summaryrefslogtreecommitdiff
path: root/board/asus/grouper
diff options
context:
space:
mode:
Diffstat (limited to 'board/asus/grouper')
-rw-r--r--board/asus/grouper/MAINTAINERS4
-rw-r--r--board/asus/grouper/Makefile6
-rw-r--r--board/asus/grouper/board-info.c84
-rw-r--r--board/asus/grouper/configs/grouper_E1565.config6
-rw-r--r--board/asus/grouper/configs/grouper_PM269.config6
-rw-r--r--board/asus/grouper/configs/tilapia.config7
-rw-r--r--board/asus/grouper/grouper-spl-max.c45
-rw-r--r--board/asus/grouper/grouper-spl-ti.c41
-rw-r--r--board/asus/grouper/grouper-spl.c105
-rw-r--r--board/asus/grouper/grouper.env15
10 files changed, 208 insertions, 111 deletions
diff --git a/board/asus/grouper/MAINTAINERS b/board/asus/grouper/MAINTAINERS
index f4068d85623..3c59632451f 100644
--- a/board/asus/grouper/MAINTAINERS
+++ b/board/asus/grouper/MAINTAINERS
@@ -2,6 +2,6 @@ GROUPER BOARD
M: Svyatoslav Ryhel <clamor95@gmail.com>
S: Maintained
F: board/asus/grouper/
-F: configs/grouper_common_defconfig
-F: doc/board/asus/grouper_common.rst
+F: configs/grouper_defconfig
+F: doc/board/asus/grouper.rst
F: include/configs/grouper.h
diff --git a/board/asus/grouper/Makefile b/board/asus/grouper/Makefile
index 05c6ffb405b..8a8e6530c86 100644
--- a/board/asus/grouper/Makefile
+++ b/board/asus/grouper/Makefile
@@ -6,9 +6,7 @@
# (C) Copyright 2021
# Svyatoslav Ryhel <clamor95@gmail.com>
-ifdef CONFIG_XPL_BUILD
-obj-$(CONFIG_DM_PMIC_MAX77663) += grouper-spl-max.o
-obj-$(CONFIG_DM_PMIC_TPS65910) += grouper-spl-ti.o
-endif
+obj-$(CONFIG_SPL_BUILD) += grouper-spl.o
+obj-$(CONFIG_MULTI_DTB_FIT) += board-info.o
obj-y += grouper.o
diff --git a/board/asus/grouper/board-info.c b/board/asus/grouper/board-info.c
new file mode 100644
index 00000000000..4892accc523
--- /dev/null
+++ b/board/asus/grouper/board-info.c
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2024
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <env.h>
+#include <spl_gpio.h>
+
+#include <asm/gpio.h>
+#include <asm/arch/pinmux.h>
+
+/*
+ * PMIC_ID is GMI_CS2_N_PK3
+ * MODEM_ID is GMI_CS4_N_PK2
+ *
+ * Extended Project ID
+ * ====================================
+ * MODEM_ID PMIC_ID project name
+ * 0 0 grouper-E1565
+ * 0 1 grouper-PM269
+ * 1 0 tilapia
+ */
+enum project_rev {
+ E1565, PM269, TILAPIA, COUNT,
+};
+
+static const char * const project_id_to_fdt[] = {
+ [E1565] = "tegra30-asus-nexus7-grouper-E1565",
+ [PM269] = "tegra30-asus-nexus7-grouper-PM269",
+ [TILAPIA] = "tegra30-asus-nexus7-tilapia-E1565",
+};
+
+static int id_gpio_get_value(u32 pingrp, u32 pin)
+{
+ /* Configure pinmux */
+ pinmux_set_func(pingrp, PMUX_FUNC_GMI);
+ pinmux_set_pullupdown(pingrp, PMUX_PULL_DOWN);
+ pinmux_tristate_enable(pingrp);
+ pinmux_set_io(pingrp, PMUX_PIN_INPUT);
+
+ /*
+ * Since this function may be called
+ * during DM reload we should use SPL
+ * GPIO functions which do not depend
+ * on DM.
+ */
+ spl_gpio_input(NULL, pin);
+ return spl_gpio_get_value(NULL, pin);
+}
+
+static int get_project_id(void)
+{
+ u32 pmic_id, modem_id, proj_id;
+
+ modem_id = id_gpio_get_value(PMUX_PINGRP_GMI_CS4_N_PK2,
+ TEGRA_GPIO(K, 2));
+ pmic_id = id_gpio_get_value(PMUX_PINGRP_GMI_CS2_N_PK3,
+ TEGRA_GPIO(K, 3));
+
+ proj_id = (modem_id << 1 | pmic_id) & COUNT;
+
+ log_debug("[GROUPER]: project id %d (%s)\n", proj_id,
+ project_id_to_fdt[proj_id]);
+
+ return proj_id;
+}
+
+int board_fit_config_name_match(const char *name)
+{
+ if (!strcmp(name, project_id_to_fdt[get_project_id()]))
+ return 0;
+
+ return -1;
+}
+
+void nvidia_board_late_init(void)
+{
+ char dt_path[64] = { 0 };
+
+ snprintf(dt_path, sizeof(dt_path), "%s.dtb",
+ project_id_to_fdt[get_project_id()]);
+ env_set("fdtfile", dt_path);
+}
diff --git a/board/asus/grouper/configs/grouper_E1565.config b/board/asus/grouper/configs/grouper_E1565.config
deleted file mode 100644
index 265295c8b3e..00000000000
--- a/board/asus/grouper/configs/grouper_E1565.config
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-E1565"
-CONFIG_CMD_POWEROFF=y
-# CONFIG_MAX77663_GPIO is not set
-CONFIG_DM_PMIC_MAX77663=y
-CONFIG_DM_REGULATOR_MAX77663=y
-CONFIG_SYSRESET_MAX77663=y
diff --git a/board/asus/grouper/configs/grouper_PM269.config b/board/asus/grouper/configs/grouper_PM269.config
deleted file mode 100644
index a7ee3587edd..00000000000
--- a/board/asus/grouper/configs/grouper_PM269.config
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-grouper-PM269"
-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
diff --git a/board/asus/grouper/configs/tilapia.config b/board/asus/grouper/configs/tilapia.config
deleted file mode 100644
index d461b4752a9..00000000000
--- a/board/asus/grouper/configs/tilapia.config
+++ /dev/null
@@ -1,7 +0,0 @@
-CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-nexus7-tilapia-E1565"
-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
diff --git a/board/asus/grouper/grouper-spl-max.c b/board/asus/grouper/grouper-spl-max.c
deleted file mode 100644
index 3e58bf97cc4..00000000000
--- a/board/asus/grouper/grouper-spl-max.c
+++ /dev/null
@@ -1,45 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * T30 Grouper MAX SPL stage configuration
- *
- * (C) Copyright 2010-2013
- * NVIDIA Corporation <www.nvidia.com>
- *
- * (C) Copyright 2022
- * Svyatoslav Ryhel <clamor95@gmail.com>
- */
-
-#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/tegra_i2c.h>
-#include <linux/delay.h>
-
-#define MAX77663_I2C_ADDR (0x3C << 1)
-
-#define MAX77663_REG_SD0 0x16
-#define MAX77663_REG_SD0_DATA (0x2100 | MAX77663_REG_SD0)
-#define MAX77663_REG_SD1 0x17
-#define MAX77663_REG_SD1_DATA (0x3000 | MAX77663_REG_SD1)
-#define MAX77663_REG_LDO4 0x2B
-#define MAX77663_REG_LDO4_DATA (0xE000 | MAX77663_REG_LDO4)
-
-#define MAX77663_REG_GPIO4 0x3A
-#define MAX77663_REG_GPIO4_DATA (0x0100 | MAX77663_REG_GPIO4)
-
-void pmic_enable_cpu_vdd(void)
-{
- /* Set VDD_CORE to 1.200V. */
- tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_SD1_DATA);
-
- udelay(1000);
-
- /* Bring up VDD_CPU to 1.0125V. */
- tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_SD0_DATA);
- udelay(1000);
-
- /* Bring up VDD_RTC to 1.200V. */
- tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_LDO4_DATA);
- udelay(10 * 1000);
-
- /* Set 32k-out gpio state */
- tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_GPIO4_DATA);
-}
diff --git a/board/asus/grouper/grouper-spl-ti.c b/board/asus/grouper/grouper-spl-ti.c
deleted file mode 100644
index 1dcce80b48c..00000000000
--- a/board/asus/grouper/grouper-spl-ti.c
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * T30 Grouper TI SPL stage configuration
- *
- * (C) Copyright 2010-2013
- * NVIDIA Corporation <www.nvidia.com>
- *
- * (C) Copyright 2022
- * Svyatoslav Ryhel <clamor95@gmail.com>
- */
-
-#include <asm/arch/tegra.h>
-#include <asm/arch-tegra/tegra_i2c.h>
-#include <linux/delay.h>
-
-#define TPS65911_I2C_ADDR (0x2D << 1)
-#define TPS65911_VDDCTRL_OP_REG 0x28
-#define TPS65911_VDDCTRL_SR_REG 0x27
-#define TPS65911_VDDCTRL_OP_DATA (0x2400 | TPS65911_VDDCTRL_OP_REG)
-#define TPS65911_VDDCTRL_SR_DATA (0x0100 | TPS65911_VDDCTRL_SR_REG)
-
-#define TPS62361B_I2C_ADDR (0x60 << 1)
-#define TPS62361B_SET3_REG 0x03
-#define TPS62361B_SET3_DATA (0x4600 | TPS62361B_SET3_REG)
-
-void pmic_enable_cpu_vdd(void)
-{
- /* Set VDD_CORE to 1.200V. */
- tegra_i2c_ll_write(TPS62361B_I2C_ADDR, TPS62361B_SET3_DATA);
-
- udelay(1000);
-
- /*
- * Bring up CPU VDD via the TPS65911x PMIC on the DVC I2C bus.
- * First set VDD to 1.0125V, then enable the VDD regulator.
- */
- tegra_i2c_ll_write(TPS65911_I2C_ADDR, TPS65911_VDDCTRL_OP_DATA);
- udelay(1000);
- tegra_i2c_ll_write(TPS65911_I2C_ADDR, TPS65911_VDDCTRL_SR_DATA);
- udelay(10 * 1000);
-}
diff --git a/board/asus/grouper/grouper-spl.c b/board/asus/grouper/grouper-spl.c
new file mode 100644
index 00000000000..a8d4e540ab2
--- /dev/null
+++ b/board/asus/grouper/grouper-spl.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * T30 Grouper SPL stage configuration
+ *
+ * (C) Copyright 2010-2013
+ * NVIDIA Corporation <www.nvidia.com>
+ *
+ * (C) Copyright 2022
+ * Svyatoslav Ryhel <clamor95@gmail.com>
+ */
+
+#include <asm/gpio.h>
+#include <asm/arch/pinmux.h>
+#include <asm/arch/tegra.h>
+#include <asm/arch-tegra/tegra_i2c.h>
+#include <spl_gpio.h>
+#include <linux/delay.h>
+
+#define MAX77663_I2C_ADDR (0x3C << 1)
+
+#define MAX77663_REG_SD0 0x16
+#define MAX77663_REG_SD0_DATA (0x2100 | MAX77663_REG_SD0)
+#define MAX77663_REG_SD1 0x17
+#define MAX77663_REG_SD1_DATA (0x3000 | MAX77663_REG_SD1)
+#define MAX77663_REG_LDO4 0x2B
+#define MAX77663_REG_LDO4_DATA (0xE000 | MAX77663_REG_LDO4)
+
+#define MAX77663_REG_GPIO4 0x3A
+#define MAX77663_REG_GPIO4_DATA (0x0100 | MAX77663_REG_GPIO4)
+
+#define TPS65911_I2C_ADDR (0x2D << 1)
+
+#define TPS65911_VDDCTRL_OP_REG 0x28
+#define TPS65911_VDDCTRL_SR_REG 0x27
+#define TPS65911_VDDCTRL_OP_DATA (0x2400 | TPS65911_VDDCTRL_OP_REG)
+#define TPS65911_VDDCTRL_SR_DATA (0x0100 | TPS65911_VDDCTRL_SR_REG)
+
+#define TPS62361B_I2C_ADDR (0x60 << 1)
+
+#define TPS62361B_SET3_REG 0x03
+#define TPS62361B_SET3_DATA (0x4600 | TPS62361B_SET3_REG)
+
+/*
+ * PCB_ID[8] is GMI_CS2_N_PK3
+ *
+ * PMIC module detection
+ * ==============================
+ * PCB_ID[8] 0 1
+ * PMIC Maxim TI
+ */
+static bool ti_pmic_detected(void)
+{
+ /* Configure pinmux */
+ pinmux_set_func(PMUX_PINGRP_GMI_CS2_N_PK3, PMUX_FUNC_GMI);
+ pinmux_set_pullupdown(PMUX_PINGRP_GMI_CS2_N_PK3, PMUX_PULL_DOWN);
+ pinmux_tristate_enable(PMUX_PINGRP_GMI_CS2_N_PK3);
+ pinmux_set_io(PMUX_PINGRP_GMI_CS2_N_PK3, PMUX_PIN_INPUT);
+
+ spl_gpio_input(NULL, TEGRA_GPIO(K, 3));
+ return spl_gpio_get_value(NULL, TEGRA_GPIO(K, 3));
+}
+
+static void max_enable_cpu_vdd(void)
+{
+ /* Set VDD_CORE to 1.200V. */
+ tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_SD1_DATA);
+
+ udelay(1000);
+
+ /* Bring up VDD_CPU to 1.0125V. */
+ tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_SD0_DATA);
+ udelay(1000);
+
+ /* Bring up VDD_RTC to 1.200V. */
+ tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_LDO4_DATA);
+ udelay(10 * 1000);
+
+ /* Set 32k-out gpio state */
+ tegra_i2c_ll_write(MAX77663_I2C_ADDR, MAX77663_REG_GPIO4_DATA);
+}
+
+static void ti_enable_cpu_vdd(void)
+{
+ /* Set VDD_CORE to 1.200V. */
+ tegra_i2c_ll_write(TPS62361B_I2C_ADDR, TPS62361B_SET3_DATA);
+
+ udelay(1000);
+
+ /*
+ * Bring up CPU VDD via the TPS65911x PMIC on the DVC I2C bus.
+ * First set VDD to 1.0125V, then enable the VDD regulator.
+ */
+ tegra_i2c_ll_write(TPS65911_I2C_ADDR, TPS65911_VDDCTRL_OP_DATA);
+ udelay(1000);
+ tegra_i2c_ll_write(TPS65911_I2C_ADDR, TPS65911_VDDCTRL_SR_DATA);
+ udelay(10 * 1000);
+}
+
+void pmic_enable_cpu_vdd(void)
+{
+ if (ti_pmic_detected())
+ ti_enable_cpu_vdd();
+ else
+ max_enable_cpu_vdd();
+}
diff --git a/board/asus/grouper/grouper.env b/board/asus/grouper/grouper.env
new file mode 100644
index 00000000000..b1f4aeb5552
--- /dev/null
+++ b/board/asus/grouper/grouper.env
@@ -0,0 +1,15 @@
+#include <env/nvidia/prod_upd.env>
+
+button_cmd_0_name=Volume Down
+button_cmd_0=bootmenu
+button_cmd_1_name=Lid
+button_cmd_1=poweroff
+partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
+
+bootmenu_0=mount internal storage=usb start && ums 0 mmc 0; bootmenu
+bootmenu_1=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; bootmenu
+bootmenu_2=update bootloader=run flash_uboot
+bootmenu_3=reboot RCM=enterrcm
+bootmenu_4=reboot=reset
+bootmenu_5=power off=poweroff
+bootmenu_delay=-1