Skip to contentSkip to conversation

dmaengine: qcom: gpi: set chain and link flag for duplex

PATCH Applied Vinod Koul 3 participants 8 messages Apr 6, 2022 – Apr 13, 2022

Subsystems (3)
lore
Share & tools
lore

Vinod Koul

author maintainer
#0 lore raw

PATCH 1/3 dmaengine: qcom: gpi: set chain and link flag for duplex

Newer platforms seem to have strict requirement for TRE flags which causes transaction to timeout. This was resolved to missing chain and link flag for duplex spi transaction.

So add these two flags.

---
 drivers/dma/qcom/gpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/qcom/gpi.c +6 -2
index 94f3648f7483..3429ceccd13b 100644
@@ -1754,10 +1754,14 @@ static int gpi_create_spi_tre(struct gchan *chan, struct gpi_desc *desc,
 		tre->dword[2] = u32_encode_bits(spi->rx_len, TRE_RX_LEN);
 
 		tre->dword[3] = u32_encode_bits(TRE_TYPE_GO, TRE_FLAGS_TYPE);
-		if (spi->cmd == SPI_RX)
+		if (spi->cmd == SPI_RX) {
 			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_IEOB);
-		else
+		} else if (spi->cmd == SPI_TX) {
+			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_CHAIN);
+		} else { /* SPI_DUPLEX */
 			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_CHAIN);
+			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_LINK);
+		}
 	}
 
 	/* create the dma tre */
Signature · 1 line
2.34.1
author maintainer
#1 lore raw

PATCH 2/3 dt-bindings: dmaengine: qcom: gpi: add compatible for sm8350/sm8350

Add the compatible for newer qcom socs with gpi dma i.e qcom sm8350 and sm8450.

---
 Documentation/devicetree/bindings/dma/qcom,gpi.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/dma/qcom,gpi.yaml +2 -0
index e614fe3187bb..67f046a4a442 100644
@@ -22,6 +22,8 @@ properties:
       - qcom,sdm845-gpi-dma
       - qcom,sm8150-gpi-dma
       - qcom,sm8250-gpi-dma
+      - qcom,sm8350-gpi-dma
+      - qcom,sm8450-gpi-dma
 
   reg:
     maxItems: 1
Signature · 1 line
2.34.1
Reviewed-by on v1 2/3
#3 lore raw

Re: [PATCH 2/3] dt-bindings: dmaengine: qcom: gpi: add compatible for sm8350/sm8350

In reply to Vinod Koul
Quoted 4 lines · Vinod Koul

Add the compatible for newer qcom socs with gpi dma i.e qcom sm8350 and sm8450.

Quoted 20 lines
---
 Documentation/devicetree/bindings/dma/qcom,gpi.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/dma/qcom,gpi.yaml +2 -0
index e614fe3187bb..67f046a4a442 100644
@@ -22,6 +22,8 @@ properties:
       - qcom,sdm845-gpi-dma
       - qcom,sm8150-gpi-dma
       - qcom,sm8250-gpi-dma
+      - qcom,sm8350-gpi-dma
+      - qcom,sm8450-gpi-dma
 
   reg:
     maxItems: 1
Signature · 1 line
2.34.1
author maintainer
#4 lore raw

PATCH 3/3 dmaengine: qcom: gpi: Add support for ee_offset

In reply to Vinod Koul

Controller on newer SoCs like SM8450 have registers at at offset. Add ee_offset to driver_data and add this compatible for the driver.

---
 drivers/dma/qcom/gpi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/dma/qcom/gpi.c +8 -3
index 3429ceccd13b..0b402d923eae 100644
@@ -2152,6 +2152,7 @@ static int gpi_probe(struct platform_device *pdev)
 {
 	struct gpi_dev *gpi_dev;
 	unsigned int i;
+	u32 ee_offset;
 	int ret;
 
 	gpi_dev = devm_kzalloc(&pdev->dev, sizeof(*gpi_dev), GFP_KERNEL);
@@ -2179,6 +2180,9 @@ static int gpi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	ee_offset = (uintptr_t)device_get_match_data(gpi_dev->dev);
+	gpi_dev->ee_base = gpi_dev->ee_base - ee_offset;
+
 	gpi_dev->ev_factor = EV_FACTOR;
 
 	ret = dma_set_mask(gpi_dev->dev, DMA_BIT_MASK(64));
@@ -2282,9 +2286,10 @@ static int gpi_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id gpi_of_match[] = {
-	{ .compatible = "qcom,sdm845-gpi-dma" },
-	{ .compatible = "qcom,sm8150-gpi-dma" },
-	{ .compatible = "qcom,sm8250-gpi-dma" },
+	{ .compatible = "qcom,sdm845-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8150-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8250-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8450-gpi-dma", .data = (void *)0x10000 },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, gpi_of_match);
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] dmaengine: qcom: gpi: Add support for ee_offset

Quoted 4 lines · Vinod Koul

Controller on newer SoCs like SM8450 have registers at at offset. Add ee_offset to driver_data and add this compatible for the driver.

Regards,
Bjorn

Quoted 43 lines
---
 drivers/dma/qcom/gpi.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/dma/qcom/gpi.c +8 -3
index 3429ceccd13b..0b402d923eae 100644
@@ -2152,6 +2152,7 @@ static int gpi_probe(struct platform_device *pdev)
 {
 	struct gpi_dev *gpi_dev;
 	unsigned int i;
+	u32 ee_offset;
 	int ret;
 
 	gpi_dev = devm_kzalloc(&pdev->dev, sizeof(*gpi_dev), GFP_KERNEL);
@@ -2179,6 +2180,9 @@ static int gpi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	ee_offset = (uintptr_t)device_get_match_data(gpi_dev->dev);
+	gpi_dev->ee_base = gpi_dev->ee_base - ee_offset;
+
 	gpi_dev->ev_factor = EV_FACTOR;
 
 	ret = dma_set_mask(gpi_dev->dev, DMA_BIT_MASK(64));
@@ -2282,9 +2286,10 @@ static int gpi_probe(struct platform_device *pdev)
 }
 
 static const struct of_device_id gpi_of_match[] = {
-	{ .compatible = "qcom,sdm845-gpi-dma" },
-	{ .compatible = "qcom,sm8150-gpi-dma" },
-	{ .compatible = "qcom,sm8250-gpi-dma" },
+	{ .compatible = "qcom,sdm845-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8150-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8250-gpi-dma", .data = (void *)0x0 },
+	{ .compatible = "qcom,sm8450-gpi-dma", .data = (void *)0x10000 },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, gpi_of_match);
Signature · 1 line
2.34.1
Reviewed-by Tested-by on v1 1/3
#6 lore raw
In reply to Vinod Koul
Quoted 7 lines · Vinod Koul

Newer platforms seem to have strict requirement for TRE flags which causes transaction to timeout. This was resolved to missing chain and link flag for duplex spi transaction.

So add these two flags.

Quoted 28 lines
---
 drivers/dma/qcom/gpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/dma/qcom/gpi.c +6 -2
index 94f3648f7483..3429ceccd13b 100644
@@ -1754,10 +1754,14 @@ static int gpi_create_spi_tre(struct gchan *chan, struct gpi_desc *desc,
 		tre->dword[2] = u32_encode_bits(spi->rx_len, TRE_RX_LEN);
 
 		tre->dword[3] = u32_encode_bits(TRE_TYPE_GO, TRE_FLAGS_TYPE);
-		if (spi->cmd == SPI_RX)
+		if (spi->cmd == SPI_RX) {
 			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_IEOB);
-		else
+		} else if (spi->cmd == SPI_TX) {
+			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_CHAIN);
+		} else { /* SPI_DUPLEX */
 			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_CHAIN);
+			tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_LINK);
+		}
 	}
 
 	/* create the dma tre */
Signature · 1 line
2.34.1
author maintainer Applied
#7 lore raw
In reply to Vinod Koul
Quoted 5 lines · Vinod Koul

Newer platforms seem to have strict requirement for TRE flags which causes transaction to timeout. This was resolved to missing chain and link flag for duplex spi transaction.

So add these two flags.

Applied all, thanks

Signature · 1 line
~Vinod