Skip to contentSkip to conversation

USB: gadget: Add Samsung S3C24xx USB HS controller driver

PATCH RESEND Superseded Heiko Stübner 4 participants 26 messages Mar 23, 2011 – May 8, 2011

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

cover USB: gadget: Add Samsung S3C24xx USB HS controller driver

On 2010-10-13 Sangbeom Kim sent 4 patches to add support the USB High-Speed device controller module on Samsung's S3C2416, S3C2443 and S3C2450. [1]

bdooks worte on 2010-10-22:

Quoted 2 lines

patch 3/4 needs a bit of work, otherwise looks ok. I'll look at applying the s3c24xx items in the next day or so.

On 2010-10-23 Kukjin Kim send a revised version of patch 3. It seems the patches were forgotten after this.

We resurrected them while working on a s3c2416 based device. Patch 3 needed an update to work with current kernels. The other 3 patches were not modified.

Tests, comments, etc very welcome.

Thanks
Heiko

[1] http://comments.gmane.org/gmane.linux.kernel.samsung-soc/3315
[2] http://comments.gmane.org/gmane.linux.kernel.samsung-soc/3469

Sangbeom Kim wrote on 2010-10-13:

Quoted 4 lines

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

The patch series contains:
[PATCH 1/4] ARM: S3C2416: Add USB Phy register definitions
[PATCH 2/4] ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.
[PATCH v2 3/4] USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver
[PATCH 4/4] ARM: S3C2416: Add support for USB 2.0 High-Speed gadget controller

#1 lore raw

PATCH RESEND 1/4 ARM: S3C2416: Add USB Phy register definitions

From: Thomas Abraham <[email protected]>

Add register definitions required to configure the USB Phy. The definitions for PHYCTRL, PHYPWR, URSTCON and UCLKCON registers and corresponding bit field definitions are added.

---
 .../mach-s3c2410/include/mach/regs-s3c2443-clock.h |   25 ++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +25 -0
index 44494a5..5e06c72 100644
@@ -37,6 +37,10 @@
 #define S3C2443_SYSID			S3C2443_CLKREG(0x5C)
 #define S3C2443_PWRCFG			S3C2443_CLKREG(0x60)
 #define S3C2443_RSTCON			S3C2443_CLKREG(0x64)
+#define S3C2443_PHYCTRL			S3C2443_CLKREG(0x80)
+#define S3C2443_PHYPWR			S3C2443_CLKREG(0x84)
+#define S3C2443_URSTCON			S3C2443_CLKREG(0x88)
+#define S3C2443_UCLKCON			S3C2443_CLKREG(0x8C)
 
 #define S3C2443_SWRST_RESET		(0x533c2443)
 
@@ -121,6 +125,27 @@
 
 #define S3C2443_PWRCFG_SLEEP		(1<<15)
 
+#define S3C2443_PWRCFG_USBPHY		(1 << 4)
+
+#define S3C2443_URSTCON_FUNCRST		(1 << 2)
+#define S3C2443_URSTCON_PHYRST		(1 << 0)
+
+#define S3C2443_PHYCTRL_CLKSEL		(1 << 3)
+#define S3C2443_PHYCTRL_EXTCLK		(1 << 2)
+#define S3C2443_PHYCTRL_PLLSEL		(1 << 1)
+#define S3C2443_PHYCTRL_DSPORT		(1 << 0)
+
+#define S3C2443_PHYPWR_COMMON_ON	(1 << 31)
+#define S3C2443_PHYPWR_ANALOG_PD	(1 << 4)
+#define S3C2443_PHYPWR_PLL_REFCLK	(1 << 3)
+#define S3C2443_PHYPWR_XO_ON		(1 << 2)
+#define S3C2443_PHYPWR_PLL_PWRDN	(1 << 1)
+#define S3C2443_PHYPWR_FSUSPEND		(1 << 0)
+
+#define S3C2443_UCLKCON_DETECT_VBUS	(1 << 31)
+#define S3C2443_UCLKCON_FUNC_CLKEN	(1 << 2)
+#define S3C2443_UCLKCON_TCLKEN		(1 << 0)
+
 #include <asm/div64.h>
 
 static inline unsigned int
Signature · 1 line
1.7.2.3
#2 lore raw

PATCH RESEND 2/4 ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

S3C2416, S3C2443 and S3C2450 includes a USB High-Speed Gadget controller module. This patch adds the following for supporting this controller.

1. Definition for USB High-Speed controller base address.
2. Platform device instantiation.
3. Declaration for platform data structure.
4. Functionality to setup platform data for the controller.

---
 arch/arm/mach-s3c2410/include/mach/map.h  |    4 +++
 arch/arm/plat-s3c24xx/devs.c              |   41 +++++++++++++++++++++++++++++
 arch/arm/plat-s3c24xx/include/plat/udc.h  |   17 ++++++++++++
 arch/arm/plat-samsung/include/plat/devs.h |    1 +
 4 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/map.h +4 -0
index 25bbf5a..425552d 100644
@@ -21,6 +21,10 @@
 /* USB host controller */
 #define S3C2410_PA_USBHOST (0x49000000)
 
+/* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */
+#define S3C2416_PA_HSUDC	(0x49800000)
+#define S3C2416_SZ_HSUDC	(SZ_4K)
+
 /* DMA controller */
 #define S3C2410_PA_DMA	   (0x4B000000)
 #define S3C24XX_SZ_DMA	   SZ_1M
arch/arm/plat-s3c24xx/devs.c +41 -0

53 lines not on this page · raw message

arch/arm/plat-s3c24xx/include/plat/udc.h +17 -0
index 546bb40..a3fc1be 100644
@@ -33,4 +33,21 @@ struct s3c2410_udc_mach_info {
 
 extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
 
+/**
+ * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
+ * @epnum: Number of endpoints to be instantiated by the controller driver.
+ * @gpio_init: Platform specific USB related GPIO initialization.
+ * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
+ *
+ * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
+ * controllers.
+ */
+struct s3c24xx_hsudc_platdata {
+	unsigned int	epnum;
+	void		(*gpio_init)(void);
+	void		(*gpio_uninit)(void);
+};
+
+extern void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd);
+
 #endif /* __ASM_ARM_ARCH_UDC_H */
arch/arm/plat-samsung/include/plat/devs.h +1 -0
index b4d208b..fcb6e30 100644
@@ -85,6 +85,7 @@ extern struct platform_device s3c64xx_device_onenand1;
 extern struct platform_device s5p_device_onenand;
 
 extern struct platform_device s3c_device_usbgadget;
+extern struct platform_device s3c_device_usb_hsudc;
 extern struct platform_device s3c_device_usb_hsotg;
 
 extern struct platform_device s5pv210_device_ac97;
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH RESEND v3 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

---
Changes since v1:
- Addressed comments from Ben Dooks

Changes since v2:
- Update the driver to match the data structure changes introduced by commit b0fca50f5a94a268ed02cfddf44448051ed9343f.
Alexander Neumann <[email protected]>
- Move s3c_hsudc to 0x29 in usb_gadget_controller_number in gadget_chips.h Heiko Stuebner <[email protected]>

 drivers/usb/gadget/Kconfig        |   17 +
 drivers/usb/gadget/Makefile       |    1 +
 drivers/usb/gadget/gadget_chips.h |    8 +
 drivers/usb/gadget/s3c-hsudc.c    | 1329 +++++++++++++++++++++++++++++++++++++
 4 files changed, 1355 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/s3c-hsudc.c
drivers/usb/gadget/Kconfig +17 -0
index d500996..d836756 100644
@@ -338,6 +338,23 @@ config USB_S3C2410_DEBUG
 	boolean "S3C2410 udc debug messages"
 	depends on USB_GADGET_S3C2410
 
+config USB_GADGET_S3C_HSUDC
+	boolean "S3C2416, S3C2443 and S3C2450 USB Device Controller"
+	depends on ARCH_S3C2410
+	select USB_GADGET_DUALSPEED
+	help
+	  Samsung's S3C2416, S3C2443 and S3C2450 is an ARM9 based SoC
+	  integrated with dual speed USB 2.0 device controller. It has
+	  8 endpoints, as well as endpoint zero.
+
+	  This driver has been tested on S3C2416 and S3C2450 processors.
+
+config USB_S3C_HSUDC
+	tristate
+	depends on USB_GADGET_S3C_HSUDC
+	default USB_GADGET
+	select USB_GADGET_SELECTED
+
 config USB_GADGET_PXA_U2O
 	boolean "PXA9xx Processor USB2.0 controller"
 	select USB_GADGET_DUALSPEED
drivers/usb/gadget/Makefile +1 -0
index 55f5e8a..540783c 100644
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_R8A66597)	+= r8a66597-udc.o
 obj-$(CONFIG_USB_FSL_QE)	+= fsl_qe_udc.o
 obj-$(CONFIG_USB_CI13XXX_PCI)	+= ci13xxx_pci.o
 obj-$(CONFIG_USB_S3C_HSOTG)	+= s3c-hsotg.o
+obj-$(CONFIG_USB_S3C_HSUDC)	+= s3c-hsudc.o
 obj-$(CONFIG_USB_LANGWELL)	+= langwell_udc.o
 obj-$(CONFIG_USB_EG20T)		+= pch_udc.o
 obj-$(CONFIG_USB_PXA_U2O)	+= mv_udc.o
drivers/usb/gadget/gadget_chips.h +8 -0
index 5c2720d..836a08e 100644
@@ -142,6 +142,12 @@
 #define gadget_is_s3c_hsotg(g)    0
 #endif
 
+#ifdef CONFIG_USB_S3C_HSUDC
+#define gadget_is_s3c_hsudc(g) (!strcmp("s3c-hsudc", (g)->name))
+#else
+#define gadget_is_s3c_hsudc(g) 0
+#endif
+
 #ifdef CONFIG_USB_GADGET_EG20T
 #define	gadget_is_pch(g)	(!strcmp("pch_udc", (g)->name))
 #else
@@ -215,6 +221,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x27;
 	else if (gadget_is_ci13xxx_msm(gadget))
 		return 0x28;
+	else if (gadget_is_s3c_hsudc(gadget))
+		return 0x29;
 	return -ENOENT;
 }
 
drivers/usb/gadget/s3c-hsudc.c new file +1329 -0

1,329 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#4 lore raw

PATCH RESEND v3 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Quoted 14 lines · Heiko St?bner

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

---
Changes since v1:
- Addressed comments from Ben Dooks

Quoted 6 lines

Changes since v2:
- Update the driver to match the data structure changes introduced by commit b0fca50f5a94a268ed02cfddf44448051ed9343f.
Alexander Neumann <[email protected]>
- Move s3c_hsudc to 0x29 in usb_gadget_controller_number in gadget_chips.h Heiko Stuebner <[email protected]>

The Renesas driver got number 0x29, so this patch no longer applies :(

Care to respin this whole series against the next linux-next tree and resend it to me so I can apply it?

thanks,

greg k-h

#5 lore raw

v2 cover USB: gadget: Add Samsung S3C24xx USB HS controller driver

Am Donnerstag 14 April 2011 schrieb Greg KH:

Quoted 4 lines

The Renesas driver got number 0x29, so this patch no longer applies :(

Care to respin this whole series against the next linux-next tree and resend it to me so I can apply it?

As requested by greg k-h, again the whole 4-patch series against most current linux-next.

Heiko

#6 lore raw

PATCH 1/4 ARM: S3C2416: Add USB Phy register definitions

From: Thomas Abraham <[email protected]>

Add register definitions required to configure the USB Phy. The definitions for PHYCTRL, PHYPWR, URSTCON and UCLKCON registers and corresponding bit field definitions are added.

---
 .../mach-s3c2410/include/mach/regs-s3c2443-clock.h |   25 ++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +25 -0
index 44494a5..5e06c72 100644
@@ -37,6 +37,10 @@
 #define S3C2443_SYSID			S3C2443_CLKREG(0x5C)
 #define S3C2443_PWRCFG			S3C2443_CLKREG(0x60)
 #define S3C2443_RSTCON			S3C2443_CLKREG(0x64)
+#define S3C2443_PHYCTRL			S3C2443_CLKREG(0x80)
+#define S3C2443_PHYPWR			S3C2443_CLKREG(0x84)
+#define S3C2443_URSTCON			S3C2443_CLKREG(0x88)
+#define S3C2443_UCLKCON			S3C2443_CLKREG(0x8C)
 
 #define S3C2443_SWRST_RESET		(0x533c2443)
 
@@ -121,6 +125,27 @@
 
 #define S3C2443_PWRCFG_SLEEP		(1<<15)
 
+#define S3C2443_PWRCFG_USBPHY		(1 << 4)
+
+#define S3C2443_URSTCON_FUNCRST		(1 << 2)
+#define S3C2443_URSTCON_PHYRST		(1 << 0)
+
+#define S3C2443_PHYCTRL_CLKSEL		(1 << 3)
+#define S3C2443_PHYCTRL_EXTCLK		(1 << 2)
+#define S3C2443_PHYCTRL_PLLSEL		(1 << 1)
+#define S3C2443_PHYCTRL_DSPORT		(1 << 0)
+
+#define S3C2443_PHYPWR_COMMON_ON	(1 << 31)
+#define S3C2443_PHYPWR_ANALOG_PD	(1 << 4)
+#define S3C2443_PHYPWR_PLL_REFCLK	(1 << 3)
+#define S3C2443_PHYPWR_XO_ON		(1 << 2)
+#define S3C2443_PHYPWR_PLL_PWRDN	(1 << 1)
+#define S3C2443_PHYPWR_FSUSPEND		(1 << 0)
+
+#define S3C2443_UCLKCON_DETECT_VBUS	(1 << 31)
+#define S3C2443_UCLKCON_FUNC_CLKEN	(1 << 2)
+#define S3C2443_UCLKCON_TCLKEN		(1 << 0)
+
 #include <asm/div64.h>
 
 static inline unsigned int
Signature · 1 line
1.7.1
#7 lore raw

PATCH 2/4 ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

S3C2416, S3C2443 and S3C2450 includes a USB High-Speed Gadget controller module. This patch adds the following for supporting this controller.

1. Definition for USB High-Speed controller base address.
2. Platform device instantiation.
3. Declaration for platform data structure.
4. Functionality to setup platform data for the controller.

---
 arch/arm/mach-s3c2410/include/mach/map.h  |    4 +++
 arch/arm/plat-s3c24xx/devs.c              |   41 +++++++++++++++++++++++++++++
 arch/arm/plat-s3c24xx/include/plat/udc.h  |   17 ++++++++++++
 arch/arm/plat-samsung/include/plat/devs.h |    1 +
 4 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/map.h +4 -0
index 25bbf5a..425552d 100644
@@ -21,6 +21,10 @@
 /* USB host controller */
 #define S3C2410_PA_USBHOST (0x49000000)
 
+/* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */
+#define S3C2416_PA_HSUDC	(0x49800000)
+#define S3C2416_SZ_HSUDC	(SZ_4K)
+
 /* DMA controller */
 #define S3C2410_PA_DMA	   (0x4B000000)
 #define S3C24XX_SZ_DMA	   SZ_1M
arch/arm/plat-s3c24xx/devs.c +41 -0

53 lines not on this page · raw message

arch/arm/plat-s3c24xx/include/plat/udc.h +17 -0
index 80457c6..f638842 100644
@@ -37,4 +37,21 @@ struct s3c2410_udc_mach_info {
 
 extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
 
+/**
+ * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
+ * @epnum: Number of endpoints to be instantiated by the controller driver.
+ * @gpio_init: Platform specific USB related GPIO initialization.
+ * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
+ *
+ * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
+ * controllers.
+ */
+struct s3c24xx_hsudc_platdata {
+	unsigned int	epnum;
+	void		(*gpio_init)(void);
+	void		(*gpio_uninit)(void);
+};
+
+extern void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd);
+
 #endif /* __ASM_ARM_ARCH_UDC_H */
arch/arm/plat-samsung/include/plat/devs.h +1 -0
index 3f38deb..39818d8 100644
@@ -88,6 +88,7 @@ extern struct platform_device s3c64xx_device_onenand1;
 extern struct platform_device s5p_device_onenand;
 
 extern struct platform_device s3c_device_usbgadget;
+extern struct platform_device s3c_device_usb_hsudc;
 extern struct platform_device s3c_device_usb_hsotg;
 
 extern struct platform_device s5pv210_device_ac97;
Signature · 1 line
1.7.1
#8 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

---
Changes since v1:
- Addressed comments from Ben Dooks

Changes since v2:
- Update the driver to match the data structure changes introduced by commit b0fca50f5a94a268ed02cfddf44448051ed9343f.
Alexander Neumann <[email protected]>
- Move s3c_hsudc to 0x29 in usb_gadget_controller_number in gadget_chips.h Heiko Stuebner <[email protected]>

Changes since v3:
- Update gadget_chips.h-id again
Heiko Stuebner <[email protected]>

 drivers/usb/gadget/Kconfig        |   17 +
 drivers/usb/gadget/Makefile       |    1 +
 drivers/usb/gadget/gadget_chips.h |    8 +
 drivers/usb/gadget/s3c-hsudc.c    | 1329 +++++++++++++++++++++++++++++++++++++
 4 files changed, 1355 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/s3c-hsudc.c
drivers/usb/gadget/Kconfig +17 -0
index 4c02b9f..58456d1 100644
@@ -356,6 +356,23 @@ config USB_S3C2410_DEBUG
 	boolean "S3C2410 udc debug messages"
 	depends on USB_GADGET_S3C2410
 
+config USB_GADGET_S3C_HSUDC
+	boolean "S3C2416, S3C2443 and S3C2450 USB Device Controller"
+	depends on ARCH_S3C2410
+	select USB_GADGET_DUALSPEED
+	help
+	  Samsung's S3C2416, S3C2443 and S3C2450 is an ARM9 based SoC
+	  integrated with dual speed USB 2.0 device controller. It has
+	  8 endpoints, as well as endpoint zero.
+
+	  This driver has been tested on S3C2416 and S3C2450 processors.
+
+config USB_S3C_HSUDC
+	tristate
+	depends on USB_GADGET_S3C_HSUDC
+	default USB_GADGET
+	select USB_GADGET_SELECTED
+
 config USB_GADGET_PXA_U2O
 	boolean "PXA9xx Processor USB2.0 controller"
 	select USB_GADGET_DUALSPEED
drivers/usb/gadget/Makefile +1 -0
index 1ea15ee..4fe92b1 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_R8A66597)	+= r8a66597-udc.o
 obj-$(CONFIG_USB_FSL_QE)	+= fsl_qe_udc.o
 obj-$(CONFIG_USB_CI13XXX_PCI)	+= ci13xxx_pci.o
 obj-$(CONFIG_USB_S3C_HSOTG)	+= s3c-hsotg.o
+obj-$(CONFIG_USB_S3C_HSUDC)	+= s3c-hsudc.o
 obj-$(CONFIG_USB_LANGWELL)	+= langwell_udc.o
 obj-$(CONFIG_USB_EG20T)		+= pch_udc.o
 obj-$(CONFIG_USB_PXA_U2O)	+= mv_udc.o
drivers/usb/gadget/gadget_chips.h +8 -0
index ec3fd97..bcdac7c 100644
@@ -136,6 +136,12 @@
 #define gadget_is_s3c_hsotg(g)    0
 #endif
 
+#ifdef CONFIG_USB_S3C_HSUDC
+#define gadget_is_s3c_hsudc(g) (!strcmp("s3c-hsudc", (g)->name))
+#else
+#define gadget_is_s3c_hsudc(g) 0
+#endif
+
 #ifdef CONFIG_USB_GADGET_EG20T
 #define	gadget_is_pch(g)	(!strcmp("pch_udc", (g)->name))
 #else
@@ -215,6 +221,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x28;
 	else if (gadget_is_renesas_usbhs(gadget))
 		return 0x29;
+	else if (gadget_is_s3c_hsudc(gadget))
+		return 0x30;
 
 	return -ENOENT;
 }
