Skip to content
Snippets Groups Projects
Commit 1c1608e0 authored by Svyatoslav Ryhel's avatar Svyatoslav Ryhel
Browse files

board: asus: grouper: implement multi-DTB support


Use board revision detection mechanism to choose correct DTB.
Adjust documentation and build setup accordingly.

Signed-off-by: default avatarSvyatoslav Ryhel <clamor95@gmail.com>
parent 1f7a5756
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -7,5 +7,6 @@
# Svyatoslav Ryhel <clamor95@gmail.com>
obj-$(CONFIG_SPL_BUILD) += grouper-spl.o
obj-$(CONFIG_MULTI_DTB_FIT) += board-info.o
obj-y += grouper.o
// 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);
}
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
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
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
......@@ -39,6 +39,7 @@ CONFIG_CMD_GPT=y
CONFIG_CMD_GPT_RENAME=y
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
CONFIG_CMD_POWEROFF=y
CONFIG_CMD_USB=y
CONFIG_CMD_USB_MASS_STORAGE=y
CONFIG_CMD_UMS_ABORT_KEYED=y
......@@ -48,6 +49,9 @@ CONFIG_CMD_REGULATOR=y
CONFIG_CMD_EXT4_WRITE=y
# CONFIG_SPL_DOS_PARTITION is not set
# CONFIG_SPL_EFI_PARTITION is not set
CONFIG_OF_LIST="tegra30-asus-nexus7-grouper-E1565 tegra30-asus-nexus7-grouper-PM269 tegra30-asus-nexus7-tilapia-E1565"
CONFIG_DTB_RESELECT=y
CONFIG_MULTI_DTB_FIT=y
CONFIG_ENV_OVERWRITE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_SYS_MMC_ENV_PART=2
......@@ -62,10 +66,16 @@ CONFIG_GPIO_HOG=y
CONFIG_SYS_I2C_TEGRA=y
CONFIG_BUTTON_KEYBOARD=y
CONFIG_DM_PMIC=y
CONFIG_DM_PMIC_MAX77663=y
CONFIG_DM_PMIC_TPS65910=y
CONFIG_DM_REGULATOR=y
CONFIG_DM_REGULATOR_MAX77663=y
CONFIG_DM_REGULATOR_FIXED=y
CONFIG_DM_REGULATOR_TPS65911=y
CONFIG_PWM_TEGRA=y
CONFIG_SYS_NS16550=y
CONFIG_SYSRESET_MAX77663=y
CONFIG_SYSRESET_TPS65910=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_TEGRA=y
......
......@@ -19,14 +19,14 @@ Quick Start
Build U-Boot
------------
Device support is implemented by applying config fragment to a generic board
defconfig. Valid fragments are ``tilapia.config``, ``grouper_E1565.config``
and ``grouper_PM269.config``.
U-Boot features ability to detect grouper board revision on which it is
loaded. Currently are supported both TI and MAXIM based WiFi-only models
along with cellular one.
.. code-block:: bash
$ export CROSS_COMPILE=arm-linux-gnueabi-
$ make grouper_common_defconfig grouper_E1565.config # For maxim based grouper
$ make grouper_defconfig # For all grouper versions and tilapia
$ make
After the build succeeds, you will obtain the final ``u-boot-dtb-tegra.bin``
......
......@@ -6,6 +6,6 @@ ASUS
.. toctree::
:maxdepth: 2
grouper_common
grouper
transformer_t20
transformer_t30
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment