diff options
Diffstat (limited to 'drivers/mfd/omap-usb-tll.c')
-rw-r--r-- | drivers/mfd/omap-usb-tll.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index 0d946ae1..5ee50f7 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c @@ -121,22 +121,22 @@ static DEFINE_SPINLOCK(tll_lock); /* serialize access to tll_dev */ static inline void usbtll_write(void __iomem *base, u32 reg, u32 val) { - __raw_writel(val, base + reg); + writel_relaxed(val, base + reg); } static inline u32 usbtll_read(void __iomem *base, u32 reg) { - return __raw_readl(base + reg); + return readl_relaxed(base + reg); } static inline void usbtll_writeb(void __iomem *base, u8 reg, u8 val) { - __raw_writeb(val, base + reg); + writeb_relaxed(val, base + reg); } static inline u8 usbtll_readb(void __iomem *base, u8 reg) { - return __raw_readb(base + reg); + return readb_relaxed(base + reg); } /*-------------------------------------------------------------------------*/ @@ -333,21 +333,17 @@ int omap_tll_init(struct usbhs_omap_platform_data *pdata) unsigned reg; struct usbtll_omap *tll; - spin_lock(&tll_lock); - - if (!tll_dev) { - spin_unlock(&tll_lock); + if (!tll_dev) return -ENODEV; - } - tll = dev_get_drvdata(tll_dev); + pm_runtime_get_sync(tll_dev); + spin_lock(&tll_lock); + tll = dev_get_drvdata(tll_dev); needs_tll = false; for (i = 0; i < tll->nch; i++) needs_tll |= omap_usb_mode_needs_tll(pdata->port_mode[i]); - pm_runtime_get_sync(tll_dev); - if (needs_tll) { void __iomem *base = tll->base; @@ -398,9 +394,8 @@ int omap_tll_init(struct usbhs_omap_platform_data *pdata) } } - pm_runtime_put_sync(tll_dev); - spin_unlock(&tll_lock); + pm_runtime_put_sync(tll_dev); return 0; } @@ -411,17 +406,14 @@ int omap_tll_enable(struct usbhs_omap_platform_data *pdata) int i; struct usbtll_omap *tll; - spin_lock(&tll_lock); - - if (!tll_dev) { - spin_unlock(&tll_lock); + if (!tll_dev) return -ENODEV; - } - - tll = dev_get_drvdata(tll_dev); pm_runtime_get_sync(tll_dev); + spin_lock(&tll_lock); + tll = dev_get_drvdata(tll_dev); + for (i = 0; i < tll->nch; i++) { if (omap_usb_mode_needs_tll(pdata->port_mode[i])) { int r; @@ -448,13 +440,10 @@ int omap_tll_disable(struct usbhs_omap_platform_data *pdata) int i; struct usbtll_omap *tll; - spin_lock(&tll_lock); - - if (!tll_dev) { - spin_unlock(&tll_lock); + if (!tll_dev) return -ENODEV; - } + spin_lock(&tll_lock); tll = dev_get_drvdata(tll_dev); for (i = 0; i < tll->nch; i++) { @@ -464,9 +453,8 @@ int omap_tll_disable(struct usbhs_omap_platform_data *pdata) } } - pm_runtime_put_sync(tll_dev); - spin_unlock(&tll_lock); + pm_runtime_put_sync(tll_dev); return 0; } |