Skip to contentSkip to conversation

dmaengine: tegra210-adma: fix transfer failure

PATCH Superseded Sameer Pujar 3 participants 7 messages Jul 12, 2019 – Sep 16, 2019

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dmaengine: tegra210-adma: fix transfer failure

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")
---
 drivers/dma/tegra210-adma.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +7 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
 				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
 				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
 #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
 struct tegra_adma;
@@ -85,6 +87,7 @@ struct tegra_adma;
  * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
  * @ch_req_rx_shift: Register offset for AHUB receive channel select.
  * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.
  * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
  * @ch_req_mask: Mask for Tx or Rx channel select.
  * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
 	unsigned int ch_req_tx_shift;
 	unsigned int ch_req_rx_shift;
 	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
 	unsigned int ch_fifo_ctrl;
 	unsigned int ch_req_mask;
 	unsigned int ch_req_max;
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
 			 ADMA_CH_CTRL_FLOWCTRL_EN;
 	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
 	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;
 	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
 	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
 	.ch_req_tx_shift	= 28,
 	.ch_req_rx_shift	= 24,
 	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
 	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0xf,
 	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
 	.ch_req_tx_shift	= 27,
 	.ch_req_rx_shift	= 22,
 	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
 	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0x1f,
 	.ch_req_max		= 20,
Signature · 1 line
2.7.4
#1 lore raw

Hi Reviewers,

Please review.

Thanks,
Sameer.

Quoted 72 lines · Sameer Pujar

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel
configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")
---
  drivers/dma/tegra210-adma.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +7 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
  				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
  				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
  #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
  struct tegra_adma;
@@ -85,6 +87,7 @@ struct tegra_adma;
   * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
   * @ch_req_rx_shift: Register offset for AHUB receive channel select.
   * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.
   * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
   * @ch_req_mask: Mask for Tx or Rx channel select.
   * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
  	unsigned int ch_req_tx_shift;
  	unsigned int ch_req_rx_shift;
  	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
  	unsigned int ch_fifo_ctrl;
  	unsigned int ch_req_mask;
  	unsigned int ch_req_max;
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
  			 ADMA_CH_CTRL_FLOWCTRL_EN;
  	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
  	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;
  	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
  	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
  	.ch_req_tx_shift	= 28,
  	.ch_req_rx_shift	= 24,
  	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
  	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0xf,
  	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
  	.ch_req_tx_shift	= 27,
  	.ch_req_rx_shift	= 22,
  	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
  	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0x1f,
  	.ch_req_max		= 20,
#2 lore raw

Request for review.

Quoted 79 lines · Sameer Pujar

Hi Reviewers,

Please review.

Thanks,
Sameer.

Quoted 71 lines · Sameer Pujar

 From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")

---
  drivers/dma/tegra210-adma.c | 7 +++++++

  1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +0 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
 TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
 TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))

  +#define TEGRA186_DMA_MAX_PENDING_REQS            8
+
  #define ADMA_CH_REG_FIELD_VAL(val, mask, shift) (((val) & mask) << shift) struct tegra_adma;

drivers/dma/tegra210-adma.c +3 -0
@@ -85,6 +87,7 @@ struct tegra_adma;
    * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
    * @ch_req_rx_shift: Register offset for AHUB receive channel select.
    * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.
    * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
    * @ch_req_mask: Mask for Tx or Rx channel select.
    * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
       unsigned int ch_req_tx_shift;
       unsigned int ch_req_rx_shift;
       unsigned int ch_base_offset;
+    unsigned int ch_pending_req;
       unsigned int ch_fifo_ctrl;
       unsigned int ch_req_mask;
       unsigned int ch_req_max;
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct 
 tegra_adma_chan *tdc,
                ADMA_CH_CTRL_FLOWCTRL_EN;
       ch_regs->config |= cdata->adma_get_burst_config(burst_size);
       ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+    ch_regs->config |= cdata->ch_pending_req;
       ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
       ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;

  @@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = { .ch_req_tx_shift    = 28,
      .ch_req_rx_shift    = 24,
      .ch_base_offset        = 0,
+    .ch_pending_req        = 0,
      .ch_fifo_ctrl        = TEGRA210_FIFO_CTRL_DEFAULT,
      .ch_req_mask        = 0xf,
      .ch_req_max        = 10,

drivers/dma/tegra210-adma.c +1 -0
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data 
 tegra186_chip_data = {
       .ch_req_tx_shift    = 27,
       .ch_req_rx_shift    = 22,
       .ch_base_offset        = 0x10000,
+    .ch_pending_req        = (TEGRA186_DMA_MAX_PENDING_REQS << 4),
       .ch_fifo_ctrl        = TEGRA186_FIFO_CTRL_DEFAULT,
       .ch_req_mask        = 0x1f,

      .ch_req_max        = 20,

maintainer
#3 lore raw
In reply to Sameer Pujar
Quoted 1 line · Sameer Pujar
Quoted 1 line

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel

^^
please remove the leading char from the para

Quoted 5 lines

configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Quoted 7 lines

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")

Should this be tagged stable? Also some reviews from Tegra folks would be great

Quoted 36 lines
---
 drivers/dma/tegra210-adma.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +4 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
 				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
 				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
 #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
 struct tegra_adma;
@@ -85,6 +87,7 @@ struct tegra_adma;
  * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
  * @ch_req_rx_shift: Register offset for AHUB receive channel select.
  * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.
  * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
  * @ch_req_mask: Mask for Tx or Rx channel select.
  * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
 	unsigned int ch_req_tx_shift;
 	unsigned int ch_req_rx_shift;
 	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
 	unsigned int ch_fifo_ctrl;
 	unsigned int ch_req_mask;
 	unsigned int ch_req_max;

drivers/dma/tegra210-adma.c static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · line 609

Quoted 4 lines
drivers/dma/tegra210-adma.c +1 -0
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
 			 ADMA_CH_CTRL_FLOWCTRL_EN;
 	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
 	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;

so for tegra186 this will be 0, which per above would prevent any transfers?? What did i miss

Quoted 21 lines
drivers/dma/tegra210-adma.c +2 -0
 	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
 	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
 	.ch_req_tx_shift	= 28,
 	.ch_req_rx_shift	= 24,
 	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
 	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0xf,
 	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
 	.ch_req_tx_shift	= 27,
 	.ch_req_rx_shift	= 22,
 	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
 	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0x1f,
 	.ch_req_max		= 20,
Signature · 1 line
2.7.4
Signature · 1 line
~Vinod
#4 lore raw

Sorry for the delayed reply.

Quoted 4 lines · Vinod Koul
Quoted 1 line · Sameer Pujar
Quoted 1 line

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel

^^
please remove the leading char from the para

Are you referring to extra char '>' here? I don't see this in my diff patch.

Quoted 12 lines
Quoted 12 lines

configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Quoted 3 lines
Quoted 1 line
Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")

Should this be tagged stable? Also some reviews from Tegra folks would be great

Ok, will tag this for stable.

Quoted 33 lines
Quoted 33 lines
---
  drivers/dma/tegra210-adma.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +4 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
  				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
  				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
  #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
  struct tegra_adma;
@@ -85,6 +87,7 @@ struct tegra_adma;
   * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
   * @ch_req_rx_shift: Register offset for AHUB receive channel select.
   * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.
   * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
   * @ch_req_mask: Mask for Tx or Rx channel select.
   * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
  	unsigned int ch_req_tx_shift;
  	unsigned int ch_req_rx_shift;
  	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
  	unsigned int ch_fifo_ctrl;
  	unsigned int ch_req_mask;
Quoted 8 lines

drivers/dma/tegra210-adma.c static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · line 609

Quoted 6 lines
drivers/dma/tegra210-adma.c +1 -0
  	unsigned int ch_req_max;
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
  			 ADMA_CH_CTRL_FLOWCTRL_EN;
  	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
  	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;

so for tegra186 this will be 0, which per above would prevent any transfers?? What did i miss

For tegra186/tegra194 this will be non-zero and for tegra210 it will be 0. The chip data reflects above.

Quoted 21 lines
Quoted 21 lines
drivers/dma/tegra210-adma.c +2 -0
  	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
  	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
  	.ch_req_tx_shift	= 28,
  	.ch_req_rx_shift	= 24,
  	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
  	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0xf,
  	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
  	.ch_req_tx_shift	= 27,
  	.ch_req_rx_shift	= 22,
  	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
  	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0x1f,
  	.ch_req_max		= 20,
Signature · 1 line
2.7.4
maintainer
#5 lore raw
In reply to Sameer Pujar
Quoted 33 lines · Sameer Pujar

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")
---
 drivers/dma/tegra210-adma.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +2 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
 				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
 				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
 #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
 struct tegra_adma;

drivers/dma/tegra210-adma.c struct tegra_adma; · line 90

Quoted 4 lines
drivers/dma/tegra210-adma.c +1 -0
@@ -85,6 +87,7 @@ struct tegra_adma;
  * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
  * @ch_req_rx_shift: Register offset for AHUB receive channel select.
  * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.

s/Outstaning/Outstanding

I do wonder if this variable should be a boolean variable 'has_oustanding_reqs' because this is not applicable to Tegra210. I think this will be clearer that this is a difference between SoC versions and that it should not be configured for Tegra210. And then ...

Quoted 12 lines
drivers/dma/tegra210-adma.c +1 -0
  * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
  * @ch_req_mask: Mask for Tx or Rx channel select.
  * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
 	unsigned int ch_req_tx_shift;
 	unsigned int ch_req_rx_shift;
 	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
 	unsigned int ch_fifo_ctrl;
 	unsigned int ch_req_mask;
 	unsigned int ch_req_max;

drivers/dma/tegra210-adma.c static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · line 609

Quoted 4 lines
drivers/dma/tegra210-adma.c +1 -0
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
 			 ADMA_CH_CTRL_FLOWCTRL_EN;
 	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
 	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;

... you can ...

        if (cdata->has_outstanding_reqs)
            ch_regs->config |= TEGRA186_ADMA_CH_CONFIG_OUTSTNDREQS(8)
Quoted 20 lines
drivers/dma/tegra210-adma.c +2 -0
 	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
 	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
 	.ch_req_tx_shift	= 28,
 	.ch_req_rx_shift	= 24,
 	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
 	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0xf,
 	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
 	.ch_req_tx_shift	= 27,
 	.ch_req_rx_shift	= 22,
 	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
 	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
 	.ch_req_mask		= 0x1f,
 	.ch_req_max		= 20,
Signature · 1 line
nvpublic
#6 lore raw

Sorry for delayed reply, I was consumed in some other work.

Quoted 32 lines · Jon Hunter
Quoted 31 lines · Sameer Pujar

From Tegra186 onwards OUTSTANDING_REQUESTS field is added in channel
configuration register(bits 7:4) which defines the maximum number of reads from the source and writes to the destination that may be outstanding at any given point of time. This field must be programmed with a value between 1 and 8. A value of 0 will prevent any transfers from happening.

Thus added 'ch_pending_req' member in chip data structure and the same is populated with maximum allowed pending requests. Since the field is not applicable to Tegra210, mentioned bit fields are unused and hence the member is initialized with 0. For Tegra186, by default program this field with the maximum permitted value of 8.

Fixes 433de642a76c ("dmaengine: tegra210-adma: add support for Tegra186/Tegra194")
---
  drivers/dma/tegra210-adma.c | 7 +++++++
  1 file changed, 7 insertions(+)
drivers/dma/tegra210-adma.c +2 -0
index 2805853..5ab4e3a9 100644
@@ -74,6 +74,8 @@
  				    TEGRA186_ADMA_CH_FIFO_CTRL_TXSIZE(3)    | \
  				    TEGRA186_ADMA_CH_FIFO_CTRL_RXSIZE(3))
 
+#define TEGRA186_DMA_MAX_PENDING_REQS			8
+
  #define ADMA_CH_REG_FIELD_VAL(val, mask, shift)	(((val) & mask) << shift)
 
Quoted 7 lines

drivers/dma/tegra210-adma.c struct tegra_adma; · line 90

Quoted 6 lines
drivers/dma/tegra210-adma.c +1 -0
  struct tegra_adma;
@@ -85,6 +87,7 @@ struct tegra_adma;
   * @ch_req_tx_shift: Register offset for AHUB transmit channel select.
   * @ch_req_rx_shift: Register offset for AHUB receive channel select.
   * @ch_base_offset: Register offset of DMA channel registers.
+ * @ch_pending_req: Outstaning DMA requests for a channel.

s/Outstaning/Outstanding

will fix.

Quoted 23 lines

I do wonder if this variable should be a boolean variable 'has_oustanding_reqs' because this is not applicable to Tegra210. I think this will be clearer that this is a difference between SoC versions and that it should not be configured for Tegra210. And then ...

Quoted 12 lines
drivers/dma/tegra210-adma.c +1 -0
   * @ch_fifo_ctrl: Default value for channel FIFO CTRL register.
   * @ch_req_mask: Mask for Tx or Rx channel select.
   * @ch_req_max: Maximum number of Tx or Rx channels available.
@@ -98,6 +101,7 @@ struct tegra_adma_chip_data {
  	unsigned int ch_req_tx_shift;
  	unsigned int ch_req_rx_shift;
  	unsigned int ch_base_offset;
+	unsigned int ch_pending_req;
  	unsigned int ch_fifo_ctrl;
  	unsigned int ch_req_mask;
  	unsigned int ch_req_max;

drivers/dma/tegra210-adma.c static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc, · line 609

Quoted 4 lines
drivers/dma/tegra210-adma.c +1 -0
@@ -602,6 +606,7 @@ static int tegra_adma_set_xfer_params(struct tegra_adma_chan *tdc,
  			 ADMA_CH_CTRL_FLOWCTRL_EN;
  	ch_regs->config |= cdata->adma_get_burst_config(burst_size);
  	ch_regs->config |= ADMA_CH_CONFIG_WEIGHT_FOR_WRR(1);
+	ch_regs->config |= cdata->ch_pending_req;

... you can ...

Quoted 2 lines
         if (cdata->has_outstanding_reqs)
             ch_regs->config |= TEGRA186_ADMA_CH_CONFIG_OUTSTNDREQS(8)

yes, this can be done. Will update in next revision.

Quoted 21 lines
Quoted 21 lines
drivers/dma/tegra210-adma.c +2 -0
  	ch_regs->fifo_ctrl = cdata->ch_fifo_ctrl;
  	ch_regs->tc = desc->period_len & ADMA_CH_TC_COUNT_MASK;
 
@@ -786,6 +791,7 @@ static const struct tegra_adma_chip_data tegra210_chip_data = {
  	.ch_req_tx_shift	= 28,
  	.ch_req_rx_shift	= 24,
  	.ch_base_offset		= 0,
+	.ch_pending_req		= 0,
  	.ch_fifo_ctrl		= TEGRA210_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0xf,
  	.ch_req_max		= 10,
@@ -800,6 +806,7 @@ static const struct tegra_adma_chip_data tegra186_chip_data = {
  	.ch_req_tx_shift	= 27,
  	.ch_req_rx_shift	= 22,
  	.ch_base_offset		= 0x10000,
+	.ch_pending_req		= (TEGRA186_DMA_MAX_PENDING_REQS << 4),
  	.ch_fifo_ctrl		= TEGRA186_FIFO_CTRL_DEFAULT,
  	.ch_req_mask		= 0x1f,
  	.ch_req_max		= 20,