Skip to contentSkip to conversation

add NXP imx8mp usb support

PATCH Superseded Li Jun 3 participants 11 messages Jul 6, 2020 – Aug 13, 2020

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Li Jun

author
#0 lore raw

v2 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, a few quriks required, instead of create new properties flags, introduce platform data and pass it from glue layer to dwc3 core, those xhci private data can further pass to xhci-plat.

Changes for v2:
- Drop the 2 patches for new property("snps,xhci-dis-64bit-support-quirk") introduction, as suggested, imply by SoC compatible string, this is done by introduce dwc3 core platform data and pass the xhci_plat_priv to xhci-plat for those xhci quirks, so a new patch added:
[1/5] usb: dwc3: add platform data to dwc3 core device to pass data. this patch is based on Peter's one patch which is also in review:
https://patchwork.kernel.org/patch/11640945/
- dts change, use the USB power function of TRL logic instead of a always-on regulator to control vbus on/off.
- Some changes to address Peter's command on patch [2/5].

Li Jun (5):
usb: dwc3: add platform data to dwc3 core device to pass data
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

 .../devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml   |  87 +++++
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts       |  21 ++
 arch/arm64/boot/dts/freescale/imx8mp.dtsi          |  77 +++++
 drivers/usb/dwc3/Kconfig                           |  10 +
 drivers/usb/dwc3/Makefile                          |   1 +
 drivers/usb/dwc3/core.h                            |   5 +
 drivers/usb/dwc3/dwc3-imx8mp.c                     | 374 +++++++++++++++++++++
 drivers/usb/dwc3/host.c                            |   9 +
 8 files changed, 584 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
author
#1 lore raw

PATCH v2 1/5 usb: dwc3: add platform data to dwc3 core device to pass data

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible string and pass it via platform data to dwc3 core driver; and pass xhci private data further to xhci-plat like quirks.

---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
drivers/usb/dwc3/core.h +5 -0
index 0b8ea8c..3146697 100644
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"
 
 #define DWC3_MSG_MAX	500
 
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };
 
