summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHal Feng <hal.feng@starfivetech.com>2024-03-13 11:05:10 +0300
committerHal Feng <hal.feng@starfivetech.com>2024-03-13 11:19:59 +0300
commit0bd685d280f7c01a48591b3cf80bc37be28fdb56 (patch)
tree846bf6ba9f767bade49206cdc13c5233a7090b0f
parent223ac8b1e907924d3891b3be1b2f6620b56bff31 (diff)
downloadu-boot-0bd685d280f7c01a48591b3cf80bc37be28fdb56.tar.xz
Support the new JH7110 chip A gmac configuration in linux v6.6+
If gmac_conf_new = 1, apply the new gmac configuration in linux v6.6+. If gmac_conf_new = 0, apply the old gmac configuration. Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
-rw-r--r--include/configs/starfive-devkits.h6
-rw-r--r--include/configs/starfive-evb.h13
-rw-r--r--include/configs/starfive-visionfive2.h39
3 files changed, 50 insertions, 8 deletions
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 \