* [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization
@ 2016-02-12 22:29 Robert Jarzmik
2016-02-27 1:51 ` Ezequiel Garcia
2016-03-05 3:07 ` Brian Norris
0 siblings, 2 replies; 5+ messages in thread
From: Robert Jarzmik @ 2016-02-12 22:29 UTC (permalink / raw)
To: Ezequiel Garcia, David Woodhouse, Brian Norris
Cc: linux-mtd, linux-kernel, Robert Jarzmik
When the driver is initialized in a pure device-tree platform, the
driver's probe fails allocating the dma channel :
[ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
[ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
The reason is that the DMA IO resource is not acquired through platform
resources but by OF bindings.
Fix this by ensuring that DMA IO resources are only queried in the non
device-tree case.
Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
drivers/mtd/nand/pxa3xx_nand.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index a168cbcc1086..afd487d4b67f 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1750,7 +1750,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
if (ret < 0)
return ret;
- if (use_dma) {
+ if (!np && use_dma) {
r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (r == NULL) {
dev_err(&pdev->dev,
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization
2016-02-12 22:29 [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization Robert Jarzmik
@ 2016-02-27 1:51 ` Ezequiel Garcia
2016-02-27 10:45 ` Robert Jarzmik
2016-03-05 3:07 ` Brian Norris
1 sibling, 1 reply; 5+ messages in thread
From: Ezequiel Garcia @ 2016-02-27 1:51 UTC (permalink / raw)
To: Robert Jarzmik
Cc: Ezequiel Garcia, David Woodhouse, Brian Norris,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
On 12 February 2016 at 19:29, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> When the driver is initialized in a pure device-tree platform, the
> driver's probe fails allocating the dma channel :
> [ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
> [ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
>
> The reason is that the DMA IO resource is not acquired through platform
> resources but by OF bindings.
>
> Fix this by ensuring that DMA IO resources are only queried in the non
> device-tree case.
>
> Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/mtd/nand/pxa3xx_nand.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
> index a168cbcc1086..afd487d4b67f 100644
> --- a/drivers/mtd/nand/pxa3xx_nand.c
> +++ b/drivers/mtd/nand/pxa3xx_nand.c
> @@ -1750,7 +1750,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
> if (ret < 0)
> return ret;
>
> - if (use_dma) {
> + if (!np && use_dma) {
> r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
> if (r == NULL) {
> dev_err(&pdev->dev,
Looking through the kernel tree, this change seems to be correct.
However, I'm still wondering how DMA resources are obtained in the
device-tree case. Can you explain it to me?
--
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization
2016-02-27 1:51 ` Ezequiel Garcia
@ 2016-02-27 10:45 ` Robert Jarzmik
2016-02-28 19:15 ` Ezequiel Garcia
0 siblings, 1 reply; 5+ messages in thread
From: Robert Jarzmik @ 2016-02-27 10:45 UTC (permalink / raw)
To: Ezequiel Garcia
Cc: Ezequiel Garcia, David Woodhouse, Brian Norris,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> writes:
> On 12 February 2016 at 19:29, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>> When the driver is initialized in a pure device-tree platform, the
>> driver's probe fails allocating the dma channel :
>> [ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
>> [ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
>>
>> The reason is that the DMA IO resource is not acquired through platform
>> resources but by OF bindings.
>>
>> Fix this by ensuring that DMA IO resources are only queried in the non
>> device-tree case.
>>
>> Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>> ---
>> drivers/mtd/nand/pxa3xx_nand.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
>> index a168cbcc1086..afd487d4b67f 100644
>> --- a/drivers/mtd/nand/pxa3xx_nand.c
>> +++ b/drivers/mtd/nand/pxa3xx_nand.c
>> @@ -1750,7 +1750,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
>> if (ret < 0)
>> return ret;
>>
>> - if (use_dma) {
>> + if (!np && use_dma) {
>> r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>> if (r == NULL) {
>> dev_err(&pdev->dev,
>
> Looking through the kernel tree, this change seems to be correct.
>
> However, I'm still wondering how DMA resources are obtained in the
> device-tree case. Can you explain it to me?
In the pxa case, look at my extract in [1].
The lines to consider are :
dmas = <&pdma 97 3>;
dma-names = "data";
Now have a look at the function pxad_dma_xlate() in drivers/dma/pxa_dma.c.
You'll see that the "97" ends up in the chanel drcmr, and the "3" in the
channel's prio, when the chanel is requested in the nand driver by calling
dma_request_slave_channel_compat(). In the latter case, pxad_filter_fn() is not
used, it's the pxad_dma_xlate() which is used instead.
Is this what you were looking for ?
Cheers.
--
Robert
[1] Extract of my zylonite310.dts
nand0: nand@43100000 {
compatible = "marvell,pxa3xx-nand";
reg = <0x43100000 90>;
interrupts = <45>;
clocks = <&clks CLK_NAND>;
dmas = <&pdma 97 3>;
dma-names = "data";
#address-cells = <1>;
#size-cells = <1>;
status = "disabled";
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization
2016-02-27 10:45 ` Robert Jarzmik
@ 2016-02-28 19:15 ` Ezequiel Garcia
0 siblings, 0 replies; 5+ messages in thread
From: Ezequiel Garcia @ 2016-02-28 19:15 UTC (permalink / raw)
To: Robert Jarzmik
Cc: Ezequiel Garcia, David Woodhouse, Brian Norris,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
On 27 February 2016 at 07:45, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
> Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> writes:
>
>> On 12 February 2016 at 19:29, Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>>> When the driver is initialized in a pure device-tree platform, the
>>> driver's probe fails allocating the dma channel :
>>> [ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
>>> [ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
>>>
>>> The reason is that the DMA IO resource is not acquired through platform
>>> resources but by OF bindings.
>>>
>>> Fix this by ensuring that DMA IO resources are only queried in the non
>>> device-tree case.
>>>
>>> Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
>>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>>> ---
>>> drivers/mtd/nand/pxa3xx_nand.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
>>> index a168cbcc1086..afd487d4b67f 100644
>>> --- a/drivers/mtd/nand/pxa3xx_nand.c
>>> +++ b/drivers/mtd/nand/pxa3xx_nand.c
>>> @@ -1750,7 +1750,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
>>> if (ret < 0)
>>> return ret;
>>>
>>> - if (use_dma) {
>>> + if (!np && use_dma) {
>>> r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
>>> if (r == NULL) {
>>> dev_err(&pdev->dev,
>>
>> Looking through the kernel tree, this change seems to be correct.
>>
>> However, I'm still wondering how DMA resources are obtained in the
>> device-tree case. Can you explain it to me?
>
> In the pxa case, look at my extract in [1].
> The lines to consider are :
> dmas = <&pdma 97 3>;
> dma-names = "data";
>
> Now have a look at the function pxad_dma_xlate() in drivers/dma/pxa_dma.c.
> You'll see that the "97" ends up in the chanel drcmr, and the "3" in the
> channel's prio, when the chanel is requested in the nand driver by calling
> dma_request_slave_channel_compat(). In the latter case, pxad_filter_fn() is not
> used, it's the pxad_dma_xlate() which is used instead.
>
> Is this what you were looking for ?
>
I see. That's exactly what I was missing.
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Thanks,
--
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization
2016-02-12 22:29 [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization Robert Jarzmik
2016-02-27 1:51 ` Ezequiel Garcia
@ 2016-03-05 3:07 ` Brian Norris
1 sibling, 0 replies; 5+ messages in thread
From: Brian Norris @ 2016-03-05 3:07 UTC (permalink / raw)
To: Robert Jarzmik; +Cc: Ezequiel Garcia, David Woodhouse, linux-mtd, linux-kernel
On Fri, Feb 12, 2016 at 11:29:04PM +0100, Robert Jarzmik wrote:
> When the driver is initialized in a pure device-tree platform, the
> driver's probe fails allocating the dma channel :
> [ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
> [ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
>
> The reason is that the DMA IO resource is not acquired through platform
> resources but by OF bindings.
>
> Fix this by ensuring that DMA IO resources are only queried in the non
> device-tree case.
>
> Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Applied to l2-mtd.git
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-03-05 3:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-12 22:29 [PATCH] mtd: nand: pxa3xx_nand: fix dmaengine initialization Robert Jarzmik
2016-02-27 1:51 ` Ezequiel Garcia
2016-02-27 10:45 ` Robert Jarzmik
2016-02-28 19:15 ` Ezequiel Garcia
2016-03-05 3:07 ` Brian Norris
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).