mirror of
https://github.com/u-boot/u-boot.git
synced 2024-11-23 12:14:32 +08:00
board: asus: transformer: implement multi-DTB support
Use board revision detection mechanism to choose correct DTB. Adjust documentation and build setup accordingly. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
This commit is contained in:
parent
1c1608e0c7
commit
8768ade2b5
@ -4,5 +4,4 @@ S: Maintained
|
||||
F: board/asus/transformer-t30/
|
||||
F: configs/transformer_t30_defconfig
|
||||
F: doc/board/asus/transformer_t30.rst
|
||||
F: include/configs/transformer-common.h
|
||||
F: include/configs/transformer-t30.h
|
||||
|
@ -7,5 +7,6 @@
|
||||
# Svyatoslav Ryhel <clamor95@gmail.com>
|
||||
|
||||
obj-$(CONFIG_SPL_BUILD) += transformer-t30-spl.o
|
||||
obj-$(CONFIG_MULTI_DTB_FIT) += board-info.o
|
||||
|
||||
obj-y += transformer-t30.o
|
||||
|
110
board/asus/transformer-t30/board-info.c
Normal file
110
board/asus/transformer-t30/board-info.c
Normal file
@ -0,0 +1,110 @@
|
||||
// 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>
|
||||
|
||||
/*
|
||||
* PCB_ID[1] is kb_row5_pr5
|
||||
* PCB_ID[3] is kb_col7_pq7
|
||||
* PCB_ID[4] is kb_row2_pr2
|
||||
* PCB_ID[5] is kb_col5_pq5
|
||||
*
|
||||
* Project ID
|
||||
* =====================================================
|
||||
* PCB_ID[1] PCB_ID[5] PCB_ID[4] PCB_ID[3] Project
|
||||
* 0 0 0 0 TF201
|
||||
* 0 0 0 1 P1801
|
||||
* 0 0 1 0 TF300T
|
||||
* 0 0 1 1 TF300TG
|
||||
* 0 1 0 0 TF700T
|
||||
* 0 1 0 1 TF300TL
|
||||
* 0 1 1 0 Extension
|
||||
* 0 1 1 1 TF500T
|
||||
* 1 0 0 0 TF502T/TF600T
|
||||
* =====================================================
|
||||
*/
|
||||
enum project_rev {
|
||||
TF201, P1801, TF300T, TF300TG, TF700T,
|
||||
TF300TL, EXT, TF500T, TF600T
|
||||
};
|
||||
|
||||
static const char * const project_id_to_fdt[] = {
|
||||
[TF201] = "tegra30-asus-tf201",
|
||||
[P1801] = "tegra30-asus-p1801-t",
|
||||
[TF300T] = "tegra30-asus-tf300t",
|
||||
[TF300TG] = "tegra30-asus-tf300tg",
|
||||
[TF700T] = "tegra30-asus-tf700t",
|
||||
[TF300TL] = "tegra30-asus-tf300tl",
|
||||
[TF600T] = "tegra30-asus-tf600t",
|
||||
};
|
||||
|
||||
static int id_gpio_get_value(u32 pingrp, u32 pin)
|
||||
{
|
||||
/* Configure pinmux */
|
||||
pinmux_set_func(pingrp, PMUX_FUNC_KBC);
|
||||
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 pcb_id1, pcb_id3, pcb_id4, pcb_id5;
|
||||
|
||||
pcb_id1 = id_gpio_get_value(PMUX_PINGRP_KB_ROW5_PR5,
|
||||
TEGRA_GPIO(R, 5));
|
||||
pcb_id3 = id_gpio_get_value(PMUX_PINGRP_KB_COL7_PQ7,
|
||||
TEGRA_GPIO(Q, 7));
|
||||
pcb_id4 = id_gpio_get_value(PMUX_PINGRP_KB_ROW2_PR2,
|
||||
TEGRA_GPIO(R, 2));
|
||||
pcb_id5 = id_gpio_get_value(PMUX_PINGRP_KB_COL5_PQ5,
|
||||
TEGRA_GPIO(Q, 5));
|
||||
|
||||
/* Construct board ID */
|
||||
int proj_id = pcb_id1 << 3 | pcb_id5 << 2 |
|
||||
pcb_id4 << 1 | pcb_id3;
|
||||
|
||||
log_debug("[TRANSFORMER]: project id %d (%s)\n", proj_id,
|
||||
project_id_to_fdt[proj_id]);
|
||||
|
||||
/* Mark tablet with SPI flash */
|
||||
if (proj_id == TF600T)
|
||||
env_set_hex("spiflash", true);
|
||||
else
|
||||
env_set_hex("spiflash", false);
|
||||
|
||||
return proj_id & 0xf;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-p1801-t"
|
||||
# CONFIG_I2C_MUX is not set
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4cb0
|
@ -1,3 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf201"
|
||||
# CONFIG_I2C_MUX is not set
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4d00
|
@ -1,3 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf300t"
|
||||
# CONFIG_I2C_MUX is not set
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4d00
|
@ -1,3 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf300tg"
|
||||
# CONFIG_I2C_MUX is not set
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4c80
|
@ -1,3 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf300tl"
|
||||
# CONFIG_I2C_MUX is not set
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4d00
|
@ -1,7 +0,0 @@
|
||||
CONFIG_ENV_SOURCE_FILE="tf600t"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf600t"
|
||||
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_I2C_MUX is not set
|
||||
CONFIG_TEGRA20_SLINK=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4d00
|
@ -1,4 +0,0 @@
|
||||
CONFIG_DEFAULT_DEVICE_TREE="tegra30-asus-tf700t"
|
||||
CONFIG_CLK_GPIO=y
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4c90
|
||||
CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768=y
|
@ -1,16 +0,0 @@
|
||||
#include <env/nvidia/prod_upd.env>
|
||||
|
||||
button_cmd_0_name=Volume Down
|
||||
button_cmd_0=bootmenu
|
||||
button_cmd_1_name=Lid sensor
|
||||
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=mount external storage=usb start && ums 0 mmc 1; bootmenu
|
||||
bootmenu_2=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; bootmenu
|
||||
bootmenu_3=update bootloader=run update_spi
|
||||
bootmenu_4=reboot RCM=enterrcm
|
||||
bootmenu_5=reboot=reset
|
||||
bootmenu_6=power off=poweroff
|
||||
bootmenu_delay=-1
|
@ -1,7 +1,7 @@
|
||||
#include <env/nvidia/prod_upd.env>
|
||||
|
||||
button_cmd_0_name=Volume Down
|
||||
button_cmd_0=bootmenu
|
||||
button_cmd_0=if spiflash; then run update_spi; else bootmenu; fi
|
||||
button_cmd_1_name=Lid sensor
|
||||
button_cmd_1=poweroff
|
||||
partitions=name=emmc,start=0,size=-,uuid=${uuid_gpt_rootfs}
|
||||
|
@ -50,10 +50,14 @@ 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-p1801-t tegra30-asus-tf201 tegra30-asus-tf300t tegra30-asus-tf300tg tegra30-asus-tf300tl tegra30-asus-tf600t tegra30-asus-tf700t"
|
||||
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
|
||||
CONFIG_BUTTON=y
|
||||
CONFIG_CLK_GPIO=y
|
||||
CONFIG_USB_FUNCTION_FASTBOOT=y
|
||||
CONFIG_FASTBOOT_BUF_ADDR=0x91000000
|
||||
CONFIG_FASTBOOT_BUF_SIZE=0x10000000
|
||||
@ -65,6 +69,7 @@ CONFIG_SYS_I2C_TEGRA=y
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_MUX_GPIO=y
|
||||
CONFIG_BUTTON_KEYBOARD=y
|
||||
CONFIG_SPI_FLASH_WINBOND=y
|
||||
CONFIG_DM_PMIC=y
|
||||
CONFIG_DM_PMIC_TPS65910=y
|
||||
CONFIG_DM_REGULATOR=y
|
||||
@ -72,6 +77,7 @@ 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
|
||||
@ -80,7 +86,9 @@ CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_USB_GADGET=y
|
||||
CONFIG_USB_GADGET_MANUFACTURER="ASUS"
|
||||
CONFIG_USB_GADGET_VENDOR_NUM=0x0b05
|
||||
CONFIG_USB_GADGET_PRODUCT_NUM=0x4daf
|
||||
CONFIG_CI_UDC=y
|
||||
CONFIG_VIDEO=y
|
||||
# CONFIG_VIDEO_LOGO is not set
|
||||
CONFIG_VIDEO_BRIDGE_TOSHIBA_TC358768=y
|
||||
CONFIG_VIDEO_TEGRA20=y
|
||||
|
@ -20,15 +20,18 @@ Quick Start
|
||||
Build U-Boot
|
||||
------------
|
||||
|
||||
Device support is implemented by applying a config fragment to a generic board
|
||||
defconfig. Valid fragments are ``tf201.config``, ``tf300t.config``,
|
||||
``tf300tg.config``, ``tf300tl.config``, ``tf700t.config``, ``tf600t.config`` and
|
||||
``p1801-t.config``.
|
||||
U-Boot features ability to detect transformer device model on which it is
|
||||
loaded. The list of supported devices include:
|
||||
- ASUS Transformer Prime TF201
|
||||
- ASUS Transformer Pad (3G/LTE) TF300T/TG/TL
|
||||
- ASUS Transformer Infinity TF700T
|
||||
- ASUS Portable AiO P1801-T
|
||||
- ASUS VivoTab RT TF600T
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ export CROSS_COMPILE=arm-linux-gnueabi-
|
||||
$ make transformer_t30_defconfig tf201.config # For TF201
|
||||
$ make transformer_t30_defconfig
|
||||
$ make
|
||||
|
||||
After the build succeeds, you will obtain the final ``u-boot-dtb-tegra.bin``
|
||||
|
Loading…
Reference in New Issue
Block a user