On Fri, 30 Jun 2023 10:16:35 +0200 Maxime Ripard <mripard@xxxxxxxxxx> wrote: Hi, > On Thu, Jun 29, 2023 at 08:34:10PM +0100, Andre Przywara wrote: > > > > > +&usbphy { > > > > > + usb0_id_det-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; > > > > Where is this pin connected to, in the USB-C connector? One of the CC > > pins? > > > > > > > + status = "okay"; > > > > > > > > So in the commit message you say "USB-C for power", but this here > > > > describes a full featured USB port. So does that work? Can you use it as a > > > > gadget, but also as a host? > > > > > > Yes, it's an OTG port with the ID pin pulled to ground. > > > > Do you mean both CC pins? IIRC this means it's hardwired as a > > peripheral (UFP). > > > > If I ignore the ID pin above, this looks like on the OrangePi Zero2 or > > the MangoPi MQ-R. In those cases we put peripheral in the DT, as this > > is what this connection seems to indicate. That *can* be used a host as > > well, with the "right" cable, but it's not really a well supported > > configuration, so we leave this up to people to change this locally, > > should they really desire so. > > The ID pin above is exactly what makes "the right cable" works: > depending on the state of the ID pin the controller will act either as a > peripheral or a host. Dual-mode works just fine, so if the hardware > supports it there's no reason not to enable it. Mmmh, I think that's correct for an USB micro-B socket, but this is a USB type C one. I don't think USB type C role switching can be easily implemented with just a single GPIO, probably not even with two purely digital GPIOs, as you would need some more clever voltage detection circuitry. For a simple connection via a USB-2.0 A<->C cable this probably doesn't matter (as nothing happens to the CC pins?), and a USB-C thumb drive probably would work as well, but I doubt those boards can properly detect that automatically. Chris, can you check how many pins from the type C connector are actually used on the board? Can you follow the traces? Does it just pull CC1 and CC2 to GND, via a resistor? Or are those pins somehow connected to the SoC, or even a separate USB-C controller chip? Maybe also worth checking if the stock OS can detect hosts or devices attached automatically. I am not really familiar with the USB type C situation in those simplified USB-2.0-only setups, so if anyone can shed some light on this, I'd be grateful. Cheers, Andre