Skip to contentSkip to conversation

IPQ40xx: Improve support

PATCH Superseded Robert Marko 3 participants 15 messages Sep 1, 2020 – Sep 10, 2020

Subsystems (10)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover IPQ40xx: Improve support

This patch series builds on the previously merged basic Qualcomm IPQ40xx series support.

Robert Marko (9):
dt-bindings: clock: import Qualcomm IPQ4019 bindings
IPQ40xx: clk: Use dt-bindings instead of hardcoding
IPQ40xx: Add SMEM support
reset: Add IPQ40xx reset controller driver
IPQ40xx: Add reset controller support
phy: add driver for Qualcomm IPQ40xx USB PHY
usb: dwc3: Make PHY functions depend on CONFIG_USB_DWC3
usb: xhci: Add Qualcomm DWC3 xHCI driver
IPQ40xx: Add USB nodes

 MAINTAINERS                                   |   6 +
 arch/arm/Kconfig                              |   3 +
 arch/arm/dts/qcom-ipq4019.dtsi                |  67 ++++++-
 arch/arm/mach-ipq40xx/clock-ipq4019.c         |   4 +-
 .../usb/qcom-dwc3-ipq.txt                     |  34 ++++
 drivers/phy/Kconfig                           |   6 +
 drivers/phy/Makefile                          |   1 +
 drivers/phy/phy-qcom-ipq4019-usb.c            | 145 +++++++++++++++
 drivers/reset/Kconfig                         |   8 +
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-ipq4019.c                 | 173 ++++++++++++++++++
 drivers/smem/Kconfig                          |   2 +-
 drivers/usb/host/Kconfig                      |   6 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/xhci-ipq.c                   | 117 ++++++++++++
 include/dt-bindings/clock/qcom,ipq4019-gcc.h  |  96 ++++++++++
 .../dt-bindings/reset/qcom,ipq4019-reset.h    |  92 ++++++++++
 include/dwc3-uboot.h                          |   2 +-
 18 files changed, 760 insertions(+), 4 deletions(-)
 create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
 create mode 100644 drivers/phy/phy-qcom-ipq4019-usb.c
 create mode 100644 drivers/reset/reset-ipq4019.c
 create mode 100644 drivers/usb/host/xhci-ipq.c
 create mode 100644 include/dt-bindings/clock/qcom,ipq4019-gcc.h
 create mode 100644 include/dt-bindings/reset/qcom,ipq4019-reset.h
Signature · 1 line
2.26.2
#1 lore raw

PATCH v2 1/9 dt-bindings: clock: import Qualcomm IPQ4019 bindings

Import Qualcomm IPQ4019 GCC bindings from Linux.
This will enable using bindings instead of raw clock numbers both in the driver and DTS like Linux does.

---
 MAINTAINERS                                  |  1 +
 include/dt-bindings/clock/qcom,ipq4019-gcc.h | 96 ++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 include/dt-bindings/clock/qcom,ipq4019-gcc.h
MAINTAINERS +1 -0
index bebe87b4d1..c0e902a424 100644
@@ -237,6 +237,7 @@ M:	Luka Kovacic <[email protected]>
 M:	Luka Perkov <[email protected]>
 S:	Maintained
 F:	arch/arm/mach-ipq40xx/
+F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
include/dt-bindings/clock/qcom,ipq4019-gcc.h new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw

PATCH v2 2/9 IPQ40xx: clk: Use dt-bindings instead of hardcoding

In reply to Robert Marko

Its common to use dt-bindings instead of hard-coding clocks or resets. So lets use the imported Linux GCC bindings on IPQ40xx target.

---
 arch/arm/dts/qcom-ipq4019.dtsi        | 3 ++-
 arch/arm/mach-ipq40xx/clock-ipq4019.c | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/dts/qcom-ipq4019.dtsi +2 -1
index 5f78bc5ab9..7b3b5e0248 100644
@@ -10,6 +10,7 @@
 #include "skeleton.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/pinctrl-snapdragon.h>
