Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 251DEC433F5 for ; Thu, 23 Sep 2021 09:04:47 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4F6666124C for ; Thu, 23 Sep 2021 09:04:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4F6666124C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=foss.st.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A22FC8336A; Thu, 23 Sep 2021 11:04:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="MnVpiEVd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 77E1783357; Thu, 23 Sep 2021 11:04:41 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 74D9083375 for ; Thu, 23 Sep 2021 11:04:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=3900e8348b=patrick.delaunay@foss.st.com Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18N730jj022164; Thu, 23 Sep 2021 11:04:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=KKSHcuNT+UtkSuLdsG/l1QdPLPiMqalz3Ek71wFDz/c=; b=MnVpiEVdZth8P+cEatPCrg1PfrFMeug9htQ/FGW0vUT3pGG/ZB6mWdK+ZCjD0uKow0Wy gT99C86dxs8zF/VfixhF1VNuCWSpTdZyRsOkeLEKrC5HjEAclV9WvnO5hXizQCMHmDDG iQS30Qz9h+i2cIhxyW+wmlCkgp17sKpV0Auq9+q5PMIzW790TK4yWYv4F3SMEIKhK0iC q+skwj/fXqldnXScKI2LxtWH6OFrPpUDaCAJZkJGDYvbQ6gH8OK41BgQ5SGGb7aIef7Y fi5FEanY64SzC1hvynyKctuUKGdmh3sq6mrV2DNkThRATJtOuO3CVFv8CmuvhpiSyy4n SQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 3b8mur8uua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Sep 2021 11:04:32 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 46C7610002A; Thu, 23 Sep 2021 11:04:30 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node2.st.com [10.75.127.5]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 898A8226FCF; Thu, 23 Sep 2021 11:04:30 +0200 (CEST) Received: from lmecxl0994.lme.st.com (10.75.127.45) by SFHDAG2NODE2.st.com (10.75.127.5) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 23 Sep 2021 11:04:29 +0200 Subject: Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d" To: Marek Vasut , Tom Rini CC: =?UTF-8?Q?Marek_Beh=c3=ban?= , , =?UTF-8?Q?Pali_Roh=c3=a1r?= , Jagan Teki , Christophe KERELLO , Miquel Raynal , Priyanka Jain , Patrice Chotard , Heiko Schocher , Simon Glass , Vignesh R , U-Boot STM32 References: <20210922162909.1857566-1-patrick.delaunay@foss.st.com> <20210922192925.723abcba@thinkpad> <20210922210536.6c9c2f9e@thinkpad> <56df80f7-aa1d-3cff-5b29-16fdafcf7bcf@denx.de> <20210922194615.GD31748@bill-the-cat> <59ce8fa7-64f2-07c9-ee2b-4b59335b3907@denx.de> <20210922200053.GE31748@bill-the-cat> From: Patrick DELAUNAY Message-ID: <4f1609c3-0aca-3f49-715b-95c8a3336f61@foss.st.com> Date: Thu, 23 Sep 2021 11:04:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG2NODE2.st.com (10.75.127.5) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-23_03,2021-09-22_01,2020-04-07_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean 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