drivers/usb/gadget/s3c-hsudc.c new file +1329 -0

1,329 lines not on this page · raw message

Signature · 1 line
1.7.1
#9 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Quoted 12 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Alan Stern

#10 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Quoted 17 lines · Alan Stern
Quoted 12 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

Quoted 11 lines

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

Or just refuse to be able to register the structure, that would stop it right away :)

thanks,

greg k-h

#11 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Am Donnerstag 14 April 2011, 17:47:48 schrieb Greg KH:

Quoted 29 lines · Alan Stern
Quoted 16 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:
Quoted 12 lines

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

Quoted 11 lines

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Quoted 4 lines

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

From what I gathered from gadget.h the usb_ep_set_wedge function checks if

set_wedge is defined and uses set_halt if it's missing. The comments surrounding usb_ep_set_wedge and usb_ep_ops also don't indicate that set_wedge is a must.
As it has a fallback [through set_halt] it might therefore lead to the impression of being optional.

Quoted 1 line

From Alan's response I gather that it isn't optional and the fallback is only

there for older drivers.

Hopefully Thomas [the original author] reads this. He would probably be able to implement the set_wedge function in a tiny fraction of the time I would need :-), as I don't really understand the inner workings of this.

Heiko

#12 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

In reply to Greg KH
Quoted 30 lines · Greg KH
Quoted 17 lines · Alan Stern
Quoted 12 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

Quoted 11 lines

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Quoted 5 lines

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

Or just refuse to be able to register the structure, that would stop it right away :)

In fact, set_wedge is optional. But it's so easy to implement, there's no good reason for leaving it out.

I suspect what's happening is that people are just basing their new drivers on other drivers from very old kernel versions, before set_wedge was added.

Alan Stern

#13 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Am Donnerstag 14 April 2011, 19:15:23 schrieb Alan Stern:

Quoted 30 lines · Greg KH
Quoted 29 lines · Alan Stern
Quoted 27 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:
Quoted 12 lines

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Quoted 8 lines
Quoted 5 lines

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

Or just refuse to be able to register the structure, that would stop it right away :)

In fact, set_wedge is optional. But it's so easy to implement, there's no good reason for leaving it out.

It seems Thomas [original author of the driver] will be able to implement said set_wedge function for it.
As he will need a bit of time for this, two possible ways for going forward come to mind:
(1) use current driver [as set_wedge is optional] and add it later via patch
(2) resubmit whole driver again when set_wedge is added to it

Obviously I would prefer option 1 :-), but in the end it's your decision.

Heiko

#14 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Quoted 40 lines · Heiko Stübner

Am Donnerstag 14 April 2011, 19:15:23 schrieb Alan Stern:

