All of lore.kernel.org
 help / color / mirror / Atom feed
* Milk-V Duo 256M: USB peripheral mode works on mainline, how should dr_mode be handled?
@ 2026-10-24 15:05 Chen-Yu Yeh
  2026-10-24 23:23 ` Inochi Amaoto
  0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Yeh @ 2026-10-24 15:05 UTC (permalink / raw)
  To: Inochi Amaoto, Chen Wang; +Cc: Hiago De Franco, sophgo

Hi Inochi, Chen,

I tested the USB port of the Milk-V Duo 256M (SG2002) in peripheral
mode on mainline and it works. Before sending a patch I would like to
ask which way you prefer, since it touches the board's default.

What I tested (v7.3-rc5, CONFIG_USB_DWC2_DUAL_ROLE=y, g_ether built in),
with only this change on top of sg2002-milkv-duo256m.dtb:

  &usb {
  	dr_mode = "peripheral";
  };

the bare board, plugged into a PC through its USB-C port, enumerates at
high speed:

  usb 3-9: new high-speed USB device number 53 using xhci_hcd
  usb 3-9: Product: RNDIS/Ethernet Gadget
  cdc_ether 3-9:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-9, CDC Ethernet Device, 12:ca:4b:aa:b9:31

ping and ssh work over it, and iperf3 gives about 111 Mbit/s from the
PC to the board and 88 Mbit/s from the board to the PC. No PHY changes
were needed; the ID override in the top syscon can stay as it is.

Today all CV18xx boards set dr_mode = "host". On the Duo 256M, though,
the USB-C port is the board's only USB connector, and the vendor image
uses it in device mode by default (USB networking, which is how most
users first log in). Host mode is needed mainly with the USB & Ethernet
IO board, whose USB hub hangs off the same controller.

I see two options:

 A) Keep "host" as the default and add a separate overlay that switches
    the port to peripheral mode, like the ethernet one.

 B) Make "peripheral" the default for the bare board, and have the
    existing IO board overlay (sg2002-milkv-duo256m-eth.dtso) set
    dr_mode = "host", since that board is what needs host mode.

B matches how the hardware is normally used, but it changes the
default for anyone using the bare board as a host today, for example
through an OTG adapter. A is the conservative choice.

Which one would you prefer? I'm happy to send either, and to do the
same for the other Duo boards if you want them kept consistent
(Hiago, I've added you since the Duo overlay would be affected the
same way).

Thanks,
Chen-Yu

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-27 16:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-24 15:05 Milk-V Duo 256M: USB peripheral mode works on mainline, how should dr_mode be handled? Chen-Yu Yeh
2026-10-24 23:23 ` Inochi Amaoto
2026-10-27  7:36   ` Chen-Yu Yeh
2026-10-27  8:46     ` Inochi Amaoto
2026-10-27 16:43       ` 葉宸佑

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.