From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Romain Naour <romain.naour@smile.fr>
Cc: linux-mtd@lists.infradead.org
Subject: Re: GPMC omap nand using CS1
Date: Mon, 13 Dec 2021 18:50:21 +0100 [thread overview]
Message-ID: <20211213185021.0cb22fea@xps13> (raw)
In-Reply-To: <fb71fa47-a59f-9434-a16a-6b59da9e2646@smile.fr>
Hello Romain,
romain.naour@smile.fr wrote on Mon, 13 Dec 2021 11:18:03 +0100:
> Hello,
>
> I'm using an AM3505 cpu with two nand device, nand0 use CS0 and nand1 use CS1.
>
> The nand0 is ok but nand1 is not detected.
> I get "nand: No NAND device found"
Easy answer (support 101, sorry about that :-) ), did you check that the
CS was toggling with a scope? Just to be sure that this is a NAND
core/driver issue and not something else?
> Regarding the devicetree for nand1, I did something similar to omap3430-sdp.dts
> where the nand is on CS1.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/boot/dts/omap3430-sdp.dts?h=v5.15.6#n102
And this is precisely the reason why we switched to a new
DT representation: as long as you have a single chip, not describing
the NAND device inside a bigger "nand" node was fine. But whenever we
need to support more than one it starts to be an issue. I saw that the
logic here was to add a second nand node which, on a pure DT
representation logic is wrong: the GPMC has subnodes which are the
different controller (there is only one NAND controller there) which
should contain two NAND device subnodes with their specific properties.
Anyway, that is not how this controller is currently being described,
so let's assume creating two NAND nodes is fine at least to make it
work.
I assume you tried:
* booting with only CS0 described -> works
* booting with only CS1 described -> No NAND device found error
Am I right?
> I'm not sure this dts actually works since in nand_base.c nand_detect() call
> nand_reset(chip, 0) with cs = 0.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/mtd/nand/raw/nand_base.c?h=v5.15.6#n4945
This is indeed the first step, we always start with the first CS and
then if the first device was discovered, we check if the other CS are
wired. This only works of course if nand_scan() requests scanning more
than one CS. This is currently not the case and was already like that
for quite some time. Maybe that is why the NAND controller was
described twice in the link below, to get the probe of the controller
called twice?
Anyway if the question is 'how do I get CS1 being checked first', you
should look at the probe function which instantiate your controller.
That is where the driver is supposed to parse the DT, find the right
CS to handle and then register the NAND chip. From the core
perspective, it can use "target" 0, 1, etc, even though from the
controller perspective, target 0 for a given chip might be CS1. You can
look at "recent" drivers, like Marvell or Arasan which support several
CS.
> It seems it was possible to use two nand on gpmc (kernel 3.16):
>
> https://e2e.ti.com/support/processors-group/processors/f/processors-forum/343017/am335x-gpmc-with-two-nand-flash-in-device-tree
I honestly do not know if this ever worked or if it was supported
upstream, it is very likely, looking at the current code base, that
if you want two CS on this board you are going to need to write a
couple of patches :)
Good luck, do not hesitate if you have other specific questions.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-12-13 17:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 10:18 GPMC omap nand using CS1 Romain Naour
2021-12-13 17:50 ` Miquel Raynal [this message]
2021-12-13 18:53 ` Romain Naour
2021-12-14 8:53 ` 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=20211213185021.0cb22fea@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=linux-mtd@lists.infradead.org \
--cc=romain.naour@smile.fr \
/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