[PATCH v1 3/5] board: transformer-t30: convert ASUS Transformers to use DM PMIC

Svyatoslav Ryhel clamor95 at gmail.com
Mon Nov 6 09:32:27 CET 2023


Since required drivers were merged, we can safely clean up the
board and switch to DM based driver with device tree support.

Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
---
 arch/arm/dts/tegra30-asus-p1801-t.dts         |   2 +
 arch/arm/dts/tegra30-asus-tf600t.dts          |   4 +
 arch/arm/dts/tegra30-asus-transformer.dtsi    |   2 +
 board/asus/transformer-t30/Kconfig            |  10 --
 .../transformer-t30/configs/tf600t.config     |   2 +-
 .../transformer-t30/transformer-t30-spl.c     |   2 +-
 board/asus/transformer-t30/transformer-t30.c  | 121 +-----------------
 configs/transformer_t30_defconfig             |   5 +
 8 files changed, 21 insertions(+), 127 deletions(-)

diff --git a/arch/arm/dts/tegra30-asus-p1801-t.dts b/arch/arm/dts/tegra30-asus-p1801-t.dts
index 39f7caf8d0..d62d43268b 100644
--- a/arch/arm/dts/tegra30-asus-p1801-t.dts
+++ b/arch/arm/dts/tegra30-asus-p1801-t.dts
@@ -101,6 +101,7 @@
 					regulator-name = "vdd_emmc_core";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
+					regulator-boot-on;
 				};
 
 				/* uSD slot VDD */
@@ -108,6 +109,7 @@
 					regulator-name = "vdd_usd";
 					regulator-min-microvolt = <3100000>;
 					regulator-max-microvolt = <3100000>;
+					regulator-boot-on;
 				};
 
 				/* uSD slot VDDIO */
diff --git a/arch/arm/dts/tegra30-asus-tf600t.dts b/arch/arm/dts/tegra30-asus-tf600t.dts
index fd9d11ca19..efc6a83b9d 100644
--- a/arch/arm/dts/tegra30-asus-tf600t.dts
+++ b/arch/arm/dts/tegra30-asus-tf600t.dts
@@ -84,12 +84,14 @@
 					regulator-name = "vdd_1v2_backlight";
 					regulator-min-microvolt = <1200000>;
 					regulator-max-microvolt = <1200000>;
+					regulator-boot-on;
 				};
 
 				vcore_lcd: vdd2 {
 					regulator-name = "vcore_lcd";
 					regulator-min-microvolt = <1500000>;
 					regulator-max-microvolt = <1500000>;
+					regulator-boot-on;
 				};
 
 				vdd_1v8_vio: vddio {
@@ -105,6 +107,7 @@
 					regulator-name = "vdd_emmc_core";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
+					regulator-boot-on;
 				};
 
 				/* uSD slot VDDIO */
@@ -119,6 +122,7 @@
 					regulator-name = "avdd_dsi_csi";
 					regulator-min-microvolt = <1200000>;
 					regulator-max-microvolt = <1200000>;
+					regulator-boot-on;
 				};
 			};
 		};
diff --git a/arch/arm/dts/tegra30-asus-transformer.dtsi b/arch/arm/dts/tegra30-asus-transformer.dtsi
index 888f9ca74e..afddb83983 100644
--- a/arch/arm/dts/tegra30-asus-transformer.dtsi
+++ b/arch/arm/dts/tegra30-asus-transformer.dtsi
@@ -82,6 +82,7 @@
 					regulator-name = "vdd_emmc_core";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
+					regulator-boot-on;
 				};
 
 				/* uSD slot VDD */
@@ -89,6 +90,7 @@
 					regulator-name = "vdd_usd";
 					regulator-min-microvolt = <3100000>;
 					regulator-max-microvolt = <3100000>;
+					regulator-boot-on;
 				};
 
 				/* uSD slot VDDIO */
diff --git a/board/asus/transformer-t30/Kconfig b/board/asus/transformer-t30/Kconfig
index accc999c43..915436ba6c 100644
--- a/board/asus/transformer-t30/Kconfig
+++ b/board/asus/transformer-t30/Kconfig
@@ -9,14 +9,4 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "transformer-t30"
 