Quoted 30 lines · Greg KH
Quoted 29 lines · Alan Stern
Quoted 27 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:
Quoted 12 lines

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Quoted 8 lines
Quoted 5 lines

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

Or just refuse to be able to register the structure, that would stop it right away :)

In fact, set_wedge is optional. But it's so easy to implement, there's no good reason for leaving it out.

Quoted 8 lines

It seems Thomas [original author of the driver] will be able to implement said set_wedge function for it.
As he will need a bit of time for this, two possible ways for going forward come to mind:
(1) use current driver [as set_wedge is optional] and add it later via patch
(2) resubmit whole driver again when set_wedge is added to it

Obviously I would prefer option 1 :-), but in the end it's your decision.

It shouldn't take that much time to do this, what is the delay?

I'd prefer to get the correct version implemented and would not like to accept a patch that everyone knows is wrong.

thanks,

greg k-h

#15 lore raw

PATCH v4 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

Am Samstag 16 April 2011, 16:58:30 schrieb Greg KH:

Quoted 48 lines · Heiko St?bner
Quoted 47 lines

Am Donnerstag 14 April 2011, 19:15:23 schrieb Alan Stern:

Quoted 30 lines · Greg KH
Quoted 29 lines · Alan Stern
Quoted 27 lines · On Thu, 14 Apr 2011, Heiko [iso-8859-1] St?bner wrote:
Quoted 12 lines

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

...

drivers/usb/gadget/s3c-hsudc.c line 945

Quoted 9 lines
drivers/usb/gadget/s3c-hsudc.c new file +9 -0
+static struct usb_ep_ops s3c_hsudc_ep_ops = {
+	.enable = s3c_hsudc_ep_enable,
+	.disable = s3c_hsudc_ep_disable,
+	.alloc_request = s3c_hsudc_alloc_request,
+	.free_request = s3c_hsudc_free_request,
+	.queue = s3c_hsudc_queue,
+	.dequeue = s3c_hsudc_dequeue,
+	.set_halt = s3c_hsudc_set_halt,
+};

There's no .set_wedge method. Why do people always leave this out?

Quoted 8 lines
Quoted 5 lines

Does the code spit out a nasty warning if this isn't set? If not, I would suggest adding it so that this doesn't keep happening.

Or just refuse to be able to register the structure, that would stop it right away :)

In fact, set_wedge is optional. But it's so easy to implement, there's no good reason for leaving it out.

It seems Thomas [original author of the driver] will be able to implement said set_wedge function for it.
As he will need a bit of time for this, two possible ways for going forward come to mind:
(1) use current driver [as set_wedge is optional] and add it later via patch (2) resubmit whole driver again when set_wedge is added to it

Quoted 3 lines
Quoted 1 line

Obviously I would prefer option 1 :-), but in the end it's your decision.

It shouldn't take that much time to do this, what is the delay?

from what I gathered, simply finding the necessary time slot for this.

Quoted 2 lines

I'd prefer to get the correct version implemented and would not like to accept a patch that everyone knows is wrong.

ok, I will resubmit the driver when set_wedge is included

Heiko

#16 lore raw

v3 cover USB: gadget: Add Samsung S3C24xx USB HS controller driver

In reply to Greg KH

Hi all,

Am Samstag 16 April 2011, 16:58:30 schrieb Greg KH:

Quoted 2 lines

I'd prefer to get the correct version implemented and would not like to accept a patch that everyone knows is wrong.

again the whole 4-patch series. This time with added set_wedge function.

Thanks
Heiko

#17 lore raw

PATCH 1/4 ARM: S3C2416: Add USB Phy register definitions

From: Thomas Abraham <[email protected]>

Add register definitions required to configure the USB Phy. The definitions for PHYCTRL, PHYPWR, URSTCON and UCLKCON registers and corresponding bit field definitions are added.

---
 .../mach-s3c2410/include/mach/regs-s3c2443-clock.h |   25 
++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h index 44494a5..5e06c72 100644

arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h +25 -0
@@ -37,6 +37,10 @@
 #define S3C2443_SYSID			S3C2443_CLKREG(0x5C)
 #define S3C2443_PWRCFG			S3C2443_CLKREG(0x60)
 #define S3C2443_RSTCON			S3C2443_CLKREG(0x64)
+#define S3C2443_PHYCTRL			S3C2443_CLKREG(0x80)
+#define S3C2443_PHYPWR			S3C2443_CLKREG(0x84)
+#define S3C2443_URSTCON			S3C2443_CLKREG(0x88)
+#define S3C2443_UCLKCON			S3C2443_CLKREG(0x8C)
 
 #define S3C2443_SWRST_RESET		(0x533c2443)
 
@@ -121,6 +125,27 @@
 
 #define S3C2443_PWRCFG_SLEEP		(1<<15)
 
+#define S3C2443_PWRCFG_USBPHY		(1 << 4)
+
+#define S3C2443_URSTCON_FUNCRST		(1 << 2)
+#define S3C2443_URSTCON_PHYRST		(1 << 0)
+
+#define S3C2443_PHYCTRL_CLKSEL		(1 << 3)
+#define S3C2443_PHYCTRL_EXTCLK		(1 << 2)
+#define S3C2443_PHYCTRL_PLLSEL		(1 << 1)
+#define S3C2443_PHYCTRL_DSPORT		(1 << 0)
+
+#define S3C2443_PHYPWR_COMMON_ON	(1 << 31)
+#define S3C2443_PHYPWR_ANALOG_PD	(1 << 4)
+#define S3C2443_PHYPWR_PLL_REFCLK	(1 << 3)
+#define S3C2443_PHYPWR_XO_ON		(1 << 2)
+#define S3C2443_PHYPWR_PLL_PWRDN	(1 << 1)
+#define S3C2443_PHYPWR_FSUSPEND		(1 << 0)
+
+#define S3C2443_UCLKCON_DETECT_VBUS	(1 << 31)
+#define S3C2443_UCLKCON_FUNC_CLKEN	(1 << 2)
+#define S3C2443_UCLKCON_TCLKEN		(1 << 0)
+
 #include <asm/div64.h>
 
 static inline unsigned int