+#include <dt-bindings/clock/qcom,ipq4019-gcc.h>
 
 / {
 	#address-cells = <1>;
@@ -61,7 +62,7 @@
 		blsp1_uart1: serial at 78af000 {
 			compatible = "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm";
 			reg = <0x78af000 0x200>;
-			clock = <&gcc 26>;
+			clock = <&gcc GCC_BLSP1_UART1_APPS_CLK>;
 			bit-rate = <0xFF>;
 			status = "disabled";
 			u-boot,dm-pre-reloc;
arch/arm/mach-ipq40xx/clock-ipq4019.c +3 -1
index 7cf98a203c..83a688e625 100644
@@ -13,6 +13,8 @@
 #include <dm.h>
 #include <errno.h>
 
+#include <dt-bindings/clock/qcom,ipq4019-gcc.h>
+
 struct msm_clk_priv {
 	phys_addr_t base;
 };
@@ -20,7 +22,7 @@ struct msm_clk_priv {
 ulong msm_set_rate(struct clk *clk, ulong rate)
 {
 	switch (clk->id) {
-	case 26: /*UART1*/
+	case GCC_BLSP1_UART1_APPS_CLK: /*UART1*/
 		/* This clock is already initialized by SBL1 */
 		return 0; 
 		break;
Signature · 1 line
2.26.2
#3 lore raw

PATCH v2 3/9 IPQ40xx: Add SMEM support

In reply to Robert Marko

There is already existing driver for SMEM so lets enable it for IPQ40xx as well.

---
 arch/arm/Kconfig               | 2 ++
 arch/arm/dts/qcom-ipq4019.dtsi | 5 +++++
 drivers/smem/Kconfig           | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/Kconfig +2 -0
index 80702c23d3..ee378f03f4 100644
@@ -767,8 +767,10 @@ config ARCH_IPQ40XX
 	select DM
 	select DM_GPIO
 	select DM_SERIAL
+	select MSM_SMEM
 	select PINCTRL
 	select CLK
+	select SMEM
 	select OF_CONTROL
 	imply CMD_DM
 
arch/arm/dts/qcom-ipq4019.dtsi +5 -0
index 7b3b5e0248..dd69d0a5b2 100644
@@ -39,6 +39,11 @@
 		};
 	};
 
+	smem {
+		compatible = "qcom,smem";
+		memory-region = <&smem_mem>;
+	};
+
 	soc: soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
drivers/smem/Kconfig +1 -1
index 7169d0f205..73d51b3a7a 100644
@@ -15,7 +15,7 @@ config SANDBOX_SMEM
 config MSM_SMEM
     bool "Qualcomm Shared Memory Manager (SMEM)"
     depends on DM
-    depends on ARCH_SNAPDRAGON
+    depends on ARCH_SNAPDRAGON || ARCH_IPQ40XX
     help
       Enable support for the Qualcomm Shared Memory Manager.
       The driver provides an interface to items in a heap shared among all
Signature · 1 line
2.26.2
#4 lore raw

PATCH v2 4/9 reset: Add IPQ40xx reset controller driver

In reply to Robert Marko

On Qualcomm IPQ40xx SoC series, GCC clock IP also handles the resets.
So since this will be needed by further drivers, lets add a driver for the reset controller.

---
 MAINTAINERS                                   |   2 +
 drivers/reset/Kconfig                         |   8 +
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-ipq4019.c                 | 173 ++++++++++++++++++
 .../dt-bindings/reset/qcom,ipq4019-reset.h    |  92 ++++++++++
 5 files changed, 276 insertions(+)
 create mode 100644 drivers/reset/reset-ipq4019.c
 create mode 100644 include/dt-bindings/reset/qcom,ipq4019-reset.h
MAINTAINERS +2 -0
index c0e902a424..f4fc823e4e 100644
@@ -238,6 +238,8 @@ M:	Luka Perkov <[email protected]>
 S:	Maintained
 F:	arch/arm/mach-ipq40xx/
 F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
+F:	include/dt-bindings/reset/qcom,ipq4019-reset.h
+F:	drivers/reset/reset-ipq4019.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
drivers/reset/Kconfig +8 -0
index 253902ff57..3fdfe4a6cb 100644
@@ -148,6 +148,14 @@ config RESET_IMX7
 	help
 	  Support for reset controller on i.MX7/8 SoCs.
 
+config RESET_IPQ419
+	bool "Reset driver for Qualcomm IPQ40xx SoCs"
+	depends on DM_RESET && ARCH_IPQ40XX
+	default y
+	help
+	  Support for reset controller on Qualcomm
+	  IPQ40xx SoCs.
+
 config RESET_SIFIVE
 	bool "Reset Driver for SiFive SoC's"
 	depends on DM_RESET && CLK_SIFIVE_FU540_PRCI && TARGET_SIFIVE_FU540
drivers/reset/Makefile +1 -0
index 3c7f066ae3..5176da5885 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_RESET_MTMIPS) += reset-mtmips.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_RESET_HISILICON) += reset-hisilicon.o
 obj-$(CONFIG_RESET_IMX7) += reset-imx7.o
+obj-$(CONFIG_RESET_IPQ419) += reset-ipq4019.o
 obj-$(CONFIG_RESET_SIFIVE) += reset-sifive.o
 obj-$(CONFIG_RESET_SYSCON) += reset-syscon.o
 obj-$(CONFIG_RESET_RASPBERRYPI) += reset-raspberrypi.o
drivers/reset/reset-ipq4019.c new file +173 -0

173 lines not on this page · raw message

include/dt-bindings/reset/qcom,ipq4019-reset.h new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.26.2
#5 lore raw

PATCH v2 5/9 IPQ40xx: Add reset controller support

In reply to Robert Marko

Since we have a driver for the reset controller, lets add the necessary node.

---
 arch/arm/Kconfig               | 1 +
 arch/arm/dts/qcom-ipq4019.dtsi | 9 +++++++++
 2 files changed, 10 insertions(+)
arch/arm/Kconfig +1 -0
index ee378f03f4..68d6d1afd6 100644
@@ -767,6 +767,7 @@ config ARCH_IPQ40XX
 	select DM
 	select DM_GPIO
 	select DM_SERIAL
+	select DM_RESET
 	select MSM_SMEM
 	select PINCTRL
 	select CLK
arch/arm/dts/qcom-ipq4019.dtsi +9 -0
index dd69d0a5b2..7b15df38d8 100644
@@ -11,6 +11,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/pinctrl-snapdragon.h>
 #include <dt-bindings/clock/qcom,ipq4019-gcc.h>
+#include <dt-bindings/reset/qcom,ipq4019-reset.h>
 
 / {
 	#address-cells = <1>;
@@ -58,6 +59,14 @@
 			u-boot,dm-pre-reloc;
 		};
 
+		reset: gcc-reset at 1800000 {
+			compatible = "qcom,gcc-reset-ipq4019";
+			reg = <0x1800000 0x60000>;
+			#clock-cells = <1>;
+			#reset-cells = <1>;
+			u-boot,dm-pre-reloc;
+		};
+
 		pinctrl: qcom,tlmm at 1000000 {
 			compatible = "qcom,tlmm-ipq4019";
 			reg = <0x1000000 0x300000>;
Signature · 1 line
2.26.2
#6 lore raw

PATCH v2 6/9 phy: add driver for Qualcomm IPQ40xx USB PHY

In reply to Robert Marko

Add a driver to setup the USB PHY-s on Qualcomm IPQ40xx series SoCs. The driver sets up HS and SS phys.

---
 MAINTAINERS                        |   1 +
 drivers/phy/Kconfig                |   6 ++
 drivers/phy/Makefile               |   1 +
 drivers/phy/phy-qcom-ipq4019-usb.c | 145 +++++++++++++++++++++++++++++
 4 files changed, 153 insertions(+)
 create mode 100644 drivers/phy/phy-qcom-ipq4019-usb.c
MAINTAINERS +1 -0
index f4fc823e4e..d8d2c6278b 100644
@@ -240,6 +240,7 @@ F:	arch/arm/mach-ipq40xx/
 F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
 F:	include/dt-bindings/reset/qcom,ipq4019-reset.h
 F:	drivers/reset/reset-ipq4019.c
+F:	drivers/phy/phy-qcom-ipq4019-usb.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
drivers/phy/Kconfig +6 -0
index 9c775107e9..8da00a259d 100644
@@ -125,6 +125,12 @@ config STI_USB_PHY
 	  used by USB2 and USB3 Host controllers available on
 	  STiH407 SoC families.
 
+config PHY_QCOM_IPQ4019_USB
+	tristate "Qualcomm IPQ4019 USB PHY driver"
+	depends on PHY && ARCH_IPQ40XX
+	help
+	  Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s.
+
 config PHY_RCAR_GEN2
 	tristate "Renesas R-Car Gen2 USB PHY"
 	depends on PHY && RCAR_GEN2
drivers/phy/Makefile +1 -0
index 74e8d931d3..009f353baf 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o
 obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
 obj-$(CONFIG_AM654_PHY) += phy-ti-am654.o
 obj-$(CONFIG_STI_USB_PHY) += sti_usb_phy.o
+obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o
 obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o
 obj-$(CONFIG_PHY_RCAR_GEN3) += phy-rcar-gen3.o
 obj-$(CONFIG_PHY_STM32_USBPHYC) += phy-stm32-usbphyc.o
drivers/phy/phy-qcom-ipq4019-usb.c new file +145 -0

145 lines not on this page · raw message

Signature · 1 line
2.26.2
#7 lore raw

PATCH v2 7/9 usb: dwc3: Make PHY functions depend on CONFIG_USB_DWC3

In reply to Robert Marko

PHY handling functions should depend also on CONFIG_USB_DWC3 aka DM DWC3 version.
Otherwise when using the non DM version with PHY subsystem enabled there will be a linking error due to missing dwc3_setup_phy and dwc3_shutdown_phy.

---
 include/dwc3-uboot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/dwc3-uboot.h +1 -1
index e08530ec4e..5eb0822d74 100644
@@ -47,7 +47,7 @@ void dwc3_uboot_exit(int index);
 void dwc3_uboot_handle_interrupt(int index);
 
 struct phy;
-#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
+#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(CONFIG_USB_DWC3)
 int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys);
 int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys);
 #else
