]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: grouper: convert ASUS Google Nexus 7 (2012) to use DM PMIC
authorSvyatoslav Ryhel <clamor95@gmail.com>
Sat, 26 Aug 2023 15:46:27 +0000 (18:46 +0300)
committerSvyatoslav Ryhel <clamor95@gmail.com>
Tue, 28 Nov 2023 07:16:55 +0000 (09:16 +0200)
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@gmail.com>
12 files changed:
arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts
arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts
arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts
board/asus/grouper/Kconfig
board/asus/grouper/Makefile
board/asus/grouper/configs/grouper_E1565.config
board/asus/grouper/configs/grouper_PM269.config
board/asus/grouper/configs/tilapia.config
board/asus/grouper/grouper-spl-max.c
board/asus/grouper/grouper-spl-ti.c
board/asus/grouper/grouper.c
configs/grouper_common_defconfig

index 945ae404acca7793a7c9f58e327d8c93ea25d8c1..bfc675ca9261ad7b20c6bf6759908353da279d75 100644 (file)
@@ -35,6 +35,7 @@
                                        regulator-name = "vcore_emmc";
                                        regulator-min-microvolt = <2850000>;
                                        regulator-max-microvolt = <2850000>;
+                                       regulator-boot-on;
                                };
                        };
                };
index 4363bfc87d8e2230e72d0cad9cc1d55b90c242e7..cf03011bc1fad9514cdc163673a7809f9141c32d 100644 (file)
@@ -36,6 +36,7 @@
                                        regulator-name = "vdd_emmc_core";
                                        regulator-min-microvolt = <3300000>;
                                        regulator-max-microvolt = <3300000>;
+                                       regulator-boot-on;
                                };
                        };
                };
index 89348fde134353f488034671d4eb4a079e3339c4..ef8b2b5049b759e778f3f8f1e97abc029c7ad25b 100644 (file)
@@ -35,6 +35,7 @@
                                        regulator-name = "vcore_emmc";
                                        regulator-min-microvolt = <2850000>;
                                        regulator-max-microvolt = <2850000>;
+                                       regulator-boot-on;
                                };
                        };
                };
index 47d9bae94682de7cc03a8b78470fce9a99433778..f935cce4225acc41a61f8e15f23c5171ea05c9eb 100644 (file)
@@ -9,12 +9,4 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
        default "grouper"
 
-config GROUPER_TPS65911
-       bool "Enable support TI TPS65911 PMIC"
-       select CMD_POWEROFF
-
-config GROUPER_MAX77663
-       bool "Enable support MAXIM MAX77663 PMIC"
-       select CMD_POWEROFF
-
 endif
index e4a477a36690bab021ca642dfdd5d14876df87b9..d041cf80870203518d6e7b23ed45ef803021efc1 100644 (file)
@@ -7,8 +7,8 @@
 #  Svyatoslav Ryhel <clamor95@gmail.com>
 
 ifdef CONFIG_SPL_BUILD
-obj-$(CONFIG_GROUPER_MAX77663) += grouper-spl-max.o
-obj-$(CONFIG_GROUPER_TPS65911) += grouper-spl-ti.o
+obj-$(CONFIG_DM_PMIC_MAX77663) += grouper-spl-max.o
+obj-$(CONFIG_DM_PMIC_TPS65910) += grouper-spl-ti.o
 endif
 
 obj-y += grouper.o
index 4d8d5263fa96a32b7d7d1b6dccd09e59ecad6e15..265295c8b3ef0898c91f4fb1a0aa6cb7568b13fc 100644 (file)
@@ -1,2 +1,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-E1565"
-CONFIG_GROUPER_MAX77663=y
+CONFIG_CMD_POWEROFF=y
+# CONFIG_MAX77663_GPIO is not set
+CONFIG_DM_PMIC_MAX77663=y
+CONFIG_DM_REGULATOR_MAX77663=y
+CONFIG_SYSRESET_MAX77663=y
index fc768b2051767b97fd0f855c0c537a54e36dcfe8..a7ee3587edd7cea692dc44385c300812ab2f4d6e 100644 (file)
@@ -1,2 +1,6 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-PM269"
-CONFIG_GROUPER_TPS65911=y
+CONFIG_CMD_POWEROFF=y
+CONFIG_DM_PMIC_TPS65910=y
+# CONFIG_DM_REGULATOR_TPS65910 is not set
+CONFIG_DM_REGULATOR_TPS65911=y
+CONFIG_SYSRESET_TPS65910=y
index 1fb0633e3a72f4f038201994d822d310dc74ca92..d461b4752a91db4a315a9a414322875ab4ef13ce 100644 (file)
@@ -1,3 +1,7 @@
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-tilapia-E1565"
-CONFIG_GROUPER_MAX77663=y
 CONFIG_SYS_PROMPT="Tegra30 (Tilapia) # "
+CONFIG_CMD_POWEROFF=y
+# CONFIG_MAX77663_GPIO is not set
+CONFIG_DM_PMIC_MAX77663=y
+CONFIG_DM_REGULATOR_MAX77663=y
+CONFIG_SYSRESET_MAX77663=y
index 844383766a7ffd446934c8bb8bc73ae9abd02444..3e58bf97cc417366b4bbbddf6979b89534fa11e2 100644 (file)
@@ -9,7 +9,7 @@
  *  Svyatoslav Ryhel <clamor95@gmail.com>
  */
 
