aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/lh7a40x_udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/lh7a40x_udc.c')
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 078f72467671..825abd2621b3 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -253,7 +253,7 @@ udc_proc_read(char *page, char **start, off_t off, int count,
253 */ 253 */
254static void udc_disable(struct lh7a40x_udc *dev) 254static void udc_disable(struct lh7a40x_udc *dev)
255{ 255{
256 DEBUG("%s, %p\n", __FUNCTION__, dev); 256 DEBUG("%s, %p\n", __func__, dev);
257 257
258 udc_set_address(dev, 0); 258 udc_set_address(dev, 0);
259 259
@@ -285,7 +285,7 @@ static void udc_reinit(struct lh7a40x_udc *dev)
285{ 285{
286 u32 i; 286 u32 i;
287 287
288 DEBUG("%s, %p\n", __FUNCTION__, dev); 288 DEBUG("%s, %p\n", __func__, dev);
289 289
290 /* device/ep0 records init */ 290 /* device/ep0 records init */
291 INIT_LIST_HEAD(&dev->gadget.ep_list); 291 INIT_LIST_HEAD(&dev->gadget.ep_list);
@@ -318,7 +318,7 @@ static void udc_enable(struct lh7a40x_udc *dev)
318{ 318{
319 int ep; 319 int ep;
320 320
321 DEBUG("%s, %p\n", __FUNCTION__, dev); 321 DEBUG("%s, %p\n", __func__, dev);
322 322
323 dev->gadget.speed = USB_SPEED_UNKNOWN; 323 dev->gadget.speed = USB_SPEED_UNKNOWN;
324 324
@@ -412,7 +412,7 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
412 struct lh7a40x_udc *dev = the_controller; 412 struct lh7a40x_udc *dev = the_controller;
413 int retval; 413 int retval;
414 414
415 DEBUG("%s: %s\n", __FUNCTION__, driver->driver.name); 415 DEBUG("%s: %s\n", __func__, driver->driver.name);
416 416
417 if (!driver 417 if (!driver
418 || driver->speed != USB_SPEED_FULL 418 || driver->speed != USB_SPEED_FULL
@@ -521,7 +521,7 @@ static int write_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
521 is_short = unlikely(max < ep_maxpacket(ep)); 521 is_short = unlikely(max < ep_maxpacket(ep));
522 } 522 }
523 523
524 DEBUG("%s: wrote %s %d bytes%s%s %d left %p\n", __FUNCTION__, 524 DEBUG("%s: wrote %s %d bytes%s%s %d left %p\n", __func__,
525 ep->ep.name, count, 525 ep->ep.name, count,
526 is_last ? "/L" : "", is_short ? "/S" : "", 526 is_last ? "/L" : "", is_short ? "/S" : "",
527 req->req.length - req->req.actual, req); 527 req->req.length - req->req.actual, req);
@@ -555,7 +555,7 @@ static int read_fifo(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
555 /* make sure there's a packet in the FIFO. */ 555 /* make sure there's a packet in the FIFO. */
556 csr = usb_read(ep->csr1); 556 csr = usb_read(ep->csr1);
557 if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY)) { 557 if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY)) {
558 DEBUG("%s: Packet NOT ready!\n", __FUNCTION__); 558 DEBUG("%s: Packet NOT ready!\n", __func__);
559 return -EINVAL; 559 return -EINVAL;
560 } 560 }
561 561
@@ -614,7 +614,7 @@ static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req, int status)
614 unsigned int stopped = ep->stopped; 614 unsigned int stopped = ep->stopped;
615 u32 index; 615 u32 index;
616 616
617 DEBUG("%s, %p\n", __FUNCTION__, ep); 617 DEBUG("%s, %p\n", __func__, ep);
618 list_del_init(&req->queue); 618 list_del_init(&req->queue);
619 619
620 if (likely(req->req.status == -EINPROGRESS)) 620 if (likely(req->req.status == -EINPROGRESS))
@@ -644,7 +644,7 @@ static void done(struct lh7a40x_ep *ep, struct lh7a40x_request *req, int status)
644/** Enable EP interrupt */ 644/** Enable EP interrupt */
645static void pio_irq_enable(int ep) 645static void pio_irq_enable(int ep)
646{ 646{
647 DEBUG("%s: %d\n", __FUNCTION__, ep); 647 DEBUG("%s: %d\n", __func__, ep);
648 648
649 switch (ep) { 649 switch (ep) {
650 case 1: 650 case 1:
@@ -665,7 +665,7 @@ static void pio_irq_enable(int ep)
665/** Disable EP interrupt */ 665/** Disable EP interrupt */
666static void pio_irq_disable(int ep) 666static void pio_irq_disable(int ep)
667{ 667{
668 DEBUG("%s: %d\n", __FUNCTION__, ep); 668 DEBUG("%s: %d\n", __func__, ep);
669 669
670 switch (ep) { 670 switch (ep) {
671 case 1: 671 case 1:
@@ -690,7 +690,7 @@ void nuke(struct lh7a40x_ep *ep, int status)
690{ 690{
691 struct lh7a40x_request *req; 691 struct lh7a40x_request *req;
692 692
693 DEBUG("%s, %p\n", __FUNCTION__, ep); 693 DEBUG("%s, %p\n", __func__, ep);
694 694
695 /* Flush FIFO */ 695 /* Flush FIFO */
696 flush(ep); 696 flush(ep);
@@ -734,7 +734,7 @@ static void flush_all(struct lh7a40x_udc *dev)
734 */ 734 */
735static void flush(struct lh7a40x_ep *ep) 735static void flush(struct lh7a40x_ep *ep)
736{ 736{
737 DEBUG("%s, %p\n", __FUNCTION__, ep); 737 DEBUG("%s, %p\n", __func__, ep);
738 738
739 switch (ep->ep_type) { 739 switch (ep->ep_type) {
740 case ep_control: 740 case ep_control:
@@ -766,7 +766,7 @@ static void lh7a40x_in_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
766 usb_set_index(ep_idx); 766 usb_set_index(ep_idx);
767 767
768 csr = usb_read(ep->csr1); 768 csr = usb_read(ep->csr1);
769 DEBUG("%s: %d, csr %x\n", __FUNCTION__, ep_idx, csr); 769 DEBUG("%s: %d, csr %x\n", __func__, ep_idx, csr);
770 770
771 if (csr & USB_IN_CSR1_SENT_STALL) { 771 if (csr & USB_IN_CSR1_SENT_STALL) {
772 DEBUG("USB_IN_CSR1_SENT_STALL\n"); 772 DEBUG("USB_IN_CSR1_SENT_STALL\n");
@@ -776,7 +776,7 @@ static void lh7a40x_in_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
776 } 776 }
777 777
778 if (!ep->desc) { 778 if (!ep->desc) {
779 DEBUG("%s: NO EP DESC\n", __FUNCTION__); 779 DEBUG("%s: NO EP DESC\n", __func__);
780 return; 780 return;
781 } 781 }
782 782
@@ -802,7 +802,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
802 struct lh7a40x_ep *ep = &dev->ep[ep_idx]; 802 struct lh7a40x_ep *ep = &dev->ep[ep_idx];
803 struct lh7a40x_request *req; 803 struct lh7a40x_request *req;
804 804
805 DEBUG("%s: %d\n", __FUNCTION__, ep_idx); 805 DEBUG("%s: %d\n", __func__, ep_idx);
806 806
807 usb_set_index(ep_idx); 807 usb_set_index(ep_idx);
808 808
@@ -814,11 +814,11 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
814 usb_read(ep-> 814 usb_read(ep->
815 csr1)) & (USB_OUT_CSR1_OUT_PKT_RDY | 815 csr1)) & (USB_OUT_CSR1_OUT_PKT_RDY |
816 USB_OUT_CSR1_SENT_STALL)) { 816 USB_OUT_CSR1_SENT_STALL)) {
817 DEBUG("%s: %x\n", __FUNCTION__, csr); 817 DEBUG("%s: %x\n", __func__, csr);
818 818
819 if (csr & USB_OUT_CSR1_SENT_STALL) { 819 if (csr & USB_OUT_CSR1_SENT_STALL) {
820 DEBUG("%s: stall sent, flush fifo\n", 820 DEBUG("%s: stall sent, flush fifo\n",
821 __FUNCTION__); 821 __func__);
822 /* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1); */ 822 /* usb_set(USB_OUT_CSR1_FIFO_FLUSH, ep->csr1); */
823 flush(ep); 823 flush(ep);
824 } else if (csr & USB_OUT_CSR1_OUT_PKT_RDY) { 824 } else if (csr & USB_OUT_CSR1_OUT_PKT_RDY) {
@@ -832,7 +832,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
832 832
833 if (!req) { 833 if (!req) {
834 printk("%s: NULL REQ %d\n", 834 printk("%s: NULL REQ %d\n",
835 __FUNCTION__, ep_idx); 835 __func__, ep_idx);
836 flush(ep); 836 flush(ep);
837 break; 837 break;
838 } else { 838 } else {
@@ -844,7 +844,7 @@ static void lh7a40x_out_epn(struct lh7a40x_udc *dev, u32 ep_idx, u32 intr)
844 844
845 } else { 845 } else {
846 /* Throw packet away.. */ 846 /* Throw packet away.. */
847 printk("%s: No descriptor?!?\n", __FUNCTION__); 847 printk("%s: No descriptor?!?\n", __func__);
848 flush(ep); 848 flush(ep);
849 } 849 }
850} 850}
@@ -886,7 +886,7 @@ static void lh7a40x_reset_intr(struct lh7a40x_udc *dev)
886#if 0 /* def CONFIG_ARCH_LH7A404 */ 886#if 0 /* def CONFIG_ARCH_LH7A404 */
887 /* Does not work always... */ 887 /* Does not work always... */
888 888
889 DEBUG("%s: %d\n", __FUNCTION__, dev->usb_address); 889 DEBUG("%s: %d\n", __func__, dev->usb_address);
890 890
891 if (!dev->usb_address) { 891 if (!dev->usb_address) {
892 /*usb_set(USB_RESET_IO, USB_RESET); 892 /*usb_set(USB_RESET_IO, USB_RESET);
@@ -936,7 +936,7 @@ static irqreturn_t lh7a40x_udc_irq(int irq, void *_dev)
936 if (!intr_out && !intr_in && !intr_int) 936 if (!intr_out && !intr_in && !intr_int)
937 break; 937 break;
938 938
939 DEBUG("%s (on state %s)\n", __FUNCTION__, 939 DEBUG("%s (on state %s)\n", __func__,
940 state_names[dev->ep0state]); 940 state_names[dev->ep0state]);
941 DEBUG("intr_out = %x\n", intr_out); 941 DEBUG("intr_out = %x\n", intr_out);
942 DEBUG("intr_in = %x\n", intr_in); 942 DEBUG("intr_in = %x\n", intr_in);
@@ -1016,14 +1016,14 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep,
1016 struct lh7a40x_udc *dev; 1016 struct lh7a40x_udc *dev;
1017 unsigned long flags; 1017 unsigned long flags;
1018 1018
1019 DEBUG("%s, %p\n", __FUNCTION__, _ep); 1019 DEBUG("%s, %p\n", __func__, _ep);
1020 1020
1021 ep = container_of(_ep, struct lh7a40x_ep, ep); 1021 ep = container_of(_ep, struct lh7a40x_ep, ep);
1022 if (!_ep || !desc || ep->desc || _ep->name == ep0name 1022 if (!_ep || !desc || ep->desc || _ep->name == ep0name
1023 || desc->bDescriptorType != USB_DT_ENDPOINT 1023 || desc->bDescriptorType != USB_DT_ENDPOINT
1024 || ep->bEndpointAddress != desc->bEndpointAddress 1024 || ep->bEndpointAddress != desc->bEndpointAddress
1025 || ep_maxpacket(ep) < le16_to_cpu(desc->wMaxPacketSize)) { 1025 || ep_maxpacket(ep) < le16_to_cpu(desc->wMaxPacketSize)) {
1026 DEBUG("%s, bad ep or descriptor\n", __FUNCTION__); 1026 DEBUG("%s, bad ep or descriptor\n", __func__);
1027 return -EINVAL; 1027 return -EINVAL;
1028 } 1028 }
1029 1029
@@ -1031,7 +1031,7 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep,
1031 if (ep->bmAttributes != desc->bmAttributes 1031 if (ep->bmAttributes != desc->bmAttributes
1032 && ep->bmAttributes != USB_ENDPOINT_XFER_BULK 1032 && ep->bmAttributes != USB_ENDPOINT_XFER_BULK
1033 && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { 1033 && desc->bmAttributes != USB_ENDPOINT_XFER_INT) {
1034 DEBUG("%s, %s type mismatch\n", __FUNCTION__, _ep->name); 1034 DEBUG("%s, %s type mismatch\n", __func__, _ep->name);
1035 return -EINVAL; 1035 return -EINVAL;
1036 } 1036 }
1037 1037
@@ -1039,13 +1039,13 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep,
1039 if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK 1039 if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
1040 && le16_to_cpu(desc->wMaxPacketSize) != ep_maxpacket(ep)) 1040 && le16_to_cpu(desc->wMaxPacketSize) != ep_maxpacket(ep))
1041 || !desc->wMaxPacketSize) { 1041 || !desc->wMaxPacketSize) {
1042 DEBUG("%s, bad %s maxpacket\n", __FUNCTION__, _ep->name); 1042 DEBUG("%s, bad %s maxpacket\n", __func__, _ep->name);
1043 return -ERANGE; 1043 return -ERANGE;
1044 } 1044 }
1045 1045
1046 dev = ep->dev; 1046 dev = ep->dev;
1047 if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { 1047 if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) {
1048 DEBUG("%s, bogus device state\n", __FUNCTION__); 1048 DEBUG("%s, bogus device state\n", __func__);
1049 return -ESHUTDOWN; 1049 return -ESHUTDOWN;
1050 } 1050 }
1051 1051
@@ -1061,7 +1061,7 @@ static int lh7a40x_ep_enable(struct usb_ep *_ep,
1061 /* Reset halt state (does flush) */ 1061 /* Reset halt state (does flush) */
1062 lh7a40x_set_halt(_ep, 0); 1062 lh7a40x_set_halt(_ep, 0);
1063 1063
1064 DEBUG("%s: enabled %s\n", __FUNCTION__, _ep->name); 1064 DEBUG("%s: enabled %s\n", __func__, _ep->name);
1065 return 0; 1065 return 0;
1066} 1066}
1067 1067
@@ -1073,11 +1073,11 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep)
1073 struct lh7a40x_ep *ep; 1073 struct lh7a40x_ep *ep;
1074 unsigned long flags; 1074 unsigned long flags;
1075 1075
1076 DEBUG("%s, %p\n", __FUNCTION__, _ep); 1076 DEBUG("%s, %p\n", __func__, _ep);
1077 1077
1078 ep = container_of(_ep, struct lh7a40x_ep, ep); 1078 ep = container_of(_ep, struct lh7a40x_ep, ep);
1079 if (!_ep || !ep->desc) { 1079 if (!_ep || !ep->desc) {
1080 DEBUG("%s, %s not enabled\n", __FUNCTION__, 1080 DEBUG("%s, %s not enabled\n", __func__,
1081 _ep ? ep->ep.name : NULL); 1081 _ep ? ep->ep.name : NULL);
1082 return -EINVAL; 1082 return -EINVAL;
1083 } 1083 }
@@ -1097,7 +1097,7 @@ static int lh7a40x_ep_disable(struct usb_ep *_ep)
1097 1097
1098 spin_unlock_irqrestore(&ep->dev->lock, flags); 1098 spin_unlock_irqrestore(&ep->dev->lock, flags);
1099 1099
1100 DEBUG("%s: disabled %s\n", __FUNCTION__, _ep->name); 1100 DEBUG("%s: disabled %s\n", __func__, _ep->name);
1101 return 0; 1101 return 0;
1102} 1102}
1103 1103
@@ -1106,7 +1106,7 @@ static struct usb_request *lh7a40x_alloc_request(struct usb_ep *ep,
1106{ 1106{
1107 struct lh7a40x_request *req; 1107 struct lh7a40x_request *req;
1108 1108
1109 DEBUG("%s, %p\n", __FUNCTION__, ep); 1109 DEBUG("%s, %p\n", __func__, ep);
1110 1110
1111 req = kzalloc(sizeof(*req), gfp_flags); 1111 req = kzalloc(sizeof(*req), gfp_flags);
1112 if (!req) 1112 if (!req)
@@ -1121,7 +1121,7 @@ static void lh7a40x_free_request(struct usb_ep *ep, struct usb_request *_req)
1121{ 1121{
1122 struct lh7a40x_request *req; 1122 struct lh7a40x_request *req;
1123 1123
1124 DEBUG("%s, %p\n", __FUNCTION__, ep); 1124 DEBUG("%s, %p\n", __func__, ep);
1125 1125
1126 req = container_of(_req, struct lh7a40x_request, req); 1126 req = container_of(_req, struct lh7a40x_request, req);
1127 WARN_ON(!list_empty(&req->queue)); 1127 WARN_ON(!list_empty(&req->queue));
@@ -1140,25 +1140,25 @@ static int lh7a40x_queue(struct usb_ep *_ep, struct usb_request *_req,
1140 struct lh7a40x_udc *dev; 1140 struct lh7a40x_udc *dev;
1141 unsigned long flags; 1141 unsigned long flags;
1142 1142
1143 DEBUG("\n\n\n%s, %p\n", __FUNCTION__, _ep); 1143 DEBUG("\n\n\n%s, %p\n", __func__, _ep);
1144 1144
1145 req = container_of(_req, struct lh7a40x_request, req); 1145 req = container_of(_req, struct lh7a40x_request, req);
1146 if (unlikely 1146 if (unlikely
1147 (!_req || !_req->complete || !_req->buf 1147 (!_req || !_req->complete || !_req->buf
1148 || !list_empty(&req->queue))) { 1148 || !list_empty(&req->queue))) {
1149 DEBUG("%s, bad params\n", __FUNCTION__); 1149 DEBUG("%s, bad params\n", __func__);
1150 return -EINVAL; 1150 return -EINVAL;
1151 } 1151 }
1152 1152
1153 ep = container_of(_ep, struct lh7a40x_ep, ep); 1153 ep = container_of(_ep, struct lh7a40x_ep, ep);
1154 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { 1154 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1155 DEBUG("%s, bad ep\n", __FUNCTION__); 1155 DEBUG("%s, bad ep\n", __func__);
1156 return -EINVAL; 1156 return -EINVAL;
1157 } 1157 }
1158 1158
1159 dev = ep->dev; 1159 dev = ep->dev;
1160 if (unlikely(!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) { 1160 if (unlikely(!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) {
1161 DEBUG("%s, bogus device state %p\n", __FUNCTION__, dev->driver); 1161 DEBUG("%s, bogus device state %p\n", __func__, dev->driver);
1162 return -ESHUTDOWN; 1162 return -ESHUTDOWN;
1163 } 1163 }
1164 1164
@@ -1218,7 +1218,7 @@ static int lh7a40x_dequeue(struct usb_ep *_ep, struct usb_request *_req)
1218 struct lh7a40x_request *req; 1218 struct lh7a40x_request *req;
1219 unsigned long flags; 1219 unsigned long flags;
1220 1220
1221 DEBUG("%s, %p\n", __FUNCTION__, _ep); 1221 DEBUG("%s, %p\n", __func__, _ep);
1222 1222
1223 ep = container_of(_ep, struct lh7a40x_ep, ep); 1223 ep = container_of(_ep, struct lh7a40x_ep, ep);
1224 if (!_ep || ep->ep.name == ep0name) 1224 if (!_ep || ep->ep.name == ep0name)
@@ -1253,13 +1253,13 @@ static int lh7a40x_set_halt(struct usb_ep *_ep, int value)
1253 1253
1254 ep = container_of(_ep, struct lh7a40x_ep, ep); 1254 ep = container_of(_ep, struct lh7a40x_ep, ep);
1255 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { 1255 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1256 DEBUG("%s, bad ep\n", __FUNCTION__); 1256 DEBUG("%s, bad ep\n", __func__);
1257 return -EINVAL; 1257 return -EINVAL;
1258 } 1258 }
1259 1259
1260 usb_set_index(ep_index(ep)); 1260 usb_set_index(ep_index(ep));
1261 1261
1262 DEBUG("%s, ep %d, val %d\n", __FUNCTION__, ep_index(ep), value); 1262 DEBUG("%s, ep %d, val %d\n", __func__, ep_index(ep), value);
1263 1263
1264 spin_lock_irqsave(&ep->dev->lock, flags); 1264 spin_lock_irqsave(&ep->dev->lock, flags);
1265 1265
@@ -1325,11 +1325,11 @@ static int lh7a40x_fifo_status(struct usb_ep *_ep)
1325 1325
1326 ep = container_of(_ep, struct lh7a40x_ep, ep); 1326 ep = container_of(_ep, struct lh7a40x_ep, ep);
1327 if (!_ep) { 1327 if (!_ep) {
1328 DEBUG("%s, bad ep\n", __FUNCTION__); 1328 DEBUG("%s, bad ep\n", __func__);
1329 return -ENODEV; 1329 return -ENODEV;
1330 } 1330 }
1331 1331
1332 DEBUG("%s, %d\n", __FUNCTION__, ep_index(ep)); 1332 DEBUG("%s, %d\n", __func__, ep_index(ep));
1333 1333
1334 /* LPD can't report unclaimed bytes from IN fifos */ 1334 /* LPD can't report unclaimed bytes from IN fifos */
1335 if (ep_is_in(ep)) 1335 if (ep_is_in(ep))
@@ -1355,7 +1355,7 @@ static void lh7a40x_fifo_flush(struct usb_ep *_ep)
1355 1355
1356 ep = container_of(_ep, struct lh7a40x_ep, ep); 1356 ep = container_of(_ep, struct lh7a40x_ep, ep);
1357 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { 1357 if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) {
1358 DEBUG("%s, bad ep\n", __FUNCTION__); 1358 DEBUG("%s, bad ep\n", __func__);
1359 return; 1359 return;
1360 } 1360 }
1361 1361
@@ -1376,7 +1376,7 @@ static int write_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1376 1376
1377 max = ep_maxpacket(ep); 1377 max = ep_maxpacket(ep);
1378 1378
1379 DEBUG_EP0("%s\n", __FUNCTION__); 1379 DEBUG_EP0("%s\n", __func__);
1380 1380
1381 count = write_packet(ep, req, max); 1381 count = write_packet(ep, req, max);
1382 1382
@@ -1390,7 +1390,7 @@ static int write_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1390 is_last = 1; 1390 is_last = 1;
1391 } 1391 }
1392 1392
1393 DEBUG_EP0("%s: wrote %s %d bytes%s %d left %p\n", __FUNCTION__, 1393 DEBUG_EP0("%s: wrote %s %d bytes%s %d left %p\n", __func__,
1394 ep->ep.name, count, 1394 ep->ep.name, count,
1395 is_last ? "/L" : "", req->req.length - req->req.actual, req); 1395 is_last ? "/L" : "", req->req.length - req->req.actual, req);
1396 1396
@@ -1434,7 +1434,7 @@ static int read_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1434 unsigned bufferspace, count, is_short; 1434 unsigned bufferspace, count, is_short;
1435 volatile u32 *fifo = (volatile u32 *)ep->fifo; 1435 volatile u32 *fifo = (volatile u32 *)ep->fifo;
1436 1436
1437 DEBUG_EP0("%s\n", __FUNCTION__); 1437 DEBUG_EP0("%s\n", __func__);
1438 1438
1439 csr = usb_read(USB_EP0_CSR); 1439 csr = usb_read(USB_EP0_CSR);
1440 if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY)) 1440 if (!(csr & USB_OUT_CSR1_OUT_PKT_RDY))
@@ -1492,7 +1492,7 @@ static int read_fifo_ep0(struct lh7a40x_ep *ep, struct lh7a40x_request *req)
1492 */ 1492 */
1493static void udc_set_address(struct lh7a40x_udc *dev, unsigned char address) 1493static void udc_set_address(struct lh7a40x_udc *dev, unsigned char address)
1494{ 1494{
1495 DEBUG_EP0("%s: %d\n", __FUNCTION__, address); 1495 DEBUG_EP0("%s: %d\n", __func__, address);
1496 /* c.f. 15.1.2.2 Table 15-4 address will be used after DATA_END is set */ 1496 /* c.f. 15.1.2.2 Table 15-4 address will be used after DATA_END is set */
1497 dev->usb_address = address; 1497 dev->usb_address = address;
1498 usb_set((address & USB_FA_FUNCTION_ADDR), USB_FA); 1498 usb_set((address & USB_FA_FUNCTION_ADDR), USB_FA);
@@ -1514,7 +1514,7 @@ static void lh7a40x_ep0_out(struct lh7a40x_udc *dev, u32 csr)
1514 struct lh7a40x_ep *ep = &dev->ep[0]; 1514 struct lh7a40x_ep *ep = &dev->ep[0];
1515 int ret; 1515 int ret;
1516 1516
1517 DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); 1517 DEBUG_EP0("%s: %x\n", __func__, csr);
1518 1518
1519 if (list_empty(&ep->queue)) 1519 if (list_empty(&ep->queue))
1520 req = 0; 1520 req = 0;
@@ -1533,13 +1533,13 @@ static void lh7a40x_ep0_out(struct lh7a40x_udc *dev, u32 csr)
1533 if (ret) { 1533 if (ret) {
1534 /* Done! */ 1534 /* Done! */
1535 DEBUG_EP0("%s: finished, waiting for status\n", 1535 DEBUG_EP0("%s: finished, waiting for status\n",
1536 __FUNCTION__); 1536 __func__);
1537 1537
1538 usb_set((EP0_CLR_OUT | EP0_DATA_END), USB_EP0_CSR); 1538 usb_set((EP0_CLR_OUT | EP0_DATA_END), USB_EP0_CSR);
1539 dev->ep0state = WAIT_FOR_SETUP; 1539 dev->ep0state = WAIT_FOR_SETUP;
1540 } else { 1540 } else {
1541 /* Not done yet.. */ 1541 /* Not done yet.. */
1542 DEBUG_EP0("%s: not finished\n", __FUNCTION__); 1542 DEBUG_EP0("%s: not finished\n", __func__);
1543 usb_set(EP0_CLR_OUT, USB_EP0_CSR); 1543 usb_set(EP0_CLR_OUT, USB_EP0_CSR);
1544 } 1544 }
1545 } else { 1545 } else {
@@ -1556,7 +1556,7 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr)
1556 struct lh7a40x_ep *ep = &dev->ep[0]; 1556 struct lh7a40x_ep *ep = &dev->ep[0];
1557 int ret, need_zlp = 0; 1557 int ret, need_zlp = 0;
1558 1558
1559 DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); 1559 DEBUG_EP0("%s: %x\n", __func__, csr);
1560 1560
1561 if (list_empty(&ep->queue)) 1561 if (list_empty(&ep->queue))
1562 req = 0; 1562 req = 0;
@@ -1564,7 +1564,7 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr)
1564 req = list_entry(ep->queue.next, struct lh7a40x_request, queue); 1564 req = list_entry(ep->queue.next, struct lh7a40x_request, queue);
1565 1565
1566 if (!req) { 1566 if (!req) {
1567 DEBUG_EP0("%s: NULL REQ\n", __FUNCTION__); 1567 DEBUG_EP0("%s: NULL REQ\n", __func__);
1568 return 0; 1568 return 0;
1569 } 1569 }
1570 1570
@@ -1585,17 +1585,17 @@ static int lh7a40x_ep0_in(struct lh7a40x_udc *dev, u32 csr)
1585 1585
1586 if (ret == 1 && !need_zlp) { 1586 if (ret == 1 && !need_zlp) {
1587 /* Last packet */ 1587 /* Last packet */
1588 DEBUG_EP0("%s: finished, waiting for status\n", __FUNCTION__); 1588 DEBUG_EP0("%s: finished, waiting for status\n", __func__);
1589 1589
1590 usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR); 1590 usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR);
1591 dev->ep0state = WAIT_FOR_SETUP; 1591 dev->ep0state = WAIT_FOR_SETUP;
1592 } else { 1592 } else {
1593 DEBUG_EP0("%s: not finished\n", __FUNCTION__); 1593 DEBUG_EP0("%s: not finished\n", __func__);
1594 usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR); 1594 usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR);
1595 } 1595 }
1596 1596
1597 if (need_zlp) { 1597 if (need_zlp) {
1598 DEBUG_EP0("%s: Need ZLP!\n", __FUNCTION__); 1598 DEBUG_EP0("%s: Need ZLP!\n", __func__);
1599 usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR); 1599 usb_set(EP0_IN_PKT_RDY, USB_EP0_CSR);
1600 dev->ep0state = DATA_STATE_NEED_ZLP; 1600 dev->ep0state = DATA_STATE_NEED_ZLP;
1601 } 1601 }
@@ -1694,7 +1694,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr)
1694 struct usb_ctrlrequest ctrl; 1694 struct usb_ctrlrequest ctrl;
1695 int i, bytes, is_in; 1695 int i, bytes, is_in;
1696 1696
1697 DEBUG_SETUP("%s: %x\n", __FUNCTION__, csr); 1697 DEBUG_SETUP("%s: %x\n", __func__, csr);
1698 1698
1699 /* Nuke all previous transfers */ 1699 /* Nuke all previous transfers */
1700 nuke(ep, -EPROTO); 1700 nuke(ep, -EPROTO);
@@ -1799,7 +1799,7 @@ static void lh7a40x_ep0_setup(struct lh7a40x_udc *dev, u32 csr)
1799 */ 1799 */
1800static void lh7a40x_ep0_in_zlp(struct lh7a40x_udc *dev, u32 csr) 1800static void lh7a40x_ep0_in_zlp(struct lh7a40x_udc *dev, u32 csr)
1801{ 1801{
1802 DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); 1802 DEBUG_EP0("%s: %x\n", __func__, csr);
1803 1803
1804 /* c.f. Table 15-14 */ 1804 /* c.f. Table 15-14 */
1805 usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR); 1805 usb_set((EP0_IN_PKT_RDY | EP0_DATA_END), USB_EP0_CSR);
@@ -1818,7 +1818,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr)
1818 usb_set_index(0); 1818 usb_set_index(0);
1819 csr = usb_read(USB_EP0_CSR); 1819 csr = usb_read(USB_EP0_CSR);
1820 1820
1821 DEBUG_EP0("%s: csr = %x\n", __FUNCTION__, csr); 1821 DEBUG_EP0("%s: csr = %x\n", __func__, csr);
1822 1822
1823 /* 1823 /*
1824 * For overview of what we should be doing see c.f. Chapter 18.1.2.4 1824 * For overview of what we should be doing see c.f. Chapter 18.1.2.4
@@ -1832,7 +1832,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr)
1832 * - clear the SENT_STALL bit 1832 * - clear the SENT_STALL bit
1833 */ 1833 */
1834 if (csr & EP0_SENT_STALL) { 1834 if (csr & EP0_SENT_STALL) {
1835 DEBUG_EP0("%s: EP0_SENT_STALL is set: %x\n", __FUNCTION__, csr); 1835 DEBUG_EP0("%s: EP0_SENT_STALL is set: %x\n", __func__, csr);
1836 usb_clear((EP0_SENT_STALL | EP0_SEND_STALL), USB_EP0_CSR); 1836 usb_clear((EP0_SENT_STALL | EP0_SEND_STALL), USB_EP0_CSR);
1837 nuke(ep, -ECONNABORTED); 1837 nuke(ep, -ECONNABORTED);
1838 dev->ep0state = WAIT_FOR_SETUP; 1838 dev->ep0state = WAIT_FOR_SETUP;
@@ -1849,7 +1849,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr)
1849 */ 1849 */
1850 if (!(csr & (EP0_IN_PKT_RDY | EP0_OUT_PKT_RDY))) { 1850 if (!(csr & (EP0_IN_PKT_RDY | EP0_OUT_PKT_RDY))) {
1851 DEBUG_EP0("%s: IN_PKT_RDY and OUT_PKT_RDY are clear\n", 1851 DEBUG_EP0("%s: IN_PKT_RDY and OUT_PKT_RDY are clear\n",
1852 __FUNCTION__); 1852 __func__);
1853 1853
1854 switch (dev->ep0state) { 1854 switch (dev->ep0state) {
1855 case DATA_STATE_XMIT: 1855 case DATA_STATE_XMIT:
@@ -1877,7 +1877,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr)
1877 * - set SERVICED_SETUP_END_BIT 1877 * - set SERVICED_SETUP_END_BIT
1878 */ 1878 */
1879 if (csr & EP0_SETUP_END) { 1879 if (csr & EP0_SETUP_END) {
1880 DEBUG_EP0("%s: EP0_SETUP_END is set: %x\n", __FUNCTION__, csr); 1880 DEBUG_EP0("%s: EP0_SETUP_END is set: %x\n", __func__, csr);
1881 1881
1882 usb_set(EP0_CLR_SETUP_END, USB_EP0_CSR); 1882 usb_set(EP0_CLR_SETUP_END, USB_EP0_CSR);
1883 1883
@@ -1896,7 +1896,7 @@ static void lh7a40x_handle_ep0(struct lh7a40x_udc *dev, u32 intr)
1896 */ 1896 */
1897 if (csr & EP0_OUT_PKT_RDY) { 1897 if (csr & EP0_OUT_PKT_RDY) {
1898 1898
1899 DEBUG_EP0("%s: EP0_OUT_PKT_RDY is set: %x\n", __FUNCTION__, 1899 DEBUG_EP0("%s: EP0_OUT_PKT_RDY is set: %x\n", __func__,
1900 csr); 1900 csr);
1901 1901
1902 switch (dev->ep0state) { 1902 switch (dev->ep0state) {
@@ -1926,7 +1926,7 @@ static void lh7a40x_ep0_kick(struct lh7a40x_udc *dev, struct lh7a40x_ep *ep)
1926 usb_set_index(0); 1926 usb_set_index(0);
1927 csr = usb_read(USB_EP0_CSR); 1927 csr = usb_read(USB_EP0_CSR);
1928 1928
1929 DEBUG_EP0("%s: %x\n", __FUNCTION__, csr); 1929 DEBUG_EP0("%s: %x\n", __func__, csr);
1930 1930
1931 /* Clear "out packet ready" */ 1931 /* Clear "out packet ready" */
1932 usb_set(EP0_CLR_OUT, USB_EP0_CSR); 1932 usb_set(EP0_CLR_OUT, USB_EP0_CSR);
@@ -1949,7 +1949,7 @@ static int lh7a40x_udc_get_frame(struct usb_gadget *_gadget)
1949{ 1949{
1950 u32 frame1 = usb_read(USB_FRM_NUM1); /* Least significant 8 bits */ 1950 u32 frame1 = usb_read(USB_FRM_NUM1); /* Least significant 8 bits */
1951 u32 frame2 = usb_read(USB_FRM_NUM2); /* Most significant 3 bits */ 1951 u32 frame2 = usb_read(USB_FRM_NUM2); /* Most significant 3 bits */
1952 DEBUG("%s, %p\n", __FUNCTION__, _gadget); 1952 DEBUG("%s, %p\n", __func__, _gadget);
1953 return ((frame2 & 0x07) << 8) | (frame1 & 0xff); 1953 return ((frame2 & 0x07) << 8) | (frame1 & 0xff);
1954} 1954}
1955 1955
@@ -1970,7 +1970,7 @@ static const struct usb_gadget_ops lh7a40x_udc_ops = {
1970 1970
1971static void nop_release(struct device *dev) 1971static void nop_release(struct device *dev)
1972{ 1972{
1973 DEBUG("%s %s\n", __FUNCTION__, dev->bus_id); 1973 DEBUG("%s %s\n", __func__, dev->bus_id);
1974} 1974}
1975 1975
1976static struct lh7a40x_udc memory = { 1976static struct lh7a40x_udc memory = {
@@ -2065,7 +2065,7 @@ static int lh7a40x_udc_probe(struct platform_device *pdev)
2065 struct lh7a40x_udc *dev = &memory; 2065 struct lh7a40x_udc *dev = &memory;
2066 int retval; 2066 int retval;
2067 2067
2068 DEBUG("%s: %p\n", __FUNCTION__, pdev); 2068 DEBUG("%s: %p\n", __func__, pdev);
2069 2069
2070 spin_lock_init(&dev->lock); 2070 spin_lock_init(&dev->lock);
2071 dev->dev = &pdev->dev; 2071 dev->dev = &pdev->dev;
@@ -2098,7 +2098,7 @@ static int lh7a40x_udc_remove(struct platform_device *pdev)
2098{ 2098{
2099 struct lh7a40x_udc *dev = platform_get_drvdata(pdev); 2099 struct lh7a40x_udc *dev = platform_get_drvdata(pdev);
2100 2100
2101 DEBUG("%s: %p\n", __FUNCTION__, pdev); 2101 DEBUG("%s: %p\n", __func__, pdev);
2102 2102
2103 if (dev->driver) 2103 if (dev->driver)
2104 return -EBUSY; 2104 return -EBUSY;
@@ -2131,7 +2131,7 @@ static struct platform_driver udc_driver = {
2131 2131
2132static int __init udc_init(void) 2132static int __init udc_init(void)
2133{ 2133{
2134 DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); 2134 DEBUG("%s: %s version %s\n", __func__, driver_name, DRIVER_VERSION);
2135 return platform_driver_register(&udc_driver); 2135 return platform_driver_register(&udc_driver);
2136} 2136}
2137 2137