+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};
+
 /**
  * struct dwc3 - representation of our controller
  * @drd_work: workqueue used for role swapping
drivers/usb/dwc3/host.c +9 -0
index bef1c1a..4f8514a 100644
@@ -46,6 +46,7 @@ int dwc3_host_init(struct dwc3 *dwc)
 {
 	struct property_entry	props[4];
 	struct platform_device	*xhci;
+	struct dwc3_platform_data *dwc3_pdata;
 	int			ret, irq;
 	struct resource		*res;
 	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
@@ -115,6 +116,14 @@ int dwc3_host_init(struct dwc3 *dwc)
 		}
 	}
 
+	dwc3_pdata = (struct dwc3_platform_data *)dev_get_platdata(dwc->dev);
+	if (dwc3_pdata && dwc3_pdata->xhci_priv) {
+		ret = platform_device_add_data(xhci, dwc3_pdata->xhci_priv,
+					       sizeof(struct xhci_plat_priv));
+		if (ret)
+			goto err;
+	}
+
 	ret = platform_device_add(xhci);
 	if (ret) {
 		dev_err(dwc->dev, "failed to register xHCI device\n");
Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 2/5 usb: dwc3: add imx8mp dwc3 glue layer driver

In reply to Li Jun

imx8mp 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 | 374 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 385 insertions(+)
drivers/usb/dwc3/Kconfig +10 -0
index 206caa0..7ef2339 100644
@@ -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
index ae86da0..2259f88 100644
@@ -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 +374 -0

374 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#7 lore raw

PATCH v2 3/5 arm64: dtsi: imx8mp: add usb nodes

In reply to Li Jun

imx8mp 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 | 77 +++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp.dtsi +77 -0
index 9b1616e..f3d671f5 100644
@@ -650,5 +650,82 @@
 			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,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,dis-u2-freeclk-exists-quirk;
+				status = "disabled";
+			};
+		};
 	};
 };
Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v2 4/5 arm64: dts: imx8mp-evk: enable usb1 as host mode

In reply to Li Jun

Enable usb host port with type-A connector on imx8mp-evk board.

---
 arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm64/boot/dts/freescale/imx8mp-evk.dts +21 -0
index 3da1fff..c7cacf2 100644
@@ -91,6 +91,21 @@
 	status = "okay";
 };
 
+&usb3_phy1 {
+	status = "okay";
+};
+
+&usb3_1 {
+	status = "okay";
+};
+
+&usb_dwc3_1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usb1_vbus>;
+	dr_mode = "host";
+	status = "okay";
+};
+
 &usdhc2 {
 	assigned-clocks = <&clk IMX8MP_CLK_USDHC2>;
 	assigned-clock-rates = <400000000>;
@@ -172,6 +187,12 @@
 		>;
 	};
 
+	pinctrl_usb1_vbus: usb1grp {
+		fsl,pins = <
+			MX8MP_IOMUXC_GPIO1_IO14__HSIOMIX_usb2_OTG_PWR	0x19
+		>;
+	};
+
 	pinctrl_usdhc2: usdhc2grp {
 		fsl,pins = <
 			MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK	0x190
Signature · 1 line
2.7.4
author
#9 lore raw

PATCH v2 5/5 dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

In reply to Li Jun

NXP 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
new file mode 100644
index 0000000..823db058
@@ -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
maintainer
#10 lore raw

Re: [PATCH v2 5/5] dt-bindings: usb: dwc3-imx8mp: add imx8mp dwc3 glue bindings

Quoted 58 lines · Li Jun

NXP 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 +41 -0
new file mode 100644
index 0000000..823db058
@@ -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.

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 51

Quoted 10 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +10 -0
+
+  clock-names:
+    items:
+      - const: hsio
+      - const: bus
+      - const: suspend
+
+# Required child node:
+
+  dwc3:

Needs to be a pattern with the unit-address.

Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml line 59

Quoted 8 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +8 -0
+    description: This is the node representing the DWC3 controller instance
+      Documentation/devicetree/bindings/usb/dwc3.txt
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks

Pretty sure you need a few more properties here...

Add:

additionalProperties: false

Quoted 31 lines
Documentation/devicetree/bindings/usb/fsl,imx8mp-dwc3.yaml new file +28 -0
+
+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
author
#2 lore raw

RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

In reply to Li Jun
Quoted 73 lines

-----Original Message-----
From: Jun Li <[email protected]>
Sent: Monday, July 6, 2020 5:45 PM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; Peter Chen <[email protected]>; Anson Huang <[email protected]>; Peng Fan <[email protected]>; Horia Geanta <[email protected]>
Subject: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible string and pass it via platform data to dwc3 core driver; and pass xhci private data further to xhci-plat like quirks.

---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
drivers/usb/dwc3/core.h index renamed from drivers/usb/dwc3/core.h +0 -0

0b8ea8c..3146697 100644

drivers/usb/dwc3/core.h +5 -0
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"
 
 #define DWC3_MSG_MAX	500
 
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };
 
+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};
+
 /**
  * struct dwc3 - representation of our controller
  * @drd_work: workqueue used for role swapping diff --git a/drivers/usb/dwc3/host.c

b/drivers/usb/dwc3/host.c index bef1c1a..4f8514a 100644

drivers/usb/dwc3/host.c +9 -1
@@ -46,6 +46,7 @@ int dwc3_host_init(struct dwc3 *dwc)  {
 	struct property_entry	props[4];
 	struct platform_device	*xhci;
+	struct dwc3_platform_data *dwc3_pdata;
 	int			ret, irq;
 	struct resource		*res;
 	struct platform_device	*dwc3_pdev = to_platform_device(dwc->dev);
@@ -115,6 +116,14 @@ int dwc3_host_init(struct dwc3 *dwc)
 		}
 	}
 
+	dwc3_pdata = (struct dwc3_platform_data *)dev_get_platdata(dwc->dev);
+	if (dwc3_pdata && dwc3_pdata->xhci_priv) {
+		ret = platform_device_add_data(xhci, dwc3_pdata->xhci_priv,
+					       sizeof(struct xhci_plat_priv));
+		if (ret)
+			goto err;
+	}
+
 	ret = platform_device_add(xhci);
 	if (ret) {
 		dev_err(dwc->dev, "failed to register xHCI device\n");
--
Quoted 1 line

2.7.4

A gentle ping...

Thanks
Li Jun

#3 lore raw

Re: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

In reply to Li Jun

Hi,

Quoted 23 lines · Li Jun

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible string and pass it via platform data to dwc3 core driver; and pass xhci private data further to xhci-plat like quirks.

---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
drivers/usb/dwc3/core.h +1 -0
index 0b8ea8c..3146697 100644
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"
 
 #define DWC3_MSG_MAX	500
 

drivers/usb/dwc3/core.h struct dwc3_scratchpad_array { · line 930

Quoted 6 lines
drivers/usb/dwc3/core.h +3 -0
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };
 
+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};

why? We should rely on properties, no?

Signature · 1 line
balbi
author
#4 lore raw

RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

Quoted 44 lines

-----Original Message-----
From: Felipe Balbi <[email protected]> On Behalf Of Felipe Balbi
Sent: Thursday, July 23, 2020 5:22 PM
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; Peter Chen <[email protected]>; Anson Huang <[email protected]>; Peng Fan <[email protected]>; Horia Geanta <[email protected]>
Subject: Re: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

Hi,

Quoted 26 lines · Li Jun

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible string and pass it via platform data to dwc3 core driver; and pass xhci private data further to xhci-plat like quirks.

---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
drivers/usb/dwc3/core.h index renamed from drivers/usb/dwc3/core.h +0 -0

0b8ea8c..3146697 100644

drivers/usb/dwc3/core.h +1 -0
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"
 
 #define DWC3_MSG_MAX	500
 
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };
 
Quoted 5 lines

drivers/usb/dwc3/core.h struct dwc3_scratchpad_array { · line 930

Quoted 3 lines
drivers/usb/dwc3/core.h +3 -0
+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};

why? We should rely on properties, no?

My v1 patch was adding new property directly, considering Rob has objection on that way if I understand correctly, also there is suggestion on use compatible string to set quirks, I changed to add platform data to pass SoC level quirks, I think this also can be used to extend other special handling for glue layer driver, so should I go back to use properties? Hope an agreement can be made on adding new properties/quirks.

Thanks
Li Jun

Quoted 3 lines

--
balbi

author
#5 lore raw

RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

Quoted 64 lines

-----Original Message-----
From: Jun Li
Sent: Thursday, July 23, 2020 5:58 PM
To: Felipe Balbi <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; Peter Chen <[email protected]>; Anson Huang <[email protected]>; Peng Fan <[email protected]>; Horia Geanta <[email protected]>
Subject: RE: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

Quoted 43 lines

-----Original Message-----
From: Felipe Balbi <[email protected]> On Behalf Of Felipe Balbi
Sent: Thursday, July 23, 2020 5:22 PM
To: Jun Li <[email protected]>; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]; [email protected]; Peter Chen <[email protected]>; Anson Huang <[email protected]>; Peng Fan <[email protected]>; Horia Geanta <[email protected]>
Subject: Re: [PATCH v2 1/5] usb: dwc3: add platform data to dwc3 core device to pass data

Hi,

Quoted 26 lines · Li Jun

In case dwc3 has SoC specific customizations, dwc3 glue driver can base on compatible string and pass it via platform data to dwc3 core driver; and pass xhci private data further to xhci-plat like quirks.

---
 drivers/usb/dwc3/core.h | 5 +++++
 drivers/usb/dwc3/host.c | 9 +++++++++
 2 files changed, 14 insertions(+)
drivers/usb/dwc3/core.h index renamed from drivers/usb/dwc3/core.h +0 -0

0b8ea8c..3146697 100644

drivers/usb/dwc3/core.h +1 -0
@@ -29,6 +29,7 @@
 #include <linux/ulpi/interface.h>
 
 #include <linux/phy/phy.h>
+#include "../host/xhci-plat.h"
 
 #define DWC3_MSG_MAX	500
 
@@ -924,6 +925,10 @@ struct dwc3_scratchpad_array {
 	__le64	dma_adr[DWC3_MAX_HIBER_SCRATCHBUFS];
 };
 
Quoted 5 lines

drivers/usb/dwc3/core.h struct dwc3_scratchpad_array { · line 930

Quoted 3 lines
drivers/usb/dwc3/core.h +3 -0
+struct dwc3_platform_data {
+	struct xhci_plat_priv *xhci_priv;
+};

why? We should rely on properties, no?

Quoted 6 lines

My v1 patch was adding new property directly, considering Rob has objection on that way if I understand correctly, also there is suggestion on use compatible string to set quirks, I changed to add platform data to pass SoC level quirks, I think this also can be used to extend other special handling for glue layer driver, so should I go back to use properties?
Hope an agreement can be made on adding new properties/quirks.

'
Hi Felipe,

Could you please point me how I can move forward on this, thanks a lot.

Li Jun

Quoted 7 lines

Thanks
Li Jun

Quoted 3 lines

--
balbi