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 42E19D3B7CA for ; Mon, 25 Nov 2024 00:41:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AF015899D0; Mon, 25 Nov 2024 01:40:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id C6DE289559; Mon, 25 Nov 2024 01:33:41 +0100 (CET) Received: from CHN02-BJS-obe.outbound.protection.partner.outlook.cn (mail-bjschn02on20705.outbound.protection.partner.outlook.cn [IPv6:2406:e500:4440:2::705]) (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 5746989559 for ; Mon, 25 Nov 2024 01:33:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=hal.feng@starfivetech.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LvCtnBi4o0+BvgBgOuhaAfSxVFnD1qnQfJtJbmvSLN/B4wumMYJNk7GqtDJ5yTW/JWnKAYf+8+2RbcLf/SK1JUDH36VH2z7EpCR1DU1NOw0xj40MX9KXjj1qOfSrv/t3GT0g0oUBHjqRg7pgDu71nluif/9LBhi6RBxgSQJr7pghu7691LPnwba8FdPBLT9CtfhHgpoapTOs8z77eQRFKWCp5xe4J4+DyMXOzrmyV+ZO9Bjvzi56KYFy2wyAvESswZXeE98jtL6Fa7RgE7kLW9VYVXK8CFzteZrVc8i5lYNqlGaqZvUE/RJjGII1DJ+Rm4crLnARRUHXDDUtd9M2Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=91ssOxK/l55yK62ThrBTb/M677/AtPtou8zl8O9iU5E=; b=mMZRJGQybZoyZ3vUINZ7WdjXX/xSSZAdzW9sU1R2P2PH7bnXMCarnSveVyW4u9Tr1AdchyAFNTQpLrFIeX046Jaj++6YEZ+SELs5w9tWA82yjwUwEL28MRgfev7L0zlww3HFO9iEXN0ZcZZX1nepX/WkiNYPLy8buoROPLjiHfLB0EUj4VU6G4iKpndTNNqxlsWvxZn7RsxyNx4JY3L/uUE2aixmQdPk9ibTdNUb8uZiHYtGjcb4DvymCbeHo4biY+xSlxwuHWVdrgqZkzkTi4O7ZyEJNfeHzsCVM3J9CEctAYaBq6Rdc9Xvao4IclqElLh7Xlqpwo0/6OIcH2zpWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:7::14) by ZQ2PR01MB1244.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:12::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Mon, 25 Nov 2024 00:33:57 +0000 Received: from ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn ([fe80::2595:ef4d:fae:37d7]) by ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn ([fe80::2595:ef4d:fae:37d7%7]) with mapi id 15.20.8182.019; Mon, 25 Nov 2024 00:33:57 +0000 From: Hal Feng To: Leo , Tom Rini , Sumit Garg , Rick Chen , Heinrich Schuchardt , H Bell , E Shattow , Conor Dooley , Nam Cao , Bo Gan Cc: Emil Renner Berthing , Minda Chen , Hal Feng , u-boot@lists.denx.de Subject: [PATCH v6 06/11] board: starfive: spl: Drop the unneeded DT modification code Date: Mon, 25 Nov 2024 08:32:00 +0800 Message-ID: <20241125003205.75327-7-hal.feng@starfivetech.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20241125003205.75327-1-hal.feng@starfivetech.com> References: <20241125003205.75327-1-hal.feng@starfivetech.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: NT0PR01CA0033.CHNPR01.prod.partner.outlook.cn (2406:e500:c510:c::10) To ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn (2406:e500:c550:7::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: ZQ2PR01MB1307:EE_|ZQ2PR01MB1244:EE_ X-MS-Office365-Filtering-Correlation-Id: d845c913-d416-4ac1-ddc8-08dd0ce8d949 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; ARA:13230040|7416014|52116014|1800799024|41320700013|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: ma/upKQGCk6JQ/+oYTFLTIb9D57yyLYFlNU7HXcyTRsZegdO2M02YpU7ib/cmfyao3nUF7DG03Jj3A3bXdc0KJsGUkRBYkdOlViYVD3EdGVBI/7gL6O5FiLFmLbbrFBXTt+IKgVvjVASb7/g0iLHaInypEUSDi95R7LN27opcKKEpT4T2t161XbZxknXQ/txw57YAbyzt5avNrGD+g+//n9FgVH3iCgG3lTxwbTFp4WtSRHdplJTD7P0v+R901QBfEUaVmCMpT4q1EqoQpFRz3K+zEzZYwAzykY9POKLvLf8qBMhXck35Hi4z+mHQRDlExDXf1WXE3IJHmnyZVM4T5G54mx/0fhWZPjgAr9hAsJx2Z3/Y4KeaAKUF6OnR8oGS68T+V6WncmJH/HLRCuWUCFg+uxXthQbd7fOK6DtqRZTx6W11BUaOffrwzYaVI8Hp8cCDI2lFz/X6WKvchMYeRc76613DW64/jcqAPa4ia1QwglNapgy2LJ7LNDqRvqbGrzSspsMEUxUKj0S8HoxshLAnhci1o4qciNKhwy6lH9ME+2E7Of15CvmmYtluE0a336QAVviaJuqwQVoineOtaNZG/X/ZRbx9V9YIM+z2/qANklxQr3XiPLS7ro1nO9txl7ioSHPlGHOwM1e0I0sPA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn; PTR:; CAT:NONE; SFS:(13230040)(7416014)(52116014)(1800799024)(41320700013)(366016)(38350700014)(921020); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sIQ27SIRfcXrr+KRmnixW/lEIJ2w1temOualaQzJ9RO4KQ2czI2qcFhQAmwz?= =?us-ascii?Q?+6DsOEo1uv0kyvaru4EUF8m0BZBT2MMU8oWeLj3VSgOOvAj3MYNVE7b5gDtF?= =?us-ascii?Q?Cb+1sdYezqIXZJ90MnH3KCLLR0XLv7ef67xtsJZkjIlMdAz+cK8+EpWrYVn3?= =?us-ascii?Q?F+FoGpO559Pd/syk04JMzLtXnQN1KU66ygEJ7hUJYetT98IlTTD4AlZKJfcS?= =?us-ascii?Q?l3crroO2Gde5cs6M5CJz1Aznl5i4S2IIBSdnSYpnmk8i9wzebsdqwrs9MK9U?= =?us-ascii?Q?EZaoWZjnHdhTU62mr/OWI3O5cQSNhGtd0b5+x6gm/FvgaJHZTkef7xRzMacq?= =?us-ascii?Q?bKsLp+/+eUrejHRMuxw5Qqm7nbIzkqkapgtPPERfKOKXCg7ZbTuPvWMTTky4?= =?us-ascii?Q?MIbH4Wtok4pYrpvDxNCKm7LEaQ5l9tXGiuiJJBcly5oIgtyQbYz/fzpAN6kG?= =?us-ascii?Q?U6YnD/jrNsSpn0cm9NraScS7j+0Njo3XT256LoiRf4av5n3w6uAspj1edvM8?= =?us-ascii?Q?wzTyloDcHgfp/AFwFF8OVdFmYj3YaxaSn5S00GUi94gKXSwJt4dSb6Ls/N+/?= =?us-ascii?Q?PL5ZO0R+zhZFWJI5258yAuxgVxpiL2xJUFEvMCbTrCSupBHt80D+D5Dakt1E?= =?us-ascii?Q?0xsqLInoVrDAdFfDR2VepoOlM3AD41jHwpyORheaz/y1ZAwf4g7et/yP5l+/?= =?us-ascii?Q?u0RqawkQu/tuDx13ffrnCnEimRZWUxlcQ75nJNuysbPon0sD4/+fQMvXLSV2?= =?us-ascii?Q?n4SAqEVDLRJlJqRCdWrK2TXlMZcza3/vXKq3ZeI/0WBTgfSuuQQfOZGzDd12?= =?us-ascii?Q?HRfX5PQSy1oXx5dKwHHa1oqrHDcrgzZSq0pARyh56gt9ADcKBb2cWVVff2WF?= =?us-ascii?Q?QIoeLsTnXmuPfm72aXIPItiQAXS6E8LdOI+bmgG1D7FTycHL09sLJFbsrLGn?= =?us-ascii?Q?3E6oYNaa9wXfXae7JN4nAghHXFcc/iiGoJztcvFJDFrUC85Gobr0yT+mvHAo?= =?us-ascii?Q?XgWyOkQrkjqD6dS6IGryDZte2B+8ssEQN2fKO+hNcA9Sx91TSjVHuWzZFBmH?= =?us-ascii?Q?ZQ3JYjp2AkCnr/9ivF2ebVOITYRe3udssTAxfvQhZqJWFkuISuVWtugoIVYt?= =?us-ascii?Q?y9NrpyRLQB33yDSM8bh9/rlgLDzkf0FupjKLyYNRvWdrBkxtYdzo1snHj+j3?= =?us-ascii?Q?NsFcI3JdwOGGWwvSAoGqHvuS3Unog3dLfFlmG22rUdhajUZ5X5h5wu9Y61sz?= =?us-ascii?Q?9Ia7M2aj5Sy6xyLZPO9+Z71TtY9JQhvOZrx6X9YezkCv+JzpR7Upn60kM5Bh?= =?us-ascii?Q?TwOK5JZfvFcorY80V9aKBhJYwbmDY4RfQnvOgFoU1j5MZV3ZR2fobPgn6sOE?= =?us-ascii?Q?bpfQ64Z0Io8npLkX4VxSwRe3OXn11cI+3nj90RwRtTcAewz33ghmMgJ2+KlP?= =?us-ascii?Q?GSmcQZKK6Vre7abi8jkeiAQxt/HtniXLwnQ1YmFoUcYPxDVs5vlJbZjG6/Xh?= =?us-ascii?Q?H4vR+gQ3fr2681dax5S/ZR6wnrKnP5vmc7cFsIU5YMeKX+cPD9ztn759cPpd?= =?us-ascii?Q?c+wkmZRKF+KsPOqzD43ZdFIG2YCGq1Cl82n9zTUc8dbvDd1wJzmgIs2IPVpo?= =?us-ascii?Q?aA=3D=3D?= X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: d845c913-d416-4ac1-ddc8-08dd0ce8d949 X-MS-Exchange-CrossTenant-AuthSource: ZQ2PR01MB1307.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2024 00:33:57.5023 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gBXiIZve4RsmQCVdSX9k+O+MPoZxjs4nxNMvc6G6KPOnl1Te3TbJKvI20dpLst5mPMQuGK5nVwzPMGl2vFflocPfKhbqmfa/JPotte/Buek= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZQ2PR01MB1244 X-Mailman-Approved-At: Mon, 25 Nov 2024 01:40:37 +0100 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.8 at phobos.denx.de X-Virus-Status: Clean As OF_UPSTREAM is implemented, these code are redundant. Tested-by: E Shattow Signed-off-by: Hal Feng --- board/starfive/visionfive2/spl.c | 356 ------------------------------- 1 file changed, 356 deletions(-) diff --git a/board/starfive/visionfive2/spl.c b/board/starfive/visionfive2/spl.c index 3fd535e7cf..38132ecccd 100644 --- a/board/starfive/visionfive2/spl.c +++ b/board/starfive/visionfive2/spl.c @@ -20,364 +20,8 @@ DECLARE_GLOBAL_DATA_PTR; #define JH7110_CLK_CPU_ROOT_SHIFT 24 #define JH7110_CLK_CPU_ROOT_MASK GENMASK(29, 24) -struct starfive_vf2_pro { - const char *path; - const char *name; - const char *value; -}; - -static const struct starfive_vf2_pro milk_v_mars[] = { - {"/soc/ethernet@16030000", "starfive,tx-use-rgmii-clk", NULL}, - {"/soc/ethernet@16040000", "starfive,tx-use-rgmii-clk", NULL}, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-adj-enabled", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-100-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-1000-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-clk-drv-microamp", "3970"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-data-drv-microamp", "2910"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "rx-internal-delay-ps", "1500"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "tx-internal-delay-ps", "1500"}, -}; - -static const struct starfive_vf2_pro starfive_vera[] = { - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", "rx-internal-delay-ps", - "1900"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", "tx-internal-delay-ps", - "1350"} -}; - -static const struct starfive_vf2_pro starfive_verb[] = { - {"/soc/ethernet@16030000", "starfive,tx-use-rgmii-clk", NULL}, - {"/soc/ethernet@16040000", "starfive,tx-use-rgmii-clk", NULL}, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-adj-enabled", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-100-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-1000-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-clk-drv-microamp", "3970"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-data-drv-microamp", "2910"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "rx-internal-delay-ps", "1500"}, - - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,tx-clk-adj-enabled", NULL}, - { "/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,tx-clk-100-inverted", NULL}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,rx-clk-drv-microamp", "3970"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,rx-data-drv-microamp", "2910"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "rx-internal-delay-ps", "0"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "tx-internal-delay-ps", "0"}, -}; - -static const struct starfive_vf2_pro star64_pine64[] = { - {"/soc/ethernet@16030000", "starfive,tx-use-rgmii-clk", NULL}, - {"/soc/ethernet@16040000", "starfive,tx-use-rgmii-clk", NULL}, - - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-adj-enabled", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-10-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-100-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,tx-clk-1000-inverted", NULL}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-clk-drv-microamp", "2910"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "motorcomm,rx-data-drv-microamp", "2910"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "rx-internal-delay-ps", "1900"}, - {"/soc/ethernet@16030000/mdio/ethernet-phy@0", - "tx-internal-delay-ps", "1500"}, - - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,tx-clk-adj-enabled", NULL}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,tx-clk-10-inverted", NULL}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,tx-clk-100-inverted", NULL}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,rx-clk-drv-microamp", "2910"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "motorcomm,rx-data-drv-microamp", "2910"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "rx-internal-delay-ps", "0"}, - {"/soc/ethernet@16040000/mdio/ethernet-phy@1", - "tx-internal-delay-ps", "300"}, -}; - -void spl_fdt_fixup_mars(void *fdt) -{ - static const char compat[] = "milkv,mars\0starfive,jh7110"; - u32 phandle; - u8 i; - int offset; - int ret; - - fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat)); - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", - "Milk-V Mars"); - - /* gmac0 */ - offset = fdt_path_offset(fdt, "/soc/clock-controller@17000000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16030000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_AONCLK_GMAC0_TX); - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_AONCLK_GMAC0_RMII_RTX); - - /* gmac1 */ - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/soc/ethernet@16040000"), - "status", "disabled"); - - for (i = 0; i < ARRAY_SIZE(milk_v_mars); i++) { - offset = fdt_path_offset(fdt, milk_v_mars[i].path); - - if (milk_v_mars[i].value) - ret = fdt_setprop_u32(fdt, offset, milk_v_mars[i].name, - dectoul(milk_v_mars[i].value, NULL)); - else - ret = fdt_setprop_empty(fdt, offset, milk_v_mars[i].name); - - if (ret) { - pr_err("%s set prop %s fail.\n", __func__, milk_v_mars[i].name); - break; - } - } -} - -void spl_fdt_fixup_mars_cm(void *fdt) -{ - const char *compat; - const char *model; - int compat_size; - - spl_fdt_fixup_mars(fdt); - - if (!get_mmc_size_from_eeprom()) { - int offset; - static const char - compat_cm_lite[] = "milkv,mars-cm-lite\0starfive,jh7110"; - - model = "Milk-V Mars CM Lite"; - compat = compat_cm_lite; - compat_size = sizeof(compat_cm_lite); - - offset = fdt_path_offset(fdt, "/soc/pinctrl/mmc0-pins/mmc0-pins-rest"); - /* GPIOMUX(22, GPOUT_SYS_SDIO0_RST, GPOEN_ENABLE, GPI_NONE) */ - fdt_setprop_u32(fdt, offset, "pinmux", 0xff130016); - } else { - static const char - compat_cm[] = "milkv,mars-cm\0starfive,jh7110"; - - model = "Milk-V Mars CM"; - compat = compat_cm; - compat_size = sizeof(compat_cm); - } - fdt_setprop(fdt, fdt_path_offset(fdt, "/"), - "compatible", compat, compat_size); - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", model); -} - -void spl_fdt_fixup_version_a(void *fdt) -{ - static const char compat[] = "starfive,visionfive-2-v1.2a\0starfive,jh7110"; - u32 phandle; - u8 i; - int offset; - int ret; - - fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat)); - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", - "StarFive VisionFive 2 v1.2A"); - - offset = fdt_path_offset(fdt, "/soc/clock-controller@13020000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16040000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_SYSCLK_GMAC1_TX); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_SYSCLK_GMAC1_RX); - - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_SYSCLK_GMAC1_RMII_RTX); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_SYSCLK_GMAC1_RMII_RTX); - - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/soc/ethernet@16040000"), - "phy-mode", "rmii"); - - for (i = 0; i < ARRAY_SIZE(starfive_vera); i++) { - offset = fdt_path_offset(fdt, starfive_vera[i].path); - - if (starfive_vera[i].value) - ret = fdt_setprop_u32(fdt, offset, starfive_vera[i].name, - dectoul(starfive_vera[i].value, NULL)); - else - ret = fdt_setprop_empty(fdt, offset, starfive_vera[i].name); - - if (ret) { - pr_err("%s set prop %s fail.\n", __func__, starfive_vera[i].name); - break; - } - } -} - -void spl_fdt_fixup_version_b(void *fdt) -{ - static const char compat[] = "starfive,visionfive-2-v1.3b\0starfive,jh7110"; - u32 phandle; - u8 i; - int offset; - int ret; - - fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat)); - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", - "StarFive VisionFive 2 v1.3B"); - - /* gmac0 */ - offset = fdt_path_offset(fdt, "/soc/clock-controller@17000000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16030000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_AONCLK_GMAC0_TX); - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_AONCLK_GMAC0_RMII_RTX); - - /* gmac1 */ - offset = fdt_path_offset(fdt, "/soc/clock-controller@13020000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16040000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_SYSCLK_GMAC1_TX); - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_SYSCLK_GMAC1_RMII_RTX); - - for (i = 0; i < ARRAY_SIZE(starfive_verb); i++) { - offset = fdt_path_offset(fdt, starfive_verb[i].path); - - if (starfive_verb[i].value) - ret = fdt_setprop_u32(fdt, offset, starfive_verb[i].name, - dectoul(starfive_verb[i].value, NULL)); - else - ret = fdt_setprop_empty(fdt, offset, starfive_verb[i].name); - - if (ret) { - pr_err("%s set prop %s fail.\n", __func__, starfive_verb[i].name); - break; - } - } -} - -void spl_fdt_fixup_star64(void *fdt) -{ - static const char compat[] = "pine64,star64\0starfive,jh7110"; - u32 phandle; - u8 i; - int offset; - int ret; - - fdt_setprop(fdt, fdt_path_offset(fdt, "/"), "compatible", compat, sizeof(compat)); - fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", - "Pine64 Star64"); - - /* gmac0 */ - offset = fdt_path_offset(fdt, "/soc/clock-controller@17000000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16030000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_AONCLK_GMAC0_TX); - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_AONCLK_GMAC0_RMII_RTX); - - /* gmac1 */ - offset = fdt_path_offset(fdt, "/soc/clock-controller@13020000"); - phandle = fdt_get_phandle(fdt, offset); - offset = fdt_path_offset(fdt, "/soc/ethernet@16040000"); - - fdt_setprop_u32(fdt, offset, "assigned-clocks", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clocks", JH7110_SYSCLK_GMAC1_TX); - fdt_setprop_u32(fdt, offset, "assigned-clock-parents", phandle); - fdt_appendprop_u32(fdt, offset, "assigned-clock-parents", - JH7110_SYSCLK_GMAC1_RMII_RTX); - - for (i = 0; i < ARRAY_SIZE(star64_pine64); i++) { - offset = fdt_path_offset(fdt, star64_pine64[i].path); - - if (star64_pine64[i].value) - ret = fdt_setprop_u32(fdt, offset, star64_pine64[i].name, - dectoul(star64_pine64[i].value, NULL)); - else - ret = fdt_setprop_empty(fdt, offset, star64_pine64[i].name); - - if (ret) { - pr_err("%s set prop %s fail.\n", __func__, star64_pine64[i].name); - break; - } - } -} - void spl_perform_fixups(struct spl_image_info *spl_image) { - u8 version; - const char *product_id; - - product_id = get_product_id_from_eeprom(); - if (!product_id) { - pr_err("Can't read EEPROM\n"); - return; - } - if (!strncmp(product_id, "MARC", 4)) { - spl_fdt_fixup_mars_cm(spl_image->fdt_addr); - } else if (!strncmp(product_id, "MARS", 4)) { - spl_fdt_fixup_mars(spl_image->fdt_addr); - } else if (!strncmp(product_id, "VF7110", 6)) { - version = get_pcb_revision_from_eeprom(); - switch (version) { - case 'a': - case 'A': - spl_fdt_fixup_version_a(spl_image->fdt_addr); - break; - - case 'b': - case 'B': - default: - spl_fdt_fixup_version_b(spl_image->fdt_addr); - break; - }; - } else if (!strncmp(product_id, "STAR64", 6)) { - spl_fdt_fixup_star64(spl_image->fdt_addr); - } else { - pr_err("Unknown product %s\n", product_id); - }; - /* Update the memory size which read from eeprom or DT */ fdt_fixup_memory(spl_image->fdt_addr, 0x40000000, gd->ram_size); } -- 2.43.2