Commit ab5e59db authored by Ido Shayevitz's avatar Ido Shayevitz Committed by Felipe Balbi

usb: dwc3: omap: add dwc3_omap_readl/writel functions

We separate between dwc3-omap helper functions to dwc3-core helper
functions. This will allow us to change the helper functions
implementation according to each module need.
Signed-off-by: default avatarIdo Shayevitz <idos@codeaurora.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 07e7f47b
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <linux/of.h> #include <linux/of.h>
#include "core.h" #include "core.h"
#include "io.h"
/* /*
* All these registers belong to OMAP's Wrapper around the * All these registers belong to OMAP's Wrapper around the
...@@ -143,6 +142,17 @@ struct dwc3_omap { ...@@ -143,6 +142,17 @@ struct dwc3_omap {
u32 dma_status:1; u32 dma_status:1;
}; };
static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
{
return readl(base + offset);
}
static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
{
writel(value, base + offset);
}
static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
{ {
struct dwc3_omap *omap = _omap; struct dwc3_omap *omap = _omap;
...@@ -150,7 +160,7 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) ...@@ -150,7 +160,7 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
spin_lock(&omap->lock); spin_lock(&omap->lock);
reg = dwc3_readl(omap->base, USBOTGSS_IRQSTATUS_1); reg = dwc3_omap_readl(omap->base, USBOTGSS_IRQSTATUS_1);
if (reg & USBOTGSS_IRQ1_DMADISABLECLR) { if (reg & USBOTGSS_IRQ1_DMADISABLECLR) {
dev_dbg(omap->dev, "DMA Disable was Cleared\n"); dev_dbg(omap->dev, "DMA Disable was Cleared\n");
...@@ -184,10 +194,10 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap) ...@@ -184,10 +194,10 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
if (reg & USBOTGSS_IRQ1_IDPULLUP_FALL) if (reg & USBOTGSS_IRQ1_IDPULLUP_FALL)
dev_dbg(omap->dev, "IDPULLUP Fall\n"); dev_dbg(omap->dev, "IDPULLUP Fall\n");
dwc3_writel(omap->base, USBOTGSS_IRQSTATUS_1, reg); dwc3_omap_writel(omap->base, USBOTGSS_IRQSTATUS_1, reg);
reg = dwc3_readl(omap->base, USBOTGSS_IRQSTATUS_0); reg = dwc3_omap_readl(omap->base, USBOTGSS_IRQSTATUS_0);
dwc3_writel(omap->base, USBOTGSS_IRQSTATUS_0, reg); dwc3_omap_writel(omap->base, USBOTGSS_IRQSTATUS_0, reg);
spin_unlock(&omap->lock); spin_unlock(&omap->lock);
...@@ -270,7 +280,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) ...@@ -270,7 +280,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
omap->base = base; omap->base = base;
omap->dwc3 = dwc3; omap->dwc3 = dwc3;
reg = dwc3_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS);
utmi_mode = of_get_property(node, "utmi-mode", &size); utmi_mode = of_get_property(node, "utmi-mode", &size);
if (utmi_mode && size == sizeof(*utmi_mode)) { if (utmi_mode && size == sizeof(*utmi_mode)) {
...@@ -293,10 +303,10 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) ...@@ -293,10 +303,10 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
} }
} }
dwc3_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg); dwc3_omap_writel(omap->base, USBOTGSS_UTMI_OTG_STATUS, reg);
/* check the DMA Status */ /* check the DMA Status */
reg = dwc3_readl(omap->base, USBOTGSS_SYSCONFIG); reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE); omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE);
/* Set No-Idle and No-Standby */ /* Set No-Idle and No-Standby */
...@@ -306,7 +316,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) ...@@ -306,7 +316,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
reg |= (USBOTGSS_SYSCONFIG_STANDBYMODE(USBOTGSS_STANDBYMODE_NO_STANDBY) reg |= (USBOTGSS_SYSCONFIG_STANDBYMODE(USBOTGSS_STANDBYMODE_NO_STANDBY)
| USBOTGSS_SYSCONFIG_IDLEMODE(USBOTGSS_IDLEMODE_NO_IDLE)); | USBOTGSS_SYSCONFIG_IDLEMODE(USBOTGSS_IDLEMODE_NO_IDLE));
dwc3_writel(omap->base, USBOTGSS_SYSCONFIG, reg); dwc3_omap_writel(omap->base, USBOTGSS_SYSCONFIG, reg);
ret = devm_request_irq(dev, omap->irq, dwc3_omap_interrupt, 0, ret = devm_request_irq(dev, omap->irq, dwc3_omap_interrupt, 0,
"dwc3-omap", omap); "dwc3-omap", omap);
...@@ -318,7 +328,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) ...@@ -318,7 +328,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
/* enable all IRQs */ /* enable all IRQs */
reg = USBOTGSS_IRQO_COREIRQ_ST; reg = USBOTGSS_IRQO_COREIRQ_ST;
dwc3_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, reg); dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, reg);
reg = (USBOTGSS_IRQ1_OEVT | reg = (USBOTGSS_IRQ1_OEVT |
USBOTGSS_IRQ1_DRVVBUS_RISE | USBOTGSS_IRQ1_DRVVBUS_RISE |
...@@ -330,7 +340,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev) ...@@ -330,7 +340,7 @@ static int __devinit dwc3_omap_probe(struct platform_device *pdev)
USBOTGSS_IRQ1_DISCHRGVBUS_FALL | USBOTGSS_IRQ1_DISCHRGVBUS_FALL |
USBOTGSS_IRQ1_IDPULLUP_FALL); USBOTGSS_IRQ1_IDPULLUP_FALL);
dwc3_writel(omap->base, USBOTGSS_IRQENABLE_SET_1, reg); dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_1, reg);
ret = platform_device_add_resources(dwc3, pdev->resource, ret = platform_device_add_resources(dwc3, pdev->resource,
pdev->num_resources); pdev->num_resources);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment