DMA: PL08x: cleanup selection of buswidth
Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
Родитель
fa020e7d04
Коммит
aa88cdaa14
|
@ -1105,13 +1105,26 @@ static u32 pl08x_cctl(u32 cctl)
|
||||||
return cctl | PL080_CONTROL_PROT_SYS;
|
return cctl | PL080_CONTROL_PROT_SYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u32 pl08x_width(enum dma_slave_buswidth width)
|
||||||
|
{
|
||||||
|
switch (width) {
|
||||||
|
case DMA_SLAVE_BUSWIDTH_1_BYTE:
|
||||||
|
return PL080_WIDTH_8BIT;
|
||||||
|
case DMA_SLAVE_BUSWIDTH_2_BYTES:
|
||||||
|
return PL080_WIDTH_16BIT;
|
||||||
|
case DMA_SLAVE_BUSWIDTH_4_BYTES:
|
||||||
|
return PL080_WIDTH_32BIT;
|
||||||
|
}
|
||||||
|
return ~0;
|
||||||
|
}
|
||||||
|
|
||||||
static int dma_set_runtime_config(struct dma_chan *chan,
|
static int dma_set_runtime_config(struct dma_chan *chan,
|
||||||
struct dma_slave_config *config)
|
struct dma_slave_config *config)
|
||||||
{
|
{
|
||||||
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
|
struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
|
||||||
struct pl08x_driver_data *pl08x = plchan->host;
|
struct pl08x_driver_data *pl08x = plchan->host;
|
||||||
enum dma_slave_buswidth addr_width;
|
enum dma_slave_buswidth addr_width;
|
||||||
u32 maxburst;
|
u32 width, maxburst;
|
||||||
u32 cctl = 0;
|
u32 cctl = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1132,25 +1145,16 @@ static int dma_set_runtime_config(struct dma_chan *chan,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (addr_width) {
|
width = pl08x_width(addr_width);
|
||||||
case DMA_SLAVE_BUSWIDTH_1_BYTE:
|
if (width == ~0) {
|
||||||
cctl |= (PL080_WIDTH_8BIT << PL080_CONTROL_SWIDTH_SHIFT) |
|
|
||||||
(PL080_WIDTH_8BIT << PL080_CONTROL_DWIDTH_SHIFT);
|
|
||||||
break;
|
|
||||||
case DMA_SLAVE_BUSWIDTH_2_BYTES:
|
|
||||||
cctl |= (PL080_WIDTH_16BIT << PL080_CONTROL_SWIDTH_SHIFT) |
|
|
||||||
(PL080_WIDTH_16BIT << PL080_CONTROL_DWIDTH_SHIFT);
|
|
||||||
break;
|
|
||||||
case DMA_SLAVE_BUSWIDTH_4_BYTES:
|
|
||||||
cctl |= (PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT) |
|
|
||||||
(PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(&pl08x->adev->dev,
|
dev_err(&pl08x->adev->dev,
|
||||||
"bad runtime_config: alien address width\n");
|
"bad runtime_config: alien address width\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cctl |= width << PL080_CONTROL_SWIDTH_SHIFT;
|
||||||
|
cctl |= width << PL080_CONTROL_DWIDTH_SHIFT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now decide on a maxburst:
|
* Now decide on a maxburst:
|
||||||
* If this channel will only request single transfers, set this
|
* If this channel will only request single transfers, set this
|
||||||
|
|
Загрузка…
Ссылка в новой задаче