aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/dwc3-omap.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-09-01 15:26:25 -0400
committerFelipe Balbi <balbi@ti.com>2011-09-09 06:02:45 -0400
commit9962444f592a53c08ce439b6dc362bba7ce5fd7e (patch)
treeaf6c9bc3d6ee2d829f3fb9959e9a5d87d7cd0f10 /drivers/usb/dwc3/dwc3-omap.c
parent29d8bc133f7bb3172201dc3f6540562cec195d13 (diff)
usb: dwc3: omap: distinguish between SW and HW modes
The OMAP wrapper allows us to either control internal OTG signals via SW or HW. Different boards might wish to use one or the other mode of operation. Let's have have that information passed via platform_data for now. After DT conversion is finished for OMAP, we can easily convert this to a DT attribute. 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.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 17d1822f7687..ddbf38a94017 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -42,6 +42,7 @@
42#include <linux/interrupt.h> 42#include <linux/interrupt.h>
43#include <linux/spinlock.h> 43#include <linux/spinlock.h>
44#include <linux/platform_device.h> 44#include <linux/platform_device.h>
45#include <linux/platform_data/dwc3-omap.h>
45#include <linux/dma-mapping.h> 46#include <linux/dma-mapping.h>
46#include <linux/ioport.h> 47#include <linux/ioport.h>
47#include <linux/io.h> 48#include <linux/io.h>
@@ -193,6 +194,7 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
193 194
194static int __devinit dwc3_omap_probe(struct platform_device *pdev) 195static int __devinit dwc3_omap_probe(struct platform_device *pdev)
195{ 196{
197 struct dwc3_omap_data *pdata = pdev->dev.platform_data;
196 struct platform_device *dwc3; 198 struct platform_device *dwc3;
197 struct dwc3_omap *omap; 199 struct dwc3_omap *omap;
198 struct resource *res; 200 struct resource *res;
@@ -258,6 +260,26 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
258 omap->base = base; 260 omap->base = base;
259 omap->dwc3 = dwc3; 261 omap->dwc3 = dwc3;
260 262
263 reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
264
265 if (!pdata) {
266 dev_dbg(&pdev->dev, "missing platform data\n");
267 } else {
268 switch (pdata->utmi_mode) {
269 case DWC3_OMAP_UTMI_MODE_SW:
270 reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
271 break;
272 case DWC3_OMAP_UTMI_MODE_HW:
273 reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
274 break;
275 default:
276 dev_dbg(&pdev->dev, "UNKNOWN utmi mode %d\n",
277 pdata->utmi_mode);
278 }
279 }
280
281 dwc3_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg);
282
261 /* check the DMA Status */ 283 /* check the DMA Status */
262 reg = dwc3_readl(omap->base, USBOTGSS_SYSCONFIG); 284 reg = dwc3_readl(omap->base, USBOTGSS_SYSCONFIG);
263 omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE); 285 omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE);