[U-Boot] [PATCH v2 0/9] apalis-tk1: fixes/updates for v2019.10

Misc. fixes related to pinmux configuration (fan), default bootargs, reset reason output and power rail configuration.
Changes in v2: * Rebased on the latest u-boot-tegra/master * Attached R-b tags [Oleksandr Suvorov] from v1 [1]
[1] https://patchwork.ozlabs.org/cover/1139705/
Dominik Sliwa (2): apalis-tk1/t30: colibri_t30: display reset reason apalis-tk1: remove non-esential power rails on boot
Igor Opaniuk (5): apalis-tk1: set apalis gpio 8 aka fan_en apalis-tk1: provide proper USB vendor id apalis-tk1: enable user debug by default apalis-tk1: add pcie_aspm=off to defargs apalis-tk1: switch to zImage
Marcel Ziswiler (2): apalis-tk1: do not explicitly release reset_moci# apalis-tk1: remove default vesa vga mode from vidargs
arch/arm/mach-tegra/sys_info.c | 32 ++++++++----- arch/arm/mach-tegra/tegra124/cpu.c | 45 +++++++++++++++++++ board/toradex/apalis-tk1/apalis-tk1.c | 10 +++++ board/toradex/apalis-tk1/as3722_init.c | 23 ++++++++++ .../apalis-tk1/pinmux-config-apalis-tk1.h | 2 +- configs/apalis-tk1_defconfig | 2 +- include/configs/apalis-tk1.h | 17 +++---- 7 files changed, 111 insertions(+), 20 deletions(-)

