summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-07-10 03:16:29 +0200
committerMarek Vasut <marex@denx.de>2013-07-29 23:01:31 +0200
commit532d846f891f31e2582428d7572b98103e3ec268 (patch)
tree95017a4a95ef4ba225c6d1c62442f58f4bd75e4a /drivers
parent6368c9194585ca7a1e35fb6806ff7d062e16299f (diff)
downloadu-boot-imx-532d846f891f31e2582428d7572b98103e3ec268.zip
u-boot-imx-532d846f891f31e2582428d7572b98103e3ec268.tar.gz
u-boot-imx-532d846f891f31e2582428d7572b98103e3ec268.tar.bz2
usb: mv_udc: Move endpoint array into driver data
The endpoints are operated on a per-controller basis, move the endpoint array into controller's private data. Also shuffle the struct mv_ep structure definition just above the definition of the struct mv_drv so they're well grouped together. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Lei Wen <leiwen@marvell.com> Cc: Otavio Salvador <otavio@ossystems.com.br> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/mv_udc.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c
index 93e5389..a667cf9 100644
--- a/drivers/usb/gadget/mv_udc.c
+++ b/drivers/usb/gadget/mv_udc.c
@@ -83,10 +83,8 @@ static struct usb_ep_ops mv_ep_ops = {
.free_request = mv_ep_free_request,
};
-static struct mv_ep ep[2 * NUM_ENDPOINTS];
static struct mv_drv controller = {
.gadget = {
- .ep0 = &ep[0].ep,
.name = "mv_udc",
},
};
@@ -207,7 +205,7 @@ static void handle_ep_complete(struct mv_ep *ep)
static void handle_setup(void)
{
- struct usb_request *req = &ep[0].req;
+ struct usb_request *req = &controller.ep[0].req;
struct mv_udc *udc = controller.udc;
struct ept_queue_head *head;
struct usb_ctrlrequest r;
@@ -230,11 +228,11 @@ static void handle_setup(void)
if ((r.wValue == 0) && (r.wLength == 0)) {
req->length = 0;
for (i = 0; i < NUM_ENDPOINTS; i++) {
- if (!ep[i].desc)
+ if (!controller.ep[i].desc)
continue;
- num = ep[i].desc->bEndpointAddress
- & USB_ENDPOINT_NUMBER_MASK;
- in = (ep[i].desc->bEndpointAddress
+ num = controller.ep[i].desc->bEndpointAddress
+ & USB_ENDPOINT_NUMBER_MASK;
+ in = (controller.ep[i].desc->bEndpointAddress
& USB_DIR_IN) != 0;
if ((num == _num) && (in == _in)) {
ep_enable(num, in);
@@ -290,10 +288,11 @@ static void stop_activity(void)
for (i = 0; i < NUM_ENDPOINTS; i++) {
if (i != 0)
writel(0, &udc->epctrl[i]);
- if (ep[i].desc) {
- num = ep[i].desc->bEndpointAddress
+ if (controller.ep[i].desc) {
+ num = controller.ep[i].desc->bEndpointAddress
& USB_ENDPOINT_NUMBER_MASK;
- in = (ep[i].desc->bEndpointAddress & USB_DIR_IN) != 0;
+ in = (controller.ep[i].desc->bEndpointAddress
+ & USB_DIR_IN) != 0;
head = epts + (num * 2) + (in);
head->info = INFO_ACTIVE;
}
@@ -324,8 +323,8 @@ void udc_irq(void)
if (bit == 2) {
controller.gadget.speed = USB_SPEED_HIGH;
for (i = 1; i < NUM_ENDPOINTS && n; i++)
- if (ep[i].desc)
- ep[i].ep.maxpacket = 512;
+ if (controller.ep[i].desc)
+ controller.ep[i].ep.maxpacket = 512;
} else {
controller.gadget.speed = USB_SPEED_FULL;
}
@@ -344,14 +343,14 @@ void udc_irq(void)
writel(n, &udc->epcomp);
for (i = 0; i < NUM_ENDPOINTS && n; i++) {
- if (ep[i].desc) {
- num = ep[i].desc->bEndpointAddress
+ if (controller.ep[i].desc) {
+ num = controller.ep[i].desc->bEndpointAddress
& USB_ENDPOINT_NUMBER_MASK;
- in = (ep[i].desc->bEndpointAddress
+ in = (controller.ep[i].desc->bEndpointAddress
& USB_DIR_IN) != 0;
bit = (in) ? EPT_TX(num) : EPT_RX(num);
if (n & bit)
- handle_ep_complete(&ep[i]);
+ handle_ep_complete(&controller.ep[i]);
}
}
}
@@ -436,19 +435,20 @@ static int mvudc_probe(void)
}
INIT_LIST_HEAD(&controller.gadget.ep_list);
- ep[0].ep.maxpacket = 64;
- ep[0].ep.name = "ep0";
- ep[0].desc = &ep0_in_desc;
+ controller.gadget.ep0 = &controller.ep[0].ep;
+ controller.ep[0].ep.maxpacket = 64;
+ controller.ep[0].ep.name = "ep0";
+ controller.ep[0].desc = &ep0_in_desc;
INIT_LIST_HEAD(&controller.gadget.ep0->ep_list);
for (i = 0; i < 2 * NUM_ENDPOINTS; i++) {
if (i != 0) {
- ep[i].ep.maxpacket = 512;
- ep[i].ep.name = "ep-";
- list_add_tail(&ep[i].ep.ep_list,
+ controller.ep[i].ep.maxpacket = 512;
+ controller.ep[i].ep.name = "ep-";
+ list_add_tail(&controller.ep[i].ep.ep_list,
&controller.gadget.ep_list);
- ep[i].desc = NULL;
+ controller.ep[i].desc = NULL;
}
- ep[i].ep.ops = &mv_ep_ops;
+ controller.ep[i].ep.ops = &mv_ep_ops;
}
return 0;
}