cancel
Showing results for 
Search instead for 
Did you mean: 

USB not found

jhi
Senior

I have problem to get USB to work. I'm using custom board but I know that USB works because if I boot the board with the delivered image (MyIR) the USB works. I'm using buildroot with the 5.10 kernel and the linux kernel configuration from bootlin git.

In TF-A I have enabled CLK_USBPHY_HSE and CLK_USBO_USBPHY.

Kernel device tree:

&usbh_ehci {
	phys = <&usbphyc_port0>;           
	phy-names = "usb";
	status = "okay";
};
 
&usbh_ohci {
   	phys = <&usbphyc_port0>;           
	phy-names = "usb";
	status = "okay";
};
 
&usbotg_hs {
	compatible = "st,stm32mp15-hsotg", "snps,dwc2";
	phys = <&usbphyc_port1 0>;         
	phy-names = "usb2-phy";
	dr_mode = "host";                  
	status = "okay";                   
};
 
&usbphyc {
	status = "okay";
	
};
 
&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
	st,phy-tuning = <&usb_phy_tuning>;
};
 
&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
	st,phy-tuning = <&usb_phy_tuning>;
};

Kernel bootlog (I enabled dwc2 debugging)

# dmesg | grep -i usb
[    0.114896] usbcore: registered new interface driver usbfs
[    0.114983] usbcore: registered new interface driver hub
[    0.115069] usbcore: registered new device driver usb
[    1.743100] usb33: supplied by vdd_usb
[    1.791657] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    1.791754] usbcore: registered new interface driver pegasus
[    1.791852] usbcore: registered new interface driver asix
[    1.791915] usbcore: registered new interface driver ax88179_178a
[    1.791976] usbcore: registered new interface driver cdc_ether
[    1.792055] usbcore: registered new interface driver smsc75xx
[    1.792133] usbcore: registered new interface driver smsc95xx
[    1.792193] usbcore: registered new interface driver net1080
[    1.792264] usbcore: registered new interface driver cdc_subset
[    1.792325] usbcore: registered new interface driver zaurus
[    1.792413] usbcore: registered new interface driver cdc_ncm
[    1.793050] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 7975fc9b
[    1.793872] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.794375] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.795291] usbcore: registered new interface driver usb-storage
[    1.807092] usbcore: registered new interface driver usbhid
[    1.807108] usbhid: USB HID core driver
[    1.866395] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 3bad9e35
[    3.243027] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 474d4785
[    3.376990] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 13a1f023
[    3.385604] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 1c356f89
[    3.462241] dwc2 49000000.usb-otg: mapped PA 49000000 to VA 46c345d1
[    3.640278] dwc2 49000000.usb-otg: mapped PA 49000000 to VA cdf58676

An this is from the original image:

0.309427] USB33: supplied by regulator-dummy
[    0.313788] usbcore: registered new interface driver usbfs
[    0.313872] usbcore: registered new interface driver hub
[    0.314020] usbcore: registered new device driver usb
[    0.442943] stm32-usbphyc 5a006000.usbphyc: Linked as a consumer to regulator.5
[    0.443071] stm32-usbphyc 5a006000.usbphyc: Linked as a consumer to regulator.6
[    0.443197] stm32-usbphyc 5a006000.usbphyc: Linked as a consumer to regulator.3
[    0.443805] stm32-usbphyc 5a006000.usbphyc: registered rev:1.0
[    1.783244] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
[    1.790785] usbcore: registered new interface driver pegasus
[    1.796362] usbcore: registered new interface driver asix
[    1.801796] usbcore: registered new interface driver ax88179_178a
[    1.807882] usbcore: registered new interface driver cdc_ether
[    1.813689] usbcore: registered new interface driver smsc75xx
[    1.819497] usbcore: registered new interface driver smsc95xx
[    1.825172] usbcore: registered new interface driver net1080
[    1.830875] usbcore: registered new interface driver cdc_subset
[    1.836760] usbcore: registered new interface driver zaurus
[    1.842426] usbcore: registered new interface driver cdc_ncm
[    1.848662] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_d not found, using dummy regulator
[    1.857041] dwc2 49000000.usb-otg: Linked as a consumer to regulator.0
[    1.863539] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_a not found, using dummy regulator
[    1.998801] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.009595] ehci-platform 5800d000.usbh-ehci: EHCI Host Controller
[    2.015330] ehci-platform 5800d000.usbh-ehci: new USB bus registered, assigned bus number 1
[    2.024135] ehci-platform 5800d000.usbh-ehci: irq 64, io mem 0x5800d000
[    2.057519] ehci-platform 5800d000.usbh-ehci: USB 2.0 started, EHCI 1.00
[    2.064088] hub 1-0:1.0: USB hub found
[    2.071964] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    2.082427] ohci-platform 5800c000.usbh-ohci: Generic Platform OHCI controller
[    2.089247] ohci-platform 5800c000.usbh-ohci: new USB bus registered, assigned bus number 2
[    2.097907] ohci-platform 5800c000.usbh-ohci: irq 63, io mem 0x5800c000
[    2.172746] hub 2-0:1.0: USB hub found
[    2.180840] usbcore: registered new interface driver cdc_acm
[    2.185045] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    2.193286] usbcore: registered new interface driver usb-storage
[    2.199289] usbcore: registered new interface driver option
[    2.204697] usbserial: USB Serial support registered for GSM modem (1-port)
[    2.437543] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    2.501578] usbcore: registered new interface driver usbhid
[    2.505770] usbhid: USB HID core driver
[    2.641447] usb-storage 1-1:1.0: USB Mass Storage device detected
[    2.689908] scsi host0: usb-storage 1-1:1.0
[    2.818748] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_d not found, using dummy regulator
[    2.826938] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_a not found, using dummy regulator
[    2.967633] dwc2 49000000.usb-otg: EPs: 9, dedicated fifos, 952 entries in SPRAM
[    2.974629] dwc2 49000000.usb-otg: DWC OTG Controller
[    2.978747] dwc2 49000000.usb-otg: new USB bus registered, assigned bus number 3
[    2.986093] dwc2 49000000.usb-otg: irq 51, io mem 0x49000000
[    2.993025] hub 3-0:1.0: USB hub found
[    8.708645] usbcore: registered new interface driver uas
[   18.015529] usb0: HOST MAC 60:0c:41:e6:65:40
[   18.022923] usb0: MAC 8e:a1:99:df:67:b5
[   18.025355] dwc2 49000000.usb-otg: bound driver configfs-gadget
[   18.208866] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready

I also tried with the original device tree configuration (this was for Kernel 4.19) which also didn't work with 5.10:

&i2c4 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c4_pins_a>;
	pinctrl-1 = <&i2c4_pins_sleep_a>;
	i2c-scl-rising-time-ns = <185>;
	i2c-scl-falling-time-ns = <20>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
 
	stusb1600@28 {
		compatible = "st,stusb1600";
		reg = <0x28>;
		interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
		interrupt-parent = <&gpiog>;
		pinctrl-names = "default";
		pinctrl-0 = <&stusb1600_pins_a>;
		status = "okay";
		vdd-supply = <&vin>;
 
		connector {
			compatible = "usb-c-connector";
			label = "USB-C";
			power-role = "dual";
			power-opmode = "default";
 
			port {
				con_usbotg_hs_ep: endpoint {
					remote-endpoint = <&usbotg_hs_ep>;
				};
			};
		};
	};
};
 
/*usb host*/
&usbh_ehci {
	phys = <&usbphyc_port0>;
	phy-names = "usb";
	status = "okay";
};
 
/*USB*/
&usbh_ohci {
   phys = <&usbphyc_port0>; 
   phy-names = "usb";
   status = "okay";
};
 
/*otg*/
&usbotg_hs {
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	usb-role-switch;
	status = "okay";
 
	port {
		usbotg_hs_ep: endpoint {
			remote-endpoint = <&con_usbotg_hs_ep>;
		};
	};
};
 
&usbphyc {
	status = "okay";
	
};
 
&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
	st,phy-tuning = <&usb_phy_tuning>;
};
 
&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
	st,phy-tuning = <&usb_phy_tuning>;
};

But all I want is to get the USB-host work, so I don't really need the USB-C stuff. Any ideas what I'm doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
jhi
Senior

So got it finally working. I had to add pinctrl.

&usbotg_hs {
	pinctrl-0 = <&usbotg_fs_dp_dm_pins_a>;
	pinctrl-names = "default";
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	dr_mode = "host";
 
	status = "okay";
};

This isn't really done in any of the examples I have seen. Where is this usually done? Not even CubeMX adds this anywhere when I configure only USB host.

View solution in original post

1 REPLY 1
jhi
Senior

So got it finally working. I had to add pinctrl.

&usbotg_hs {
	pinctrl-0 = <&usbotg_fs_dp_dm_pins_a>;
	pinctrl-names = "default";
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	dr_mode = "host";
 
	status = "okay";
};

This isn't really done in any of the examples I have seen. Where is this usually done? Not even CubeMX adds this anywhere when I configure only USB host.