diff options
author | Felipe Balbi <balbi@ti.com> | 2012-01-25 04:07:03 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-02-06 04:48:39 -0500 |
commit | 45b3cd4ad79b31289aa7da7a6448ec5afb7780a4 (patch) | |
tree | f4659ce5c2c014be945aada0e734545db6d011cd /drivers/usb/dwc3/dwc3-omap.c | |
parent | 8db7ed15f2557e26371e4b2d98fee290d992b715 (diff) |
usb: dwc3: omap: convert pdata to of property
Convert our platform_data usage to OF property,
keep the legacy pdata for a while until the complete
conversion is done.
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.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 3274ac8f1200..64e29c31df22 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/dma-mapping.h> | 46 | #include <linux/dma-mapping.h> |
47 | #include <linux/ioport.h> | 47 | #include <linux/ioport.h> |
48 | #include <linux/io.h> | 48 | #include <linux/io.h> |
49 | #include <linux/of.h> | ||
49 | #include <linux/module.h> | 50 | #include <linux/module.h> |
50 | 51 | ||
51 | #include "core.h" | 52 | #include "core.h" |
@@ -197,14 +198,18 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) | |||
197 | static int __devinit dwc3_omap_probe(struct platform_device *pdev) | 198 | static int __devinit dwc3_omap_probe(struct platform_device *pdev) |
198 | { | 199 | { |
199 | struct dwc3_omap_data *pdata = pdev->dev.platform_data; | 200 | struct dwc3_omap_data *pdata = pdev->dev.platform_data; |
201 | struct device_node *node = pdev->dev.of_node; | ||
202 | |||
200 | struct platform_device *dwc3; | 203 | struct platform_device *dwc3; |
201 | struct dwc3_omap *omap; | 204 | struct dwc3_omap *omap; |
202 | struct resource *res; | 205 | struct resource *res; |
203 | 206 | ||
204 | int devid; | 207 | int devid; |
208 | int size; | ||
205 | int ret = -ENOMEM; | 209 | int ret = -ENOMEM; |
206 | int irq; | 210 | int irq; |
207 | 211 | ||
212 | const u32 *utmi_mode; | ||
208 | u32 reg; | 213 | u32 reg; |
209 | 214 | ||
210 | void __iomem *base; | 215 | void __iomem *base; |
@@ -269,19 +274,24 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) | |||
269 | 274 | ||
270 | reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); | 275 | reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); |
271 | 276 | ||
272 | if (!pdata) { | 277 | utmi_mode = of_get_property(node, "utmi-mode", &size); |
273 | dev_dbg(&pdev->dev, "missing platform data\n"); | 278 | if (utmi_mode && size == sizeof(*utmi_mode)) { |
279 | reg |= *utmi_mode; | ||
274 | } else { | 280 | } else { |
275 | switch (pdata->utmi_mode) { | 281 | if (!pdata) { |
276 | case DWC3_OMAP_UTMI_MODE_SW: | 282 | dev_dbg(&pdev->dev, "missing platform data\n"); |
277 | reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; | 283 | } else { |
278 | break; | 284 | switch (pdata->utmi_mode) { |
279 | case DWC3_OMAP_UTMI_MODE_HW: | 285 | case DWC3_OMAP_UTMI_MODE_SW: |
280 | reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; | 286 | reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE; |
281 | break; | 287 | break; |
282 | default: | 288 | case DWC3_OMAP_UTMI_MODE_HW: |
283 | dev_dbg(&pdev->dev, "UNKNOWN utmi mode %d\n", | 289 | reg &= ~USBOTGSS_UTMI_OTG_STATUS_SW_MODE; |
284 | pdata->utmi_mode); | 290 | break; |
291 | default: | ||
292 | dev_dbg(&pdev->dev, "UNKNOWN utmi mode %d\n", | ||
293 | pdata->utmi_mode); | ||
294 | } | ||
285 | } | 295 | } |
286 | } | 296 | } |
287 | 297 | ||