Skip to contentSkip to conversation

ARM: S5P: Add usb ehci device

PATCH New Joonyoung Shim 2 participants 6 messages Apr 8, 2011 – Apr 14, 2011

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

PATCH 1/4 ARM: S5P: Add usb ehci device

This patch adds usb ehci device definition for samsung s5p cpus.

---
 arch/arm/mach-exynos4/include/mach/map.h  |    3 ++
 arch/arm/plat-s5p/Kconfig                 |    5 +++
 arch/arm/plat-s5p/Makefile                |    1 +
 arch/arm/plat-s5p/dev-ehci.c              |   50 +++++++++++++++++++++++++++++
 arch/arm/plat-s5p/include/plat/ehci.h     |   21 ++++++++++++
 arch/arm/plat-samsung/include/plat/devs.h |    2 +
 6 files changed, 82 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-s5p/dev-ehci.c
 create mode 100644 arch/arm/plat-s5p/include/plat/ehci.h
arch/arm/mach-exynos4/include/mach/map.h +3 -0
index 6330b73..213c2a2 100644
@@ -101,6 +101,8 @@
 
 #define EXYNOS4_PA_SROMC		0x12570000
 
+#define EXYNOS4_PA_EHCI			0x12580000
+
 #define EXYNOS4_PA_UART			0x13800000
 
 #define EXYNOS4_PA_IIC(x)		(0x13860000 + ((x) * 0x10000))
@@ -143,6 +145,7 @@
 #define S5P_PA_SROMC			EXYNOS4_PA_SROMC
 #define S5P_PA_SYSCON			EXYNOS4_PA_SYSCON
 #define S5P_PA_TIMER			EXYNOS4_PA_TIMER
+#define S5P_PA_EHCI			EXYNOS4_PA_EHCI
 
 #define SAMSUNG_PA_KEYPAD		EXYNOS4_PA_KEYPAD
 
arch/arm/plat-s5p/Kconfig +5 -0
index 8492297..6751bcf 100644
@@ -85,6 +85,11 @@ config S5P_DEV_CSIS1
 	help
 	  Compile in platform device definitions for MIPI-CSIS channel 1
 
+config S5P_DEV_USB_EHCI
+	bool
+	help
+	  Compile in platform device definition for USB EHCI
+
 config S5P_SETUP_MIPIPHY
 	bool
 	help
arch/arm/plat-s5p/Makefile +1 -0
index 42afff7..e234cc4 100644
@@ -33,4 +33,5 @@ obj-$(CONFIG_S5P_DEV_FIMC3)	+= dev-fimc3.o
 obj-$(CONFIG_S5P_DEV_ONENAND)	+= dev-onenand.o
 obj-$(CONFIG_S5P_DEV_CSIS0)	+= dev-csis0.o
 obj-$(CONFIG_S5P_DEV_CSIS1)	+= dev-csis1.o
+obj-$(CONFIG_S5P_DEV_USB_EHCI)	+= dev-ehci.o
 obj-$(CONFIG_S5P_SETUP_MIPIPHY)	+= setup-mipiphy.o
arch/arm/plat-s5p/dev-ehci.c new file +50 -0

50 lines not on this page · raw message

arch/arm/plat-s5p/include/plat/ehci.h new file +21 -0
new file mode 100644
index 0000000..6ae6810
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <[email protected]>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __PLAT_S5P_EHCI_H
+#define __PLAT_S5P_EHCI_H
+
+struct s5p_ehci_platdata {
+	int (*phy_init)(struct platform_device *pdev, int type);
+	int (*phy_exit)(struct platform_device *pdev, int type);
+};
+
+extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
+
+#endif /* __PLAT_S5P_EHCI_H */
arch/arm/plat-samsung/include/plat/devs.h +2 -0
index f0da6b7..3f38deb 100644
@@ -142,6 +142,8 @@ extern struct platform_device s5p_device_fimc3;
 extern struct platform_device s5p_device_mipi_csis0;
 extern struct platform_device s5p_device_mipi_csis1;
 
+extern struct platform_device s5p_device_ehci;
+
 extern struct platform_device exynos4_device_sysmmu;
 
 /* s3c2440 specific devices */
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/4 ARM: EXYNOS4: Add usb host phy control

EXYNOS4 has 2 phys for usb host and usb device. This patch supports to control usb host phy of EXYNOS4.

---
 arch/arm/mach-exynos4/Makefile                    |    2 +
 arch/arm/mach-exynos4/cpu.c                       |    7 +-
 arch/arm/mach-exynos4/include/mach/map.h          |    1 +
 arch/arm/mach-exynos4/include/mach/regs-pmu.h     |    3 +
 arch/arm/mach-exynos4/include/mach/regs-usb-phy.h |   64 ++++++++++
 arch/arm/mach-exynos4/usb-phy.c                   |  136 +++++++++++++++++++++
 arch/arm/plat-s5p/dev-ehci.c                      |    9 ++-
 arch/arm/plat-s5p/include/plat/map-s5p.h          |    2 +-
 arch/arm/plat-s5p/include/plat/usb-phy.h          |   22 ++++
 9 files changed, 243 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-exynos4/include/mach/regs-usb-phy.h
 create mode 100644 arch/arm/mach-exynos4/usb-phy.c
 create mode 100644 arch/arm/plat-s5p/include/plat/usb-phy.h