-config TRANSFORMER_SPI_BOOT
-	bool "Enable support for SPI based flash"
-	select TEGRA20_SLINK
-	select DM_SPI_FLASH
-	select SPI_FLASH_WINBOND
-	help
-	  Tegra 3 based Transformers with Windows RT have core
-	  boot sequence (BCT and EBT) on separate SPI FLASH
-	  memory with 4MB size.
-
 endif
diff --git a/board/asus/transformer-t30/configs/tf600t.config b/board/asus/transformer-t30/configs/tf600t.config
index 18ab4fbd87..e40d0fdd47 100644
--- a/board/asus/transformer-t30/configs/tf600t.config
+++ b/board/asus/transformer-t30/configs/tf600t.config
@@ -1,4 +1,4 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf600t"
-CONFIG_TRANSFORMER_SPI_BOOT=y
 CONFIG_BOOTCOMMAND="setenv gpio_button 222; if run check_button; then poweroff; fi; setenv gpio_button 132; if run check_button; then echo Starting SPI flash update ...; run update_spi; fi; run bootcmd_usb0; run bootcmd_mmc1; run bootcmd_mmc0; poweroff;"
+CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_USB_GADGET_PRODUCT_NUM=0x4d00
diff --git a/board/asus/transformer-t30/transformer-t30-spl.c b/board/asus/transformer-t30/transformer-t30-spl.c
index 89819b2b92..952e2c8224 100644
--- a/board/asus/transformer-t30/transformer-t30-spl.c
+++ b/board/asus/transformer-t30/transformer-t30-spl.c
@@ -9,7 +9,7 @@
  *  Svyatoslav Ryhel <clamor95 at gmail.com>
  */
 
-#include <common.h>
+#include <asm/arch/tegra.h>
 #include <asm/arch-tegra/tegra_i2c.h>
 #include <linux/delay.h>
 
diff --git a/board/asus/transformer-t30/transformer-t30.c b/board/asus/transformer-t30/transformer-t30.c
index ba795a802e..29d77146bb 100644
--- a/board/asus/transformer-t30/transformer-t30.c
+++ b/board/asus/transformer-t30/transformer-t30.c
@@ -9,70 +9,13 @@
 
 /* T30 Transformers derive from Cardhu board */
 
-#include <common.h>
 #include <dm.h>
 #include <fdt_support.h>
