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>
This commit is contained in:
parent
8db7ed15f2
commit
45b3cd4ad7
1 changed files with 22 additions and 12 deletions
|
@ -46,6 +46,7 @@
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <linux/ioport.h>
|
#include <linux/ioport.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/of.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
|
||||||
#include "core.h"
|
#include "core.h"
|
||||||
|
@ -197,14 +198,18 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
|
||||||
static int __devinit dwc3_omap_probe(struct platform_device *pdev)
|
static int __devinit dwc3_omap_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct dwc3_omap_data *pdata = pdev->dev.platform_data;
|
struct dwc3_omap_data *pdata = pdev->dev.platform_data;
|
||||||
|
struct device_node *node = pdev->dev.of_node;
|
||||||
|
|
||||||
struct platform_device *dwc3;
|
struct platform_device *dwc3;
|
||||||
struct dwc3_omap *omap;
|
struct dwc3_omap *omap;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
||||||
int devid;
|
int devid;
|
||||||
|
int size;
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
int irq;
|
int irq;
|
||||||
|
|
||||||
|
const u32 *utmi_mode;
|
||||||
u32 reg;
|
u32 reg;
|
||||||
|
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
@ -269,6 +274,10 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
|
reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
|
||||||
|
|
||||||
|
utmi_mode = of_get_property(node, "utmi-mode", &size);
|
||||||
|
if (utmi_mode && size == sizeof(*utmi_mode)) {
|
||||||
|
reg |= *utmi_mode;
|
||||||
|
} else {
|
||||||
if (!pdata) {
|
if (!pdata) {
|
||||||
dev_dbg(&pdev->dev, "missing platform data\n");
|
dev_dbg(&pdev->dev, "missing platform data\n");
|
||||||
} else {
|
} else {
|
||||||
|
@ -284,6 +293,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
|
||||||
pdata->utmi_mode);
|
pdata->utmi_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dwc3_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg);
|
dwc3_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue