linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Brian Norris <computersforpeace@gmail.com>,
	Kamal Dasu <kamal.dasu@broadcom.com>
Cc: "MTD Maling List" <linux-mtd@lists.infradead.org>,
	bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>,
	"Arınç ÜNAL" <arinc.unal@arinc9.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>
Subject: Memory mapped flash access breaks Broadcom NAND controller based access
Date: Thu, 31 Aug 2023 17:30:15 +0200	[thread overview]
Message-ID: <CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com> (raw)

Hi,

Broadcom Northstar platform has SPI controller and NAND controller
v6.1. Devices can come with serial or NAND flashes (or both).

To provide early access to configuration data (NVRAM) stored on flash
Northstar provides MMIO mappings:
#define SI_NS_NANDFLASH            0x1c000000    /* NorthStar NAND flash base */
#define SI_NS_NORFLASH            0x1e000000    /* NorthStar NOR flash base */

It's possible to ioremap those and read flash content. Details:
Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
drivers/nvmem/brcm_nvram.c

The problem is that reading flash that way breaks NAND controller
based access using brcmnand driver. A simple readb() triggers errors
like:
[  120.098439] SQUASHFS error: xz decompression failed, data probably corrupt
[  120.105371] SQUASHFS error: Failed to read block 0x3b8c02: -5
[  120.111158] SQUASHFS error: Unable to read metadata cache entry [3b8c00]
[  120.117877] SQUASHFS error: Unable to read inode 0x6760785
or
[    3.120527] ubi0 error: 0xc04f0b3c: PEB 0 contains corrupted VID
header, and the data does not contain all 0xFF
[    3.130664] ubi0 error: 0xc04f0b4c: this may be a non-UBI PEB or a
severe VID header corruption which requires manual inspection

I assume that whatever hardware provides MMIO based access it
interferences with NAND controller.

Is that something that could be solved in brcmnand? Or should Linux
just don't use MMIO post-booting (after brcmnand initializes)? Is
there some generic cross-subsystem method to achieve that?

-- 
Rafał

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2023-08-31 15:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 15:30 Rafał Miłecki [this message]
2023-08-31 21:07 ` Memory mapped flash access breaks Broadcom NAND controller based access Florian Fainelli
2023-08-31 21:26 ` Scott Branden

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='CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com' \
    --to=zajec5@gmail.com \
    --cc=arinc.unal@arinc9.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=kamal.dasu@broadcom.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=srinivas.kandagatla@linaro.org \
    /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).