-#include <i2c.h>
-#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/gp_padctrl.h>
-#include <asm/arch/gpio.h>
-#include <asm/gpio.h>
-#include <linux/delay.h>
-#include "pinmux-config-transformer.h"
-
-#define TPS65911_I2C_ADDRESS		0x2D
-
-#define TPS65911_VDD1			0x21
-#define TPS65911_VDD1_OP		0x22
-#define TPS65911_LDO1			0x30
-#define TPS65911_LDO2			0x31
-#define TPS65911_LDO3			0x37
-#define TPS65911_LDO5			0x32
-#define TPS65911_LDO6			0x35
-
-#define TPS65911_DEVCTRL		0x3F
-#define   DEVCTRL_PWR_OFF_MASK		BIT(7)
-#define   DEVCTRL_DEV_ON_MASK		BIT(2)
-#define   DEVCTRL_DEV_OFF_MASK		BIT(0)
-
-#ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(struct cmd_tbl *cmdtp, int flag,
-		int argc, char *const argv[])
-{
-	struct udevice *dev;
-	uchar data_buffer[1];
-	int ret;
-
-	ret = i2c_get_chip_for_busnum(0, TPS65911_I2C_ADDRESS, 1, &dev);
-	if (ret) {
-		log_debug("cannot find PMIC I2C chip\n");
-		return 0;
-	}
+#include <power/regulator.h>
 
-	ret = dm_i2c_read(dev, TPS65911_DEVCTRL, data_buffer, 1);
-	if (ret)
-		return ret;
-
-	data_buffer[0] |= DEVCTRL_PWR_OFF_MASK;
-
-	ret = dm_i2c_write(dev, TPS65911_DEVCTRL, data_buffer, 1);
-	if (ret)
-		return ret;
-
-	data_buffer[0] |= DEVCTRL_DEV_OFF_MASK;
-	data_buffer[0] &= ~DEVCTRL_DEV_ON_MASK;
-
-	ret = dm_i2c_write(dev, TPS65911_DEVCTRL, data_buffer, 1);
-	if (ret)
-		return ret;
-
-	// wait some time and then print error
-	mdelay(5000);
-	printf("Failed to power off!!!\n");
-	return 1;
-}
-#endif
+#include "pinmux-config-transformer.h"
 
 /*
  * Routine: pinmux_init
@@ -92,65 +35,13 @@ void pinmux_init(void)
 	}
 }
 
-#ifdef CONFIG_MMC_SDHCI_TEGRA
-static void tps65911_voltage_init(void)
+int nvidia_board_init(void)
 {
-	struct udevice *dev;
-	int ret;
-
-	ret = i2c_get_chip_for_busnum(0, TPS65911_I2C_ADDRESS, 1, &dev);
-	if (ret) {
-		log_debug("cannot find PMIC I2C chip\n");
-		return;
-	}
-
-	/* TPS659110: LDO1_REG = 3.3v, ACTIVE to SDMMC4 */
-	ret = dm_i2c_reg_write(dev, TPS65911_LDO1, 0xc9);
-	if (ret)
-		log_debug("vcore_emmc set failed: %d\n", ret);
-
-	if (of_machine_is_compatible("asus,tf600t")) {
-		/* TPS659110: VDD1_REG = 1.2v, ACTIVE to backlight */
-		ret = dm_i2c_reg_write(dev, TPS65911_VDD1_OP, 0x33);
-		if (ret)
-			log_debug("vdd_bl set failed: %d\n", ret);
-
-		ret = dm_i2c_reg_write(dev, TPS65911_VDD1, 0x0d);
-		if (ret)
-			log_debug("vdd_bl enable failed: %d\n", ret);
-
-		/* TPS659110: LDO5_REG = 3.3v, ACTIVE to SDMMC1 VIO */
-		ret = dm_i2c_reg_write(dev, TPS65911_LDO5, 0x65);
-		if (ret)
-			log_debug("vdd_usd set failed: %d\n", ret);
-
-		/* TPS659110: LDO6_REG = 1.2v, ACTIVE to MIPI */
-		ret = dm_i2c_reg_write(dev, TPS65911_LDO6, 0x11);
-		if (ret)
-			log_debug("vdd_mipi set failed: %d\n", ret);
-	} else {
-		/* TPS659110: LDO2_REG = 3.1v, ACTIVE to SDMMC1 */
-		ret = dm_i2c_reg_write(dev, TPS65911_LDO2, 0xb9);
-		if (ret)
-			log_debug("vdd_usd set failed: %d\n", ret);
+	/* Set up boot-on regulators */
+	regulators_enable_boot_on(true);
 
-		/* TPS659110: LDO3_REG = 3.1v, ACTIVE to SDMMC1 VIO */
-		ret = dm_i2c_reg_write(dev, TPS65911_LDO3, 0x5d);
-		if (ret)
-			log_debug("vddio_usd set failed: %d\n", ret);
-	}
-}
-
-/*
- * Routine: pin_mux_mmc
- * Description: setup the MMC muxes, power rails, etc.
- */
-void pin_mux_mmc(void)
-{
-	/* Bring up uSD and eMMC power */
-	tps65911_voltage_init();
+	return 0;
 }
-#endif	/* MMC */
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
diff --git a/configs/transformer_t30_defconfig b/configs/transformer_t30_defconfig
index 092c0aa2b0..8d828c1fa6 100644
--- a/configs/transformer_t30_defconfig
+++ b/configs/transformer_t30_defconfig
@@ -45,6 +45,7 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_UMS_ABORT_KEYED=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_PAUSE=y
+CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
@@ -65,10 +66,14 @@ CONFIG_I2C_MUX=y
 CONFIG_I2C_MUX_GPIO=y
 CONFIG_BUTTON_KEYBOARD=y
 CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_TPS65910=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_TPS65911=y
 CONFIG_PWM_TEGRA=y
 CONFIG_SYS_NS16550=y
+CONFIG_TEGRA20_SLINK=y
+CONFIG_SYSRESET_TPS65910=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_TEGRA=y
-- 
2.40.1



More information about the U-Boot mailing list