summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorSamin Guo <samin.guo@starfivetech.com>2022-11-01 11:19:48 +0300
committerSamin Guo <samin.guo@starfivetech.com>2022-11-01 13:54:30 +0300
commit0dbe3fb0be546f2be7adaee6baf6d550fbba4e26 (patch)
tree7f1d5836620b8522a4317dd5627d5fcc5a23973f /board
parentbd7deb0588459f36cf774ed58a419a7efbc9d5e4 (diff)
downloadu-boot-0dbe3fb0be546f2be7adaee6baf6d550fbba4e26.tar.xz
board:starfive:evb: add get_chip_type
Read the chip model from the rgpio3 and setenv "chip_vision" 1: jh7110B 0: JH7110A defalut: JH7110A Signed-off-by: Samin Guo <samin.guo@starfivetech.com>
Diffstat (limited to 'board')
-rw-r--r--board/starfive/evb/starfive_evb.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/board/starfive/evb/starfive_evb.c b/board/starfive/evb/starfive_evb.c
index 63fa24e3b1..9955c97b9b 100644
--- a/board/starfive/evb/starfive_evb.c
+++ b/board/starfive/evb/starfive_evb.c
@@ -17,6 +17,12 @@
#include <linux/bitops.h>
#include <asm/arch/gpio.h>
+enum chip_type_t {
+ CHIP_A = 0,
+ CHIP_B,
+ CHIP_MAX,
+};
+
#define SYS_CLOCK_ENABLE(clk) \
setbits_le32(SYS_CRG_BASE + clk, CLK_ENABLE_MASK)
@@ -157,6 +163,26 @@ static void jh7110_usb_init(bool usb2_enable)
}
+static u32 get_chip_type(void)
+{
+ u32 value;
+
+ value = in_le32(AON_IOMUX_BASE + AON_GPIO_DIN_REG);
+ value = (value & BIT(3)) >> 3;
+ switch (value) {
+ case CHIP_B:
+ env_set("chip_vision", "B");
+ jh7110_gmac_sel_tx_to_rgmii(0);
+ jh7110_gmac_sel_tx_to_rgmii(1);
+ break;
+ case CHIP_A:
+ default:
+ env_set("chip_vision", "A");
+ break;
+ }
+ return value;
+}
+
static void jh7110_mmc_init(int id)
{
if (id == 0) {
@@ -238,7 +264,7 @@ err:
#endif
eth_env_set_enetaddr("eth0addr", mac0);
eth_env_set_enetaddr("eth1addr", mac1);
-
+ get_chip_type();
return 0;
}
#endif