Signature · 1 line
1.7.2.3
#18 lore raw

PATCH 2/4 ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

S3C2416, S3C2443 and S3C2450 includes a USB High-Speed Gadget controller module. This patch adds the following for supporting this controller.

1. Definition for USB High-Speed controller base address.
2. Platform device instantiation.
3. Declaration for platform data structure.
4. Functionality to setup platform data for the controller.

---
 arch/arm/mach-s3c2410/include/mach/map.h  |    4 +++
 arch/arm/plat-s3c24xx/devs.c              |   41 +++++++++++++++++++++++++++++
 arch/arm/plat-s3c24xx/include/plat/udc.h  |   17 ++++++++++++
 arch/arm/plat-samsung/include/plat/devs.h |    1 +
 4 files changed, 63 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2410/include/mach/map.h +4 -0
index 25bbf5a..425552d 100644
@@ -21,6 +21,10 @@
 /* USB host controller */
 #define S3C2410_PA_USBHOST (0x49000000)
 
+/* S3C2416/S3C2443/S3C2450 High-Speed USB Gadget */
+#define S3C2416_PA_HSUDC	(0x49800000)
+#define S3C2416_SZ_HSUDC	(SZ_4K)
+
 /* DMA controller */
 #define S3C2410_PA_DMA	   (0x4B000000)
 #define S3C24XX_SZ_DMA	   SZ_1M
arch/arm/plat-s3c24xx/devs.c +41 -0

53 lines not on this page · raw message

arch/arm/plat-s3c24xx/include/plat/udc.h +17 -0
index 80457c6..f6388424 100644
@@ -37,4 +37,21 @@ struct s3c2410_udc_mach_info {
 
 extern void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *);
 
+/**
+ * s3c24xx_hsudc_platdata - Platform data for USB High-Speed gadget controller.
+ * @epnum: Number of endpoints to be instantiated by the controller driver.
+ * @gpio_init: Platform specific USB related GPIO initialization.
+ * @gpio_uninit: Platform specific USB releted GPIO uninitialzation.
+ *
+ * Representation of platform data for the S3C24XX USB 2.0 High Speed gadget
+ * controllers.
+ */
+struct s3c24xx_hsudc_platdata {
+	unsigned int	epnum;
+	void		(*gpio_init)(void);
+	void		(*gpio_uninit)(void);
+};
+
+extern void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd);
+
 #endif /* __ASM_ARM_ARCH_UDC_H */
arch/arm/plat-samsung/include/plat/devs.h +1 -0
index 3f38deb..39818d8 100644
@@ -88,6 +88,7 @@ extern struct platform_device s3c64xx_device_onenand1;
 extern struct platform_device s5p_device_onenand;
 
 extern struct platform_device s3c_device_usbgadget;
+extern struct platform_device s3c_device_usb_hsudc;
 extern struct platform_device s3c_device_usb_hsotg;
 
 extern struct platform_device s5pv210_device_ac97;
Signature · 1 line
1.7.2.3
#19 lore raw

PATCH 2/4 ARM: S3C24XX: Add plaform device definition for USB High-Speed gadget controller.

Hello.

Quoted 12 lines · Heiko St?bner

From: Thomas Abraham<[email protected]>

S3C2416, S3C2443 and S3C2450 includes a USB High-Speed Gadget controller module. This patch adds the following for supporting this controller.

1. Definition for USB High-Speed controller base address.
2. Platform device instantiation.
3. Declaration for platform data structure.
4. Functionality to setup platform data for the controller.

[...]

Quoted 4 lines
arch/arm/plat-s3c24xx/devs.c +0 -0
index 268f3ed..7366799 100644

[...]

Quoted 1 line
arch/arm/plat-s3c24xx/devs.c +0 -0
@@ -233,6 +234,46 @@ void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)

[...]

arch/arm/plat-s3c24xx/devs.c void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd) · line 270

