From 636941ff4dc54289c3a0bcc792c3fcd04893a65d Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:07 -0300 Subject: [PATCH 01/26] pico-imx6ul: Convert to distro config Instead of keeping a custom environment, use a more generic approach by switching to distro config. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 2 ++ include/configs/pico-imx6ul.h | 67 ++++++++++------------------------- 2 files changed, 20 insertions(+), 49 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 59ef7b7f22..3f969a2d6e 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -4,7 +4,9 @@ CONFIG_SYS_TEXT_BASE=0x87800000 CONFIG_TARGET_PICO_IMX6UL=y # CONFIG_CMD_BMODE is not set CONFIG_NR_DRAM_BANKS=1 +CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx6ul/imximage.cfg" +CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" CONFIG_BOOTDELAY=3 CONFIG_SUPPORT_RAW_INITRD=y CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 34ba53a2a9..e8e4c87614 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -52,65 +52,34 @@ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 #define CONFIG_EXTRA_ENV_SETTINGS \ + "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc5\0" \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ - "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ "fdt_addr=0x83000000\0" \ - "mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \ - "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \ + "fdt_addr_r=0x83000000\0" \ + "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ + "ramdisk_addr_r=0x83000000\0" \ + "ramdiskaddr=0x83000000\0" \ + "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ "mmcautodetect=yes\0" \ CONFIG_DFU_ENV_SETTINGS \ - "finduuid=part uuid mmc 0:2 uuid\0" \ + "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ - "name=boot,size=16MiB;name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ - "setup_emmc=gpt write mmc 0 $partitions; reset;\0" \ - "mmcargs=setenv bootargs console=${console},${baudrate} " \ - "root=PARTUUID=${uuid} rootwait rw\0" \ - "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ - "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run finduuid; " \ - "run mmcargs; " \ - "if run loadfdt; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi;\0" \ - "netargs=setenv bootargs console=${console},${baudrate} " \ - "root=/dev/nfs " \ - "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ - "netboot=echo Booting from net ...; " \ - "run netargs; " \ - "if test ${ip_dyn} = yes; then " \ - "setenv get_cmd dhcp; " \ - "else " \ - "setenv get_cmd tftp; " \ - "fi; " \ - "${get_cmd} ${image}; " \ - "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ - "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ - "bootz ${loadaddr} - ${fdt_addr}; " \ - "else " \ - "if test ${boot_fdt} = try; then " \ - "bootz; " \ - "else " \ - "echo WARN: Cannot load the DT; " \ - "fi; " \ - "fi; " \ - "else " \ - "bootz; " \ - "fi;\0" \ + "name=rootfs,size=0,uuid=${uuid_gpt_rootfs}\0" \ + "fastboot_partition_alias_system=rootfs\0" \ + "setup_emmc=mmc dev 0; gpt write mmc 0 $partitions; reset;\0" \ + BOOTENV -#define CONFIG_BOOTCOMMAND \ - "if mmc rescan; then " \ - "if run loadimage; then " \ - "run mmcboot; " \ - "else run netboot; " \ - "fi; " \ - "else run netboot; fi" +#define BOOT_TARGET_DEVICES(func) \ + func(MMC, mmc, 0) \ + func(DHCP, dhcp, na) + +#include #define CONFIG_SYS_MEMTEST_START 0x80000000 #define CONFIG_SYS_MEMTEST_END CONFIG_SYS_MEMTEST_START + SZ_128M From 82a8a93327077046d3ede01aea5984ffcc019f5c Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:08 -0300 Subject: [PATCH 02/26] pico-imx6ul: Convert to SPL There are two versions of imx6ul pico SOMs: one with 256MB and another one with 512MB of RAM. Convert to SPL so that both versions can be supported. This patch doesn't rework the clock initialization to avoid changing the behavior in this same patch, so it will be cleaned up in future. Currently only the 256MB is tested/supported. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- arch/arm/mach-imx/mx6/Kconfig | 1 + board/technexion/pico-imx6ul/Makefile | 2 +- board/technexion/pico-imx6ul/spl.c | 115 ++++++++++++++++++++++++++ configs/pico-imx6ul_defconfig | 14 +++- include/configs/pico-imx6ul.h | 1 + 5 files changed, 131 insertions(+), 2 deletions(-) create mode 100644 board/technexion/pico-imx6ul/spl.c diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index a2799c436e..06c25bae36 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -402,6 +402,7 @@ config TARGET_OT1200 config TARGET_PICO_IMX6UL bool "PICO-IMX6UL-EMMC" select MX6UL + select SUPPORT_SPL config TARGET_LITEBOARD bool "Grinn liteBoard (i.MX6UL)" diff --git a/board/technexion/pico-imx6ul/Makefile b/board/technexion/pico-imx6ul/Makefile index 8fdb7875ac..b7493df01c 100644 --- a/board/technexion/pico-imx6ul/Makefile +++ b/board/technexion/pico-imx6ul/Makefile @@ -2,4 +2,4 @@ # (C) Copyright 2015 Technexion Ltd. # (C) Copyright 2015 Freescale Semiconductor, Inc. -obj-y := pico-imx6ul.o +obj-y := pico-imx6ul.o spl.o diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c new file mode 100644 index 0000000000..78c731fe7c --- /dev/null +++ b/board/technexion/pico-imx6ul/spl.c @@ -0,0 +1,115 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_SPL_BUILD) +#include + +static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = { + .grp_addds = 0x00000030, + .grp_ddrmode_ctl = 0x00020000, + .grp_b0ds = 0x00000030, + .grp_ctlds = 0x00000030, + .grp_b1ds = 0x00000030, + .grp_ddrpke = 0x00000000, + .grp_ddrmode = 0x00020000, + .grp_ddr_type = 0x00080000, +}; + +static struct mx6ul_iomux_ddr_regs mx6_ddr_ioregs = { + .dram_dqm0 = 0x00000030, + .dram_dqm1 = 0x00000030, + .dram_ras = 0x00000030, + .dram_cas = 0x00000030, + .dram_odt0 = 0x00000030, + .dram_odt1 = 0x00000030, + .dram_sdba2 = 0x00000000, + .dram_sdclk_0 = 0x00000030, + .dram_sdqs0 = 0x00000030, + .dram_sdqs1 = 0x00000030, + .dram_reset = 0x00000030, +}; + +static struct mx6_mmdc_calibration mx6_mmcd_calib = { + .p0_mpwldectrl0 = 0x00000000, + .p0_mpdgctrl0 = 0x01380134, + .p0_mprddlctl = 0x40404244, + .p0_mpwrdlctl = 0x40405050, +}; + +static struct mx6_ddr_sysinfo ddr_sysinfo = { + .dsize = 0, + .cs1_mirror = 0, + .cs_density = 32, + .ncs = 1, + .bi_on = 1, + .rtt_nom = 1, + .rtt_wr = 0, + .ralat = 5, + .walat = 0, + .mif3_mode = 3, + .rst_to_cke = 0x23, + .sde_to_rst = 0x10, + .refsel = 1, + .refr = 3, +}; + +static struct mx6_ddr3_cfg mem_ddr = { + .mem_speed = 1333, + .density = 2, + .width = 16, + .banks = 8, + .rowaddr = 14, + .coladdr = 10, + .pagesz = 2, + .trcd = 1350, + .trcmin = 4950, + .trasmin = 3600, +}; + +static void ccgr_init(void) +{ + struct mxc_ccm_reg *ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; + + writel(0xFFFFFFFF, &ccm->CCGR0); + writel(0xFFFFFFFF, &ccm->CCGR1); + writel(0xFFFFFFFF, &ccm->CCGR2); + writel(0xFFFFFFFF, &ccm->CCGR3); + writel(0xFFFFFFFF, &ccm->CCGR4); + writel(0xFFFFFFFF, &ccm->CCGR5); + writel(0xFFFFFFFF, &ccm->CCGR6); +} + +static void spl_dram_init(void) +{ + mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs); + mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); +} + +void board_init_f(ulong dummy) +{ + ccgr_init(); + arch_cpu_init(); + board_early_init_f(); + timer_init(); + preloader_console_init(); + spl_dram_init(); + memset(__bss_start, 0, __bss_end - __bss_start); + board_init_r(NULL, 0); +} + +void reset_cpu(ulong addr) +{ +} +#endif diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 3f969a2d6e..589e67be96 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -1,12 +1,23 @@ CONFIG_ARM=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_TARGET_PICO_IMX6UL=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y # CONFIG_CMD_BMODE is not set CONFIG_NR_DRAM_BANKS=1 CONFIG_DISTRO_DEFAULTS=y -CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/technexion/pico-imx6ul/imximage.cfg" +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_BOOTDELAY=3 CONFIG_SUPPORT_RAW_INITRD=y CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" @@ -21,6 +32,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_PART=y CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_DHCP=y CONFIG_CMD_MII=y diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index e8e4c87614..5fdbff93e0 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -12,6 +12,7 @@ #include #include "mx6_common.h" #include +#include "imx6_spl.h" /* Network support */ From 3e8cdb990cc8aacb6e90ea93003ae2bdc6077137 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:09 -0300 Subject: [PATCH 03/26] pico-imx6ul: Add fastboot support fastboot tool is a convenient way to flash the eMMC, so add support for it. Examples of usages: On the pico-imx6ul U-Boot prompt: => fastboot 0 On the Linux PC connected via USB: 1. Retrieving the U-Boot version $ sudo fastboot getvar bootloader-version -i 0x0525 bootloader-version: U-Boot 2018.07-rc2-00130-g0881835-dirty finished. total time: 0.000s 2. Resetting the board $ sudo fastboot reboot -i 0x0525 (this causes the pico-imx6ul to reboot) Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 589e67be96..cae7ded1fa 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -45,6 +45,12 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_IS_IN_MMC=y CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +CONFIG_FASTBOOT_BUF_SIZE=0x10000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_FSL_ESDHC=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y @@ -56,5 +62,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL" CONFIG_USB_GADGET_VENDOR_NUM=0x0525 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y -CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_OF_LIBFDT=y From 558a37ce852077d01f56688af4d55ac5fa76a981 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:10 -0300 Subject: [PATCH 04/26] pico-imx6ul: Add bmode support The 'bmode' command is helpful for switching the boot media. In the case of pico-imx6ul there are two possible boot media: eMMC or USB. To boot from eMMC: => bmode emmc To boot from USB (via Serial Download Protocol): => bmode usb Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index cae7ded1fa..daa898fb22 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -9,7 +9,6 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y -# CONFIG_CMD_BMODE is not set CONFIG_NR_DRAM_BANKS=1 CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" From 000829fdb8999a4085e45799e7dee73f27c7d3f0 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:11 -0300 Subject: [PATCH 05/26] pico-imx6ul: Add support for the 512MB module Currently only the module with 256MB of RAM is supported. Add support for the 512MB of RAM variant as well. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/spl.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c index 78c731fe7c..1819722024 100644 --- a/board/technexion/pico-imx6ul/spl.c +++ b/board/technexion/pico-imx6ul/spl.c @@ -70,7 +70,6 @@ static struct mx6_ddr3_cfg mem_ddr = { .density = 2, .width = 16, .banks = 8, - .rowaddr = 14, .coladdr = 10, .pagesz = 2, .trcd = 1350, @@ -91,12 +90,34 @@ static void ccgr_init(void) writel(0xFFFFFFFF, &ccm->CCGR6); } -static void spl_dram_init(void) +static void imx6ul_spl_dram_cfg_size(u32 ram_size) { + if (ram_size == SZ_256M) + mem_ddr.rowaddr = 14; + else + mem_ddr.rowaddr = 15; + mx6ul_dram_iocfg(mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs); mx6_dram_cfg(&ddr_sysinfo, &mx6_mmcd_calib, &mem_ddr); } +static void imx6ul_spl_dram_cfg(void) +{ + ulong ram_size_test, ram_size = 0; + + for (ram_size = SZ_512M; ram_size >= SZ_256M; ram_size >>= 1) { + imx6ul_spl_dram_cfg_size(ram_size); + ram_size_test = get_ram_size((long int *)PHYS_SDRAM, ram_size); + if (ram_size_test == ram_size) + break; + } + + if (ram_size < SZ_256M) { + puts("ERROR: DRAM size detection failed\n"); + hang(); + } +} + void board_init_f(ulong dummy) { ccgr_init(); @@ -104,7 +125,7 @@ void board_init_f(ulong dummy) board_early_init_f(); timer_init(); preloader_console_init(); - spl_dram_init(); + imx6ul_spl_dram_cfg(); memset(__bss_start, 0, __bss_end - __bss_start); board_init_r(NULL, 0); } From c97c9e0804062c86e253b404e1da10edc3e9a0f1 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Tue, 4 Sep 2018 10:23:13 -0300 Subject: [PATCH 06/26] pico-imx6ul: Update the README file Update the README file to take into accound the switch to SPL. Signed-off-by: Fabio Estevam Signed-off-by: Fabio Berton Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/README | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/board/technexion/pico-imx6ul/README b/board/technexion/pico-imx6ul/README index 2f66095097..a5415714ee 100644 --- a/board/technexion/pico-imx6ul/README +++ b/board/technexion/pico-imx6ul/README @@ -13,7 +13,13 @@ $ make mrproper $ make pico-imx6ul_defconfig $ make -This will generate the U-Boot binary called u-boot.imx. +This generates the SPL and u-boot.img binaries. + +1. Loading U-Boot via USB Serial Download Protocol + +Note: This method is convenient for development purposes. +If the eMMC has already a U-Boot flashed with DFU support then +the user can go to step 2 below in order to update U-Boot. Put pico board in USB download mode (refer to the document http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf page 15) @@ -24,11 +30,15 @@ Connect a USB cable between the OTG pico port and the host PC Open a terminal program such as minicom -Copy u-boot.imx to the imx_usb_loader folder. +Copy SPL and u-boot.img to the imx_usb_loader folder. -Load u-boot.imx via USB: +Load the SPL binary via USB: -$ sudo ./imx_usb u-boot.imx +$ sudo ./imx_usb SPL + +Load the u-boot.img binary via USB: + +$ sudo ./imx_usb u-boot.img Then U-Boot should start and its messages will appear in the console program. @@ -37,12 +47,16 @@ Use the default environment variables: => env default -f -a => saveenv +2. Flashing U-Boot into the eMMC + Run the DFU command: => dfu 0 mmc 0 -Transfer u-boot.imx that will be flashed into the eMMC: +Flash SPL and u-boot.img into the eMMC running the following commands on a PC: -$ sudo dfu-util -D u-boot.imx -a boot +$ sudo dfu-util -D SPL -a spl + +$ sudo dfu-util -D u-boot.img -a u-boot Then on the U-Boot prompt the following message should be seen after a successful upgrade: From 136f4605658f493dc5ac8dd2048828e9a961648c Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:14 -0300 Subject: [PATCH 07/26] pico-imx6ul: Sync defconfig with new changes Due the changes in previous commits, we need to resync the defconfig to reduce noise in next commits. Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index daa898fb22..56cb4810dc 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -9,43 +9,31 @@ CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y -CONFIG_NR_DRAM_BANKS=1 CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTDELAY=3 CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y -CONFIG_BOOTDELAY=3 -CONFIG_SUPPORT_RAW_INITRD=y -CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" -CONFIG_BOARD_EARLY_INIT_F=y -CONFIG_HUSH_PARSER=y -CONFIG_CMD_BOOTZ=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y -CONFIG_CMD_PART=y CONFIG_CMD_USB=y CONFIG_CMD_USB_SDP=y CONFIG_CMD_USB_MASS_STORAGE=y -CONFIG_CMD_DHCP=y -CONFIG_CMD_MII=y -CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y -CONFIG_CMD_EXT2=y -CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y -CONFIG_CMD_FAT=y -CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_IS_IN_MMC=y CONFIG_DFU_MMC=y CONFIG_USB_FUNCTION_FASTBOOT=y -CONFIG_FASTBOOT_BUF_ADDR=0x82000000 CONFIG_FASTBOOT_BUF_SIZE=0x10000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 From f6d805504b6fcc6c6e7d3eb0aed6b7c07ce33e53 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:15 -0300 Subject: [PATCH 08/26] pico-imx6ul: Add bootmenu to choose the baseboard Currently the baseboards do not offer a way to autodetect which one is in use, so we ask the user if no value has been set. Signed-off-by: Otavio Salvador --- configs/pico-imx6ul_defconfig | 5 +++-- include/configs/pico-imx6ul.h | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 56cb4810dc..3d4063b136 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -13,13 +13,14 @@ CONFIG_DISTRO_DEFAULTS=y CONFIG_NR_DRAM_BANKS=1 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3 -CONFIG_BOOTCOMMAND="run finduuid; run distro_bootcmd" -CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="ask" CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL_I2C_SUPPORT=y CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y +CONFIG_CMD_BOOTMENU=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 5fdbff93e0..9905b1eebb 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -50,6 +50,10 @@ "/imx6ul-pico-hobbit.dtb ext4 0 1;" \ "rootfs part 0 2\0" \ +#define BOOTMENU_ENV \ + "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ + "setenv fdtfile imx6ul-pico-hobbit.dtb\0" \ + #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 #define CONFIG_EXTRA_ENV_SETTINGS \ @@ -59,6 +63,7 @@ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \ + BOOTMENU_ENV \ "fdt_addr=0x83000000\0" \ "fdt_addr_r=0x83000000\0" \ "kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \ @@ -68,6 +73,11 @@ "scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \ "mmcautodetect=yes\0" \ CONFIG_DFU_ENV_SETTINGS \ + "findfdt=" \ + "if test $fdtfile = ask ; then " \ + "bootmenu -1; fi;" \ + "if test $fdtfile != ask ; then " \ + "saveenv; fi;\0" \ "finduuid=part uuid mmc 0:1 uuid\0" \ "partitions=" \ "uuid_disk=${uuid_gpt_disk};" \ From 313d02b6b4b2c6d2527b116af2c698b0a412e246 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:16 -0300 Subject: [PATCH 09/26] pico-imx6ul: Improve default DFU settings This rework the DFU settings so it supports the SPL and U-Boot image, as well as the single partition layout we are using by default. Signed-off-by: Otavio Salvador --- include/configs/pico-imx6ul.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 9905b1eebb..535f0b26df 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -44,11 +44,12 @@ #define DFU_DEFAULT_POLL_TIMEOUT 300 #define CONFIG_DFU_ENV_SETTINGS \ - "dfu_alt_info=uboot raw 0x2 0x400 mmcpart 1;" \ - "boot part 0 1;" \ - "/zImage ext4 0 1;" \ - "/imx6ul-pico-hobbit.dtb ext4 0 1;" \ - "rootfs part 0 2\0" \ + "dfu_alt_info=" \ + "spl raw 0x2 0x400 mmcpart 1;" \ + "u-boot raw 0x8a 0x400 mmcpart 1;" \ + "/boot/zImage ext4 0 1;" \ + "/boot/imx6ul-pico-hobbit.dtb ext4 0 1;" \ + "rootfs part 0 1\0" \ #define BOOTMENU_ENV \ "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ From 978138fab825f9af96ca44d2b64193c6cd536623 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:17 -0300 Subject: [PATCH 10/26] pico-imx6ul: Sync README with pico-imx7d Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/README | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/board/technexion/pico-imx6ul/README b/board/technexion/pico-imx6ul/README index a5415714ee..66dc977d49 100644 --- a/board/technexion/pico-imx6ul/README +++ b/board/technexion/pico-imx6ul/README @@ -22,13 +22,14 @@ If the eMMC has already a U-Boot flashed with DFU support then the user can go to step 2 below in order to update U-Boot. Put pico board in USB download mode (refer to the document -http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf page 15) +http://www.wandboard.org/images/hobbit/hobbitboard-imx6ul-reva1.pdf +page 15). -Connect a USB to serial adapter between the host PC and pico +Connect a USB to serial adapter between the host PC and pico. -Connect a USB cable between the OTG pico port and the host PC +Connect a USB cable between the OTG pico port and the host PC. -Open a terminal program such as minicom +Open a terminal program such as minicom. Copy SPL and u-boot.img to the imx_usb_loader folder. @@ -40,7 +41,7 @@ Load the u-boot.img binary via USB: $ sudo ./imx_usb u-boot.img -Then U-Boot should start and its messages will appear in the console program. +Then U-Boot starts and its messages appear in the console program. Use the default environment variables: @@ -49,7 +50,8 @@ Use the default environment variables: 2. Flashing U-Boot into the eMMC -Run the DFU command: +Run the DFU agent so we can flash the new images using dfu-util tool: + => dfu 0 mmc 0 Flash SPL and u-boot.img into the eMMC running the following commands on a PC: @@ -58,14 +60,8 @@ $ sudo dfu-util -D SPL -a spl $ sudo dfu-util -D u-boot.img -a u-boot -Then on the U-Boot prompt the following message should be seen after a -successful upgrade: - -#DOWNLOAD ... OK -Ctrl+C to exit ... - Remove power from the pico board. -Put pico board into normal boot mode +Put pico board into normal boot mode. Power up the board and the new updated U-Boot should boot from eMMC. From 6dcd8918bb70865ac9826d2f4e2c9612f7b43c4f Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:18 -0300 Subject: [PATCH 11/26] pico-imx6ul: Add new pico-hobbit config The new config skips the boot menu which asks which board is in use. This is useful to allow direct booting of image without user iteration. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/MAINTAINERS | 5 +++ configs/pico-hobbit-imx6ul_defconfig | 53 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 configs/pico-hobbit-imx6ul_defconfig diff --git a/board/technexion/pico-imx6ul/MAINTAINERS b/board/technexion/pico-imx6ul/MAINTAINERS index 594a883d15..334847cf71 100644 --- a/board/technexion/pico-imx6ul/MAINTAINERS +++ b/board/technexion/pico-imx6ul/MAINTAINERS @@ -5,3 +5,8 @@ S: Maintained F: board/technexion/pico-imx6ul/ F: include/configs/pico-imx6ul.h F: configs/pico-imx6ul_defconfig + +Technexion PICO-HOBBIT-IMX6UL +M: Otavio Salvador +S: Maintained +F: configs/pico-hobbit-imx6ul_defconfig diff --git a/configs/pico-hobbit-imx6ul_defconfig b/configs/pico-hobbit-imx6ul_defconfig new file mode 100644 index 0000000000..362c0a251d --- /dev/null +++ b/configs/pico-hobbit-imx6ul_defconfig @@ -0,0 +1,53 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX6=y +CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_PICO_IMX6UL=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTDELAY=3 +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-hobbit.dtb" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y +CONFIG_CMD_BOOTMENU=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_DFU=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_SIZE=0x10000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FSL_ESDHC=y +CONFIG_PHYLIB=y +CONFIG_PHY_MICREL=y +CONFIG_MII=y +CONFIG_USB=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_OF_LIBFDT=y From ba5fd0af0fb04dda4ca25f2af29dbafc8d884727 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Tue, 4 Sep 2018 10:23:19 -0300 Subject: [PATCH 12/26] pico-imx6ul: Remove CONFIG_FSL_USDHC from .h The CONFIG_FSL_USDHC is defined inside "mx6_common.h", which is already included in this file. Signed-off-by: Otavio Salvador Reviewed-by: Fabio Estevam --- include/configs/pico-imx6ul.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 535f0b26df..ead242d2ff 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -28,7 +28,6 @@ #define CONFIG_MXC_UART_BASE UART6_BASE_ADDR /* MMC Configs */ -#define CONFIG_FSL_USDHC #define CONFIG_SYS_FSL_ESDHC_ADDR USDHC1_BASE_ADDR #define CONFIG_SUPPORT_EMMC_BOOT From df158705a8bf6ce5b6095a82fbf512302597687a Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Wed, 29 Aug 2018 08:33:36 +0200 Subject: [PATCH 13/26] imx: imx6ull: fix pinmux input_val for uart5 rx pin just try to bring up an imx6ull board with console on uart5 and found, that input_val for pin MX6UL_PAD_UART5_RX_DATA__UART5_DCE_RX is 7 and not 5 on imx6ull. With this patch rx works now. Signed-off-by: Heiko Schocher --- arch/arm/include/asm/arch-mx6/mx6ull_pins.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-mx6/mx6ull_pins.h b/arch/arm/include/asm/arch-mx6/mx6ull_pins.h index 64cbb0e247..de4a1abc27 100644 --- a/arch/arm/include/asm/arch-mx6/mx6ull_pins.h +++ b/arch/arm/include/asm/arch-mx6/mx6ull_pins.h @@ -332,7 +332,7 @@ enum { MX6_PAD_UART5_TX_DATA__CSI_DATA14 = IOMUX_PAD(0x0348, 0x00BC, 3, 0x04FC, 0, 0), MX6_PAD_UART5_TX_DATA__CSU_CSU_ALARM_AUT00 = IOMUX_PAD(0x0348, 0x00BC, 4, 0x0000, 0, 0), - MX6_PAD_UART5_RX_DATA__UART5_DCE_RX = IOMUX_PAD(0x034C, 0x00C0, 0, 0x0644, 5, 0), + MX6_PAD_UART5_RX_DATA__UART5_DCE_RX = IOMUX_PAD(0x034C, 0x00C0, 0, 0x0644, 7, 0), MX6_PAD_UART5_RX_DATA__UART5_DTE_TX = IOMUX_PAD(0x034C, 0x00C0, 0, 0x0000, 0, 0), MX6_PAD_UART5_RX_DATA__ENET2_COL = IOMUX_PAD(0x034C, 0x00C0, 1, 0x0000, 0, 0), From 21c22db014a7c5d9c182a6da15f365b4d4f26774 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Fri, 31 Aug 2018 13:58:25 +0200 Subject: [PATCH 14/26] ARM: bootscript: Remove hard-coded rootpath from K+P's tpcboot.cmd The 'rootpath' can be provided by DHCP server. Removing this line prevents from overwriting it. To do that on the DHCP server side (isc-dhcp-server) modify dhcpd.conf and add 'option root-path "192.168.X.Y:/srv/tftp/rootfs";' Signed-off-by: Lukasz Majewski --- board/k+p/bootscripts/tpcboot.cmd | 1 - 1 file changed, 1 deletion(-) diff --git a/board/k+p/bootscripts/tpcboot.cmd b/board/k+p/bootscripts/tpcboot.cmd index 16b93ebe3f..9290317730 100644 --- a/board/k+p/bootscripts/tpcboot.cmd +++ b/board/k+p/bootscripts/tpcboot.cmd @@ -65,7 +65,6 @@ fi" # # Provide 'boot_nfs' command #------------------------------------------------------------ -setenv rootpath "/srv/tftp/KP/rootfs" setenv nfsargs "setenv bootargs root=/dev/nfs rw \ nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" setenv addip "setenv bootargs ${bootargs} \ From 2d558da0d73af7329592a072bfe2c912af413f74 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Fri, 31 Aug 2018 13:58:26 +0200 Subject: [PATCH 15/26] ARM: bootscript: Replace tftpboot with dhcp when downloading kernel The 'dhcp' command is more versatile as it allows working with the DHCP server to obtain serverip, ipaddress and other network parameters. The configuration necessary to obtain the serverip (dhcpd.conf): option option-150 code 150 = ip-address; and in the subnet definition: option option-150 192.168.X.Y; Signed-off-by: Lukasz Majewski --- board/k+p/bootscripts/tpcboot.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/k+p/bootscripts/tpcboot.cmd b/board/k+p/bootscripts/tpcboot.cmd index 9290317730..ebd2d4ec2a 100644 --- a/board/k+p/bootscripts/tpcboot.cmd +++ b/board/k+p/bootscripts/tpcboot.cmd @@ -52,7 +52,7 @@ fi;" # # Provide 'boot_tftp_kernel' command #------------------------------------------------------------ -setenv download_kernel "tftpboot ${loadaddr} ${kernel_file}" +setenv download_kernel "dhcp ${loadaddr} ${kernel_file}" setenv boot_tftp_kernel " if run download_kernel; then From 7e6bba20f5d80b07574d317c4b62d89bd36c400f Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Fri, 31 Aug 2018 13:58:27 +0200 Subject: [PATCH 16/26] ARM: bootscript: Fix the nfsargs and addip in K+P's tpcboot.cmd The quotes around ${bootargs} were missing as we elaborate those variables twice - once when we "setenv" the command and secondly when we "run" it. Without quotes we have just empty string in the second call. Moreover there is an issue with line breaks - as the original commands got truncated. Signed-off-by: Lukasz Majewski --- board/k+p/bootscripts/tpcboot.cmd | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/board/k+p/bootscripts/tpcboot.cmd b/board/k+p/bootscripts/tpcboot.cmd index ebd2d4ec2a..e26fd72825 100644 --- a/board/k+p/bootscripts/tpcboot.cmd +++ b/board/k+p/bootscripts/tpcboot.cmd @@ -65,17 +65,14 @@ fi" # # Provide 'boot_nfs' command #------------------------------------------------------------ -setenv nfsargs "setenv bootargs root=/dev/nfs rw \ - nfsroot=${serverip}:${rootpath},nolock,nfsvers=3" -setenv addip "setenv bootargs ${bootargs} \ - ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:\ - ${hostname}:eth0:on" +setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${serverip}':'${rootpath}',nolock,nfsvers=3" +setenv addip "setenv bootargs '${bootargs}' ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on" setenv boot_nfs " if run download_kernel; then run nfsargs; run addip; - setenv bootargs ${bootargs} console=${console}; + setenv bootargs '${bootargs}' console=${console}; run boot_fitImage; fi" From 97657a8cb444015ac57cc057879fc0cc6be18ab8 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Fri, 31 Aug 2018 13:58:28 +0200 Subject: [PATCH 17/26] ARM: bootscript: For nfsargs only use rootpath (and remove not needed serverip) The serverip part is provided from DHCP server with 'option root-path "192.168.3.1:/srv/tftp/rootfs";' parameter in dhcpd.conf Signed-off-by: Lukasz Majewski --- board/k+p/bootscripts/tpcboot.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/k+p/bootscripts/tpcboot.cmd b/board/k+p/bootscripts/tpcboot.cmd index e26fd72825..0576e81140 100644 --- a/board/k+p/bootscripts/tpcboot.cmd +++ b/board/k+p/bootscripts/tpcboot.cmd @@ -65,7 +65,7 @@ fi" # # Provide 'boot_nfs' command #------------------------------------------------------------ -setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${serverip}':'${rootpath}',nolock,nfsvers=3" +setenv nfsargs "setenv bootargs root=/dev/nfs rw nfsroot='${rootpath}',nolock,nfsvers=3" setenv addip "setenv bootargs '${bootargs}' ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on" setenv boot_nfs " From 1b5f4dc9e618763b0729bdb9a91aaeecf9499eeb Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Fri, 31 Aug 2018 10:01:45 -0300 Subject: [PATCH 18/26] wandboard: README: Include the mx6qp variant in the list The mx6qp Wandboard variant is also supported, so add it to the list. Signed-off-by: Fabio Estevam --- board/wandboard/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/wandboard/README b/board/wandboard/README index 6345416b2f..e5170bcc81 100644 --- a/board/wandboard/README +++ b/board/wandboard/README @@ -4,7 +4,7 @@ U-Boot for Wandboard This file contains information for the port of U-Boot to the Wandboard. Wandboard is a development board that has three variants based on the following -SoCs: mx6 quad, mx6 dual lite and mx6 solo. +SoCs: mx6 quad, mx6 quad plus, mx6 dual lite and mx6 solo. For more details about Wandboard, please refer to: http://www.wandboard.org/ From 9ddd1cd596b5d825a53265c267d9322f2af0f4d1 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Thu, 13 Sep 2018 16:57:05 -0300 Subject: [PATCH 19/26] pico-imx6ul: Add Falcon mode support Falcon mode boots the kernel directly from SPL, without loading the full U-Boot. As pico-imx6ul does not have a GPIO for selecting Falcon versus normal mode, enter in Falcon mode when the customer selects the CONFIG_SPL_OS_BOOT option in menuconfig. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/spl.c | 8 ++++++++ configs/pico-imx6ul_defconfig | 2 ++ include/configs/pico-imx6ul.h | 12 ++++++++++++ 3 files changed, 22 insertions(+) diff --git a/board/technexion/pico-imx6ul/spl.c b/board/technexion/pico-imx6ul/spl.c index 1819722024..6464a32d3b 100644 --- a/board/technexion/pico-imx6ul/spl.c +++ b/board/technexion/pico-imx6ul/spl.c @@ -14,6 +14,14 @@ #include #if defined(CONFIG_SPL_BUILD) + +#ifdef CONFIG_SPL_OS_BOOT +int spl_start_uboot(void) +{ + return 0; +} +#endif + #include static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = { diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig index 3d4063b136..c8d58cbe71 100644 --- a/configs/pico-imx6ul_defconfig +++ b/configs/pico-imx6ul_defconfig @@ -21,6 +21,8 @@ CONFIG_SPL_USB_HOST_SUPPORT=y CONFIG_SPL_USB_GADGET_SUPPORT=y CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_CMD_BOOTMENU=y +CONFIG_CMD_SPL=y +CONFIG_CMD_SPL_WRITE_SIZE=0x20000 CONFIG_CMD_MEMTEST=y CONFIG_CMD_DFU=y # CONFIG_CMD_FLASH is not set diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index ead242d2ff..8c657c13ac 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -14,6 +14,18 @@ #include #include "imx6_spl.h" +#ifdef CONFIG_SPL_OS_BOOT +/* Falcon Mode */ +#define CONFIG_SPL_FS_LOAD_ARGS_NAME "args" +#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" +#define CONFIG_SYS_SPL_ARGS_ADDR 0x88000000 + +/* Falcon Mode - MMC support: args@1MB kernel@2MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ +#endif + /* Network support */ #define CONFIG_FEC_MXC From d27748b7cb3b7f447ef7d7d7c6cfe91852cd14e6 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 13 Sep 2018 16:57:06 -0300 Subject: [PATCH 20/26] pico-imx6ul: Add instructions for booting in Falcon mode Falcon mode allows the SPL to load and jump directly to the kernel, without loading U-Boot proper. Add detailed step by step on how to use Falcon mode on pico-imx6ul. Signed-off-by: Fabio Estevam Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/README | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/board/technexion/pico-imx6ul/README b/board/technexion/pico-imx6ul/README index 66dc977d49..1cabd90759 100644 --- a/board/technexion/pico-imx6ul/README +++ b/board/technexion/pico-imx6ul/README @@ -65,3 +65,95 @@ Remove power from the pico board. Put pico board into normal boot mode. Power up the board and the new updated U-Boot should boot from eMMC. + +Booting in Falcon mode +====================== + +Generate a uImage kernel: + +$ make imx_v6_v7_defconfig (Using the default imx_v6_v7_defconfig configuration +just for an example. In order to boot faster the user should customize the +defconfig by only enabling the minimal required drivers). + +$ make -j4 uImage LOADADDR=0x80800000 + +$ cp arch/arm/boot/uImage /tftpboot +$ cp arch/arm/boot/dts/imx6ul-pico-hobbit.dtb /tftpboot + +In the U-Boot prompt: + +Setup the server and board IP addresses: +=> setenv serverip 192.168.0.10 +=> setenv ipaddr 192.168.0.11 + +Get the dtb file: +=> tftp ${fdt_addr} imx6ul-pico-hobbit.dtb + +Get the kernel: +=> tftp ${loadaddr} uImage + +Write the kernel at 2MB offset: +=> mmc write ${loadaddr} 0x1000 0x4000 + +Setup the bootargs: +=> setenv bootargs 'console=ttymxc5,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait rw' + +Prepare args: +=> spl export fdt ${loadaddr} - ${fdt_addr} +## Booting kernel from Legacy Image at 82000000 ... + Image Name: Linux-4.19.0-rc2-next-20180905-0 + Image Type: ARM Linux Kernel Image (uncompressed) + Data Size: 8365608 Bytes = 8 MiB + Load Address: 80800000 + Entry Point: 80800000 + Verifying Checksum ... OK +## Flattened Device Tree blob at 83000000 + Booting using the fdt blob at 0x83000000 + Loading Kernel Image ... OK + Using Device Tree in place at 83000000, end 83009c63 +subcommand not supported +subcommand not supported + Using Device Tree in place at 83000000, end 8300cc63 +Argument image is now in RAM: 0x83000000 + +Write 1MB of args data (0x800 sectors) to 1MB offset (0x800 sectors): + +=> mmc write ${fdt_addr} 0x800 0x800 + +In order to boot with Falcon mode, activate the CONFIG_SPL_OS_BOOT +option in the defconfig + +--- a/configs/pico-hobbit-imx6ul_defconfig ++++ b/configs/pico-hobbit-imx6ul_defconfig +@@ -53,3 +53,4 @@ CONFIG_USB_GADGET_VENDOR_NUM=0x0525 + CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 + CONFIG_CI_UDC=y + CONFIG_OF_LIBFDT=y ++CONFIG_SPL_OS_BOOT=y + +Then rebuild U-Boot: + +$ make pico-hobbit-imx6ul_defconfig +$ make -j4 + +Launch UMS: +=> ums 0 mmc 0 + +Flash the new binaries: + +$ sudo dd if=SPL of=/dev/sdX bs=1k seek=1; sync +$ sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=69; sync + +And then SPL binary will load and jump directly to the kernel: + +U-Boot SPL 2018.09-rc2-00156-g8c46f15-dirty (Sep 05 2018 - 16:24:05 -0300) +Trying to boot from MMC1 +[ 0.000000] Booting Linux on physical CPU 0x0 +[ 0.000000] Linux version 4.19.0-rc2-next-20180905-00001-gb805e2d (fabio@fabio-Latitude-E5450) (gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)) #533 SMP Wed Sep 5 16:21:03 -03 2018 +[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d +[ 0.000000] CPU: div instructions available: patching division code +[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache +[ 0.000000] OF: fdt: Machine model: Technexion Pico i.MX6UL Board +[ 0.000000] Memory policy: Data cache writealloc +[ 0.000000] cma: Reserved 64 MiB at 0x8c000000 +... From 8854cf259129c8dbb9c5b0f4ec767a7d68ad5901 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:31 -0300 Subject: [PATCH 21/26] pico-imx6ul: Fix TechNexion spelling on MAINTAINERS file Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/technexion/pico-imx6ul/MAINTAINERS b/board/technexion/pico-imx6ul/MAINTAINERS index 334847cf71..fec5868015 100644 --- a/board/technexion/pico-imx6ul/MAINTAINERS +++ b/board/technexion/pico-imx6ul/MAINTAINERS @@ -1,4 +1,4 @@ -Technexion PICO-IMX6UL board +TechNexion PICO-IMX6UL board M: Richard Hu M: Fabio Estevam S: Maintained @@ -6,7 +6,7 @@ F: board/technexion/pico-imx6ul/ F: include/configs/pico-imx6ul.h F: configs/pico-imx6ul_defconfig -Technexion PICO-HOBBIT-IMX6UL +TechNexion PICO-HOBBIT-IMX6UL M: Otavio Salvador S: Maintained F: configs/pico-hobbit-imx6ul_defconfig From 3a8932b6f67e055111472b4ec7d1f3d56ddc5664 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:32 -0300 Subject: [PATCH 22/26] pico-imx6ul: Add PICO-Pi baseboard support This adds the device tree to the DFU and bootmenu environment setting. Signed-off-by: Otavio Salvador --- include/configs/pico-imx6ul.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h index 8c657c13ac..3d93205535 100644 --- a/include/configs/pico-imx6ul.h +++ b/include/configs/pico-imx6ul.h @@ -60,11 +60,14 @@ "u-boot raw 0x8a 0x400 mmcpart 1;" \ "/boot/zImage ext4 0 1;" \ "/boot/imx6ul-pico-hobbit.dtb ext4 0 1;" \ + "/boot/imx6ul-pico-pi.dtb ext4 0 1;" \ "rootfs part 0 1\0" \ #define BOOTMENU_ENV \ "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ "setenv fdtfile imx6ul-pico-hobbit.dtb\0" \ + "bootmenu_1=Boot using PICO-Pi baseboard=" \ + "setenv fdtfile imx6ul-pico-pi.dtb\0" \ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 From f4e5516bc1ca9f9fd1543b86af11ce0a06c130b3 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:33 -0300 Subject: [PATCH 23/26] pico-imx6ul: Add a new defconfig with PICO-Pi selected This adds a new defconfig which pre-selects the PICO-Pi baseboard allowing a completely non-interactive boot process. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx6ul/MAINTAINERS | 5 +++ configs/pico-pi-imx6ul_defconfig | 53 ++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 configs/pico-pi-imx6ul_defconfig diff --git a/board/technexion/pico-imx6ul/MAINTAINERS b/board/technexion/pico-imx6ul/MAINTAINERS index fec5868015..b8f3d24a53 100644 --- a/board/technexion/pico-imx6ul/MAINTAINERS +++ b/board/technexion/pico-imx6ul/MAINTAINERS @@ -10,3 +10,8 @@ TechNexion PICO-HOBBIT-IMX6UL M: Otavio Salvador S: Maintained F: configs/pico-hobbit-imx6ul_defconfig + +TechNexion PICO-PI-IMX6UL +M: Otavio Salvador +S: Maintained +F: configs/pico-pi-imx6ul_defconfig diff --git a/configs/pico-pi-imx6ul_defconfig b/configs/pico-pi-imx6ul_defconfig new file mode 100644 index 0000000000..680438d265 --- /dev/null +++ b/configs/pico-pi-imx6ul_defconfig @@ -0,0 +1,53 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX6=y +CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_PICO_IMX6UL=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTDELAY=3 +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-pi.dtb" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y +CONFIG_CMD_BOOTMENU=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_DFU=y +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_ENV_IS_IN_MMC=y +CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_SIZE=0x10000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FSL_ESDHC=y +CONFIG_PHYLIB=y +CONFIG_PHY_MICREL=y +CONFIG_MII=y +CONFIG_USB=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_OF_LIBFDT=y From f40d0e8b259f2b59778c0128fae70f4f16d8377b Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:34 -0300 Subject: [PATCH 24/26] pico-imx7d: Fix TechNexion spelling on MAINTAINERS file Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/board/technexion/pico-imx7d/MAINTAINERS b/board/technexion/pico-imx7d/MAINTAINERS index 0755bd8366..1505c4da9a 100644 --- a/board/technexion/pico-imx7d/MAINTAINERS +++ b/board/technexion/pico-imx7d/MAINTAINERS @@ -1,11 +1,11 @@ -Technexion PICO-IMX7D board +TechNexion PICO-IMX7D board M: Vanessa Maegima S: Maintained F: board/technexion/pico-imx7d/ F: include/configs/pico-imx7d.h F: configs/pico-imx7d_defconfig -Technexion PICO-PI-IMX7 +TechNexion PICO-PI-IMX7 M: Otavio Salvador S: Maintained F: configs/pico-pi-imx7d_defconfig From 130f03a7af9ee7cfeb6d515faf5841226410a623 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:35 -0300 Subject: [PATCH 25/26] pico-imx7d: Add PICO-Hobbit baseboard support This adds the device tree to the DFU and bootmenu environment setting. Signed-off-by: Otavio Salvador --- include/configs/pico-imx7d.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h index 4cc84ff5d4..0e770bf41f 100644 --- a/include/configs/pico-imx7d.h +++ b/include/configs/pico-imx7d.h @@ -48,11 +48,14 @@ "spl raw 0x2 0x400 mmcpart 1;" \ "u-boot raw 0x8a 0x400 mmcpart 1;" \ "/boot/zImage ext4 0 1;" \ + "/boot/imx7d-pico-hobbit.dtb ext4 0 1;" \ "/boot/imx7d-pico-pi.dtb ext4 0 1;" \ "rootfs part 0 1\0" \ #define BOOTMENU_ENV \ - "bootmenu_0=Boot using PICO-PI baseboard=" \ + "bootmenu_0=Boot using PICO-Hobbit baseboard=" \ + "setenv fdtfile imx7d-pico-hobbit.dtb\0" \ + "bootmenu_1=Boot using PICO-Pi baseboard=" \ "setenv fdtfile imx7d-pico-pi.dtb\0" \ #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */ From f7df8932ccaec97c8c422de8adadb3a0491543ed Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Fri, 14 Sep 2018 15:53:36 -0300 Subject: [PATCH 26/26] pico-imx7d: Add a new defconfig with PICO-Hobbit selected This adds a new defconfig which pre-selects the PICO-Hobbit baseboard allowing a completely non-interactive boot process. Signed-off-by: Otavio Salvador --- board/technexion/pico-imx7d/MAINTAINERS | 5 ++ configs/pico-hobbit-imx7d_defconfig | 61 +++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 configs/pico-hobbit-imx7d_defconfig diff --git a/board/technexion/pico-imx7d/MAINTAINERS b/board/technexion/pico-imx7d/MAINTAINERS index 1505c4da9a..f9a1dfc05e 100644 --- a/board/technexion/pico-imx7d/MAINTAINERS +++ b/board/technexion/pico-imx7d/MAINTAINERS @@ -5,6 +5,11 @@ F: board/technexion/pico-imx7d/ F: include/configs/pico-imx7d.h F: configs/pico-imx7d_defconfig +TechNexion PICO-HOBBIT-IMX7 +M: Otavio Salvador +S: Maintained +F: configs/pico-hobbit-imx7d_defconfig + TechNexion PICO-PI-IMX7 M: Otavio Salvador S: Maintained diff --git a/configs/pico-hobbit-imx7d_defconfig b/configs/pico-hobbit-imx7d_defconfig new file mode 100644 index 0000000000..568fb11d59 --- /dev/null +++ b/configs/pico-hobbit-imx7d_defconfig @@ -0,0 +1,61 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX7=y +CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_TARGET_PICO_IMX7D=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y +CONFIG_ARMV7_BOOT_SEC_DEFAULT=y +CONFIG_IMX_RDC=y +CONFIG_IMX_BOOTAUX=y +CONFIG_DISTRO_DEFAULTS=y +CONFIG_NR_DRAM_BANKS=1 +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd" +CONFIG_DEFAULT_FDT_FILE="imx7d-pico-hobbit.dtb" +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_USB_HOST_SUPPORT=y +CONFIG_SPL_USB_GADGET_SUPPORT=y +CONFIG_SPL_USB_SDP_SUPPORT=y +# CONFIG_CMD_BOOTD is not set +CONFIG_CMD_BOOTMENU=y +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_XIMG is not set +CONFIG_CMD_SPL=y +CONFIG_CMD_SPL_WRITE_SIZE=0x20000 +CONFIG_CMD_DFU=y +CONFIG_CMD_GPIO=y +CONFIG_CMD_GPT=y +CONFIG_CMD_I2C=y +CONFIG_CMD_MMC=y +CONFIG_CMD_USB=y +CONFIG_CMD_USB_SDP=y +CONFIG_CMD_USB_MASS_STORAGE=y +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_MII is not set +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT4_WRITE=y +CONFIG_DFU_MMC=y +CONFIG_USB_FUNCTION_FASTBOOT=y +CONFIG_FASTBOOT_BUF_ADDR=0x82000000 +CONFIG_FASTBOOT_BUF_SIZE=0x10000000 +CONFIG_FASTBOOT_FLASH=y +CONFIG_FASTBOOT_FLASH_MMC_DEV=0 +CONFIG_FASTBOOT_CMD_OEM_FORMAT=y +CONFIG_FSL_ESDHC=y +CONFIG_PHYLIB=y +CONFIG_MII=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y +CONFIG_MXC_USB_OTG_HACTIVE=y +CONFIG_USB_STORAGE=y +CONFIG_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_CI_UDC=y +CONFIG_OF_LIBFDT=y