Signature · 1 line
2.26.2
#8 lore raw

PATCH v2 7/9 usb: dwc3: Make PHY functions depend on CONFIG_USB_DWC3

Quoted 14 lines · Robert Marko

PHY handling functions should depend also on CONFIG_USB_DWC3 aka DM DWC3 version.
Otherwise when using the non DM version with PHY subsystem enabled there will be a linking error due to missing dwc3_setup_phy and dwc3_shutdown_phy.

---
 include/dwc3-uboot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/dwc3-uboot.h +0 -0
index e08530ec4e..5eb0822d74 100644

include/dwc3-uboot.h void dwc3_uboot_exit(int index); · line 53

Quoted 8 lines
include/dwc3-uboot.h +1 -1
@@ -47,7 +47,7 @@ void dwc3_uboot_exit(int index);
 void dwc3_uboot_handle_interrupt(int index);
 
 struct phy;
-#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
+#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(CONFIG_USB_DWC3)
 int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys);
 int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys);
 #else

This should be CONFIG_IS_ENABLED(USB_DWC3).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/911bcc57/attachment.sig>
#9 lore raw

PATCH v2 7/9 usb: dwc3: Make PHY functions depend on CONFIG_USB_DWC3

Quoted 19 lines · Tom Rini
Quoted 16 lines · Robert Marko

PHY handling functions should depend also on CONFIG_USB_DWC3 aka DM DWC3 version.
Otherwise when using the non DM version with PHY subsystem enabled there will be a linking error due to missing dwc3_setup_phy and dwc3_shutdown_phy.

---
 include/dwc3-uboot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/dwc3-uboot.h +0 -0
index e08530ec4e..5eb0822d74 100644
@@ -47,7 +47,7 @@ void dwc3_uboot_exit(int index);
 void dwc3_uboot_handle_interrupt(int index);
 
Quoted 8 lines

include/dwc3-uboot.h void dwc3_uboot_exit(int index); · line 53

Quoted 6 lines
include/dwc3-uboot.h +1 -1
 struct phy;
