Skip to contentSkip to conversation

MIPS: ralink: use the dwc2 driver for the rt305x USB controller

PATCH In review Matthijs Kooijman 3 participants 6 messages Apr 15, 2013

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

PATCH 1/3 MIPS: ralink: use the dwc2 driver for the rt305x USB controller

This sets up the devicetree file for the rt3050 chip series and rt3052 eval board to use the right compatible string for the dwc2 driver.

---
 arch/mips/ralink/dts/rt3050.dtsi     | 10 ++++++++++
 arch/mips/ralink/dts/rt3052_eval.dts |  4 ++++
 2 files changed, 14 insertions(+)

v2: Rebased on top of mips-next-3.10
Renamed device from "otg" to "usb"

arch/mips/ralink/dts/rt3050.dtsi +10 -0
index ef7da1e..e3203d4 100644
@@ -55,4 +55,14 @@
 			reg-shift = <2>;
 		};
 	};
+
+	usb@101c0000 {
+		compatible = "ralink,rt3050-usb", "snps,dwc2";
+		reg = <0x101c0000 40000>;
+
+		interrupt-parent = <&intc>;
+		interrupts = <18>;
+
+		status = "disabled";
+	};
 };
arch/mips/ralink/dts/rt3052_eval.dts +4 -0
index a2341c1..93061ff 100644
@@ -45,4 +45,8 @@
 			reg = <0x50000 0x7b0000>;
 		};
 	};
+
+	usb@101c0000 {
+		status = "ok";
+	};
 };
Signature · 1 line
1.8.0
#1 lore raw

PATCH 2/3 MIPS: ralink: setup dma_mask for the rt305x dwc2 usb controller

From: John Crispin <[email protected]>

Add code to setup the dma mask for the usb dwc2 platform driver on Ralink SoC. This contains a bit more code than strictly necessary, so it can also be used to set up ehci and ohci on other ralink platforms later on.

---
 arch/mips/ralink/Makefile     |  2 +-
 arch/mips/ralink/common.h     |  2 ++
 arch/mips/ralink/mt7620.c     |  5 +++++
 arch/mips/ralink/of.c         |  2 ++
 arch/mips/ralink/rt288x.c     |  4 ++++
 arch/mips/ralink/rt305x-usb.c | 51 +++++++++++++++++++++++++++++++++++++++++++
 arch/mips/ralink/rt3883.c     |  5 +++++
 7 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/ralink/rt305x-usb.c

v2: Rebased on top of mips-next-3.10
Switched order with next patch
Renamed ralink_usb_platform() to ralink_usb_init() Added empty function to rt288x.c

arch/mips/ralink/Makefile +1 -1
index 38cf1a8..c5572a3 100644
@@ -9,7 +9,7 @@
 obj-y := prom.o of.o reset.o clk.o irq.o
 
 obj-$(CONFIG_SOC_RT288X) += rt288x.o
-obj-$(CONFIG_SOC_RT305X) += rt305x.o
+obj-$(CONFIG_SOC_RT305X) += rt305x.o rt305x-usb.o
 obj-$(CONFIG_SOC_RT3883) += rt3883.o
 obj-$(CONFIG_SOC_MT7620) += mt7620.o
 
arch/mips/ralink/common.h +2 -0
index 83144c3..20089cae 100644
@@ -50,4 +50,6 @@ extern void prom_soc_init(struct ralink_soc_info *soc_info);
 
 __iomem void *plat_of_remap_node(const char *node);
 
+void ralink_usb_init(void);
+
 #endif /* _RALINK_COMMON_H__ */
arch/mips/ralink/mt7620.c +5 -0
index 3740826..220dc69 100644
@@ -137,6 +137,11 @@ struct ralink_pinmux rt_gpio_pinmux = {
 	.uart_mask = MT7620_GPIO_MODE_GPIO,
 };
 
+void ralink_usb_init(void)
+{
+
+}
+
 void __init ralink_clk_init(void)
 {
 	unsigned long cpu_rate, sys_rate;
arch/mips/ralink/of.c +2 -0
index d285ea8..b63623b 100644
@@ -108,6 +108,8 @@ static int __init plat_of_setup(void)
 	if (of_platform_populate(NULL, of_ids, NULL, NULL))
 		panic("failed to populate DT\n");
 
+	ralink_usb_init();
+
 	return 0;
 }
 
arch/mips/ralink/rt288x.c +4 -0
index f87de1a..652201c 100644
@@ -74,6 +74,10 @@ struct ralink_pinmux rt_gpio_pinmux = {
 	.wdt_reset = rt288x_wdt_reset,
 };
 
