From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DF03C433EF for ; Sat, 25 Sep 2021 00:12:13 +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 90B6D610C7 for ; Sat, 25 Sep 2021 00:12:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90B6D610C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nic.cz 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 051E5834B4; Sat, 25 Sep 2021 02:12:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=nic.cz header.i=@nic.cz header.b="WzH2hYFn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DDD5283238; Sat, 25 Sep 2021 02:12:07 +0200 (CEST) Received: from mail.nic.cz (lists.nic.cz [IPv6:2001:1488:800:400::400]) (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 6E3D0834CF for ; Sat, 25 Sep 2021 02:12:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=nic.cz Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.behun@nic.cz Received: from thinkpad (unknown [172.20.6.87]) by mail.nic.cz (Postfix) with ESMTPSA id C5378142627; Sat, 25 Sep 2021 02:12:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1632528721; bh=glCfIUomaAlH08lUnS2WwFGYTh87Chy7WqBvYcGQipw=; h=Date:From:To; b=WzH2hYFnxe7EUEfceAFYBtBzh0289QAZsAeTuBsT7RfvRxiUnl6ncA1Hbish8qxMr nEcUicqsyPsXzdVb9iwVUIIM3Ru5W0M/+6bnIPnH52daLe+AmFF+7XNiD+MK3b7KPP gD21zuOVE7+QK+ggPf0eC59NmbdjfAMUwacw7kJk= Date: Sat, 25 Sep 2021 02:12:00 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Marek Vasut , Tom Rini Cc: Patrick DELAUNAY , u-boot@lists.denx.de, Pali =?UTF-8?B?Um9ow6Fy?= , Jagan Teki , Christophe KERELLO , Miquel Raynal , Priyanka Jain , Patrice Chotard , Heiko Schocher , Simon Glass , Vignesh R , U-Boot STM32 Subject: Re: [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d" Message-ID: <20210925021200.7d5b62e2@thinkpad> In-Reply-To: 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> <4f1609c3-0aca-3f49-715b-95c8a3336f61@foss.st.com> <20210924182257.GG31748@bill-the-cat> <20210924212559.22006a61@thinkpad> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Fri, 24 Sep 2021 22:09:15 +0200 Marek Vasut wrote: > I have a feeling the discussion is again banking toward "mtdparts" and > "DT", which really is a solved problem, or at least we agreed upon the > solution. I was trying to explain to Patrick how he can convert the ST board so that the mtd partitions will be defined in DT and board code won't need mtdids if he also converts to distro boot correctly. > The patch is trying to fix MTDIDS and their look up in > get_mtd_device_nm(). This is all U-Boot stuff, it has nothing to do with > passing mtd partitions to Linux at all. The solution here is to get rid of MTDIDS also. But I guess this will take some time, so it does make sense for get_mtd_device_nm() to return the same device as previously when given argument "norN". The reason why I put SPI NOR name into mtd->name was because otherwise the `mtd list` command did not print that name anywhere (since it doesn't know how, because that SPI-NOR data are private for the jedec_spi_nor driver). Since - every mtd device has mtd->type, for NOR flash this is MTD_NORFLASH - we can iterate mtd devices in order they were registered (mtd_for_each_device does this) we can easily implement a function get_mtd_device_by_type_and_id() that, when given string "norN" will find the N-th mtd device of type MTD_NORFLASH. This function could than be called from get_mtd_device_nm() if everything failed, or in some other way. Tom, Marek, Patrick, what do you think? Marek