b43legacy: simplify engine type / DMA mask selection
Return the engine type from the function looking at the registers, and just derive the DMA mask from that in the one place we care. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
This commit is contained in:
parent
2589890008
commit
80372782e4
|
@ -603,7 +603,7 @@ static void free_all_descbuffers(struct b43legacy_dmaring *ring)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u64 supported_dma_mask(struct b43legacy_wldev *dev)
|
static enum b43legacy_dmatype b43legacy_engine_type(struct b43legacy_wldev *dev)
|
||||||
{
|
{
|
||||||
u32 tmp;
|
u32 tmp;
|
||||||
u16 mmio_base;
|
u16 mmio_base;
|
||||||
|
@ -615,18 +615,7 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev)
|
||||||
tmp = b43legacy_read32(dev, mmio_base +
|
tmp = b43legacy_read32(dev, mmio_base +
|
||||||
B43legacy_DMA32_TXCTL);
|
B43legacy_DMA32_TXCTL);
|
||||||
if (tmp & B43legacy_DMA32_TXADDREXT_MASK)
|
if (tmp & B43legacy_DMA32_TXADDREXT_MASK)
|
||||||
return DMA_BIT_MASK(32);
|
|
||||||
|
|
||||||
return DMA_BIT_MASK(30);
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum b43legacy_dmatype dma_mask_to_engine_type(u64 dmamask)
|
|
||||||
{
|
|
||||||
if (dmamask == DMA_BIT_MASK(30))
|
|
||||||
return B43legacy_DMA_30BIT;
|
|
||||||
if (dmamask == DMA_BIT_MASK(32))
|
|
||||||
return B43legacy_DMA_32BIT;
|
return B43legacy_DMA_32BIT;
|
||||||
B43legacy_WARN_ON(1);
|
|
||||||
return B43legacy_DMA_30BIT;
|
return B43legacy_DMA_30BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,13 +777,10 @@ int b43legacy_dma_init(struct b43legacy_wldev *dev)
|
||||||
{
|
{
|
||||||
struct b43legacy_dma *dma = &dev->dma;
|
struct b43legacy_dma *dma = &dev->dma;
|
||||||
struct b43legacy_dmaring *ring;
|
struct b43legacy_dmaring *ring;
|
||||||
|
enum b43legacy_dmatype type = b43legacy_engine_type(dev);
|
||||||
int err;
|
int err;
|
||||||
u64 dmamask;
|
|
||||||
enum b43legacy_dmatype type;
|
|
||||||
|
|
||||||
dmamask = supported_dma_mask(dev);
|
err = dma_set_mask_and_coherent(dev->dev->dma_dev, DMA_BIT_MASK(type));
|
||||||
type = dma_mask_to_engine_type(dmamask);
|
|
||||||
err = dma_set_mask_and_coherent(dev->dev->dma_dev, dmamask);
|
|
||||||
if (err) {
|
if (err) {
|
||||||
#ifdef CONFIG_B43LEGACY_PIO
|
#ifdef CONFIG_B43LEGACY_PIO
|
||||||
b43legacywarn(dev->wl, "DMA for this device not supported. "
|
b43legacywarn(dev->wl, "DMA for this device not supported. "
|
||||||
|
|
Loading…
Reference in New Issue