From: Brian Norris <computersforpeace@gmail.com>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Dmitry Torokhov <dtor@google.com>,
Anatol Pomazao <anatol@google.com>, Ray Jui <rjui@broadcom.com>,
Corneliu Doban <cdoban@broadcom.com>,
Jonathan Richardson <jonathar@broadcom.com>,
Florian Fainelli <f.fainelli@gmail.com>,
bcm-kernel-feedback-list@broadcom.com,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kevin Cernekee <cernekee@gmail.com>,
sbranden@broadcom.com
Subject: Re: [PATCH 0/3] mtd: nand: add Broadcom NAND controller support
Date: Mon, 9 Mar 2015 11:04:31 -0700 [thread overview]
Message-ID: <20150309180431.GW18140@ld-irv-0074> (raw)
In-Reply-To: <CACna6rz656H-K1hPaSGyOE+x4RKfqdUdnWKhff87n=0dvHB+fw@mail.gmail.com>
On Sun, Mar 08, 2015 at 11:22:40AM +0100, Rafał Miłecki wrote:
> On 8 March 2015 at 01:57, Brian Norris <computersforpeace@gmail.com> wrote:
> > 2. Endianness is a known issue with at least one other platform. On many
> > chips (spanning MIPS LE, MIPS BE, and ARM LE), NAND has been integrated
> > such that data can just be read/programmed in the native endianness
> > through the FLASH_CACHE registers (as this driver does), but there are a
> > few (on ARM, LE) that require a be32_to_cpu()/cpu_to_be32() swap. I'm
> > considering supporting DT properties like one of the following:
> >
> > brcm,nand-cache-be
> > brcm,nand-cache-big-endian
> > brcm,nand-cache-reverse-endian
> >
> > You might also check (though I might actually be better equipped for
> > this) if there is a separate register that can tell the NAND data bus to
> > automatically endian-swap data into the native endianness. I know a lot
> > of the buses and peripherals in BCG, at least, are designed such that
> > either (1) they can work naturally in the CPU's native endianness or
> > else (2) they can be configured to swap endianness into either format.
> >
> > But if such a register does not exist, then we'll definitely have to do
> > something like the DT property above.
>
> It seems there is such a magic register. Please take a look at bcm_nand.c:
> https://dev.openwrt.org/browser/trunk/target/linux/bcm53xx/patches-3.18/420-mtd-bcm5301x_nand.patch
>
> There are multiple places (data, OOB, reads, writes) with:
So you do data and OOB in little endian? At least that seems consistent.
> /* Set controller to Little Endian mode for copying */
> bcmnand_reg_awrite(ctrl, NANDC_IDM_APB_LITTLE_ENDIAN, 1);
>
> /* Return to Big Endian mode for commands etc */
> bcmnand_reg_awrite(ctrl, NANDC_IDM_APB_LITTLE_ENDIAN, 0);
>
> That register is 0x408, but it's in "agent" core (AKA wrapper), so
> it's separated mapping. I'm not sure what address is it right now, as
> we read them from the EROM.
>
>
> > Do the bad block markers look OK without extra endian swapping? I'm
> > wondering whether the swapping will have to occur on both the
> > FLASH_CACHE and SPARE_AREA registers.
>
> I don't know, I didn't try nand-on-flash-bbt.
You don't have to use on-flash BBT to notice. Without a flash-based BBT,
you should just be scanning for bad block markers on *every* boot. Do
you read factory-marked bad block markers correctly? Or maybe you see no
factory bad blocks?
Note that this is sometimes hard to tell, if the factory just programmed
the entire page + OOB to 0x00; then you obviously don't have to worry
about endianness. But if they programmed a word of 0xffffff00, then you
definitely do need to care!
Brian
next prev parent reply other threads:[~2015-03-09 18:04 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-07 1:18 [PATCH 0/3] mtd: nand: add Broadcom NAND controller support Brian Norris
2015-03-07 1:18 ` [PATCH 1/3] mtd: nand: add common DT init code Brian Norris
2015-03-07 1:18 ` [PATCH 2/3] Documentation: devicetree: add binding doc for Broadcom NAND controller Brian Norris
2015-03-16 18:49 ` Florian Fainelli
[not found] ` <1425691129-1150-3-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-16 23:07 ` Scott Branden
[not found] ` <55076247.4070104-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-03-16 23:37 ` Brian Norris
2015-03-16 23:40 ` Scott Branden
2015-03-16 23:46 ` Brian Norris
2015-03-16 23:52 ` Scott Branden
2015-03-07 1:18 ` [PATCH 3/3] mtd: nand: add NAND driver for Broadcom STB " Brian Norris
2015-03-07 12:39 ` Paul Bolle
2015-03-09 17:30 ` Brian Norris
2015-03-07 17:39 ` Rafał Miłecki
[not found] ` <CACna6rzkEQu+LYchckFpLLxkvyMYK7N84nrGu8p0rjRsRbFzfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-07 21:48 ` Rafał Miłecki
2015-03-08 0:44 ` Rafał Miłecki
2015-03-09 17:49 ` Brian Norris
2015-03-09 17:57 ` Ray Jui
[not found] ` <1425691129-1150-4-git-send-email-computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-03-07 13:21 ` Rafał Miłecki
2015-03-09 17:31 ` Brian Norris
2015-03-07 22:15 ` Rafał Miłecki
2015-03-16 18:55 ` Florian Fainelli
2015-03-19 1:49 ` Brian Norris
2015-03-16 19:58 ` Florian Fainelli
2015-03-08 0:01 ` [PATCH 0/3] mtd: nand: add Broadcom NAND controller support Rafał Miłecki
2015-03-08 0:57 ` Brian Norris
2015-03-08 10:22 ` Rafał Miłecki
2015-03-09 18:04 ` Brian Norris [this message]
2015-03-08 11:18 ` Rafał Miłecki
2015-03-09 17:59 ` Brian Norris
[not found] ` <CALj_zD5rW3Se27Rh0pL6QTMNGOrrmrvAVLvW3BCuF8RujYQE=g@mail.gmail.com>
2015-03-16 23:44 ` Brian Norris
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=20150309180431.GW18140@ld-irv-0074 \
--to=computersforpeace@gmail.com \
--cc=anatol@google.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=cdoban@broadcom.com \
--cc=cernekee@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dtor@google.com \
--cc=f.fainelli@gmail.com \
--cc=jonathar@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=zajec5@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