Skip to contentSkip to conversation

usb: gadget: bcm63xx UDC driver

PATCH In review Kevin Cernekee 2 participants 3 messages Aug 25, 2012 – Aug 27, 2012

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

PATCH v4 1/1 usb: gadget: bcm63xx UDC driver

Driver for the "USB20D" / "USBD" block on BCM6328, BCM6368, BCM6816, BCM6362, BCM3383, and others.

The hardware block was designed to support networking applications (direct connection of a home router to a PC), and the endpoint configuration is fixed.

---
 drivers/usb/gadget/Kconfig        |   12 +
 drivers/usb/gadget/Makefile       |    1 +
 drivers/usb/gadget/bcm63xx_udc.c  | 2464 +++++++++++++++++++++++++++++++++++++
 drivers/usb/gadget/gadget_chips.h |    3 +
 4 files changed, 2480 insertions(+)
 create mode 100644 drivers/usb/gadget/bcm63xx_udc.c

V4 changes:

Don't wait for status reply on a bad faked setup() request Prioritize SET_{CONFIGURATION,INTERFACE} over other ep0 requests Rebase on the latest balbi/usb.git tree

drivers/usb/gadget/Kconfig +12 -0
index 51ab5fd..663aae2 100644
@@ -160,6 +160,18 @@ config USB_ATMEL_USBA
 	  USBA is the integrated high-speed USB Device controller on
 	  the AT32AP700x, some AT91SAM9 and AT91CAP9 processors from Atmel.
 
+config USB_BCM63XX_UDC
+	tristate "Broadcom BCM63xx Peripheral Controller"
+	select USB_GADGET_DUALSPEED
+	depends on BCM63XX
+	help
+	   Many Broadcom BCM63xx chipsets (such as the BCM6328) have a
+	   high speed USB Device Port with support for four fixed endpoints
+	   (plus endpoint zero).
+
+	   Say "y" to link the driver statically, or "m" to build a
+	   dynamically linked module called "bcm63xx_udc".
+
 config USB_FSL_USB2
 	tristate "Freescale Highspeed USB DR Peripheral Controller"
 	depends on FSL_SOC || ARCH_MXC
drivers/usb/gadget/Makefile +1 -0
index 3fd8cd0..d84f923 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_USB_OMAP)		+= omap_udc.o
 obj-$(CONFIG_USB_S3C2410)	+= s3c2410_udc.o
 obj-$(CONFIG_USB_AT91)		+= at91_udc.o
 obj-$(CONFIG_USB_ATMEL_USBA)	+= atmel_usba_udc.o
+obj-$(CONFIG_USB_BCM63XX_UDC)	+= bcm63xx_udc.o
 obj-$(CONFIG_USB_FSL_USB2)	+= fsl_usb2_udc.o
 fsl_usb2_udc-y			:= fsl_udc_core.o
 fsl_usb2_udc-$(CONFIG_ARCH_MXC)	+= fsl_mxc_udc.o
drivers/usb/gadget/bcm63xx_udc.c new file +2464 -0

2,464 lines not on this page · raw message

drivers/usb/gadget/gadget_chips.h +3 -0
index b8b3a34..0ccca58 100644
@@ -28,6 +28,7 @@
 #define gadget_is_amd5536udc(g)		(!strcmp("amd5536udc", (g)->name))
 #define gadget_is_at91(g)		(!strcmp("at91_udc", (g)->name))
 #define gadget_is_atmel_usba(g)		(!strcmp("atmel_usba_udc", (g)->name))
+#define gadget_is_bcm63xx(g)		(!strcmp("bcm63xx_udc", (g)->name))
 #define gadget_is_ci13xxx_msm(g)	(!strcmp("ci13xxx_msm", (g)->name))
 #define gadget_is_ci13xxx_pci(g)	(!strcmp("ci13xxx_pci", (g)->name))
 #define gadget_is_dummy(g)		(!strcmp("dummy_udc", (g)->name))
@@ -121,6 +122,8 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x32;
 	else if (gadget_is_lpc32xx(gadget))
 		return 0x33;
+	else if (gadget_is_bcm63xx(gadget))
+		return 0x34;
 
 	return -ENOENT;
 }
Signature · 1 line
1.7.11.1
Acked-by on v4 1/1
#1 lore raw
Quoted 2 lines · Kevin Cernekee

Driver for the "USB20D" / "USBD" block on BCM6328, BCM6368, BCM6816, BCM6362, BCM3383, and others.

I don't see anything worth to object.

One little question: Felipe suggested to replace the workqueue by a threaded interrupt. You schedule the workqueue in interrupt context and once in ep0 enqueue. The enqueue should be fine by executing one round and waiting for the interrupt. Any reason why you suggested against it?

Sebastian

#2 lore raw

On Mon, Aug 27, 2012 at 1:46 PM, Sebastian Andrzej Siewior > One little question: Felipe suggested to replace the workqueue by a threaded

Quoted 3 lines

interrupt. You schedule the workqueue in interrupt context and once in ep0 enqueue. The enqueue should be fine by executing one round and waiting for the interrupt. Any reason why you suggested against it?

A couple of rounds could pass with no interrupt, e.g. if a SET_CONFIGURATION request and a SET_INTERFACE request are both pending.

Also, I ran into deadlocks when trying to invoke the gadget driver's callback from within the UDC enqueue function.

I did attempt it; V2 of the patch had the workqueue removed, but I backed out the change for V3 after seeing so many problems.