Skip to contentSkip to conversation

using cdns3-imx driver on imx8qm

DISCUSSION Oliver Graute 4 participants 14 messages Mar 26, 2020 – Apr 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello,

What is the right way for using the new cdns3-imx glue usb driver on a imx8qm soc with linux-next. I added this snippet in imx8qm.dtsi and enabled the driver in the kernel configuration.

usbotg3: usb3@5b110000 {
		compatible = "cdns,usb3";
		reg = <0x0 0x5B110000 0x0 0x10000>,
			<0x0 0x5B130000 0x0 0x10000>,
			<0x0 0x5B140000 0x0 0x10000>,
			<0x0 0x5B160000 0x0 0x40000>,
			<0x0 0x5B120000 0x0 0x10000>;
		interrupt-parent = <&gic>;
		interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
				  <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
				  <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		cdns3,usbphy = <&usb3phynop1>;
		status = "disabled";
	};

In board dts I enabled this:

&usbotg3 {
	dr_mode = "host";
	status = "okay";
};

On probing I got:

[    2.932089] cdns-usb3 5b110000.usb3: missing host IRQ

I also tried to enable "fsl,imx8qm-usb3" compatible buts this results directly into a crash.

What do I miss here? some comments would be helpful.

Best Regards,

Oliver

#1 lore raw
Quoted 6 lines · Oliver Graute

Hello,

What is the right way for using the new cdns3-imx glue usb driver on a imx8qm soc with linux-next. I added this snippet in imx8qm.dtsi and enabled the driver in the kernel configuration.

Hi Oliver,

I just checked linux-next-0326, there is no imx8qm dtsi. When I worked this driver, I use a internal version based on v5.4, the dts layout is different with internal tree.

Besides, you need a PHY driver for upstream version:
https://patchwork.kernel.org/patch/11454581/

Peter

Quoted 45 lines
usbotg3: usb3@5b110000 {
		compatible = "cdns,usb3";
		reg = <0x0 0x5B110000 0x0 0x10000>,
			<0x0 0x5B130000 0x0 0x10000>,
			<0x0 0x5B140000 0x0 0x10000>,
			<0x0 0x5B160000 0x0 0x40000>,
			<0x0 0x5B120000 0x0 0x10000>;
		interrupt-parent = <&gic>;
		interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
				  <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
				  <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		cdns3,usbphy = <&usb3phynop1>;
		status = "disabled";
	};

In board dts I enabled this:

&usbotg3 {
	dr_mode = "host";
	status = "okay";
};

On probing I got:

[    2.932089] cdns-usb3 5b110000.usb3: missing host IRQ

I also tried to enable "fsl,imx8qm-usb3" compatible buts this results directly into a crash.

What do I miss here? some comments would be helpful.

Best Regards,

Oliver

Signature · 2 lines
Thanks,
Peter Chen
#2 lore raw
Quoted 11 lines · Peter Chen
Quoted 6 lines · Oliver Graute

Hello,

What is the right way for using the new cdns3-imx glue usb driver on a imx8qm soc with linux-next. I added this snippet in imx8qm.dtsi and enabled the driver in the kernel configuration.

Hi Oliver,

I just checked linux-next-0326, there is no imx8qm dtsi.

I'am currently using this series on top of linux-next-0214.

https://patchwork.kernel.org/patch/11248331/

Quoted 2 lines

When I worked this driver, I use a internal version based on v5.4, the dts layout is different with internal tree.

I looked also at:

https://source.codeaurora.org/external/imx/linux-imx/tree/arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi?h=imx_5.4.3_2.0.0

How do I adapt the usbotg3 for linux-next? I already ported some usb related dependencies from imx8-ss-conn.dtsi. But the cdns3 core driver is stucked at probe and currently I don't understand how the cdns3-imx glue layer comes into play.

Quoted 3 lines

Besides, you need a PHY driver for upstream version:
https://patchwork.kernel.org/patch/11454581/

Best Regards,

Oliver

#3 lore raw
Quoted 21 lines · Oliver Graute
Quoted 11 lines · Peter Chen
Quoted 6 lines · Oliver Graute

Hello,

What is the right way for using the new cdns3-imx glue usb driver on a imx8qm soc with linux-next. I added this snippet in imx8qm.dtsi and enabled the driver in the kernel configuration.

Hi Oliver,

I just checked linux-next-0326, there is no imx8qm dtsi.

I'am currently using this series on top of linux-next-0214.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F11248331%2F&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7C1b6963823b924b76684908d7d2344976%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637208994318640157&amp;sdata=HGG4r65ROTeY54uQArcWTZGT9%2BLrr0kndwmDegULtDw%3D&amp;reserved=0

Quoted 2 lines

When I worked this driver, I use a internal version based on v5.4, the dts layout is different with internal tree.

Quoted 9 lines

I looked also at:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fimx%2Flinux-imx%2Ftree%2Farch%2Farm64%2Fboot%2Fdts%2Ffreescale%2Fimx8-ss-conn.dtsi%3Fh%3Dimx_5.4.3_2.0.0&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7C1b6963823b924b76684908d7d2344976%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637208994318640157&amp;sdata=yTiMWh5BpWdtA%2B8Vy06KeCvg2jPzlgPOmKaM3fmK%2F6w%3D&amp;reserved=0

How do I adapt the usbotg3 for linux-next? I already ported some usb related dependencies from imx8-ss-conn.dtsi. But the cdns3 core driver is stucked at probe and currently I don't understand how the cdns3-imx glue layer comes into play.

cdns3-imx is the parent device, the cdns3 core is the child device. The example dts like below:

	usb3_lpcg: clock-controller@5b280000 {
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST registers */
				<0x5B140000 0x10000>,   /* memory area for DEVICE registers */
				<0x5B120000 0x10000>;   /* memory area for OTG/DRD registers */
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

After kernel boots up, it neither at host mode nor device mode, you need to echo host or device to role-switch sys entry.

Signature · 2 lines
Thanks,
Peter Chen
#4 lore raw
Quoted 85 lines · Peter Chen
Quoted 21 lines · Oliver Graute
Quoted 11 lines · Peter Chen
Quoted 6 lines · Oliver Graute

Hello,

What is the right way for using the new cdns3-imx glue usb driver on a imx8qm soc with linux-next. I added this snippet in imx8qm.dtsi and enabled the driver in the kernel configuration.

Hi Oliver,

I just checked linux-next-0326, there is no imx8qm dtsi.

I'am currently using this series on top of linux-next-0214.

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F11248331%2F&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7C1b6963823b924b76684908d7d2344976%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637208994318640157&amp;sdata=HGG4r65ROTeY54uQArcWTZGT9%2BLrr0kndwmDegULtDw%3D&amp;reserved=0

Quoted 2 lines

When I worked this driver, I use a internal version based on v5.4, the dts layout is different with internal tree.

Quoted 9 lines

I looked also at:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource.codeaurora.org%2Fexternal%2Fimx%2Flinux-imx%2Ftree%2Farch%2Farm64%2Fboot%2Fdts%2Ffreescale%2Fimx8-ss-conn.dtsi%3Fh%3Dimx_5.4.3_2.0.0&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7C1b6963823b924b76684908d7d2344976%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637208994318640157&amp;sdata=yTiMWh5BpWdtA%2B8Vy06KeCvg2jPzlgPOmKaM3fmK%2F6w%3D&amp;reserved=0

How do I adapt the usbotg3 for linux-next? I already ported some usb related dependencies from imx8-ss-conn.dtsi. But the cdns3 core driver is stucked at probe and currently I don't understand how the cdns3-imx glue layer comes into play.

cdns3-imx is the parent device, the cdns3 core is the child device. The example dts like below:

	usb3_lpcg: clock-controller@5b280000 {
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST registers */
Quoted 8 lines
				<0x5B140000 0x10000>,   /* memory area for DEVICE registers */
				<0x5B120000 0x10000>;   /* memory area for OTG/DRD registers */
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for device, assuming no driver

Some Idea howto fix that?

Best regards,

Oliver

#5 lore raw
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

Peter

#6 lore raw
Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok I got this for USB3_SSPHY_STATUS

[    3.057122] cdns3-imx 5b110000.usb3: wait clkvld timeout 0xb0b03827

Unfortunally my imx8qm spec is incomplete regarding the USB3_SSPHY_STATUS register.

this are my related DTS nodes:

	usb3_lpcg: clock-controller@5b280000 {
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		/* bit-offset = <0 4 16 20 24 28>; */
		clock-indices = <IMX_LPCG_CLK_0>, <IMX_LPCG_CLK_1>,
				<IMX_LPCG_CLK_4>, <IMX_LPCG_CLK_5>,
				<IMX_LPCG_CLK_6>, <IMX_LPCG_CLK_7>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		/* ranges; */
		reg = <0x0 0x5B110000 0x0 0x10000>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST registers */
				<0x5B140000 0x10000>,   /* memory area for DEVICE registers */
				<0x5B120000 0x10000>;   /* memory area for OTG/DRD registers */
			reg-names = "xhci", "dev", "otg";
			phys = <&usbphynop2>;
			phy-names = "cdns3,usb2-phy";
			status = "disabled";
		};
	};

I'am also using the SCU related clock patches from here:

https://patchwork.kernel.org/patch/11248255/

Thx for your comments,

Best regards,

Oliver

#7 lore raw

Hi,

Quoted 9 lines · Oliver Graute
Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok I got this for USB3_SSPHY_STATUS

[    3.057122] cdns3-imx 5b110000.usb3: wait clkvld timeout 0xb0b03827

Unfortunally my imx8qm spec is incomplete regarding the USB3_SSPHY_STATUS register.

for testing purposes, you could just have the bootloader enable the necessary clocks and use dummy fixed-clock in your DTS.

At least you could get something working from USB-side and focus on the clock tree after that.

Signature · 1 line
balbi
#8 lore raw
In reply to Oliver Graute
Quoted 7 lines · Oliver Graute
Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok I got this for USB3_SSPHY_STATUS

[    3.057122] cdns3-imx 5b110000.usb3: wait clkvld timeout 0xb0b03827

It indicates usb3_aclk did not open correctly. Tried to see if u-boot could work well, and see if set its assigned-clock-rates as 500000000 could work.

Peter

Quoted 75 lines

Unfortunally my imx8qm spec is incomplete regarding the USB3_SSPHY_STATUS register.

this are my related DTS nodes:

	usb3_lpcg: clock-controller@5b280000 {
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		/* bit-offset = <0 4 16 20 24 28>; */
		clock-indices = <IMX_LPCG_CLK_0>, <IMX_LPCG_CLK_1>,
				<IMX_LPCG_CLK_4>, <IMX_LPCG_CLK_5>,
				<IMX_LPCG_CLK_6>, <IMX_LPCG_CLK_7>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		/* ranges; */
		reg = <0x0 0x5B110000 0x0 0x10000>;
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST registers */
				<0x5B140000 0x10000>,   /* memory area for DEVICE registers */
				<0x5B120000 0x10000>;   /* memory area for OTG/DRD registers */
			reg-names = "xhci", "dev", "otg";
			phys = <&usbphynop2>;
			phy-names = "cdns3,usb2-phy";
			status = "disabled";
		};
	};

