2019-01-10 17:37:19

by John Stultz

[permalink] [raw]
Subject: [PATCH 0/8 v3] k3dma patches to add support for hi3660/HiKey960

This patch series is based on recent work by Tanglei Han, and
adds support for hi3660 SoCs as found on the HiKey960 board,
along with a few patches I've been carrying.

Review and feedback would be greatly appreciated!

thanks
-john

Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Guodong Xu <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Ryan Grachek <[email protected]>
CC: [email protected]
Cc: [email protected]
Cc: [email protected]

John Stultz (3):
Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan
arm64: dts: hi3660: Add dma to uart nodes
arm64: dts: hi3660: Fixup unofficial dma-min-chan to
hisi-dma-avail-chan

Li Yu (2):
dma: k3dma: Delete axi_config
dma: k3dma: Add support for hisi-dma-avail-chan

Youlin Wang (3):
Documentation: bindings: k3dma: Extend the k3dma driver binding to
support hisi-asp
dma: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware
arm64: dts: hi3660: Add hisi asp dma device

Documentation/devicetree/bindings/dma/k3dma.txt | 7 ++-
arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 20 ++++++++-
drivers/dma/k3dma.c | 60 +++++++++++++++++++++----
3 files changed, 76 insertions(+), 11 deletions(-)

--
2.7.4



2019-01-10 17:35:57

by John Stultz

[permalink] [raw]
Subject: [PATCH 2/8 v3] Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan

Some dma channels can be reserved for secure mode or other
hardware on the SoC, so provide a binding for a bitmask
listing the available channels for the kernel to use.

Cc: Vinod Koul <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: John Stultz <[email protected]>
---
v3: Renamed to hisi-dma-avail-chan
---
Documentation/devicetree/bindings/dma/k3dma.txt | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
index 10a2f15..38825d4 100644
--- a/Documentation/devicetree/bindings/dma/k3dma.txt
+++ b/Documentation/devicetree/bindings/dma/k3dma.txt
@@ -14,6 +14,9 @@ Required properties:
have specific request line
- clocks: clock required

+Optional properties:
+- hisi-dma-avail-chan: Bitmask of available physical channels
+
Example:

Controller:
--
2.7.4


2019-01-10 17:36:11

by John Stultz

[permalink] [raw]
Subject: [PATCH 7/8 v3] arm64: dts: hi3660: Add hisi asp dma device

From: Youlin Wang <[email protected]>

Add asp-dma device to hi3660 dts

Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: [email protected]
Cc: [email protected]
Acked-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Youlin Wang <[email protected]>
Signed-off-by: Tanglei Han <[email protected]>
Signed-off-by: John Stultz <[email protected]>
---
v2: Removed undocumented bindings
---
arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 4c8d682..77a7135 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -567,6 +567,16 @@
dma-type = "hi3660_dma";
};

