diff options
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/Kconfig | 12 | ||||
-rw-r--r-- | drivers/usb/gadget/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/gadget_chips.h | 4 | ||||
-rw-r--r-- | drivers/usb/gadget/inode.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa25x_udc.c (renamed from drivers/usb/gadget/pxa2xx_udc.c) | 309 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa25x_udc.h (renamed from drivers/usb/gadget/pxa2xx_udc.h) | 29 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa27x_udc.c | 9 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa27x_udc.h | 8 |
9 files changed, 187 insertions, 190 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 3565d4352826..d6bab0d5f453 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -172,7 +172,7 @@ config USB_NET2280 default USB_GADGET select USB_GADGET_SELECTED -config USB_GADGET_PXA2XX +config USB_GADGET_PXA25X boolean "PXA 25x or IXP 4xx" depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX help @@ -184,19 +184,19 @@ config USB_GADGET_PXA2XX zero (for control transfers). Say "y" to link the driver statically, or "m" to build a - dynamically linked module called "pxa2xx_udc" and force all + dynamically linked module called "pxa25x_udc" and force all gadget drivers to also be dynamically linked. -config USB_PXA2XX +config USB_PXA25X tristate - depends on USB_GADGET_PXA2XX + depends on USB_GADGET_PXA25X default USB_GADGET select USB_GADGET_SELECTED # if there's only one gadget driver, using only two bulk endpoints, # don't waste memory for the other endpoints -config USB_PXA2XX_SMALL - depends on USB_GADGET_PXA2XX +config USB_PXA25X_SMALL + depends on USB_GADGET_PXA25X bool default n if USB_ETH_RNDIS default y if USB_ZERO diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile index 12357255d740..e258afd25faf 100644 --- a/drivers/usb/gadget/Makefile +++ b/drivers/usb/gadget/Makefile @@ -8,7 +8,7 @@ endif obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o obj-$(CONFIG_USB_NET2280) += net2280.o obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o -obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o +obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o obj-$(CONFIG_USB_GOKU) += goku_udc.o obj-$(CONFIG_USB_OMAP) += omap_udc.o diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8d61ea67a817..4ce3950b997f 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c @@ -262,7 +262,7 @@ MODULE_PARM_DESC(host_addr, "Host Ethernet Address"); /* For CDC-incapable hardware, choose the simple cdc subset. * Anything that talks bulk (without notable bugs) can do this. */ -#ifdef CONFIG_USB_GADGET_PXA2XX +#ifdef CONFIG_USB_GADGET_PXA25X #define DEV_CONFIG_SUBSET #endif diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h index f7f159c1002b..ca5149ea7312 100644 --- a/drivers/usb/gadget/gadget_chips.h +++ b/drivers/usb/gadget/gadget_chips.h @@ -29,8 +29,8 @@ #define gadget_is_dummy(g) 0 #endif -#ifdef CONFIG_USB_GADGET_PXA2XX -#define gadget_is_pxa(g) !strcmp("pxa2xx_udc", (g)->name) +#ifdef CONFIG_USB_GADGET_PXA25X +#define gadget_is_pxa(g) !strcmp("pxa25x_udc", (g)->name) #else #define gadget_is_pxa(g) 0 #endif diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 69b0a2754f2a..f132a9219e11 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c @@ -1501,7 +1501,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) } break; -#ifndef CONFIG_USB_GADGET_PXA2XX +#ifndef CONFIG_USB_GADGET_PXA25X /* PXA automagically handles this request too */ case USB_REQ_GET_CONFIGURATION: if (ctrl->bRequestType != 0x80) diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 08f699b1fc57..031dceb93023 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c @@ -1,5 +1,4 @@ /* - * linux/drivers/usb/gadget/pxa2xx_udc.c * Intel PXA25x and IXP4xx on-chip full speed USB device controllers * * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) @@ -46,19 +45,25 @@ #include <linux/err.h> #include <linux/seq_file.h> #include <linux/debugfs.h> +#include <linux/io.h> #include <asm/byteorder.h> #include <asm/dma.h> #include <asm/gpio.h> -#include <asm/io.h> #include <asm/system.h> #include <asm/mach-types.h> #include <asm/unaligned.h> -#include <asm/hardware.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> +/* + * This driver is PXA25x only. Grab the right register definitions. + */ +#ifdef CONFIG_ARCH_PXA +#include <asm/arch/pxa25x-udc.h> +#endif + #include <asm/mach/udc_pxa2xx.h> @@ -91,7 +96,7 @@ #define DRIVER_DESC "PXA 25x USB Device Controller driver" -static const char driver_name [] = "pxa2xx_udc"; +static const char driver_name [] = "pxa25x_udc"; static const char ep0name [] = "ep0"; @@ -111,10 +116,10 @@ static const char ep0name [] = "ep0"; #endif -#include "pxa2xx_udc.h" +#include "pxa25x_udc.h" -#ifdef CONFIG_USB_PXA2XX_SMALL +#ifdef CONFIG_USB_PXA25X_SMALL #define SIZE_STR " (small)" #else #define SIZE_STR "" @@ -126,8 +131,8 @@ static const char ep0name [] = "ep0"; * --------------------------------------------------------------------------- */ -static void pxa2xx_ep_fifo_flush (struct usb_ep *ep); -static void nuke (struct pxa2xx_ep *, int status); +static void pxa25x_ep_fifo_flush (struct usb_ep *ep); +static void nuke (struct pxa25x_ep *, int status); /* one GPIO should be used to detect VBUS from the host */ static int is_vbus_present(void) @@ -212,24 +217,24 @@ static inline void udc_ack_int_UDCCR(int mask) /* * endpoint enable/disable * - * we need to verify the descriptors used to enable endpoints. since pxa2xx + * we need to verify the descriptors used to enable endpoints. since pxa25x * endpoint configurations are fixed, and are pretty much always enabled, * there's not a lot to manage here. * - * because pxa2xx can't selectively initialize bulk (or interrupt) endpoints, + * because pxa25x can't selectively initialize bulk (or interrupt) endpoints, * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except * for a single interface (with only the default altsetting) and for gadget * drivers that don't halt endpoints (not reset by set_interface). that also * means that if you use ISO, you must violate the USB spec rule that all * iso endpoints must be in non-default altsettings. */ -static int pxa2xx_ep_enable (struct usb_ep *_ep, +static int pxa25x_ep_enable (struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) { - struct pxa2xx_ep *ep; - struct pxa2xx_udc *dev; + struct pxa25x_ep *ep; + struct pxa25x_udc *dev; - ep = container_of (_ep, struct pxa2xx_ep, ep); + ep = container_of (_ep, struct pxa25x_ep, ep); if (!_ep || !desc || ep->desc || _ep->name == ep0name || desc->bDescriptorType != USB_DT_ENDPOINT || ep->bEndpointAddress != desc->bEndpointAddress @@ -268,7 +273,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); /* flush fifo (mostly for OUT buffers) */ - pxa2xx_ep_fifo_flush (_ep); + pxa25x_ep_fifo_flush (_ep); /* ... reset halt state too, if we could ... */ @@ -276,12 +281,12 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, return 0; } -static int pxa2xx_ep_disable (struct usb_ep *_ep) +static int pxa25x_ep_disable (struct usb_ep *_ep) { - struct pxa2xx_ep *ep; + struct pxa25x_ep *ep; unsigned long flags; - ep = container_of (_ep, struct pxa2xx_ep, ep); + ep = container_of (_ep, struct pxa25x_ep, ep); if (!_ep || !ep->desc) { DMSG("%s, %s not enabled\n", __func__, _ep ? ep->ep.name : NULL); @@ -292,7 +297,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) nuke (ep, -ESHUTDOWN); /* flush fifo (mostly for IN buffers) */ - pxa2xx_ep_fifo_flush (_ep); + pxa25x_ep_fifo_flush (_ep); ep->desc = NULL; ep->stopped = 1; @@ -304,18 +309,18 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) /*-------------------------------------------------------------------------*/ -/* for the pxa2xx, these can just wrap kmalloc/kfree. gadget drivers +/* for the pxa25x, these can just wrap kmalloc/kfree. gadget drivers * must still pass correctly initialized endpoints, since other controller * drivers may care about how it's currently set up (dma issues etc). */ /* - * pxa2xx_ep_alloc_request - allocate a request data structure + * pxa25x_ep_alloc_request - allocate a request data structure */ static struct usb_request * -pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) +pxa25x_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) { - struct pxa2xx_request *req; + struct pxa25x_request *req; req = kzalloc(sizeof(*req), gfp_flags); if (!req) @@ -327,14 +332,14 @@ pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) /* - * pxa2xx_ep_free_request - deallocate a request data structure + * pxa25x_ep_free_request - deallocate a request data structure */ static void -pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) +pxa25x_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) { - struct pxa2xx_request *req; + struct pxa25x_request *req; - req = container_of (_req, struct pxa2xx_request, req); + req = container_of (_req, struct pxa25x_request, req); WARN_ON (!list_empty (&req->queue)); kfree(req); } @@ -344,7 +349,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) /* * done - retire a request; caller blocked irqs */ -static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status) +static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status) { unsigned stopped = ep->stopped; @@ -367,13 +372,13 @@ static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status) } -static inline void ep0_idle (struct pxa2xx_udc *dev) +static inline void ep0_idle (struct pxa25x_udc *dev) { dev->ep0state = EP0_IDLE; } static int -write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) +write_packet(volatile u32 *uddr, struct pxa25x_request *req, unsigned max) { u8 *buf; unsigned length, count; @@ -398,7 +403,7 @@ write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) * caller guarantees at least one packet buffer is ready (or a zlp). */ static int -write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) +write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) { unsigned max; @@ -455,7 +460,7 @@ write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) * ep0 data stage. these chips want very simple state transitions. */ static inline -void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) +void ep0start(struct pxa25x_udc *dev, u32 flags, const char *tag) { UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR; USIR0 = USIR0_IR0; @@ -465,7 +470,7 @@ void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) } static int -write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) +write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) { unsigned count; int is_short; @@ -525,7 +530,7 @@ write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) * request buffer having filled (and maybe overran till end-of-packet). */ static int -read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) +read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) { for (;;) { u32 udccs; @@ -602,7 +607,7 @@ read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) * protocols do use them. */ static int -read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) +read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) { u8 *buf, byte; unsigned bufferspace; @@ -641,21 +646,21 @@ read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) /*-------------------------------------------------------------------------*/ static int -pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) +pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) { - struct pxa2xx_request *req; - struct pxa2xx_ep *ep; - struct pxa2xx_udc *dev; + struct pxa25x_request *req; + struct pxa25x_ep *ep; + struct pxa25x_udc *dev; unsigned long flags; - req = container_of(_req, struct pxa2xx_request, req); + req = container_of(_req, struct pxa25x_request, req); if (unlikely (!_req || !_req->complete || !_req->buf || !list_empty(&req->queue))) { DMSG("%s, bad params\n", __func__); return -EINVAL; } - ep = container_of(_ep, struct pxa2xx_ep, ep); + ep = container_of(_ep, struct pxa25x_ep, ep); if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) { DMSG("%s, bad ep\n", __func__); return -EINVAL; @@ -751,14 +756,14 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) /* * nuke - dequeue ALL requests */ -static void nuke(struct pxa2xx_ep *ep, int status) +static void nuke(struct pxa25x_ep *ep, int status) { - struct pxa2xx_request *req; + struct pxa25x_request *req; /* called with irqs blocked */ while (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, - struct pxa2xx_request, + struct pxa25x_request, queue); done(ep, req, status); } @@ -768,13 +773,13 @@ static void nuke(struct pxa2xx_ep *ep, int status) /* dequeue JUST ONE request */ -static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) +static int pxa25x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) { - struct pxa2xx_ep *ep; - struct pxa2xx_request *req; + struct pxa25x_ep *ep; + struct pxa25x_request *req; unsigned long flags; - ep = container_of(_ep, struct pxa2xx_ep, ep); + ep = container_of(_ep, struct pxa25x_ep, ep); if (!_ep || ep->ep.name == ep0name) return -EINVAL; @@ -798,12 +803,12 @@ static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) /*-------------------------------------------------------------------------*/ -static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) +static int pxa25x_ep_set_halt(struct usb_ep *_ep, int value) { - struct pxa2xx_ep *ep; + struct pxa25x_ep *ep; unsigned long flags; - ep = container_of(_ep, struct pxa2xx_ep, ep); + ep = container_of(_ep, struct pxa25x_ep, ep); if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name)) || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { @@ -853,11 +858,11 @@ static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) return 0; } -static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) +static int pxa25x_ep_fifo_status(struct usb_ep *_ep) { - struct pxa2xx_ep *ep; + struct pxa25x_ep *ep; - ep = container_of(_ep, struct pxa2xx_ep, ep); + ep = container_of(_ep, struct pxa25x_ep, ep); if (!_ep) { DMSG("%s, bad ep\n", __func__); return -ENODEV; @@ -872,11 +877,11 @@ static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) return (*ep->reg_ubcr & 0xfff) + 1; } -static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) +static void pxa25x_ep_fifo_flush(struct usb_ep *_ep) { - struct pxa2xx_ep *ep; + struct pxa25x_ep *ep; - ep = container_of(_ep, struct pxa2xx_ep, ep); + ep = container_of(_ep, struct pxa25x_ep, ep); if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { DMSG("%s, bad ep\n", __func__); return; @@ -898,19 +903,19 @@ static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) } -static struct usb_ep_ops pxa2xx_ep_ops = { - .enable = pxa2xx_ep_enable, - .disable = pxa2xx_ep_disable, +static struct usb_ep_ops pxa25x_ep_ops = { + .enable = pxa25x_ep_enable, + .disable = pxa25x_ep_disable, - .alloc_request = pxa2xx_ep_alloc_request, - .free_request = pxa2xx_ep_free_request, + .alloc_request = pxa25x_ep_alloc_request, + .free_request = pxa25x_ep_free_request, - .queue = pxa2xx_ep_queue, - .dequeue = pxa2xx_ep_dequeue, + .queue = pxa25x_ep_queue, + .dequeue = pxa25x_ep_dequeue, - .set_halt = pxa2xx_ep_set_halt, - .fifo_status = pxa2xx_ep_fifo_status, - .fifo_flush = pxa2xx_ep_fifo_flush, + .set_halt = pxa25x_ep_set_halt, + .fifo_status = pxa25x_ep_fifo_status, + .fifo_flush = pxa25x_ep_fifo_flush, }; @@ -919,12 +924,12 @@ static struct usb_ep_ops pxa2xx_ep_ops = { * --------------------------------------------------------------------------- */ -static int pxa2xx_udc_get_frame(struct usb_gadget *_gadget) +static int pxa25x_udc_get_frame(struct usb_gadget *_gadget) { return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff); } -static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget) +static int pxa25x_udc_wakeup(struct usb_gadget *_gadget) { /* host may not have enabled remote wakeup */ if ((UDCCS0 & UDCCS0_DRWF) == 0) @@ -933,14 +938,14 @@ static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget) return 0; } -static void stop_activity(struct pxa2xx_udc *, struct usb_gadget_driver *); -static void udc_enable (struct pxa2xx_udc *); -static void udc_disable(struct pxa2xx_udc *); +static void stop_activity(struct pxa25x_udc *, struct usb_gadget_driver *); +static void udc_enable (struct pxa25x_udc *); +static void udc_disable(struct pxa25x_udc *); /* We disable the UDC -- and its 48 MHz clock -- whenever it's not * in active use. */ -static int pullup(struct pxa2xx_udc *udc) +static int pullup(struct pxa25x_udc *udc) { int is_active = udc->vbus && udc->pullup && !udc->suspended; DMSG("%s\n", is_active ? "active" : "inactive"); @@ -970,11 +975,11 @@ static int pullup(struct pxa2xx_udc *udc) } /* VBUS reporting logically comes from a transceiver */ -static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) +static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active) { - struct pxa2xx_udc *udc; + struct pxa25x_udc *udc; - udc = container_of(_gadget, struct pxa2xx_udc, gadget); + udc = container_of(_gadget, struct pxa25x_udc, gadget); udc->vbus = (is_active != 0); DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); pullup(udc); @@ -982,11 +987,11 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) } /* drivers may have software control over D+ pullup */ -static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) +static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active) { - struct pxa2xx_udc *udc; + struct pxa25x_udc *udc; - udc = container_of(_gadget, struct pxa2xx_udc, gadget); + udc = container_of(_gadget, struct pxa25x_udc, gadget); /* not all boards support pullup control */ if (!udc->mach->gpio_pullup && !udc->mach->udc_command) @@ -997,11 +1002,11 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) return 0; } -static const struct usb_gadget_ops pxa2xx_udc_ops = { - .get_frame = pxa2xx_udc_get_frame, - .wakeup = pxa2xx_udc_wakeup, - .vbus_session = pxa2xx_udc_vbus_session, - .pullup = pxa2xx_udc_pullup, +static const struct usb_gadget_ops pxa25x_udc_ops = { + .get_frame = pxa25x_udc_get_frame, + .wakeup = pxa25x_udc_wakeup, + .vbus_session = pxa25x_udc_vbus_session, + .pullup = pxa25x_udc_pullup, // .vbus_draw ... boards may consume current from VBUS, up to // 100-500mA based on config. the 500uA suspend ceiling means @@ -1015,7 +1020,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = { static int udc_seq_show(struct seq_file *m, void *_d) { - struct pxa2xx_udc *dev = m->private; + struct pxa25x_udc *dev = m->private; unsigned long flags; int i; u32 tmp; @@ -1076,8 +1081,8 @@ udc_seq_show(struct seq_file *m, void *_d) /* dump endpoint queues */ for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { - struct pxa2xx_ep *ep = &dev->ep [i]; - struct pxa2xx_request *req; + struct pxa25x_ep *ep = &dev->ep [i]; + struct pxa25x_request *req; if (i != 0) { const struct usb_endpoint_descriptor *desc; @@ -1150,7 +1155,7 @@ static const struct file_operations debug_fops = { /* * udc_disable - disable USB device controller */ -static void udc_disable(struct pxa2xx_udc *dev) +static void udc_disable(struct pxa25x_udc *dev) { /* block all irqs */ udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM); @@ -1170,7 +1175,7 @@ static void udc_disable(struct pxa2xx_udc *dev) /* * udc_reinit - initialize software state */ -static void udc_reinit(struct pxa2xx_udc *dev) +static void udc_reinit(struct pxa25x_udc *dev) { u32 i; @@ -1181,7 +1186,7 @@ static void udc_reinit(struct pxa2xx_udc *dev) /* basic endpoint records init */ for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { - struct pxa2xx_ep *ep = &dev->ep[i]; + struct pxa25x_ep *ep = &dev->ep[i]; if (i != 0) list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); @@ -1198,7 +1203,7 @@ static void udc_reinit(struct pxa2xx_udc *dev) /* until it's enabled, this UDC should be completely invisible * to any USB host. */ -static void udc_enable (struct pxa2xx_udc *dev) +static void udc_enable (struct pxa25x_udc *dev) { udc_clear_mask_UDCCR(UDCCR_UDE); @@ -1254,7 +1259,7 @@ static void udc_enable (struct pxa2xx_udc *dev) */ int usb_gadget_register_driver(struct usb_gadget_driver *driver) { - struct pxa2xx_udc *dev = the_controller; + struct pxa25x_udc *dev = the_controller; int retval; if (!driver @@ -1299,7 +1304,7 @@ fail: EXPORT_SYMBOL(usb_gadget_register_driver); static void -stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) +stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) { int i; @@ -1310,7 +1315,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) /* prevent new request submissions, kill any outstanding requests */ for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { - struct pxa2xx_ep *ep = &dev->ep[i]; + struct pxa25x_ep *ep = &dev->ep[i]; ep->stopped = 1; nuke(ep, -ESHUTDOWN); @@ -1327,7 +1332,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) { - struct pxa2xx_udc *dev = the_controller; + struct pxa25x_udc *dev = the_controller; if (!dev) return -ENODEV; @@ -1364,7 +1369,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); static irqreturn_t lubbock_vbus_irq(int irq, void *_dev) { - struct pxa2xx_udc *dev = _dev; + struct pxa25x_udc *dev = _dev; int vbus; dev->stats.irqs++; @@ -1383,7 +1388,7 @@ lubbock_vbus_irq(int irq, void *_dev) return IRQ_NONE; } - pxa2xx_udc_vbus_session(&dev->gadget, vbus); + pxa25x_udc_vbus_session(&dev->gadget, vbus); return IRQ_HANDLED; } @@ -1391,20 +1396,20 @@ lubbock_vbus_irq(int irq, void *_dev) static irqreturn_t udc_vbus_irq(int irq, void *_dev) { - struct pxa2xx_udc *dev = _dev; + struct pxa25x_udc *dev = _dev; int vbus = gpio_get_value(dev->mach->gpio_vbus); if (dev->mach->gpio_vbus_inverted) vbus = !vbus; - pxa2xx_udc_vbus_session(&dev->gadget, vbus); + pxa25x_udc_vbus_session(&dev->gadget, vbus); return IRQ_HANDLED; } /*-------------------------------------------------------------------------*/ -static inline void clear_ep_state (struct pxa2xx_udc *dev) +static inline void clear_ep_state (struct pxa25x_udc *dev) { unsigned i; @@ -1417,7 +1422,7 @@ static inline void clear_ep_state (struct pxa2xx_udc *dev) static void udc_watchdog(unsigned long _dev) { - struct pxa2xx_udc *dev = (void *)_dev; + struct pxa25x_udc *dev = (void *)_dev; local_irq_disable(); if (dev->ep0state == EP0_STALL @@ -1430,11 +1435,11 @@ static void udc_watchdog(unsigned long _dev) local_irq_enable(); } -static void handle_ep0 (struct pxa2xx_udc *dev) +static void handle_ep0 (struct pxa25x_udc *dev) { u32 udccs0 = UDCCS0; - struct pxa2xx_ep *ep = &dev->ep [0]; - struct pxa2xx_request *req; + struct pxa25x_ep *ep = &dev->ep [0]; + struct pxa25x_request *req; union { struct usb_ctrlrequest r; u8 raw [8]; @@ -1444,7 +1449,7 @@ static void handle_ep0 (struct pxa2xx_udc *dev) if (list_empty(&ep->queue)) req = NULL; else - req = list_entry(ep->queue.next, struct pxa2xx_request, queue); + req = list_entry(ep->queue.next, struct pxa25x_request, queue); /* clear stall status */ if (udccs0 & UDCCS0_SST) { @@ -1654,9 +1659,9 @@ stall: USIR0 = USIR0_IR0; } -static void handle_ep(struct pxa2xx_ep *ep) +static void handle_ep(struct pxa25x_ep *ep) { - struct pxa2xx_request *req; + struct pxa25x_request *req; int is_in = ep->bEndpointAddress & USB_DIR_IN; int completed; u32 udccs, tmp; @@ -1665,7 +1670,7 @@ static void handle_ep(struct pxa2xx_ep *ep) completed = 0; if (likely (!list_empty(&ep->queue))) req = list_entry(ep->queue.next, - struct pxa2xx_request, queue); + struct pxa25x_request, queue); else req = NULL; @@ -1702,16 +1707,16 @@ static void handle_ep(struct pxa2xx_ep *ep) } /* - * pxa2xx_udc_irq - interrupt handler + * pxa25x_udc_irq - interrupt handler * * avoid delays in ep0 processing. the control handshaking isn't always * under software control (pxa250c0 and the pxa255 are better), and delays * could cause usb protocol errors. */ static irqreturn_t -pxa2xx_udc_irq(int irq, void *_dev) +pxa25x_udc_irq(int irq, void *_dev) { - struct pxa2xx_udc *dev = _dev; + struct pxa25x_udc *dev = _dev; int handled; dev->stats.irqs++; @@ -1820,9 +1825,9 @@ static void nop_release (struct device *dev) * doing it at run-time) to save code, eliminate fault paths, and * be more obviously correct. */ -static struct pxa2xx_udc memory = { +static struct pxa25x_udc memory = { .gadget = { - .ops = &pxa2xx_udc_ops, + .ops = &pxa25x_udc_ops, .ep0 = &memory.ep[0].ep, .name = driver_name, .dev = { @@ -1835,7 +1840,7 @@ static struct pxa2xx_udc memory = { .ep[0] = { .ep = { .name = ep0name, - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = EP0_FIFO_SIZE, }, .dev = &memory, @@ -1847,7 +1852,7 @@ static struct pxa2xx_udc memory = { .ep[1] = { .ep = { .name = "ep1in-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -1860,7 +1865,7 @@ static struct pxa2xx_udc memory = { .ep[2] = { .ep = { .name = "ep2out-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -1871,11 +1876,11 @@ static struct pxa2xx_udc memory = { .reg_ubcr = &UBCR2, .reg_uddr = &UDDR2, }, -#ifndef CONFIG_USB_PXA2XX_SMALL +#ifndef CONFIG_USB_PXA25X_SMALL .ep[3] = { .ep = { .name = "ep3in-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -1888,7 +1893,7 @@ static struct pxa2xx_udc memory = { .ep[4] = { .ep = { .name = "ep4out-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -1902,7 +1907,7 @@ static struct pxa2xx_udc memory = { .ep[5] = { .ep = { .name = "ep5in-int", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = INT_FIFO_SIZE, }, .dev = &memory, @@ -1917,7 +1922,7 @@ static struct pxa2xx_udc memory = { .ep[6] = { .ep = { .name = "ep6in-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -1930,7 +1935,7 @@ static struct pxa2xx_udc memory = { .ep[7] = { .ep = { .name = "ep7out-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -1944,7 +1949,7 @@ static struct pxa2xx_udc memory = { .ep[8] = { .ep = { .name = "ep8in-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -1957,7 +1962,7 @@ static struct pxa2xx_udc memory = { .ep[9] = { .ep = { .name = "ep9out-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -1971,7 +1976,7 @@ static struct pxa2xx_udc memory = { .ep[10] = { .ep = { .name = "ep10in-int", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = INT_FIFO_SIZE, }, .dev = &memory, @@ -1986,7 +1991,7 @@ static struct pxa2xx_udc memory = { .ep[11] = { .ep = { .name = "ep11in-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -1999,7 +2004,7 @@ static struct pxa2xx_udc memory = { .ep[12] = { .ep = { .name = "ep12out-bulk", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = BULK_FIFO_SIZE, }, .dev = &memory, @@ -2013,7 +2018,7 @@ static struct pxa2xx_udc memory = { .ep[13] = { .ep = { .name = "ep13in-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -2026,7 +2031,7 @@ static struct pxa2xx_udc memory = { .ep[14] = { .ep = { .name = "ep14out-iso", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = ISO_FIFO_SIZE, }, .dev = &memory, @@ -2040,7 +2045,7 @@ static struct pxa2xx_udc memory = { .ep[15] = { .ep = { .name = "ep15in-int", - .ops = &pxa2xx_ep_ops, + .ops = &pxa25x_ep_ops, .maxpacket = INT_FIFO_SIZE, }, .dev = &memory, @@ -2050,7 +2055,7 @@ static struct pxa2xx_udc memory = { .reg_udccs = &UDCCS15, .reg_uddr = &UDDR15, }, -#endif /* !CONFIG_USB_PXA2XX_SMALL */ +#endif /* !CONFIG_USB_PXA25X_SMALL */ }; #define CP15R0_VENDOR_MASK 0xffffe000 @@ -2090,9 +2095,9 @@ static struct pxa2xx_udc memory = { /* * probe - binds to the platform device */ -static int __init pxa2xx_udc_probe(struct platform_device *pdev) +static int __init pxa25x_udc_probe(struct platform_device *pdev) { - struct pxa2xx_udc *dev = &memory; + struct pxa25x_udc *dev = &memory; int retval, vbus_irq, irq; u32 chiprev; @@ -2155,7 +2160,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) if (dev->mach->gpio_vbus) { if ((retval = gpio_request(dev->mach->gpio_vbus, - "pxa2xx_udc GPIO VBUS"))) { + "pxa25x_udc GPIO VBUS"))) { dev_dbg(&pdev->dev, "can't get vbus gpio %d, err: %d\n", dev->mach->gpio_vbus, retval); @@ -2168,7 +2173,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) if (dev->mach->gpio_pullup) { if ((retval = gpio_request(dev->mach->gpio_pullup, - "pca2xx_udc GPIO PULLUP"))) { + "pca25x_udc GPIO PULLUP"))) { dev_dbg(&pdev->dev, "can't get pullup gpio %d, err: %d\n", dev->mach->gpio_pullup, retval); @@ -2194,7 +2199,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) dev->vbus = is_vbus_present(); /* irq setup after old hardware state is cleaned up */ - retval = request_irq(irq, pxa2xx_udc_irq, + retval = request_irq(irq, pxa25x_udc_irq, IRQF_DISABLED, driver_name, dev); if (retval != 0) { pr_err("%s: can't get irq %d, err %d\n", @@ -2260,14 +2265,14 @@ lubbock_fail0: return retval; } -static void pxa2xx_udc_shutdown(struct platform_device *_dev) +static void pxa25x_udc_shutdown(struct platform_device *_dev) { pullup_off(); } -static int __exit pxa2xx_udc_remove(struct platform_device *pdev) +static int __exit pxa25x_udc_remove(struct platform_device *pdev) { - struct pxa2xx_udc *dev = platform_get_drvdata(pdev); + struct pxa25x_udc *dev = platform_get_drvdata(pdev); if (dev->driver) return -EBUSY; @@ -2317,9 +2322,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) * VBUS IRQs should probably be ignored so that the PXA device just acts * "dead" to USB hosts until system resume. */ -static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) +static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state) { - struct pxa2xx_udc *udc = platform_get_drvdata(dev); + struct pxa25x_udc *udc = platform_get_drvdata(dev); unsigned long flags; if (!udc->mach->gpio_pullup && !udc->mach->udc_command) @@ -2333,9 +2338,9 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) return 0; } -static int pxa2xx_udc_resume(struct platform_device *dev) +static int pxa25x_udc_resume(struct platform_device *dev) { - struct pxa2xx_udc *udc = platform_get_drvdata(dev); + struct pxa25x_udc *udc = platform_get_drvdata(dev); unsigned long flags; udc->suspended = 0; @@ -2347,27 +2352,27 @@ static int pxa2xx_udc_resume(struct platform_device *dev) } #else -#define pxa2xx_udc_suspend NULL -#define pxa2xx_udc_resume NULL +#define pxa25x_udc_suspend NULL +#define pxa25x_udc_resume NULL #endif /*-------------------------------------------------------------------------*/ static struct platform_driver udc_driver = { - .shutdown = pxa2xx_udc_shutdown, - .remove = __exit_p(pxa2xx_udc_remove), - .suspend = pxa2xx_udc_suspend, - .resume = pxa2xx_udc_resume, + .shutdown = pxa25x_udc_shutdown, + .remove = __exit_p(pxa25x_udc_remove), + .suspend = pxa25x_udc_suspend, + .resume = pxa25x_udc_resume, .driver = { .owner = THIS_MODULE, - .name = "pxa2xx-udc", + .name = "pxa25x-udc", }, }; static int __init udc_init(void) { pr_info("%s: version %s\n", driver_name, DRIVER_VERSION); - return platform_driver_probe(&udc_driver, pxa2xx_udc_probe); + return platform_driver_probe(&udc_driver, pxa25x_udc_probe); } module_init(udc_init); @@ -2380,4 +2385,4 @@ module_exit(udc_exit); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); MODULE_LICENSE("GPL"); -MODULE_ALIAS("platform:pxa2xx-udc"); +MODULE_ALIAS("platform:pxa25x-udc"); diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa25x_udc.h index e2c19e88c875..4d11ece7c95f 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa25x_udc.h @@ -1,6 +1,5 @@ /* - * linux/drivers/usb/gadget/pxa2xx_udc.h - * Intel PXA2xx on-chip full speed USB device controller + * Intel PXA25x on-chip full speed USB device controller * * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix * Copyright (C) 2003 David Brownell @@ -21,14 +20,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef __LINUX_USB_GADGET_PXA2XX_H -#define __LINUX_USB_GADGET_PXA2XX_H +#ifndef __LINUX_USB_GADGET_PXA25X_H +#define __LINUX_USB_GADGET_PXA25X_H #include <linux/types.h> /*-------------------------------------------------------------------------*/ -/* pxa2xx has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */ +/* pxa25x has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */ #define UFNRH_SIR (1 << 7) /* SOF interrupt request */ #define UFNRH_SIM (1 << 6) /* SOF interrupt mask */ #define UFNRH_IPE14 (1 << 5) /* ISO packet error, ep14 */ @@ -45,11 +44,11 @@ /*-------------------------------------------------------------------------*/ -struct pxa2xx_udc; +struct pxa25x_udc; -struct pxa2xx_ep { +struct pxa25x_ep { struct usb_ep ep; - struct pxa2xx_udc *dev; + struct pxa25x_udc *dev; const struct usb_endpoint_descriptor *desc; struct list_head queue; @@ -72,7 +71,7 @@ struct pxa2xx_ep { volatile u32 *reg_uddr; }; -struct pxa2xx_request { +struct pxa25x_request { struct usb_request req; struct list_head queue; }; @@ -98,7 +97,7 @@ struct udc_stats { unsigned long irqs; }; -#ifdef CONFIG_USB_PXA2XX_SMALL +#ifdef CONFIG_USB_PXA25X_SMALL /* when memory's tight, SMALL config saves code+data. */ #define PXA_UDC_NUM_ENDPOINTS 3 #endif @@ -107,7 +106,7 @@ struct udc_stats { #define PXA_UDC_NUM_ENDPOINTS 16 #endif -struct pxa2xx_udc { +struct pxa25x_udc { struct usb_gadget gadget; struct usb_gadget_driver *driver; @@ -130,7 +129,7 @@ struct pxa2xx_udc { struct clk *clk; struct pxa2xx_udc_mach_info *mach; u64 dma_mask; - struct pxa2xx_ep ep [PXA_UDC_NUM_ENDPOINTS]; + struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS]; #ifdef CONFIG_USB_GADGET_DEBUG_FS struct dentry *debugfs_udc; @@ -144,7 +143,7 @@ struct pxa2xx_udc { /* lubbock can also report usb connect/disconnect irqs */ #endif -static struct pxa2xx_udc *the_controller; +static struct pxa25x_udc *the_controller; /*-------------------------------------------------------------------------*/ @@ -209,7 +208,7 @@ dump_udccs0(const char *label) } static void __maybe_unused -dump_state(struct pxa2xx_udc *dev) +dump_state(struct pxa25x_udc *dev) { u32 tmp; unsigned i; @@ -264,4 +263,4 @@ dump_state(struct pxa2xx_udc *dev) #define INFO(stuff...) pr_info("udc: " stuff) -#endif /* __LINUX_USB_GADGET_PXA2XX_H */ +#endif /* __LINUX_USB_GADGET_PXA25X_H */ diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index e02bfd4df3a6..9c0e82ec5c43 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -38,7 +38,7 @@ #include <linux/usb.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> - +#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */ #include <asm/arch/udc.h> #include "pxa27x_udc.h" @@ -2360,18 +2360,19 @@ static int pxa_udc_resume(struct platform_device *_dev) * Software must configure the USB OTG pad, UDC, and UHC * to the state they were in before entering sleep mode. */ - PSSR |= PSSR_OTGPH; + if (cpu_is_pxa27x()) + PSSR |= PSSR_OTGPH; return 0; } #endif /* work with hotplug and coldplug */ -MODULE_ALIAS("platform:pxa2xx-udc"); +MODULE_ALIAS("platform:pxa27x-udc"); static struct platform_driver udc_driver = { .driver = { - .name = "pxa2xx-udc", + .name = "pxa27x-udc", .owner = THIS_MODULE, }, .remove = __exit_p(pxa_udc_remove), diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h index 97453db924ff..1d1b7936ee11 100644 --- a/drivers/usb/gadget/pxa27x_udc.h +++ b/drivers/usb/gadget/pxa27x_udc.h @@ -484,12 +484,4 @@ static inline struct pxa_udc *to_gadget_udc(struct usb_gadget *gadget) #define ep_warn(ep, fmt, arg...) \ dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg) -/* - * Cannot include pxa-regs.h, as register names are similar. - * So PSSR is redefined here. This should be removed once UDC registers will - * be gone from pxa-regs.h. - */ -#define PSSR __REG(0x40F00004) /* Power Manager Sleep Status */ -#define PSSR_OTGPH (1 << 6) /* OTG Peripheral Hold */ - #endif /* __LINUX_USB_GADGET_PXA27X_H */ |