From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Rabara, Niravkumar L" <niravkumar.l.rabara@intel.com>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
"linux@treblig.org" <linux@treblig.org>,
Shen Lichuan <shenlichuan@vivo.com>,
Jinjie Ruan <ruanjinjie@huawei.com>,
"u.kleine-koenig@baylibre.com" <u.kleine-koenig@baylibre.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] mtd: rawnand: cadence: support deferred prob when DMA is not ready
Date: Thu, 30 Jan 2025 16:19:53 +0100 [thread overview]
Message-ID: <87msf8z5uu.fsf@bootlin.com> (raw)
In-Reply-To: <BL3PR11MB65321B556C59C995DC05C70AA2E92@BL3PR11MB6532.namprd11.prod.outlook.com> (Niravkumar L. Rabara's message of "Thu, 30 Jan 2025 03:51:08 +0000")
Hello,
>> > Driver works without external DMA interface i.e. has_dma=0.
>> > However current driver does not have a mechanism to configure it from
>> > device tree.
>>
>> What? Why are you requesting a DMA channel from a dmaengine in this case?
>>
>> Please make the distinction between the OS implementation (the driver) and
>> the DT binding which describe the HW and only the HW.
>>
>
> Let me clarify from bindings(hw) and driver prospective.
>
> Bindings :-
> Cadence NAND controller HW has MMIO registers, so called slave DMA interface
> for page programming or page read.
> reg = <0x10b80000 0x10000>,
> <0x10840000 0x10000>;
> reg-names = "reg", "sdma"; // sdma = Slave DMA data port register set
>
> It appears that dt bindings has captured sdma interface correctly.
Slave DMA is very confusing because in Linux we make the distinction
between:
1- external DMA (generic DMA controller) driven
through the dmaengine API, through which we interact using the so
called slave API
2- peripheral DMA (DMA controller embedded in the NAND IP) when there is
no "external/generic" engine. In this case we control DMA transfers
using the registers of the NAND controller (or a nearby range, in
this case), the same driver handles both the NAND and the DMA part.
You used the wording Slave DMA (#1), but it feels like you are talking
about the other (#2). Can you please confirm in which case we are?
> Linux Driver:-
> Driver can read these sdma registers directly or it can use the DMA.
> Existing driver code has hardcoded has_dma with an assumption that
> an external DMA is always used and relies on DMA API for data
> transfer.
I am sorry but DMA API does not mean much. There are 3 APIs:
- dma-mapping, for the buffers and the coherency
- dmaengine, used in case #1 only, to drive the external DMA controllers
- dma-buf to share buffers between areas in the kernel (out of scope)
> Thant is why it requires to use DMA channel from dmaengine.
If I understand it right, no :-)
Either you have an external DMA controller (#2) or an internal one (#1)
but in this second case there is no DMA channel request nor any
engine-related API. Of course you need to use the dma-mapping API for
the buffers.
> In my previous reply, I tried to describe this driver scenario but maybe I mixed up.
> has_dma=0, i.e. accessing sdma register without using dmaengine is
> also working.
But do you have an external DMA engine in the end? Or is it specific to
the NAND controller?
> However, currently there is no option in driver to choose between using dmaengine and
> direct register access.
>
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Rabara, Niravkumar L" <niravkumar.l.rabara@intel.com>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
"linux@treblig.org" <linux@treblig.org>,
Shen Lichuan <shenlichuan@vivo.com>,
Jinjie Ruan <ruanjinjie@huawei.com>,
"u.kleine-koenig@baylibre.com" <u.kleine-koenig@baylibre.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] mtd: rawnand: cadence: support deferred prob when DMA is not ready
Date: Thu, 30 Jan 2025 16:19:53 +0100 [thread overview]
Message-ID: <87msf8z5uu.fsf@bootlin.com> (raw)
In-Reply-To: <BL3PR11MB65321B556C59C995DC05C70AA2E92@BL3PR11MB6532.namprd11.prod.outlook.com> (Niravkumar L. Rabara's message of "Thu, 30 Jan 2025 03:51:08 +0000")
Hello,
>> > Driver works without external DMA interface i.e. has_dma=0.
>> > However current driver does not have a mechanism to configure it from
>> > device tree.
>>
>> What? Why are you requesting a DMA channel from a dmaengine in this case?
>>
>> Please make the distinction between the OS implementation (the driver) and
>> the DT binding which describe the HW and only the HW.
>>
>
> Let me clarify from bindings(hw) and driver prospective.
>
> Bindings :-
> Cadence NAND controller HW has MMIO registers, so called slave DMA interface
> for page programming or page read.
> reg = <0x10b80000 0x10000>,
> <0x10840000 0x10000>;
> reg-names = "reg", "sdma"; // sdma = Slave DMA data port register set
>
> It appears that dt bindings has captured sdma interface correctly.
Slave DMA is very confusing because in Linux we make the distinction
between:
1- external DMA (generic DMA controller) driven
through the dmaengine API, through which we interact using the so
called slave API
2- peripheral DMA (DMA controller embedded in the NAND IP) when there is
no "external/generic" engine. In this case we control DMA transfers
using the registers of the NAND controller (or a nearby range, in
this case), the same driver handles both the NAND and the DMA part.
You used the wording Slave DMA (#1), but it feels like you are talking
about the other (#2). Can you please confirm in which case we are?
> Linux Driver:-
> Driver can read these sdma registers directly or it can use the DMA.
> Existing driver code has hardcoded has_dma with an assumption that
> an external DMA is always used and relies on DMA API for data
> transfer.
I am sorry but DMA API does not mean much. There are 3 APIs:
- dma-mapping, for the buffers and the coherency
- dmaengine, used in case #1 only, to drive the external DMA controllers
- dma-buf to share buffers between areas in the kernel (out of scope)
> Thant is why it requires to use DMA channel from dmaengine.
If I understand it right, no :-)
Either you have an external DMA controller (#2) or an internal one (#1)
but in this second case there is no DMA channel request nor any
engine-related API. Of course you need to use the dma-mapping API for
the buffers.
> In my previous reply, I tried to describe this driver scenario but maybe I mixed up.
> has_dma=0, i.e. accessing sdma register without using dmaengine is
> also working.
But do you have an external DMA engine in the end? Or is it specific to
the NAND controller?
> However, currently there is no option in driver to choose between using dmaengine and
> direct register access.
>
Thanks,
Miquèl
next prev parent reply other threads:[~2025-01-30 15:20 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-16 3:21 [PATCH v2 0/3] mtd: rawnand: cadence: improvement and fixes niravkumar.l.rabara
2025-01-16 3:21 ` niravkumar.l.rabara
2025-01-16 3:21 ` [PATCH v2 1/3] mtd: rawnand: cadence: support deferred prob when DMA is not ready niravkumar.l.rabara
2025-01-16 3:21 ` niravkumar.l.rabara
2025-01-21 9:52 ` Miquel Raynal
2025-01-21 9:52 ` Miquel Raynal
2025-01-29 9:17 ` Rabara, Niravkumar L
2025-01-29 9:17 ` Rabara, Niravkumar L
2025-01-29 10:02 ` Miquel Raynal
2025-01-29 10:02 ` Miquel Raynal
2025-01-30 3:51 ` Rabara, Niravkumar L
2025-01-30 3:51 ` Rabara, Niravkumar L
2025-01-30 15:19 ` Miquel Raynal [this message]
2025-01-30 15:19 ` Miquel Raynal
2025-02-04 7:48 ` Rabara, Niravkumar L
2025-02-04 7:48 ` Rabara, Niravkumar L
2025-02-04 9:20 ` Miquel Raynal
2025-02-04 9:20 ` Miquel Raynal
2025-02-04 10:43 ` Rabara, Niravkumar L
2025-02-04 10:43 ` Rabara, Niravkumar L
2025-02-04 13:32 ` Miquel Raynal
2025-02-04 13:32 ` Miquel Raynal
2025-02-04 14:11 ` Rabara, Niravkumar L
2025-02-04 14:11 ` Rabara, Niravkumar L
2025-02-06 17:01 ` Miquel Raynal
2025-02-06 17:01 ` Miquel Raynal
2025-02-07 9:12 ` Rabara, Niravkumar L
2025-02-07 9:12 ` Rabara, Niravkumar L
2025-02-07 13:22 ` Miquel Raynal
2025-02-07 13:22 ` Miquel Raynal
2025-01-16 3:21 ` [PATCH v2 2/3] mtd: rawnand: cadence: use dma_map_resource for sdma address niravkumar.l.rabara
2025-01-16 3:21 ` niravkumar.l.rabara
2025-01-21 9:53 ` Miquel Raynal
2025-01-21 9:53 ` Miquel Raynal
2025-01-29 9:02 ` Rabara, Niravkumar L
2025-01-29 9:02 ` Rabara, Niravkumar L
2025-01-29 9:50 ` Miquel Raynal
2025-01-29 9:50 ` Miquel Raynal
2025-01-16 3:21 ` [PATCH v2 3/3] mtd: rawnand: cadence: fix incorrect dev context in dma_unmap_single niravkumar.l.rabara
2025-01-16 3:21 ` niravkumar.l.rabara
2025-01-21 9:54 ` Miquel Raynal
2025-01-21 9:54 ` Miquel Raynal
2025-01-29 8:58 ` Rabara, Niravkumar L
2025-01-29 8:58 ` Rabara, Niravkumar L
2025-01-29 9:48 ` Miquel Raynal
2025-01-29 9:48 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87msf8z5uu.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux@treblig.org \
--cc=niravkumar.l.rabara@intel.com \
--cc=richard@nod.at \
--cc=ruanjinjie@huawei.com \
--cc=shenlichuan@vivo.com \
--cc=stable@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.