u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
To: Marek Vasut <marex@denx.de>, Tom Rini <trini@konsulko.com>
Cc: "Marek Behún" <marek.behun@nic.cz>,
	u-boot@lists.denx.de, "Pali Rohár" <pali@kernel.org>,
	"Jagan Teki" <jagan@amarulasolutions.com>,
	"Christophe KERELLO" <christophe.kerello@foss.st.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Priyanka Jain" <priyanka.jain@nxp.com>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Heiko Schocher" <hs@denx.de>, "Simon Glass" <sjg@chromium.org>,
	"Vignesh R" <vigneshr@ti.com>,
	"U-Boot STM32" <uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d"
Date: Thu, 23 Sep 2021 11:04:28 +0200	[thread overview]
Message-ID: <4f1609c3-0aca-3f49-715b-95c8a3336f61@foss.st.com> (raw)
In-Reply-To: <a0fa4277-80be-ce67-73fa-08a5be23088f@denx.de>

Hi,

On 9/23/21 3:32 AM, Marek Vasut wrote:
> On 9/22/21 10:00 PM, Tom Rini wrote:
>> On Wed, Sep 22, 2021 at 09:56:26PM +0200, Marek Vasut wrote:
>>> On 9/22/21 9:46 PM, Tom Rini wrote:
>>>> On Wed, Sep 22, 2021 at 09:24:24PM +0200, Marek Vasut wrote:
>>>>
>>>>> I am talking about using nor%d in MTDIDS in U-Boot UBI code to 
>>>>> look up from
>>>>> which device to attach UBI in U-Boot.
>>>>
>>>> OK, so are we not able to pass in the correct name now?  Or just 
>>>> worried
>>>> about old environment and new U-Boot?
>>>
>>> Say you have the following in board config:
>>>
>>> CONFIG_MTDIDS_DEFAULT="nor0=ff705000.spi.0"
>>> CONFIG_MTDPARTS_DEFAULT="mtdparts=ff705000.spi.0:-(fs);"
>>>
>>> Then run "=> ubi part fs", which will fail to find nor0, because now 
>>> that
>>> nor0 is called something else. That is what this series tries to fix.
>>
>> Yes, and what is nor0 now, and what happens if you use it?
>
> Now it is "mt25ql02g", for all mt25ql02g on the board, so ... I cannot 
> even select the one SPI NOR I want to use, since they are not even 
> enumerated in any way, they are all the same. You might want to look 
> at get_mtd_device_nm() in drivers/mtd/mtdcore.c .


To comple me use case, on EV1 board can boot from NOR / NAND / SPI-NAND

so mtdparts and mtdids are buidl dynamically with 
CONFIG_SYS_MTDPARTS_RUNTIME in

afraided board/st/common/stm32mp_mtdparts.c::board_mtdparts_default()


I don't use MTDIDS_DEFAULT / MTDPARTS_DEFAULT.


For example, when I force NOR / NAND presence, I create the MTD variables:

mtdids=nand0=nand0,nor0=nor0

mtdparts=mtdparts=nand0:2m(fsbl),2m(ssbl1),2m(ssbl2),-(UBI);nor0:256k(fsbl1),256k(fsbl2),2m(ssbl),512k(u-boot-env),-(nor_user)


The command "mtdparts" is working in previous U-Boot releaseafraided

and it is not more working as the name of MTD device change


Today, without my patch I have

STM32MP> mtd list
SF: Detected mx66l51235l with page size 256 Bytes, erase size 64 KiB, 
total 64 MiB
Could not find a valid device for nor0
List of MTD devices:
* nand0
   - type: NAND flash
   - block size: 0x40000 bytes
   - min I/O: 0x1000 bytes
   - OOB size: 224 bytes
   - OOB available: 118 bytes
   - ECC strength: 8 bits
   - ECC step size: 512 bytes
   - bitflip threshold: 6 bits
   - 0x000000000000-0x000040000000 : "nand0"
       - 0x000000000000-0x000000200000 : "fsbl"
       - 0x000000200000-0x000000400000 : "ssbl1"
       - 0x000000400000-0x000000600000 : "ssbl2"
       - 0x000000600000-0x000040000000 : "UBI"
* mx66l51235l
   - device: mx66l51235l@0
   - parent: spi@58003000
   - driver: jedec_spi_nor
   - path: /soc/spi@58003000/mx66l51235l@0
   - type: NOR flash
   - block size: 0x10000 bytes
   - min I/O: 0x1 bytes
   - 0x000000000000-0x000004000000 : "mx66l51235l"
* mx66l51235l
   - device: mx66l51235l@1
   - parent: spi@58003000
   - driver: jedec_spi_nor
   - path: /soc/spi@58003000/mx66l51235l@1
   - type: NOR flash
   - block size: 0x10000 bytes
   - min I/O: 0x1 bytes
   - 0x000000000000-0x000004000000 : "mx66l51235l"



before my patch, Ihave always the error "Device nor0 not found!" on 
mtdparts command

=> get_mtd_info

==> get_mtd_device_nm("nor0")   build with MTD_DEV_TYPE(type)

===> mtd_device_matches_name()

             and here "nor0" must be  mtd->name acoring the code


or I miss something...


I don't found any way to solve my issue only with "mtdids" variable.

so I restore the previous behavior as I expect the mtd name

modification can impact many other boards.


A other solution can be change get_mtd_info(),

but I was also afraid of side effect.


Patrick


  reply	other threads:[~2021-09-23  9:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 16:29 [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d" Patrick Delaunay
2021-09-22 16:29 ` [PATCH v4 1/2] mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported Patrick Delaunay
2021-09-28 18:45   ` Tom Rini
2021-09-22 16:29 ` [PATCH v4 2/2] mtd: spi: nor: force mtd name to "nor%d" Patrick Delaunay
2021-09-28 18:45   ` Tom Rini
2021-09-22 17:29 ` [PATCH v4 0/2] " Marek Behún
2021-09-22 18:24   ` Marek Vasut
2021-09-22 18:42     ` Tom Rini
2021-09-22 19:08       ` Marek Behún
2021-09-22 19:12       ` Marek Vasut
2021-09-22 19:05     ` Marek Behún
2021-09-22 19:23       ` Tom Rini
2021-09-22 19:39         ` Marek Vasut
2021-09-22 19:24       ` Marek Vasut
2021-09-22 19:41         ` Tom Rini
2021-09-22 19:42         ` Tom Rini
2021-09-22 19:46         ` Tom Rini
2021-09-22 19:56           ` Marek Vasut
2021-09-22 20:00             ` Tom Rini
2021-09-23  1:32               ` Marek Vasut
2021-09-23  9:04                 ` Patrick DELAUNAY [this message]
2021-09-24 18:22                   ` Tom Rini
2021-09-24 19:25                     ` Marek Behún
2021-09-24 20:09                       ` Marek Vasut
2021-09-25  0:12                         ` Marek Behún
2021-09-25  3:06                           ` Marek Vasut

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=4f1609c3-0aca-3f49-715b-95c8a3336f61@foss.st.com \
    --to=patrick.delaunay@foss.st.com \
    --cc=christophe.kerello@foss.st.com \
    --cc=hs@denx.de \
    --cc=jagan@amarulasolutions.com \
    --cc=marek.behun@nic.cz \
    --cc=marex@denx.de \
    --cc=miquel.raynal@bootlin.com \
    --cc=pali@kernel.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=priyanka.jain@nxp.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    --cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).