Quoted 7 lines
arch/arm/plat-s3c24xx/devs.c +7 -0
+void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd)
+{
+	struct s3c24xx_hsudc_platdata *npd;
+
+	npd = kmalloc(sizeof(*npd), GFP_KERNEL);
+	if (npd) {
+		memcpy(npd, pd, sizeof(*npd));

You could use kmemdup() (from mm/util.c) instead...

WBR, Sergei

#20 lore raw

PATCH v5 3/4 USB: Gadget: Add Samsung S3C24XX USB High-Speed controller driver

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

The Samsung's S3C2416, S3C2443 and S3C2450 includes a USB High-Speed device controller module. This driver enables support for USB high-speed gadget functionality for the Samsung S3C24xx SoC's that include this controller.

---
Changes since v1:
- Addressed comments from Ben Dooks
Thomas Abraham <[email protected]>

Changes since v2:
- Update the driver to match the data structure changes introduced by commit b0fca50f5a94a268ed02cfddf44448051ed9343f.
Alexander Neumann <[email protected]>
- Move s3c_hsudc to 0x29 in usb_gadget_controller_number in gadget_chips.h Heiko Stuebner <[email protected]>

Changes since v3:
- Update gadget_chips.h-id again
Heiko Stuebner <[email protected]>

Changes since v4:
- Add set_wedge function
Thomas Abraham <[email protected]>

 drivers/usb/gadget/Kconfig        |   17 +
 drivers/usb/gadget/Makefile       |    1 +
 drivers/usb/gadget/gadget_chips.h |    8 +
 drivers/usb/gadget/s3c-hsudc.c    | 1349 +++++++++++++++++++++++++++++++++++++
 4 files changed, 1375 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/s3c-hsudc.c
drivers/usb/gadget/Kconfig +17 -0
index 4c02b9f..58456d1 100644
@@ -356,6 +356,23 @@ config USB_S3C2410_DEBUG
 	boolean "S3C2410 udc debug messages"
 	depends on USB_GADGET_S3C2410
 
+config USB_GADGET_S3C_HSUDC
+	boolean "S3C2416, S3C2443 and S3C2450 USB Device Controller"
+	depends on ARCH_S3C2410
+	select USB_GADGET_DUALSPEED
+	help
+	  Samsung's S3C2416, S3C2443 and S3C2450 is an ARM9 based SoC
+	  integrated with dual speed USB 2.0 device controller. It has
+	  8 endpoints, as well as endpoint zero.
+
+	  This driver has been tested on S3C2416 and S3C2450 processors.
+
+config USB_S3C_HSUDC
+	tristate
+	depends on USB_GADGET_S3C_HSUDC
+	default USB_GADGET
+	select USB_GADGET_SELECTED
+
 config USB_GADGET_PXA_U2O
 	boolean "PXA9xx Processor USB2.0 controller"
 	select USB_GADGET_DUALSPEED
drivers/usb/gadget/Makefile +1 -0
index 1ea15ee..4fe92b1 100644
@@ -22,6 +22,7 @@ obj-$(CONFIG_USB_R8A66597)	+= r8a66597-udc.o
 obj-$(CONFIG_USB_FSL_QE)	+= fsl_qe_udc.o
 obj-$(CONFIG_USB_CI13XXX_PCI)	+= ci13xxx_pci.o
 obj-$(CONFIG_USB_S3C_HSOTG)	+= s3c-hsotg.o
+obj-$(CONFIG_USB_S3C_HSUDC)	+= s3c-hsudc.o
 obj-$(CONFIG_USB_LANGWELL)	+= langwell_udc.o
 obj-$(CONFIG_USB_EG20T)		+= pch_udc.o
 obj-$(CONFIG_USB_PXA_U2O)	+= mv_udc.o
drivers/usb/gadget/gadget_chips.h +8 -0
index ec3fd97..bcdac7c 100644
@@ -136,6 +136,12 @@
 #define gadget_is_s3c_hsotg(g)    0
 #endif
 
+#ifdef CONFIG_USB_S3C_HSUDC
+#define gadget_is_s3c_hsudc(g) (!strcmp("s3c-hsudc", (g)->name))
+#else
+#define gadget_is_s3c_hsudc(g) 0
+#endif
+
 #ifdef CONFIG_USB_GADGET_EG20T
 #define	gadget_is_pch(g)	(!strcmp("pch_udc", (g)->name))
 #else
@@ -215,6 +221,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x28;
 	else if (gadget_is_renesas_usbhs(gadget))
 		return 0x29;
+	else if (gadget_is_s3c_hsudc(gadget))
+		return 0x30;
 
 	return -ENOENT;
 }
drivers/usb/gadget/s3c-hsudc.c new file +1349 -0

1,349 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#21 lore raw

PATCH 4/4 ARM: S3C2416: Add support for USB 2.0 High-Speed gadget controller

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

Add support for USB 2.0 High-Speed gadget controller driver for Samsung's S3C2416 processor.

---
 arch/arm/mach-s3c2416/mach-smdk2416.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2416/mach-smdk2416.c +27 -0
index 3f83177..ac27ebb 100644
@@ -23,6 +23,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/gpio.h>
 #include <linux/fb.h>
+#include <linux/delay.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -35,6 +36,7 @@
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-lcd.h>
+#include <mach/regs-s3c2443-clock.h>
 
 #include <mach/idle.h>
 #include <mach/leds-gpio.h>
@@ -47,6 +49,7 @@
 #include <plat/cpu.h>
 #include <plat/nand.h>
 #include <plat/sdhci.h>
+#include <plat/udc.h>
 
 #include <plat/regs-fb-v4.h>
 #include <plat/fb.h>
@@ -121,6 +124,27 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
 	}
 };
 
+void smdk2416_hsudc_gpio_init(void)
+{
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
+	s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
+}
+
+void smdk2416_hsudc_gpio_uninit(void)
+{
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
+}
+
+struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
+	.epnum = 9,
+	.gpio_init = smdk2416_hsudc_gpio_init,
+	.gpio_uninit = smdk2416_hsudc_gpio_uninit,
+};
+
 struct s3c_fb_pd_win smdk2416_fb_win[] = {
 	[0] = {
 		/* think this is the same as the smdk6410 */
@@ -186,6 +210,7 @@ static struct platform_device *smdk2416_devices[] __initdata = {
 	&s3c_device_i2c0,
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
+	&s3c_device_usb_hsudc,
 };
 
 static void __init smdk2416_map_io(void)
@@ -203,6 +228,8 @@ static void __init smdk2416_machine_init(void)
 	s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
 
+	s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
+
 	gpio_request(S3C2410_GPB(4), "USBHost Power");
 	gpio_direction_output(S3C2410_GPB(4), 1);
 
Signature · 1 line
1.7.2.3
#22 lore raw

PATCH 4/4 ARM: S3C2416: Add support for USB 2.0 High-Speed gadget controller

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

Add support for USB 2.0 High-Speed gadget controller driver for Samsung's S3C2416 processor.

---
 arch/arm/mach-s3c2416/mach-smdk2416.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2416/mach-smdk2416.c +27 -0
index 3f83177..ac27ebb 100644
@@ -23,6 +23,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/gpio.h>
 #include <linux/fb.h>
+#include <linux/delay.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -35,6 +36,7 @@
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-lcd.h>
+#include <mach/regs-s3c2443-clock.h>
 
 #include <mach/idle.h>
 #include <mach/leds-gpio.h>
@@ -47,6 +49,7 @@
 #include <plat/cpu.h>
 #include <plat/nand.h>
 #include <plat/sdhci.h>
+#include <plat/udc.h>
 
 #include <plat/regs-fb-v4.h>
 #include <plat/fb.h>
@@ -121,6 +124,27 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
 	}
 };
 
+void smdk2416_hsudc_gpio_init(void)
+{
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
+	s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
+}
+
+void smdk2416_hsudc_gpio_uninit(void)
+{
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
+}
+
+struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
+	.epnum = 9,
+	.gpio_init = smdk2416_hsudc_gpio_init,
+	.gpio_uninit = smdk2416_hsudc_gpio_uninit,
+};
+
 struct s3c_fb_pd_win smdk2416_fb_win[] = {
 	[0] = {
 		/* think this is the same as the smdk6410 */
@@ -186,6 +210,7 @@ static struct platform_device *smdk2416_devices[] __initdata = {
 	&s3c_device_i2c0,
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
+	&s3c_device_usb_hsudc,
 };
 
 static void __init smdk2416_map_io(void)
@@ -203,6 +228,8 @@ static void __init smdk2416_machine_init(void)
 	s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
 
+	s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
+
 	gpio_request(S3C2410_GPB(4), "USBHost Power");
 	gpio_direction_output(S3C2410_GPB(4), 1);
 
Signature · 1 line
1.7.1
#23 lore raw

PATCH RESEND 4/4 ARM: S3C2416: Add support for USB 2.0 High-Speed gadget controller

In reply to Heiko Stübner

From: Thomas Abraham <[email protected]>

Add support for USB 2.0 High-Speed gadget controller driver for Samsung's S3C2416 processor.

---
 arch/arm/mach-s3c2416/mach-smdk2416.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-s3c2416/mach-smdk2416.c +27 -0
index 3f83177..ac27ebb 100644
@@ -23,6 +23,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/gpio.h>
 #include <linux/fb.h>
+#include <linux/delay.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -35,6 +36,7 @@
 #include <plat/regs-serial.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-lcd.h>
+#include <mach/regs-s3c2443-clock.h>
 
 #include <mach/idle.h>
 #include <mach/leds-gpio.h>
@@ -47,6 +49,7 @@
 #include <plat/cpu.h>
 #include <plat/nand.h>
 #include <plat/sdhci.h>
+#include <plat/udc.h>
 
 #include <plat/regs-fb-v4.h>
 #include <plat/fb.h>
@@ -121,6 +124,27 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
 	}
 };
 
+void smdk2416_hsudc_gpio_init(void)
+{
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
+	s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
+}
+
+void smdk2416_hsudc_gpio_uninit(void)
+{
+	s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
+	s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
+	s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
+}
+
+struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
+	.epnum = 9,
+	.gpio_init = smdk2416_hsudc_gpio_init,
+	.gpio_uninit = smdk2416_hsudc_gpio_uninit,
+};
+
 struct s3c_fb_pd_win smdk2416_fb_win[] = {
 	[0] = {
 		/* think this is the same as the smdk6410 */
@@ -186,6 +210,7 @@ static struct platform_device *smdk2416_devices[] __initdata = {
 	&s3c_device_i2c0,
 	&s3c_device_hsmmc0,
 	&s3c_device_hsmmc1,
+	&s3c_device_usb_hsudc,
 };
 
 static void __init smdk2416_map_io(void)
@@ -203,6 +228,8 @@ static void __init smdk2416_machine_init(void)
 	s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
 	s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
 
+	s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
+
 	gpio_request(S3C2410_GPB(4), "USBHost Power");
 	gpio_direction_output(S3C2410_GPB(4), 1);
 
Signature · 1 line
1.7.2.3
#24 lore raw

cover USB: gadget: Add Samsung S3C24xx USB HS controller driver

In reply to Heiko Stübner

Am Mittwoch 23 M?rz 2011 schrieb Heiko St?bner:

Quoted 7 lines

On 2010-10-13 Sangbeom Kim sent 4 patches to add support the USB High-Speed device controller module on Samsung's S3C2416, S3C2443 and S3C2450. [1]

bdooks worte on 2010-10-22:

Quoted 2 lines

patch 3/4 needs a bit of work, otherwise looks ok. I'll look at applying the s3c24xx items in the next day or so.

Quoted 8 lines

On 2010-10-23 Kukjin Kim send a revised version of patch 3. It seems the patches were forgotten after this.

We resurrected them while working on a s3c2416 based device. Patch 3 needed an update to work with current kernels. The other 3 patches were not modified.

Tests, comments, etc very welcome.

anyone?

If someone could tell me if I'm doing something wrong I would be really grateful.

Heiko

#25 lore raw

cover USB: gadget: Add Samsung S3C24xx USB HS controller driver

Quoted 16 lines · Heiko St?bner

Am Mittwoch 23 M?rz 2011 schrieb Heiko St?bner:

Quoted 14 lines

On 2010-10-13 Sangbeom Kim sent 4 patches to add support the USB High-Speed device controller module on Samsung's S3C2416, S3C2443 and S3C2450. [1]

bdooks worte on 2010-10-22:

Quoted 2 lines

patch 3/4 needs a bit of work, otherwise looks ok. I'll look at applying the s3c24xx items in the next day or so.

On 2010-10-23 Kukjin Kim send a revised version of patch 3. It seems the patches were forgotten after this.

We resurrected them while working on a s3c2416 based device. Patch 3 needed an update to work with current kernels. The other 3 patches were not modified.

Quoted 5 lines
Quoted 1 line

Tests, comments, etc very welcome.

anyone?

If someone could tell me if I'm doing something wrong I would be really grateful.

Sorry, been on vacation and at conferences, give me some time next week to catch up on usb email and I will get back to this...

thanks,

greg k-h