Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmaengine: dw-axi-dmac: Allow client-chosen width #6377

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions arch/arm64/boot/dts/broadcom/rp1.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
interrupts = <RP1_INT_UART0 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&rp1_clocks RP1_CLK_UART &rp1_clocks RP1_PLL_SYS_PRI_PH>;
clock-names = "uartclk", "apb_pclk";
// dmas = <&rp1_dma RP1_DMA_UART0_TX>,
// <&rp1_dma RP1_DMA_UART0_RX>;
// dma-names = "tx", "rx";
dmas = <&rp1_dma RP1_DMA_UART0_TX>,
<&rp1_dma RP1_DMA_UART0_RX>;
dma-names = "tx", "rx";
pinctrl-names = "default";
arm,primecell-periphid = <0x00541011>;
uart-has-rtscts;
Expand Down
12 changes: 12 additions & 0 deletions drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,18 @@ static int dw_axi_dma_set_hw_desc(struct axi_dma_chan *chan,
case DMA_DEV_TO_MEM:
reg_burst_msize = axi_dma_encode_msize(chan->config.src_maxburst);
reg_width = __ffs(chan->config.src_addr_width);
/*
* For devices where transfer lengths are not known upfront,
* there is a danger when the destination is wider than the
* source that partial words can be lost at the end of a transfer.
* Ideally the controller would be able to flush the residue, but
* it can't - it's not even possible to tell that there is any.
* Instead, allow the client driver to avoid the problem by setting
* a smaller width.
*/
if (chan->config.dst_addr_width &&
(chan->config.dst_addr_width < mem_width))
mem_width = chan->config.dst_addr_width;
device_addr = phys_to_dma(chan->chip->dev, chan->config.src_addr);
ctllo = reg_width << CH_CTL_L_SRC_WIDTH_POS |
mem_width << CH_CTL_L_DST_WIDTH_POS |
Expand Down
2 changes: 0 additions & 2 deletions drivers/spi/spi-dw-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@ static int dw_spi_dma_config_tx(struct dw_spi *dws)
txconf.direction = DMA_MEM_TO_DEV;
txconf.dst_addr = dws->dma_addr;
txconf.dst_maxburst = dws->txburst;
txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
txconf.dst_addr_width = dw_spi_dma_convert_width(dws->n_bytes);
txconf.device_fc = false;

Expand Down Expand Up @@ -431,7 +430,6 @@ static int dw_spi_dma_config_rx(struct dw_spi *dws)
rxconf.direction = DMA_DEV_TO_MEM;
rxconf.src_addr = dws->dma_addr;
rxconf.src_maxburst = dws->rxburst;
rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
rxconf.src_addr_width = dw_spi_dma_convert_width(dws->n_bytes);
rxconf.device_fc = false;

Expand Down
1 change: 1 addition & 0 deletions drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ static void pl011_dma_probe(struct uart_amba_port *uap)
.src_addr = uap->port.mapbase +
pl011_reg_to_offset(uap, REG_DR),
.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
.direction = DMA_DEV_TO_MEM,
.src_maxburst = uap->fifosize >> 2,
.device_fc = false,
Expand Down
Loading