-#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB)
+#if CONFIG_IS_ENABLED(PHY) && CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(CONFIG_USB_DWC3)
 int dwc3_setup_phy(struct udevice *dev, struct phy_bulk *phys);
 int dwc3_shutdown_phy(struct udevice *dev, struct phy_bulk *phys);
 #else

This should be CONFIG_IS_ENABLED(USB_DWC3).

This was dropped in v3 that will be sent out soon. Regards
Robert

Quoted 3 lines

--
Tom

#10 lore raw

PATCH v2 8/9 usb: xhci: Add Qualcomm DWC3 xHCI driver

In reply to Robert Marko

Add driver for Qualcomm DWC3 based dual role xHCI USB controller. Currently tested on IPQ40xx, but should support other Qualcomm SoC families as well.

Only host mode is supported.

---
 MAINTAINERS                                   |   2 +
 .../usb/qcom-dwc3-ipq.txt                     |  34 +++++
 drivers/usb/host/Kconfig                      |   6 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/xhci-ipq.c                   | 117 ++++++++++++++++++
 5 files changed, 160 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
 create mode 100644 drivers/usb/host/xhci-ipq.c
MAINTAINERS +2 -0
index d8d2c6278b..99828f656a 100644
@@ -241,6 +241,8 @@ F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
 F:	include/dt-bindings/reset/qcom,ipq4019-reset.h
 F:	drivers/reset/reset-ipq4019.c
 F:	drivers/phy/phy-qcom-ipq4019-usb.c
+F:	doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
+F:	drivers/usb/host/xhci-ipq.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt new file +34 -0
new file mode 100644
index 0000000000..a910a06fa2
@@ -0,0 +1,34 @@
+Qualcomm SuperSpeed DWC3 USB SoC controller
+
+This controller is integrated in IPQ40xx SoC-s.
+It is a dual role USB3.0/USB2.0 controller.
+
+Required properties :
+ - compatible: must be "qcom,dwc3-ipq"
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - #address-cells: must be 1
+ - #size-cells: must be 1
+ - phys: list of PHY specifiers
+ - phy-names: shall be "usb2-phy" and "usb3-phy"(In case of USB3.0 only)
+
+Example:
+	usb3: xhci at 8a00000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x8a00000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+		phy-names = "usb2-phy", "usb3-phy";
+		status = "disabled";
+	};
+
+	usb2: xhci at 6000000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x6000000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb2_hs_phy>;
+		phy-names = "usb2-phy";
+		status = "disabled";
+	};
drivers/usb/host/Kconfig +6 -0
index 1c374a7bd8..7e0b1ab4ce 100644
@@ -93,6 +93,12 @@ config USB_XHCI_BRCM
 	  USB controller based on the Broadcom USB3 IP Core.
 	  Supports USB2/3 functionality.
 
+config USB_XHCI_IPQ
+	bool "Support for Qualcomm IPQ on-chip DWC3 xHCI USB controller"
+	depends on DM_USB && PHY && USB_XHCI_DWC3 && ARCH_IPQ40XX 
+	help
+	  Enables support for the on-chip xHCI DWC3 controller on Qualcomm IPQ SoCs.
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
drivers/usb/host/Makefile +1 -0
index 29d4f87e38..0fa9c8f32a 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
+obj-$(CONFIG_USB_XHCI_IPQ) += xhci-ipq.o
 obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
 
 # designware
drivers/usb/host/xhci-ipq.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.26.2
#11 lore raw

PATCH v2 8/9 usb: xhci: Add Qualcomm DWC3 xHCI driver

Quoted 212 lines · Robert Marko

Add driver for Qualcomm DWC3 based dual role xHCI USB controller. Currently tested on IPQ40xx, but should support other Qualcomm SoC families as well.

Only host mode is supported.

---
 MAINTAINERS                                   |   2 +
 .../usb/qcom-dwc3-ipq.txt                     |  34 +++++
 drivers/usb/host/Kconfig                      |   6 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/xhci-ipq.c                   | 117 ++++++++++++++++++
 5 files changed, 160 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
 create mode 100644 drivers/usb/host/xhci-ipq.c
MAINTAINERS +2 -0
index d8d2c6278b..99828f656a 100644
@@ -241,6 +241,8 @@ F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
 F:	include/dt-bindings/reset/qcom,ipq4019-reset.h
 F:	drivers/reset/reset-ipq4019.c
 F:	drivers/phy/phy-qcom-ipq4019-usb.c
+F:	doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
+F:	drivers/usb/host/xhci-ipq.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt new file +34 -0
new file mode 100644
index 0000000000..a910a06fa2
@@ -0,0 +1,34 @@
+Qualcomm SuperSpeed DWC3 USB SoC controller
+
+This controller is integrated in IPQ40xx SoC-s.
+It is a dual role USB3.0/USB2.0 controller.
+
+Required properties :
+ - compatible: must be "qcom,dwc3-ipq"
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - #address-cells: must be 1
+ - #size-cells: must be 1
+ - phys: list of PHY specifiers
+ - phy-names: shall be "usb2-phy" and "usb3-phy"(In case of USB3.0 only)
+
+Example:
+	usb3: xhci at 8a00000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x8a00000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+		phy-names = "usb2-phy", "usb3-phy";
+		status = "disabled";
+	};
+
+	usb2: xhci at 6000000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x6000000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb2_hs_phy>;
+		phy-names = "usb2-phy";
+		status = "disabled";
+	};
drivers/usb/host/Kconfig +6 -0
index 1c374a7bd8..7e0b1ab4ce 100644
@@ -93,6 +93,12 @@ config USB_XHCI_BRCM
 	  USB controller based on the Broadcom USB3 IP Core.
 	  Supports USB2/3 functionality.
 
