From patchwork Thu May 19 16:46:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 1633433 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=UbK4exUo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L3wkP6p2mz9sVB for ; Fri, 20 May 2022 02:47:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 165D8837EF; Thu, 19 May 2022 18:47:02 +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="UbK4exUo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F0DE1805FE; Thu, 19 May 2022 18:46:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 6EA1F839DF for ; Thu, 19 May 2022 18:46:57 +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=1138dbf158=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24JBWRSV017719; Thu, 19 May 2022 18:46:47 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=c4ON0j4rRHVjqEZ2IHZC2z2PYJHxlOCWFW3FYaHFjEE=; b=UbK4exUouZ4FmeT+OirREONRgeZhRIueKe1BmHtCe0gldrdgRGMU4KQ8vO/eS8N36w8W 8oqlZqV7sRDKj0C4b7XH2HyoNd9FH6RowpAFK4pkIwApgNBcv+i2c3hAY6Z/KPqeTAOP 0nctXNwWIWkTSdxIWSqHJhSTUzhOIweZ8ybZyfgVUBxkVUOaE7+18nTCPR9iKvzyOysV RK2Q59aRJj2GhXt/GCpB3Z+9sfIzGlH5Eyv/qd8uGDKvrhHkTLALEXsJkPPfjkV0A9jH LBNmUNKgfJkRT40HaEZrBsEz2DUkgVMZuyPr5Zk15MhQx5oLSShO8yCq84PQv7D6SdS8 iQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3g21j9ay40-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 May 2022 18:46:47 +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 5DFEB10002A; Thu, 19 May 2022 18:46:46 +0200 (CEST) Received: from Webmail-eu.st.com (eqndag1node6.st.com [10.75.129.135]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 417D722FA2B; Thu, 19 May 2022 18:46:46 +0200 (CEST) Received: from localhost (10.75.127.50) by EQNDAG1NODE6.st.com (10.75.129.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Thu, 19 May 2022 18:46:41 +0200 From: Patrick Delaunay To: CC: Marek Vasut , Patrick Delaunay , Patrice Chotard , U-Boot STM32 , Subject: [RFC PATCH 1/2] board: dhelectronics: stm32mp1: convert to livetree Date: Thu, 19 May 2022 18:46:32 +0200 Message-ID: <20220519184552.RFC.1.I4f6455f026820524103f7fbdffaafd3b75585197@changeid> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To EQNDAG1NODE6.st.com (10.75.129.135) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-19_05,2022-05-19_03,2022-02-23_01 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.5 at phobos.denx.de X-Virus-Status: Clean Replace call to fdt_*() functions and access to gd->fdt_blob with call to ofnode_*() functions to support a live tree. Signed-off-by: Patrick Delaunay Tested-by: Marek Vasut --- board/dhelectronics/dh_stm32mp1/board.c | 38 +++++++++++-------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c index d407f0bf59..f5afe97c73 100644 --- a/board/dhelectronics/dh_stm32mp1/board.c +++ b/board/dhelectronics/dh_stm32mp1/board.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -78,11 +77,6 @@ #define SYSCFG_PMCSETR_ETH_SEL_RGMII BIT(21) #define SYSCFG_PMCSETR_ETH_SEL_RMII BIT(23) -/* - * Get a global data pointer - */ -DECLARE_GLOBAL_DATA_PTR; - #define KS_CCR 0x08 #define KS_CCR_EEPROM BIT(9) #define KS_BE0 BIT(12) @@ -96,14 +90,15 @@ int setup_mac_address(void) bool skip_eth0 = false; bool skip_eth1 = false; struct udevice *dev; - int off, ret; + int ret; + ofnode node; ret = eth_env_get_enetaddr("ethaddr", enetaddr); if (ret) /* ethaddr is already set */ skip_eth0 = true; - off = fdt_path_offset(gd->fdt_blob, "ethernet1"); - if (off < 0) { + node = ofnode_path("ethernet1"); + if (!ofnode_valid(node)) { /* ethernet1 is not present in the system */ skip_eth1 = true; goto out_set_ethaddr; @@ -116,7 +111,7 @@ int setup_mac_address(void) goto out_set_ethaddr; } - ret = fdt_node_check_compatible(gd->fdt_blob, off, "micrel,ks8851-mll"); + ret = ofnode_device_is_compatible(node, "micrel,ks8851-mll"); if (ret) goto out_set_ethaddr; @@ -127,7 +122,7 @@ int setup_mac_address(void) * MAC address. */ u32 reg, cider, ccr; - reg = fdt_get_base_address(gd->fdt_blob, off); + reg = ofnode_get_addr(node); if (!reg) goto out_set_ethaddr; @@ -149,13 +144,13 @@ out_set_ethaddr: if (skip_eth0 && skip_eth1) return 0; - off = fdt_path_offset(gd->fdt_blob, "eeprom0"); - if (off < 0) { + node = ofnode_path("eeprom0"); + if (!ofnode_valid(node)) { printf("%s: No eeprom0 path offset\n", __func__); - return off; + return -ENOENT; } - ret = uclass_get_device_by_of_offset(UCLASS_I2C_EEPROM, off, &dev); + ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, node, &dev); if (ret) { printf("Cannot find EEPROM!\n"); return ret; @@ -191,8 +186,8 @@ int checkboard(void) mode = "basic"; printf("Board: stm32mp1 in %s mode", mode); - fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible", - &fdt_compat_len); + fdt_compat = ofnode_get_property(ofnode_root(), "compatible", + &fdt_compat_len); if (fdt_compat && fdt_compat_len) printf(" (%s)", fdt_compat); puts("\n"); @@ -289,7 +284,7 @@ int board_fit_config_name_match(const char *name) const char *compat; char test[128]; - compat = fdt_getprop(gd->fdt_blob, 0, "compatible", NULL); + compat = ofnode_get_property(ofnode_root(), "compatible", NULL); snprintf(test, sizeof(test), "%s_somrev%d_boardrev%d", compat, somcode, brdcode); @@ -604,14 +599,13 @@ static void board_init_fmc2(void) #define STPMIC_NVM_BUCKS_VOUT_SHR_BUCK_OFFSET(n) ((((n) - 1) & 3) * 2) static int board_get_regulator_buck3_nvm_uv_av96(int *uv) { - const void *fdt = gd->fdt_blob; struct udevice *dev; u8 bucks_vout = 0; const char *prop; int len, ret; /* Check whether this is Avenger96 board. */ - prop = fdt_getprop(fdt, 0, "compatible", &len); + prop = ofnode_get_property(ofnode_root(), "compatible", &len); if (!prop || !len) return -ENODEV; @@ -701,8 +695,8 @@ int board_late_init(void) const void *fdt_compat; int fdt_compat_len; - fdt_compat = fdt_getprop(gd->fdt_blob, 0, "compatible", - &fdt_compat_len); + fdt_compat = ofnode_get_property(ofnode_root(), "compatible", + &fdt_compat_len); if (fdt_compat && fdt_compat_len) { if (strncmp(fdt_compat, "st,", 3) != 0) env_set("board_name", fdt_compat); From patchwork Thu May 19 16:46:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 1633434 X-Patchwork-Delegate: patrice.chotard@st.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256 header.s=selector1 header.b=ZQ4DtDkA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4L3wkd2m7Mz9sVB for ; Fri, 20 May 2022 02:47:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D449583D8F; Thu, 19 May 2022 18:47:11 +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="ZQ4DtDkA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B7EB583D9B; Thu, 19 May 2022 18:47:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 90AF783D0C for ; Thu, 19 May 2022 18:47:05 +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=1138dbf158=patrick.delaunay@foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24JF45C4009064; Thu, 19 May 2022 18:46:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=selector1; bh=4uFj9z4mN/k3ys5mUTCv1CNuZk5Tg926kDPfFd9RFwo=; b=ZQ4DtDkA9SVG2ERq0GoI8lczoH30RrGvNoczzFiPFYwCSJ2K2Fr/Lv4BdDkoneIzVkd5 GW4TZVa4LaU8Gp0Dp/jsUbaQkhyPja3z6dCZBzDMwCktgDmpTiuHp7QTauSU02hlapHl QqUxaX9fGo4wUN+WaKa2WhO0coal3f/6kqm0T43/bqy6vmfLJlqh2CyqO8znc1T8/DZR DVCnJUmWLDMoWX42/A/8Jv2k32sk2qDNFq1Kby46NShjbDTs9BzGNX0ds4Dn7JNz43Ax 7PmwdBSUKlL/itEaYqL7mbBQFVo23MVNtF47gu5GMBI8FiCbQn9r2bXMpAmoEmNMynLS 0g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3g21j9ay4n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 19 May 2022 18:46:56 +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 47B0710002A; Thu, 19 May 2022 18:46:56 +0200 (CEST) Received: from Webmail-eu.st.com (eqndag1node6.st.com [10.75.129.135]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3FD9C22FA2B; Thu, 19 May 2022 18:46:56 +0200 (CEST) Received: from localhost (10.75.127.49) by EQNDAG1NODE6.st.com (10.75.129.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Thu, 19 May 2022 18:46:41 +0200 From: Patrick Delaunay To: CC: Marek Vasut , Patrick Delaunay , Patrice Chotard , Tom Rini , U-Boot STM32 , Subject: [RFC PATCH 2/2] ARM: stm32: activate OF_LIVE for DHSOM Date: Thu, 19 May 2022 18:46:33 +0200 Message-ID: <20220519184552.RFC.2.Ida901b98d25a7f60b6fb05d18f2e030d9c9ecc5c@changeid> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220519184552.RFC.1.I4f6455f026820524103f7fbdffaafd3b75585197@changeid> References: <20220519184552.RFC.1.I4f6455f026820524103f7fbdffaafd3b75585197@changeid> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To EQNDAG1NODE6.st.com (10.75.129.135) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-19_05,2022-05-19_03,2022-02-23_01 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.5 at phobos.denx.de X-Virus-Status: Clean Activate the live DT with CONFIG_OF_LIVE to reduce the DT parsing time. Signed-off-by: Patrick Delaunay Tested-by: Marek Vasut --- configs/stm32mp15_dhcom_basic_defconfig | 1 + configs/stm32mp15_dhcor_basic_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/stm32mp15_dhcom_basic_defconfig b/configs/stm32mp15_dhcom_basic_defconfig index ca3873c7e6..f91bc173d5 100644 --- a/configs/stm32mp15_dhcom_basic_defconfig +++ b/configs/stm32mp15_dhcom_basic_defconfig @@ -72,6 +72,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k( # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set +CONFIG_OF_LIVE=y CONFIG_OF_LIST="stm32mp15xx-dhcom-pdk2 stm32mp15xx-dhcom-drc02 stm32mp15xx-dhcom-picoitx" CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks" CONFIG_ENV_IS_IN_SPI_FLASH=y diff --git a/configs/stm32mp15_dhcor_basic_defconfig b/configs/stm32mp15_dhcor_basic_defconfig index 4e70566e3f..b19033bdaa 100644 --- a/configs/stm32mp15_dhcor_basic_defconfig +++ b/configs/stm32mp15_dhcor_basic_defconfig @@ -70,6 +70,7 @@ CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(fsbl1),256k(fsbl2),1408k(uboot),64k( # CONFIG_SPL_DOS_PARTITION is not set # CONFIG_ISO_PARTITION is not set # CONFIG_SPL_PARTITION_UUIDS is not set +CONFIG_OF_LIVE=y CONFIG_OF_SPL_REMOVE_PROPS="interrupts interrupt-names interrupts-extended interrupt-controller \\\#interrupt-cells interrupt-parent dmas dma-names assigned-clocks assigned-clock-rates assigned-clock-parents hwlocks" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_SYS_REDUNDAND_ENVIRONMENT=y