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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72082C00144 for ; Mon, 1 Aug 2022 21:59:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BF1FA84068; Mon, 1 Aug 2022 23:59:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="AfTsxZwr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 68CDC840E4; Mon, 1 Aug 2022 23:59:04 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 3B42684038 for ; Mon, 1 Aug 2022 23:59:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD8FE60B55; Mon, 1 Aug 2022 21:58:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2522C433C1; Mon, 1 Aug 2022 21:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659391139; bh=AmQ31qa9gvsa1pXdBDGGP+U5pja6hR7DDQHIFSR39kg=; h=From:To:Cc:Subject:Date:From; b=AfTsxZwrRyQUuXHIl1+vGkc1MCybg+7SYNFgx/zFWdBm/i2CCuvQ5zztUjDFegCHO iBLIVSVOEhYx4VDSjIQLU99sLikWvKLPlAxIEZ52Pow1JAhhgjQVXeFxfxYeXLLxJK wXVc2ijiLRXAWu+PI49g3IoX4g3tU3521rWYsBYC/aQQAjtTjh+1lcelSaYI1LzZwI IvkmDn+IJ7eu2wQlLy+KpSwo6XEPCoNDKU0cWhc+MA5U2pJnHvM7VNL4lgxJBNgnBy eCtg6kdLiH2Qs5Nh4JJQQQE2kgQZGQOOpVs0FVjpdIbTI4nIuGnlXIG2/R2U5n6VaS iasV76wu9fZUA== Received: by pali.im (Postfix) id DB3B1773; Mon, 1 Aug 2022 23:58:55 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese Cc: Marek Behun , u-boot@lists.denx.de Subject: [PATCH] arm: mvebu: turris_omnia: Remove hardcoded spi-nor device tree path Date: Mon, 1 Aug 2022 23:58:42 +0200 Message-Id: <20220801215842.4972-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Linux kernel DTS files renamed spi-nor@0 node to flash@0 which effectively broke U-Boot to boot new Linux kernel versions correctly. So remove hardcoded spi-nor device tree path from Turris Omnia board code and replace it by searching for mtd node by compatible string. Signed-off-by: Pali Rohár --- board/CZ.NIC/turris_omnia/turris_omnia.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c index 108d160f486d..9d7e63865f14 100644 --- a/board/CZ.NIC/turris_omnia/turris_omnia.c +++ b/board/CZ.NIC/turris_omnia/turris_omnia.c @@ -32,8 +32,6 @@ DECLARE_GLOBAL_DATA_PTR; -#define OMNIA_SPI_NOR_PATH "/soc/spi@10600/spi-nor@0" - #define OMNIA_I2C_BUS_NAME "i2c@11000->i2cmux@70->i2c@0" #define OMNIA_I2C_MCU_CHIP_ADDR 0x2a @@ -1030,14 +1028,22 @@ static bool fixup_mtd_partitions(void *blob, int offset, struct mtd_info *mtd) static void fixup_spi_nor_partitions(void *blob) { - struct mtd_info *mtd; + struct mtd_info *mtd = NULL; + char mtd_path[64]; int node; - mtd = get_mtd_device_nm(OMNIA_SPI_NOR_PATH); + node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "jedec,spi-nor"); + if (node < 0) + goto fail; + + if (fdt_get_path(gd->fdt_blob, node, mtd_path, sizeof(mtd_path)) < 0) + goto fail; + + mtd = get_mtd_device_nm(mtd_path); if (IS_ERR_OR_NULL(mtd)) goto fail; - node = fdt_path_offset(blob, OMNIA_SPI_NOR_PATH); + node = fdt_node_offset_by_compatible(blob, -1, "jedec,spi-nor"); if (node < 0) goto fail; -- 2.20.1