[PATCH v2 00/16] General tegra and board improvements

This patchset follows Transformers, Grouper, LG X3 and Endeavoru bringup and contains changes from v9 of previous patchset and some new improvenets.
List of changes: - separated tf600t and p1801-t device trees since they use different video path bindings - enabled booting from usb devices (USB > SD > eMMC) - fixed tf201 dock usb line binding - removed transformer board pmic gpios setup - refresh USB option converted into enter console for transformers - updated device trees for future DM PMIC migration - re-synced defconfigs - added base voltages setup from board for t114 same as on t30 - adjusted ebtupdate to work with non-encrypted re-crypted devices - attempt to move setup of some env values to arch - config fragments moved to board/vendor/device/configs/ dir (requires pending u-boot patch)
./tools/buildman/buildman tegra Building current source for 30 boards (12 threads, 1 job per thread) 30 0 0 /30 colibri_t30 Completed: 30 total built, 30 newly), duration 0:05:15, rate 0.10
--- Changes from v1 - tap and trim values for t210 commit moved to dedicated patchset - TZ manipulations dropped for now - switched platform name inline with linux look: tegraXYZ ---
Svyatoslav Ryhel (16): ARM: dts: p1801-t: separate from common transformers tree ARM: dts: tf600t: separate from common transformers tree configs: transformer_t30: support booting from USB ARM: dts: tf201: configure dock USB phy board: asus: transformer-t30: remove PMIC GPIOs configuration configs: transformer_t30: convert bootmenu option ARM: dts: transformer-t30: complete missing bindings ARM: dts: endeavoru: complete missing bindings ARM: dts: lg-x3: complete missing bindings ARM: dts: grouper: complete missing bindings configs: transformer_t30: grouper: lg-x3: endeavoru: sync defconfigs ARM: tegra114: enable base voltages setup from board ARM: tegra20: tegra30: support EBTUPDATE on non-encrypted devices ARM: tegra: board2: add generic late init board: tegra30: remove nvidia_board_late_init calls board: asus: lg: move config fragments into device boards
arch/arm/dts/tegra30-asus-grouper-common.dtsi | 5 +- .../dts/tegra30-asus-nexus7-grouper-E1565.dts | 5 +- .../dts/tegra30-asus-nexus7-grouper-PM269.dts | 11 +- .../dts/tegra30-asus-nexus7-tilapia-E1565.dts | 5 +- arch/arm/dts/tegra30-asus-p1801-t.dts | 205 +++++++++++++++++- arch/arm/dts/tegra30-asus-tf201.dts | 5 + arch/arm/dts/tegra30-asus-tf600t.dts | 160 +++++++++++++- arch/arm/dts/tegra30-asus-transformer.dtsi | 24 +- arch/arm/dts/tegra30-htc-endeavoru.dts | 15 +- arch/arm/dts/tegra30-lg-x3.dtsi | 11 +- arch/arm/mach-tegra/board2.c | 43 ++++ arch/arm/mach-tegra/tegra114/cpu.c | 5 + arch/arm/mach-tegra/tegra20/bct.c | 30 ++- arch/arm/mach-tegra/tegra30/bct.c | 30 ++- board/asus/grouper/MAINTAINERS | 3 - .../grouper/configs}/grouper_E1565.config | 0 .../grouper/configs}/grouper_PM269.config | 0 .../asus/grouper/configs}/tilapia.config | 0 board/asus/grouper/grouper.c | 12 - board/asus/transformer-t30/MAINTAINERS | 7 - .../transformer-t30/configs}/p1801-t.config | 0 .../transformer-t30/configs}/tf201.config | 0 .../transformer-t30/configs}/tf300t.config | 0 .../transformer-t30/configs}/tf300tg.config | 0 .../transformer-t30/configs}/tf300tl.config | 0 .../transformer-t30/configs}/tf600t.config | 3 +- .../transformer-t30/configs}/tf700t.config | 0 board/asus/transformer-t30/transformer-t30.c | 37 ---- board/htc/endeavoru/endeavoru.c | 12 - board/lg/x3-t30/MAINTAINERS | 2 - .../lg/x3-t30/configs}/p880.config | 0 .../lg/x3-t30/configs}/p895.config | 0 board/lg/x3-t30/x3-t30.c | 11 - configs/endeavoru_defconfig | 2 - configs/grouper_common_defconfig | 4 - configs/transformer_t30_defconfig | 4 +- configs/x3_t30_defconfig | 2 - include/configs/transformer-common.h | 7 +- 38 files changed, 499 insertions(+), 161 deletions(-) rename {configs => board/asus/grouper/configs}/grouper_E1565.config (100%) rename {configs => board/asus/grouper/configs}/grouper_PM269.config (100%) rename {configs => board/asus/grouper/configs}/tilapia.config (100%) rename {configs => board/asus/transformer-t30/configs}/p1801-t.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf201.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300t.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300tg.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300tl.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf600t.config (77%) rename {configs => board/asus/transformer-t30/configs}/tf700t.config (100%) rename {configs => board/lg/x3-t30/configs}/p880.config (100%) rename {configs => board/lg/x3-t30/configs}/p895.config (100%)

