Commit 52256c0e authored by Eric Miao's avatar Eric Miao Committed by Russell King

[NET] smc91x: prepare SMC_USE_PXA_DMA to be specified in platform data

Now that the original SMC_USE_PXA_DMA specific code will always being
built if CONFIG_ARCH_PXA is defined, so to make this part of the code
to be PXA public, and still prevent it from being built if support of
PXA is not selected.

A SMC91X_USE_DMA flag is added to the platform data to allow platform
to choose its usage of DMA. Note this flag itself is so named to be
generic enough (assuming other platforms can also use DMA).

It keeps backward compatibility to set the SMC91X_USE_DMA flag if
SMC_USE_PXA_DMA is still defined.
Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
Acked-by: default avatarNicolas Pitre <nico@cam.org>
Acked-by: default avatarJeff Garzik <jgarzik@pobox.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 15919886
...@@ -1939,8 +1939,11 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr, ...@@ -1939,8 +1939,11 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
if (retval) if (retval)
goto err_out; goto err_out;
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
{ # ifdef SMC_USE_PXA_DMA
lp->cfg.flags |= SMC91X_USE_DMA;
# endif
if (lp->cfg.flags & SMC91X_USE_DMA) {
int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW,
smc_pxa_dma_irq, NULL); smc_pxa_dma_irq, NULL);
if (dma >= 0) if (dma >= 0)
...@@ -1980,7 +1983,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr, ...@@ -1980,7 +1983,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
} }
err_out: err_out:
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
if (retval && dev->dma != (unsigned char)-1) if (retval && dev->dma != (unsigned char)-1)
pxa_free_dma(dev->dma); pxa_free_dma(dev->dma);
#endif #endif
...@@ -2198,7 +2201,7 @@ static int smc_drv_probe(struct platform_device *pdev) ...@@ -2198,7 +2201,7 @@ static int smc_drv_probe(struct platform_device *pdev)
goto out_release_attrib; goto out_release_attrib;
} }
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
{ {
struct smc_local *lp = netdev_priv(ndev); struct smc_local *lp = netdev_priv(ndev);
lp->device = &pdev->dev; lp->device = &pdev->dev;
...@@ -2241,7 +2244,7 @@ static int smc_drv_remove(struct platform_device *pdev) ...@@ -2241,7 +2244,7 @@ static int smc_drv_remove(struct platform_device *pdev)
free_irq(ndev->irq, ndev); free_irq(ndev->irq, ndev);
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
if (ndev->dma != (unsigned char)-1) if (ndev->dma != (unsigned char)-1)
pxa_free_dma(ndev->dma); pxa_free_dma(ndev->dma);
#endif #endif
......
...@@ -492,7 +492,7 @@ struct smc_local { ...@@ -492,7 +492,7 @@ struct smc_local {
spinlock_t lock; spinlock_t lock;
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
/* DMA needs the physical address of the chip */ /* DMA needs the physical address of the chip */
u_long physaddr; u_long physaddr;
struct device *device; struct device *device;
...@@ -510,7 +510,7 @@ struct smc_local { ...@@ -510,7 +510,7 @@ struct smc_local {
#define SMC_16BIT(p) ((p)->cfg.flags & SMC91X_USE_16BIT) #define SMC_16BIT(p) ((p)->cfg.flags & SMC91X_USE_16BIT)
#define SMC_32BIT(p) ((p)->cfg.flags & SMC91X_USE_32BIT) #define SMC_32BIT(p) ((p)->cfg.flags & SMC91X_USE_32BIT)
#ifdef SMC_USE_PXA_DMA #ifdef CONFIG_ARCH_PXA
/* /*
* Let's use the DMA engine on the XScale PXA2xx for RX packets. This is * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is
* always happening in irq context so no need to worry about races. TX is * always happening in irq context so no need to worry about races. TX is
...@@ -604,7 +604,7 @@ smc_pxa_dma_irq(int dma, void *dummy) ...@@ -604,7 +604,7 @@ smc_pxa_dma_irq(int dma, void *dummy)
{ {
DCSR(dma) = 0; DCSR(dma) = 0;
} }
#endif /* SMC_USE_PXA_DMA */ #endif /* CONFIG_ARCH_PXA */
/* /*
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#define SMC91X_IO_SHIFT_3 (3 << 4) #define SMC91X_IO_SHIFT_3 (3 << 4)
#define SMC91X_IO_SHIFT(x) (((x) >> 4) & 0x3) #define SMC91X_IO_SHIFT(x) (((x) >> 4) & 0x3)
#define SMC91X_USE_DMA (1 << 6)
struct smc91x_platdata { struct smc91x_platdata {
unsigned long flags; unsigned long flags;
}; };
......
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