From: Hal Feng <hal.feng@starfivetech.com>
To: Leo <ycliang@andestech.com>, Tom Rini <trini@konsulko.com>,
Sumit Garg <sumit.garg@linaro.org>,
Rick Chen <rick@andestech.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
H Bell <dmoo_dv@protonmail.com>, E Shattow <lucent@gmail.com>,
Conor Dooley <conor.dooley@microchip.com>,
Nam Cao <namcao@linutronix.de>, Bo Gan <ganboing@gmail.com>
Cc: Emil Renner Berthing <emil.renner.berthing@canonical.com>,
Minda Chen <minda.chen@starfivetech.com>,
Hal Feng <hal.feng@starfivetech.com>,
u-boot@lists.denx.de
Subject: [PATCH v7 07/12] board: starfive: spl: Drop the unneeded DT modification code
Date: Tue, 3 Dec 2024 11:04:25 +0800 [thread overview]
Message-ID: <20241203030430.26089-8-hal.feng@starfivetech.com> (raw)
In-Reply-To: <20241203030430.26089-1-hal.feng@starfivetech.com>
As OF_UPSTREAM is implemented, these code are redundant.
Tested-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: E Shattow <lucent@gmail.com>
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
---
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
next prev parent reply other threads:[~2024-12-03 3:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-03 3:04 [PATCH v7 00/12] Support OF_UPSTREAM for StarFive JH7110 Hal Feng
2024-12-03 3:04 ` [PATCH v7 01/12] dts: starfive: Switch to using upstream DT Hal Feng
2024-12-03 3:04 ` [PATCH v7 02/12] riscv: dts: jh7110: Make u-boot device trees adapting to " Hal Feng
2024-12-04 19:07 ` E Shattow
2024-12-06 2:16 ` Hal Feng
2024-12-03 3:04 ` [PATCH v7 03/12] mmc: dw_mmc: Add "starfive, jh7110-mmc" compatible to match " Hal Feng
2024-12-04 0:27 ` Jaehoon Chung
2024-12-03 3:04 ` [PATCH v7 04/12] pcie: starfive: Make the driver compatible with " Hal Feng
2024-12-03 3:04 ` [PATCH v7 05/12] riscv: dts: jh7110: Move common code to the new jh7110-common-u-boot.dtsi Hal Feng
2024-12-03 19:15 ` E Shattow
2024-12-04 6:52 ` Hal Feng
2024-12-04 10:56 ` E Shattow
2024-12-05 6:08 ` Hal Feng
2024-12-03 3:04 ` [PATCH v7 06/12] riscv: dts: jh7110: Add u-boot device tree for JH7110 based boards Hal Feng
2024-12-03 3:04 ` Hal Feng [this message]
2024-12-03 3:04 ` [PATCH v7 08/12] configs: visionfive2: Enable MULTI_DTB_FIT for JH7110 based board DT Hal Feng
2024-12-03 3:04 ` [PATCH v7 09/12] riscv: dts: jh7110: Support multiple DTBs in a Fit image Hal Feng
2024-12-03 3:04 ` [PATCH v7 10/12] board: starfive: spl: Fix the wrong use of CONFIG_IS_ENABLED() Hal Feng
2024-12-03 3:04 ` [PATCH v7 11/12] board: starfive: spl: Support multiple DTBs for JH7110 based boards Hal Feng
2024-12-03 3:04 ` [PATCH v7 12/12] riscv: cpu: jh7110: Sort the list of imply statements Hal Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241203030430.26089-8-hal.feng@starfivetech.com \
--to=hal.feng@starfivetech.com \
--cc=conor.dooley@microchip.com \
--cc=dmoo_dv@protonmail.com \
--cc=emil.renner.berthing@canonical.com \
--cc=ganboing@gmail.com \
--cc=lucent@gmail.com \
--cc=minda.chen@starfivetech.com \
--cc=namcao@linutronix.de \
--cc=rick@andestech.com \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.