P1801-T has significant differences (hdmi panel and backlight, own power supply system) which makes use of common transformer device tree complicated.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-asus-p1801-t.dts | 205 +++++++++++++++++++++++++- 1 file changed, 198 insertions(+), 7 deletions(-)
diff --git a/arch/arm/dts/tegra30-asus-p1801-t.dts b/arch/arm/dts/tegra30-asus-p1801-t.dts index 4b2dc61713..39f7caf8d0 100644 --- a/arch/arm/dts/tegra30-asus-p1801-t.dts +++ b/arch/arm/dts/tegra30-asus-p1801-t.dts @@ -1,18 +1,209 @@ // SPDX-License-Identifier: GPL-2.0 /dts-v1/;
-#include "tegra30-asus-transformer.dtsi" +#include <dt-bindings/input/input.h> +#include "tegra30.dtsi"
/ { model = "ASUS Portable AiO P1801-T"; compatible = "asus,p1801-t", "nvidia,tegra30";
- /delete-node/ host1x@50000000; - /delete-node/ pwm@7000a000; + chosen { + stdout-path = &uarta; + };
- /delete-node/ backlight; - /delete-node/ panel; + aliases { + i2c0 = &pwr_i2c; + i2c1 = &hdmi_ddc;
- /delete-node/ regulator-pnl; - /delete-node/ regulator-bl; + mmc0 = &sdmmc4; /* eMMC */ + mmc1 = &sdmmc1; /* uSD slot */ + + rtc0 = &pmic; + rtc1 = "/rtc@7000e000"; + + usb0 = &usb1; + usb1 = &usb2; /* Mini USB */ + usb2 = &usb3; /* Dock USB */ + }; + + memory { + device_type = "memory"; + reg = <0x80000000 0x80000000>; + }; + + host1x@50000000 { + dc@54200000 { + clocks = <&tegra_car TEGRA30_CLK_DISP1>, + <&tegra_car TEGRA30_CLK_PLL_D_OUT0>; + + rgb { + status = "okay"; + + nvidia,panel = <&hdmi>; + }; + }; + + hdmi: hdmi@54280000 { + clocks = <&tegra_car TEGRA30_CLK_HDMI>, + <&tegra_car TEGRA30_CLK_PLL_D_OUT0>; + + status = "okay"; + + hdmi-supply = <&hdmi_5v0_sys>; + pll-supply = <&vdd_1v8_vio>; + vdd-supply = <&hdmi_3v3_vdd>; + + /* low: tablet, high: dock */ + nvidia,hpd-gpio = <&gpio TEGRA_GPIO(H, 4) GPIO_ACTIVE_LOW>; + nvidia,ddc-i2c-bus = <&hdmi_ddc>; + }; + }; + + uarta: serial@70006000 { + status = "okay"; + }; + + hdmi_ddc: i2c@7000c700 { + status = "okay"; + clock-frequency = <33000>; + }; + + pwr_i2c: i2c@7000d000 { + status = "okay"; + clock-frequency = <400000>; + + /* Texas Instruments TPS659110 PMIC */ + pmic: tps65911@2d { + compatible = "ti,tps65911"; + reg = <0x2d>; + + interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; + #interrupt-cells = <2>; + interrupt-controller; + + ti,system-power-controller; + + #gpio-cells = <2>; + gpio-controller; + + regulators { + vdd_1v8_vio: vddio { + regulator-name = "vdd_1v8_gen"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + /* eMMC VDD */ + vcore_emmc: ldo1 { + regulator-name = "vdd_emmc_core"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + }; + + /* uSD slot VDD */ + vdd_usd: ldo2 { + regulator-name = "vdd_usd"; + regulator-min-microvolt = <3100000>; + regulator-max-microvolt = <3100000>; + }; + + /* uSD slot VDDIO */ + vddio_usd: ldo3 { + regulator-name = "vddio_usd"; + regulator-min-microvolt = <3100000>; + regulator-max-microvolt = <3100000>; + regulator-always-on; + regulator-boot-on; + }; + }; + }; + }; + + sdmmc1: sdhci@78000000 { + status = "okay"; + bus-width = <4>; + + cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>; + power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>; + + vmmc-supply = <&vdd_usd>; + vqmmc-supply = <&vddio_usd>; + }; + + sdmmc4: sdhci@78000600 { + status = "okay"; + bus-width = <8>; + non-removable; + + vmmc-supply = <&vcore_emmc>; + vqmmc-supply = <&vdd_1v8_vio>; + }; + + /* USB via ASUS connector */ + usb1: usb@7d000000 { + status = "okay"; + dr_mode = "otg"; + }; + + /* Mini USB port */ + usb2: usb@7d004000 { + status = "okay"; + nvidia,vbus-gpio = <&gpio TEGRA_GPIO(H, 7) GPIO_ACTIVE_HIGH>; + }; + + /* Dock's USB port */ + usb3: usb@7d008000 { + status = "okay"; + }; + + /* PMIC has a built-in 32KHz oscillator which is used by PMC */ + clk32k_in: clock-32k { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "pmic-oscillator"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + key-power { + label = "Power"; + gpios = <&gpio TEGRA_GPIO(V, 0) GPIO_ACTIVE_LOW>; + linux,code = <KEY_ENTER>; + }; + + key-volume-up { + label = "Volume Up"; + gpios = <&gpio TEGRA_GPIO(Q, 2) GPIO_ACTIVE_LOW>; + linux,code = <KEY_UP>; + }; + + key-volume-down { + label = "Volume Down"; + gpios = <&gpio TEGRA_GPIO(Q, 3) GPIO_ACTIVE_LOW>; + linux,code = <KEY_DOWN>; + }; + }; + + hdmi_3v3_vdd: regulator-vdd { + compatible = "regulator-fixed"; + regulator-name = "hdmi_3v3_vdd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + gpio = <&gpio TEGRA_GPIO(H, 3) GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + hdmi_5v0_sys: regulator-hdmi { + compatible = "regulator-fixed"; + regulator-name = "hdmi_5v0_sys"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio TEGRA_GPIO(P, 2) GPIO_ACTIVE_HIGH>; + enable-active-high; + }; };

TF600T has significant differences (Tegra DSI and DSI panel, own power supply system) which makes use of common transformer device tree complicated.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-asus-tf600t.dts | 160 +++++++++++++++++++++++++-- 1 file changed, 148 insertions(+), 12 deletions(-)
diff --git a/arch/arm/dts/tegra30-asus-tf600t.dts b/arch/arm/dts/tegra30-asus-tf600t.dts index c9b8f4fa14..fd9d11ca19 100644 --- a/arch/arm/dts/tegra30-asus-tf600t.dts +++ b/arch/arm/dts/tegra30-asus-tf600t.dts @@ -1,38 +1,116 @@ // SPDX-License-Identifier: GPL-2.0 /dts-v1/;
-#include "tegra30-asus-transformer.dtsi" +#include <dt-bindings/input/input.h> +#include "tegra30.dtsi"
/ { model = "ASUS VivoTab RT TF600T"; compatible = "asus,tf600t", "nvidia,tegra30";
+ chosen { + stdout-path = &uarta; + }; + aliases { + i2c0 = &pwr_i2c; + + mmc0 = &sdmmc4; /* eMMC */ + mmc1 = &sdmmc1; /* uSD slot */ + + rtc0 = &pmic; + rtc1 = "/rtc@7000e000"; + spi0 = &spi4; + + usb0 = &usb1; + usb1 = &usb3; /* Dock USB */ + }; + + memory { + device_type = "memory"; + reg = <0x80000000 0x80000000>; + }; + + host1x@50000000 { + dc@54200000 { + clocks = <&tegra_car TEGRA30_CLK_DISP1>, + <&tegra_car TEGRA30_CLK_PLL_D_OUT0>; + + rgb { + status = "okay"; + + nvidia,panel = <&dsia>; + }; + }; + + dsia: dsi@54300000 { + status = "okay"; + + avdd-dsi-csi-supply = <&avdd_dsi_csi>; + + panel = <&panel>; + }; + }; + + uarta: serial@70006000 { + status = "okay"; + }; + + pwm: pwm@7000a000 { + status = "okay"; };
- /delete-node/ host1x@50000000; + pwr_i2c: i2c@7000d000 { + status = "okay"; + clock-frequency = <400000>;
- pmic_i2c: i2c@7000d000 { /* Texas Instruments TPS659110 PMIC */ pmic: tps65911@2d { + compatible = "ti,tps65911"; + reg = <0x2d>; + + interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; + #interrupt-cells = <2>; + interrupt-controller; + + ti,system-power-controller; + + #gpio-cells = <2>; + gpio-controller; + regulators { vdd_1v2_bl: vdd1 { regulator-name = "vdd_1v2_backlight"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; + }; + + vcore_lcd: vdd2 { + regulator-name = "vcore_lcd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; + }; + + vdd_1v8_vio: vddio { + regulator-name = "vdd_1v8_gen"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; regulator-always-on; regulator-boot-on; - ti,regulator-ext-sleep-control = <8>; };
- /delete-node/ ldo2; - /delete-node/ ldo3; + /* eMMC VDD */ + vcore_emmc: ldo1 { + regulator-name = "vdd_emmc_core"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + };
/* uSD slot VDDIO */ vddio_usd: ldo5 { regulator-name = "vddio_sdmmc"; - regulator-min-microvolt = <1800000>; + regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-always-on; }; @@ -57,11 +135,65 @@ }; };
- backlight { + sdmmc1: sdhci@78000000 { + status = "okay"; + bus-width = <4>; + + cd-gpios = <&gpio TEGRA_GPIO(I, 5) GPIO_ACTIVE_LOW>; + power-gpios = <&gpio TEGRA_GPIO(D, 7) GPIO_ACTIVE_HIGH>; + + vmmc-supply = <&vdd_usd>; + vqmmc-supply = <&vddio_usd>; + }; + + sdmmc4: sdhci@78000600 { + status = "okay"; + bus-width = <8>; + non-removable; + + vmmc-supply = <&vcore_emmc>; + vqmmc-supply = <&vdd_1v8_vio>; + }; + + /* USB via ASUS connector */ + usb1: usb@7d000000 { + status = "okay"; + dr_mode = "otg"; + }; + + /* Dock's USB port */ + usb3: usb@7d008000 { + status = "okay"; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + + enable-gpios = <&gpio TEGRA_GPIO(H, 2) GPIO_ACTIVE_HIGH>; power-supply = <&vdd_1v2_bl>; + pwms = <&pwm 0 71428>; + + brightness-levels = <1 35 70 105 140 175 210 255>; + default-brightness-level = <5>; + }; + + /* PMIC has a built-in 32KHz oscillator which is used by PMC */ + clk32k_in: clock-32k { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "pmic-oscillator"; };
gpio-keys { + compatible = "gpio-keys"; + + key-power { + label = "Power"; + gpios = <&gpio TEGRA_GPIO(V, 0) GPIO_ACTIVE_LOW>; + linux,code = <KEY_ENTER>; + }; + key-volume-up { label = "Volume Up"; gpios = <&gpio TEGRA_GPIO(Q, 3) GPIO_ACTIVE_LOW>; @@ -75,7 +207,14 @@ }; };
- /delete-node/ panel; + panel: panel { + compatible = "hydis,hv101hd1"; + + vdd-supply = <&vcore_lcd>; + enable-gpios = <&gpio TEGRA_GPIO(L, 4) GPIO_ACTIVE_HIGH>; + + backlight = <&backlight>; + };
vdd_usd: regulator-usd { compatible = "regulator-fixed"; @@ -83,7 +222,4 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; - - /delete-node/ regulator-pnl; - /delete-node/ regulator-bl; };

Change boot logic to primary try to boot from USB in dock, then from microSD and lastly from eMMC.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- configs/tf600t.config | 2 +- configs/transformer_t30_defconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configs/tf600t.config b/configs/tf600t.config index 89d8db4eb1..18ab4fbd87 100644 --- a/configs/tf600t.config +++ b/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_mmc1; run bootcmd_mmc0; poweroff;" +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_USB_GADGET_PRODUCT_NUM=0x4d00 diff --git a/configs/transformer_t30_defconfig b/configs/transformer_t30_defconfig index 6fe6f2548d..840431ff38 100644 --- a/configs/transformer_t30_defconfig +++ b/configs/transformer_t30_defconfig @@ -22,7 +22,7 @@ CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="setenv gpio_button 150; if run check_button; then poweroff; fi; setenv gpio_button 131; if run check_button; then bootmenu; fi; run bootcmd_mmc1; run bootcmd_mmc0; poweroff;" +CONFIG_BOOTCOMMAND="setenv gpio_button 150; if run check_button; then poweroff; fi; setenv gpio_button 131; if run check_button; then bootmenu; fi; run bootcmd_usb0; run bootcmd_mmc1; run bootcmd_mmc0; poweroff;" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set

TF201 unlike other transformers uses non-fused xcvr value for its dock USB port. With out it dock USB and SD reader will not work.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-asus-tf201.dts | 5 +++++ arch/arm/dts/tegra30-asus-transformer.dtsi | 4 ++++ 2 files changed, 9 insertions(+)
diff --git a/arch/arm/dts/tegra30-asus-tf201.dts b/arch/arm/dts/tegra30-asus-tf201.dts index 54f359ef96..59e19f9766 100644 --- a/arch/arm/dts/tegra30-asus-tf201.dts +++ b/arch/arm/dts/tegra30-asus-tf201.dts @@ -6,4 +6,9 @@ / { model = "ASUS Transformer Prime TF201"; compatible = "asus,tf201", "nvidia,tegra30"; + + usb-phy@7d008000 { + /delete-property/ nvidia,xcvr-setup-use-fuses; + nvidia,xcvr-setup = <5>; /* Based on TF201 fuse value - 48 */ + }; }; diff --git a/arch/arm/dts/tegra30-asus-transformer.dtsi b/arch/arm/dts/tegra30-asus-transformer.dtsi index 4eee1df084..d144a56445 100644 --- a/arch/arm/dts/tegra30-asus-transformer.dtsi +++ b/arch/arm/dts/tegra30-asus-transformer.dtsi @@ -123,6 +123,10 @@ status = "okay"; };
+ usb-phy@7d008000 { + status = "okay"; + }; + backlight: backlight { compatible = "pwm-backlight";

Default configuration matches values which are set in the board so this configuration is not required.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- board/asus/transformer-t30/transformer-t30.c | 25 -------------------- 1 file changed, 25 deletions(-)
diff --git a/board/asus/transformer-t30/transformer-t30.c b/board/asus/transformer-t30/transformer-t30.c index b6fd19d28e..5c1bac004f 100644 --- a/board/asus/transformer-t30/transformer-t30.c +++ b/board/asus/transformer-t30/transformer-t30.c @@ -33,11 +33,6 @@ #define TPS65911_LDO5 0x32 #define TPS65911_LDO6 0x35
-#define TPS65911_GPIO0 0x60 -#define TPS65911_GPIO6 0x66 -#define TPS65911_GPIO7 0x67 -#define TPS65911_GPIO8 0x68 - #define TPS65911_DEVCTRL 0x3F #define DEVCTRL_PWR_OFF_MASK BIT(7) #define DEVCTRL_DEV_ON_MASK BIT(2) @@ -146,26 +141,6 @@ static void tps65911_voltage_init(void) if (ret) log_debug("vddio_usd set failed: %d\n", ret); } - - /* TPS659110: GPIO0_REG output high to VDD_5V0_SBY */ - ret = dm_i2c_reg_write(dev, TPS65911_GPIO0, 0x07); - if (ret) - log_debug("vdd_5v0_sby set failed: %d\n", ret); - - /* TPS659110: GPIO6_REG output high to VDD_3V3_SYS */ - ret = dm_i2c_reg_write(dev, TPS65911_GPIO6, 0x07); - if (ret) - log_debug("vdd_3v3_sys set failed: %d\n", ret); - - /* TPS659110: GPIO7_REG output high to VDD_1V5_DDR */ - ret = dm_i2c_reg_write(dev, TPS65911_GPIO7, 0x07); - if (ret) - log_debug("vdd_1v5_ddr set failed: %d\n", ret); - - /* TPS659110: GPIO8_REG pull_down output high to VDD_5V0_SYS */ - ret = dm_i2c_reg_write(dev, TPS65911_GPIO8, 0x0f); - if (ret) - log_debug("vdd_5v0_sys set failed: %d\n", ret); }
/*

Convert refresh USB to enter console. Transformers have full size USB and a dock keyboard so access to U-Boot console would be handy.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- configs/transformer_t30_defconfig | 2 +- include/configs/transformer-common.h | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/configs/transformer_t30_defconfig b/configs/transformer_t30_defconfig index 840431ff38..802dcb1786 100644 --- a/configs/transformer_t30_defconfig +++ b/configs/transformer_t30_defconfig @@ -22,7 +22,7 @@ CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y CONFIG_USE_BOOTCOMMAND=y -CONFIG_BOOTCOMMAND="setenv gpio_button 150; if run check_button; then poweroff; fi; setenv gpio_button 131; if run check_button; then bootmenu; fi; run bootcmd_usb0; run bootcmd_mmc1; run bootcmd_mmc0; poweroff;" +CONFIG_BOOTCOMMAND="setenv skip_boot 0; setenv gpio_button 150; if run check_button; then poweroff; fi; setenv gpio_button 131; if run check_button; then bootmenu; fi; if test ${skip_boot} -eq 1; then; else run bootcmd_usb0; run bootcmd_mmc1; run bootcmd_mmc0; poweroff; fi" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set diff --git a/include/configs/transformer-common.h b/include/configs/transformer-common.h index dcdda1ec5b..3b7db0ab14 100644 --- a/include/configs/transformer-common.h +++ b/include/configs/transformer-common.h @@ -64,19 +64,14 @@ "else echo SPI flash backup FAILED! Aborting ...;" \ "poweroff; fi\0"
-#define TRANSFORMER_REFRESH_USB \ - "refresh_usb=usb start; usb reset; usb tree; usb info;" \ - "pause 'Press ANY key to return to bootmenu...'; bootmenu\0" - #define TRANSFORMER_BOOTMENU \ TRANSFORMER_FLASH_UBOOT \ TRANSFORMER_FLASH_SPI \ - TRANSFORMER_REFRESH_USB \ "bootmenu_0=mount internal storage=usb start && ums 0 mmc 0; bootmenu\0" \ "bootmenu_1=mount external storage=usb start && ums 0 mmc 1; bootmenu\0" \ "bootmenu_2=fastboot=echo Starting Fastboot protocol ...; fastboot usb 0; bootmenu\0" \ "bootmenu_3=update bootloader=run flash_uboot\0" \ - "bootmenu_4=refresh USB=run refresh_usb\0" \ + "bootmenu_4=enter console=usb start; setenv skip_boot 1; exit\0" \ "bootmenu_5=reboot RCM=enterrcm\0" \ "bootmenu_6=reboot=reset\0" \ "bootmenu_7=power off=poweroff\0" \

Clean up the tree and prepare for DM PMIC migration.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-asus-transformer.dtsi | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/arch/arm/dts/tegra30-asus-transformer.dtsi b/arch/arm/dts/tegra30-asus-transformer.dtsi index d144a56445..888f9ca74e 100644 --- a/arch/arm/dts/tegra30-asus-transformer.dtsi +++ b/arch/arm/dts/tegra30-asus-transformer.dtsi @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0
#include <dt-bindings/input/input.h> - #include "tegra30.dtsi"
/ { @@ -70,12 +69,19 @@ gpio-controller;
regulators { + vdd_1v8_vio: vddio { + regulator-name = "vdd_1v8_gen"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + /* eMMC VDD */ vcore_emmc: ldo1 { regulator-name = "vdd_emmc_core"; - regulator-min-microvolt = <1000000>; + regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; - regulator-always-on; };
/* uSD slot VDD */ @@ -88,8 +94,10 @@ /* uSD slot VDDIO */ vddio_usd: ldo3 { regulator-name = "vddio_usd"; - regulator-min-microvolt = <1800000>; + regulator-min-microvolt = <3100000>; regulator-max-microvolt = <3100000>; + regulator-always-on; + regulator-boot-on; }; }; }; @@ -110,6 +118,9 @@ status = "okay"; bus-width = <8>; non-removable; + + vmmc-supply = <&vcore_emmc>; + vqmmc-supply = <&vdd_1v8_vio>; };
/* USB via ASUS connector */ @@ -208,7 +219,6 @@ regulator-name = "vdd_5v0_bl"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - regulator-boot-on; gpio = <&gpio TEGRA_GPIO(H, 3) GPIO_ACTIVE_HIGH>; enable-active-high; };

Clean up the tree and prepare for DM PMIC migration.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-htc-endeavoru.dts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/tegra30-htc-endeavoru.dts b/arch/arm/dts/tegra30-htc-endeavoru.dts index c55e193d1d..5c7b2deae5 100644 --- a/arch/arm/dts/tegra30-htc-endeavoru.dts +++ b/arch/arm/dts/tegra30-htc-endeavoru.dts @@ -5,7 +5,6 @@ /* CPU Speedo ID 4, Soc Speedo ID 1, CPU Process: 1, Core Process: 0 */
#include <dt-bindings/input/input.h> - #include "tegra30.dtsi"
/ { @@ -66,13 +65,22 @@ compatible = "ti,tps80032"; reg = <0x48>;
+ ti,system-power-controller; + regulators { + vdd_1v8_vio: smps5 { + regulator-name = "vdd_1v8_gen"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + /* DSI VDD */ avdd_dsi_csi: ldo1 { regulator-name = "avdd_dsi_csi"; regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>; - regulator-always-on; }; }; }; @@ -82,6 +90,9 @@ status = "okay"; bus-width = <8>; non-removable; + + vmmc-supply = <&vcore_emmc>; + vqmmc-supply = <&vdd_1v8_vio>; };
micro_usb: usb@7d000000 {

Clean up the tree and prepare for DM PMIC migration.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-lg-x3.dtsi | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/dts/tegra30-lg-x3.dtsi b/arch/arm/dts/tegra30-lg-x3.dtsi index 922e39915e..6e52fc5a53 100644 --- a/arch/arm/dts/tegra30-lg-x3.dtsi +++ b/arch/arm/dts/tegra30-lg-x3.dtsi @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0
#include <dt-bindings/input/input.h> - #include "tegra30.dtsi"
/ { @@ -91,6 +90,14 @@ regulator-boot-on; };
+ avdd_3v3_periph: ldo2 { + regulator-name = "avdd_usb"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + }; + vdd_usd: ldo3 { regulator-name = "vdd_sdmmc3"; regulator-min-microvolt = <3000000>; @@ -103,8 +110,6 @@ regulator-name = "vdd_ddr_rx"; regulator-min-microvolt = <2850000>; regulator-max-microvolt = <2850000>; - regulator-always-on; - regulator-boot-on; }; }; };

Clean up the tree and prepare for DM PMIC migration.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/dts/tegra30-asus-grouper-common.dtsi | 5 +++-- arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts | 5 ++--- arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts | 11 +++++++++-- arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts | 5 ++--- 4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/arch/arm/dts/tegra30-asus-grouper-common.dtsi b/arch/arm/dts/tegra30-asus-grouper-common.dtsi index 4fa980f24f..fcf31e2dd0 100644 --- a/arch/arm/dts/tegra30-asus-grouper-common.dtsi +++ b/arch/arm/dts/tegra30-asus-grouper-common.dtsi @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0
#include <dt-bindings/input/input.h> - #include "tegra30.dtsi"
/ { @@ -62,6 +61,9 @@ status = "okay"; bus-width = <8>; non-removable; + + vmmc-supply = <&vcore_emmc>; + vqmmc-supply = <&vdd_1v8_vio>; };
usb1: usb@7d000000 { @@ -150,7 +152,6 @@ regulator-name = "vdd_5v0_bl"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; - regulator-boot-on; gpio = <&gpio TEGRA_GPIO(H, 3) GPIO_ACTIVE_HIGH>; enable-active-high; }; diff --git a/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts b/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts index a98d3e2145..945ae404ac 100644 --- a/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts +++ b/arch/arm/dts/tegra30-asus-nexus7-grouper-E1565.dts @@ -22,7 +22,7 @@ gpio-controller;
regulators { - vdd_1v8: sd2 { + vdd_1v8_vio: sd2 { regulator-name = "vdd_1v8_gen"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; @@ -34,8 +34,7 @@ vcore_emmc: ldo3 { regulator-name = "vcore_emmc"; regulator-min-microvolt = <2850000>; - regulator-max-microvolt = <3100000>; - regulator-always-on; + regulator-max-microvolt = <2850000>; }; }; }; diff --git a/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts b/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts index 44ea218a47..4363bfc87d 100644 --- a/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts +++ b/arch/arm/dts/tegra30-asus-nexus7-grouper-PM269.dts @@ -23,12 +23,19 @@ gpio-controller;
regulators { + vdd_1v8_vio: vddio { + regulator-name = "vdd_1v8_gen"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + /* eMMC VDD */ vcore_emmc: ldo1 { regulator-name = "vdd_emmc_core"; - regulator-min-microvolt = <1000000>; + regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; - regulator-always-on; }; }; }; diff --git a/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts b/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts index 812d5a1ba7..89348fde13 100644 --- a/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts +++ b/arch/arm/dts/tegra30-asus-nexus7-tilapia-E1565.dts @@ -22,7 +22,7 @@ gpio-controller;
regulators { - vdd_1v8: sd2 { + vdd_1v8_vio: sd2 { regulator-name = "vdd_1v8_gen"; regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; @@ -34,8 +34,7 @@ vcore_emmc: ldo3 { regulator-name = "vcore_emmc"; regulator-min-microvolt = <2850000>; - regulator-max-microvolt = <3100000>; - regulator-always-on; + regulator-max-microvolt = <2850000>; }; }; };

Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- configs/endeavoru_defconfig | 2 -- configs/grouper_common_defconfig | 4 ---- configs/tf600t.config | 1 + configs/transformer_t30_defconfig | 2 -- configs/x3_t30_defconfig | 2 -- 5 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/configs/endeavoru_defconfig b/configs/endeavoru_defconfig index 38f26f2dcc..feb481170a 100644 --- a/configs/endeavoru_defconfig +++ b/configs/endeavoru_defconfig @@ -21,7 +21,6 @@ CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y -CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc0; poweroff;" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 @@ -44,7 +43,6 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_UMS_ABORT_KEYED=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_NFS is not set CONFIG_CMD_PAUSE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_SPL_DOS_PARTITION is not set diff --git a/configs/grouper_common_defconfig b/configs/grouper_common_defconfig index 8dc88851f5..36ad0980e7 100644 --- a/configs/grouper_common_defconfig +++ b/configs/grouper_common_defconfig @@ -21,7 +21,6 @@ CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y -CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc0; poweroff;" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 @@ -43,7 +42,6 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_UMS_ABORT_KEYED=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_NFS is not set CONFIG_CMD_PAUSE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_SPL_DOS_PARTITION is not set @@ -61,8 +59,6 @@ CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_GPIO_HOG=y CONFIG_SYS_I2C_TEGRA=y -CONFIG_I2C_MUX=y -CONFIG_I2C_MUX_GPIO=y CONFIG_BUTTON_KEYBOARD=y CONFIG_DM_PMIC=y CONFIG_DM_REGULATOR=y diff --git a/configs/tf600t.config b/configs/tf600t.config index 18ab4fbd87..ee1b827bea 100644 --- a/configs/tf600t.config +++ b/configs/tf600t.config @@ -2,3 +2,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_USB_GADGET_PRODUCT_NUM=0x4d00 +CONFIG_VIDEO_DSI_TEGRA30=y diff --git a/configs/transformer_t30_defconfig b/configs/transformer_t30_defconfig index 802dcb1786..eaff0697bb 100644 --- a/configs/transformer_t30_defconfig +++ b/configs/transformer_t30_defconfig @@ -21,7 +21,6 @@ CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y -CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="setenv skip_boot 0; setenv gpio_button 150; if run check_button; then poweroff; fi; setenv gpio_button 131; if run check_button; then bootmenu; fi; if test ${skip_boot} -eq 1; then; else run bootcmd_usb0; run bootcmd_mmc1; run bootcmd_mmc0; poweroff; fi" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 @@ -45,7 +44,6 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_UMS_ABORT_KEYED=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_NFS is not set CONFIG_CMD_PAUSE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_SPL_DOS_PARTITION is not set diff --git a/configs/x3_t30_defconfig b/configs/x3_t30_defconfig index 540c43096d..98744ec89d 100644 --- a/configs/x3_t30_defconfig +++ b/configs/x3_t30_defconfig @@ -22,7 +22,6 @@ CONFIG_OF_SYSTEM_SETUP=y CONFIG_BOOTDELAY=0 CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_KEYED_CTRLC=y -CONFIG_USE_BOOTCOMMAND=y CONFIG_BOOTCOMMAND="if run check_button; then bootmenu; fi; run bootcmd_mmc1; run bootcmd_mmc0; poweroff;" CONFIG_SPL_FOOTPRINT_LIMIT=y CONFIG_SPL_MAX_FOOTPRINT=0x8000 @@ -45,7 +44,6 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_UMS_ABORT_KEYED=y # CONFIG_CMD_SETEXPR is not set -# CONFIG_CMD_NFS is not set CONFIG_CMD_PAUSE=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_SPL_DOS_PARTITION is not set

Tegra 4, same as Tegra 3, requires configuration of CPU and CORE voltages in the SPL stage to boot properly. Expose function to be able perform this configuration in the SPL section of the device board.
Tested-by: Svyatoslav Ryhel clamor95@gmail.com # ASUS TF701T Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/mach-tegra/tegra114/cpu.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/mach-tegra/tegra114/cpu.c b/arch/arm/mach-tegra/tegra114/cpu.c index 62c1053630..7d8f080c31 100644 --- a/arch/arm/mach-tegra/tegra114/cpu.c +++ b/arch/arm/mach-tegra/tegra114/cpu.c @@ -13,9 +13,13 @@ #include <asm/arch/tegra.h> #include <asm/arch-tegra/clk_rst.h> #include <asm/arch-tegra/pmc.h> +#include <asm/arch-tegra/tegra_i2c.h> #include <linux/delay.h> #include "../cpu.h"
+/* In case this function is not defined */ +__weak void pmic_enable_cpu_vdd(void) {} + /* Tegra114-specific CPU init code */ static void enable_cpu_power_rail(void) { @@ -254,6 +258,7 @@ void start_cpu(u32 reset_vector)
/* Enable VDD_CPU */ enable_cpu_power_rail(); + pmic_enable_cpu_vdd();
/* Get the CPU(s) running */ enable_cpu_clocks();

Re-crypt support was extended to devices without burnt SBK. In case SBK is not set, place from where it is read is filled with zeroes. This patch adds support for ebtupdate function to detect nosbk device and avoid crypto operations for it.
Tested-by: Maksim Kurnosenko asusx2@mail.ru Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- arch/arm/mach-tegra/tegra20/bct.c | 30 ++++++++++++++++++++---------- arch/arm/mach-tegra/tegra30/bct.c | 30 ++++++++++++++++++++---------- 2 files changed, 40 insertions(+), 20 deletions(-)
diff --git a/arch/arm/mach-tegra/tegra20/bct.c b/arch/arm/mach-tegra/tegra20/bct.c index 5eb48990b6..b2c44f3d23 100644 --- a/arch/arm/mach-tegra/tegra20/bct.c +++ b/arch/arm/mach-tegra/tegra20/bct.c @@ -11,6 +11,9 @@ #include "bct.h" #include "uboot_aes.h"
+/* Device with "sbk burned: false" will expose zero key */ +const u8 nosbk[AES128_KEY_LENGTH] = { 0 }; + /* * @param bct boot config table start in RAM * @param ect bootloader start in RAM @@ -23,22 +26,27 @@ static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) u8 ebt_hash[AES128_KEY_LENGTH] = { 0 }; u8 sbk[AES128_KEY_LENGTH] = { 0 }; u8 *bct_hash = bct; + bool encrypted; int ret;
bct += BCT_HASH;
+ ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + memcpy(sbk, (u8 *)(bct + BCT_LENGTH), NVBOOT_CMAC_AES_HASH_LENGTH * 4);
- ret = decrypt_data_block(bct, BCT_LENGTH, sbk); - if (ret) - return 1; + encrypted = memcmp(&sbk, &nosbk, AES128_KEY_LENGTH);
- ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + if (encrypted) { + ret = decrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1;
- ret = encrypt_data_block(ebt, ebt_size, sbk); - if (ret) - return 1; + ret = encrypt_data_block(ebt, ebt_size, sbk); + if (ret) + return 1; + }
ret = sign_enc_data_block(ebt, ebt_size, ebt_hash, sbk); if (ret) @@ -52,9 +60,11 @@ static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) bct_tbl->bootloader[0].load_addr = CONFIG_SPL_TEXT_BASE; bct_tbl->bootloader[0].length = ebt_size;
- ret = encrypt_data_block(bct, BCT_LENGTH, sbk); - if (ret) - return 1; + if (encrypted) { + ret = encrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + }
ret = sign_enc_data_block(bct, BCT_LENGTH, bct_hash, sbk); if (ret) diff --git a/arch/arm/mach-tegra/tegra30/bct.c b/arch/arm/mach-tegra/tegra30/bct.c index c56958da69..cff1a3e98d 100644 --- a/arch/arm/mach-tegra/tegra30/bct.c +++ b/arch/arm/mach-tegra/tegra30/bct.c @@ -11,6 +11,9 @@ #include "bct.h" #include "uboot_aes.h"
+/* Device with "sbk burned: false" will expose zero key */ +const u8 nosbk[AES128_KEY_LENGTH] = { 0 }; + /* * @param bct boot config table start in RAM * @param ect bootloader start in RAM @@ -23,22 +26,27 @@ static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) u8 ebt_hash[AES128_KEY_LENGTH] = { 0 }; u8 sbk[AES128_KEY_LENGTH] = { 0 }; u8 *bct_hash = bct; + bool encrypted; int ret;
bct += BCT_HASH;
+ ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + memcpy(sbk, (u8 *)(bct + BCT_LENGTH), NVBOOT_CMAC_AES_HASH_LENGTH * 4);
- ret = decrypt_data_block(bct, BCT_LENGTH, sbk); - if (ret) - return 1; + encrypted = memcmp(&sbk, &nosbk, AES128_KEY_LENGTH);
- ebt_size = roundup(ebt_size, EBT_ALIGNMENT); + if (encrypted) { + ret = decrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1;
- ret = encrypt_data_block(ebt, ebt_size, sbk); - if (ret) - return 1; + ret = encrypt_data_block(ebt, ebt_size, sbk); + if (ret) + return 1; + }
ret = sign_enc_data_block(ebt, ebt_size, ebt_hash, sbk); if (ret) @@ -52,9 +60,11 @@ static int bct_patch(u8 *bct, u8 *ebt, u32 ebt_size) bct_tbl->bootloader[0].load_addr = CONFIG_SPL_TEXT_BASE; bct_tbl->bootloader[0].length = ebt_size;
- ret = encrypt_data_block(bct, BCT_LENGTH, sbk); - if (ret) - return 1; + if (encrypted) { + ret = encrypt_data_block(bct, BCT_LENGTH, sbk); + if (ret) + return 1; + }
ret = sign_enc_data_block(bct, BCT_LENGTH, bct_hash, sbk); if (ret)

Board specific late init allows vendors to set up different device or board specific env variables (like serial number, platform name). In case this information is missing, u-boot will lack info regards serial or platform.
To avoid this prior nvidia_board_late_init internal generic function is called which fills required data. In this case platform name is obtained from get_chip and serialno is filled with SoC id.
Though SoC id is not dedicated to be devices serial but it fits well in case of restriction of data about device and since SoC is basically a main chip of the device.
Tested-by: Andreas Westman Dorcsak hedmoo@yahoo.com # ASUS Transformers Tested-by: Svyatoslav Ryhel clamor95@gmail.com # Nvidia Tegratab Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com Reviewed-by: Simon Glass sjg@chromium.org --- arch/arm/mach-tegra/board2.c | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c index 981768bb0e..cd405874d3 100644 --- a/arch/arm/mach-tegra/board2.c +++ b/arch/arm/mach-tegra/board2.c @@ -26,6 +26,10 @@ #include <asm/arch-tegra/gpu.h> #include <asm/arch-tegra/usb.h> #include <asm/arch-tegra/xusb-padctl.h> +#ifndef CONFIG_TEGRA186 +#include <asm/arch-tegra/fuse.h> +#include <asm/arch/gp_padctrl.h> +#endif #if IS_ENABLED(CONFIG_TEGRA_CLKRST) #include <asm/arch/clock.h> #endif @@ -256,6 +260,37 @@ int board_early_init_f(void) } #endif /* EARLY_INIT */
+#ifndef CONFIG_TEGRA186 +static void nvidia_board_late_init_generic(void) +{ + char serialno_str[17]; + + /* Set chip id as serialno */ + sprintf(serialno_str, "%016llx", tegra_chip_uid()); + env_set("serial#", serialno_str); + + switch (tegra_get_chip()) { + case CHIPID_TEGRA20: + env_set("platform", "tegra20"); + break; + case CHIPID_TEGRA30: + env_set("platform", "tegra30"); + break; + case CHIPID_TEGRA114: + env_set("platform", "tegra114"); + break; + case CHIPID_TEGRA124: + env_set("platform", "tegra124"); + break; + case CHIPID_TEGRA210: + env_set("platform", "tegra210"); + break; + default: + return; + } +} +#endif + int board_late_init(void) { #if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE) @@ -268,6 +303,14 @@ int board_late_init(void) #endif start_cpu_fan(); cboot_late_init(); + + /* + * Perform generic env setup in case + * vendor does not provide it. + */ +#ifndef CONFIG_TEGRA186 + nvidia_board_late_init_generic(); +#endif nvidia_board_late_init();
return 0;

Remove nvidia_board_late_init calls from board since this setup is performed in board2 of mach-tegra. Call of nvidia_board_late_init from within the board does not provide any additional data.
Tested-by: Andreas Westman Dorcsak hedmoo@yahoo.com # ASUS Transformer T30 Tested-by: Svyatoslav Ryhel clamor95@gmail.com # LG P895 T30 Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- board/asus/grouper/grouper.c | 12 ------------ board/asus/transformer-t30/transformer-t30.c | 12 ------------ board/htc/endeavoru/endeavoru.c | 12 ------------ board/lg/x3-t30/x3-t30.c | 11 ----------- 4 files changed, 47 deletions(-)
diff --git a/board/asus/grouper/grouper.c b/board/asus/grouper/grouper.c index 2769313e68..5398ec8b9f 100644 --- a/board/asus/grouper/grouper.c +++ b/board/asus/grouper/grouper.c @@ -9,14 +9,12 @@
#include <common.h> #include <dm.h> -#include <env.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/arch-tegra/fuse.h> #include <asm/gpio.h> #include <linux/delay.h> #include "pinmux-config-grouper.h" @@ -190,13 +188,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif - -void nvidia_board_late_init(void) -{ - char serialno_str[17]; - - /* Set chip id as serialno */ - sprintf(serialno_str, "%016llx", tegra_chip_uid()); - env_set("serial#", serialno_str); - env_set("platform", "Tegra 3 T30"); -} diff --git a/board/asus/transformer-t30/transformer-t30.c b/board/asus/transformer-t30/transformer-t30.c index 5c1bac004f..ba795a802e 100644 --- a/board/asus/transformer-t30/transformer-t30.c +++ b/board/asus/transformer-t30/transformer-t30.c @@ -11,14 +11,12 @@
#include <common.h> #include <dm.h> -#include <env.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/arch-tegra/fuse.h> #include <asm/gpio.h> #include <linux/delay.h> #include "pinmux-config-transformer.h" @@ -164,13 +162,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif - -void nvidia_board_late_init(void) -{ - char serialno_str[17]; - - /* Set chip id as serialno */ - sprintf(serialno_str, "%016llx", tegra_chip_uid()); - env_set("serial#", serialno_str); - env_set("platform", "Tegra 3 T30"); -} diff --git a/board/htc/endeavoru/endeavoru.c b/board/htc/endeavoru/endeavoru.c index 1d92870f91..e1a0b242e2 100644 --- a/board/htc/endeavoru/endeavoru.c +++ b/board/htc/endeavoru/endeavoru.c @@ -9,14 +9,12 @@
#include <common.h> #include <dm.h> -#include <env.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/arch-tegra/fuse.h> #include <asm/gpio.h> #include <linux/delay.h> #include "pinmux-config-endeavoru.h" @@ -104,13 +102,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif - -void nvidia_board_late_init(void) -{ - char serialno_str[17]; - - /* Set chip id as serialno */ - sprintf(serialno_str, "%016llx", tegra_chip_uid()); - env_set("serial#", serialno_str); - env_set("platform", "Tegra 3 T30"); -} diff --git a/board/lg/x3-t30/x3-t30.c b/board/lg/x3-t30/x3-t30.c index 594563cf52..a08e00dd87 100644 --- a/board/lg/x3-t30/x3-t30.c +++ b/board/lg/x3-t30/x3-t30.c @@ -9,7 +9,6 @@
#include <common.h> #include <dm.h> -#include <env.h> #include <fdt_support.h> #include <i2c.h> #include <log.h> @@ -164,13 +163,3 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif - -void nvidia_board_late_init(void) -{ - char serialno_str[17]; - - /* Set chip id as serialno */ - sprintf(serialno_str, "%016llx", tegra_chip_uid()); - env_set("serial#", serialno_str); - env_set("platform", "Tegra 3 T30"); -}

Move ASUS Transformers, Grouper, P895 and P880 config fragments into their respective device directory in /board/../configs/
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- board/asus/grouper/MAINTAINERS | 3 --- .../asus/grouper/configs}/grouper_E1565.config | 0 .../asus/grouper/configs}/grouper_PM269.config | 0 {configs => board/asus/grouper/configs}/tilapia.config | 0 board/asus/transformer-t30/MAINTAINERS | 7 ------- .../asus/transformer-t30/configs}/p1801-t.config | 0 .../asus/transformer-t30/configs}/tf201.config | 0 .../asus/transformer-t30/configs}/tf300t.config | 0 .../asus/transformer-t30/configs}/tf300tg.config | 0 .../asus/transformer-t30/configs}/tf300tl.config | 0 .../asus/transformer-t30/configs}/tf600t.config | 0 .../asus/transformer-t30/configs}/tf700t.config | 0 board/lg/x3-t30/MAINTAINERS | 2 -- {configs => board/lg/x3-t30/configs}/p880.config | 0 {configs => board/lg/x3-t30/configs}/p895.config | 0 15 files changed, 12 deletions(-) rename {configs => board/asus/grouper/configs}/grouper_E1565.config (100%) rename {configs => board/asus/grouper/configs}/grouper_PM269.config (100%) rename {configs => board/asus/grouper/configs}/tilapia.config (100%) rename {configs => board/asus/transformer-t30/configs}/p1801-t.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf201.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300t.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300tg.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf300tl.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf600t.config (100%) rename {configs => board/asus/transformer-t30/configs}/tf700t.config (100%) rename {configs => board/lg/x3-t30/configs}/p880.config (100%) rename {configs => board/lg/x3-t30/configs}/p895.config (100%)
diff --git a/board/asus/grouper/MAINTAINERS b/board/asus/grouper/MAINTAINERS index 18b4f0641f..f4068d8562 100644 --- a/board/asus/grouper/MAINTAINERS +++ b/board/asus/grouper/MAINTAINERS @@ -2,9 +2,6 @@ GROUPER BOARD M: Svyatoslav Ryhel clamor95@gmail.com S: Maintained F: board/asus/grouper/ -F: configs/grouper_E1565.config -F: configs/grouper_PM269.config -F: configs/tilapia.config F: configs/grouper_common_defconfig F: doc/board/asus/grouper_common.rst F: include/configs/grouper.h diff --git a/configs/grouper_E1565.config b/board/asus/grouper/configs/grouper_E1565.config similarity index 100% rename from configs/grouper_E1565.config rename to board/asus/grouper/configs/grouper_E1565.config diff --git a/configs/grouper_PM269.config b/board/asus/grouper/configs/grouper_PM269.config similarity index 100% rename from configs/grouper_PM269.config rename to board/asus/grouper/configs/grouper_PM269.config diff --git a/configs/tilapia.config b/board/asus/grouper/configs/tilapia.config similarity index 100% rename from configs/tilapia.config rename to board/asus/grouper/configs/tilapia.config diff --git a/board/asus/transformer-t30/MAINTAINERS b/board/asus/transformer-t30/MAINTAINERS index c6c15323b2..071a9c04b8 100644 --- a/board/asus/transformer-t30/MAINTAINERS +++ b/board/asus/transformer-t30/MAINTAINERS @@ -2,13 +2,6 @@ TRANSFORMER BOARD M: Svyatoslav Ryhel clamor95@gmail.com S: Maintained F: board/asus/transformer-t30/ -F: configs/p1801-t.config -F: configs/tf201.config -F: configs/tf300t.config -F: configs/tf300tg.config -F: configs/tf300tl.config -F: configs/tf600t.config -F: configs/tf700t.config F: configs/transformer_t30_defconfig F: doc/board/asus/transformer_t30.rst F: include/configs/transformer-common.h diff --git a/configs/p1801-t.config b/board/asus/transformer-t30/configs/p1801-t.config similarity index 100% rename from configs/p1801-t.config rename to board/asus/transformer-t30/configs/p1801-t.config diff --git a/configs/tf201.config b/board/asus/transformer-t30/configs/tf201.config similarity index 100% rename from configs/tf201.config rename to board/asus/transformer-t30/configs/tf201.config diff --git a/configs/tf300t.config b/board/asus/transformer-t30/configs/tf300t.config similarity index 100% rename from configs/tf300t.config rename to board/asus/transformer-t30/configs/tf300t.config diff --git a/configs/tf300tg.config b/board/asus/transformer-t30/configs/tf300tg.config similarity index 100% rename from configs/tf300tg.config rename to board/asus/transformer-t30/configs/tf300tg.config diff --git a/configs/tf300tl.config b/board/asus/transformer-t30/configs/tf300tl.config similarity index 100% rename from configs/tf300tl.config rename to board/asus/transformer-t30/configs/tf300tl.config diff --git a/configs/tf600t.config b/board/asus/transformer-t30/configs/tf600t.config similarity index 100% rename from configs/tf600t.config rename to board/asus/transformer-t30/configs/tf600t.config diff --git a/configs/tf700t.config b/board/asus/transformer-t30/configs/tf700t.config similarity index 100% rename from configs/tf700t.config rename to board/asus/transformer-t30/configs/tf700t.config diff --git a/board/lg/x3-t30/MAINTAINERS b/board/lg/x3-t30/MAINTAINERS index 0ad29563e9..13c8588d0b 100644 --- a/board/lg/x3-t30/MAINTAINERS +++ b/board/lg/x3-t30/MAINTAINERS @@ -2,8 +2,6 @@ X3 BOARD M: Svyatoslav Ryhel clamor95@gmail.com S: Maintained F: board/lg/x3-t30/ -F: configs/p880.config -F: configs/p895.config F: configs/x3_t30_defconfig F: doc/board/lg/x3_t30.rst F: include/configs/x3-t30.h diff --git a/configs/p880.config b/board/lg/x3-t30/configs/p880.config similarity index 100% rename from configs/p880.config rename to board/lg/x3-t30/configs/p880.config diff --git a/configs/p895.config b/board/lg/x3-t30/configs/p895.config similarity index 100% rename from configs/p895.config rename to board/lg/x3-t30/configs/p895.config

From: Thierry Reding treding@nvidia.com
On Thu, 24 Aug 2023 22:25:47 +0300, Svyatoslav Ryhel wrote:
This patchset follows Transformers, Grouper, LG X3 and Endeavoru bringup and contains changes from v9 of previous patchset and some new improvenets.
List of changes:
- separated tf600t and p1801-t device trees since they use different video path bindings
- enabled booting from usb devices (USB > SD > eMMC)
- fixed tf201 dock usb line binding
- removed transformer board pmic gpios setup
- refresh USB option converted into enter console for transformers
- updated device trees for future DM PMIC migration
- re-synced defconfigs
- added base voltages setup from board for t114 same as on t30
- adjusted ebtupdate to work with non-encrypted re-crypted devices
- attempt to move setup of some env values to arch
- config fragments moved to board/vendor/device/configs/ dir (requires pending u-boot patch)
[...]
Applied, thanks!
[01/16] ARM: dts: p1801-t: separate from common transformers tree (no commit info) [02/16] ARM: dts: tf600t: separate from common transformers tree (no commit info) [03/16] configs: transformer_t30: support booting from USB (no commit info) [04/16] ARM: dts: tf201: configure dock USB phy (no commit info) [05/16] board: asus: transformer-t30: remove PMIC GPIOs configuration (no commit info) [06/16] configs: transformer_t30: convert bootmenu option (no commit info) [07/16] ARM: dts: transformer-t30: complete missing bindings (no commit info) [08/16] ARM: dts: endeavoru: complete missing bindings (no commit info) [09/16] ARM: dts: lg-x3: complete missing bindings (no commit info) [10/16] ARM: dts: grouper: complete missing bindings (no commit info) [11/16] configs: transformer_t30: grouper: lg-x3: endeavoru: sync defconfigs (no commit info) [12/16] ARM: tegra114: enable base voltages setup from board (no commit info) [13/16] ARM: tegra20: tegra30: support EBTUPDATE on non-encrypted devices (no commit info) [14/16] ARM: tegra: board2: add generic late init (no commit info) [15/16] board: tegra30: remove nvidia_board_late_init calls (no commit info) [16/16] board: asus: lg: move config fragments into device boards (no commit info)
Best regards,
participants (2)
-
Svyatoslav Ryhel
-
Thierry Reding