* [PATCH v2 0/4] k3dma: add support to reserved channels
@ 2018-07-06 3:55 Guodong Xu
2018-07-06 3:55 ` [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan Guodong Xu
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Guodong Xu @ 2018-07-06 3:55 UTC (permalink / raw)
To: vkoul, robh+dt, mark.rutland, dan.j.williams, xuwei5,
catalin.marinas, will.deacon
Cc: liyu65, suzhuangluan, xuhongtao8, zhongkaihua, xuezhiliang,
xupeng7, sunliang10, fengbaopeng, dmaengine, devicetree,
linux-kernel, linux-arm-kernel, Guodong Xu
This patchset fixes bug people found on hikey960 when allocating DMA
channels to peripherals such as SPI. It fails because the channel is
reserved and not accessible by kernel.
Patch 1, 2 and 3 add support to reserved channels for K3 DMA. Patch 4
includes a removal of axi_config who controls DMA secure/non-secure
access permission but is actually set in early stage by bootloader.
Guodong Xu (1):
arm64: dts: hi3660: update property name hisilicon,dma-min-chan
Li Yu (3):
dt-bindings: k3dma: add optional property hisilicon,dma-min-chan
k3dma: add support to reserved minimum channels
k3dma: delete axi_config
Documentation/devicetree/bindings/dma/k3dma.txt | 6 ++++++
arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 +-
drivers/dma/k3dma.c | 16 ++++++++--------
3 files changed, 15 insertions(+), 9 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan
2018-07-06 3:55 [PATCH v2 0/4] k3dma: add support to reserved channels Guodong Xu
@ 2018-07-06 3:55 ` Guodong Xu
2018-07-09 10:34 ` Vinod
2018-07-06 3:55 ` [PATCH v2 2/4] k3dma: add support to reserved minimum channels Guodong Xu
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Guodong Xu @ 2018-07-06 3:55 UTC (permalink / raw)
To: vkoul, robh+dt, mark.rutland, dan.j.williams, xuwei5,
catalin.marinas, will.deacon
Cc: liyu65, suzhuangluan, xuhongtao8, zhongkaihua, xuezhiliang,
xupeng7, sunliang10, fengbaopeng, dmaengine, devicetree,
linux-kernel, linux-arm-kernel, Guodong Xu
From: Li Yu <liyu65@hisilicon.com>
Add optional property hisilicon,dma-min-chan for k3dma.
Signed-off-by: Li Yu <liyu65@hisilicon.com>
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
---
Documentation/devicetree/bindings/dma/k3dma.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
index 4945aeac4dc4..f34202a80f3c 100644
--- a/Documentation/devicetree/bindings/dma/k3dma.txt
+++ b/Documentation/devicetree/bindings/dma/k3dma.txt
@@ -12,6 +12,11 @@ Required properties:
have specific request line
- clocks: clock required
+Optional properties:
+- hisilicon,dma-min-chan: the minimum DMA channel number which is usable
+ Default value is 0, but in some platform it is
+ configured 1, like in hi3660 platform
+
Example:
Controller:
@@ -21,6 +26,7 @@ Controller:
#dma-cells = <1>;
dma-channels = <16>;
dma-requests = <27>;
+ hisilicon,dma-min-chan = <1>;
interrupts = <0 12 4>;
clocks = <&pclk>;
};
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/4] k3dma: add support to reserved minimum channels
2018-07-06 3:55 [PATCH v2 0/4] k3dma: add support to reserved channels Guodong Xu
2018-07-06 3:55 ` [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan Guodong Xu
@ 2018-07-06 3:55 ` Guodong Xu
2018-07-06 3:55 ` [PATCH v2 3/4] arm64: dts: hi3660: update property name hisilicon,dma-min-chan Guodong Xu
2018-07-06 3:55 ` [PATCH v2 4/4] k3dma: delete axi_config Guodong Xu
3 siblings, 0 replies; 7+ messages in thread
From: Guodong Xu @ 2018-07-06 3:55 UTC (permalink / raw)
To: vkoul, robh+dt, mark.rutland, dan.j.williams, xuwei5,
catalin.marinas, will.deacon
Cc: liyu65, suzhuangluan, xuhongtao8, zhongkaihua, xuezhiliang,
xupeng7, sunliang10, fengbaopeng, dmaengine, devicetree,
linux-kernel, linux-arm-kernel, Guodong Xu
From: Li Yu <liyu65@hisilicon.com>
On k3 series of SoC, DMA controller reserves some channels for
other on-chip coprocessors. By reading property "hisilicon,dma-min-chan"
from dts node, kernel will not use these reserved channels.
As an example, on Hi3660, channel 0 is reserved for lpm3.
Refer to Documentation/devicetree/bindings/dma/k3dma.txt for more
information.
Signed-off-by: Li Yu <liyu65@hisilicon.com>
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
---
drivers/dma/k3dma.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index fa31cccbe04f..33efb541acb2 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -113,6 +113,7 @@ struct k3_dma_dev {
struct dma_pool *pool;
u32 dma_channels;
u32 dma_requests;
+ u32 dma_min_chan;
unsigned int irq;
};
@@ -309,7 +310,7 @@ 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++) {
+ for (pch = d->dma_min_chan; pch < d->dma_channels; pch++) {
p = &d->phy[pch];
if (p->vchan == NULL && !list_empty(&d->chan_pending)) {
@@ -326,7 +327,7 @@ static void k3_dma_tasklet(unsigned long arg)
}
spin_unlock_irq(&d->lock);
- for (pch = 0; pch < d->dma_channels; pch++) {
+ for (pch = d->dma_min_chan; pch < d->dma_channels; pch++) {
if (pch_alloc & (1 << pch)) {
p = &d->phy[pch];
c = p->vchan;
@@ -825,6 +826,8 @@ 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);
+ of_property_read_u32((&op->dev)->of_node,
+ "hisilicon,dma-min-chan", &d->dma_min_chan);
}
d->clk = devm_clk_get(&op->dev, NULL);
@@ -848,12 +851,12 @@ static int k3_dma_probe(struct platform_device *op)
return -ENOMEM;
/* init phy channel */
- d->phy = devm_kcalloc(&op->dev,
- d->dma_channels, sizeof(struct k3_dma_phy), GFP_KERNEL);
+ d->phy = devm_kcalloc(&op->dev, (d->dma_channels - d->dma_min_chan),
+ sizeof(struct k3_dma_phy), GFP_KERNEL);
if (d->phy == NULL)
return -ENOMEM;
- for (i = 0; i < d->dma_channels; i++) {
+ for (i = d->dma_min_chan; i < d->dma_channels; i++) {
struct k3_dma_phy *p = &d->phy[i];
p->idx = i;
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/4] arm64: dts: hi3660: update property name hisilicon,dma-min-chan
2018-07-06 3:55 [PATCH v2 0/4] k3dma: add support to reserved channels Guodong Xu
2018-07-06 3:55 ` [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan Guodong Xu
2018-07-06 3:55 ` [PATCH v2 2/4] k3dma: add support to reserved minimum channels Guodong Xu
@ 2018-07-06 3:55 ` Guodong Xu
2018-07-06 3:55 ` [PATCH v2 4/4] k3dma: delete axi_config Guodong Xu
3 siblings, 0 replies; 7+ messages in thread
From: Guodong Xu @ 2018-07-06 3:55 UTC (permalink / raw)
To: vkoul, robh+dt, mark.rutland, dan.j.williams, xuwei5,
catalin.marinas, will.deacon
Cc: liyu65, suzhuangluan, xuhongtao8, zhongkaihua, xuezhiliang,
xupeng7, sunliang10, fengbaopeng, dmaengine, devicetree,
linux-kernel, linux-arm-kernel, Guodong Xu
Update property name dma-min-chan to "hisilicon,dma-min-chan"
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
---
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 8d477dcbfa58..0cec26976eb6 100644
--- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
+++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
@@ -537,7 +537,7 @@
#dma-cells = <1>;
dma-channels = <16>;
dma-requests = <32>;
- dma-min-chan = <1>;
+ hisilicon,dma-min-chan = <1>;
interrupts = <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&crg_ctrl HI3660_CLK_GATE_DMAC>;
dma-no-cci;
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/4] k3dma: delete axi_config
2018-07-06 3:55 [PATCH v2 0/4] k3dma: add support to reserved channels Guodong Xu
` (2 preceding siblings ...)
2018-07-06 3:55 ` [PATCH v2 3/4] arm64: dts: hi3660: update property name hisilicon,dma-min-chan Guodong Xu
@ 2018-07-06 3:55 ` Guodong Xu
3 siblings, 0 replies; 7+ messages in thread
From: Guodong Xu @ 2018-07-06 3:55 UTC (permalink / raw)
To: vkoul, robh+dt, mark.rutland, dan.j.williams, xuwei5,
catalin.marinas, will.deacon
Cc: liyu65, suzhuangluan, xuhongtao8, zhongkaihua, xuezhiliang,
xupeng7, sunliang10, fengbaopeng, dmaengine, devicetree,
linux-kernel, linux-arm-kernel, Guodong Xu
From: Li Yu <liyu65@hisilicon.com>
Axi_config controls whether DMA resources can be accessed in non-secure
mode, such as linux kernel. The setting is actually done in
bootloader stage.
This patch removes axi_config from k3dma driver.
Signed-off-by: Li Yu <liyu65@hisilicon.com>
Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
---
drivers/dma/k3dma.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index 33efb541acb2..4542e703ec85 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
@@ -158,7 +156,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.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan
2018-07-06 3:55 ` [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan Guodong Xu
@ 2018-07-09 10:34 ` Vinod
2018-07-11 16:09 ` Rob Herring
0 siblings, 1 reply; 7+ messages in thread
From: Vinod @ 2018-07-09 10:34 UTC (permalink / raw)
To: Guodong Xu
Cc: robh+dt, mark.rutland, dan.j.williams, xuwei5, catalin.marinas,
will.deacon, liyu65, suzhuangluan, xuhongtao8, zhongkaihua,
xuezhiliang, xupeng7, sunliang10, fengbaopeng, dmaengine,
devicetree, linux-kernel, linux-arm-kernel
On 06-07-18, 11:55, Guodong Xu wrote:
> From: Li Yu <liyu65@hisilicon.com>
>
> Add optional property hisilicon,dma-min-chan for k3dma.
>
> Signed-off-by: Li Yu <liyu65@hisilicon.com>
> Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
> ---
> Documentation/devicetree/bindings/dma/k3dma.txt | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
> index 4945aeac4dc4..f34202a80f3c 100644
> --- a/Documentation/devicetree/bindings/dma/k3dma.txt
> +++ b/Documentation/devicetree/bindings/dma/k3dma.txt
> @@ -12,6 +12,11 @@ Required properties:
> have specific request line
> - clocks: clock required
>
> +Optional properties:
> +- hisilicon,dma-min-chan: the minimum DMA channel number which is usable
> + Default value is 0, but in some platform it is
> + configured 1, like in hi3660 platform
> +
> Example:
>
> Controller:
> @@ -21,6 +26,7 @@ Controller:
> #dma-cells = <1>;
> dma-channels = <16>;
> dma-requests = <27>;
> + hisilicon,dma-min-chan = <1>;
Am still expecting this to be a mask
--
~Vinod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan
2018-07-09 10:34 ` Vinod
@ 2018-07-11 16:09 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2018-07-11 16:09 UTC (permalink / raw)
To: Vinod, Guodong Xu
Cc: mark.rutland, dan.j.williams, xuwei5, catalin.marinas,
will.deacon, liyu65, suzhuangluan, xuhongtao8, zhongkaihua,
xuezhiliang, xupeng7, sunliang10, fengbaopeng, dmaengine,
devicetree, linux-kernel, linux-arm-kernel
On Mon, Jul 09, 2018 at 04:04:38PM +0530, Vinod wrote:
> On 06-07-18, 11:55, Guodong Xu wrote:
> > From: Li Yu <liyu65@hisilicon.com>
> >
> > Add optional property hisilicon,dma-min-chan for k3dma.
> >
> > Signed-off-by: Li Yu <liyu65@hisilicon.com>
> > Signed-off-by: Guodong Xu <guodong.xu@linaro.org>
> > ---
> > Documentation/devicetree/bindings/dma/k3dma.txt | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/dma/k3dma.txt b/Documentation/devicetree/bindings/dma/k3dma.txt
> > index 4945aeac4dc4..f34202a80f3c 100644
> > --- a/Documentation/devicetree/bindings/dma/k3dma.txt
> > +++ b/Documentation/devicetree/bindings/dma/k3dma.txt
> > @@ -12,6 +12,11 @@ Required properties:
> > have specific request line
> > - clocks: clock required
> >
> > +Optional properties:
> > +- hisilicon,dma-min-chan: the minimum DMA channel number which is usable
> > + Default value is 0, but in some platform it is
> > + configured 1, like in hi3660 platform
> > +
> > Example:
> >
> > Controller:
> > @@ -21,6 +26,7 @@ Controller:
> > #dma-cells = <1>;
> > dma-channels = <16>;
> > dma-requests = <27>;
> > + hisilicon,dma-min-chan = <1>;
>
> Am still expecting this to be a mask
If so calling it 'min' doesn't make sense. And a mask should have 'mask'
in the name.
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-07-11 16:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-06 3:55 [PATCH v2 0/4] k3dma: add support to reserved channels Guodong Xu
2018-07-06 3:55 ` [PATCH v2 1/4] dt-bindings: k3dma: add optional property hisilicon,dma-min-chan Guodong Xu
2018-07-09 10:34 ` Vinod
2018-07-11 16:09 ` Rob Herring
2018-07-06 3:55 ` [PATCH v2 2/4] k3dma: add support to reserved minimum channels Guodong Xu
2018-07-06 3:55 ` [PATCH v2 3/4] arm64: dts: hi3660: update property name hisilicon,dma-min-chan Guodong Xu
2018-07-06 3:55 ` [PATCH v2 4/4] k3dma: delete axi_config Guodong Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).