-#include <common.h>
+#include <asm/arch/tegra.h>
 #include <asm/arch-tegra/tegra_i2c.h>
 #include <linux/delay.h>
 
index e5b78f01215c1d7d054f84880ac02387b1398bb0..1dcce80b48c525c8c0cd34ee2fb4af2d97188ddf 100644 (file)
@@ -9,7 +9,7 @@
  *  Svyatoslav Ryhel <clamor95@gmail.com>
  */
 
-#include <common.h>
+#include <asm/arch/tegra.h>
 #include <asm/arch-tegra/tegra_i2c.h>
 #include <linux/delay.h>
 
index 5398ec8b9f853dec62c0ef123427c1cc675b73ad..dc1d1102c3ff7527113189e8febd224846abda90 100644 (file)
  *  Svyatoslav Ryhel <clamor95@gmail.com>
  */
 
-#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-grouper.h"
-
-#define TPS65911_I2C_ADDRESS           0x2D
-
-#define TPS65911_REG_LDO1              0x30
-#define TPS65911_REG_DEVCTRL           0x3F
-#define   DEVCTRL_PWR_OFF_MASK         BIT(7)
-#define   DEVCTRL_DEV_ON_MASK          BIT(2)
-#define   DEVCTRL_DEV_OFF_MASK         BIT(0)
-
-#define MAX77663_I2C_ADDRESS           0x3C
-
-#define MAX77663_REG_SD2               0x18
-#define MAX77663_REG_LDO3              0x29
-#define MAX77663_REG_ONOFF_CFG1                0x41
-#define   ONOFF_PWR_OFF                        BIT(1)
-
-#ifdef CONFIG_CMD_POWEROFF
-#ifdef CONFIG_GROUPER_TPS65911
-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;
-       }
-
-       ret = dm_i2c_read(dev, TPS65911_REG_DEVCTRL, data_buffer, 1);
-       if (ret)
-               return ret;
-
-       data_buffer[0] |= DEVCTRL_PWR_OFF_MASK;
-
-       ret = dm_i2c_write(dev, TPS65911_REG_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_REG_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 /* CONFIG_GROUPER_TPS65911 */
-
-#ifdef CONFIG_GROUPER_MAX77663
-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, MAX77663_I2C_ADDRESS, 1, &dev);
-       if (ret) {
-               log_debug("cannot find PMIC I2C chip\n");
-               return 0;
-       }
-
-       ret = dm_i2c_read(dev, MAX77663_REG_ONOFF_CFG1, data_buffer, 1);
-       if (ret)
-               return ret;
-
-       data_buffer[0] |= ONOFF_PWR_OFF;
-
-       ret = dm_i2c_write(dev, MAX77663_REG_ONOFF_CFG1, 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 /* CONFIG_GROUPER_MAX77663 */
-#endif /* CONFIG_CMD_POWEROFF */
+#include "pinmux-config-grouper.h"
 
 /*
  * Routine: pinmux_init
@@ -120,64 +27,6 @@ void pinmux_init(void)
                ARRAY_SIZE(grouper_padctrl));
 }
 
-#ifdef CONFIG_MMC_SDHCI_TEGRA
-static void __maybe_unused tps65911_voltage_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_REG_LDO1, 0xC9);
-       if (ret)
-               log_debug("vcore_emmc set failed: %d\n", ret);
-}
-
-static void __maybe_unused max77663_voltage_init(void)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = i2c_get_chip_for_busnum(0, MAX77663_I2C_ADDRESS, 1, &dev);
-       if (ret) {
-               log_debug("cannot find PMIC I2C chip\n");
-               return;
-       }
-
-       /* 0x60 for 1.8v, bit7:0 = voltage */
-       ret = dm_i2c_reg_write(dev, MAX77663_REG_SD2, 0x60);
-       if (ret)
-               log_debug("vdd_1v8_vio set failed: %d\n", ret);
-
-       /* 0xEC for 3.00v, enabled: bit7:6 = 11 = enable, bit5:0 = voltage */
-       ret = dm_i2c_reg_write(dev, MAX77663_REG_LDO3, 0xEC);
-       if (ret)
-               log_debug("vcore_emmc set failed: %d\n", ret);
-}
-
-/*
- * Routine: pin_mux_mmc
- * Description: setup the MMC muxes, power rails, etc.
- */
-void pin_mux_mmc(void)
-{
-#ifdef CONFIG_GROUPER_MAX77663
-       /* Bring up eMMC power on MAX PMIC */
-       max77663_voltage_init();
-#endif
-
-#ifdef CONFIG_GROUPER_TPS65911
-       /* Bring up eMMC power on TI PMIC */
-       tps65911_voltage_init();
-#endif
-}
-#endif /* MMC */
-
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
index 258d7b1139c3565893f5675fcf9e3e6f93c95431..616540f7d50c87ea31eeb4a87f45b41300572e00 100644 (file)
@@ -43,6 +43,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