Commit 52ef8efc authored by Arnd Bergmann's avatar Arnd Bergmann

dma: omap: hide legacy interface

The legacy interface for omap-dma is only used on OMAP1, and the
same is true for the non-DT case. Make both of these conditional on
CONFIG_ARCH_OMAP1 being set to simplify the dependency.

The non-OMAP stub functions in include/linux/omap-dma.h are note needed
any more either now, because they are only called on OMAP1.
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Acked-By: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 17ea03b7
...@@ -699,6 +699,11 @@ static void omap_dma_put_lch(struct omap_dmadev *od, int lch) ...@@ -699,6 +699,11 @@ static void omap_dma_put_lch(struct omap_dmadev *od, int lch)
mutex_unlock(&od->lch_lock); mutex_unlock(&od->lch_lock);
} }
static inline bool omap_dma_legacy(struct omap_dmadev *od)
{
return IS_ENABLED(CONFIG_ARCH_OMAP1) && od->legacy;
}
static int omap_dma_alloc_chan_resources(struct dma_chan *chan) static int omap_dma_alloc_chan_resources(struct dma_chan *chan)
{ {
struct omap_dmadev *od = to_omap_dma_dev(chan->device); struct omap_dmadev *od = to_omap_dma_dev(chan->device);
...@@ -706,7 +711,7 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan) ...@@ -706,7 +711,7 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan)
struct device *dev = od->ddev.dev; struct device *dev = od->ddev.dev;
int ret; int ret;
if (od->legacy) { if (omap_dma_legacy(od)) {
ret = omap_request_dma(c->dma_sig, "DMA engine", ret = omap_request_dma(c->dma_sig, "DMA engine",
omap_dma_callback, c, &c->dma_ch); omap_dma_callback, c, &c->dma_ch);
} else { } else {
...@@ -718,7 +723,7 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan) ...@@ -718,7 +723,7 @@ static int omap_dma_alloc_chan_resources(struct dma_chan *chan)
if (ret >= 0) { if (ret >= 0) {
omap_dma_assign(od, c, c->dma_ch); omap_dma_assign(od, c, c->dma_ch);
if (!od->legacy) { if (!omap_dma_legacy(od)) {
unsigned val; unsigned val;
spin_lock_irq(&od->irq_lock); spin_lock_irq(&od->irq_lock);
...@@ -757,7 +762,7 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan) ...@@ -757,7 +762,7 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan)
struct omap_dmadev *od = to_omap_dma_dev(chan->device); struct omap_dmadev *od = to_omap_dma_dev(chan->device);
struct omap_chan *c = to_omap_dma_chan(chan); struct omap_chan *c = to_omap_dma_chan(chan);
if (!od->legacy) { if (!omap_dma_legacy(od)) {
spin_lock_irq(&od->irq_lock); spin_lock_irq(&od->irq_lock);
od->irq_enable_mask &= ~BIT(c->dma_ch); od->irq_enable_mask &= ~BIT(c->dma_ch);
omap_dma_glbl_write(od, IRQENABLE_L1, od->irq_enable_mask); omap_dma_glbl_write(od, IRQENABLE_L1, od->irq_enable_mask);
...@@ -768,7 +773,7 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan) ...@@ -768,7 +773,7 @@ static void omap_dma_free_chan_resources(struct dma_chan *chan)
od->lch_map[c->dma_ch] = NULL; od->lch_map[c->dma_ch] = NULL;
vchan_free_chan_resources(&c->vc); vchan_free_chan_resources(&c->vc);
if (od->legacy) if (omap_dma_legacy(od))
omap_free_dma(c->dma_ch); omap_free_dma(c->dma_ch);
else else
omap_dma_put_lch(od, c->dma_ch); omap_dma_put_lch(od, c->dma_ch);
...@@ -1674,12 +1679,14 @@ static int omap_dma_probe(struct platform_device *pdev) ...@@ -1674,12 +1679,14 @@ static int omap_dma_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "omap_system_dma_plat_info is missing"); dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
return -ENODEV; return -ENODEV;
} }
} else { } else if (IS_ENABLED(CONFIG_ARCH_OMAP1)) {
od->cfg = &default_cfg; od->cfg = &default_cfg;
od->plat = omap_get_plat_info(); od->plat = omap_get_plat_info();
if (!od->plat) if (!od->plat)
return -EPROBE_DEFER; return -EPROBE_DEFER;
} else {
return -ENODEV;
} }
od->reg_map = od->plat->reg_map; od->reg_map = od->plat->reg_map;
...@@ -1855,7 +1862,7 @@ static int omap_dma_remove(struct platform_device *pdev) ...@@ -1855,7 +1862,7 @@ static int omap_dma_remove(struct platform_device *pdev)
dma_async_device_unregister(&od->ddev); dma_async_device_unregister(&od->ddev);
if (!od->legacy) { if (!omap_dma_legacy(od)) {
/* Disable all interrupts */ /* Disable all interrupts */
omap_dma_glbl_write(od, IRQENABLE_L0, 0); omap_dma_glbl_write(od, IRQENABLE_L0, 0);
} }
......
...@@ -292,7 +292,6 @@ struct omap_system_dma_plat_info { ...@@ -292,7 +292,6 @@ struct omap_system_dma_plat_info {
#define dma_omap15xx() __dma_omap15xx(d) #define dma_omap15xx() __dma_omap15xx(d)
#define dma_omap16xx() __dma_omap16xx(d) #define dma_omap16xx() __dma_omap16xx(d)
#if defined(CONFIG_ARCH_OMAP)
extern struct omap_system_dma_plat_info *omap_get_plat_info(void); extern struct omap_system_dma_plat_info *omap_get_plat_info(void);
extern void omap_set_dma_priority(int lch, int dst_port, int priority); extern void omap_set_dma_priority(int lch, int dst_port, int priority);
...@@ -340,25 +339,4 @@ static inline int omap_lcd_dma_running(void) ...@@ -340,25 +339,4 @@ static inline int omap_lcd_dma_running(void)
} }
#endif #endif
#else /* CONFIG_ARCH_OMAP */
static inline void omap_set_dma_priority(int lch, int dst_port, int priority)
{
}
static inline struct omap_system_dma_plat_info *omap_get_plat_info(void)
{
return NULL;
}
static inline int omap_request_dma(int dev_id, const char *dev_name,
void (*callback)(int lch, u16 ch_status, void *data),
void *data, int *dma_ch)
{
return -ENODEV;
}
static inline void omap_free_dma(int ch) { }
#endif /* CONFIG_ARCH_OMAP */
#endif /* __LINUX_OMAP_DMA_H */ #endif /* __LINUX_OMAP_DMA_H */
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