From baefb63a13d106458577704ca4586b3f414c9520 Mon Sep 17 00:00:00 2001 From: Eric Nelson Date: Mon, 11 Dec 2017 13:52:11 -0200 Subject: mx6: Add board mx6memcal for use in validating DDR This is a virtual "board" that uses configuration files and Kconfig to define the memory layout used by a real board during the board bring-up process. It generates an SPL image that can be loaded using imx_usb or SB_LOADER.exe. When run, it will generate a set of calibration constants for use in either or both a DCD configuration file for boards that use u-boot.imx or struct mx6_mmdc_calibration for boards that boot via SPL. In essence, it is a configurable, open-source variant of the Freescale ddr-stress tool. https://community.nxp.com/docs/DOC-105652 File mx6memcal_defconfig configures the board for use with mx6sabresd or mx6qsabreauto. Signed-off-by: Eric Nelson Signed-off-by: Fabio Estevam --- include/configs/mx6memcal.h | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 include/configs/mx6memcal.h (limited to 'include') diff --git a/include/configs/mx6memcal.h b/include/configs/mx6memcal.h new file mode 100644 index 0000000000..f5238a52f5 --- /dev/null +++ b/include/configs/mx6memcal.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. + * + * Configuration settings for the Boundary Devices Nitrogen6X + * and Freescale i.MX6Q Sabre Lite boards. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* SPL */ + +#include "mx6_common.h" +#include "imx6_spl.h" + +#undef CONFIG_FSL_ESDHC +#undef CONFIG_MMC +#undef CONFIG_SPL_MMC_SUPPORT +#undef CONFIG_GENERIC_MMC +#undef CONFIG_CMD_FUSE + +#define CONFIG_SYS_MEMTEST_START 0x10000000 +#define CONFIG_SYS_MEMTEST_END 0x20000000 +#define CONFIG_SYS_MALLOC_LEN (64 * 1024 * 1024) + +#define CONFIG_MXC_UART +#ifdef CONFIG_SERIAL_CONSOLE_UART1 +#if defined(CONFIG_MX6SL) +#define CONFIG_MXC_UART_BASE UART1_IPS_BASE_ADDR +#else +#define CONFIG_MXC_UART_BASE UART1_BASE +#endif +#elif defined(CONFIG_SERIAL_CONSOLE_UART2) +#define CONFIG_MXC_UART_BASE UART2_BASE +#else +#error please define serial console (CONFIG_SERIAL_CONSOLE_UARTx) +#endif +#define CONFIG_BAUDRATE 115200 + +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + 16) + +/* Physical Memory Map */ +#define CONFIG_NR_DRAM_BANKS 1 +#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR + +#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM +#define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR +#define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE + +#define CONFIG_SYS_INIT_SP_OFFSET \ + (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) + +#define CONFIG_ENV_SIZE (8 * 1024) + +#endif /* __CONFIG_H */ -- cgit From 6b79f71c8ee970635ac71d7a452d6b39a3db0e99 Mon Sep 17 00:00:00 2001 From: Christopher Spinrath Date: Sat, 9 Dec 2017 16:37:41 +0100 Subject: ARM: imx: cm_fx6: env: use standard variables In preparation for supporting the distro boot command, introduce the standard variables for specifying load addresses, which are documented in README and doc/README.distro, and replace the custom variables used so far with them. Since the current address layout disregards an address for an initramfs, also switch to the load addresses used and proven by other imx6 boards (e.g. the wandboard and nitrogen6x), instead of going on with our own way. Signed-off-by: Christopher Spinrath Reviewed-by: Fabio Estevam --- include/configs/cm_fx6.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 5195610233..f511bc221c 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -63,6 +63,13 @@ #define CONFIG_ENV_OFFSET (768 * 1024) #define CONFIG_EXTRA_ENV_SETTINGS \ + "fdt_high=0xffffffff\0" \ + "initrd_high=0xffffffff\0" \ + "fdt_addr_r=0x18000000\0" \ + "ramdisk_addr_r=0x13000000\0" \ + "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ "stdin=serial,usbkbd\0" \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" \ @@ -73,22 +80,19 @@ "kernel=uImage-cm-fx6\0" \ "script=boot.scr\0" \ "dtb=cm-fx6.dtb\0" \ - "bootm_low=18000000\0" \ - "loadaddr=0x10800000\0" \ - "fdtaddr=0x11000000\0" \ "console=ttymxc3,115200\0" \ "ethprime=FEC0\0" \ "video_hdmi=mxcfb0:dev=hdmi,1920x1080M-32@50,if=RGB32\0" \ "video_dvi=mxcfb0:dev=dvi,1280x800M-32@50,if=RGB32\0" \ - "doboot=bootm ${loadaddr}\0" \ + "doboot=bootm ${kernel_addr_r}\0" \ "doloadfdt=false\0" \ "mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \ "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ "setboottypez=setenv kernel ${zImage};" \ - "setenv doboot bootz ${loadaddr} - ${fdtaddr};" \ + "setenv doboot bootz ${kernel_addr_r} - ${fdt_addr_r};" \ "setenv doloadfdt true;\0" \ "setboottypem=setenv kernel ${uImage};" \ - "setenv doboot bootm ${loadaddr};" \ + "setenv doboot bootm ${kernel_addr_r};" \ "setenv doloadfdt false;\0"\ "mmcroot=/dev/mmcblk0p2 rw rootwait\0" \ "sataroot=/dev/sda2 rw rootwait\0" \ @@ -112,13 +116,13 @@ "run_eboot=echo Starting EBOOT ...; "\ "mmc dev 2 && " \ "mmc rescan && mmc read 10042000 a 400 && go 10042000\0" \ - "loadscript=load ${storagetype} ${storagedev} ${loadaddr} ${script};\0"\ - "loadkernel=load ${storagetype} ${storagedev} ${loadaddr} ${kernel};\0"\ - "loadfdt=load ${storagetype} ${storagedev} ${fdtaddr} ${dtb};\0" \ + "loadscript=load ${storagetype} ${storagedev} ${scriptaddr} ${script};\0"\ + "loadkernel=load ${storagetype} ${storagedev} ${kernel_addr_r} ${kernel};\0"\ + "loadfdt=load ${storagetype} ${storagedev} ${fdt_addr_r} ${dtb};\0" \ "bootscript=echo Running bootscript from ${storagetype} ...;" \ - "source ${loadaddr};\0" \ - "nandloadkernel=nand read ${loadaddr} 0 780000;\0" \ - "nandloadfdt=nand read ${fdtaddr} 780000 80000;\0" \ + "source ${scriptaddr};\0" \ + "nandloadkernel=nand read ${kernel_addr_r} 0 780000;\0" \ + "nandloadfdt=nand read ${fdt_addr_r} 780000 80000;\0" \ "setupmmcboot=setenv storagetype mmc; setenv storagedev 2;\0" \ "setupsataboot=setenv storagetype sata; setenv storagedev 0;\0" \ "setupnandboot=setenv storagetype nand;\0" \ -- cgit From 3ef5f6714ab1501247b227ffdcb5f37fd13c0bce Mon Sep 17 00:00:00 2001 From: Christopher Spinrath Date: Sat, 9 Dec 2017 16:37:42 +0100 Subject: ARM: imx: cm_fx6: env: support distro boot command The current default environment of the cm_fx6 is not suitable for booting modern distributions. Instead of extending the custom environment, let's use the distro boot command, which has been developed for precisely this use case. If the distro boot command fails, fall back to the old behavior (except for USB drives where the old behaviour is completely covered by the distro boot command). That way it is still possible to create "rescue SD cards" for old installations (e.g. if one messes up the on-flash environment). Signed-off-by: Christopher Spinrath Reviewed-by: Fabio Estevam --- include/configs/cm_fx6.h | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index f511bc221c..2cd127bcc3 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -13,6 +13,10 @@ #include "mx6_common.h" +#ifndef CONFIG_SPL_BUILD +#include +#endif + /* Machine config */ #define CONFIG_SYS_LITTLE_ENDIAN #define CONFIG_MACH_TYPE 4273 @@ -62,6 +66,7 @@ #define CONFIG_ENV_SIZE (8 * 1024) #define CONFIG_ENV_OFFSET (768 * 1024) +#ifndef CONFIG_SPL_BUILD #define CONFIG_EXTRA_ENV_SETTINGS \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ @@ -126,7 +131,6 @@ "setupmmcboot=setenv storagetype mmc; setenv storagedev 2;\0" \ "setupsataboot=setenv storagetype sata; setenv storagedev 0;\0" \ "setupnandboot=setenv storagetype nand;\0" \ - "setupusbboot=setenv storagetype usb; setenv storagedev 0;\0" \ "storagebootcmd=echo Booting from ${storagetype} ...;" \ "run ${storagetype}args; run doboot;\0" \ "trybootk=if run loadkernel; then " \ @@ -141,29 +145,33 @@ "run setboottypem;" \ "run trybootk;" \ "run setboottypez;" \ - "run trybootk;\0" - -#define CONFIG_BOOTCOMMAND \ - "run setupmmcboot;" \ - "mmc dev ${storagedev};" \ - "if mmc rescan; then " \ - "run trybootsmz;" \ - "fi;" \ - "run setupusbboot;" \ - "if usb start; then "\ - "if run loadscript; then " \ - "run bootscript;" \ + "run trybootk;\0" \ + "legacy_bootcmd=" \ + "run setupmmcboot;" \ + "mmc dev ${storagedev};" \ + "if mmc rescan; then " \ + "run trybootsmz;" \ "fi;" \ - "fi;" \ - "run setupsataboot;" \ - "if sata init; then " \ - "run trybootsmz;" \ - "fi;" \ - "run setupnandboot;" \ - "run nandboot;" + "run setupsataboot;" \ + "if sata init; then " \ + "run trybootsmz;" \ + "fi;" \ + "run setupnandboot;" \ + "run nandboot;\0" \ + BOOTENV #define CONFIG_PREBOOT "usb start;sf probe" +#define BOOT_TARGET_DEVICES(func) \ + func(USB, usb, 0) \ + func(MMC, mmc, 2) \ + func(SATA, sata, 0) + +#include +#else +#define CONFIG_EXTRA_ENV_SETTINGS +#endif + /* SPI */ #define CONFIG_SPI #define CONFIG_MXC_SPI -- cgit From 5a6440cac77db8083aa9b7f260e0ff3e994e7834 Mon Sep 17 00:00:00 2001 From: Christopher Spinrath Date: Sat, 9 Dec 2017 16:37:43 +0100 Subject: ARM: imx: cm_fx6: env: don't run boot scripts twice Boot scripts located in the root directory of the first partition of USB, mmc, and SATA drives are executed twice: first by the distro boot command and then by the legacy boot command. This may have weird side effects if those scripts only change or extend the environment (including parts of the boot command itself). Removing the script execution from the legacy boot command has its own caveats. For instance, the distro boot command may execute the boot.scr on the mmc drive, then the boot.scr on the SATA drive, before the legacy boot command actually boots from the mmc drive. However, the current behavior would only execute the boot.scr once more before the actual boot, but it does not prevent the script located on the SATA drive from being executed, and thus, both scripts from being mixed up. Considering that the legacy boot command is only in place to boot old (standard) installations, let's go with the resolution having less custom code and remove the script execution from the legacy boot command. Signed-off-by: Christopher Spinrath Reviewed-by: Fabio Estevam --- include/configs/cm_fx6.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'include') diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h index 2cd127bcc3..ec3e6e6ca5 100644 --- a/include/configs/cm_fx6.h +++ b/include/configs/cm_fx6.h @@ -83,7 +83,6 @@ "uImage=uImage-cm-fx6\0" \ "zImage=zImage-cm-fx6\0" \ "kernel=uImage-cm-fx6\0" \ - "script=boot.scr\0" \ "dtb=cm-fx6.dtb\0" \ "console=ttymxc3,115200\0" \ "ethprime=FEC0\0" \ @@ -121,11 +120,8 @@ "run_eboot=echo Starting EBOOT ...; "\ "mmc dev 2 && " \ "mmc rescan && mmc read 10042000 a 400 && go 10042000\0" \ - "loadscript=load ${storagetype} ${storagedev} ${scriptaddr} ${script};\0"\ "loadkernel=load ${storagetype} ${storagedev} ${kernel_addr_r} ${kernel};\0"\ "loadfdt=load ${storagetype} ${storagedev} ${fdt_addr_r} ${dtb};\0" \ - "bootscript=echo Running bootscript from ${storagetype} ...;" \ - "source ${scriptaddr};\0" \ "nandloadkernel=nand read ${kernel_addr_r} 0 780000;\0" \ "nandloadfdt=nand read ${fdt_addr_r} 780000 80000;\0" \ "setupmmcboot=setenv storagetype mmc; setenv storagedev 2;\0" \ @@ -139,9 +135,7 @@ "fi;" \ "run storagebootcmd;" \ "fi;\0" \ - "trybootsmz=if run loadscript; then " \ - "run bootscript;" \ - "fi;" \ + "trybootsmz=" \ "run setboottypem;" \ "run trybootk;" \ "run setboottypez;" \ -- cgit From 290e7cfdbfa288d26598c073186ab45e3fa711b3 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Wed, 3 Jan 2018 12:33:05 -0200 Subject: mx6ull: Handle the CONFIG_MX6ULL cases correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commit 051ba9e082f7 ("Kconfig: mx6ull: Deselect MX6UL from CONFIG_MX6ULL") CONFIG_MX6ULL does not select CONFIG_MX6UL anymore, so take this into consideration in all the checks for CONFIG_MX6UL. This fixes a boot regression. Reported-by: Stefan Agner Signed-off-by: Fabio Estevam Reviewed-by: Stefan Agner Tested-by: Breno Lima Tested-by: Peng Fan Reviewed-by: Stefano Babic Tested-by: Jörg Krause --- include/configs/imx6_spl.h | 3 ++- include/configs/mx6_common.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h index cdb3a374bc..dd481205f3 100644 --- a/include/configs/imx6_spl.h +++ b/include/configs/imx6_spl.h @@ -55,7 +55,8 @@ # endif #endif -#if defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL) || defined(CONFIG_MX6SL) +#if defined(CONFIG_MX6SX) || defined(CONFIG_MX6SL) || \ + defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) #define CONFIG_SPL_BSS_START_ADDR 0x88200000 #define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */ #define CONFIG_SYS_SPL_MALLOC_START 0x88300000 diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h index 5fb85a1127..59e6daea62 100644 --- a/include/configs/mx6_common.h +++ b/include/configs/mx6_common.h @@ -7,7 +7,7 @@ #ifndef __MX6_COMMON_H #define __MX6_COMMON_H -#ifndef CONFIG_MX6UL +#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) #ifndef CONFIG_SYS_L2CACHE_OFF #define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE L2_PL310_BASE @@ -37,8 +37,9 @@ #define CONFIG_REVISION_TAG /* Boot options */ -#if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6SL) || \ - defined(CONFIG_MX6UL) || defined(CONFIG_MX6SLL)) +#if defined(CONFIG_MX6SL) || defined(CONFIG_MX6SLL) || \ + defined(CONFIG_MX6SX) || \ + defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL) #define CONFIG_LOADADDR 0x82000000 #ifndef CONFIG_SYS_TEXT_BASE #define CONFIG_SYS_TEXT_BASE 0x87800000 -- cgit From 616aa55d178788e134cc58439a7215b03c7090e4 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 5 Jan 2018 15:08:17 +0100 Subject: imx: move CONFIG_SYSCOUNTER_TIMER to Kconfig Signed-off-by: Stefan Agner Reviewed-by: Fabio Estevam --- include/configs/mx7_common.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h index 16e4d95ff4..17850400c1 100644 --- a/include/configs/mx7_common.h +++ b/include/configs/mx7_common.h @@ -19,7 +19,6 @@ /* Timer settings */ #define CONFIG_MXC_GPT_HCLK -#define CONFIG_SYSCOUNTER_TIMER #define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */ #define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK #define CONFIG_SYS_FSL_CLK -- cgit From 46718353b2fc784fa8f658fd5112272ed921ce9a Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Fri, 5 Jan 2018 15:08:19 +0100 Subject: imx: initialize and use generic timer on i.MX 6UL/ULL The i.MX 6UL/ULL feature a Cortex-A7 CPU which suppor the ARM generic timer. This change makes use of the ARM generic timer in U-Boot. This is crucial to make the ARM generic timers usable in Linux since timer_init() initalizes the system counter module, which is necessary to use the generic timers CP15 registers. Signed-off-by: Stefan Agner Reviewed-by: Fabio Estevam --- include/configs/mx6_common.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h index 59e6daea62..ddc645c136 100644 --- a/include/configs/mx6_common.h +++ b/include/configs/mx6_common.h @@ -7,7 +7,10 @@ #ifndef __MX6_COMMON_H #define __MX6_COMMON_H -#if !(defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) +#if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL)) +#define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */ +#define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK +#else #ifndef CONFIG_SYS_L2CACHE_OFF #define CONFIG_SYS_L2_PL310 #define CONFIG_SYS_PL310_BASE L2_PL310_BASE -- cgit