Browse Source

Merge branch 'CR_3910_Modify_cpu_vol_mason.huo' into 'vf2-devel'

CR_3910  Modify cpu voltage set commands

See merge request sbc/u-boot!48
andy.hu 1 year ago
parent
commit
e4e25e8532

+ 11 - 6
board/starfive/visionfive2/starfive_visionfive2.c

@@ -53,12 +53,14 @@ enum board_type_t {
 
 
 enum cpu_voltage_type_t {
-	CPU_VOL_1020 = 0x0e,
-	CPU_VOL_1040 = 0xff,
-	CPU_VOL_1060 = 0xf0,
-	CPU_VOL_1080 = 0xf1,
-	CPU_VOL_1100 = 0xf2,
+	CPU_VOL_1020 = 0xef0,
+	CPU_VOL_1040 = 0xfff,
+	CPU_VOL_1060 = 0xff0,
+	CPU_VOL_1080 = 0xfe0,
+	CPU_VOL_1100 = 0xf80,
+	CPU_VOL_1120 = 0xf00,
 };
+#define CPU_VOL_MASK	0xfff
 
 static void sys_reset_clear(ulong assert, ulong status, u32 rst)
 {
@@ -311,7 +313,10 @@ static void get_cpu_voltage_type(struct udevice *dev)
 	if (ret != sizeof(buf))
 		printf("%s: error reading CPU vol from OTP\n", __func__);
 	else {
-		switch ((buf & 0xff)) {
+		switch ((buf & CPU_VOL_MASK)) {
+		case CPU_VOL_1120:
+			env_set("cpu_max_vol", "1120000");
+			break;
 		case CPU_VOL_1100:
 			env_set("cpu_max_vol", "1100000");
 			break;

+ 9 - 2
include/configs/starfive-visionfive2.h

@@ -118,9 +118,15 @@
 	"cpu_vol_1100_set=" 			\
 	"fdt set /opp-table-0/opp-1500000000 opp-microvolt <1100000>;\0"
 
+#define CPU_VOL_1120_SET \
+	"cpu_vol_1120_set=" 			\
+	"fdt set /opp-table-0/opp-1500000000 opp-microvolt <1120000>;\0"
+
 #define CPU_VOL_SET	\
-	"cpu_vol_set="				\
-	"if test ${cpu_max_vol} = 1100000; then "	\
+	"cpu_vol_set="					\
+	"if test ${cpu_max_vol} = 1120000; then "	\
+		"run cpu_vol_1120_set;"			\
+	"elif test ${cpu_max_vol} = 1100000; then "	\
 		"run cpu_vol_1100_set;"			\
 	"elif test ${cpu_max_vol} = 1080000; then "	\
 		"run cpu_vol_1080_set;"			\
@@ -273,6 +279,7 @@
 	CPU_VOL_1060_SET				\
 	CPU_VOL_1080_SET				\
 	CPU_VOL_1100_SET				\
+	CPU_VOL_1120_SET				\
 	CPU_VOL_SET					\
 	CHIPA_SET_FORCE					\
 	VISIONFIVE2_MEM_SET				\