aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/dwc3-omap.c
diff options
context:
space:
mode:
authorKishon Vijay Abraham I <kishon@ti.com>2013-02-26 09:33:27 -0500
committerFelipe Balbi <balbi@ti.com>2013-03-18 05:16:33 -0400
commite36a0c870f7dbbfa7ed13cd83b79be00bcd00380 (patch)
tree229420075c7d5d800081932143ec297bc2b8cc65 /drivers/usb/dwc3/dwc3-omap.c
parentb54b5f56531d9fcbb30908373ba842af4de6a26b (diff)
usb: dwc3: omap: minor fixes to get dt working
Includes few minor fixes in dwc3-omap like populating the compatible string in a correct way, extracting the utmi-mode property properly and changing the index of get_irq since irq of core is removed from hwmod entry. Also updated the documentation with dwc3-omap device tree binding information. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> [ balbi@ti.com : fix a compile warning introduced by this commit ] Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-omap.c')
-rw-r--r--drivers/usb/dwc3/dwc3-omap.c45
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index afa05e3c9cf4..e1206b419932 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -316,11 +316,11 @@ static int dwc3_omap_probe(struct platform_device *pdev)
316 struct resource *res; 316 struct resource *res;
317 struct device *dev = &pdev->dev; 317 struct device *dev = &pdev->dev;
318 318
319 int size;
320 int ret = -ENOMEM; 319 int ret = -ENOMEM;
321 int irq; 320 int irq;
322 321
323 const u32 *utmi_mode; 322 int utmi_mode = 0;
323
324 u32 reg; 324 u32 reg;
325 325
326 void __iomem *base; 326 void __iomem *base;
@@ -334,13 +334,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)
334 334
335 platform_set_drvdata(pdev, omap); 335 platform_set_drvdata(pdev, omap);
336 336
337 irq = platform_get_irq(pdev, 1); 337 irq = platform_get_irq(pdev, 0);
338 if (irq < 0) { 338 if (irq < 0) {
339 dev_err(dev, "missing IRQ resource\n"); 339 dev_err(dev, "missing IRQ resource\n");
340 return -EINVAL; 340 return -EINVAL;
341 } 341 }
342 342
343 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 343 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
344 if (!res) { 344 if (!res) {
345 dev_err(dev, "missing memory base resource\n"); 345 dev_err(dev, "missing memory base resource\n");
346 return -EINVAL; 346 return -EINVAL;
@@ -387,25 +387,22 @@ static int dwc3_omap_probe(struct platform_device *pdev)
387 387
388 reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); 388 reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
389 389
390 utmi_mode = of_get_property(node, "utmi-mode", &size); 390 if (node)
391 if (utmi_mode && size == sizeof(*utmi_mode)) { 391 of_property_read_u32(node, "utmi-mode", &utmi_mode);
392 reg |= *utmi_mode; 392 else if (pdata)
393 } else { 393 utmi_mode = pdata->utmi_mode;
394 if (!pdata) { 394 else
395 dev_dbg(dev, "missing platform data\n"); 395 dev_dbg(dev, "missing platform data\n");
396 } else { 396
397 switch (pdata->utmi_mode) { 397 switch (utmi_mode) {
398 case DWC3_OMAP_UTMI_MODE_SW: 398 case DWC3_OMAP_UTMI_MODE_SW:
399 reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; 399 reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
400 break; 400 break;
401 case DWC3_OMAP_UTMI_MODE_HW: 401 case DWC3_OMAP_UTMI_MODE_HW:
402 reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; 402 reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
403 break; 403 break;
404 default: 404 default:
405 dev_dbg(dev, "UNKNOWN utmi mode %d\n", 405 dev_dbg(dev, "UNKNOWN utmi mode %d\n", utmi_mode);
406 pdata->utmi_mode);
407 }
408 }
409 } 406 }
410 407
411 dwc3_omap_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg); 408 dwc3_omap_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg);
@@ -465,7 +462,7 @@ static int dwc3_omap_remove(struct platform_device *pdev)
465 462
466static const struct of_device_id of_dwc3_match[] = { 463static const struct of_device_id of_dwc3_match[] = {
467 { 464 {
468 "ti,dwc3", 465 .compatible = "ti,dwc3"
469 }, 466 },
470 { }, 467 { },
471}; 468};