public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] mtd partitions go away
Date: Thu, 15 Nov 2018 15:21:31 +0100	[thread overview]
Message-ID: <20181115152131.422bdd77@bbrezillon> (raw)
In-Reply-To: <43906f4b-d2d9-7efe-aa03-f361606bca3c@gmail.com>

On Thu, 15 Nov 2018 14:48:49 +0100
Marek Vasut <marek.vasut@gmail.com> wrote:

> On 11/15/2018 11:14 AM, Heiko Schocher wrote:
> > Hello all,
> > 
> > just see with current HEAD of u-boot on an imx6ull based board with SPI NOR
> > and NAND following behaviour:  
> 
> +CC Boris, since he was recently looking into this stuff.
> 
> > => mtdparts  
> > 
> > device nand0 <gpmi-nand>, # parts = 1
> >  #: name                size            offset          mask_flags
> >  0: ubi                 0x08000000      0x00000000      0
> > 
> > device nor0 <spi1.0>, # parts = 5
> >  #: name                size            offset          mask_flags
> >  0: spl                 0x00010000      0x00000000      0
> >  1: u-boot              0x000c0000      0x00010000      0
> >  2: env                 0x00010000      0x000d0000      0
> >  3: env-red             0x00010000      0x000e0000      0
> >  4: rescue              0x00710000      0x000f0000      0
> > 
> > active partition: nand0,0 - (ubi) 0x08000000 @ 0x00000000
> > 
> > defaults:
> > mtdids  : nand0=gpmi-nand,nor0=spi1.0
> > mtdparts:
> > mtdparts=gpmi-nand:-(ubi);spi1.0:64k(spl),768k(u-boot),64k(env),64k(env-red),-(rescue)
> >   
> > =>  
> >   
> > => mtd list  
> > List of MTD devices:
> > * nand0
> >   - type: NAND flash
> >   - block size: 0x20000 bytes
> >   - min I/O: 0x800 bytes
> >   - OOB size: 64 bytes
> >   - OOB available: 0 bytes
> >   - ECC strength: 8 bits
> >   - ECC step size: 512 bytes
> >   - bitflip threshold: 6 bits
> >   - 0x000000000000-0x000008000000 : "nand0"
> >           - 0x000000000000-0x000008000000 : "ubi"
> > * nor0
> >   - type: NOR flash
> >   - block size: 0x10000 bytes
> >   - min I/O: 0x1 bytes
> >   - 0x000000000000-0x000000800000 : "nor0"
> >           - 0x000000000000-0x000000010000 : "spl"
> >           - 0x000000010000-0x0000000d0000 : "u-boot"
> >           - 0x0000000d0000-0x0000000e0000 : "env"
> >           - 0x0000000e0000-0x0000000f0000 : "env-red"
> >           - 0x0000000f0000-0x000000800000 : "rescue"
> > 
> > until here all is fine, for example an "ubi part ubi" works as
> > expected ... also doing this command n times, no problems.
> > 
> > Now:
> >   
> > => sf probe  
> > SF: Detected s25f064l with page size 256 Bytes, erase size 64 KiB, total
> > 8 MiB  
> > => mtd list  
> > List of MTD devices:
> > * nand0
> >   - type: NAND flash
> >   - block size: 0x20000 bytes
> >   - min I/O: 0x800 bytes
> >   - OOB size: 64 bytes
> >   - OOB available: 0 bytes
> >   - ECC strength: 8 bits
> >   - ECC step size: 512 bytes
> >   - bitflip threshold: 6 bits
> >   - 0x000000000000-0x000008000000 : "nand0"
> >           - 0x000000000000-0x000008000000 : "ubi"
> > * nor0
> >   - type: NOR flash
> >   - block size: 0x10000 bytes
> >   - min I/O: 0x1 bytes
> >   - 0x000000000000-0x000000800000 : "nor0"  
> > =>  
> > 
> > All MTD devices on nor0 are gone ... also the previous working
> > "ubi part ubi" fails ...
> > 
> > Adding debug code:
> > 
> > mtd_for_each_device(other)
> >     printf("%s ===== %s\n", __func__, other->name);
> > 
> > shows only:
> > 
> > get_mtd_device_nm ===== nand0
> > get_mtd_device_nm ===== nor0
> > 
> > ?
> > 
> > Anyone sees this behaviour too?
> > 
> > Any hints?

Looks like spi_flash_mtd_register() is doing something really bad here
[1]: memsetting the global sf_mtd_info object without testing if
this object has already been registered, and then registering it again
to the MTD layer. So any partition that had been attached to the mtd
object through mtd_probe_devices() are lost, and mtdparts/mtdids are not
parsed again because they haven't changed since the last time
mtd_probe_devices() was called.

[1]https://elixir.bootlin.com/u-boot/v2018.11/source/drivers/mtd/spi/sf_mtd.c#L76

  reply	other threads:[~2018-11-15 14:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-15 10:14 [U-Boot] mtd partitions go away Heiko Schocher
2018-11-15 13:48 ` Marek Vasut
2018-11-15 14:21   ` Boris Brezillon [this message]
2018-11-15 15:15     ` Boris Brezillon
2018-11-15 16:47       ` Boris Brezillon
2018-11-16  6:09         ` Heiko Schocher
2018-11-16  6:36       ` Heiko Schocher

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=20181115152131.422bdd77@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=u-boot@lists.denx.de \
    /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