Hi. Is there a way to force the USB (device) to operate in FullSpeed mode instead of HiSpeed?..
USB Device in FullSpeed
You can try to edit the device tree to add the following to the dwc node:
maximum-speed = "full-speed";
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/usb/generic.txt
How to do that in a Debain or Armbian image? Which file needs to be modified?
Similar to this post:
First check your kernel version, find the dtb file booting, then de-compile it and edit it.
I decompiled the dtb file ‘rk3308-rock-pi-s.dtb’ into dts using following command:
dtc -I dtb -O dts -o rk3308-rock-pi-s.dts rk3308-rock-pi-s.dtb
In the resulting .dts file there were three USB nodes:
usb@ff400000 {
compatible = “rockchip,rk3066-usb\0snps,dwc2”;
reg = < 0x00 0xff400000 0x00 0x40000 >;
interrupts = < 0x00 0x42 0x04 >;
clocks = < 0x02 0x9e >;
clock-names = “otg”;
dr_mode = “otg”;
g-np-tx-fifo-size = < 0x10 >;
g-rx-fifo-size = < 0x118 >;
g-tx-fifo-size = < 0x100 0x80 0x80 0x40 0x20 0x10 >;
g-use-dma;
phys = < 0x67 >;
phy-names = “usb2-phy”;
status = “okay”;
phandle = < 0xc8 >;
};
usb@ff440000 {
compatible = "generic-ehci";
reg = < 0x00 0xff440000 0x00 0x10000 >;
interrupts = < 0x00 0x47 0x04 >;
clocks = < 0x02 0x9f 0x02 0xa0 0x1b >;
clock-names = "usbhost\0arbiter\0utmi";
phys = < 0x68 >;
phy-names = "usb";
status = "okay";
phandle = < 0xc9 >;
};
usb@ff450000 {
compatible = "generic-ohci";
reg = < 0x00 0xff450000 0x00 0x10000 >;
interrupts = < 0x00 0x48 0x04 >;
clocks = < 0x02 0x9f 0x02 0xa0 0x1b >;
clock-names = "usbhost\0arbiter\0utmi";
phys = < 0x68 >;
phy-names = "usb";
status = "okay";
phandle = < 0xca >;
};
There was no dwc node in that file, not even as subnode in one of the usb nodes.
From RK3308 reference manual, I found that usb@ff400000 is the node for USB OTG. So I added the maximum-speed parameter in that node like this:
usb@ff400000 {
compatible = “rockchip,rk3066-usb\0snps,dwc2”;
reg = < 0x00 0xff400000 0x00 0x40000 >;
interrupts = < 0x00 0x42 0x04 >;
clocks = < 0x02 0x9e >;
clock-names = “otg”;
dr_mode = “otg”;
g-np-tx-fifo-size = < 0x10 >;
g-rx-fifo-size = < 0x118 >;
g-tx-fifo-size = < 0x100 0x80 0x80 0x40 0x20 0x10 >;
g-use-dma;
phys = < 0x67 >;
phy-names = “usb2-phy”;
status = “okay”;
phandle = < 0xc8 >;
maximum-speed = “full-speed”;
};
I recompiled the .dts using following command:
dtc -I dts -O dtb -o rk3308-rock-pi-s_2.dtb rk3308-rock-pi-s.dts
Edited the /boot/uEnv.txt file to load the new dtb file:
fdtfile=rockchip/rk3308-rock-pi-s_2.dtb
and rebooted. But still OTG was not working in forced Full-speed mode. I loaded g_ether driver using modprobe and connected usb to a pc but it was trying to connect in high-speed.
dmesg output:
root@rockpis:~# modprobe g_ether
[ 180.861975] using random self ethernet address
[ 180.862622] using random host ethernet address
[ 180.864102] usb0: HOST MAC 0e:ba:71:f1:99:04
[ 180.872148] usb0: MAC 86:8a:c6:06:f6:4f
[ 180.872621] using random self ethernet address
[ 180.873084] using random host ethernet address
[ 180.873654] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 180.874360] g_ether gadget: g_ether ready
[ 180.877826] dwc2 ff400000.usb: bound driver g_ether
root@rockpis:~# [ 235.819745] dwc2 ff400000.usb: new device is high-speed
[ 236.568559] dwc2 ff400000.usb: new device is high-speed
[ 237.348594] dwc2 ff400000.usb: new device is high-speed
[ 238.128627] dwc2 ff400000.usb: new device is high-speed