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] [PATCH] cmd: mtdparts: Probe MTD devices in mtdparts_init()
Date: Tue, 30 Oct 2018 14:46:20 +0100	[thread overview]
Message-ID: <20181030144620.69d4a78f@bbrezillon> (raw)
In-Reply-To: <e112c41a-a8d6-3926-949b-99de14246fa0@denx.de>

On Tue, 30 Oct 2018 11:59:13 +0100
Stefan Roese <sr@denx.de> wrote:

> On 30.10.18 11:41, Boris Brezillon wrote:
> > On Tue, 30 Oct 2018 11:13:37 +0100
> > Stefan Roese <sr@denx.de> wrote:
> >   
> >> Hi Boris,
> >>
> >> On 30.10.18 11:03, Boris Brezillon wrote:  
> >>> On Tue, 30 Oct 2018 10:51:51 +0100
> >>> Stefan Roese <sr@denx.de> wrote:
> >>>      
> >>>> Calling "mtdparts" currently fails when its called before any other mtd
> >>>> command (or ubi command) has been called. The MTD devices are not
> >>>> probed at this point and therefore it fails e.g. with this message:
> >>>>     
> >>>> => mtdparts  
> >>>> Device spi-nand0 not found!  
> >>>
> >>> IIRC, we decided that mtdparts should not call mtd_probe_devices() to
> >>> encourage people to stop using it.  
> >>
> >> I see. But I don't quite get how this missing call (and reslting
> >> error message) would encourage people to stop using it.  
> > 
> > You're right, this message does not encourage people to stop using
> > mtdparts on existing setups (mtdparts should work just fine on any MTD
> > devices except SPI NANDs) but it does discourage them from using it on
> > spi-nand devices since it returns an error.  
> 
> IMHO, that's more confusing than discouraging.

Maybe we should have a

	depends on !CMD_MTDPARTS

in the CMD_MTD entry. Since spi-nand can only be accessed from the
cmdline through the mtd command, that should cover most cases.

>   
> >>>>
> >>>> This patch adds a call to mtd_probe_devices() to mtdparts_init() to
> >>>> solve this issue. This also fixes a problem when calling "ubi part"
> >>>> as first flash storage related command.  
> >>>
> >>> Hm, this one is unexpected. Miquel, any idea why this happens. Do we
> >>> need to enable a specific option if we want mtd_probe_devices() to be
> >>> called in the ubi part path?  
> >>
> >> Please note that "ubi part part-foo" does still work. It only
> >> prints this error message before attaching the MTD partition.
> >> The error is printed because of this call-chain:
> >>
> >> ubi_part()  
> >> ->  ubi_detach()
> >>       -> mtdparts_init()  
> >>
> >> So again, mtdparts_init() is called without the MTD devices
> >> being probed.  
> > 
> > I guess we forgot to remove this mtdparts_init() call from the detach
> > path. I think it's no longer needed since we now call
> > mtd_probe_devices() in ubi_part(), and mtd_probe_devices() will take
> > care of creating MTD partitions based on the mtdparts= and mtdids=
> > variables.  
> 
> A quick test reveals that this removal does not remove the
> error message. Instead the command does not work anymore at
> all:
> 
> => ubi part nand  
> Partition nand not found!

Hm, there's a problem. The partition creation should work even if
mtdparts_init() is not called. Can you check that CONFG_MTD_PARTITIONS
is selected, and if it is, add traces in mtd_probe_devices() to see
where it fails.

> 
> Before (and without my patch) its this:
> 
> => ubi part nand  
> Device spi-nand0 not found!
> Error initializing mtdparts!
> ubi0: attaching mtd2
> ubi0: scanning is finished
> ubi0: attached mtd2 (name "nand", size 128 MiB)
> ...
> 
> Thanks,
> Stefan

  reply	other threads:[~2018-10-30 13:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30  9:51 [U-Boot] [PATCH] cmd: mtdparts: Probe MTD devices in mtdparts_init() Stefan Roese
2018-10-30 10:03 ` Boris Brezillon
2018-10-30 10:13   ` Stefan Roese
2018-10-30 10:41     ` Boris Brezillon
2018-10-30 10:59       ` Stefan Roese
2018-10-30 13:46         ` Boris Brezillon [this message]
2018-10-30 22:02         ` Boris Brezillon
2018-10-30 22:43           ` Boris Brezillon
2018-10-31  6:05             ` Stefan Roese
2018-10-30 22:43           ` Miquel Raynal
2018-10-30 22:49             ` Boris Brezillon

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=20181030144620.69d4a78f@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