+void ralink_usb_init(void)
+{
+}
+
 void __init ralink_clk_init(void)
 {
 	unsigned long cpu_rate;
arch/mips/ralink/rt305x-usb.c new file +51 -0

51 lines not on this page · raw message

arch/mips/ralink/rt3883.c +5 -0
index afbf2ce..c403696 100644
@@ -166,6 +166,11 @@ struct ralink_pinmux rt_gpio_pinmux = {
 	.pci_mask = RT3883_GPIO_MODE_PCI_MASK,
 };
 
+void ralink_usb_init(void)
+{
+}
+
+
 void __init ralink_clk_init(void)
 {
 	unsigned long cpu_rate, sys_rate;
Signature · 1 line
1.8.0
maintainer
#2 lore raw

Re: [PATCH 2/3] MIPS: ralink: setup dma_mask for the rt305x dwc2 usb controller

arch/mips/ralink/mt7620.c struct ralink_pinmux rt_gpio_pinmux = { · line 144

Quoted 13 lines · Matthijs Kooijman
arch/mips/ralink/mt7620.c +5 -0
index 3740826..220dc69 100644
@@ -137,6 +137,11 @@ struct ralink_pinmux rt_gpio_pinmux = {
  	.uart_mask = MT7620_GPIO_MODE_GPIO,
  };
 
+void ralink_usb_init(void)
+{
+
+}
+

Hi,

i'll post a different patch later that eliminates the need for these empty stubs.

John

#3 lore raw

PATCH 3/3 owrt: MIPS: ralink: add usb platform support

In reply to Matthijs Kooijman

From: John Crispin <[email protected]>

Add code to load the platform ehci/ohci driver on Ralink SoC. For the usb core to work we need to populate the platform_data during boot, prior to the usb driver being loaded.

[[email protected]: Extracted non-ohci/ehci 3052 code into separate patch]
---
 arch/mips/ralink/Makefile     |   2 +-
 arch/mips/ralink/rt305x-usb.c |  74 ++++++++++++++++++++++++++
 arch/mips/ralink/rt3883-usb.c | 118 ++++++++++++++++++++++++++++++++++++++++++
 arch/mips/ralink/rt3883.c     |   5 --
 4 files changed, 193 insertions(+), 6 deletions(-)
 create mode 100644 arch/mips/ralink/rt3883-usb.c

v2: Rebased on top of mips-next-3.10
Switched order with previous patch

This patch isn't intended for mips-next-3.10 yet.

arch/mips/ralink/Makefile +1 -1
index c5572a3..ef7d6c8 100644
@@ -10,7 +10,7 @@ obj-y := prom.o of.o reset.o clk.o irq.o
 
 obj-$(CONFIG_SOC_RT288X) += rt288x.o
 obj-$(CONFIG_SOC_RT305X) += rt305x.o rt305x-usb.o
-obj-$(CONFIG_SOC_RT3883) += rt3883.o
+obj-$(CONFIG_SOC_RT3883) += rt3883.o rt3883-usb.o
 obj-$(CONFIG_SOC_MT7620) += mt7620.o
 
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
arch/mips/ralink/rt305x-usb.c +74 -0

95 lines not on this page · raw message

arch/mips/ralink/rt3883-usb.c new file +118 -0

118 lines not on this page · raw message

arch/mips/ralink/rt3883.c +0 -5
index c403696..afbf2ce 100644
@@ -166,11 +166,6 @@ struct ralink_pinmux rt_gpio_pinmux = {
 	.pci_mask = RT3883_GPIO_MODE_PCI_MASK,
 };
 
-void ralink_usb_init(void)
-{
-}
-
-
 void __init ralink_clk_init(void)
 {
 	unsigned long cpu_rate, sys_rate;
Signature · 1 line
1.8.0
maintainer
#4 lore raw

Re: [PATCH 3/3] owrt: MIPS: ralink: add usb platform support

Quoted 9 lines · Matthijs Kooijman

From: John Crispin<[email protected]>

Add code to load the platform ehci/ohci driver on Ralink SoC. For the usb core to work we need to populate the platform_data during boot, prior to the usb driver being loaded.

[[email protected]: Extracted non-ohci/ehci 3052 code into separate patch]

Hi,

this patch sits ontop of a patch from openwrt that adds a OF binding for ohci/ehci so it wont go upstream until the usb people decided how to expose ohci-platform and ehci-platform in OF

John

#5 lore raw

Re: [PATCH 3/3] owrt: MIPS: ralink: add usb platform support

Hello.

Quoted 6 lines · John Crispin
Quoted 5 lines

From: John Crispin<[email protected]>

Add code to load the platform ehci/ohci driver on Ralink SoC. For the usb core to work we need to populate the platform_data during boot, prior to the usb driver being loaded.

Quoted 7 lines
Quoted 3 lines
[[email protected]: Extracted non-ohci/ehci 3052 code into separate patch]

this patch sits ontop of a patch from openwrt that adds a OF binding for ohci/ehci so it wont go upstream until the usb people decided how to expose ohci-platform and ehci-platform in OF

Note that there's already a patch exposing ehci-platform to DT in Greg's
'usb-next' branch:

https://git.kernel.org/cgit/linux/kernel/git/gregkh/usb.git/commit/?h=usb-next&id=f3bc64d6d1f21c1b92d75f233a37b75d77af6963

Quoted 1 line

John

WBR, Sergei