author: andy.hu <andy.hu@starfivetech.com> 2024-03-13 10:43:30 +0000
committer: andy.hu <andy.hu@starfivetech.com> 2024-03-13 10:43:30 +0000
commit: 4f0dc1bed91ce8dd3206514f71c7036c13dea998
parent: 223ac8b1e907924d3891b3be1b2f6620b56bff31
Commit Summary:
Diffstat:
4 files changed, 51 insertions, 9 deletions
diff --git a/configs/starfive_visionfive2_defconfig b/configs/starfive_visionfive2_defconfig
index cc892d486f..b78ff8e154 100644
--- a/configs/starfive_visionfive2_defconfig
+++ b/configs/starfive_visionfive2_defconfig
@@ -33,7 +33,7 @@ CONFIG_USE_BOOTCOMMAND=y
CONFIG_BOOTCOMMAND="run sdk_boot_env; run distro_boot_env"
CONFIG_USE_PREBOOT=y
CONFIG_PREBOOT="run chipa_set_uboot;"
-CONFIG_DEFAULT_FDT_FILE="jh7110-visionfive-v2.dtb"
+CONFIG_DEFAULT_FDT_FILE="jh7110-starfive-visionfive-2-v1.3b.dtb"
CONFIG_LOG_MAX_LEVEL=4
CONFIG_SPL_LOG=y
CONFIG_DISPLAY_CPUINFO=y
diff --git a/include/configs/starfive-devkits.h b/include/configs/starfive-devkits.h
index 5a86c6f59d..794da8d03f 100644
--- a/include/configs/starfive-devkits.h
+++ b/include/configs/starfive-devkits.h
@@ -169,13 +169,11 @@
#define CHIPA_GMAC_SET \
"chipa_gmac_set=" \
- "fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_10 <0x1>;" \
- "fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_100 <0x1>;" \
- "fdt set /soc/ethernet@16030000/ethernet-phy@0 tx_inverted_1000 <0x1>;\0"
+ "echo JH7110 Devkits never supports chip A;\0"
#define CHIPA_SET \
"chipa_set=" \
- "if test ${chip_vision} = B; then " \
+ "if test ${chip_vision} = A; then " \
"run chipa_gmac_set;" \
"fi; \0" \
"chipa_set_uboot=" \
diff --git a/include/configs/starfive-evb.h b/include/configs/starfive-evb.h
index a9ff995cb4..6f6e4b0b4c 100644
--- a/include/configs/starfive-evb.h
+++ b/include/configs/starfive-evb.h
@@ -177,8 +177,17 @@
#define CHIPA_SET \
"chipa_set=" \
- "if test ${chip_vision} = B; then " \
- "run chipa_gmac_set;" \
+ "if test ${chip_vision} = B; then " \
+ "fdt get name gmac1_subnode_name /soc/ethernet@16040000 0;" \
+ "if test ${gmac1_subnode_name} = mdio; then " \
+ "setenv gmac_conf_new 1;" \
+ "else " \
+ "setenv gmac_conf_new 0;" \
+ "fi; " \
+ "setenv gmac1_subnode_name;" \
+ "if test ${gmac_conf_new} = 0; then " \
+ "run chipa_gmac_set;" \
+ "fi; " \
"fi; \0" \
"chipa_set_uboot=" \
"fdt addr ${fdtcontroladdr};" \
diff --git a/include/configs/starfive-visionfive2.h b/include/configs/starfive-visionfive2.h
index 30b60e85b0..2cb74c5850 100644
--- a/include/configs/starfive-visionfive2.h
+++ b/include/configs/starfive-visionfive2.h
@@ -180,6 +180,29 @@
"fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_inverted_1000 <0x0>;" \
"fdt set /soc/ethernet@16040000/ethernet-phy@1 tx_delay_sel <0x9> \0"
+#define CHIPA_GMAC_SET_NEW \
+ "chipa_gmac_set_new=" \
+ "fdt rm /soc/ethernet@16030000 starfive,tx-use-rgmii-clk;" \
+ "fdt rm /soc/ethernet@16030000 assigned-clocks;" \
+ "fdt rm /soc/ethernet@16030000 assigned-clock-parents;" \
+ "fdt rm /soc/ethernet@16030000/mdio/ethernet-phy@0 motorcomm,tx-clk-adj-enabled;" \
+ "fdt rm /soc/ethernet@16030000/mdio/ethernet-phy@0 motorcomm,tx-clk-100-inverted;" \
+ "fdt rm /soc/ethernet@16030000/mdio/ethernet-phy@0 motorcomm,tx-clk-1000-inverted;" \
+ "fdt rm /soc/ethernet@16030000/mdio/ethernet-phy@0 motorcomm,rx-clk-drv-microamp;" \
+ "fdt rm /soc/ethernet@16030000/mdio/ethernet-phy@0 motorcomm,rx-data-drv-microamp;" \
+ "fdt set /soc/ethernet@16030000/mdio/ethernet-phy@0 rx-internal-delay-ps <1900>;" \
+ "fdt set /soc/ethernet@16030000/mdio/ethernet-phy@0 tx-internal-delay-ps <1350>;" \
+ "fdt rm /soc/ethernet@16040000 starfive,tx-use-rgmii-clk;" \
+ "fdt set /soc/ethernet@16040000 phy-mode \"rmii\";" \
+ "fdt set /soc/ethernet@16040000 assigned-clocks <0x00000003 0x00000069 0x00000003 0x00000067>;" \
+ "fdt set /soc/ethernet@16040000 assigned-clock-parents <0x00000003 0x00000065 0x00000003 0x00000065>;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 motorcomm,tx-clk-adj-enabled;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 motorcomm,tx-clk-100-inverted;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 motorcomm,rx-clk-drv-microamp;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 motorcomm,rx-data-drv-microamp;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 rx-internal-delay-ps;" \
+ "fdt rm /soc/ethernet@16040000/mdio/ethernet-phy@1 tx-internal-delay-ps; \0"
+
#define VISIONFIVE2_MEM_SET \
"visionfive2_mem_set=" \
"fdt memory ${memory_addr} ${memory_size};" \
@@ -187,8 +210,19 @@
#define CHIPA_SET \
"chipa_set=" \
- "if test ${chip_vision} = A; then " \
- "run chipa_gmac_set;" \
+ "if test ${chip_vision} = A; then " \
+ "fdt get name gmac1_subnode_name /soc/ethernet@16040000 0;" \
+ "if test ${gmac1_subnode_name} = mdio; then " \
+ "setenv gmac_conf_new 1;" \
+ "else " \
+ "setenv gmac_conf_new 0;" \
+ "fi; " \
+ "setenv gmac1_subnode_name;" \
+ "if test ${gmac_conf_new} = 0; then " \
+ "run chipa_gmac_set;" \
+ "else " \
+ "run chipa_gmac_set_new;" \
+ "fi; " \
"fi; \0" \
"chipa_set_uboot=" \
"fdt addr ${uboot_fdt_addr};" \
@@ -326,6 +360,7 @@
JH7110_SDK_BOOTENV \
JH7110_DISTRO_BOOTENV \
CHIPA_GMAC_SET \
+ CHIPA_GMAC_SET_NEW \
CHIPA_SET \
CPU_VOL_1020_SET \
CPU_VOL_1040_SET \