diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/ti/common/board_detect.c | 4 | ||||
-rw-r--r-- | board/toradex/verdin-am62/verdin-am62.c | 52 |
2 files changed, 52 insertions, 4 deletions
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 0ec6d1aaf4..38e23ccbb6 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -129,7 +129,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, rc = dm_i2c_read(dev, 0x1, &offset_test, sizeof(offset_test)); - if (*((u32 *)ep) != (header & 0xFF)) + if (offset_test != ((header >> 8) & 0xFF)) one_byte_addressing = false; /* Corrupted data??? */ @@ -181,7 +181,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, rc = i2c_read(dev_addr, 0x1, byte, &offset_test, sizeof(offset_test)); - if (*((u32 *)ep) != (header & 0xFF)) + if (offset_test != ((header >> 8) & 0xFF)) one_byte_addressing = false; /* Corrupted data??? */ diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c index 2718263eb1..395eb365a0 100644 --- a/board/toradex/verdin-am62/verdin-am62.c +++ b/board/toradex/verdin-am62/verdin-am62.c @@ -14,10 +14,13 @@ #include <fdt_support.h> #include <init.h> #include <k3-ddrss.h> +#include <power/regulator.h> #include <spl.h> #include "../common/tdx-cfg-block.h" +#define VDD_CORE_REG "buck1" + DECLARE_GLOBAL_DATA_PTR; int board_init(void) @@ -50,9 +53,37 @@ int board_fit_config_name_match(const char *name) } #endif +static u32 get_vdd_core_nominal(void) +{ + int core_uvolt; + + switch (k3_get_speed_grade()) { + case 'G': + case 'K': + case 'S': + core_uvolt = 750000; + break; + case 'T': + default: + core_uvolt = 850000; + break; + } + return core_uvolt; +} + #if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, struct bd_info *bd) { + int core_uvolt; + + core_uvolt = get_vdd_core_nominal(); + if (core_uvolt != 850000) { + do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1", + "regulator-max-microvolt", core_uvolt, 0); + do_fixup_by_path_u32(blob, "/bus@f0000/i2c@20000000/pmic@30/regulators/buck1", + "regulator-min-microvolt", core_uvolt, 0); + } + return ft_common_board_setup(blob, bd); } #endif @@ -87,6 +118,22 @@ static void select_dt_from_module_version(void) int board_late_init(void) { + int ret; + int core_uvolt; + struct udevice *dev = NULL; + + core_uvolt = get_vdd_core_nominal(); + if (core_uvolt != 850000) { + /* Set CPU core voltage to 0.75V for slower speed grades */ + ret = regulator_get_by_devname(VDD_CORE_REG, &dev); + if (ret) + pr_err("VDD CORE Regulator get error: %d\n", ret); + + ret = regulator_set_value_force(dev, core_uvolt); + if (ret) + pr_err("VDD CORE Regulator value setting error: %d\n", ret); + } + select_dt_from_module_version(); return 0; @@ -102,12 +149,13 @@ void spl_board_init(void) { u32 val; - /* Set USB0 PHY core voltage to 0.85V */ + /* Clear USB0_PHY_CTRL_CORE_VOLTAGE */ + /* TI recommends to clear the bit independent of VDDA_CORE_USB */ val = readl(CTRLMMR_USB0_PHY_CTRL); val &= ~(CORE_VOLTAGE); writel(val, CTRLMMR_USB0_PHY_CTRL); - /* Set USB1 PHY core voltage to 0.85V */ + /* Clear USB1_PHY_CTRL_CORE_VOLTAGE */ val = readl(CTRLMMR_USB1_PHY_CTRL); val &= ~(CORE_VOLTAGE); writel(val, CTRLMMR_USB1_PHY_CTRL); |