Skip to contentSkip to conversation

Patches to add support for Rockchip dwc2 controller

PATCH Superseded Kever Yang 2 participants 7 messages Jul 31, 2014

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Kever Yang

author
#0 lore raw

v3 cover Patches to add support for Rockchip dwc2 controller

These patches to add support for dwc2 controller found in Rockchip processors rk3066, rk3188 and rk3288, and enable dts for rk3288 evb.

Reposting series with the proper email address.

Changes in v3:
- Moved out of pin control and sort by base address
- EHCI and HSIC move new for version 3.
- Rebase

Changes in v2:
- Split out dr_mode and rk3288 bindings.
- add compatible "snps,dwc2" bingding info
- set most parameters as driver auto-detect
- change the node name from 'dwc2' to 'usb'
- evb patch added in version 2

Doug Anderson (1):
ARM: dts: Fix the sort ordering of EHCI and HSIC in rk3288.dtsi

Kever Yang (4):
Documentation: dt-bindings: add dt binding info for Rockchip dwc2
usb: dwc2: add compatible data for rockchip soc
ARM: dts: add rk3288 dwc2 controller support
ARM: dts: Enable USB otg and host1(dwc) on rk3288-evb

 Documentation/devicetree/bindings/usb/dwc2.txt |    3 ++
 arch/arm/boot/dts/rk3288-evb.dtsi              |    6 +++
 arch/arm/boot/dts/rk3288.dtsi                  |   61 ++++++++++++++++--------
 drivers/usb/dwc2/platform.c                    |   29 +++++++++++
 4 files changed, 78 insertions(+), 21 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v3 1/5 Documentation: dt-bindings: add dt binding info for Rockchip dwc2

This add necessary dwc2 binding documentation for Rockchip socs:
rk3066, rk3188 and rk3288

---

Changes in v3: None
Changes in v2:
- Split out dr_mode and rk3288 bindings.
- add compatible "snps,dwc2" bingding info

 Documentation/devicetree/bindings/usb/dwc2.txt |    3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/dwc2.txt +3 -0
index 467ddd1..2899679 100644
@@ -4,6 +4,9 @@ Platform DesignWare HS OTG USB 2.0 controller
 Required properties:
 - compatible : One of:
   - brcm,bcm2835-usb: The DWC2 USB controller instance in the BCM2835 SoC.
+  - rockchip,rk3066-usb: The DWC2 USB controller instance in the rk3066 Soc;
+  - "rockchip,rk3188-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3188 Soc;
+  - "rockchip,rk3288-usb", "rockchip,rk3066-usb", "snps,dwc2": for rk3288 Soc;
   - snps,dwc2: A generic DWC2 USB controller with default parameters.
 - reg : Should contain 1 register range (address and length)
 - interrupts : Should contain 1 interrupt
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v3 2/5 usb: dwc2: add compatible data for rockchip soc

In reply to Kever Yang

This patch add compatible data for dwc2 controller found on rk3066, rk3188 and rk3288 processors from rockchip.

---

Changes in v3: None
Changes in v2:
- set most parameters as driver auto-detect

 drivers/usb/dwc2/platform.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
drivers/usb/dwc2/platform.c +29 -0
index a10e7a3..b533a0d 100644
@@ -75,6 +75,34 @@ static const struct dwc2_core_params params_bcm2835 = {
 	.uframe_sched			= 0,
 };
 
