Skip to contentSkip to conversation

Add USB support to R8A7778/BOCK-W

PATCH RESEND New Sergei Shtylyov 2 participants 5 messages Jun 8, 2013 – Jun 11, 2013

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

v9 cover Add USB support to R8A7778/BOCK-W

Hello.

Here's the set of 3 patches against the Simon Horman's 'renesas.git' repo,
'renesas-next-20130607' tag, and the R8A7779/Marzen USB patchset I've posted. It was created to add support of R8A7778/BOCK-W USB to the platform code and the USB common PHY driver, and so spans both arch/arm/mach-shmobile/ and drivers/usb/phy/ subtrees.

[1/3] phy-rcar-usb: add R8A7778 support
[2/3] ARM: shmobile: r8a7778: add USB support
[3/3] ARM: shmobile: BOCK-W: add USB support

The patchset is completely ready for merging now.

WBR, Sergei

#1 lore raw

PATCH RESEND v9 2/3 ARM: shmobile: r8a7778: add USB support

Add USB clock and EHCI, OHCI, and USB PHY platform devices for R8A7778 SoC; add a function to register PHY device with board-specific platform data and register EHCI and OHCI platfrom devices from the init_late() board method.

Also, don't forget to enable CONFIG_ARCH_HAS_[EO]HCI options for R8A7778 SoC in Kconfig...

The patch has been tested on the BOCK-W board.

---
Changes since version 8:
- resolved reject;

Changes since version 7:
- changed PHY checks to IS_ERR(phy) and returning PTR_ERR(phy) where applicable;
- resolved reject.

Changes since version 5:
- renamed the R-Car PHY driver header file in #include.

Changes since version 4:
- annotated USB resources and '[eo]hci_info' as '__initdata' since they're kmemdup()'ed while registering the platform devices anyway;
- refreshed the patch.

Changes since version 3:
- resolved reject in the 'clock-r8a7778.c' file, refreshed the patch.

Changes since version 2:
- refreshed the patch.

Changes since the original posting:
- resolved rejects in the 'clock-r8a7778.c' file;
- lowercased the SoC name in the subject.

 arch/arm/mach-shmobile/Kconfig                |    2 
 arch/arm/mach-shmobile/clock-r8a7778.c        |    4 
 arch/arm/mach-shmobile/include/mach/r8a7778.h |    3 
 arch/arm/mach-shmobile/setup-r8a7778.c        |  108 ++++++++++++++++++++++++++
 4 files changed, 117 insertions(+)
arch/arm/mach-shmobile/Kconfig +2 -0
Index: renesas/arch/arm/mach-shmobile/Kconfig
===================================================================
@@ -41,6 +41,8 @@ config ARCH_R8A7778
 	select CPU_V7
 	select SH_CLK_CPG
 	select ARM_GIC
+	select USB_ARCH_HAS_EHCI
+	select USB_ARCH_HAS_OHCI
 
 config ARCH_R8A7779
 	bool "R-Car H1 (R8A77790)"
arch/arm/mach-shmobile/clock-r8a7778.c +4 -0
Index: renesas/arch/arm/mach-shmobile/clock-r8a7778.c
===================================================================
@@ -105,6 +105,7 @@ static struct clk *main_clks[] = {
 enum {
 	MSTP323, MSTP322, MSTP321,
 	MSTP114,
+	MSTP100,
 	MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021,
 	MSTP016, MSTP015,
 	MSTP_NR };
@@ -114,6 +115,7 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */
 	[MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */
 	[MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */
+	[MSTP100] = SH_CLK_MSTP32(&p_clk, MSTPCR1,  0, 0), /* USB0/1 */
 	[MSTP026] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 26, 0), /* SCIF0 */
 	[MSTP025] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 25, 0), /* SCIF1 */
 	[MSTP024] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 24, 0), /* SCIF2 */
@@ -130,6 +132,8 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */
 	CLKDEV_DEV_ID("sh-eth",	&mstp_clks[MSTP114]), /* Ether */
+	CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */
+	CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */
 	CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */
 	CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */
 	CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */
arch/arm/mach-shmobile/include/mach/r8a7778.h +3 -0
Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h
===================================================================
@@ -20,10 +20,13 @@
 
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/sh_eth.h>
+#include <linux/platform_data/usb-rcar-phy.h>
 
 extern void r8a7778_add_standard_devices(void);
 extern void r8a7778_add_standard_devices_dt(void);
 extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
+extern void r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata);
+extern void r8a7778_init_late(void);
 extern void r8a7778_init_delay(void);
 extern void r8a7778_init_irq(void);
 extern void r8a7778_init_irq_dt(void);
arch/arm/mach-shmobile/setup-r8a7778.c +108 -0

132 lines not on this page · raw message

#2 lore raw

