From: Ladislav Michl <ladis@linux-mips.org>
To: Roger Quadros <rogerq@ti.com>
Cc: linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org,
Tony Lindgren <tony@atomide.com>,
Peter Ujfalusi <peter.ujfalusi@ti.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: [PATCH v4 12/16] mtd: onenand: omap2: Enable DMA by default
Date: Wed, 15 Nov 2017 11:32:09 +0100 [thread overview]
Message-ID: <20171115103209.b2wolfglkrwdjfku@lenoch> (raw)
In-Reply-To: <d2cd7de6-744c-6944-70d6-276a8530b6f5@ti.com>
On Wed, Nov 15, 2017 at 12:08:05PM +0200, Roger Quadros wrote:
> Hi,
>
> On 11/11/17 23:24, Ladislav Michl wrote:
> > DMA and R/B pin are independent on each other. Use DMA by default.
>
> Is there a R/B pin on Onenand? It looks more like it has a RDY pin and
> an INT pin (which is used for command completion interrupt).
(See also my previous answer) Yes, there's RDY and INT pin. I tried to use
the same scheme as NAND is using, but perhaps it doesn't fit too well here.
Therefore I'm proposing to keep INT pin name and use int-gpios in DT
bindings. Suggestions?
> I think the subject and message are a bit misleading.
>
> It should be something like
>
> mtd: onenand: omap2: decouple DMA enabling from INT pin availability
>
> INT pin (gpio_irq) is not really needed for DMA but only for notification
> when a command that needs wait has completed. We can still have DMA
> even without gpio_irq available.
Thanks, that's definitely better :-)
> > Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> > ---
> > Changes:
> > -v4: new patch
> >
> > drivers/mtd/onenand/omap2.c | 41 +++++++++++++++++------------------------
> > 1 file changed, 17 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c
> > index e4857a41760d..62e4ede918c4 100644
> > --- a/drivers/mtd/onenand/omap2.c
> > +++ b/drivers/mtd/onenand/omap2.c
> > @@ -152,17 +152,13 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
> > }
> >
> > reinit_completion(&c->irq_done);
> > - if (c->gpio_irq) {
> > - result = gpio_get_value(c->gpio_irq);
> > - if (result == -1) {
> > - ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS);
> > - intr = read_reg(c, ONENAND_REG_INTERRUPT);
> > - wait_err("gpio error", state, ctrl, intr);
> > - return -EIO;
> > - }
> > - } else
> > - result = 0;
> > - if (result == 0) {
> > + result = gpio_get_value(c->gpio_irq);
> > + if (result < 0) {
> > + ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS);
> > + intr = read_reg(c, ONENAND_REG_INTERRUPT);
> > + wait_err("gpio error", state, ctrl, intr);
> > + return -EIO;
> > + } else if (result == 0) {
> > int retry_cnt = 0;
> > retry:
> > if (!wait_for_completion_io_timeout(&c->irq_done,
> > @@ -513,13 +509,15 @@ static int omap2_onenand_probe(struct platform_device *pdev)
>
> We need to get rid if this code from probe.
>
> if (pdata->dma_channel < 0) {
> /* if -1, don't use DMA */
> c->gpio_irq = 0;
> }
Yes. I overlooked it when shuffling with patches. In ended in later patch, but it
really belongs here. Will fix.
> > dev_err(&pdev->dev, "Failed to request GPIO%d for "
> > "OneNAND\n", c->gpio_irq);
> > goto err_iounmap;
> > - }
> > - gpio_direction_input(c->gpio_irq);
> > + }
> > + gpio_direction_input(c->gpio_irq);
> > +
> > + if ((r = request_irq(gpio_to_irq(c->gpio_irq),
> > + omap2_onenand_interrupt, IRQF_TRIGGER_RISING,
> > + pdev->dev.driver->name, c)) < 0)
> > + goto err_release_gpio;
> >
> > - if ((r = request_irq(gpio_to_irq(c->gpio_irq),
> > - omap2_onenand_interrupt, IRQF_TRIGGER_RISING,
> > - pdev->dev.driver->name, c)) < 0)
> > - goto err_release_gpio;
> > + this->wait = omap2_onenand_wait;
> > }
> >
> > if (pdata->dma_channel >= 0) {
> > @@ -529,15 +527,11 @@ static int omap2_onenand_probe(struct platform_device *pdev)
> > dma_cap_set(DMA_MEMCPY, mask);
> >
> > c->dma_chan = dma_request_channel(mask, NULL, NULL);
> > - if (!c->dma_chan)
> > - dev_info(&pdev->dev,
> > - "failed to allocate DMA for OneNAND, "
> > - "using PIO instead\n");
>
> Why get rid of the print message? Instead we could choose to error out completely
> if a DMA channel was provided and we couldn't get it.
The point is that without pdata->dma_channel condition above, DMA is always
enabled and it seems too strict to me to fail, when driver can continue to work.
> > }
> >
> > dev_info(&pdev->dev, "initializing on CS%d, phys base 0x%08lx, virtual "
> > - "base %p, freq %d MHz\n", c->gpmc_cs, c->phys_base,
> > - c->onenand.base, c->freq);
> > + "base %p, freq %d MHz, %s mode\n", c->gpmc_cs, c->phys_base,
> > + c->onenand.base, c->freq, c->dma_chan ? "DMA" : "PIO");
See here ^. We just merely print message driver is running in PIO mode.
> > c->pdev = pdev;
> > c->mtd.priv = &c->onenand;
> > @@ -547,7 +541,6 @@ static int omap2_onenand_probe(struct platform_device *pdev)
> >
> > this = &c->onenand;
> > if (c->dma_chan) {
> > - this->wait = omap2_onenand_wait;
> > this->read_bufferram = omap2_onenand_read_bufferram;
> > this->write_bufferram = omap2_onenand_write_bufferram;
> > }
> >
>
> --
> cheers,
> -roger
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next prev parent reply other threads:[~2017-11-15 10:32 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-11 21:12 [PATCH v4 00/16] OMAP2+ OneNAND driver update Ladislav Michl
2017-11-11 21:17 ` [PATCH v4 02/16] ARM: dts: OMAP2+: Add compatible property to onenand node Ladislav Michl
2017-11-14 15:11 ` Roger Quadros
2017-11-14 23:01 ` Ladislav Michl
2017-11-14 21:39 ` Tony Lindgren
2017-11-11 21:18 ` [PATCH v4 03/16] ARM: dts: omap3-igep: Update onenand node timings Ladislav Michl
2017-11-14 15:12 ` Roger Quadros
2017-11-14 21:39 ` Tony Lindgren
2017-11-11 21:19 ` [PATCH v4 04/16] mtd: onenand: omap2: Remove regulator support Ladislav Michl
2017-11-14 15:13 ` Roger Quadros
2017-11-15 14:15 ` Sebastian Reichel
2017-11-11 21:19 ` [PATCH v4 05/16] mtd: onenand: omap2: Remove skip initial unlocking support Ladislav Michl
2017-11-14 15:14 ` Roger Quadros
2017-11-15 14:16 ` Sebastian Reichel
2017-11-11 21:20 ` [PATCH v4 06/16] mtd: onenand: omap2: Remove partitioning support from platform data Ladislav Michl
2017-11-14 15:14 ` Roger Quadros
2017-11-15 14:57 ` Sebastian Reichel
2017-11-11 21:20 ` [PATCH v4 07/16] mtd: onenand: omap2: Account waiting time as waiting on IO Ladislav Michl
2017-11-14 15:18 ` Roger Quadros
2017-11-15 15:00 ` Sebastian Reichel
2017-11-11 21:21 ` [PATCH v4 08/16] mtd: onenand: omap2: Simplify the DMA setup for various paths Ladislav Michl
2017-11-15 8:35 ` Roger Quadros
2017-11-15 15:05 ` Sebastian Reichel
2017-11-11 21:22 ` [PATCH v4 09/16] mtd: onenand: omap2: Unify OMAP2 and OMAP3 DMA implementation Ladislav Michl
2017-11-15 8:38 ` Roger Quadros
2017-11-15 15:07 ` Sebastian Reichel
2017-11-11 21:23 ` [PATCH v4 10/16] mtd: onenand: omap2: Convert to use dmaengine for memcpy Ladislav Michl
2017-11-15 8:57 ` Roger Quadros
2017-11-15 9:32 ` Ladislav Michl
2017-11-15 15:19 ` Sebastian Reichel
2017-11-11 21:24 ` [PATCH v4 11/16] mtd: onenand: omap2: Do not make delay for GPIO OMAP3 specific Ladislav Michl
2017-11-15 9:31 ` Roger Quadros
2017-11-15 15:20 ` Sebastian Reichel
2017-11-11 21:24 ` [PATCH v4 12/16] mtd: onenand: omap2: Enable DMA by default Ladislav Michl
2017-11-15 10:08 ` Roger Quadros
2017-11-15 10:32 ` Ladislav Michl [this message]
2017-11-15 10:43 ` Roger Quadros
2017-11-27 18:21 ` Ladislav Michl
2017-11-15 10:44 ` Roger Quadros
2017-11-11 21:26 ` [PATCH v4 13/16] memory: omap-gpmc: Refactor OneNAND support Ladislav Michl
2017-11-15 10:13 ` Roger Quadros
2017-11-15 10:37 ` Ladislav Michl
2017-11-11 21:27 ` [PATCH v4 14/16] mtd: onenand: omap2: Configure driver from DT Ladislav Michl
2017-11-15 10:40 ` Roger Quadros
2017-11-15 10:53 ` Ladislav Michl
2017-11-15 11:04 ` Roger Quadros
2017-11-15 11:20 ` Ladislav Michl
2017-11-15 14:41 ` Roger Quadros
2017-11-11 21:29 ` [PATCH v4 15/16] ARM: OMAP2+: Remove gpmc-onenand Ladislav Michl
2017-11-14 21:41 ` Tony Lindgren
2017-11-15 10:46 ` Roger Quadros
2017-11-11 21:29 ` [PATCH v4 16/16] ARM: dts: Nokia: Use R/B pin Ladislav Michl
2017-11-14 21:42 ` Tony Lindgren
2017-11-14 22:46 ` Ladislav Michl
2017-11-14 21:48 ` [PATCH v4 00/16] OMAP2+ OneNAND driver update Tony Lindgren
2017-11-14 22:53 ` Ladislav Michl
2017-11-15 8:10 ` Peter Ujfalusi
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=20171115103209.b2wolfglkrwdjfku@lenoch \
--to=ladis@linux-mips.org \
--cc=boris.brezillon@free-electrons.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=rogerq@ti.com \
--cc=tony@atomide.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox