dmaengine: tegra-apb: Support non-flow controlled slave configuration
Subsystems (3)
PATCH 1/1 dmaengine: tegra-apb: Support non-flow controlled slave configuration
This allows DMA client to issue a non-flow controlled TX. In particular it is needed for the fuse driver that reads fuse registers using APBDMA to workaround a HW bug that results in hang when CPU and DMA perform simultaneous access to fuse peripheral.
--- drivers/dma/tegra20-apb-dma.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/dma/tegra20-apb-dma.c +14 -5
@@ -353,7 +353,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc, }memcpy (&tdc->dma_sconfig, sconfig,sizeof (*sconfig)); -if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID ) { +if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID && + sconfig->device_fc) {if (sconfig->slave_id >TEGRA_APBDMA_CSR_REQ_SEL_MASK )return -EINVAL ; tdc->slave_id = sconfig->slave_id;
@@ -970,8 +971,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_ONCE |TEGRA_APBDMA_CSR_FLOW ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + csr |=TEGRA_APBDMA_CSR_ONCE ; + +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ;
@@ -1110,10 +1116,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_FLOW ; +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;
Signature · 1 line
2.14.1
Jon Hunter
Reviewed-byQuoted 46 lines · Dmitry Osipenko
This allows DMA client to issue a non-flow controlled TX. In particular it is needed for the fuse driver that reads fuse registers using APBDMA to workaround a HW bug that results in hang when CPU and DMA perform simultaneous access to fuse peripheral.
Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/dma/tegra20-apb-dma.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)drivers/dma/tegra20-apb-dma.c +10
-4@@ -353,7 +353,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc, }memcpy (&tdc->dma_sconfig, sconfig,sizeof (*sconfig)); -if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID ) { +if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID && + sconfig->device_fc) {if (sconfig->slave_id >TEGRA_APBDMA_CSR_REQ_SEL_MASK )return -EINVAL ; tdc->slave_id = sconfig->slave_id;@@ -970,8 +971,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_ONCE |TEGRA_APBDMA_CSR_FLOW ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + csr |=TEGRA_APBDMA_CSR_ONCE ; + +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ;@@ -1110,10 +1116,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_FLOW ; +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) {
drivers/dma/tegra20-apb-dma.c static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic( · line 1128
Quoted 10 lines
drivers/dma/tegra20-apb-dma.c +4
-1+ csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 25 lines · Dmitry Osipenko
This allows DMA client to issue a non-flow controlled TX. In particular it is needed for the fuse driver that reads fuse registers using APBDMA to workaround a HW bug that results in hang when CPU and DMA perform simultaneous access to fuse peripheral.
Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/dma/tegra20-apb-dma.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)drivers/dma/tegra20-apb-dma.c +2
-1@@ -353,7 +353,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc, }memcpy (&tdc->dma_sconfig, sconfig,sizeof (*sconfig)); -if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID ) { +if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID && + sconfig->device_fc) {if (sconfig->slave_id >TEGRA_APBDMA_CSR_REQ_SEL_MASK )return -EINVAL ; tdc->slave_id = sconfig->slave_id;
drivers/dma/tegra20-apb-dma.c static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( · line 974
Quoted 6 lines
drivers/dma/tegra20-apb-dma.c +1
-2@@ -970,8 +971,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_ONCE |TEGRA_APBDMA_CSR_FLOW ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + csr |=TEGRA_APBDMA_CSR_ONCE ;
^^^
Checkpatch should have complained here, no space before ; please
Quoted 32 lines
drivers/dma/tegra20-apb-dma.c +11
-2+ +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ;@@ -1110,10 +1116,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_FLOW ; +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;Signature · 6 lines
2.14.1 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
~Vinod
Quoted 29 lines · Vinod Koul
Quoted 28 lines · Dmitry Osipenko
This allows DMA client to issue a non-flow controlled TX. In particular it is needed for the fuse driver that reads fuse registers using APBDMA to workaround a HW bug that results in hang when CPU and DMA perform simultaneous access to fuse peripheral.
Signed-off-by Dmitry Osipenko <[email protected]>--- drivers/dma/tegra20-apb-dma.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)drivers/dma/tegra20-apb-dma.c +2
-1@@ -353,7 +353,8 @@ static int tegra_dma_slave_config(struct dma_chan *dc, }memcpy (&tdc->dma_sconfig, sconfig,sizeof (*sconfig)); -if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID ) { +if (tdc->slave_id ==TEGRA_APBDMA_SLAVE_ID_INVALID && + sconfig->device_fc) {if (sconfig->slave_id >TEGRA_APBDMA_CSR_REQ_SEL_MASK )return -EINVAL ; tdc->slave_id = sconfig->slave_id;@@ -970,8 +971,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ;
Quoted 6 lines
drivers/dma/tegra20-apb-dma.c static struct dma_async_tx_descriptor *tegra_dma_prep_slave_sg( · line 974
Quoted 3 lines
drivers/dma/tegra20-apb-dma.c +1
-2- csr |=TEGRA_APBDMA_CSR_ONCE |TEGRA_APBDMA_CSR_FLOW ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + csr |=TEGRA_APBDMA_CSR_ONCE ;^^^Checkpatch should have complained here, no space before ; please
Yep, sorry.
Quoted 28 lines
Quoted 28 lines
drivers/dma/tegra20-apb-dma.c +11
-2+ +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ;@@ -1110,10 +1116,13 @@ static struct dma_async_tx_descriptor *tegra_dma_prep_dma_cyclic(TEGRA_APBDMA_AHBSEQ_WRAP_SHIFT ; ahb_seq |=TEGRA_APBDMA_AHBSEQ_BUS_WIDTH_32 ; - csr |=TEGRA_APBDMA_CSR_FLOW ; +if (tdc->slave_id !=TEGRA_APBDMA_SLAVE_ID_INVALID ) { + csr |=TEGRA_APBDMA_CSR_FLOW ; + csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; + } +if (flags &DMA_PREP_INTERRUPT ) csr |=TEGRA_APBDMA_CSR_IE_EOC ; - csr |= tdc->slave_id <<TEGRA_APBDMA_CSR_REQ_SEL_SHIFT ; apb_seq |=TEGRA_APBDMA_APBSEQ_WRAP_WORD_1 ;Signature · 1 line
2.14.1