+static const struct dwc2_core_params params_rk3066 = {
+	.otg_cap			= 2,	/* non-HNP/non-SRP */
+	.otg_ver			= -1,
+	.dma_enable			= -1,
+	.dma_desc_enable		= 0,
+	.speed				= -1,
+	.enable_dynamic_fifo		= 1,
+	.en_multiple_tx_fifo		= -1,
+	.host_rx_fifo_size		= 520,	/* 520 DWORDs */
+	.host_nperio_tx_fifo_size	= 128,	/* 128 DWORDs */
+	.host_perio_tx_fifo_size	= 256,	/* 256 DWORDs */
+	.max_transfer_size		= -1,
+	.max_packet_count		= -1,
+	.host_channels			= -1,
+	.phy_type			= -1,
+	.phy_utmi_width			= -1,
+	.phy_ulpi_ddr			= -1,
+	.phy_ulpi_ext_vbus		= -1,
+	.i2c_enable			= -1,
+	.ulpi_fs_ls			= -1,
+	.host_support_fs_ls_low_power	= -1,
+	.host_ls_low_power_phy_clk	= -1,
+	.ts_dline			= -1,
+	.reload_ctl			= -1,
+	.ahbcfg				= 0x7, /* INCR16 */
+	.uframe_sched			= -1,
+};
+
 /**
  * dwc2_driver_remove() - Called when the DWC_otg core is unregistered with the
  * DWC_otg driver
@@ -97,6 +125,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
 
 static const struct of_device_id dwc2_of_match_table[] = {
 	{ .compatible = "brcm,bcm2835-usb", .data = &params_bcm2835 },
+	{ .compatible = "rockchip,rk3066-usb", .data = &params_rk3066 },
 	{ .compatible = "snps,dwc2", .data = NULL },
 	{},
 };
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v3 3/5 ARM: dts: add rk3288 dwc2 controller support

In reply to Kever Yang

rk3288 has two kind of usb controller, this add the dwc2 controller for otg and host1.

Controller can works with usb PHY default setting and Vbus on.

---

Changes in v3:
- Moved out of pin control and sort by base address

Changes in v2:
- change the node name from 'dwc2' to 'usb'

 arch/arm/boot/dts/rk3288.dtsi |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/rk3288.dtsi +20 -0
index ab8a611..a5607a1 100644
@@ -205,6 +205,26 @@
 		status = "disabled";
 	};
 
+	usb_host1: usb at ff540000 {
+		compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
+				"snps,dwc2";
+		reg = <0xff540000 0x40000>;
+		interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_USBHOST1>;
+		clock-names = "otg";
+		status = "disabled";
+	};
+
+	usb_otg: usb at ff580000 {
+		compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
+				"snps,dwc2";
+		reg = <0xff580000 0x40000>;
+		interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_OTG0>;
+		clock-names = "otg";
+		status = "disabled";
+	};
+
 	uart2: serial at ff690000 {
 		compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
 		reg = <0xff690000 0x100>;
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v3 4/5 ARM: dts: Fix the sort ordering of EHCI and HSIC in rk3288.dtsi

In reply to Kever Yang

From: Doug Anderson <[email protected]>

The EHCI and HSIC device tree nodes were added in the wrong place. Fix them.

---

Changes in v3:
- EHCI and HSIC move new for version 3.

Changes in v2: None

 arch/arm/boot/dts/rk3288.dtsi |   41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)
arch/arm/boot/dts/rk3288.dtsi +20 -21
index a5607a1..673dee3 100644
@@ -205,6 +205,17 @@
 		status = "disabled";
 	};
 
+	usb_host0_ehci: ehci at ff500000 {
+		compatible = "generic-ehci";
+		reg = <0xff500000 0x100>;
+		interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_USBHOST0>;
+		clock-names = "usbhost";
+		status = "disabled";
+	};
+
+	/* NOTE: ohci at ff520000 doesn't actually work on hardware */
+
 	usb_host1: usb at ff540000 {
 		compatible = "rockchip,rk3288-usb", "rockchip,rk3066-usb",
 				"snps,dwc2";
@@ -225,6 +236,15 @@
 		status = "disabled";
 	};
 
+	usb_hsic: ehci at ff5c0000 {
+		compatible = "generic-ehci";
+		reg = <0xff5c0000 0x100>;
+		interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru HCLK_HSIC>;
+		clock-names = "usbhost";
+		status = "disabled";
+	};
+
 	uart2: serial at ff690000 {
 		compatible = "rockchip,rk3288-uart", "snps,dw-apb-uart";
 		reg = <0xff690000 0x100>;
@@ -319,27 +339,6 @@
 		interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
-
-	usb_host0_ehci: ehci at ff500000 {
-		compatible = "generic-ehci";
-		reg = <0xff500000 0x100>;
-		interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&cru HCLK_USBHOST0>;
-		clock-names = "usbhost";
-		status = "disabled";
-	};
-
-	/* NOTE: ohci at ff520000 doesn't actually work on hardware */
-
-	usb_hsic: ehci at ff5c0000 {
-		compatible = "generic-ehci";
-		reg = <0xff5c0000 0x100>;
-		interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&cru HCLK_HSIC>;
-		clock-names = "usbhost";
-		status = "disabled";
-	};
-
 	gic: interrupt-controller at ffc01000 {
 		compatible = "arm,gic-400";
 		interrupt-controller;
Signature · 1 line
1.7.9.5
#5 lore raw

Re: [REPOST PATCH v3 4/5] ARM: dts: Fix the sort ordering of EHCI and HSIC in rk3288.dtsi

Kever,

Quoted 22 lines · Kever Yang

From: Doug Anderson <[email protected]>

The EHCI and HSIC device tree nodes were added in the wrong place. Fix them.

---

Changes in v3:
- EHCI and HSIC move new for version 3.

Changes in v2: None

 arch/arm/boot/dts/rk3288.dtsi |   41 ++++++++++++++++++++---------------------
 1 file changed, 20 insertions(+), 21 deletions(-)
arch/arm/boot/dts/rk3288.dtsi +0 -0
index a5607a1..673dee3 100644

arch/arm/boot/dts/rk3288.dtsi line 208

Quoted 4 lines
arch/arm/boot/dts/rk3288.dtsi +1 -0
@@ -205,6 +205,17 @@
                status = "disabled";
        };
 
+       usb_host0_ehci: ehci at ff500000 {

Argh. When I was helping you I messed this up. :( I pointed you at an older version of the EHCI patch.

I'll post a fixup myself. Sorry for the bother...

-Doug

author
#6 lore raw

PATCH v3 5/5 ARM: dts: Enable USB otg and host1(dwc) on rk3288-evb

In reply to Kever Yang

USB otg port is the usb3.0 b-port on the board. USB host1 port is the host A port nearby the otg port.

---

Changes in v3:
- Rebase

Changes in v2:
- evb patch added in version 2

 arch/arm/boot/dts/rk3288-evb.dtsi |    6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/rk3288-evb.dtsi +6 -0
index 66f76a6..35a0837 100644
@@ -127,3 +127,9 @@
 &usb_host0_ehci {
 	status = "okay";
 };
+&usb_host1 {
+	status = "okay";
+};
+&usb_otg {
+	status = "okay";
+};
Signature · 1 line
1.7.9.5