From: Marcel Ziswiler marcel.ziswiler@toradex.com
By keeping RESET_MOCI_CTRL low we avoid explicitly releasing RESET_MOCI#.
Please note that module hardware versions up to V1.1A will already release RESET_MOCI# in hardware coming out of reset.
Please further note that with this change the USB hub on the Apalis Evaluation board is kept in reset in U-Boot and therefore none of its ports are operational in U-Boot.
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
board/toradex/apalis-tk1/pinmux-config-apalis-tk1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/toradex/apalis-tk1/pinmux-config-apalis-tk1.h b/board/toradex/apalis-tk1/pinmux-config-apalis-tk1.h index 1584d9b2d3..d2d24c4391 100644 --- a/board/toradex/apalis-tk1/pinmux-config-apalis-tk1.h +++ b/board/toradex/apalis-tk1/pinmux-config-apalis-tk1.h @@ -39,7 +39,7 @@ static const struct tegra_gpio_config apalis_tk1_gpio_inits[] = { GPIO_INIT(R, 1, OUT0), /* Shift_CTRL_Dir_In[1] */ GPIO_INIT(R, 2, OUT0), /* Shift_CTRL_OE[3] */ GPIO_INIT(S, 3, OUT0), /* Shift_CTRL_Dir_In[2] */ - GPIO_INIT(U, 4, OUT1), + GPIO_INIT(U, 4, OUT0), /* RESET_MOCI_CTRL */ GPIO_INIT(W, 3, IN), GPIO_INIT(W, 5, IN), GPIO_INIT(BB, 0, IN),

From: Igor Opaniuk igor.opaniuk@toradex.com
Make sure the Apalis GPIO 8 aka FAN_EN is on when using Apalis TK1 modules.
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com Signed-off-by: Dominik Sliwa dominik.sliwa@toradex.com ---
board/toradex/apalis-tk1/apalis-tk1.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c index b87e9e7a3e..d57c5042dd 100644 --- a/board/toradex/apalis-tk1/apalis-tk1.c +++ b/board/toradex/apalis-tk1/apalis-tk1.c @@ -19,6 +19,7 @@
#define LAN_DEV_OFF_N TEGRA_GPIO(O, 6) #define LAN_RESET_N TEGRA_GPIO(S, 2) +#define FAN_EN TEGRA_GPIO(DD, 2) #define LAN_WAKE_N TEGRA_GPIO(O, 5) #ifdef CONFIG_APALIS_TK1_PCIE_EVALBOARD_INIT #define PEX_PERST_N TEGRA_GPIO(DD, 1) /* Apalis GPIO7 */ @@ -241,6 +242,15 @@ void tegra_pcie_board_port_reset(struct tegra_pcie_port *port) } #endif /* CONFIG_PCI_TEGRA */
+/* + * Enable/start PWM CPU fan + */ +void start_cpu_fan(void) +{ + gpio_request(FAN_EN, "FAN_EN"); + gpio_direction_output(FAN_EN, 1); +} + /* * Backlight off before OS handover */

From: Igor Opaniuk igor.opaniuk@toradex.com
Use unified values for USB Product/Vendor numbers when the config block is missing
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Max Krummenacher max.krummenacher@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
configs/apalis-tk1_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig index be9d55e7d4..3c9ca9ca78 100644 --- a/configs/apalis-tk1_defconfig +++ b/configs/apalis-tk1_defconfig @@ -53,7 +53,7 @@ CONFIG_USB_EHCI_TEGRA=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="Toradex" CONFIG_USB_GADGET_VENDOR_NUM=0x1b67 -CONFIG_USB_GADGET_PRODUCT_NUM=0xffff +CONFIG_USB_GADGET_PRODUCT_NUM=0x4000 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT_OVERLAY=y

From: Igor Opaniuk igor.opaniuk@toradex.com
Let the kernel print some debug messages when a user program crashes due to an exception.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/apalis-tk1.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index 9c8c8979f0..e4b4f196e6 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -94,7 +94,8 @@ "boot_file=uImage\0" \ "console=ttyS0\0" \ "defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 " \ - "usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0\0" \ + "usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \ + "user_debug=30\0" \ "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ EMMC_BOOTCMD \ "fdt_board=eval\0" \

On Thu, Aug 1, 2019 at 11:11 AM Igor Opaniuk igor.opaniuk@gmail.com wrote:
From: Igor Opaniuk igor.opaniuk@toradex.com
Let the kernel print some debug messages when a user program crashes due to an exception.
Signed-off-by: Stefan Agner stefan.agner@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
include/configs/apalis-tk1.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index 9c8c8979f0..e4b4f196e6 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -94,7 +94,8 @@ "boot_file=uImage\0" \ "console=ttyS0\0" \ "defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 " \
"usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0\0" \
"usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \
"user_debug=30\0" \ "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ EMMC_BOOTCMD \ "fdt_board=eval\0" \
-- 2.17.1
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

From: Igor Opaniuk igor.opaniuk@toradex.com
Disabling ASPM fixes incompatibilities with some PCIe cards
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Dominik Sliwa dominik.sliwa@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/apalis-tk1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index e4b4f196e6..d2ea5450bd 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -95,7 +95,7 @@ "console=ttyS0\0" \ "defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 " \ "usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \ - "user_debug=30\0" \ + "user_debug=30 pcie_aspm=off\0" \ "dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \ EMMC_BOOTCMD \ "fdt_board=eval\0" \

From: Igor Opaniuk igor.opaniuk@toradex.com
Switch to the generic compressed Kernel image type (zImage) instead of the U-Boot specific uImage format.
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Bhuvanchandra DV bhuvanchandra.dv@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/apalis-tk1.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index d2ea5450bd..ae62f00cd1 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -44,7 +44,7 @@ #define DFU_ALT_EMMC_INFO "apalis-tk1.img raw 0x0 0x500 mmcpart 1; " \ "boot part 0 1 mmcpart 0; " \ "rootfs part 0 2 mmcpart 0; " \ - "uImage fat 0 1 mmcpart 0; " \ + "zImage fat 0 1 mmcpart 0; " \ "tegra124-apalis-eval.dtb fat 0 1 mmcpart 0"
#define EMMC_BOOTCMD \ @@ -53,7 +53,7 @@ "${setupargs} ${vidargs}; echo Booting from internal eMMC " \ "chip...; run emmcdtbload; load mmc 0:1 ${kernel_addr_r} " \ "${boot_file} && run fdt_fixup && " \ - "bootm ${kernel_addr_r} - ${dtbparam}\0" \ + "bootz ${kernel_addr_r} - ${dtbparam}\0" \ "emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} " \ "${soc}-apalis-${fdt_board}.dtb && " \ "setenv dtbparam ${fdt_addr_r}\0" @@ -63,7 +63,7 @@ "nfsboot=pci enum; run setup; setenv bootargs ${defargs} ${nfsargs} " \ "${setupargs} ${vidargs}; echo Booting via DHCP/TFTP/NFS...; " \ "run nfsdtbload; dhcp ${kernel_addr_r} " \ - "&& run fdt_fixup && bootm ${kernel_addr_r} - ${dtbparam}\0" \ + "&& run fdt_fixup && bootz ${kernel_addr_r} - ${dtbparam}\0" \ "nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} " \ "${soc}-apalis-${fdt_board}.dtb " \ "&& setenv dtbparam ${fdt_addr_r}\0" @@ -74,7 +74,7 @@ "${vidargs}; echo Booting from SD card in 8bit slot...; " \ "run sddtbload; load mmc 1:1 ${kernel_addr_r} " \ "${boot_file} && run fdt_fixup && " \ - "bootm ${kernel_addr_r} - ${dtbparam}\0" \ + "bootz ${kernel_addr_r} - ${dtbparam}\0" \ "sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} " \ "${soc}-apalis-${fdt_board}.dtb " \ "&& setenv dtbparam ${fdt_addr_r}\0" @@ -85,13 +85,13 @@ "${usbargs} ${vidargs}; echo Booting from USB stick...; " \ "usb start && run usbdtbload; load usb 0:1 ${kernel_addr_r} " \ "${boot_file} && run fdt_fixup && " \ - "bootm ${kernel_addr_r} - ${dtbparam}\0" \ + "bootz ${kernel_addr_r} - ${dtbparam}\0" \ "usbdtbload=setenv dtbparam; load usb 0:1 ${fdt_addr_r} " \ "${soc}-apalis-${fdt_board}.dtb " \ "&& setenv dtbparam ${fdt_addr_r}\0"
#define BOARD_EXTRA_ENV_SETTINGS \ - "boot_file=uImage\0" \ + "boot_file=zImage\0" \ "console=ttyS0\0" \ "defargs=lp0_vec=2064@0xf46ff000 core_edp_mv=1150 core_edp_ma=4000 " \ "usb_port_owner_info=2 lane_owner_info=6 emc_max_dvfs=0 " \

From: Dominik Sliwa dominik.sliwa@toradex.com
Display proper reset reason after the SoC info.
Signed-off-by: Dominik Sliwa dominik.sliwa@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
arch/arm/mach-tegra/sys_info.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-tegra/sys_info.c b/arch/arm/mach-tegra/sys_info.c index 9975f33e0b..5dc998a52b 100644 --- a/arch/arm/mach-tegra/sys_info.c +++ b/arch/arm/mach-tegra/sys_info.c @@ -6,24 +6,36 @@
#include <common.h> #include <linux/ctype.h> +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) +#include <asm/arch-tegra/pmc.h>
-static void upstring(char *s) +static char *get_reset_cause(void) { - while (*s) { - *s = toupper(*s); - s++; + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; + + switch (pmc->pmc_reset_status) { + case 0x00: + return "POR"; + case 0x01: + return "WATCHDOG"; + case 0x02: + return "SENSOR"; + case 0x03: + return "SW_MAIN"; + case 0x04: + return "LP0"; } + return "UNKNOWN"; } +#endif
/* Print CPU information */ int print_cpuinfo(void) { - char soc_name[10]; - - strncpy(soc_name, CONFIG_SYS_SOC, 10); - upstring(soc_name); - puts(soc_name); - puts("\n"); + printf("SoC: %s\n", CONFIG_SYS_SOC); +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) + printf("Reset cause: %s\n", get_reset_cause()); +#endif
/* TBD: Add printf of major/minor rev info, stepping, etc. */ return 0;

On Thu, Aug 1, 2019 at 11:09 AM Igor Opaniuk igor.opaniuk@gmail.com wrote:
From: Dominik Sliwa dominik.sliwa@toradex.com
Display proper reset reason after the SoC info.
Signed-off-by: Dominik Sliwa dominik.sliwa@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com
arch/arm/mach-tegra/sys_info.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-tegra/sys_info.c b/arch/arm/mach-tegra/sys_info.c index 9975f33e0b..5dc998a52b 100644 --- a/arch/arm/mach-tegra/sys_info.c +++ b/arch/arm/mach-tegra/sys_info.c @@ -6,24 +6,36 @@
#include <common.h> #include <linux/ctype.h> +#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30) +#include <asm/arch-tegra/pmc.h>
-static void upstring(char *s) +static char *get_reset_cause(void) {
while (*s) {
*s = toupper(*s);
s++;
struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
switch (pmc->pmc_reset_status) {
case 0x00:
return "POR";
case 0x01:
return "WATCHDOG";
case 0x02:
return "SENSOR";
case 0x03:
return "SW_MAIN";
case 0x04:
return "LP0"; }
return "UNKNOWN";
} +#endif
/* Print CPU information */ int print_cpuinfo(void) {
char soc_name[10];
strncpy(soc_name, CONFIG_SYS_SOC, 10);
upstring(soc_name);
puts(soc_name);
puts("\n");
printf("SoC: %s\n", CONFIG_SYS_SOC);
+#if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30)
printf("Reset cause: %s\n", get_reset_cause());
+#endif
/* TBD: Add printf of major/minor rev info, stepping, etc. */ return 0;
-- 2.17.1
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

From: Marcel Ziswiler marcel.ziswiler@toradex.com
Remove video=tegrafb0:640x480-16@60 aka VESA VGA mode from vidargs in order for the panel specification in the device tree to be used. This causes the default to be the 10.1" LVDS display which will be available in the Toradex webshop shortly.
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Marcel Ziswiler marcel.ziswiler@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
include/configs/apalis-tk1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h index ae62f00cd1..869b2a8bd6 100644 --- a/include/configs/apalis-tk1.h +++ b/include/configs/apalis-tk1.h @@ -119,7 +119,7 @@ "load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \ "source ${loadaddr}\0" \ USB_BOOTCMD \ - "vidargs=video=tegrafb0:640x480-16@60 fbcon=map:1\0" + "vidargs=fbcon=map:1\0"
/* Increase console I/O buffer size */ #undef CONFIG_SYS_CBSIZE

From: Dominik Sliwa dominik.sliwa@toradex.com
When mainline kernels reboot TK1 they use SW_RESET, that reset mode does not reset PMIC. Some rails need to be off for RAM Re-repair to work correctly.
Reviewed-by: Oleksandr Suvorov oleksandr.suvorov@toradex.com Signed-off-by: Dominik Sliwa dominik.sliwa@toradex.com Signed-off-by: Igor Opaniuk igor.opaniuk@toradex.com ---
arch/arm/mach-tegra/tegra124/cpu.c | 45 ++++++++++++++++++++++++++ board/toradex/apalis-tk1/as3722_init.c | 23 +++++++++++++ 2 files changed, 68 insertions(+)
diff --git a/arch/arm/mach-tegra/tegra124/cpu.c b/arch/arm/mach-tegra/tegra124/cpu.c index 992c0beb04..abc050c27b 100644 --- a/arch/arm/mach-tegra/tegra124/cpu.c +++ b/arch/arm/mach-tegra/tegra124/cpu.c @@ -238,6 +238,45 @@ static bool is_partition_powered(u32 partid) return !!(reg & (1 << partid)); }
+static void unpower_partition(u32 partid) +{ + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; + + debug("%s: part ID = %08X\n", __func__, partid); + /* Is the partition on? */ + if (is_partition_powered(partid)) { + /* Yes, toggle the partition power state (ON -> OFF) */ + debug("power_partition, toggling state\n"); + writel(START_CP | partid, &pmc->pmc_pwrgate_toggle); + + /* Wait for the power to come down */ + while (is_partition_powered(partid)) + ; + + /* Give I/O signals time to stabilize */ + udelay(IO_STABILIZATION_DELAY); + } +} + +void unpower_cpus(void) +{ + debug("%s entry: G cluster\n", __func__); + + /* Power down the fast cluster rail partition */ + debug("%s: CRAIL\n", __func__); + unpower_partition(CRAIL); + + /* Power down the fast cluster non-CPU partition */ + debug("%s: C0NC\n", __func__); + unpower_partition(C0NC); + + /* Power down the fast cluster CPU0 partition */ + debug("%s: CE0\n", __func__); + unpower_partition(CE0); + + debug("%s: done\n", __func__); +} + static void power_partition(u32 partid) { struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE; @@ -284,6 +323,12 @@ void start_cpu(u32 reset_vector)
debug("%s entry, reset_vector = %x\n", __func__, reset_vector);
+ /* + * High power clusters are on after software reset, + * it may interfere with tegra124_ram_repair. + * unpower them. + */ + unpower_cpus(); tegra124_init_clocks();
/* Set power-gating timer multiplier */ diff --git a/board/toradex/apalis-tk1/as3722_init.c b/board/toradex/apalis-tk1/as3722_init.c index bd754e5fcf..15f8dce2f1 100644 --- a/board/toradex/apalis-tk1/as3722_init.c +++ b/board/toradex/apalis-tk1/as3722_init.c @@ -43,6 +43,29 @@ void pmic_enable_cpu_vdd(void) udelay(10 * 1000); #endif
+ /* + * Make sure all non-fused regulators are down. + * That way we're in known state after software reboot from linux + */ + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x0003, I2C_SEND_2_BYTES); + udelay(10 * 1000); + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x0004, I2C_SEND_2_BYTES); + udelay(10 * 1000); + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x001b, I2C_SEND_2_BYTES); + udelay(10 * 1000); + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x0014, I2C_SEND_2_BYTES); + udelay(10 * 1000); + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x001a, I2C_SEND_2_BYTES); + udelay(10 * 1000); + tegra_i2c_ll_write_addr(AS3722_I2C_ADDR, 2); + tegra_i2c_ll_write_data(0x0019, I2C_SEND_2_BYTES); + udelay(10 * 1000); + debug("%s: Setting VDD_CPU to 1.0V via AS3722 reg 0/4D\n", __func__); /* * Bring up VDD_CPU via the AS3722 PMIC on the PWR I2C bus.
participants (2)
-
Igor Opaniuk
-
Oleksandr Suvorov