.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",
},
};
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;
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);
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;
}
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;
}
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]);
}
}
}
}
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;
}
#define EP_MAX_PACKET_SIZE 0x200
#define EP0_MAX_PACKET_SIZE 64
-struct mv_ep {
- struct usb_ep ep;
- struct usb_request req;
- struct list_head queue;
- const struct usb_endpoint_descriptor *desc;
-};
-
struct mv_udc {
u32 pad0[80];
#define MICRO_8FRAME 0x8
u32 epctrl[16]; /* 0x1c0 */
};
+struct mv_ep {
+ struct usb_ep ep;
+ struct usb_request req;
+ struct list_head queue;
+ const struct usb_endpoint_descriptor *desc;
+};
+
struct mv_drv {
struct usb_gadget gadget;
- struct usb_gadget_driver *driver;
+ struct usb_gadget_driver *driver;
struct mv_udc *udc;
+ struct mv_ep ep[2 * NUM_ENDPOINTS];
};
struct ept_queue_head {