arm: baltos: switch to CONFIG_DM_I2C

Also use the TPS65910 driver directly.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
This commit is contained in:
Yegor Yefremov 2023-05-15 16:26:44 +02:00 committed by Tom Rini
parent eab13ca620
commit e0feee58ac
2 changed files with 25 additions and 31 deletions

View file

@ -76,17 +76,23 @@ static int baltos_set_console(void)
static int read_eeprom(BSP_VS_HWPARAM *header) 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 */ /* 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 " puts("Could not probe the EEPROM; something fundamentally "
"wrong on the I2C bus.\n"); "wrong on the I2C bus.\n");
return -ENODEV; return -ENODEV;
} }
/* read the eeprom using i2c */ /* 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))) { sizeof(BSP_VS_HWPARAM))) {
puts("Could not read the EEPROM; something fundamentally" puts("Could not read the EEPROM; something fundamentally"
" wrong on the I2C bus.\n"); " wrong on the I2C bus.\n");
@ -173,34 +179,28 @@ const struct dpll_params dpll_ddr_baltos = {
void am33xx_spl_board_init(void) void am33xx_spl_board_init(void)
{ {
int mpu_vdd; int sil_rev, mpu_vdd;
int sil_rev; int freq;
/* Get the frequency */ enable_i2c1_pin_mux();
dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
/*
* 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
* the frequency we are running at.
*/
i2c_set_bus_num(1); i2c_set_bus_num(1);
printf("I2C speed: %d Hz\n", CONFIG_SYS_I2C_SPEED); freq = am335x_get_efuse_mpu_max_freq(cdev);
if (i2c_probe(TPS65910_CTRL_I2C_ADDR)) { /*
puts("i2c: cannot access TPS65910\n"); * 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
* the frequency we are running at.
*/
if (power_tps65910_init(1))
return; return;
}
/* /*
* Depending on MPU clock and PG we will need a different * Depending on MPU clock and PG we will need a different
* VDD to drive at that speed. * VDD to drive at that speed.
*/ */
sil_rev = readl(&cdev->deviceid) >> 28; sil_rev = readl(&cdev->deviceid) >> 28;
mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev, freq);
dpll_mpu_opp100.m);
/* Tell the TPS65910 to use i2c */ /* Tell the TPS65910 to use i2c */
tps65910_set_i2c_control(); 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)) if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_3))
return; 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); writel(0x000010ff, PRM_DEVICE_INST + 4);
} }

View file

@ -18,7 +18,6 @@ CONFIG_OF_BOARD_SETUP=y
CONFIG_DISTRO_DEFAULTS=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_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_SYS_CONSOLE_INFO_QUIET=y
CONFIG_ARCH_MISC_INIT=y
CONFIG_SYS_SPL_MALLOC=y CONFIG_SYS_SPL_MALLOC=y
CONFIG_SYS_SPL_MALLOC_SIZE=0x800000 CONFIG_SYS_SPL_MALLOC_SIZE=0x800000
CONFIG_SPL_FS_EXT4=y CONFIG_SPL_FS_EXT4=y
@ -57,10 +56,10 @@ CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
CONFIG_VERSION_VARIABLE=y CONFIG_VERSION_VARIABLE=y
CONFIG_NET_RETRY_COUNT=10 CONFIG_NET_RETRY_COUNT=10
CONFIG_BOOTP_SEND_HOSTNAME=y CONFIG_BOOTP_SEND_HOSTNAME=y
# CONFIG_TI_SYSC is not set
CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_LIMIT=y
CONFIG_SYS_I2C_LEGACY=y CONFIG_DM_I2C=y
CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SPL_SYS_I2C_LEGACY=y
CONFIG_SYS_I2C_SPEED=1000
CONFIG_SYS_I2C_EEPROM_ADDR=0x50 CONFIG_SYS_I2C_EEPROM_ADDR=0x50
CONFIG_MMC_OMAP_HS=y CONFIG_MMC_OMAP_HS=y
CONFIG_MMC_OMAP_HS_ADMA=y CONFIG_MMC_OMAP_HS_ADMA=y
@ -79,6 +78,8 @@ CONFIG_PHY_SMSC=y
CONFIG_DM_MDIO=y CONFIG_DM_MDIO=y
CONFIG_MII=y CONFIG_MII=y
CONFIG_DRIVER_TI_CPSW=y CONFIG_DRIVER_TI_CPSW=y
CONFIG_DM_PMIC=y
# CONFIG_PMIC_CHILDREN is not set
CONFIG_SPL_POWER_TPS65910=y CONFIG_SPL_POWER_TPS65910=y
CONFIG_SPI=y CONFIG_SPI=y
CONFIG_DM_SPI=y CONFIG_DM_SPI=y
@ -94,5 +95,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xbd00
CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_FUNCTION_MASS_STORAGE=y CONFIG_USB_FUNCTION_MASS_STORAGE=y
CONFIG_USB_ETHER=y CONFIG_USB_ETHER=y
CONFIG_USBNET_HOST_ADDR="de:ad:be:af:00:00"
CONFIG_WDT=y CONFIG_WDT=y