Skip to contentSkip to conversation

IPQ40xx: Improve support

PATCH New Robert Marko 2 participants 16 messages Sep 10, 2020 – Sep 19, 2020

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

v3 cover IPQ40xx: Improve support

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

v3 series drops custom USB driver and instead uses existing DWC3 generic driver.

Robert Marko (8):
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: Add Qualcomm DWC3 compatible string
IPQ40xx: Add USB nodes

 MAINTAINERS                                   |   4 +
 arch/arm/Kconfig                              |   3 +
 arch/arm/dts/qcom-ipq4019.dtsi                |  93 +++++++++-
 arch/arm/mach-ipq40xx/clock-ipq4019.c         |   4 +-
 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/dwc3/dwc3-generic.c               |   1 +
 include/dt-bindings/clock/qcom,ipq4019-gcc.h  |  96 ++++++++++
 .../dt-bindings/reset/qcom,ipq4019-reset.h    |  92 ++++++++++
 14 files changed, 626 insertions(+), 3 deletions(-)
 create mode 100644 drivers/phy/phy-qcom-ipq4019-usb.c
 create mode 100644 drivers/reset/reset-ipq4019.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 v3 1/8 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 101f4e185d..fa73c4e025 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 v3 1/8 dt-bindings: clock: import Qualcomm IPQ4019 bindings

Quoted 5 lines · Robert Marko

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.

Applied to u-boot/next, thanks!

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/20200919/cb6e34b7/attachment.sig>
#3 lore raw

PATCH v3 2/8 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
#4 lore raw

PATCH v3 2/8 IPQ40xx: clk: Use dt-bindings instead of hardcoding

Quoted 5 lines · 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.

Applied to u-boot/next, thanks!

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/20200919/57a62ef0/attachment.sig>
#5 lore raw

PATCH v3 3/8 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
#6 lore raw

PATCH v3 3/8 IPQ40xx: Add SMEM support

Quoted 4 lines · Robert Marko

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

Applied to u-boot/next, thanks!

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/20200919/d848927c/attachment.sig>
#7 lore raw

PATCH v3 4/8 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 fa73c4e025..1f00d5fced 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
#8 lore raw

PATCH v3 4/8 reset: Add IPQ40xx reset controller driver

Quoted 5 lines · 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.

Applied to u-boot/next, thanks!

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/20200919/4886bd0b/attachment.sig>
#9 lore raw

PATCH v3 5/8 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
#10 lore raw

PATCH v3 6/8 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 1f00d5fced..c0e9285124 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
#11 lore raw

PATCH v3 6/8 phy: add driver for Qualcomm IPQ40xx USB PHY

Quoted 5 lines · Robert Marko

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

Applied to u-boot/next, thanks!

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/20200919/4b19e505/attachment.sig>
#12 lore raw

PATCH v3 7/8 usb: dwc3: Add Qualcomm DWC3 compatible string

In reply to Robert Marko

Lot of Qualcomm SoC-s use DWC3 controller for both USB2.0 and USB3.0 ports.
Qualcomm has some custom config registers on top of the generic ones, but for host mode these are not needed.

So lets add the neccessary compatible string.

---
 drivers/usb/dwc3/dwc3-generic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-generic.c +1 -0
index 551f682024..7fbf2502fa 100644
@@ -449,6 +449,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "ti,am654-dwc3" },
 	{ .compatible = "rockchip,rk3328-dwc3" },
 	{ .compatible = "rockchip,rk3399-dwc3" },
+	{ .compatible = "qcom,dwc3" },
 	{ }
 };
 
Signature · 1 line
2.26.2
#13 lore raw

PATCH v3 7/8 usb: dwc3: Add Qualcomm DWC3 compatible string

Quoted 9 lines · Robert Marko

Lot of Qualcomm SoC-s use DWC3 controller for both USB2.0 and USB3.0 ports.
Qualcomm has some custom config registers on top of the generic ones, but for host mode these are not needed.

So lets add the neccessary compatible string.

Applied to u-boot/next, thanks!

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/20200919/f57af371/attachment.sig>
#14 lore raw

PATCH v3 8/8 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 | 76 ++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
arch/arm/dts/qcom-ipq4019.dtsi +76 -0
index 7b15df38d8..e0e4188e5d 100644
@@ -90,5 +90,81 @@
 			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: usb3 at 8af8800 {
+			compatible = "qcom,dwc3";
+			reg = <0x8af8800 0x100>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			clocks = <&gcc GCC_USB3_MASTER_CLK>,
+				 <&gcc GCC_USB3_SLEEP_CLK>,
+				 <&gcc GCC_USB3_MOCK_UTMI_CLK>;
+			clock-names = "master", "sleep", "mock_utmi";
+			ranges;
+			status = "disabled";
+
+			dwc3 at 8a00000 {
+				compatible = "snps,dwc3";
+				reg = <0x8a00000 0xf8000>;
+				phys = <&usb3_hs_phy>, <&usb3_ss_phy>;
+				phy-names = "usb2-phy", "usb3-phy";
+				dr_mode = "host";
+				maximum-speed = "super-speed";
+				snps,dis_u2_susphy_quirk;
+			};
+		};
+
+		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: usb2 at 60f8800 {
+			compatible = "qcom,dwc3";
+			reg = <0x60f8800 0x100>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			clocks = <&gcc GCC_USB2_MASTER_CLK>,
+				 <&gcc GCC_USB2_SLEEP_CLK>,
+				 <&gcc GCC_USB2_MOCK_UTMI_CLK>;
+			clock-names = "master", "sleep", "mock_utmi";
+			ranges;
+			status = "disabled";
+
+			dwc3 at 6000000 {
+				compatible = "snps,dwc3";
+				reg = <0x6000000 0xf8000>;
+				phys = <&usb2_hs_phy>;
+				phy-names = "usb2-phy";
+				dr_mode = "host";
+				maximum-speed = "high-speed";
+				snps,dis_u2_susphy_quirk;
+			};
+		};
 	};
 };
Signature · 1 line
2.26.2
#15 lore raw

PATCH v3 8/8 IPQ40xx: Add USB nodes

Quoted 4 lines · Robert Marko

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

Applied to u-boot/next, thanks!

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/20200919/52757778/attachment.sig>