1 From 07f84ed283b913cbdf87181ae2ed65467d923df5 Mon Sep 17 00:00:00 2001
2 From: Vincent Chen <vincent.chen@sifive.com>
3 Date: Mon, 24 Jan 2022 02:57:40 -0800
4 Subject: [PATCH 2/2] board: sifive: spl: Set remote thermal of TMP451 to 85
5 deg C for the unmatched board
7 For TMP451 on the unmatched board, the default value of the remote
8 thermal threshold is 108 deg C. This commit initilizes it to 85 deg C at SPL.
10 board/sifive/unmatched/spl.c | 29 +++++++++++++++++++++++++++++
11 drivers/misc/Kconfig | 10 ++++++++++
12 include/configs/sifive-unmatched.h | 4 ++++
13 scripts/config_whitelist.txt | 1 +
14 4 files changed, 44 insertions(+)
16 --- a/board/sifive/unmatched/spl.c
17 +++ b/board/sifive/unmatched/spl.c
24 #include <linux/delay.h>
28 #define MODE_SELECT_SD 0xb
29 #define MODE_SELECT_MASK GENMASK(3, 0)
31 +#define TMP451_REMOTE_THERM_LIMIT_REG_OFFSET 0x19
32 +#define TMP451_REMOTE_THERM_LIMIT_INIT_VALUE 0x55
34 +static inline int init_tmp451_remote_therm_limit(void)
36 + struct udevice *dev;
37 + unsigned char r_therm_limit = TMP451_REMOTE_THERM_LIMIT_INIT_VALUE;
40 + ret = i2c_get_chip_for_busnum(CONFIG_SYS_TMP451_BUS_NUM,
41 + CONFIG_SYS_I2C_TMP451_ADDR,
42 + CONFIG_SYS_I2C_TMP451_ADDR_LEN,
46 + ret = dm_i2c_write(dev, TMP451_REMOTE_THERM_LIMIT_REG_OFFSET,
48 + sizeof(unsigned char));
52 static inline int spl_reset_device_by_gpio(const char *label, int pin, int low_width)
55 @@ -92,6 +115,12 @@ int spl_board_init_f(void)
59 + ret = init_tmp451_remote_therm_limit();
61 + debug("TMP451 remote THERM limit init failed: %d\n", ret);
65 ret = spl_gemgxl_init();
67 debug("Gigabit ethernet PHY (VSC8541) init failed: %d\n", ret);
68 --- a/drivers/misc/Kconfig
69 +++ b/drivers/misc/Kconfig
70 @@ -536,8 +536,18 @@ config SYS_I2C_EEPROM_ADDR
71 depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM
74 +config SYS_I2C_TMP451_ADDR
75 + hex "Chip address of the TMP451 device"
80 +config SYS_I2C_TMP451_ADDR_LEN
81 + int "Length in bytes of the TMP451 memory array address"
84 + Note: This is NOT the chip address length!
86 config SYS_I2C_EEPROM_ADDR_OVERFLOW
87 hex "EEPROM Address Overflow"
89 --- a/include/configs/sifive-unmatched.h
90 +++ b/include/configs/sifive-unmatched.h
93 #define CONFIG_STANDALONE_LOAD_ADDR 0x80200000
95 +#define CONFIG_SYS_TMP451_BUS_NUM 0
96 +#define CONFIG_SYS_I2C_TMP451_ADDR 0x4c
97 +#define CONFIG_SYS_I2C_TMP451_ADDR_LEN 0x1
99 /* Environment options */
101 #define BOOT_TARGET_DEVICES(func) \
102 --- a/scripts/config_whitelist.txt
103 +++ b/scripts/config_whitelist.txt
104 @@ -1268,6 +1268,7 @@ CONFIG_SYS_TIMER_BASE
105 CONFIG_SYS_TIMER_COUNTER
106 CONFIG_SYS_TIMER_COUNTS_DOWN
107 CONFIG_SYS_TIMER_RATE
108 +CONFIG_SYS_TMP451_BUS_NUM
110 CONFIG_SYS_TSEC1_OFFSET
111 CONFIG_SYS_TX_ETH_BUFFER