On 6/4/24 6:33 PM, Sebastian Reichel wrote:
Enable support for the fusb302 USB Type-C controller.

This will do early USB PD (power deliver) negotiation, which must happen
within 5 seconds after the USB-C connector has plugged in according to
the specification. It takes almost 5 seconds to go through the bootchain
on Rock 5B and jump to the operating system. When the Linux initializes
the fusb302 usually 20-30 seconds have gone since the device has been
plugged, which is far too late. The USB PD power source reacts with a
hard reset, which disables VBUS for some time. This is not a problem for
a battery driven device, but Rock 5B will loose its power-supply and
reset. By initializing PD in U-Boot, this can be avoided.

The DT node can be sourced from the Linux kernel DT in the future,
but to get things going it makes sense to add it in the U-Boot
specific file for now. Because of the reset issue it is important
to get support in U-Boot first.

[...]

+int misc_init_r(void)
+{
+       struct udevice *dev;
+       int ret;
+
+       ret = tcpm_get("usb-typec@22", &dev);
+       if (ret) {
+               printf("Failed to probe Type-C controller\n");
+               return 0;
+       }
+
+       return 0;
+}

A code comment similar to commit message content would be nice here.

Reply via email to