I'am also using the SCU related clock patches from here:

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F11248255%2F&amp;data=02%7C01%7Cpeter.chen%40nxp.com%7Ce6d163e72ed14b064f4208d7d629842f%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637213346107862080&amp;sdata=ChqqxYqxdJysskHzHP1dmF69zGVzw4PfDz%2Fim%2F0khHc%3D&amp;reserved=0

Thx for your comments,

Best regards,

Oliver

Signature · 2 lines
Thanks,
Peter Chen
#9 lore raw
In reply to Peter Chen
Quoted 83 lines · Peter Chen
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok thx, we got it fixed by replacing:

clocks = <&usb3_lpcg 1>,

          <&usb3_lpcg 0>,
          <&usb3_lpcg 4>,
          <&usb3_lpcg 2>,
          <&usb3_lpcg 3>;

with this:

clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,

          <&usb3_lpcg IMX_LPCG_CLK_0>,
          <&usb3_lpcg IMX_LPCG_CLK_7>,
          <&usb3_lpcg IMX_LPCG_CLK_4>,
          <&usb3_lpcg IMX_LPCG_CLK_5>;

now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register is very similar to another imx8qm device which runs linux-imx from NXP.

Now I try to get into USB HOST mode:

drivers/usb/cdns3/cdns3-imx.c +1 -1
@@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
        udelay(1);
 
        value = cdns_imx_readl(data, USB3_CORE_CTRL1);
-       value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
+       value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
        cdns_imx_writel(data, USB3_CORE_CTRL1, value);
 

Is this change necessary?

Do I need special changes on xhci.c do get it work with cdns-imx in host mode?

I'am stuck at:

[   16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110

I already tried to add the Intel quirk:

udelay(1000) in xhci_reset() but without success.

Is the host mode working on your side?

Best regards,

Oliver

#10 lore raw
Quoted 120 lines · Oliver Graute
Quoted 83 lines · Peter Chen
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok thx, we got it fixed by replacing:

clocks = <&usb3_lpcg 1>,

          <&usb3_lpcg 0>,
          <&usb3_lpcg 4>,
          <&usb3_lpcg 2>,
          <&usb3_lpcg 3>;

with this:

clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,

          <&usb3_lpcg IMX_LPCG_CLK_0>,
          <&usb3_lpcg IMX_LPCG_CLK_7>,
          <&usb3_lpcg IMX_LPCG_CLK_4>,
          <&usb3_lpcg IMX_LPCG_CLK_5>;

now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register is very similar to another imx8qm device which runs linux-imx from NXP.

Now I try to get into USB HOST mode:

drivers/usb/cdns3/cdns3-imx.c +1 -1
@@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
        udelay(1);
 
        value = cdns_imx_readl(data, USB3_CORE_CTRL1);
-       value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
+       value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
        cdns_imx_writel(data, USB3_CORE_CTRL1, value);
 

Is this change necessary?

Quoted 5 lines

Do I need special changes on xhci.c do get it work with cdns-imx in host mode?

I'am stuck at:

[   16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110

A bit more debug information:

[    5.988571] cdns-usb3 5b130000.cdns3: DRD version v0 (00000100)
[    6.012664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.018173] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    6.036369] xhci-hcd xhci-hcd.0.auto: // Halt the HC
[    6.041335] xhci-hcd xhci-hcd.0.auto: Resetting HCD
[    6.056364] xhci-hcd xhci-hcd.0.auto: // Reset the HC
[   16.062450] xhci-hcd xhci-hcd.0.auto: can't setup: -110
[   16.067686] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
[   16.073361] xhci-hcd: probe of xhci-hcd.0.auto failed with error -110

Best Regards,

Oliver

#11 lore raw
Quoted 114 lines · Oliver Graute
Quoted 113 lines · Oliver Graute
Quoted 83 lines · Peter Chen
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok thx, we got it fixed by replacing:

clocks = <&usb3_lpcg 1>,

          <&usb3_lpcg 0>,
          <&usb3_lpcg 4>,
          <&usb3_lpcg 2>,
          <&usb3_lpcg 3>;

with this:

clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,

          <&usb3_lpcg IMX_LPCG_CLK_0>,
          <&usb3_lpcg IMX_LPCG_CLK_7>,
          <&usb3_lpcg IMX_LPCG_CLK_4>,
          <&usb3_lpcg IMX_LPCG_CLK_5>;

now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register is very similar to another imx8qm device which runs linux-imx from NXP.

Now I try to get into USB HOST mode:

drivers/usb/cdns3/cdns3-imx.c +0 -0
@@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
        udelay(1);
 
Quoted 6 lines
Quoted 6 lines
drivers/usb/cdns3/cdns3-imx.c +1 -1
        value = cdns_imx_readl(data, USB3_CORE_CTRL1);
-       value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
+       value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
        cdns_imx_writel(data, USB3_CORE_CTRL1, value);
 

Is this change necessary?

No

Quoted 3 lines
Quoted 3 lines

Do I need special changes on xhci.c do get it work with cdns-imx in host mode?

No

Quoted 6 lines
Quoted 3 lines

I'am stuck at:

[   16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110

A bit more debug information:

Quoted 10 lines
[    5.988571] cdns-usb3 5b130000.cdns3: DRD version v0 (00000100)
[    6.012664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.018173] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    6.036369] xhci-hcd xhci-hcd.0.auto: // Halt the HC
[    6.041335] xhci-hcd xhci-hcd.0.auto: Resetting HCD
[    6.056364] xhci-hcd xhci-hcd.0.auto: // Reset the HC
[   16.062450] xhci-hcd xhci-hcd.0.auto: can't setup: -110
[   16.067686] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
[   16.073361] xhci-hcd: probe of xhci-hcd.0.auto failed with error -110

set dr_mode = "otg" at dts, and after boot up, run below commands at console:

echo host > /sys/class/usb_role/5b130000.cdns3-role-switch/role

Signature · 2 lines
Thanks,
Peter Chen
#12 lore raw
Quoted 147 lines · Peter Chen
Quoted 114 lines · Oliver Graute
Quoted 113 lines · Oliver Graute
Quoted 83 lines · Peter Chen
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok thx, we got it fixed by replacing:

clocks = <&usb3_lpcg 1>,

          <&usb3_lpcg 0>,
          <&usb3_lpcg 4>,
          <&usb3_lpcg 2>,
          <&usb3_lpcg 3>;

with this:

clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,

          <&usb3_lpcg IMX_LPCG_CLK_0>,
          <&usb3_lpcg IMX_LPCG_CLK_7>,
          <&usb3_lpcg IMX_LPCG_CLK_4>,
          <&usb3_lpcg IMX_LPCG_CLK_5>;

now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register is very similar to another imx8qm device which runs linux-imx from NXP.

Now I try to get into USB HOST mode:

drivers/usb/cdns3/cdns3-imx.c +0 -0
@@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
        udelay(1);
 
Quoted 6 lines
Quoted 6 lines
drivers/usb/cdns3/cdns3-imx.c +1 -1
        value = cdns_imx_readl(data, USB3_CORE_CTRL1);
-       value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
+       value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
        cdns_imx_writel(data, USB3_CORE_CTRL1, value);
 

Is this change necessary?

No

Quoted 3 lines
Quoted 3 lines

Do I need special changes on xhci.c do get it work with cdns-imx in host mode?

No

Quoted 6 lines
Quoted 3 lines

I'am stuck at:

[   16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110

A bit more debug information:

Quoted 10 lines
[    5.988571] cdns-usb3 5b130000.cdns3: DRD version v0 (00000100)
[    6.012664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.018173] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    6.036369] xhci-hcd xhci-hcd.0.auto: // Halt the HC
[    6.041335] xhci-hcd xhci-hcd.0.auto: Resetting HCD
[    6.056364] xhci-hcd xhci-hcd.0.auto: // Reset the HC
[   16.062450] xhci-hcd xhci-hcd.0.auto: can't setup: -110
[   16.067686] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
[   16.073361] xhci-hcd: probe of xhci-hcd.0.auto failed with error -110
Quoted 4 lines

set dr_mode = "otg" at dts, and after boot up, run below commands at console:

echo host > /sys/class/usb_role/5b130000.cdns3-role-switch/role

I tried that but still get same result. Is there a reason to set dr_mode = "otg" and do the host mode later on?

Are there any tweaks to get this usb controller working in host mode?

Some further hints for debugging would be helpfull.

Best Regards,

Oliver

#13 lore raw
Quoted 151 lines · Oliver Graute
Quoted 150 lines · Peter Chen
Quoted 114 lines · Oliver Graute
Quoted 113 lines · Oliver Graute
Quoted 83 lines · Peter Chen
Quoted 80 lines
Quoted 26 lines
  
		compatible = "fsl,imx8qxp-lpcg";
		reg = <0x5b280000 0x10000>;
		#clock-cells = <1>;
		bit-offset = <0 4 16 20 24 28>;
		clocks = <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_PER>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&conn_ipg_clk>,
			 <&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		clock-output-names = "usb3_app_clk",
				     "usb3_lpm_clk",
				     "usb3_ipg_clk",
				     "usb3_core_pclk",
				     "usb3_phy_clk",
				     "usb3_aclk";
		power-domains = <&pd IMX_SC_R_USB_2_PHY>;
	};

	usbotg3: usb3@5b110000 {
		compatible = "fsl,imx8qm-usb3";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;
		reg = <0x5B110000 0x10000>;
Quoted 8 lines
		clocks = <&usb3_lpcg 1>,
			 <&usb3_lpcg 0>,
			 <&usb3_lpcg 5>,
			 <&usb3_lpcg 2>,
			 <&usb3_lpcg 3>;
		clock-names = "usb3_lpm_clk", "usb3_bus_clk", "usb3_aclk",
			"usb3_ipg_clk", "usb3_core_pclk";
		assigned-clocks = <&clk IMX_SC_R_USB_2

IMX_SC_PM_CLK_PER>,

Quoted 8 lines
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MISC>,
			<&clk IMX_SC_R_USB_2 IMX_SC_PM_CLK_MST_BUS>;
		assigned-clock-rates = <125000000>, <12000000>, <250000000>;
		power-domains = <&pd IMX_SC_R_USB_2>;
		status = "disabled";

		usbotg3_cdns3: cdns3 {
			compatible = "cdns,usb3";
Quoted 8 lines
			#address-cells = <1>;
			#size-cells = <1>;
			interrupt-parent = <&gic>;
			interrupts = <GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>,
					<GIC_SPI 271 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-names = "host", "peripheral", "otg";
			reg = <0x5B130000 0x10000>,     /* memory area for HOST

registers */

Quoted 1 line
				<0x5B140000 0x10000>,   /* memory area for

DEVICE registers */

Quoted 1 line
				<0x5B120000 0x10000>;   /* memory area for

OTG/DRD registers */

Quoted 6 lines
			reg-names = "xhci", "dev", "otg";
			phys = <&usb3_phy>;
			phy-names = "cdns3,usb3-phy";
			status = "disabled";
		};
	};

