aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc2/platform.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 17:57:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-14 17:57:16 -0500
commite7cf773d431a63a2417902696fcc9e0ebdc83bbe (patch)
tree86dbdceb7d91226507a3af0d57e03b0ca664b22e /drivers/usb/dwc2/platform.c
parent7a02d089695a1217992434f03a78aa32bad85b5c (diff)
parent81e1dadfb5b2d47aa513ad60b1c9cf0ea17b6514 (diff)
Merge tag 'usb-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB updates from Greg KH: "Here's the big set of USB and PHY patches for 3.19-rc1. The normal churn in the USB gadget area is in here, as well as xhci and other individual USB driver updates. The PHY tree is also in here, as there were dependancies on the USB tree. All of these have been in linux-next" * tag 'usb-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (351 commits) arm: omap3: twl: remove usb phy init data usbip: fix error handling in stub_probe() usb: gadget: udc: missing curly braces USB: mos7720: delete some unneeded code wusb: replace memset by memzero_explicit usbip: remove unneeded structure usb: xhci: fix comment for PORT_DEV_REMOVE xhci: don't use the same variable for stopped and halted rings current TD xhci: clear extra bits from slot context when setting max exit latency xhci: cleanup finish_td function USB: adutux: NULL dereferences on disconnect usb: chipidea: fix platform_no_drv_owner.cocci warnings usb: chipidea: Fixed a few typos in comments Documentation: bindings: add doc for the USB2 ChipIdea USB driver usb: chipidea: add a usb2 driver for ci13xxx usb: chipidea: fix phy handling usb: chipidea: remove duplicate dev_set_drvdata for host_start usb: chipidea: parameter 'mode' isn't needed for hw_device_reset usb: chipidea: add controller reset API usb: chipidea: remove flag CI_HDRC_REQUIRE_TRANSCEIVER ...
Diffstat (limited to 'drivers/usb/dwc2/platform.c')
-rw-r--r--drivers/usb/dwc2/platform.c44
1 files changed, 41 insertions, 3 deletions
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 121dbdafc06b..6a795aa2ff05 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -40,6 +40,7 @@
40#include <linux/device.h> 40#include <linux/device.h>
41#include <linux/dma-mapping.h> 41#include <linux/dma-mapping.h>
42#include <linux/of_device.h> 42#include <linux/of_device.h>
43#include <linux/mutex.h>
43#include <linux/platform_device.h> 44#include <linux/platform_device.h>
44 45
45#include <linux/usb/of.h> 46#include <linux/usb/of.h>
@@ -121,6 +122,7 @@ static int dwc2_driver_remove(struct platform_device *dev)
121 struct dwc2_hsotg *hsotg = platform_get_drvdata(dev); 122 struct dwc2_hsotg *hsotg = platform_get_drvdata(dev);
122 123
123 dwc2_hcd_remove(hsotg); 124 dwc2_hcd_remove(hsotg);
125 s3c_hsotg_remove(hsotg);
124 126
125 return 0; 127 return 0;
126} 128}
@@ -129,6 +131,7 @@ static const struct of_device_id dwc2_of_match_table[] = {
129 { .compatible = "brcm,bcm2835-usb", .data = &params_bcm2835 }, 131 { .compatible = "brcm,bcm2835-usb", .data = &params_bcm2835 },
130 { .compatible = "rockchip,rk3066-usb", .data = &params_rk3066 }, 132 { .compatible = "rockchip,rk3066-usb", .data = &params_rk3066 },
131 { .compatible = "snps,dwc2", .data = NULL }, 133 { .compatible = "snps,dwc2", .data = NULL },
134 { .compatible = "samsung,s3c6400-hsotg", .data = NULL},
132 {}, 135 {},
133}; 136};
134MODULE_DEVICE_TABLE(of, dwc2_of_match_table); 137MODULE_DEVICE_TABLE(of, dwc2_of_match_table);
@@ -155,9 +158,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
155 int retval; 158 int retval;
156 int irq; 159 int irq;
157 160
158 if (usb_disabled())
159 return -ENODEV;
160
161 match = of_match_device(dwc2_of_match_table, &dev->dev); 161 match = of_match_device(dwc2_of_match_table, &dev->dev);
162 if (match && match->data) { 162 if (match && match->data) {
163 params = match->data; 163 params = match->data;
@@ -194,6 +194,14 @@ static int dwc2_driver_probe(struct platform_device *dev)
194 return irq; 194 return irq;
195 } 195 }
196 196
197 dev_dbg(hsotg->dev, "registering common handler for irq%d\n",
198 irq);
199 retval = devm_request_irq(hsotg->dev, irq,
200 dwc2_handle_common_intr, IRQF_SHARED,
201 dev_name(hsotg->dev), hsotg);
202 if (retval)
203 return retval;
204
197 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 205 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
198 hsotg->regs = devm_ioremap_resource(&dev->dev, res); 206 hsotg->regs = devm_ioremap_resource(&dev->dev, res);
199 if (IS_ERR(hsotg->regs)) 207 if (IS_ERR(hsotg->regs))
@@ -204,6 +212,11 @@ static int dwc2_driver_probe(struct platform_device *dev)
204 212
205 hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node); 213 hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
206 214
215 spin_lock_init(&hsotg->lock);
216 mutex_init(&hsotg->init_mutex);
217 retval = dwc2_gadget_init(hsotg, irq);
218 if (retval)
219 return retval;
207 retval = dwc2_hcd_init(hsotg, irq, params); 220 retval = dwc2_hcd_init(hsotg, irq, params);
208 if (retval) 221 if (retval)
209 return retval; 222 return retval;
@@ -213,10 +226,35 @@ static int dwc2_driver_probe(struct platform_device *dev)
213 return retval; 226 return retval;
214} 227}
215 228
229static int __maybe_unused dwc2_suspend(struct device *dev)
230{
231 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
232 int ret = 0;
233
234 if (dwc2_is_device_mode(dwc2))
235 ret = s3c_hsotg_suspend(dwc2);
236 return ret;
237}
238
239static int __maybe_unused dwc2_resume(struct device *dev)
240{
241 struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
242 int ret = 0;
243
244 if (dwc2_is_device_mode(dwc2))
245 ret = s3c_hsotg_resume(dwc2);
246 return ret;
247}
248
249static const struct dev_pm_ops dwc2_dev_pm_ops = {
250 SET_SYSTEM_SLEEP_PM_OPS(dwc2_suspend, dwc2_resume)
251};
252
216static struct platform_driver dwc2_platform_driver = { 253static struct platform_driver dwc2_platform_driver = {
217 .driver = { 254 .driver = {
218 .name = dwc2_driver_name, 255 .name = dwc2_driver_name,
219 .of_match_table = dwc2_of_match_table, 256 .of_match_table = dwc2_of_match_table,
257 .pm = &dwc2_dev_pm_ops,
220 }, 258 },
221 .probe = dwc2_driver_probe, 259 .probe = dwc2_driver_probe,
222 .remove = dwc2_driver_remove, 260 .remove = dwc2_driver_remove,