aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/s3c-hsudc.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 12:20:28 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 12:20:28 -0500
commitf9b0f5170918695891f42645737682ccb452ee13 (patch)
tree75eaab0ff54f8aadaa6375df140cc9d685f78d95 /drivers/usb/gadget/s3c-hsudc.c
parent8062d94a545457a83d5291bd62c3bfd14200bba0 (diff)
parent6440093f5eae9842feb06e40d41c3bd569b6b461 (diff)
Merge tag 'gadget-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
USB: Gadget: changes for 3.4 This merge is rather big. Here's what it contains: For am5536udc we have just simple coding style fixes. Nothing that has any potential to cause any issues going forward. With mv_udc, there's only one single change removing an unneeded NULL check. at91_udc also only saw a single change this merge window, and that's only removing a duplicated header. The Renesas controller has a few more involved changes. Support for SUDMAC was added, there's now a special handling of IRQ resources for when the IRQ line is shared between Renesas controller and SUDMAC, we also had a bug fix where Renesas controller would sleep in atomic context while doing DMA transfers from a tasklet. There were also a set of minor cleanups. The FSL UDC also had a scheduling in atomic context bug fix, but that's all. Thanks to Sebastian, the dummy_hcd now works better than ever with support for scatterlists and streams. Sebastian also added SuperSpeed descriptors to the serial gadgets. The highlight on this merge is the addition of a generic API for mapping and unmapping usb_requests. This will avoid code duplication on all UDC controllers and also kills all the defines for DMA_ADDR_INVALID which UDC controllers sprinkled around. A few of the UDC controllers were already converted to use this new API. Conflicts: drivers/usb/dwc3/gadget.c
Diffstat (limited to 'drivers/usb/gadget/s3c-hsudc.c')
-rw-r--r--drivers/usb/gadget/s3c-hsudc.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index c2f3aa650584..cef9b82ff911 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -30,6 +30,7 @@
30#include <linux/prefetch.h> 30#include <linux/prefetch.h>
31#include <linux/platform_data/s3c-hsudc.h> 31#include <linux/platform_data/s3c-hsudc.h>
32#include <linux/regulator/consumer.h> 32#include <linux/regulator/consumer.h>
33#include <linux/pm_runtime.h>
33 34
34#include <mach/regs-s3c2443-clock.h> 35#include <mach/regs-s3c2443-clock.h>
35 36
@@ -759,7 +760,7 @@ static int s3c_hsudc_ep_enable(struct usb_ep *_ep,
759 unsigned long flags; 760 unsigned long flags;
760 u32 ecr = 0; 761 u32 ecr = 0;
761 762
762 hsep = container_of(_ep, struct s3c_hsudc_ep, ep); 763 hsep = our_ep(_ep);
763 if (!_ep || !desc || hsep->desc || _ep->name == ep0name 764 if (!_ep || !desc || hsep->desc || _ep->name == ep0name
764 || desc->bDescriptorType != USB_DT_ENDPOINT 765 || desc->bDescriptorType != USB_DT_ENDPOINT
765 || hsep->bEndpointAddress != desc->bEndpointAddress 766 || hsep->bEndpointAddress != desc->bEndpointAddress
@@ -816,6 +817,7 @@ static int s3c_hsudc_ep_disable(struct usb_ep *_ep)
816 s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN); 817 s3c_hsudc_nuke_ep(hsep, -ESHUTDOWN);
817 818
818 hsep->desc = 0; 819 hsep->desc = 0;
820 hsep->ep.desc = NULL;
819 hsep->stopped = 1; 821 hsep->stopped = 1;
820 822
821 spin_unlock_irqrestore(&hsudc->lock, flags); 823 spin_unlock_irqrestore(&hsudc->lock, flags);
@@ -853,7 +855,7 @@ static void s3c_hsudc_free_request(struct usb_ep *ep, struct usb_request *_req)
853{ 855{
854 struct s3c_hsudc_req *hsreq; 856 struct s3c_hsudc_req *hsreq;
855 857
856 hsreq = container_of(_req, struct s3c_hsudc_req, req); 858 hsreq = our_req(_req);
857 WARN_ON(!list_empty(&hsreq->queue)); 859 WARN_ON(!list_empty(&hsreq->queue));
858 kfree(hsreq); 860 kfree(hsreq);
859} 861}
@@ -876,12 +878,12 @@ static int s3c_hsudc_queue(struct usb_ep *_ep, struct usb_request *_req,
876 u32 offset; 878 u32 offset;
877 u32 csr; 879 u32 csr;
878 880
879 hsreq = container_of(_req, struct s3c_hsudc_req, req); 881 hsreq = our_req(_req);
880 if ((!_req || !_req->complete || !_req->buf || 882 if ((!_req || !_req->complete || !_req->buf ||
881 !list_empty(&hsreq->queue))) 883 !list_empty(&hsreq->queue)))
882 return -EINVAL; 884 return -EINVAL;
883 885
884 hsep = container_of(_ep, struct s3c_hsudc_ep, ep); 886 hsep = our_ep(_ep);
885 hsudc = hsep->dev; 887 hsudc = hsep->dev;
886 if (!hsudc->driver || hsudc->gadget.speed == USB_SPEED_UNKNOWN) 888 if (!hsudc->driver || hsudc->gadget.speed == USB_SPEED_UNKNOWN)
887 return -ESHUTDOWN; 889 return -ESHUTDOWN;
@@ -935,7 +937,7 @@ static int s3c_hsudc_dequeue(struct usb_ep *_ep, struct usb_request *_req)
935 struct s3c_hsudc_req *hsreq; 937 struct s3c_hsudc_req *hsreq;
936 unsigned long flags; 938 unsigned long flags;
937 939
938 hsep = container_of(_ep, struct s3c_hsudc_ep, ep); 940 hsep = our_ep(_ep);
939 if (!_ep || hsep->ep.name == ep0name) 941 if (!_ep || hsep->ep.name == ep0name)
940 return -EINVAL; 942 return -EINVAL;
941 943
@@ -1005,6 +1007,7 @@ static void s3c_hsudc_initep(struct s3c_hsudc *hsudc,
1005 hsep->ep.ops = &s3c_hsudc_ep_ops; 1007 hsep->ep.ops = &s3c_hsudc_ep_ops;
1006 hsep->fifo = hsudc->regs + S3C_BR(epnum); 1008 hsep->fifo = hsudc->regs + S3C_BR(epnum);
1007 hsep->desc = 0; 1009 hsep->desc = 0;
1010 hsep->ep.desc = NULL;
1008 hsep->stopped = 0; 1011 hsep->stopped = 0;
1009 hsep->wedge = 0; 1012 hsep->wedge = 0;
1010 1013
@@ -1179,6 +1182,9 @@ static int s3c_hsudc_start(struct usb_gadget *gadget,
1179 dev_info(hsudc->dev, "bound driver %s\n", driver->driver.name); 1182 dev_info(hsudc->dev, "bound driver %s\n", driver->driver.name);
1180 1183
1181 s3c_hsudc_reconfig(hsudc); 1184 s3c_hsudc_reconfig(hsudc);
1185
1186 pm_runtime_get_sync(hsudc->dev);
1187
1182 s3c_hsudc_init_phy(); 1188 s3c_hsudc_init_phy();
1183 if (hsudc->pd->gpio_init) 1189 if (hsudc->pd->gpio_init)
1184 hsudc->pd->gpio_init(); 1190 hsudc->pd->gpio_init();
@@ -1209,6 +1215,9 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget,
1209 hsudc->gadget.dev.driver = NULL; 1215 hsudc->gadget.dev.driver = NULL;
1210 hsudc->gadget.speed = USB_SPEED_UNKNOWN; 1216 hsudc->gadget.speed = USB_SPEED_UNKNOWN;
1211 s3c_hsudc_uninit_phy(); 1217 s3c_hsudc_uninit_phy();
1218
1219 pm_runtime_put(hsudc->dev);
1220
1212 if (hsudc->pd->gpio_uninit) 1221 if (hsudc->pd->gpio_uninit)
1213 hsudc->pd->gpio_uninit(); 1222 hsudc->pd->gpio_uninit();
1214 s3c_hsudc_stop_activity(hsudc); 1223 s3c_hsudc_stop_activity(hsudc);
@@ -1363,6 +1372,8 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev)
1363 if (ret) 1372 if (ret)
1364 goto err_add_udc; 1373 goto err_add_udc;
1365 1374
1375 pm_runtime_enable(dev);
1376
1366 return 0; 1377 return 0;
1367err_add_udc: 1378err_add_udc:
1368 device_unregister(&hsudc->gadget.dev); 1379 device_unregister(&hsudc->gadget.dev);