View: 15046|Reply: 2

Using OTG as normal USB port

[Copy link]

2

threads

6

posts

22

credits

Novice

Rank: 1

credits
22
Published in 2018-2-25 00:13:47 | Show all floors |Read mode
Edited by Chourizo at 2018-2-25 00:30

Orange pi zero with armbian 5.38 stable, kernel 4.14.18-sunxi, and the expansion board with two usbs. All usbs working except the OTG, that I want to use as a regular usb.
To do so, I've shorted Q10 to have power in the,  OTG and I am powering the board through the GPIOS, but still nothing shows up. I have enough power for everything.

I enabled all the usbs in armbian-config, but still nothing works. I think it might be a software issue related with the default behavior as OTG. I removed g_serial, but still nothing shows up.

Any suggestion? How do I enable the restore the normal usb mode for the OTG port?

NOTE: I just saw that /sys/devices/platform/soc/1c19000.usb/musb-hdrc.1.auto/udc/musb-hdrc.1.auto/is_otg is 1, but I cannot change it even as root.



2

threads

6

posts

22

credits

Novice

Rank: 1

credits
22
 Author| Published in 2018-2-25 09:27:36 | Show all floors
Edited by Chourizo at 2018-2-25 09:45

Digging in the DTB file, I see that the OTG port and the other ports look totally different. I'm not an expert on that, so I'd appreciate some help. Has anyone ever used the OTG port before on a zero to access a flash drive for example?I tried changing the status of usb_otg and usbphy to disabled in the DTB file, but no changes.

usb_otg = "/soc/usb@01c19000";
usbphy = "/soc/phy@01c19400";
ehci0 = "/soc/usb@01c1a000";
ohci0 = "/soc/usb@01c1a400";
ehci1 = "/soc/usb@01c1b000";
ohci1 = "/soc/usb@01c1b400";
ehci2 = "/soc/usb@01c1c000";
ohci2 = "/soc/usb@01c1c400";
ehci3 = "/soc/usb@01c1d000";
ohci3 = "/soc/usb@01c1d400";


  1.           usb@01c19000 {
  2.                         compatible = "allwinner,sun8i-h3-musb";
  3.                         reg = <0x1c19000 0x400>;
  4.                         clocks = <0x6 0x20>;
  5.                         resets = <0x6 0x11>;
  6.                         interrupts = <0x0 0x47 0x4>;
  7.                         interrupt-names = "mc";
  8.                         phys = <0x18 0x0>;
  9.                         phy-names = "usb";
  10.                         extcon = <0x18 0x0>;
  11.                         status = "okay";
  12.                         dr_mode = "peripheral";
  13.                         linux,phandle = <0x45>;
  14.                         phandle = <0x45>;
  15.                 };

  16.                 phy@01c19400 {
  17.                         compatible = "allwinner,sun8i-h3-usb-phy";
  18.                         reg = <0x1c19400 0x2c 0x1c1a800 0x4 0x1c1b800 0x4 0x1c1c800 0x4 0x1c1d800 0x4>;
  19.                         reg-names = "phy_ctrl", "pmu0", "pmu1", "pmu2", "pmu3";
  20.                         clocks = <0x6 0x58 0x6 0x59 0x6 0x5a 0x6 0x5b>;
  21.                         clock-names = "usb0_phy", "usb1_phy", "usb2_phy", "usb3_phy";
  22.                         resets = <0x6 0x0 0x6 0x1 0x6 0x2 0x6 0x3>;
  23.                         reset-names = "usb0_reset", "usb1_reset", "usb2_reset", "usb3_reset";
  24.                         status = "okay";
  25.                         #phy-cells = <0x1>;
  26.                         usb0_id_det-gpios = <0x14 0x6 0xc 0x0>;
  27.                         linux,phandle = <0x18>;
  28.                         phandle = <0x18>;
  29.                 };
Copy code

2

threads

6

posts

22

credits

Novice

Rank: 1

credits
22
 Author| Published in 2018-2-25 10:17:54 | Show all floors
Got it! All I had to do is change the line:
                        dr_mode = "peripheral";

to                         dr_mode = "host";

Recompile to a DTB with dtc, and replace the file in /boot/dtb

I have all 4 usb working now at once in the orange pi zero.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list