+ asp_dmac: dma-controller@e804b000 {
+ compatible = "hisilicon,hisi-pcm-asp-dma-1.0";
+ reg = <0x0 0xe804b000 0x0 0x1000>;
+ #dma-cells = <1>;
+ dma-channels = <16>;
+ dma-requests = <32>;
+ interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "asp_dma_irq";
+ };
+
rtc0: rtc@fff04000 {
compatible = "arm,pl031", "arm,primecell";
reg = <0x0 0Xfff04000 0x0 0x1000>;
--
2.7.4


2019-01-10 17:36:11

by John Stultz

[permalink] [raw]
Subject: [PATCH 5/8 v3] dma: k3dma: Add support for hisi-dma-avail-chan

From: Li Yu <[email protected]>

Add hisi-dma-avail-chan as a property for k3dma, it defines
available dma channels which a non-secure mode driver can use.

One sample usage of this is in Hi3660 SoC. DMA channel 0 is
reserved to lpm3, which is a coprocessor for power management. So
as a result, any request in kernel (which runs on main processor
and in non-secure mode) should start from at least channel 1.

Cc: Dan Williams <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Guodong Xu <[email protected]>
Cc: [email protected]
Signed-off-by: Li Yu <[email protected]>
[jstultz: Reworked to use a channel mask]
Signed-off-by: John Stultz <[email protected]>
---
v3: Rename to hisi-dma-avail-chan
---
drivers/dma/k3dma.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index b2060bf..f4001ca 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -111,6 +111,7 @@ struct k3_dma_dev {
struct dma_pool *pool;
u32 dma_channels;
u32 dma_requests;
+ u32 dma_avail_chan;
unsigned int irq;
};

@@ -318,6 +319,9 @@ static void k3_dma_tasklet(unsigned long arg)
/* check new channel request in d->chan_pending */
spin_lock_irq(&d->lock);
for (pch = 0; pch < d->dma_channels; pch++) {
+ if (!(d->dma_avail_chan & (1<<pch)))
+ continue;
+
p = &d->phy[pch];

if (p->vchan == NULL && !list_empty(&d->chan_pending)) {
@@ -335,6 +339,9 @@ static void k3_dma_tasklet(unsigned long arg)
spin_unlock_irq(&d->lock);

for (pch = 0; pch < d->dma_channels; pch++) {
+ if (!(d->dma_avail_chan & (1<<pch)))
+ continue;
+
if (pch_alloc & (1 << pch)) {
p = &d->phy[pch];
c = p->vchan;
@@ -855,6 +862,13 @@ static int k3_dma_probe(struct platform_device *op)
"dma-channels", &d->dma_channels);
of_property_read_u32((&op->dev)->of_node,
"dma-requests", &d->dma_requests);
+ ret = of_property_read_u32((&op->dev)->of_node,
+ "hisi-dma-avail-chan", &d->dma_avail_chan);
+ if (ret) {
+ dev_warn(&op->dev,
+ "hisi-dma-avail-chan doesn't exist, considering all as available.\n");
+ d->dma_avail_chan = (u32)~0UL;
+ }
}

if (!(soc_data->flags & K3_FLAG_NOCLK)) {
@@ -886,8 +900,12 @@ static int k3_dma_probe(struct platform_device *op)
return -ENOMEM;

for (i = 0; i < d->dma_channels; i++) {
- struct k3_dma_phy *p = &d->phy[i];
+ struct k3_dma_phy *p;
+
+ if (!(d->dma_avail_chan & (1<<i)))
+ continue;

+ p = &d->phy[i];
p->idx = i;
p->base = d->base + i * 0x40;
}
--
2.7.4


2019-01-10 17:36:14

by John Stultz

[permalink] [raw]
Subject: [PATCH 3/8 v3] dma: k3dma: Upgrade k3dma driver to support hisi_asp_dma hardware

From: Youlin Wang <[email protected]>

On the hi3660 hardware there are two (at least) DMA controllers,
the DMA-P (Peripherial DMA) and the DMA-A (Audio DMA). The
two blocks are similar, but have some slight differences. This
resulted in the vendor implementing two separate drivers, which
after review, they have been able to condense and re-use the
existing k3dma driver.

Thus, this patch adds support for the new "hisi-pcm-asp-dma-1.0"
compatible string in the binding.

One difference with the DMA-A controller, is that it does not
need to initialize a clock. So we skip this by adding and using
soc data flags.

After above this driver will support both k3 and hisi_asp dma
hardware.

Cc: Dan Williams <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: [email protected]
Acked-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Youlin Wang <[email protected]>
Signed-off-by: Tanglei Han <[email protected]>
[jstultz: Reworked to use of_match_data, commit msg improvements]
Signed-off-by: John Stultz <[email protected]>
---
v2:
* Reworked to use of_match_data
v3:
* Further rework of the commit message
---
drivers/dma/k3dma.c | 37 ++++++++++++++++++++++++++++++++-----
1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index fdec2b6..df61406 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -116,6 +116,13 @@ struct k3_dma_dev {
unsigned int irq;
};

+
+#define K3_FLAG_NOCLK (1<<0)
+struct k3dma_soc_data {
+ unsigned long flags;
+};
+
+
#define to_k3_dma(dmadev) container_of(dmadev, struct k3_dma_dev, slave)

static int k3_dma_config_write(struct dma_chan *chan,
@@ -790,8 +797,21 @@ static int k3_dma_transfer_resume(struct dma_chan *chan)
return 0;
}

+static const struct k3dma_soc_data k3_v1_dma_data = {
+ .flags = 0,
+};
+
+static const struct k3dma_soc_data asp_v1_dma_data = {
+ .flags = K3_FLAG_NOCLK,
+};
+
static const struct of_device_id k3_pdma_dt_ids[] = {
- { .compatible = "hisilicon,k3-dma-1.0", },
+ { .compatible = "hisilicon,k3-dma-1.0",
+ .data = &k3_v1_dma_data
+ },
+ { .compatible = "hisilicon,hisi-pcm-asp-dma-1.0",
+ .data = &asp_v1_dma_data
+ },
{}
};
MODULE_DEVICE_TABLE(of, k3_pdma_dt_ids);
@@ -810,6 +830,7 @@ static struct dma_chan *k3_of_dma_simple_xlate(struct of_phandle_args *dma_spec,

static int k3_dma_probe(struct platform_device *op)
{
+ const struct k3dma_soc_data *soc_data;
struct k3_dma_dev *d;
const struct of_device_id *of_id;
struct resource *iores;
@@ -823,6 +844,10 @@ static int k3_dma_probe(struct platform_device *op)
if (!d)
return -ENOMEM;

+ soc_data = device_get_match_data(&op->dev);
+ if (!soc_data)
+ return -EINVAL;
+
d->base = devm_ioremap_resource(&op->dev, iores);
if (IS_ERR(d->base))
return PTR_ERR(d->base);
@@ -835,10 +860,12 @@ static int k3_dma_probe(struct platform_device *op)
"dma-requests", &d->dma_requests);
}

- d->clk = devm_clk_get(&op->dev, NULL);
- if (IS_ERR(d->clk)) {
- dev_err(&op->dev, "no dma clk\n");
- return PTR_ERR(d->clk);
+ if (!(soc_data->flags & K3_FLAG_NOCLK)) {
+ d->clk = devm_clk_get(&op->dev, NULL);
+ if (IS_ERR(d->clk)) {
+ dev_err(&op->dev, "no dma clk\n");
+ return PTR_ERR(d->clk);
+ }
}

irq = platform_get_irq(op, 0);
--
2.7.4


2019-01-10 17:36:14

by John Stultz

[permalink] [raw]
Subject: [PATCH 6/8 v3] arm64: dts: hi3660: Add dma to uart nodes

Try to add DMA support to the uart nodes following
the assignments made in the dts from the victoria vendor kernel
here:
https://consumer.huawei.com/en/opensource/detail/?siteCode=worldwide&keywords=p10&fileType=openSourceSoftware&pageSize=10&curPage=1

Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: John Stultz <[email protected]>
---
v3:
* Remove dma enablment on uart0 which would use reserved channel 0
---
arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 20ae40d..4c8d682 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -478,6 +478,8 @@
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xfdf00000 0x0 0x1000>;
interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 2 &dma0 3>;
clocks = <&crg_ctrl HI3660_CLK_GATE_UART1>,
<&crg_ctrl HI3660_CLK_GATE_UART1>;
clock-names = "uartclk", "apb_pclk";
@@ -490,6 +492,8 @@
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xfdf03000 0x0 0x1000>;
interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 4 &dma0 5>;
clocks = <&crg_ctrl HI3660_CLK_GATE_UART2>,
<&crg_ctrl HI3660_PCLK>;
clock-names = "uartclk", "apb_pclk";
@@ -514,6 +518,8 @@
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xfdf01000 0x0 0x1000>;
interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 6 &dma0 7>;
clocks = <&crg_ctrl HI3660_CLK_GATE_UART4>,
<&crg_ctrl HI3660_CLK_GATE_UART4>;
clock-names = "uartclk", "apb_pclk";
@@ -526,6 +532,8 @@
compatible = "arm,pl011", "arm,primecell";
reg = <0x0 0xfdf05000 0x0 0x1000>;
interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+ dma-names = "rx", "tx";
+ dmas = <&dma0 8 &dma0 9>;
clocks = <&crg_ctrl HI3660_CLK_GATE_UART5>,
<&crg_ctrl HI3660_CLK_GATE_UART5>;
clock-names = "uartclk", "apb_pclk";
--
2.7.4


2019-01-10 17:36:39

by John Stultz

[permalink] [raw]
Subject: [PATCH 4/8 v3] dma: k3dma: Delete axi_config

From: Li Yu <[email protected]>

Axi_config controls whether DMA resources can be accessed in non-secure
mode, such as linux kernel. The register should be set by the bootloader
stage and depends on the device.

Thus, this patch removes axi_config from k3dma driver.

Cc: Dan Williams <[email protected]>
Cc: Vinod Koul <[email protected]>
Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: [email protected]
Acked-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Li Yu <[email protected]>
Signed-off-by: Guodong Xu <[email protected]>
[jstultz: Minor tweaks to commit message]
Signed-off-by: John Stultz <[email protected]>
---
drivers/dma/k3dma.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index df61406..b2060bf 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -52,8 +52,6 @@
#define CX_SRC 0x814
#define CX_DST 0x818
#define CX_CFG 0x81c
-#define AXI_CFG 0x820
-#define AXI_CFG_DEFAULT 0x201201

#define CX_LLI_CHAIN_EN 0x2
#define CX_CFG_EN 0x1
@@ -168,7 +166,6 @@ static void k3_dma_set_desc(struct k3_dma_phy *phy, struct k3_desc_hw *hw)
writel_relaxed(hw->count, phy->base + CX_CNT0);
writel_relaxed(hw->saddr, phy->base + CX_SRC);
writel_relaxed(hw->daddr, phy->base + CX_DST);
- writel_relaxed(AXI_CFG_DEFAULT, phy->base + AXI_CFG);
writel_relaxed(hw->config, phy->base + CX_CFG);
}

--
2.7.4


2019-01-10 17:36:57

by John Stultz

[permalink] [raw]
Subject: [PATCH 1/8 v3] Documentation: bindings: k3dma: Extend the k3dma driver binding to support hisi-asp

From: Youlin Wang <[email protected]>

Extend the k3dma driver binding to support hisi-asp hardware
variants.

Cc: Vinod Koul <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Tanglei Han <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Youlin Wang <[email protected]>
Signed-off-by: Tanglei Han <[email protected]>
Signed-off-by: John Stultz <[email protected]>
---
v2: Simplify patch, removing extranious examples
---
Documentation/devicetree/bindings/dma/k3dma.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
index 4945aea..10a2f15 100644
--- a/Documentation/devicetree/bindings/dma/k3dma.txt
+++ b/Documentation/devicetree/bindings/dma/k3dma.txt
@@ -3,7 +3,9 @@
See dma.txt first

Required properties:
-- compatible: Should be "hisilicon,k3-dma-1.0"
+- compatible: Must be one of
+- "hisilicon,k3-dma-1.0"
+- "hisilicon,hisi-pcm-asp-dma-1.0"
- reg: Should contain DMA registers location and length.
- interrupts: Should contain one interrupt shared by all channel
- #dma-cells: see dma.txt, should be 1, para number
--
2.7.4


2019-01-10 20:12:02

by John Stultz

[permalink] [raw]
Subject: [PATCH 8/8 v3] arm64: dts: hi3660: Fixup unofficial dma-min-chan to hisi-dma-avail-chan

A undocumented and unimplemented binding got into the hi3660
dtsi, and this switches that binding to the now documented one.

Cc: Tanglei Han <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Ryan Grachek <[email protected]>
Cc: Manivannan Sadhasivam <[email protected]>
Cc: Wei Xu <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: John Stultz <[email protected]>
---
v3: Renamed to hisi-dma-avail-chan
---
arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
index 77a7135..472c370a3d 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -560,7 +560,7 @@
#dma-cells = <1>;
dma-channels = <16>;
dma-requests = <32>;
- dma-min-chan = <1>;
+ hisi-dma-avail-chan = <0xfffe>;
interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&crg_ctrl HI3660_CLK_GATE_DMAC>;
dma-no-cci;
--
2.7.4


2019-01-11 21:12:57

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 2/8 v3] Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan

On Thu, Jan 10, 2019 at 11:34 AM John Stultz <[email protected]> wrote:
>
> Some dma channels can be reserved for secure mode or other
> hardware on the SoC, so provide a binding for a bitmask
> listing the available channels for the kernel to use.
>
> Cc: Vinod Koul <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Tanglei Han <[email protected]>
> Cc: Zhuangluan Su <[email protected]>
> Cc: Ryan Grachek <[email protected]>
> Cc: Manivannan Sadhasivam <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: John Stultz <[email protected]>
> ---
> v3: Renamed to hisi-dma-avail-chan
> ---
> Documentation/devicetree/bindings/dma/k3dma.txt | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
> index 10a2f15..38825d4 100644
> --- a/Documentation/devicetree/bindings/dma/k3dma.txt
> +++ b/Documentation/devicetree/bindings/dma/k3dma.txt
> @@ -14,6 +14,9 @@ Required properties:
> have specific request line
> - clocks: clock required
>
> +Optional properties:
> +- hisi-dma-avail-chan: Bitmask of available physical channels

Not quite right. Should be: hisilicon,dma-avail-chan

2019-01-11 21:14:01

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 2/8 v3] Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan

On Fri, Jan 11, 2019 at 1:58 PM Rob Herring <[email protected]> wrote:
>
> On Thu, Jan 10, 2019 at 11:34 AM John Stultz <[email protected]> wrote:
> >
> > Some dma channels can be reserved for secure mode or other
> > hardware on the SoC, so provide a binding for a bitmask
> > listing the available channels for the kernel to use.
> >
> > Cc: Vinod Koul <[email protected]>
> > Cc: Rob Herring <[email protected]>
> > Cc: Mark Rutland <[email protected]>
> > Cc: Tanglei Han <[email protected]>
> > Cc: Zhuangluan Su <[email protected]>
> > Cc: Ryan Grachek <[email protected]>
> > Cc: Manivannan Sadhasivam <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Signed-off-by: John Stultz <[email protected]>
> > ---
> > v3: Renamed to hisi-dma-avail-chan
> > ---
> > Documentation/devicetree/bindings/dma/k3dma.txt | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
> > index 10a2f15..38825d4 100644
> > --- a/Documentation/devicetree/bindings/dma/k3dma.txt
> > +++ b/Documentation/devicetree/bindings/dma/k3dma.txt
> > @@ -14,6 +14,9 @@ Required properties:
> > have specific request line
> > - clocks: clock required
> >
> > +Optional properties:
> > +- hisi-dma-avail-chan: Bitmask of available physical channels
>
> Not quite right. Should be: hisilicon,dma-avail-chan

Actually, we already have the same case elsewhere with
'brcm,dma-channel-mask'. Maybe there are others. So make the property
common (i.e. documented in dma.txt) and called 'dma-channel-mask'.

Whether or not the dmaengine handles this or not is irrelevant to
whether the binding is common or not. I have no say over OS design
decisions.

Rob

2019-01-11 21:34:15

by John Stultz

[permalink] [raw]
Subject: Re: [PATCH 2/8 v3] Documentation: bindings: k3dma: Add binding for hisi-dma-avail-chan

On Fri, Jan 11, 2019 at 12:04 PM Rob Herring <[email protected]> wrote:
>
> On Fri, Jan 11, 2019 at 1:58 PM Rob Herring <[email protected]> wrote:
> >
> > On Thu, Jan 10, 2019 at 11:34 AM John Stultz <[email protected]> wrote:
> > >
> > > Some dma channels can be reserved for secure mode or other
> > > hardware on the SoC, so provide a binding for a bitmask
> > > listing the available channels for the kernel to use.
> > >
> > > Cc: Vinod Koul <[email protected]>
> > > Cc: Rob Herring <[email protected]>
> > > Cc: Mark Rutland <[email protected]>
> > > Cc: Tanglei Han <[email protected]>
> > > Cc: Zhuangluan Su <[email protected]>
> > > Cc: Ryan Grachek <[email protected]>
> > > Cc: Manivannan Sadhasivam <[email protected]>
> > > Cc: [email protected]
> > > Cc: [email protected]
> > > Signed-off-by: John Stultz <[email protected]>
> > > ---
> > > v3: Renamed to hisi-dma-avail-chan
> > > ---
> > > Documentation/devicetree/bindings/dma/k3dma.txt | 3 +++
> > > 1 file changed, 3 insertions(+)
> > >
> > > diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
> > > index 10a2f15..38825d4 100644
> > > --- a/Documentation/devicetree/bindings/dma/k3dma.txt
> > > +++ b/Documentation/devicetree/bindings/dma/k3dma.txt
> > > @@ -14,6 +14,9 @@ Required properties:
> > > have specific request line
> > > - clocks: clock required
> > >
> > > +Optional properties:
> > > +- hisi-dma-avail-chan: Bitmask of available physical channels
> >
> > Not quite right. Should be: hisilicon,dma-avail-chan
>
> Actually, we already have the same case elsewhere with
> 'brcm,dma-channel-mask'. Maybe there are others. So make the property
> common (i.e. documented in dma.txt) and called 'dma-channel-mask'.

Ok. I'll rework it for that then.

> Whether or not the dmaengine handles this or not is irrelevant to
> whether the binding is common or not. I have no say over OS design
> decisions.

Ok. I'll keep it in the driver for now unless otherwise directed.

Thanks so much for the review!
-john

2019-01-17 16:08:41

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/8 v3] Documentation: bindings: k3dma: Extend the k3dma driver binding to support hisi-asp

On Thu, 10 Jan 2019 09:34:05 -0800, John Stultz wrote:
> From: Youlin Wang <[email protected]>
>
> Extend the k3dma driver binding to support hisi-asp hardware
> variants.
>
> Cc: Vinod Koul <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: Zhuangluan Su <[email protected]>
> Cc: Tanglei Han <[email protected]>
> Cc: Ryan Grachek <[email protected]>
> Cc: Manivannan Sadhasivam <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Youlin Wang <[email protected]>
> Signed-off-by: Tanglei Han <[email protected]>
> Signed-off-by: John Stultz <[email protected]>
> ---
> v2: Simplify patch, removing extranious examples
> ---
> Documentation/devicetree/bindings/dma/k3dma.txt | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Rob Herring <[email protected]>


2019-01-17 16:59:12

by Manivannan Sadhasivam

[permalink] [raw]
Subject: Re: [PATCH 6/8 v3] arm64: dts: hi3660: Add dma to uart nodes

On Thu, Jan 10, 2019 at 09:34:10AM -0800, John Stultz wrote:
> Try to add DMA support to the uart nodes following
> the assignments made in the dts from the victoria vendor kernel
> here:
> https://consumer.huawei.com/en/opensource/detail/?siteCode=worldwide&keywords=p10&fileType=openSourceSoftware&pageSize=10&curPage=1
>
> Cc: Tanglei Han <[email protected]>
> Cc: Zhuangluan Su <[email protected]>
> Cc: Ryan Grachek <[email protected]>
> Cc: Manivannan Sadhasivam <[email protected]>
> Cc: Wei Xu <[email protected]>
> Cc: Rob Herring <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: John Stultz <[email protected]>

Acked-by: Manivannan Sadhasivam <[email protected]>

Thanks,
Mani

> ---
> v3:
> * Remove dma enablment on uart0 which would use reserved channel 0
> ---
> arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> index 20ae40d..4c8d682 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> @@ -478,6 +478,8 @@
> compatible = "arm,pl011", "arm,primecell";
> reg = <0x0 0xfdf00000 0x0 0x1000>;
> interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
> + dma-names = "rx", "tx";
> + dmas = <&dma0 2 &dma0 3>;
> clocks = <&crg_ctrl HI3660_CLK_GATE_UART1>,
> <&crg_ctrl HI3660_CLK_GATE_UART1>;
> clock-names = "uartclk", "apb_pclk";
> @@ -490,6 +492,8 @@
> compatible = "arm,pl011", "arm,primecell";
> reg = <0x0 0xfdf03000 0x0 0x1000>;
> interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
> + dma-names = "rx", "tx";
> + dmas = <&dma0 4 &dma0 5>;
> clocks = <&crg_ctrl HI3660_CLK_GATE_UART2>,
> <&crg_ctrl HI3660_PCLK>;
> clock-names = "uartclk", "apb_pclk";
> @@ -514,6 +518,8 @@
> compatible = "arm,pl011", "arm,primecell";
> reg = <0x0 0xfdf01000 0x0 0x1000>;
> interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
> + dma-names = "rx", "tx";
> + dmas = <&dma0 6 &dma0 7>;
> clocks = <&crg_ctrl HI3660_CLK_GATE_UART4>,
> <&crg_ctrl HI3660_CLK_GATE_UART4>;
> clock-names = "uartclk", "apb_pclk";
> @@ -526,6 +532,8 @@
> compatible = "arm,pl011", "arm,primecell";
> reg = <0x0 0xfdf05000 0x0 0x1000>;
> interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
> + dma-names = "rx", "tx";
> + dmas = <&dma0 8 &dma0 9>;
> clocks = <&crg_ctrl HI3660_CLK_GATE_UART5>,
> <&crg_ctrl HI3660_CLK_GATE_UART5>;
> clock-names = "uartclk", "apb_pclk";
> --
> 2.7.4
>