arm: baltos: switch to CONFIG_DM_I2C

Also use the TPS65910 driver directly.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index f335d5b..8f23cda 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -76,17 +76,23 @@
 
 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 @@
 
 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 @@
 	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);
 }