+config USB_XHCI_IPQ
+	bool "Support for Qualcomm IPQ on-chip DWC3 xHCI USB controller"
+	depends on DM_USB && PHY && USB_XHCI_DWC3 && ARCH_IPQ40XX 
+	help
+	  Enables support for the on-chip xHCI DWC3 controller on Qualcomm IPQ SoCs.
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
drivers/usb/host/Makefile +1 -0
index 29d4f87e38..0fa9c8f32a 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
+obj-$(CONFIG_USB_XHCI_IPQ) += xhci-ipq.o
 obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
 
 # designware
drivers/usb/host/xhci-ipq.c new file +107 -0
new file mode 100644
index 0000000000..840f074819
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Sartura Ltd.
+ *
+ * Qualcomm DWC3 controller driver
+ *
+ * Author: Robert Marko <[email protected]>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/usb/dwc3.h>
+#include <usb.h>
+#include <usb/xhci.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ipq_xhci_priv {
+	phys_addr_t					hcd_base;
+	struct xhci_ctrl 			ctrl;
+	struct xhci_hccr 			*hcd;
+	struct dwc3 				*dwc3_reg;
+	struct phy_bulk 			phys;
+};
+
+static int ipq_xhci_core_init(struct ipq_xhci_priv *ipq)
+{
+	int ret;
+
+	ret = dwc3_core_init(ipq->dwc3_reg);
+	if (ret) {
+		return ret;
+	}
+
+	/* We are hard-coding DWC3 core to Host Mode */
+	dwc3_set_mode(ipq->dwc3_reg, DWC3_GCTL_PRTCAP_HOST);
+
+	return ret;
+}
+
+static int ipq_xhci_core_exit(struct udevice *dev)
+{
+	struct ipq_xhci_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = generic_phy_power_off_bulk(&priv->phys);
+	ret |= generic_phy_exit_bulk(&priv->phys);
+	return ret;
+}
+
+static int ipq_xhci_usb_remove(struct udevice *dev)
+{
+	int ret;
+	ret = xhci_deregister(dev);
+
+	if (ret != 0) {
+		dev_err(dev, "XHCI deregistration failed\n");
+		return ret;
+	}
+
+	ipq_xhci_core_exit(dev);
+
+	return ret;
+}
+
+static int ipq_xhci_usb_probe(struct udevice *dev)
+{
+	struct ipq_xhci_priv *priv = dev_get_priv(dev);
+	struct xhci_hcor *hcor;
+	int ret;
+
+	priv->hcd_base = dev_read_addr(dev);
+	if (priv->hcd_base == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	ret = generic_phy_get_bulk(dev, &priv->phys);
+	if (ret)
+		return ret;
+
+	priv->hcd = (struct xhci_hccr *)priv->hcd_base;
+	priv->dwc3_reg = (struct dwc3 *)((char *)(priv->hcd) + DWC3_REG_OFFSET);
+	hcor = (struct xhci_hcor *)((uint32_t)priv->hcd +
+			HC_LENGTH(xhci_readl(&priv->hcd->cr_capbase)));
+
+	ret = generic_phy_power_on_bulk(&priv->phys);
+	if (ret)
+		generic_phy_exit_bulk(&priv->phys);
+
+	ret = ipq_xhci_core_init(priv);
+
+	if (ret) {
+		dev_err(dev, "Error initializing the XHCI controller\n");
+		return ret;
+	}
+
+	return xhci_register(dev, priv->hcd, hcor);
+}
+
+static const struct udevice_id ipq_xhci_match_ids[] = {
+	{ .compatible = "qcom,dwc3-ipq" },
+	{}
+};
+

drivers/usb/host/xhci-ipq.c line 117

Quoted 10 lines
drivers/usb/host/xhci-ipq.c new file +10 -0
+U_BOOT_DRIVER(usb_xhci) = {
+	.name	= "ipq_hci",
+	.id	= UCLASS_USB,
+	.of_match = ipq_xhci_match_ids,
+	.probe = ipq_xhci_usb_probe,
+	.remove = ipq_xhci_usb_remove,
+	.ops	= &xhci_usb_ops,
+	.priv_auto_alloc_size = sizeof(struct ipq_xhci_priv),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};

Adding USB maintainer.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200910/a3a68af1/attachment.sig>
#12 lore raw

PATCH v2 8/9 usb: xhci: Add Qualcomm DWC3 xHCI driver

Quoted 218 lines · Tom Rini
Quoted 216 lines · Robert Marko

Add driver for Qualcomm DWC3 based dual role xHCI USB controller. Currently tested on IPQ40xx, but should support other Qualcomm SoC families as well.

Only host mode is supported.

---
 MAINTAINERS                                   |   2 +
 .../usb/qcom-dwc3-ipq.txt                     |  34 +++++
 drivers/usb/host/Kconfig                      |   6 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/xhci-ipq.c                   | 117 ++++++++++++++++++
 5 files changed, 160 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
 create mode 100644 drivers/usb/host/xhci-ipq.c
MAINTAINERS +2 -0
index d8d2c6278b..99828f656a 100644
@@ -241,6 +241,8 @@ F:	include/dt-bindings/clock/qcom,ipq4019-gcc.h
 F:	include/dt-bindings/reset/qcom,ipq4019-reset.h
 F:	drivers/reset/reset-ipq4019.c
 F:	drivers/phy/phy-qcom-ipq4019-usb.c
+F:	doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
+F:	drivers/usb/host/xhci-ipq.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:	Stefan Roese <[email protected]>
doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt new file +34 -0
new file mode 100644
index 0000000000..a910a06fa2
@@ -0,0 +1,34 @@
+Qualcomm SuperSpeed DWC3 USB SoC controller
+
+This controller is integrated in IPQ40xx SoC-s.
+It is a dual role USB3.0/USB2.0 controller.
+
+Required properties :
+ - compatible: must be "qcom,dwc3-ipq"
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - #address-cells: must be 1
+ - #size-cells: must be 1
+ - phys: list of PHY specifiers
+ - phy-names: shall be "usb2-phy" and "usb3-phy"(In case of USB3.0 only)
+
+Example:
+	usb3: xhci at 8a00000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x8a00000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+		phy-names = "usb2-phy", "usb3-phy";
+		status = "disabled";
+	};
+
+	usb2: xhci at 6000000 {
+		compatible = "qcom,dwc3-ipq";
+		reg = <0x6000000 0xcd00>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		phys = <&usb2_hs_phy>;
+		phy-names = "usb2-phy";
+		status = "disabled";
+	};
drivers/usb/host/Kconfig +6 -0
index 1c374a7bd8..7e0b1ab4ce 100644
@@ -93,6 +93,12 @@ config USB_XHCI_BRCM
 	  USB controller based on the Broadcom USB3 IP Core.
 	  Supports USB2/3 functionality.
 
+config USB_XHCI_IPQ
+	bool "Support for Qualcomm IPQ on-chip DWC3 xHCI USB controller"
+	depends on DM_USB && PHY && USB_XHCI_DWC3 && ARCH_IPQ40XX 
+	help
+	  Enables support for the on-chip xHCI DWC3 controller on Qualcomm IPQ SoCs.
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
drivers/usb/host/Makefile +1 -0
index 29d4f87e38..0fa9c8f32a 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
+obj-$(CONFIG_USB_XHCI_IPQ) += xhci-ipq.o
 obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
 
 # designware
drivers/usb/host/xhci-ipq.c new file +111 -0
new file mode 100644
index 0000000000..840f074819
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Sartura Ltd.
+ *
+ * Qualcomm DWC3 controller driver
+ *
+ * Author: Robert Marko <[email protected]>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/usb/dwc3.h>
+#include <usb.h>
+#include <usb/xhci.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ipq_xhci_priv {
+	phys_addr_t					hcd_base;
+	struct xhci_ctrl 			ctrl;
+	struct xhci_hccr 			*hcd;
+	struct dwc3 				*dwc3_reg;
+	struct phy_bulk 			phys;
+};
+
+static int ipq_xhci_core_init(struct ipq_xhci_priv *ipq)
+{
+	int ret;
+
+	ret = dwc3_core_init(ipq->dwc3_reg);
+	if (ret) {
+		return ret;
+	}
+
+	/* We are hard-coding DWC3 core to Host Mode */
+	dwc3_set_mode(ipq->dwc3_reg, DWC3_GCTL_PRTCAP_HOST);
+
+	return ret;
+}
+
+static int ipq_xhci_core_exit(struct udevice *dev)
+{
+	struct ipq_xhci_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = generic_phy_power_off_bulk(&priv->phys);
+	ret |= generic_phy_exit_bulk(&priv->phys);
+	return ret;
+}
+
+static int ipq_xhci_usb_remove(struct udevice *dev)
+{
+	int ret;
+	ret = xhci_deregister(dev);
+
+	if (ret != 0) {
+		dev_err(dev, "XHCI deregistration failed\n");
+		return ret;
+	}
+
+	ipq_xhci_core_exit(dev);
+
+	return ret;
+}
+
+static int ipq_xhci_usb_probe(struct udevice *dev)
+{
+	struct ipq_xhci_priv *priv = dev_get_priv(dev);
+	struct xhci_hcor *hcor;
+	int ret;
+
+	priv->hcd_base = dev_read_addr(dev);
+	if (priv->hcd_base == FDT_ADDR_T_NONE)
+		return -EINVAL;
+
+	ret = generic_phy_get_bulk(dev, &priv->phys);
+	if (ret)
+		return ret;
+
+	priv->hcd = (struct xhci_hccr *)priv->hcd_base;
+	priv->dwc3_reg = (struct dwc3 *)((char *)(priv->hcd) + DWC3_REG_OFFSET);
+	hcor = (struct xhci_hcor *)((uint32_t)priv->hcd +
+			HC_LENGTH(xhci_readl(&priv->hcd->cr_capbase)));
+
+	ret = generic_phy_power_on_bulk(&priv->phys);
+	if (ret)
+		generic_phy_exit_bulk(&priv->phys);
+
+	ret = ipq_xhci_core_init(priv);
+
+	if (ret) {
+		dev_err(dev, "Error initializing the XHCI controller\n");
+		return ret;
+	}
+
+	return xhci_register(dev, priv->hcd, hcor);
+}
+
+static const struct udevice_id ipq_xhci_match_ids[] = {
+	{ .compatible = "qcom,dwc3-ipq" },
+	{}
+};
+
+U_BOOT_DRIVER(usb_xhci) = {
+	.name	= "ipq_hci",
+	.id	= UCLASS_USB,
+	.of_match = ipq_xhci_match_ids,
Quoted 8 lines

drivers/usb/host/xhci-ipq.c line 117

Quoted 6 lines
drivers/usb/host/xhci-ipq.c new file +6 -0
+	.probe = ipq_xhci_usb_probe,
+	.remove = ipq_xhci_usb_remove,
+	.ops	= &xhci_usb_ops,
+	.priv_auto_alloc_size = sizeof(struct ipq_xhci_priv),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};

