From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: Russ Dill <russ.dill@gmail.com>,
Jamie Lokier <jamie@shareable.org>,
Ben Dooks <ben-linux-arm@fluff.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
Mike Rapoport <mike@compulab.co.il>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] [MTD] [NAND] GPIO NAND flash driver
Date: Sun, 12 Oct 2008 09:28:03 +0100 [thread overview]
Message-ID: <20081012082803.GA29975@flint.arm.linux.org.uk> (raw)
In-Reply-To: <8bd0f97a0810120114p261e86bbib791eedfe0808ed8@mail.gmail.com>
On Sun, Oct 12, 2008 at 04:14:43AM -0400, Mike Frysinger wrote:
> On Sun, Oct 12, 2008 at 04:02, Mike Rapoport wrote:
> > + if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
> > + gpio_set_value(gpiomtd->plat.gpio_nwp, 0);
> > + gpio_set_value(gpiomtd->plat.gpio_nce, 1);
> > +
> > + gpio_free(gpiomtd->plat.gpio_cle);
> > + gpio_free(gpiomtd->plat.gpio_ale);
> > + gpio_free(gpiomtd->plat.gpio_nce);
> > + if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
> > + gpio_free(gpiomtd->plat.gpio_nwp);
>
> why do you bother setting the value before releasing ? when you
> release, the pin tends to go to the hardware default and on the
> Blackfin, that tends to be "tristate". are you just banking on the
> idea that the pin will stay the way it was last set before it gets
> freed ?
Maybe you should reconsider that behaviour - this is a prime example
why such behaviour is wrong. If you leave the NAND signals floating,
you're going to eat power - most CMOS based devices want inputs to be
either logic high or low, and not floating otherwise they eat power.
Moreover, you don't want to leave memory control lines floating - you
don't want them to pick up noise which may be transmitted inside the
NAND chip and may cause malfunction.
Lastly, you don't want spurious writes to the NAND memory region (think
DMA controller scribbling over memory because of some buggy driver) to
write into the NAND, or maybe cause the NAND to erase itself.
There's another reason for doing this. Think GPIO line connected to
a loudspeaker amplifier shutdown input. Do you really want that line
floating when the sound driver isn't loaded?
On ARM, certainly PXA, the last GPIO state is preserved when free'd.
> you really should be returning "ret" rather than "-ENOMEM" as many
> (most?) of the ways you'd get here will not be due to out of memory
> conditions. some error paths above will probably require you to
> manually set "ret" to something relevant ...
Probably a left over from the early days of the driver (it's 4 years old
and has been through multiple revisions to eventually turn it into what
you see today.) Yes, it should be fixed.
next prev parent reply other threads:[~2008-10-12 8:33 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-08 6:01 [PATCH] [MTD] [NAND] GPIO NAND flash driver Mike Rapoport
2008-10-08 6:20 ` Mike Frysinger
2008-10-08 7:28 ` Russell King - ARM Linux
2008-10-08 7:29 ` Mike Frysinger
2008-10-08 8:28 ` Mike Rapoport
2008-10-08 17:41 ` Mike Frysinger
2008-10-10 10:46 ` Mike Rapoport
2008-10-10 14:19 ` Jamie Lokier
2008-10-10 21:48 ` Russell King - ARM Linux
2008-10-10 22:07 ` Mike Frysinger
2008-10-12 8:02 ` Mike Rapoport
2008-10-12 8:14 ` Mike Frysinger
2008-10-12 8:28 ` Russell King - ARM Linux [this message]
2008-10-12 8:56 ` Mike Frysinger
2008-10-12 10:13 ` Russell King - ARM Linux
2008-10-12 10:35 ` David Woodhouse
2008-10-12 10:43 ` Russell King - ARM Linux
2008-10-12 15:04 ` Jamie Lokier
2008-10-12 19:04 ` Mike Frysinger
2008-10-12 19:09 ` Russell King - ARM Linux
2008-10-12 19:22 ` Mike Frysinger
2008-10-12 19:40 ` Russell King - ARM Linux
2008-10-12 10:04 ` Mike Rapoport
2008-10-13 13:59 ` David Woodhouse
2008-10-15 6:38 ` Mike Rapoport
2008-10-15 7:52 ` Russell King - ARM Linux
2008-10-15 8:25 ` Mike Rapoport
2008-10-08 8:30 ` David Woodhouse
2008-10-08 14:25 ` Paulius Zaleckas
-- strict thread matches above, loose matches on Subject: below --
2008-10-19 23:51 David Brownell
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=20081012082803.GA29975@flint.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=ben-linux-arm@fluff.org \
--cc=dwmw2@infradead.org \
--cc=jamie@shareable.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mike@compulab.co.il \
--cc=russ.dill@gmail.com \
--cc=vapier.adi@gmail.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