mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] dmaengine: pl08x: Support the Hi3798MV100 PL080 variant
@ 2026-11-06  7:25 David Yang
  2026-11-06  7:25 ` [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers David Yang
  2026-11-06  7:25 ` [PATCH v2 2/2] dmaengine: pl08x: Use the channel count from the device tree David Yang
  0 siblings, 2 replies; 4+ messages in thread
From: David Yang @ 2026-11-06  7:25 UTC (permalink / raw)
  To: dmaengine; +Cc: David Yang, Vinod Koul, Frank Li, Philipp Zabel, linux-kernel

Hi3798MV100 (HiSilicon HiSTB) carries a PL080-class DMAC. The block
reports 0x0a141080 -- the ID reserved for Samsung's PL080S -- while its
register map is plain PL080 and the instance has 4 channels instead of
the 8 the plain PL080 entry claims.

Set the DT node to arm,primecell-periphid = <0x00041080> and
dma-channels = <4>, and apply the two patches to add that support.

Tested on Hi3798MV100 hardware.

v2:
 - fix for shared reset
 - use local copy of vendor_data
v1: https://lore.kernel.org/r/20261104154542.3131916-1-mmyangfl@gmail.com/

David Yang (2):
  dmaengine: pl08x: Release the reset before reading registers
  dmaengine: pl08x: Use the channel count from the device tree

 drivers/dma/amba-pl08x.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers
  2026-11-06  7:25 [PATCH v2 0/2] dmaengine: pl08x: Support the Hi3798MV100 PL080 variant David Yang
@ 2026-11-06  7:25 ` David Yang
  2026-11-06 12:32   ` Philipp Zabel
  2026-11-06  7:25 ` [PATCH v2 2/2] dmaengine: pl08x: Use the channel count from the device tree David Yang
  1 sibling, 1 reply; 4+ messages in thread
From: David Yang @ 2026-11-06  7:25 UTC (permalink / raw)
  To: dmaengine; +Cc: David Yang, Vinod Koul, Frank Li, Philipp Zabel, linux-kernel

amba_read_periphid() happens to release the reset. A node that carries
arm,primecell-periphid never reaches it. Take the reset shared and
release it ourselves.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/dma/amba-pl08x.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 543c2eb8cfa8..9f5e4f5fb877 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -75,6 +75,7 @@
 #include <linux/of.h>
 #include <linux/of_dma.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/amba/pl080.h>
@@ -2695,6 +2696,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 	struct pl08x_driver_data *pl08x;
 	struct vendor_data *vd = id->data;
 	struct device_node *np = adev->dev.of_node;
+	struct reset_control *rst;
 	u32 tsfr_size;
 	int ret = 0;
 	int i;
@@ -2725,6 +2727,13 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 		goto out_no_ioremap;
 	}
 
+	/* Release the reset before reading registers */
+	rst = devm_reset_control_get_optional_shared_deasserted(&adev->dev, NULL);
+	if (IS_ERR(rst)) {
+		ret = PTR_ERR(rst);
+		goto out_no_platdata;
+	}
+
 	if (vd->ftdmac020) {
 		u32 val;
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] dmaengine: pl08x: Use the channel count from the device tree
  2026-11-06  7:25 [PATCH v2 0/2] dmaengine: pl08x: Support the Hi3798MV100 PL080 variant David Yang
  2026-11-06  7:25 ` [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers David Yang
@ 2026-11-06  7:25 ` David Yang
  1 sibling, 0 replies; 4+ messages in thread
From: David Yang @ 2026-11-06  7:25 UTC (permalink / raw)
  To: dmaengine; +Cc: David Yang, Vinod Koul, Frank Li, Philipp Zabel, linux-kernel

The Hi3798MV100 DMAC is a plain PL080 except for the channel count: 4
instead of 8. The part ID does not say, and the driver takes the count
from the matched vendor_data entry. The entry is shared between
instances; the adjustment lands in a private copy. dma-common.yaml
already defines dma-channels for a controller node. Honor it.

Signed-off-by: David Yang <mmyangfl@gmail.com>
---
 drivers/dma/amba-pl08x.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 9f5e4f5fb877..27c61a7f2082 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -282,7 +282,7 @@ struct pl08x_driver_data {
 	bool has_slave;
 	void __iomem *base;
 	struct amba_device *adev;
-	const struct vendor_data *vd;
+	struct vendor_data *vd;
 	struct pl08x_platform_data *pd;
 	struct pl08x_phy_chan *phy_chans;
 	struct dma_pool *pool;
@@ -2698,6 +2698,7 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 	struct device_node *np = adev->dev.of_node;
 	struct reset_control *rst;
 	u32 tsfr_size;
+	u32 channels;
 	int ret = 0;
 	int i;
 
@@ -2719,7 +2720,6 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 
 	/* Assign useful pointers to the driver state */
 	pl08x->adev = adev;
-	pl08x->vd = vd;
 
 	pl08x->base = ioremap(adev->res.start, resource_size(&adev->res));
 	if (!pl08x->base) {
@@ -2727,6 +2727,17 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 		goto out_no_ioremap;
 	}
 
+	/*
+	 * vd points into the shared id table; give the instance its own
+	 * copy before anything below starts adjusting it.
+	 */
+	pl08x->vd = devm_kmemdup(&adev->dev, vd, sizeof(*vd), GFP_KERNEL);
+	if (!pl08x->vd) {
+		ret = -ENOMEM;
+		goto out_no_platdata;
+	}
+	vd = pl08x->vd;
+
 	/* Release the reset before reading registers */
 	rst = devm_reset_control_get_optional_shared_deasserted(&adev->dev, NULL);
 	if (IS_ERR(rst)) {
@@ -2756,6 +2767,16 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id)
 		vd->dualmaster = !!(val & BIT(9));
 	}
 
+	/* Read the channel number from the node if specified */
+	if (!of_property_read_u32(np, "dma-channels", &channels) && channels) {
+		if (channels > vd->channels)
+			dev_warn(&adev->dev,
+				 "using %u channels, instead of %u from the node\n",
+				 vd->channels, channels);
+		else
+			vd->channels = channels;
+	}
+
 	/* Initialize memcpy engine */
 	dma_cap_set(DMA_MEMCPY, pl08x->memcpy.cap_mask);
 	pl08x->memcpy.dev = &adev->dev;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers
  2026-11-06  7:25 ` [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers David Yang
@ 2026-11-06 12:32   ` Philipp Zabel
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Zabel @ 2026-11-06 12:32 UTC (permalink / raw)
  To: David Yang, dmaengine; +Cc: Vinod Koul, Frank Li, linux-kernel

On Fr, 2026-11-06 at 15:25 +0800, David Yang wrote:
> amba_read_periphid() happens to release the reset. A node that carries
> arm,primecell-periphid never reaches it. Take the reset shared and
> release it ourselves.
> 
> Signed-off-by: David Yang <mmyangfl@gmail.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-06 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  7:25 [PATCH v2 0/2] dmaengine: pl08x: Support the Hi3798MV100 PL080 variant David Yang
2026-11-06  7:25 ` [PATCH v2 1/2] dmaengine: pl08x: Release the reset before reading registers David Yang
2026-11-06 12:32   ` Philipp Zabel
2026-11-06  7:25 ` [PATCH v2 2/2] dmaengine: pl08x: Use the channel count from the device tree David Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®