From: Boris Brezillon <boris.brezillon@collabora.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
Tudor Ambarus <tudor.ambarus@microchip.com>,
Richard Weinberger <richard@nod.at>,
Harvey Hunt <harveyhuntnexus@gmail.com>,
linux-mtd@lists.infradead.org,
Miquel Raynal <miquel.raynal@bootlin.com>
Subject: Re: [PATCH] mtd: rawnand: ingenic: Convert the driver to exec_op()
Date: Wed, 20 May 2020 01:13:59 +0200 [thread overview]
Message-ID: <20200520011359.37477358@collabora.com> (raw)
In-Reply-To: <L8KLAQ.KW09884RLNR6@crapouillou.net>
On Tue, 19 May 2020 23:12:21 +0200
Paul Cercueil <paul@crapouillou.net> wrote:
> Le mar. 19 mai 2020 à 19:28, Boris Brezillon
> <boris.brezillon@collabora.com> a écrit :
> > On Tue, 19 May 2020 17:04:37 +0200
> > Paul Cercueil <paul@crapouillou.net> wrote:
> >
> >> Le lun. 18 mai 2020 à 21:35, Boris Brezillon
> >> <boris.brezillon@collabora.com> a écrit :
> >> > On Mon, 18 May 2020 21:24:22 +0200
> >> > Boris Brezillon <boris.brezillon@collabora.com> wrote:
> >> >
> >> >> On Mon, 18 May 2020 19:50:04 +0200
> >> >> Paul Cercueil <paul@crapouillou.net> wrote:
> >> >>
> >> >> > Hi Boris,
> >> >> >
> >> >> > Le lun. 18 mai 2020 à 18:56, Boris Brezillon
> >> >> > <boris.brezillon@collabora.com> a écrit :
> >> >> > > Let's convert the driver to exec_op() to have one less
> >> driver
> >> >> relying
> >> >> > > on the legacy interface.
> >> >> >
> >> >> > Great work, thanks for that.
> >> >> >
> >> >> > However it does not work :( nand_scan() returns error -145.
> >> >>
> >> >> Looks like the R/B signal is inverted. Can you try with the
> >> >> following diff applied?
> >> >
> >> > I checked the DT, and the GPIO is indeed declared GPIO_ACTIVE_LOW,
> >> > which explain why the test is inverted. Because of DT ABI
> >> stability it
> >> > might not be an option to change that, but the signal should
> >> actually
> >> > be
> >> > declared GPIO_ACTIVE_HIGH.
> >>
> >> It depends what you consider what is the active state, is it when
> >> "busy" or "ready"? ;)
> >
> > True, this should really be documented in the generic binding part. As
> > you probably guessed from this discussion, all other drivers (and the
> > framework) is assuming "ready" is the state we're monitoring, so it's
> > effectively active high.
> >
> >>
> >> I can fix it in the devicetree, and the driver would return
> >> (gpiod_get_value_cansleep(gpiod) ^ gpiod_is_active_low(gpiod)) for
> >> compatibility with the old devicetree.
> >
> > Or you could read the raw value (gpiod_get_raw_value_cansleep()),
> > but that still means you can't move away from the old semantics
> > without
> > breaking the existing DT with the erroneous active-low. I mean,
> > active-low is still valid if someone has the R/B signal inverted,
> > but you can't discriminate when it's valid and when it's not.
> >
> > I guess having a custom helper, and documenting that the active state
> > for ingenic is BUSY would be okay. Unless you'd be willing to break
> > the backward compat for the only board that has a rb-gpios property
> > defined.
>
> What I suggest, in the probe:
>
> if (of_machine_is_compatible("qi,lb60") &&
> gpiod_is_active_low(nand->busy_gpio)) {
> gpiod_toggle_active_low(nand->busy_gpio);
> }
>
Oh, I didn't notice this gpiod_toggle_active_low() in the API.
> Then it's backward-compatible, would allow me to fix the rb-gpios in
> devicetree, and wouldn't require a custom nand_gpio_waitrdy() function.
That's indeed the best option IMHO. I'll add a patch doing that in my
v2. Thanks for the suggestion.
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2020-05-19 23:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 16:56 [PATCH] mtd: rawnand: ingenic: Convert the driver to exec_op() Boris Brezillon
2020-05-18 17:50 ` Paul Cercueil
2020-05-18 19:24 ` Boris Brezillon
2020-05-18 19:35 ` Boris Brezillon
2020-05-19 15:04 ` Paul Cercueil
2020-05-19 17:28 ` Boris Brezillon
2020-05-19 21:12 ` Paul Cercueil
2020-05-19 23:13 ` Boris Brezillon [this message]
2020-05-19 14:52 ` Paul Cercueil
2020-05-19 15:01 ` Boris Brezillon
2020-05-19 15:10 ` Paul Cercueil
2020-05-19 17:35 ` Boris Brezillon
2020-05-19 21:15 ` Paul Cercueil
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=20200520011359.37477358@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=harveyhuntnexus@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=paul@crapouillou.net \
--cc=richard@nod.at \
--cc=tudor.ambarus@microchip.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 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).