arch/arm/mach-exynos4/Makefile +2 -0
index de197d6..683fc38 100644
@@ -55,3 +55,5 @@ obj-$(CONFIG_EXYNOS4_SETUP_I2C7)	+= setup-i2c7.o
 obj-$(CONFIG_EXYNOS4_SETUP_KEYPAD)	+= setup-keypad.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI)	+= setup-sdhci.o
 obj-$(CONFIG_EXYNOS4_SETUP_SDHCI_GPIO)	+= setup-sdhci-gpio.o
+
+obj-$(CONFIG_USB_SUPPORT)		+= usb-phy.o
arch/arm/mach-exynos4/cpu.c +6 -1
index 7930113..08813a6 100644
@@ -97,7 +97,12 @@ static struct map_desc exynos4_iodesc[] __initdata = {
 		.pfn		= __phys_to_pfn(EXYNOS4_PA_SROMC),
 		.length		= SZ_4K,
 		.type		= MT_DEVICE,
-	},
+	}, {
+		.virtual	= (unsigned long)S5P_VA_USB_HSPHY,
+		.pfn		= __phys_to_pfn(EXYNOS4_PA_HSPHY),
+		.length		= SZ_4K,
+		.type		= MT_DEVICE,
+	}
 };
 
 static void exynos4_idle(void)
arch/arm/mach-exynos4/include/mach/map.h +1 -0
index 213c2a2..0009e77 100644
@@ -102,6 +102,7 @@
 #define EXYNOS4_PA_SROMC		0x12570000
 
 #define EXYNOS4_PA_EHCI			0x12580000
+#define EXYNOS4_PA_HSPHY		0x125B0000
 
 #define EXYNOS4_PA_UART			0x13800000
 
arch/arm/mach-exynos4/include/mach/regs-pmu.h +3 -0
index 62b0014..a964337 100644
@@ -33,6 +33,9 @@
 #define S5P_EINT_WAKEUP_MASK			S5P_PMUREG(0x0604)
 #define S5P_WAKEUP_MASK				S5P_PMUREG(0x0608)
 
+#define S5P_USBHOST_PHY_CONTROL			S5P_PMUREG(0x0708)
+#define S5P_USBHOST_PHY_ENABLE			(1 << 0)
+
 #define S5P_MIPI_DPHY_CONTROL(n)		S5P_PMUREG(0x0710 + (n) * 4)
 #define S5P_MIPI_DPHY_ENABLE			(1 << 0)
 #define S5P_MIPI_DPHY_SRESETN			(1 << 1)
arch/arm/mach-exynos4/include/mach/regs-usb-phy.h new file +64 -0

64 lines not on this page · raw message

arch/arm/mach-exynos4/usb-phy.c new file +136 -0

136 lines not on this page · raw message

arch/arm/plat-s5p/dev-ehci.c +8 -1
index a610e5c..94080ff 100644
@@ -45,6 +45,13 @@ struct platform_device s5p_device_ehci = {
 
 void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
 {
-	s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
+	struct s5p_ehci_platdata *npd;
+
+	npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
 			&s5p_device_ehci);
+
+	if (!npd->phy_init)
+		npd->phy_init = s5p_usb_phy_init;
+	if (!npd->phy_exit)
+		npd->phy_exit = s5p_usb_phy_exit;
 }
arch/arm/plat-s5p/include/plat/map-s5p.h +1 -1
index d973d39..a6c3d32 100644
@@ -39,7 +39,7 @@
 #define S5P_VA_TWD		S5P_VA_COREPERI(0x600)
 #define S5P_VA_GIC_DIST		S5P_VA_COREPERI(0x1000)
 
-#define S3C_VA_USB_HSPHY	S3C_ADDR(0x02900000)
+#define S5P_VA_USB_HSPHY	S3C_ADDR(0x02900000)
 
 #define VA_VIC(x)		(S3C_VA_IRQ + ((x) * 0x10000))
 #define VA_VIC0			VA_VIC(0)
arch/arm/plat-s5p/include/plat/usb-phy.h new file +22 -0
new file mode 100644
index 0000000..6dd6bcf
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <[email protected]>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __PLAT_S5P_USB_PHY_H
+#define __PLAT_S5P_USB_PHY_H
+
+enum s5p_usb_phy_type {
+	S5P_USB_PHY_DEVICE,
+	S5P_USB_PHY_HOST,
+};
+
+extern int s5p_usb_phy_init(struct platform_device *pdev, int type);
+extern int s5p_usb_phy_exit(struct platform_device *pdev, int type);
+
+#endif /* __PLAT_S5P_REGS_USB_PHY_H */
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 3/4 ARM: EXYNOS4: Add usb ehci device to the NURI board

In reply to Joonyoung Shim

This patch is to support usb ehci device to the NURI board.

---
 arch/arm/mach-exynos4/Kconfig     |    1 +
 arch/arm/mach-exynos4/mach-nuri.c |   16 ++++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)
arch/arm/mach-exynos4/Kconfig +1 -0
index 11b57a4..b92c1e5 100644
@@ -171,6 +171,7 @@ config MACH_NURI
 	select S3C_DEV_I2C1
 	select S3C_DEV_I2C3
 	select S3C_DEV_I2C5
+	select S5P_DEV_USB_EHCI
 	select EXYNOS4_SETUP_I2C1
 	select EXYNOS4_SETUP_I2C3
 	select EXYNOS4_SETUP_I2C5
arch/arm/mach-exynos4/mach-nuri.c +16 -0
index d13c5e8..40bd720 100644
@@ -33,6 +33,8 @@
 #include <plat/sdhci.h>
 #include <plat/gpio-cfg.h>
 #include <plat/iic.h>
+#include <plat/ehci.h>
+#include <plat/clock.h>
 
 #include <mach/map.h>
 
@@ -347,6 +349,16 @@ static struct i2c_board_info i2c5_devs[] __initdata = {
 	/* max8997, To be updated */
 };
 
+/* USB EHCI */
+static struct s5p_ehci_platdata nuri_ehci_pdata;
+
+static void __init nuri_ehci_init(void)
+{
+	struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
+
+	s5p_ehci_set_platdata(pdata);
+}
+
 static struct platform_device *nuri_devices[] __initdata = {
 	/* Samsung Platform Devices */
 	&emmc_fixed_voltage,
@@ -356,6 +368,7 @@ static struct platform_device *nuri_devices[] __initdata = {
 	&s3c_device_wdt,
 	&s3c_device_timer[0],
 	&s3c_device_i2c3,
+	&s5p_device_ehci,
 
 	/* NURI Devices */
 	&nuri_gpio_keys,
@@ -380,6 +393,9 @@ static void __init nuri_machine_init(void)
 	i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
 	i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
 
+	nuri_ehci_init();
+	clk_xusbxti.rate = 24000000;
+
 	/* Last */
 	platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
 }
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/4 ARM: EXYNOS4: Add usb ehci device to the NURI board

Quoted 4 lines · Joonyoung Shim

This patch is to support usb ehci device to the NURI board.

Note, I had to apply this one by hand, I don't know what tree you made it against. Hopefully the merge issues will be simple to handle, as they were pretty obvious to me.

thanks,

greg k-h

#4 lore raw

PATCH 3/4 ARM: EXYNOS4: Add usb ehci device to the NURI board

Quoted 10 lines · Greg KH
Quoted 4 lines · Joonyoung Shim

This patch is to support usb ehci device to the NURI board.

Note, I had to apply this one by hand, I don't know what tree you made it against. Hopefully the merge issues will be simple to handle, as they were pretty obvious to me.

This patch is based from for-next branch of linux-samsung tree
(git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung.git),
so will occur merge conflict at the your usb tree.

Sorry for missing about tree.

#5 lore raw

PATCH 4/4 USB: Add initial S5P EHCI driver

In reply to Joonyoung Shim

This patch adds host USB high speed driver for samsung S5P series. This is initial driver and we need additional implementation to support some functions like power management.

---
 drivers/usb/Kconfig         |    1 +
 drivers/usb/host/Kconfig    |    6 ++
 drivers/usb/host/ehci-hcd.c |    5 +
 drivers/usb/host/ehci-s5p.c |  201 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 213 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-s5p.c
drivers/usb/Kconfig +1 -0
index 41b6e51..e0a9f2a 100644
@@ -65,6 +65,7 @@ config USB_ARCH_HAS_EHCI
 	default y if ARCH_CNS3XXX
 	default y if ARCH_VT8500
 	default y if PLAT_SPEAR
+	default y if PLAT_S5P
 	default y if ARCH_MSM
 	default PCI
 
drivers/usb/host/Kconfig +6 -0
index 9483acd..0fe36a2 100644
@@ -188,6 +188,12 @@ config USB_EHCI_SH
 	  Enables support for the on-chip EHCI controller on the SuperH.
 	  If you use the PCI EHCI controller, this option is not necessary.
 
+config USB_EHCI_S5P
+       boolean "S5P EHCI support"
+       depends on USB_EHCI_HCD && PLAT_S5P
+       help
+	 Enable support for the S5P SOC's on-chip EHCI controller.
+
 config USB_W90X900_EHCI
 	bool "W90X900(W90P910) EHCI support"
 	depends on USB_EHCI_HCD && ARCH_W90X900
drivers/usb/host/ehci-hcd.c +5 -0
index 78561d1..6b20b3b 100644
@@ -1265,6 +1265,11 @@ MODULE_LICENSE ("GPL");
 #define PLATFORM_DRIVER		tegra_ehci_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_S5P
+#include "ehci-s5p.c"
+#define PLATFORM_DRIVER		s5p_ehci_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
     !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
     !defined(XILINX_OF_PLATFORM_DRIVER)
drivers/usb/host/ehci-s5p.c new file +201 -0

201 lines not on this page · raw message

Signature · 1 line
1.7.0.4