PATCH RESEND v9 3/3 ARM: shmobile: BOCK-W: add USB support

In reply to Sergei Shtylyov

Register the USB PHY device from bockw_init(), passing the platform data to it. Set machine's init_late() method to r8a7778_init_late() in order for [EO]HCI to get registered too...

Don't forget to add USB PENC0/1 pins to bockw_pinctrl_map[].

The patch has been tested on the BOCK-W board.

---
Changes since version 8:
- resolved reject, refreshed the patch.

Changes since version 6:
- added USB PENC0/1 pins to bockw_pinctrl_map[].

Changes since version 4:
- annotated 'usb_phy_platform_data' as '__initdata' since it's kmemdup()'ed while registering the platform device anyway;
- refreshed the patch.

Changes since version 3:
- removed initializer for 'usb_phy_platform_data' letting it be set to all 0s;
- refreshed the patch.

Changes since version 2:
- refreshed the patch.

Changes since the original posting:
- removed initializer for no longer existing field in 'usb_phy_platform_data', modified the comment to the 'ferrite_bead' field initializer.

 arch/arm/mach-shmobile/board-bockw.c |    8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-shmobile/board-bockw.c +8 -0
Index: renesas/arch/arm/mach-shmobile/board-bockw.c
===================================================================
@@ -63,6 +63,8 @@ static struct sh_mobile_sdhi_info sdhi0_
 	.tmio_flags	= TMIO_MMC_HAS_IDLE_WAIT,
 };
 
+static struct rcar_phy_platform_data usb_phy_platform_data __initdata;
+
 static const struct pinctrl_map bockw_pinctrl_map[] = {
 	/* SCIF0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.0", "pfc-r8a7778",
@@ -72,6 +74,10 @@ static const struct pinctrl_map bockw_pi
 	/* SDHI0 */
 	PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7778",
 				  "sdhi0", "sdhi0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
+				  "usb0", "usb0"),
+	PIN_MAP_MUX_GROUP_DEFAULT("ehci-platform", "pfc-r8a7778",
+				  "usb1", "usb1"),
 };
 
 #define FPGA	0x18200000
@@ -85,6 +91,7 @@ static void __init bockw_init(void)
 	r8a7778_clock_init();
 	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
+	r8a7778_add_usb_phy_device(&usb_phy_platform_data);
 
 	pinctrl_register_mappings(bockw_pinctrl_map,
 				  ARRAY_SIZE(bockw_pinctrl_map));
@@ -140,4 +147,5 @@ DT_MACHINE_START(BOCKW_DT, "bockw")
 	.init_machine	= bockw_init,
 	.init_time	= shmobile_timer_init,
 	.dt_compat	= bockw_boards_compat_dt,
+	.init_late      = r8a7778_init_late,
 MACHINE_END
#3 lore raw

v9 cover Add USB support to R8A7778/BOCK-W

In reply to Sergei Shtylyov
Quoted 8 lines · Sergei Shtylyov

Hello.

Here's the set of 3 patches against the Simon Horman's 'renesas.git' repo,
'renesas-next-20130607' tag, and the R8A7779/Marzen USB patchset I've posted. It was created to add support of R8A7778/BOCK-W USB to the platform code and the USB common PHY driver, and so spans both arch/arm/mach-shmobile/ and drivers/usb/phy/ subtrees.

Quoted 5 lines

[1/3] phy-rcar-usb: add R8A7778 support
[2/3] ARM: shmobile: r8a7778: add USB support
[3/3] ARM: shmobile: BOCK-W: add USB support

The patchset is completely ready for merging now.

Thanks, I have queued this up in the soc2 phy-rcar-usb. My current plan is to let that branch sit in next for a few days and then send a pull-request for it to be included in v3.11.

#4 lore raw

v9 cover Add USB support to R8A7778/BOCK-W

Quoted 9 lines · Simon Horman
Quoted 8 lines · Sergei Shtylyov

Hello.

Here's the set of 3 patches against the Simon Horman's 'renesas.git' repo,
'renesas-next-20130607' tag, and the R8A7779/Marzen USB patchset I've posted. It was created to add support of R8A7778/BOCK-W USB to the platform code and the USB common PHY driver, and so spans both arch/arm/mach-shmobile/ and drivers/usb/phy/ subtrees.

Quoted 7 lines
Quoted 5 lines

[1/3] phy-rcar-usb: add R8A7778 support
[2/3] ARM: shmobile: r8a7778: add USB support
[3/3] ARM: shmobile: BOCK-W: add USB support

The patchset is completely ready for merging now.

Thanks, I have queued this up in the soc2 phy-rcar-usb.

s/soc2 phy-rcar-usb/phy-rcar-usb branch/

Quoted 7 lines

My current plan is to let that branch sit in next for a few days and then send a pull-request for it to be included in v3.11. --
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html