Hello Peter,

thx for the dts example. Now I get "wait clkvld timeout" in "cdns_imx_noncore_init()" So USB3_SSPHY_STATUS register seems to be wrong.

dmesg | grep imx

[    1.065445] cdns3-imx 5b110000.usb3: Adding to iommu group 0
[    1.257309] imx-scu scu: NXP i.MX SCU Initialized
[    1.275489] imx-scu-clk: probe of gpt0_clk failed with error -5
[    1.291143] imx-scu-clk: probe of pwm_clk failed with error -22
[    1.302517] imx-scu-clk: probe of lcd_clk failed with error -22
[    1.341405] imx8qm-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    3.029484] cdns3-imx 5b110000.usb3: wait clkvld timeout
[    3.034891] cdns3-imx: probe of 5b110000.usb3 failed with error -110
[    3.237393] sdhci-esdhc-imx 5b030000.mmc: Got CD GPIO
[    3.242468] sdhci-esdhc-imx 5b030000.mmc: Got WP GPIO
[    3.316687] imx8qxp-lpcg-clk 5a4a0000.clock-controller: ignoring dependency for
Quoted 2 lines

device, assuming no driver

Quoted 2 lines

Make sure the five clocks in dts are correct, and print the USB3_SSPHY_STATUS if timeout still exists.