Adding USB maintainer.

And adding Bin, since it's XHCI.

#13 lore raw

PATCH v2 8/9 usb: xhci: Add Qualcomm DWC3 xHCI driver

Quoted 229 lines · Marek Vasut
Quoted 218 lines · Tom Rini
Quoted 216 lines · Robert Marko

Add driver for Qualcomm DWC3 based dual role xHCI USB controller. Currently tested on IPQ40xx, but should support other Qualcomm SoC families as well.

Only host mode is supported.

---
 MAINTAINERS                                   |   2 +
 .../usb/qcom-dwc3-ipq.txt                     |  34 +++++
 drivers/usb/host/Kconfig                      |   6 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/xhci-ipq.c                   | 117 ++++++++++++++++++
 5 files changed, 160 insertions(+)
 create mode 100644 doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
 create mode 100644 drivers/usb/host/xhci-ipq.c
MAINTAINERS +2 -0
index d8d2c6278b..99828f656a 100644
@@ -241,6 +241,8 @@ F:       include/dt-bindings/clock/qcom,ipq4019-gcc.h
 F:  include/dt-bindings/reset/qcom,ipq4019-reset.h
 F:  drivers/reset/reset-ipq4019.c
 F:  drivers/phy/phy-qcom-ipq4019-usb.c
+F:  doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt
+F:  drivers/usb/host/xhci-ipq.c
 
 ARM MARVELL KIRKWOOD ARMADA-XP ARMADA-38X ARMADA-37XX ARMADA-7K/8K
 M:  Stefan Roese <[email protected]>
doc/device-tree-bindings/usb/qcom-dwc3-ipq.txt new file +34 -0
new file mode 100644
index 0000000000..a910a06fa2
@@ -0,0 +1,34 @@
+Qualcomm SuperSpeed DWC3 USB SoC controller
+
+This controller is integrated in IPQ40xx SoC-s.
+It is a dual role USB3.0/USB2.0 controller.
+
+Required properties :
+ - compatible: must be "qcom,dwc3-ipq"
+ - reg: should contain address and length of the standard XHCI
+   register set for the device.
+ - #address-cells: must be 1
+ - #size-cells: must be 1
+ - phys: list of PHY specifiers
+ - phy-names: shall be "usb2-phy" and "usb3-phy"(In case of USB3.0 only)
+
+Example:
+    usb3: xhci at 8a00000 {
+            compatible = "qcom,dwc3-ipq";
+            reg = <0x8a00000 0xcd00>;
+            #address-cells = <1>;
+            #size-cells = <1>;
+            phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+            phy-names = "usb2-phy", "usb3-phy";
+            status = "disabled";
+    };
+
+    usb2: xhci at 6000000 {
+            compatible = "qcom,dwc3-ipq";
+            reg = <0x6000000 0xcd00>;
+            #address-cells = <1>;
+            #size-cells = <1>;
+            phys = <&usb2_hs_phy>;
+            phy-names = "usb2-phy";
+            status = "disabled";
+    };
drivers/usb/host/Kconfig +6 -0
index 1c374a7bd8..7e0b1ab4ce 100644
@@ -93,6 +93,12 @@ config USB_XHCI_BRCM
       USB controller based on the Broadcom USB3 IP Core.
       Supports USB2/3 functionality.
 
+config USB_XHCI_IPQ
+    bool "Support for Qualcomm IPQ on-chip DWC3 xHCI USB controller"
+    depends on DM_USB && PHY && USB_XHCI_DWC3 && ARCH_IPQ40XX
+    help
+      Enables support for the on-chip xHCI DWC3 controller on Qualcomm IPQ SoCs.
+
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
drivers/usb/host/Makefile +1 -0
index 29d4f87e38..0fa9c8f32a 100644
@@ -55,6 +55,7 @@ obj-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o
+obj-$(CONFIG_USB_XHCI_IPQ) += xhci-ipq.o
 obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o
 
 # designware
