How to enable usb dwc2 function?

I use armbian system and I want to usb otg port to be a mass storage or a gadget device , but it can not work, maybe it is dwc2 problem, how to enbale dwc2?

Hey,
I had to implement 2 changes:

  1. re-compile the DTS with ā€˜dr_mode = ā€œotgā€;ā€™
    (ref https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi )
  2. all ā€œlibcompositeā€
    to the /etc/module file.

Thanks,but it is not work, the dts I changed:

usb: usb@ffe09000 {
status = ā€œokayā€;
compatible = ā€œamlogic,meson-g12a-usb-ctrlā€;
reg = <0x0 0xffe09000 0x0 0xa0>;
interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <2>;
#size-cells = <2>;
ranges;

  clocks = <&clkc CLKID_USB>;
  resets = <&reset RESET_USB>;

  dr_mode = "otg";

  phys = <&usb2_phy0>, <&usb2_phy1>,
         <&usb3_pcie_phy PHY_TYPE_USB3>;
  phy-names = "usb2-phy0", "usb2-phy1", "usb3-phy0";

  dwc2: usb@ff400000 {
    compatible = "amlogic,meson-g12a-usb", "snps,dwc2";
    reg = <0x0 0xff400000 0x0 0x40000>;
    interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&clkc CLKID_USB1_DDR_BRIDGE>;
    clock-names = "otg";
    phys = <&usb2_phy1>;
    phy-names = "usb2-phy";
    dr_mode = "peripheral";
    g-rx-fifo-size = <192>;
    g-np-tx-fifo-size = <128>;
    g-tx-fifo-size = <128 128 16 16 16>;
  };

  dwc3: usb@ff500000 {
    compatible = "snps,dwc3";
    reg = <0x0 0xff500000 0x0 0x100000>;
    interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_HIGH>;
    dr_mode = "host";
    snps,dis_u2_susphy_quirk;
    snps,quirk-frame-length-adjustment = <0x20>;
    snps,parkmode-disable-ss-quirk;
  };
};

And I have already insmod the g_ether or g_mass_storage or g_serial module, it can not work.

Hi. We have fixed issue with usb dwc2 otg function.

You are right. We need to set ā€˜dr_modeā€™ of usb node to ā€˜otgā€™.

For usage of USB Mass Storage, please check https://wiki.radxa.com/Zero/dev/usb-mass-storage.

:champagne: ADB is supported. You can access Radxa Zero via USB.

Why not try the latest system images, https://github.com/radxa/radxa-zero-images-released/releases/tag/radxa-zero-v20211028?

1 Like

how about g_ether? would be nice to have it.