Browse Source

board:starfive:evb: Support using env to detect board version

JH7110B need tx_inverted by YT8521 phy, you need to read the chip
version to determine whether to use it.

Signed-off-by: Samin Guo <samin.guo@starfivetech.com>
Samin Guo 1 year ago
parent
commit
ca91f535d4
2 changed files with 22 additions and 0 deletions
  1. 2 0
      configs/starfive_evb_defconfig
  2. 20 0
      include/configs/starfive-evb.h

+ 2 - 0
configs/starfive_evb_defconfig

@@ -27,6 +27,8 @@ CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200  debug rootwait  earlycon=sbi "
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="fatload mmc 0:3 $kernel_addr_r jh7110_uEnv.txt; env import -t $kernel_addr_r $filesize;run boot2"
+CONFIG_USE_PREBOOT=y
+CONFIG_PREBOOT="run chipa_set_uboot"
 CONFIG_LOG_MAX_LEVEL=4
 CONFIG_SPL_LOG=y
 CONFIG_DISPLAY_CPUINFO=y

+ 20 - 0
include/configs/starfive-evb.h

@@ -98,6 +98,24 @@
 #define TYPE_GUID_LOADER2	"2E54B353-1271-4842-806F-E436D6AF6985"
 #define TYPE_GUID_SYSTEM	"0FC63DAF-8483-4772-8E79-3D69D8477DE4"
 
+#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"
+
+#define CHIPA_SET	\
+	"chipa_set="				\
+	"if test ${chip_vision} = B; then "	\
+		"run chipa_gmac_set;"		\
+	"fi; \0"				\
+	"chipa_set_uboot="			\
+	"fdt addr ${fdtcontroladdr};"		\
+	"run chipa_set;\0"			\
+	"chipa_set_linux="			\
+	"fdt addr ${fdt_addr_r};"		\
+	"run chipa_set;\0"
+
 #define PARTS_DEFAULT							\
 	"name=loader1,start=17K,size=1M,type=${type_guid_gpt_loader1};" \
 	"name=loader2,size=4MB,type=${type_guid_gpt_loader2};"		\
@@ -113,6 +131,8 @@
 	"script_size_f=0x1000\0"			\
 	"pxefile_addr_r=0x88200000\0"			\
 	"ramdisk_addr_r=0x88300000\0"			\
+	CHIPA_GMAC_SET					\
+	CHIPA_SET					\
 	"type_guid_gpt_loader1=" TYPE_GUID_LOADER1 "\0" \
 	"type_guid_gpt_loader2=" TYPE_GUID_LOADER2 "\0" \
 	"type_guid_gpt_system=" TYPE_GUID_SYSTEM "\0"	\