drivers/usb/host/xhci-ipq.c new file +111 -0
new file mode 100644
index 0000000000..840f074819
@@ -0,0 +1,117 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Sartura Ltd.
+ *
+ * Qualcomm DWC3 controller driver
+ *
+ * Author: Robert Marko <[email protected]>
+ *
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <generic-phy.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
+#include <linux/usb/dwc3.h>
+#include <usb.h>
+#include <usb/xhci.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ipq_xhci_priv {
+    phys_addr_t                                     hcd_base;
+    struct xhci_ctrl                        ctrl;
+    struct xhci_hccr                        *hcd;
+    struct dwc3                             *dwc3_reg;
+    struct phy_bulk                         phys;
+};
+
+static int ipq_xhci_core_init(struct ipq_xhci_priv *ipq)
+{
+    int ret;
+
+    ret = dwc3_core_init(ipq->dwc3_reg);
+    if (ret) {
+            return ret;
+    }
+
+    /* We are hard-coding DWC3 core to Host Mode */
+    dwc3_set_mode(ipq->dwc3_reg, DWC3_GCTL_PRTCAP_HOST);
+
+    return ret;
+}
+
+static int ipq_xhci_core_exit(struct udevice *dev)
+{
+    struct ipq_xhci_priv *priv = dev_get_priv(dev);
+    int ret;
+
+    ret = generic_phy_power_off_bulk(&priv->phys);
+    ret |= generic_phy_exit_bulk(&priv->phys);
+    return ret;
+}
+
+static int ipq_xhci_usb_remove(struct udevice *dev)
+{
+    int ret;
+    ret = xhci_deregister(dev);
+
+    if (ret != 0) {
+            dev_err(dev, "XHCI deregistration failed\n");
+            return ret;
+    }
+
+    ipq_xhci_core_exit(dev);
+
+    return ret;
+}
+
+static int ipq_xhci_usb_probe(struct udevice *dev)
+{
+    struct ipq_xhci_priv *priv = dev_get_priv(dev);
+    struct xhci_hcor *hcor;
+    int ret;
+
+    priv->hcd_base = dev_read_addr(dev);
+    if (priv->hcd_base == FDT_ADDR_T_NONE)
+            return -EINVAL;
+
+    ret = generic_phy_get_bulk(dev, &priv->phys);
+    if (ret)
+            return ret;
+
+    priv->hcd = (struct xhci_hccr *)priv->hcd_base;
+    priv->dwc3_reg = (struct dwc3 *)((char *)(priv->hcd) + DWC3_REG_OFFSET);
+    hcor = (struct xhci_hcor *)((uint32_t)priv->hcd +
+                    HC_LENGTH(xhci_readl(&priv->hcd->cr_capbase)));
+
+    ret = generic_phy_power_on_bulk(&priv->phys);
+    if (ret)
+            generic_phy_exit_bulk(&priv->phys);
+
+    ret = ipq_xhci_core_init(priv);
+
+    if (ret) {
+            dev_err(dev, "Error initializing the XHCI controller\n");
+            return ret;
+    }
+
+    return xhci_register(dev, priv->hcd, hcor);
+}
+
+static const struct udevice_id ipq_xhci_match_ids[] = {
+    { .compatible = "qcom,dwc3-ipq" },
+    {}
+};
+
+U_BOOT_DRIVER(usb_xhci) = {
+    .name   = "ipq_hci",
+    .id     = UCLASS_USB,
+    .of_match = ipq_xhci_match_ids,
Quoted 8 lines

drivers/usb/host/xhci-ipq.c line 117

Quoted 6 lines
drivers/usb/host/xhci-ipq.c new file +6 -0
+    .probe = ipq_xhci_usb_probe,
+    .remove = ipq_xhci_usb_remove,
+    .ops    = &xhci_usb_ops,
+    .priv_auto_alloc_size = sizeof(struct ipq_xhci_priv),
+    .flags  = DM_FLAG_ALLOC_PRIV_DMA,
+};

Adding USB maintainer.

Quoted 1 line

And adding Bin, since it's XHCI.

No need to bother reviewing this, I dropped it in the next patch series that will be sent in a couple of minutes Regards Robert

#14 lore raw

PATCH v2 9/9 IPQ40xx: Add USB nodes

In reply to Robert Marko

There are drivers to support built in USB controller and PHY-s now, so lets add the USB nodes to DTSI.

---
 arch/arm/dts/qcom-ipq4019.dtsi | 50 ++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/arm/dts/qcom-ipq4019.dtsi +50 -0
index 7b15df38d8..494b2205a5 100644
@@ -90,5 +90,55 @@
 			gpio-bank-name="soc";
 			#gpio-cells = <2>;
 		};
+
+		usb3_ss_phy: ssphy at 9a000 {
+			compatible = "qcom,usb-ss-ipq4019-phy";
+			#phy-cells = <0>;
+			reg = <0x9a000 0x800>;
+			reg-names = "phy_base";
+			resets = <&reset USB3_UNIPHY_PHY_ARES>;
+			reset-names = "por_rst";
+			status = "disabled";
+		};
+
+		usb3_hs_phy: hsphy at a6000 {
+			compatible = "qcom,usb-hs-ipq4019-phy";
+			#phy-cells = <0>;
+			reg = <0xa6000 0x40>;
+			reg-names = "phy_base";
+			resets = <&reset USB3_HSPHY_POR_ARES>, <&reset USB3_HSPHY_S_ARES>;
+			reset-names = "por_rst", "srif_rst";
+			status = "disabled";
+		};
+
+		usb3: xhci at 8a00000 {
+			compatible = "qcom,dwc3-ipq";
+			reg = <0x8a00000 0xcd00>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+			phy-names = "usb2-phy", "usb3-phy";
+			status = "disabled";
+		};
+
+		usb2_hs_phy: hsphy at a8000 {
+			compatible = "qcom,usb-hs-ipq4019-phy";
+			#phy-cells = <0>;
+			reg = <0xa8000 0x40>;
+			reg-names = "phy_base";
+			resets = <&reset USB2_HSPHY_POR_ARES>, <&reset USB2_HSPHY_S_ARES>;
+			reset-names = "por_rst", "srif_rst";
+			status = "disabled";
+		};
+
+		usb2: xhci at 6000000 {
+			compatible = "qcom,dwc3-ipq";
+			reg = <0x6000000 0xcd00>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			phys = <&usb2_hs_phy>;
+			phy-names = "usb2-phy";
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.26.2