[PATCH] arm: baltos: switch to CONFIG_DM_I2C
yegorslists at googlemail.com
yegorslists at googlemail.com
Mon May 15 16:26:44 CEST 2023
From: Yegor Yefremov <yegorslists at googlemail.com>
Also use the TPS65910 driver directly.
Signed-off-by: Yegor Yefremov <yegorslists at googlemail.com>
---
board/vscom/baltos/board.c | 44 ++++++++++++++-------------------
configs/am335x_baltos_defconfig | 8 +++---
2 files changed, 23 insertions(+), 29 deletions(-)
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index f335d5b4f4..8f23cda8e4 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -76,17 +76,23 @@ static int baltos_set_console(void)
static int read_eeprom(BSP_VS_HWPARAM *header)
{
- i2c_set_bus_num(1);
+ int rc;
+ struct udevice *dev;
+ struct udevice *bus;
+
+ rc = uclass_get_device_by_seq(UCLASS_I2C, 1, &bus);
+ if (rc)
+ return rc;
/* Check if baseboard eeprom is available */
- if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
+ if (dm_i2c_probe(bus, CONFIG_SYS_I2C_EEPROM_ADDR, 0, &dev)) {
puts("Could not probe the EEPROM; something fundamentally "
"wrong on the I2C bus.\n");
return -ENODEV;
}
/* read the eeprom using i2c */
- if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
+ if (dm_i2c_read(dev, 0, (uchar *)header,
sizeof(BSP_VS_HWPARAM))) {
puts("Could not read the EEPROM; something fundamentally"
" wrong on the I2C bus.\n");
@@ -173,34 +179,28 @@ const struct dpll_params dpll_ddr_baltos = {
void am33xx_spl_board_init(void)
{
- int mpu_vdd;
- int sil_rev;
+ int sil_rev, mpu_vdd;
+ int freq;
+
+ enable_i2c1_pin_mux();
+ i2c_set_bus_num(1);
- /* Get the frequency */
- dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
+ freq = am335x_get_efuse_mpu_max_freq(cdev);
/*
- * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all
+ * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all
* MPU frequencies we support we use a CORE voltage of
- * 1.1375V. For MPU voltage we need to switch based on
+ * 1.1375V. For MPU voltage we need to switch based on
* the frequency we are running at.
*/
- i2c_set_bus_num(1);
-
- printf("I2C speed: %d Hz\n", CONFIG_SYS_I2C_SPEED);
-
- if (i2c_probe(TPS65910_CTRL_I2C_ADDR)) {
- puts("i2c: cannot access TPS65910\n");
+ if (power_tps65910_init(1))
return;
- }
-
/*
* Depending on MPU clock and PG we will need a different
* VDD to drive at that speed.
*/
sil_rev = readl(&cdev->deviceid) >> 28;
- mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev,
- dpll_mpu_opp100.m);
+ mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, freq);
/* Tell the TPS65910 to use i2c */
tps65910_set_i2c_control();
@@ -213,12 +213,6 @@ void am33xx_spl_board_init(void)
if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_3))
return;
- /* Set CORE Frequencies to OPP100 */
- do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
-
- /* Set MPU Frequency to what we detected now that voltages are set */
- do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
-
writel(0x000010ff, PRM_DEVICE_INST + 4);
}
diff --git a/configs/am335x_baltos_defconfig b/configs/am335x_baltos_defconfig
index 090b902be3..6ef3c78390 100644
--- a/configs/am335x_baltos_defconfig
+++ b/configs/am335x_baltos_defconfig
@@ -18,7 +18,6 @@ CONFIG_OF_BOARD_SETUP=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_BOOTCOMMAND="run findfdt; run usbboot;run mmcboot;setenv mmcdev 1; setenv bootpart 1:2; run mmcboot;run nandboot;"
CONFIG_SYS_CONSOLE_INFO_QUIET=y
-CONFIG_ARCH_MISC_INIT=y
CONFIG_SYS_SPL_MALLOC=y
CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
CONFIG_SPL_FS_EXT4=y
@@ -57,10 +56,10 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_VERSION_VARIABLE=y
CONFIG_NET_RETRY_COUNT=10
CONFIG_BOOTP_SEND_HOSTNAME=y
+# CONFIG_TI_SYSC is not set
CONFIG_BOOTCOUNT_LIMIT=y
-CONFIG_SYS_I2C_LEGACY=y
+CONFIG_DM_I2C=y
CONFIG_SPL_SYS_I2C_LEGACY=y
-CONFIG_SYS_I2C_SPEED=1000
CONFIG_SYS_I2C_EEPROM_ADDR=0x50
CONFIG_MMC_OMAP_HS=y
CONFIG_MMC_OMAP_HS_ADMA=y
@@ -79,6 +78,8 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_MDIO=y
CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y
+CONFIG_DM_PMIC=y
+# CONFIG_PMIC_CHILDREN is not set
CONFIG_SPL_POWER_TPS65910=y
CONFIG_SPI=y
CONFIG_DM_SPI=y
@@ -94,5 +95,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_FUNCTION_MASS_STORAGE=y
CONFIG_USB_ETHER=y
-CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
CONFIG_WDT=y
--
2.34.1
More information about the U-Boot
mailing list