ok thx, we got it fixed by replacing:

clocks = <&usb3_lpcg 1>,

          <&usb3_lpcg 0>,
          <&usb3_lpcg 4>,
          <&usb3_lpcg 2>,
          <&usb3_lpcg 3>;

with this:

clocks = <&usb3_lpcg IMX_LPCG_CLK_1>,

          <&usb3_lpcg IMX_LPCG_CLK_0>,
          <&usb3_lpcg IMX_LPCG_CLK_7>,
          <&usb3_lpcg IMX_LPCG_CLK_4>,
          <&usb3_lpcg IMX_LPCG_CLK_5>;

now the "wait clkvld timeout" is gone and the USB3_SSPHY_STATUS register is very similar to another imx8qm device which runs linux-imx from NXP.

Now I try to get into USB HOST mode:

drivers/usb/cdns3/cdns3-imx.c +0 -0
@@ -113,11 +115,11 @@ static int cdns_imx_noncore_init(struct cdns_imx *data)
        udelay(1);
 
Quoted 6 lines
Quoted 6 lines
drivers/usb/cdns3/cdns3-imx.c +1 -1
        value = cdns_imx_readl(data, USB3_CORE_CTRL1);
-       value = (value & ~MODE_STRAP_MASK) | OTG_MODE | OC_DISABLE;
+       value = (value & ~MODE_STRAP_MASK) | HOST_MODE | OC_DISABLE;
        cdns_imx_writel(data, USB3_CORE_CTRL1, value);
 

Is this change necessary?

No

Quoted 3 lines
Quoted 3 lines

Do I need special changes on xhci.c do get it work with cdns-imx in host mode?

No

Quoted 6 lines
Quoted 3 lines

I'am stuck at:

[   16.697525] xhci-hcd xhci-hcd.0.auto: can't setup: -110

A bit more debug information:

Quoted 10 lines
[    5.988571] cdns-usb3 5b130000.cdns3: DRD version v0 (00000100)
[    6.012664] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
[    6.018173] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
[    6.036369] xhci-hcd xhci-hcd.0.auto: // Halt the HC
[    6.041335] xhci-hcd xhci-hcd.0.auto: Resetting HCD
[    6.056364] xhci-hcd xhci-hcd.0.auto: // Reset the HC
[   16.062450] xhci-hcd xhci-hcd.0.auto: can't setup: -110
[   16.067686] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
[   16.073361] xhci-hcd: probe of xhci-hcd.0.auto failed with error -110

set dr_mode = "otg" at dts, and after boot up, run below commands at console:

Quoted 8 lines
Quoted 1 line

echo host > /sys/class/usb_role/5b130000.cdns3-role-switch/role

I tried that but still get same result. Is there a reason to set dr_mode = "otg" and do the host mode later on?

Are there any tweaks to get this usb controller working in host mode?

Some further hints for debugging would be helpfull.

it is working now. The usb controller is in host mode now :-)

Your cadence salvo phy driver makes the difference here.

Quoted 1 line

https://patchwork.kernel.org/patch/11454581/

and the example from here:

https://patchwork.kernel.org/patch/11454579/

Best regards,

Oliver