add NXP imx8mp usb support
Subsystems (5)
cover add NXP imx8mp usb support
NXP imx8MPlus integrates 2 indentical dwc3 3.30b IP with additional wakeup logic to support low power, this wakeup logic has a separated interrupt which can generate events with suspend clock(32K), due to SoC integration limitation, 64bit address can't be supported for host controller, but the xhci capability register HCCPARAMS1 AC64 bit is 1, so introduce a new property snps,xhci-dis-64bit-support-quirk to enable existing quirk XHCI_NO_64BIT_SUPPORT for OF platforms.
Li Jun (6):
dt-bindings: usb: dwc3: add property to disable xhci 64bit support
usb: host: xhci-plat: add quirk for XHCI_NO_64BIT_SUPPORT
usb: dwc3: add imx8mp dwc3 glue layer driver
arm64: dtsi: imx8mp: add usb nodes
arm64: dts: imx8mp-evk: enable usb1 as host mode
dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings
Documentation/devicetree/bindings/usb/dwc3.txt | 3 + .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml | 87 +++++ arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 32 ++ arch/arm64/boot/dts/freescale/imx8mp.dtsi | 79 +++++ drivers/usb/dwc3/Kconfig | 10 + drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-imx8mp.c | 352 +++++++++++++++++++++ drivers/usb/host/xhci-plat.c | 4 + 8 files changed, 568 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml create mode 100644 drivers/usb/dwc3/dwc3-imx8mp.c
Signature · 1 line
2.7.4
PATCH 1/6 dt-bindings: usb: dwc3: add property to disable xhci 64bit support
Add a property "snps,xhci-dis-64bit-support-quirk" to disable xhci 64bit address support, this is due to SoC integration can't support it but the AC64 bit (bit 0) of HCCPARAMS1 is set to be 1.
--- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/dwc3.txt +3 -0
@@ -109,6 +109,9 @@ Optional properties: When just one value, which means INCRX burst mode enabled. When more than one value, which means undefined length INCR burst type enabled. The values can be 1, 4, 8, 16, 32, 64, 128 and 256. + - snps,xhci-dis-64bit-support-quirk: set if the AC64 bit (bit 0) of HCCPARAMS1 is set + to be 1, but the controller actually can't handle 64-bit address + due to SoC integration. - in addition all properties from usb-xhci.txt from the current directory are supported as well
Signature · 1 line
2.7.4
Re: [PATCH 1/6] dt-bindings: usb: dwc3: add property to disable xhci 64bit support
Quoted 14 lines · Li Jun
Add a property "snps,xhci-dis-64bit-support-quirk" to disable xhci 64bit address support, this is due to SoC integration can't support it but the AC64 bit (bit 0) of HCCPARAMS1 is set to be 1.
Signed-off-by Li Jun <[email protected]>--- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +0
-0
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 117
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt +3
-0@@ -109,6 +109,9 @@ Optional properties: When just one value, which means INCRX burst mode enabled. When more than one value, which means undefined length INCR burst type enabled. The values can be 1, 4, 8, 16, 32, 64, 128 and 256. + - snps,xhci-dis-64bit-support-quirk: set if the AC64 bit (bit 0) of HCCPARAMS1 is set + to be 1, but the controller actually can't handle 64-bit address + due to SoC integration. - in addition all properties from usb-xhci.txt from the current directory are supported as well
Why not adding it at usb-xhci.txt directly? It is more like general property, I see Renesas rcar platforms also have this quirk.
Signature · 2 lines
Thanks, Peter Chen
Re: [PATCH 1/6] dt-bindings: usb: dwc3: add property to disable xhci 64bit support
Quoted 22 lines · Peter Chen
Quoted 21 lines · Li Jun
Add a property "snps,xhci-dis-64bit-support-quirk" to disable xhci 64bit address support, this is due to SoC integration can't support it but the AC64 bit (bit 0) of HCCPARAMS1 is set to be 1.
Signed-off-by Li Jun <[email protected]>--- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/usb/dwc3.txt +3
-0@@ -109,6 +109,9 @@ Optional properties: When just one value, which means INCRX burst mode enabled. When more than one value, which means undefined length INCR burst type enabled. The values can be 1, 4, 8, 16, 32, 64, 128 and 256. + - snps,xhci-dis-64bit-support-quirk: set if the AC64 bit (bit 0) of HCCPARAMS1 is set + to be 1, but the controller actually can't handle 64-bit address + due to SoC integration.
Quoted 6 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 117
Quoted 2 lines
Documentation/devicetree/bindings/usb/dwc3.txt +0
-0- in addition all properties from usb-xhci.txt from the current directory are supported as wellWhy not adding it at usb-xhci.txt directly? It is more like general property, I see Renesas rcar platforms also have this quirk.
Or rather define a compatible string for the specific SoC integration here and based upon that compatibility string set the xhci->quirks to have XHCI_NO_64BIT_SUPPORT set.
Signature · 1 line
Florian
RE: [PATCH 1/6] dt-bindings: usb: dwc3: add property to disable xhci 64bit support
Quoted 46 lines
-----Original Message-----
From: Florian Fainelli <[email protected]>
Sent: Wednesday, June 10, 2020 12:22 PM
To: Peter Chen <[email protected]>; Jun Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/6] dt-bindings: usb: dwc3: add property to disable xhci 64bit supportQuoted 10 lines · Peter Chen
Quoted 9 lines · Li Jun
Add a property "snps,xhci-dis-64bit-support-quirk" to disable xhci 64bit address support, this is due to SoC integration can't support it but the AC64 bit (bit 0) of HCCPARAMS1 is set to be 1.
Signed-off-by Li Jun <[email protected]>--- Documentation/devicetree/bindings/usb/dwc3.txt | 3 +++ 1 file changed, 3 insertions(+)Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 112
Quoted 10 lines
Documentation/devicetree/bindings/usb/dwc3.txt +1
-0@@ -109,6 +109,9 @@ Optional properties: When just one value, which means INCRX burst mode enabled. When more than one value, which means undefined length INCR burst type enabled. The values can be 1, 4, 8, 16, 32, 64, 128 and 256. + - snps,xhci-dis-64bit-support-quirk: set if the AC64 bit (bit 0) of HCCPARAMS1is set
Quoted 9 lines
Documentation/devicetree/bindings/usb/dwc3.txt Optional properties: · line 117
Quoted 5 lines
Documentation/devicetree/bindings/usb/dwc3.txt +2
-0+ to be 1, but the controller actually can't handle 64-bit address + due to SoC integration. - in addition all properties from usb-xhci.txt from the current directory are supported as wellWhy not adding it at usb-xhci.txt directly? It is more like general property, I see Renesas rcar platforms also have this quirk.
Quoted 3 lines
Or rather define a compatible string for the specific SoC integration here and based upon that compatibility string set the
xhci->quirksto haveXHCI_NO_64BIT_SUPPORTset.
Hi Florian, Peter
Sent out v2 with changes to use platform data so compatible string based to pass those xhci quirks to xhci-plat.
Thanks
Li Jun
Quoted 2 lines
--
Florian
PATCH 2/6 usb: host: xhci-plat: add quirk for XHCI_NO_64BIT_SUPPORT
In reply to Li JunSome dwc3 based platforms may also have the problem AC64 bit (bit 0) of HCCPARAMS1 set to be 1 but the controller actually can't support 64-bit address when SoC integration, so enable XHCI_NO_64BIT_SUPPORT via dts property "snps,xhci-dis-64bit-support-quirk".
--- drivers/usb/host/xhci-plat.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/host/xhci-plat.c +4 -0
@@ -290,6 +290,10 @@ static int xhci_plat_probe(struct platform_device *pdev)device_property_read_u32 (tmpdev,"imod-interval-ns" , &xhci->imod_interval); + +if (device_property_read_bool (tmpdev, +"snps,xhci-dis-64bit-support-quirk" )) + xhci->quirks |=XHCI_NO_64BIT_SUPPORT ; } hcd->usb_phy =devm_usb_get_phy_by_phandle (sysdev,"usb-phy" ,0 );
Signature · 1 line
2.7.4
PATCH 3/6 usb: dwc3: add imx8mp dwc3 glue layer driver
In reply to Li Junimx8mp SoC integrate dwc3 3.30b IP and has some customizations to support low power, which has a seprated wakeup irq and additional logic to wakeup usb from low power mode both for host mode and device mode.
--- drivers/usb/dwc3/Kconfig | 10 ++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-imx8mp.c | 352 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 363 insertions(+)
drivers/usb/dwc3/Kconfig +10 -0
@@ -138,4 +138,14 @@ config USB_DWC3_QCOM for peripheral mode support. Say 'Y' or 'M' if you have one such device. +config USB_DWC3_IMX8MP + tristate "NXP iMX8MP Platform" + depends on OF && COMMON_CLK + depends on (ARCH_MXC && ARM64) || COMPILE_TEST + default USB_DWC3 + help + NXP iMX8M Plus SoC use DesignWare Core IP for USB2/3 + functionality. + Say 'Y' or 'M' if you have one such device. + endif
drivers/usb/dwc3/Makefile +1 -0
@@ -51,3 +51,4 @@ obj-$(CONFIG_USB_DWC3_MESON_G12A) += dwc3-meson-g12a.o obj-$(CONFIG_USB_DWC3_OF_SIMPLE) += dwc3-of-simple.o obj-$(CONFIG_USB_DWC3_ST) += dwc3-st.o obj-$(CONFIG_USB_DWC3_QCOM) += dwc3-qcom.o +obj-$(CONFIG_USB_DWC3_IMX8MP) += dwc3-imx8mp.o
drivers/usb/dwc3/dwc3-imx8mp.c new file +352 -0
352 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH 3/6] usb: dwc3: add imx8mp dwc3 glue layer driver
drivers/usb/dwc3/dwc3-imx8mp.c line 173
Quoted 12 lines · Li Jun
drivers/usb/dwc3/dwc3-imx8mp.c new file +12
-0+ +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + err =pm_runtime_get_sync (dev); +if (err <0 ) + goto disable_rpm; + + dwc3_np =of_get_child_by_name (node,"dwc3" ); +if (!dwc3_np) { +dev_err (dev,"failed to find dwc3 core child\n" ); + goto disable_rpm; + }
You may call of_node_put() for dwc3_np after using.
Quoted 89 lines
drivers/usb/dwc3/dwc3-imx8mp.c new file +89
-0+ + err =of_platform_populate (node,NULL ,NULL , dev); +if (err) { +dev_err (&pdev->dev,"failed to create dwc3 core\n" ); + goto disable_rpm; + } + + dwc3_imx->dwc3 =of_find_device_by_node (dwc3_np); +if (!dwc3_imx->dwc3) { +dev_err (dev,"failed to get dwc3 platform device\n" ); + err = -ENODEV ; + goto depopulate; + } + +device_set_wakeup_capable (dev, true); +pm_runtime_put (dev); + +return 0 ; + +depopulate: +of_platform_depopulate (dev); +disable_rpm: +pm_runtime_disable (dev); +pm_runtime_put_noidle (dev); +disable_clks: +clk_disable_unprepare (dwc3_imx->clks[dwc3_imx->num_clks-1 ].clk); +disable_bulk_clk: +clk_bulk_disable_unprepare (dwc3_imx->num_clks, dwc3_imx->clks); + +return err; +} + +static int dwc3_imx8mp_remove (struct platform_device *pdev) +{ +struct dwc3_imx8mp *dwc3_imx =platform_get_drvdata (pdev); +struct device *dev = &pdev->dev; + +pm_runtime_get_sync (dev); +of_platform_depopulate (dev); + +clk_bulk_disable_unprepare (dwc3_imx->num_clks, dwc3_imx->clks); +clk_disable_unprepare (dwc3_imx->clks[dwc3_imx->num_clks-1 ].clk); + +pm_runtime_disable (dev); +pm_runtime_put_noidle (dev); +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static int dwc3_imx8mp_suspend (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) +{ +if (dwc3_imx->pm_suspended) +return 0 ; + +/* Wakeup enable */ +if (PMSG_IS_AUTO (msg) ||device_may_wakeup (dwc3_imx->dev)) +dwc3_imx8mp_wakeup_enable (dwc3_imx); + +clk_bulk_disable_unprepare (dwc3_imx->num_clks, dwc3_imx->clks); + dwc3_imx->pm_suspended = true; + +return 0 ; +} + +static int dwc3_imx8mp_resume (struct dwc3_imx8mp *dwc3_imx,pm_message_t msg) +{ +struct dwc3 *dwc =platform_get_drvdata (dwc3_imx->dwc3); +int ret =0 ; + +if (!dwc3_imx->pm_suspended) +return 0 ; + + ret =clk_bulk_prepare_enable (dwc3_imx->num_clks, dwc3_imx->clks); +if (ret) +return ret; + +/* Wakeup disable */ +dwc3_imx8mp_wakeup_disable (dwc3_imx); + dwc3_imx->pm_suspended = false; + +if (dwc3_imx->wakeup_pending) { + dwc3_imx->wakeup_pending = false; +if (dwc->current_dr_role ==DWC3_GCTL_PRTCAP_DEVICE ) { +pm_runtime_mark_last_busy (dwc->dev); +pm_runtime_put_autosuspend (dwc->dev); + }else { +/* +* Add wait for xhci switch from suspend
drivers/usb/dwc3/dwc3-imx8mp.c line 272
Quoted 10 lines
drivers/usb/dwc3/dwc3-imx8mp.c new file +10
-0+* clock to normal clock to detect connection. +*/ +usleep_range (9000 ,10000 ); + } +enable_irq (dwc3_imx->irq); + } + +return ret; +} +
You may need to add __maybe_unused for above two functions.
Peter
Quoted 83 lines
drivers/usb/dwc3/dwc3-imx8mp.c new file +80
-0+static int __maybe_unused dwc3_imx8mp_pm_suspend (struct device *dev) +{ +struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev); +int ret; + + ret =dwc3_imx8mp_suspend (dwc3_imx,PMSG_SUSPEND ); + +if (device_may_wakeup (dwc3_imx->dev)) +enable_irq_wake (dwc3_imx->irq); + +dev_dbg (dev,"dwc3 imx8mp pm suspend.\n" ); + +return ret; +} + +static int __maybe_unused dwc3_imx8mp_pm_resume (struct device *dev) +{ +struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev); +int ret; + +if (device_may_wakeup (dwc3_imx->dev)) +disable_irq_wake (dwc3_imx->irq); + + ret =dwc3_imx8mp_resume (dwc3_imx,PMSG_RESUME ); + +pm_runtime_disable (dev); +pm_runtime_set_active (dev); +pm_runtime_enable (dev); + +dev_dbg (dev,"dwc3 imx8mp pm resume.\n" ); + +return ret; +} + +static int __maybe_unused dwc3_imx8mp_runtime_suspend (struct device *dev) +{ +struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev); + +dev_dbg (dev,"dwc3 imx8mp runtime suspend.\n" ); + +return dwc3_imx8mp_suspend (dwc3_imx,PMSG_AUTO_SUSPEND ); +} + +static int __maybe_unused dwc3_imx8mp_runtime_resume (struct device *dev) +{ +struct dwc3_imx8mp *dwc3_imx =dev_get_drvdata (dev); + +dev_dbg (dev,"dwc3 imx8mp runtime resume.\n" ); + +return dwc3_imx8mp_resume (dwc3_imx,PMSG_AUTO_RESUME ); +} + +static const struct dev_pm_ops dwc3_imx8mp_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dwc3_imx8mp_pm_suspend, dwc3_imx8mp_pm_resume) +SET_RUNTIME_PM_OPS (dwc3_imx8mp_runtime_suspend, + dwc3_imx8mp_runtime_resume,NULL ) +}; + +static const struct of_device_id dwc3_imx8mp_of_match[] = { + { .compatible ="fsl,imx8mp-dwc3" , }, + {}, +}; +MODULE_DEVICE_TABLE (of, dwc3_imx8mp_of_match); + +static struct platform_driver dwc3_imx8mp_driver = { + .probe = dwc3_imx8mp_probe, + .remove = dwc3_imx8mp_remove, + .driver = { + .name ="imx8mp-dwc3" , + .pm = &dwc3_imx8mp_dev_pm_ops, + .of_match_table = dwc3_imx8mp_of_match, + }, +}; + +module_platform_driver (dwc3_imx8mp_driver); + +MODULE_ALIAS ("platform:imx8mp-dwc3" ); +MODULE_AUTHOR ("[email protected]" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_DESCRIPTION ("DesignWare USB3 imx8mp Glue Layer" );Signature · 1 line
2.7.4
Signature · 2 lines
Thanks, Peter Chen
PATCH 4/6 arm64: dtsi: imx8mp: add usb nodes
In reply to Li Junimx8mp integrates 2 identical dwc3 based USB3 controllers and Synopsys phys, each instance has additional wakeup logic to support low powe mode, so the glue layer need a node with dwc3 core sub node.
--- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +79 -0
@@ -650,5 +650,84 @@ interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; }; + + usb3_phy0: usb-phy@381f0040 { + compatible = "fsl,imx8mp-usb-phy"; + reg = <0x381f0040 0x40>; + clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>; + clock-names = "phy"; + assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>; + assigned-clock-parents = <&clk IMX8MP_CLK_24M>; + #phy-cells = <0>; + status = "disabled"; + }; + + usb3_0: usb@32f10100 { + compatible = "fsl,imx8mp-dwc3"; + reg = <0x32f10100 0x8>; + clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, + <&clk IMX8MP_CLK_HSIO_AXI_DIV>, + <&clk IMX8MP_CLK_USB_ROOT>; + clock-names = "hsio", "bus", "suspend"; + assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>; + assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>; + assigned-clock-rates = <500000000>; + interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + usb_dwc3_0: dwc3@38100000 { + compatible = "snps,dwc3"; + reg = <0x38100000 0x10000>; + interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usb3_phy0>, <&usb3_phy0>; + phy-names = "usb2-phy", "usb3-phy"; + snps,xhci-dis-64bit-support-quirk; + snps,dis-u2-freeclk-exists-quirk; + status = "disabled"; + }; + + }; + + usb3_phy1: usb-phy@382f0040 { + compatible = "fsl,imx8mp-usb-phy"; + reg = <0x382f0040 0x40>; + clocks = <&clk IMX8MP_CLK_USB_PHY_ROOT>; + clock-names = "phy"; + assigned-clocks = <&clk IMX8MP_CLK_USB_PHY_REF>; + assigned-clock-parents = <&clk IMX8MP_CLK_24M>; + #phy-cells = <0>; + status = "disabled"; + }; + + usb3_1: usb@32f10108 { + compatible = "fsl,imx8mp-dwc3"; + reg = <0x32f10108 0x8>; + clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, + <&clk IMX8MP_CLK_HSIO_AXI_DIV>, + <&clk IMX8MP_CLK_USB_ROOT>; + clock-names = "hsio", "bus", "suspend"; + assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>; + assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>; + assigned-clock-rates = <500000000>; + interrupts = <GIC_SPI 149 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + status = "disabled"; + + usb_dwc3_1: dwc3@38200000 { + compatible = "snps,dwc3"; + reg = <0x38200000 0x10000>; + interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usb3_phy1>, <&usb3_phy1>; + phy-names = "usb2-phy", "usb3-phy"; + snps,xhci-dis-64bit-support-quirk; + snps,dis-u2-freeclk-exists-quirk; + status = "disabled"; + }; + }; }; };
Signature · 1 line
2.7.4
PATCH 5/6 arm64: dts: imx8mp-evk: enable usb1 as host mode
In reply to Li JunEnable usb host port with type-A connector on imx8mp-evk board.
--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +32 -0
@@ -43,6 +43,19 @@ gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; enable-active-high; }; + + reg_usb1_host_vbus: regulator-usb1-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb1_host_vbus"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb1_vbus>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + }; &fec {
@@ -91,6 +104,19 @@ status = "okay"; }; +&usb3_phy1 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; +}; + +&usb_dwc3_1 { + dr_mode = "host"; + status = "okay"; +}; + &usdhc2 { assigned-clocks = <&clk IMX8MP_CLK_USDHC2>; assigned-clock-rates = <400000000>;
@@ -172,6 +198,12 @@ >; }; + pinctrl_usb1_vbus: usb1grp { + fsl,pins = < + MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14 0x19 + >; + }; + pinctrl_usdhc2: usdhc2grp { fsl,pins = < MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190
Signature · 1 line
2.7.4
Re: [PATCH 5/6] arm64: dts: imx8mp-evk: enable usb1 as host mode
Quoted 16 lines · Li Jun
Enable usb host port with type-A connector on imx8mp-evk board.
Signed-off-by Li Jun <[email protected]>--- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)arch/arm64/boot/dts/freescale/imx8mp-evk.dts +1
-0@@ -43,6 +43,19 @@ gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; enable-active-high; }; +
arch/arm64/boot/dts/freescale/imx8mp-evk.dts line 56
Quoted 10 lines
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +10
-0+ reg_usb1_host_vbus: regulator-usb1-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb1_host_vbus"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb1_vbus>; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on;
Instead of having it regulator-always-on, it should be controlled by usb device, right?
Shawn
Quoted 41 lines
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +21
-0+ }; + }; &fec {@@ -91,6 +104,19 @@ status = "okay"; }; +&usb3_phy1 { + status = "okay"; +}; + +&usb3_1 { + status = "okay"; +}; + +&usb_dwc3_1 { + dr_mode = "host"; + status = "okay"; +}; + &usdhc2 { assigned-clocks = <&clk IMX8MP_CLK_USDHC2>; assigned-clock-rates = <400000000>;@@ -172,6 +198,12 @@ >; }; + pinctrl_usb1_vbus: usb1grp { + fsl,pins = < + MX8MP_IOMUXC_GPIO1_IO14__GPIO1_IO14 0x19 + >; + }; + pinctrl_usdhc2: usdhc2grp { fsl,pins = < MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190Signature · 1 line
2.7.4
RE: [PATCH 5/6] arm64: dts: imx8mp-evk: enable usb1 as host mode
Quoted 6 lines
Quoted 6 lines
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +6
-0+ + reg_usb1_host_vbus: regulator-usb1-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb1_host_vbus"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb1_vbus>;
Quoted 8 lines
arch/arm64/boot/dts/freescale/imx8mp-evk.dts line 56
Quoted 5 lines
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +5
-0+ regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on;Instead of having it regulator-always-on, it should be controlled by usb device, right?
Right, I will try to use that pin as usb power function instead of GPIO(regulator) for vbus control in v2.
Thanks
Li Jun
PATCH 6/6 dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings
In reply to Li JunNXP imx8mp integrates 2 dwc3 3.30b IP and add some wakeup logic to support low power mode, the glue layer is for this wakeup functionality, which has a separated interrupt, can support wakeup from U3 and connect events for host, and vbus wakeup for device.
--- .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+)
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +87 -0
@@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (c) 2020 NXP +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/fsl,imx8mp-dwc3.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP iMX8MP Soc USB Controller + +maintainers: + - Li Jun <[email protected]> + +properties: + compatible: + items: + - const: fsl,imx8mp-dwc3 + + reg: + maxItems: 1 + description: Address and length of the register set for the wrapper of + dwc3 core on the SOC. + + "#address-cells": + enum: [ 1, 2 ] + + "#size-cells": + enum: [ 1, 2 ] + + interrupts: + maxItems: 1 + description: The interrupt that is asserted when a wakeup event is + received. + + clocks: + description: + A list of phandle and clock-specifier pairs for the clocks + listed in clock-names. + items: + - description: system hsio root clock. + - description: system bus AXI clock. + - description: suspend clock, used for wakeup logic. + + clock-names: + items: + - const: hsio + - const: bus + - const: suspend + +# Required child node: + + dwc3: + description: This is the node representing the DWC3 controller instance + Documentation/devicetree/bindings/usb/dwc3.txt + +required: + - compatible + - reg + - interrupts + - clocks + +examples: + - | + #include <dt-bindings/clock/imx8mp-clock.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + usb3_0: usb@32f10100 { + compatible = "fsl,imx8mp-dwc3"; + reg = <0x32f10100 0x8>; + clocks = <&clk IMX8MP_CLK_HSIO_ROOT>, + <&clk IMX8MP_CLK_HSIO_AXI_DIV>, + <&clk IMX8MP_CLK_USB_ROOT>; + clock-names = "hsio", "bus", "suspend"; + assigned-clocks = <&clk IMX8MP_CLK_HSIO_AXI_SRC>; + assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>; + assigned-clock-rates = <500000000>; + interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + dwc3@38100000 { + compatible = "snps,dwc3"; + reg = <0x38100000 0x10000>; + interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>; + phys = <&usb3_phy0>, <&usb3_phy0>; + phy-names = "usb2-phy", "usb3-phy"; + }; + };
Signature · 1 line
2.7.4