diff options
97 files changed, 979 insertions, 325 deletions
diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst index 98628faf9d..f26299efd9 100644 --- a/Documentation/user/booting-linux.rst +++ b/Documentation/user/booting-linux.rst @@ -99,6 +99,20 @@ with addpart to the Kernel: Kernel command line: mtdparts=physmap-flash.0:512k(bootloader),512k(env),4M(kernel),-(root); mxc_nand:1M(bootloader),1M(env),4M(kernel),-(root) +Creating root= options for the Kernel +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It's a common case that the Linux Kernel is loaded from a filesystem +that later becomes the root filesystem for the Kernel. For several +filesystems barebox can automatically append a suitable root= option +to the Kernel command line. This is done when ``global.bootm.appendroot`` +is true. How the root= option is appended depends on the device type +and filesystem the kernel is booted from. For disk like devices (SD/MMC, +ATA) the partition UUID will be used, the root= option will be something +like ``root=PARTUUID=deadbeef-1``. For UBIFS fileystems it will be +``root=ubi0:volname ubi.mtd=mtdpartname rootfstype=ubifs``. NFS +filesystems will result in ``root=/dev/nfs nfsroot=ip:/path/to/nfsroot,v3,tcp``. +The ``v3,tcp`` part is configurable in ``global.linux.rootnfsopts``. The boot command ---------------- @@ -1,5 +1,5 @@ VERSION = 2016 -PATCHLEVEL = 04 +PATCHLEVEL = 05 SUBLEVEL = 0 EXTRAVERSION = NAME = None diff --git a/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg index 6f1cab60c7..68d947c01d 100644 --- a/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg +++ b/arch/arm/boards/ccxmx53/flash-header-imx53-ccxmx53_1gib.imxcfg @@ -31,7 +31,7 @@ wm 32 0x63fd90f8 0x00000800 wm 32 0x63fd907c 0x020c0211 wm 32 0x63fd9080 0x014c0155 wm 32 0x63fd9018 0x000016d0 -wm 32 0x63fd9000 0xc4110000 +wm 32 0x63fd9000 0xc3110000 wm 32 0x63fd900c 0x4d5122d2 wm 32 0x63fd9010 0x92d18a22 wm 32 0x63fd9014 0x00c70092 diff --git a/arch/arm/boards/ccxmx53/lowlevel.c b/arch/arm/boards/ccxmx53/lowlevel.c index b321811e95..55f6f366ac 100644 --- a/arch/arm/boards/ccxmx53/lowlevel.c +++ b/arch/arm/boards/ccxmx53/lowlevel.c @@ -13,7 +13,10 @@ * */ +#include <debug_ll.h> #include <common.h> +#include <linux/sizes.h> +#include <io.h> #include <mach/esdctl.h> #include <mach/generic.h> #include <image-metadata.h> @@ -26,28 +29,32 @@ BAREBOX_IMD_TAG_STRING(ccxmx53_memsize_SZ_512M, IMD_TYPE_PARAMETER, "memsize=512", 0); BAREBOX_IMD_TAG_STRING(ccxmx53_memsize_SZ_1G, IMD_TYPE_PARAMETER, "memsize=1024", 0); -static void __noreturn start_imx53_ccxmx53_common(uint32_t size, - void *fdt_blob_fixed_offset) +extern char __dtb_imx53_ccxmx53_start[]; + +ENTRY_FUNCTION(start_ccxmx53_512mb, r0, r1, r2) { void *fdt; imx5_cpu_lowlevel_init(); arm_setup_stack(0xf8020000 - 8); - fdt = fdt_blob_fixed_offset - get_runtime_offset(); - barebox_arm_entry(0x70000000, size, fdt); + IMD_USED(ccxmx53_memsize_SZ_512M); + + fdt = __dtb_imx53_ccxmx53_start - get_runtime_offset(); + + imx53_barebox_entry(fdt); } -#define CCMX53_ENTRY(name, fdt_name, memory_size) \ - ENTRY_FUNCTION(name, r0, r1, r2) \ - { \ - extern char __dtb_##fdt_name##_start[]; \ - \ - IMD_USED(ccxmx53_memsize_##memory_size); \ - \ - start_imx53_ccxmx53_common(memory_size, \ - __dtb_##fdt_name##_start); \ - } - -CCMX53_ENTRY(start_ccxmx53_512mb, imx53_ccxmx53, SZ_512M); -CCMX53_ENTRY(start_ccxmx53_1gib, imx53_ccxmx53, SZ_1G); +ENTRY_FUNCTION(start_ccxmx53_1gib, r0, r1, r2) +{ + void *fdt; + + imx5_cpu_lowlevel_init(); + arm_setup_stack(0xf8020000 - 8); + + IMD_USED(ccxmx53_memsize_SZ_1G); + + fdt = __dtb_imx53_ccxmx53_start - get_runtime_offset(); + + imx53_barebox_entry(fdt); +} diff --git a/arch/arm/boards/guf-vincell/board.c b/arch/arm/boards/guf-vincell/board.c index ad47ee2558..43c195254e 100644 --- a/arch/arm/boards/guf-vincell/board.c +++ b/arch/arm/boards/guf-vincell/board.c @@ -40,7 +40,8 @@ static void vincell_fec_reset(void) static int vincell_devices_init(void) { - if (!of_machine_is_compatible("guf,imx53-vincell")) + if (!of_machine_is_compatible("guf,imx53-vincell") && + !of_machine_is_compatible("guf,imx53-vincell-lt")) return 0; writel(0, MX53_M4IF_BASE_ADDR + 0xc); diff --git a/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg b/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg new file mode 100644 index 0000000000..455aab92ca --- /dev/null +++ b/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg @@ -0,0 +1,183 @@ +soc imx6 +loadaddr 0x20000000 +dcdofs 0x400 + +wm 32 0x020e00a4 0x00000016 +wm 32 0x020e00c4 0x00000011 +wm 32 0x020e03b8 0x0000f079 +wm 32 0x020e03d8 0x0000f079 +wm 32 0x020e0898 0x00000000 +wm 32 0x020e089c 0x00000000 +wm 32 0x020e0248 0x00000012 +wm 32 0x020e02c8 0x00000015 +wm 32 0x020e06b0 0x000030b0 +wm 32 0x020e00a0 0x00000015 +wm 32 0x020e03b4 0x000030b0 +wm 32 0x020e024c 0x00000005 +wm 32 0x020e061c 0x000030b0 +wm 32 0x020c402c 0x006336c1 +wm 32 0x020c4034 0x00012093 +wm 32 0x020c4038 0x00012090 +wm 32 0x020c80e0 0x00002001 +set_bits 32 0x020c4068 0x00000030 +set_bits 32 0x020c406c 0x00000c00 +set_bits 32 0x020c4070 0x000000c0 +set_bits 32 0x020c4078 0xff000000 +set_bits 32 0x020c407c 0x0f000000 +set_bits 32 0x020c4080 0x000003fc +wm 32 0x020c80a0 0x00082029 +wm 32 0x020c80b0 0x0007a120 +wm 32 0x020c80c0 0x000f4240 +wm 32 0x020e0004 0x48640005 +wm 32 0x020e0010 0xf00000cf +wm 32 0x020e0018 0x77177717 +wm 32 0x020e001c 0x77177717 +wm 32 0x020e02a8 0x00000001 +wm 32 0x020e02ac 0x00000001 +wm 32 0x020e0920 0x00000003 +wm 32 0x020e02c0 0x00000001 +wm 32 0x020e02c4 0x00000001 +wm 32 0x020e091c 0x00000003 +wm 32 0x020e02ec 0x00000000 +wm 32 0x020e05ac 0x00020030 +wm 32 0x020e05b4 0x00020030 +wm 32 0x020e0528 0x00020030 +wm 32 0x020e0520 0x00020030 +wm 32 0x020e0514 0x00020030 +wm 32 0x020e0510 0x00020030 +wm 32 0x020e05bc 0x00020030 +wm 32 0x020e05c4 0x00020030 +wm 32 0x020e052c 0x00020200 +wm 32 0x020e0530 0x00020200 +wm 32 0x020e0534 0x00020200 +wm 32 0x020e0538 0x00020200 +wm 32 0x020e053c 0x00020200 +wm 32 0x020e0540 0x00020200 +wm 32 0x020e0544 0x00020200 +wm 32 0x020e0548 0x00020200 +wm 32 0x020e054c 0x00020200 +wm 32 0x020e0550 0x00020200 +wm 32 0x020e0554 0x00020200 +wm 32 0x020e0558 0x00020200 +wm 32 0x020e055c 0x00020200 +wm 32 0x020e0560 0x00020200 +wm 32 0x020e0564 0x00020200 +wm 32 0x020e0568 0x00020200 +wm 32 0x020e056c 0x00020030 +wm 32 0x020e0578 0x00020030 +wm 32 0x020e0588 0x00020030 +wm 32 0x020e0594 0x00020030 +wm 32 0x020e057c 0x00020030 +wm 32 0x020e0590 0x00003000 +wm 32 0x020e0598 0x00003000 +wm 32 0x020e0580 0x00000000 +wm 32 0x020e0584 0x00000000 +wm 32 0x020e058c 0x00000000 +wm 32 0x020e059c 0x00003030 +wm 32 0x020e05a0 0x00003030 +wm 32 0x020e0784 0x00000030 +wm 32 0x020e0788 0x00000030 +wm 32 0x020e0794 0x00000030 +wm 32 0x020e079c 0x00000030 +wm 32 0x020e07a0 0x00000030 +wm 32 0x020e07a4 0x00000030 +wm 32 0x020e07a8 0x00000030 +wm 32 0x020e0748 0x00000030 +wm 32 0x020e074c 0x00000030 +wm 32 0x020e0750 0x00020000 +wm 32 0x020e0758 0x00000000 +wm 32 0x020e0774 0x00020000 +wm 32 0x020e078c 0x00000030 +wm 32 0x020e0798 0x000c0000 +wm 32 0x020e0768 0x00002000 +wm 32 0x020e0770 0x00000000 +wm 32 0x020e0754 0x00000200 +wm 32 0x020e075c 0x00000200 +wm 32 0x020e0760 0x00000200 +wm 32 0x020e0764 0x00000200 +wm 32 0x020e076c 0x00000200 +wm 32 0x020e0778 0x00000200 +wm 32 0x020e077c 0x00000200 +wm 32 0x020e0780 0x00000200 +wm 32 0x021b001c 0x04008010 +wm 32 0x021b001c 0x04008040 +wm 32 0x021b0800 0xa1390001 +wm 32 0x021b080c 0x001e001e +wm 32 0x021b0810 0x001e001e +wm 32 0x021b480c 0x001e001e +wm 32 0x021b4810 0x001e001e +wm 32 0x021b083c 0x43430349 +wm 32 0x021b0840 0x03330334 +wm 32 0x021b483c 0x434b0351 +wm 32 0x021b4840 0x033d030e +wm 32 0x021b0848 0x40404040 +wm 32 0x021b0850 0x40404040 +wm 32 0x021b4848 0x40404040 +wm 32 0x021b4850 0x40404040 +wm 32 0x021b081c 0x33333333 +wm 32 0x021b0820 0x33333333 +wm 32 0x021b0824 0x33333333 +wm 32 0x021b0828 0x33333333 +wm 32 0x021b481c 0x33333333 +wm 32 0x021b4820 0x33333333 +wm 32 0x021b4824 0x33333333 +wm 32 0x021b4828 0x33333333 +wm 32 0x021b08b8 0x00000800 +wm 32 0x021b48b8 0x00000800 +wm 32 0x021b0018 0x00000742 +check 32 while_all_bits_clear 0x021b0018 0x00000002 +wm 32 0x021b001c 0x00008000 +check 32 while_any_bit_clear 0x021b001c 0x00004000 +wm 32 0x021b0000 0x841a0000 +check 32 while_any_bit_clear 0x021b0018 0x40000000 +wm 32 0x021b000c 0x898f78f4 +wm 32 0x021b0010 0xff328e64 +wm 32 0x021b0014 0x01ff00db +wm 32 0x021b002c 0x000026d2 +wm 32 0x021b0030 0x008f1023 +wm 32 0x021b0008 0x24444040 +wm 32 0x021b0004 0x00020076 +wm 32 0x021b0040 0x00000047 +wm 32 0x021b001c 0x09308030 +wm 32 0x021b001c 0x00048031 +wm 32 0x021b001c 0x00488032 +wm 32 0x021b001c 0x00008033 +wm 32 0x021b0020 0x0000c000 +wm 32 0x021b001c 0x00008020 +wm 32 0x021b0818 0x00022222 +wm 32 0x021b4818 0x00022222 +wm 32 0x021b0890 0x00000003 +set_bits 32 0x021b0400 0x02000000 +wm 32 0x021b0404 0x00000001 +wm 32 0x021b001c 0x04008010 +wm 32 0x021b001c 0x04008040 +wm 32 0x021b0800 0xa1390001 +check 32 while_all_bits_clear 0x021b0800 0x00010000 +wm 32 0x021b0800 0xa1380000 +wm 32 0x021b001c 0x00048033 +wm 32 0x020e05a8 0x00000030 +wm 32 0x020e05b0 0x00000030 +wm 32 0x020e0524 0x00000030 +wm 32 0x020e051c 0x00000030 +wm 32 0x020e0518 0x00000030 +wm 32 0x020e050c 0x00000030 +wm 32 0x020e05b8 0x00000030 +wm 32 0x020e05c0 0x00000030 +wm 32 0x021b001c 0x04008050 +wm 32 0x021b0860 0x00000030 +wm 32 0x021b4860 0x00000030 +check 32 while_all_bits_clear 0x021b0860 0x0000001f +check 32 while_all_bits_clear 0x021b4860 0x0000001f +wm 32 0x021b001c 0x04008050 +wm 32 0x021b0864 0x00000030 +check 32 while_all_bits_clear 0x021b0864 0x0000001f +wm 32 0x021b001c 0x04008050 +wm 32 0x021b4864 0x00000030 +check 32 while_all_bits_clear 0x021b4864 0x0000001f +wm 32 0x021b001c 0x00008033 +wm 32 0x021b0800 0xa138002b +wm 32 0x021b0020 0x00001800 +wm 32 0x021b0404 0x00001000 +wm 32 0x021b0004 0x00025576 +wm 32 0x021b001c 0x00000000 +check 32 while_all_bits_clear 0x021b001c 0x00004000 diff --git a/arch/arm/boards/karo-tx6x/lowlevel.c b/arch/arm/boards/karo-tx6x/lowlevel.c index 1aa24c5842..459c44b845 100644 --- a/arch/arm/boards/karo-tx6x/lowlevel.c +++ b/arch/arm/boards/karo-tx6x/lowlevel.c @@ -77,3 +77,23 @@ ENTRY_FUNCTION(start_imx6q_tx6x_1g, r0, r1, r2) imx6q_barebox_entry(fdt); } + +BAREBOX_IMD_TAG_STRING(tx6x_mx6_memsize_2G, IMD_TYPE_PARAMETER, "memsize=2048", 0); + +ENTRY_FUNCTION(start_imx6q_tx6x_2g, r0, r1, r2) +{ + void *fdt; + + imx6_cpu_lowlevel_init(); + + arm_setup_stack(0x00920000 - 8); + + IMD_USED(tx6x_mx6_memsize_2G); + + if (IS_ENABLED(CONFIG_DEBUG_LL)) + setup_uart(); + + fdt = __dtb_imx6q_tx6q_start - get_runtime_offset(); + + imx6q_barebox_entry(fdt); +} diff --git a/arch/arm/boards/phytec-som-am335x/lowlevel.c b/arch/arm/boards/phytec-som-am335x/lowlevel.c index 73e75eb491..33e83c5a8e 100644 --- a/arch/arm/boards/phytec-som-am335x/lowlevel.c +++ b/arch/arm/boards/phytec-som-am335x/lowlevel.c @@ -125,6 +125,7 @@ PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_sram_2x512mb, am335x_phytec_phycore PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_sram_1024mb, am335x_phytec_phycore_som_mlo, PHYCORE_IM8G16D3FBBG15EI_1024MB); PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_512mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K256M16TW107IT_512MB); PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_256mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K128M16JT_256MB); +PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_1024mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K512M16HA125IT_1024MB); PHYTEC_ENTRY(start_am33xx_phytec_phycore_sdram, am335x_phytec_phycore_som); PHYTEC_ENTRY(start_am33xx_phytec_phycore_no_spi_sdram, am335x_phytec_phycore_som_no_spi); PHYTEC_ENTRY(start_am33xx_phytec_phycore_no_eeprom_sdram, am335x_phytec_phycore_som_no_eeprom); diff --git a/arch/arm/boards/phytec-som-am335x/ram-timings.h b/arch/arm/boards/phytec-som-am335x/ram-timings.h index 884874caf7..9576d265e5 100644 --- a/arch/arm/boards/phytec-som-am335x/ram-timings.h +++ b/arch/arm/boards/phytec-som-am335x/ram-timings.h @@ -32,6 +32,7 @@ enum { PHYCORE_IM8G16D3FBBG15EI_1024MB, PHYCORE_R2_MT41K256M16TW107IT_512MB, PHYCORE_R2_MT41K128M16JT_256MB, + PHYCORE_R2_MT41K512M16HA125IT_1024MB, PHYCARD_NT5CB128M16BP_256MB, }; @@ -232,6 +233,25 @@ struct am335x_sdram_timings physom_timings[] = { .wr_slave_ratio0 = 0x73, }, }, + + /* 1024MB R2 */ + [PHYCORE_R2_MT41K512M16HA125IT_1024MB] = { + .regs = { + .emif_read_latency = 0x7, + .emif_tim1 = 0x0AAAD4DB, + .emif_tim2 = 0x268F7FDA, + .emif_tim3 = 0x501F88BF, + .sdram_config = 0x61C053B2, + .zq_config = 0x50074BE4, + .sdram_ref_ctrl = 0x00000C30, + }, + .data = { + .rd_slave_ratio0 = 0x38, + .wr_dqs_slave_ratio0 = 0x4d, + .fifo_we_slave_ratio0 = 0x9d, + .wr_slave_ratio0 = 0x82, + }, + }, }; #endif diff --git a/arch/arm/boards/phytec-som-imx6/Makefile b/arch/arm/boards/phytec-som-imx6/Makefile index c61e9cddcf..2f9c4a8a8f 100644 --- a/arch/arm/boards/phytec-som-imx6/Makefile +++ b/arch/arm/boards/phytec-som-imx6/Makefile @@ -1,4 +1,4 @@ obj-y += board.o lwl-y += lowlevel.o bbenv-y += defaultenv-physom-imx6 -bbenv-y += defaultenv-physom-imx6-mira +bbenv-y += defaultenv-physom-imx6-phycore diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c index bf8703e3a4..fe237942f8 100644 --- a/arch/arm/boards/phytec-som-imx6/board.c +++ b/arch/arm/boards/phytec-som-imx6/board.c @@ -113,7 +113,8 @@ static int physom_imx6_devices_init(void) } else if (of_machine_is_compatible("phytec,imx6q-pcm058-nand") || of_machine_is_compatible("phytec,imx6q-pcm058-emmc") - || of_machine_is_compatible("phytec,imx6dl-pcm058-nand")) { + || of_machine_is_compatible("phytec,imx6dl-pcm058-nand") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { barebox_set_hostname("phyCORE-i.MX6"); default_environment_path = "/chosen/environment-spinor"; @@ -152,15 +153,23 @@ static int physom_imx6_devices_init(void) pr_notice("Using environment in %s\n", envdev); - imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + if (of_machine_is_compatible("phytec,imx6q-pcm058-emmc") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { + imx6_bbu_internal_mmc_register_handler("mmc3", + "/dev/mmc3", + BBU_HANDLER_FLAG_DEFAULT); + } else { + imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + } defaultenv_append_directory(defaultenv_physom_imx6); /* Overwrite file /env/init/automount */ if (of_machine_is_compatible("phytec,imx6q-pcm058-nand") || of_machine_is_compatible("phytec,imx6q-pcm058-emmc") - || of_machine_is_compatible("phytec,imx6dl-pcm058-nand")) { - defaultenv_append_directory(defaultenv_physom_imx6_mira); + || of_machine_is_compatible("phytec,imx6dl-pcm058-nand") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { + defaultenv_append_directory(defaultenv_physom_imx6_phycore); } return 0; diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/init/automount b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/automount index 3659cf7d39..a059e190e2 100644 --- a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/init/automount +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/automount @@ -12,3 +12,6 @@ automount /mnt/tftp 'ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp' mkdir -p /mnt/mmc automount -d /mnt/mmc 'mmc0.probe=1 && [ -e /dev/mmc0.0 ] && mount /dev/mmc0.0 /mnt/mmc' + +mkdir -p /mnt/emmc +automount -d /mnt/emmc 'mmc3.probe=1 && [ -e /dev/mmc3.0 ] && mount /dev/mmc3.0 /mnt/emmc' diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource new file mode 100644 index 0000000000..515613b041 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -n "$nv.boot.default" ]; then + exit +fi + +if [ $bootsource = mmc ]; then + if [ $bootsource_instance = 0 ]; then + global.boot.default="mmc emmc nand spi net" + elif [ $bootsource_instance = 3 ]; then + global.boot.default="emmc mmc nand spi net" + fi +elif [ $bootsource = nand ]; then + global.boot.default="nand spi emmc mmc net" +elif [ $bootsource = spi ]; then + global.boot.default="spi nand emmc mmc net" +elif [ $bootsource = net ]; then + global.boot.default="net nand spi emmc mmc" +fi diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg new file mode 100644 index 0000000000..54c9e41d28 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg @@ -0,0 +1,8 @@ +#define SETUP_MDCFG0 \ + wm 32 0x021b000c 0x8c929b85 + +#define SETUP_MDASP_MDCTL \ + wm 32 0x021b0040 0x00000047; \ + wm 32 0x021b0000 0x841A0000 + +#include "flash-header-phytec-pcm058.h" diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg new file mode 100644 index 0000000000..f047253084 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg @@ -0,0 +1,8 @@ +#define SETUP_MDCFG0 \ + wm 32 0x021b000c 0x555A7955 + +#define SETUP_MDASP_MDCTL \ + wm 32 0x021b0040 0x00000027; \ + wm 32 0x021b0000 0x831A0000 + +#include "flash-header-phytec-pcm058dl.h" diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h index c7df7907d1..a6e4578cb1 100644 --- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h @@ -44,18 +44,18 @@ wm 32 0x020e0488 0x00000028 wm 32 0x020e048c 0x00000028 wm 32 0x021b0800 0xa1390003 wm 32 0x021b4800 0xa1380003 -wm 32 0x021b080c 0x0032003A -wm 32 0x021b0810 0x00350037 -wm 32 0x021b480c 0x00260038 -wm 32 0x021b4810 0x002C0038 -wm 32 0x021b083c 0x42630244 -wm 32 0x021b0840 0x02300238 -wm 32 0x021b483c 0x02540258 -wm 32 0x021b4840 0x0236021e -wm 32 0x021b0848 0x46484446 -wm 32 0x021b4848 0x302d2c35 -wm 32 0x021b0850 0x36342630 -wm 32 0x021b4850 0x3423372d +wm 32 0x021b080c 0x0019001C +wm 32 0x021b0810 0x00140019 +wm 32 0x021b480c 0x00030003 +wm 32 0x021b4810 0x00030010 +wm 32 0x021b083c 0x42140210 +wm 32 0x021b0840 0x02040208 +wm 32 0x021b483c 0x42040208 +wm 32 0x021b4840 0x01680178 +wm 32 0x021b0848 0x40423E3E +wm 32 0x021b4848 0x4242443E +wm 32 0x021b0850 0x2C2C2A30 +wm 32 0x021b4850 0x2E2A3228 wm 32 0x021b081c 0x33333333 wm 32 0x021b0820 0x33333333 wm 32 0x021b0824 0x33333333 diff --git a/arch/arm/boards/phytec-som-imx6/lowlevel.c b/arch/arm/boards/phytec-som-imx6/lowlevel.c index eb796e78b8..c732d32a96 100644 --- a/arch/arm/boards/phytec-som-imx6/lowlevel.c +++ b/arch/arm/boards/phytec-som-imx6/lowlevel.c @@ -91,7 +91,10 @@ PHYTEC_ENTRY(start_phytec_pbab01s_256mb_1bank, imx6s_phytec_pbab01, SZ_256M, fal PHYTEC_ENTRY(start_phytec_pbab01s_512mb_1bank, imx6s_phytec_pbab01, SZ_512M, false); PHYTEC_ENTRY(start_phytec_phyboard_alcor_1gib, imx6q_phytec_phyboard_alcor, SZ_1G, false); PHYTEC_ENTRY(start_phytec_phyboard_subra_512mb_1bank, imx6dl_phytec_phyboard_subra, SZ_512M, false); +PHYTEC_ENTRY(start_phytec_phyboard_subra_1gib_1bank, imx6q_phytec_phyboard_subra, SZ_1G, false); PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_nand_256mb, imx6dl_phytec_phycore_som_nand, SZ_256M, true); +PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_emmc_1gib, imx6dl_phytec_phycore_som_emmc, SZ_1G, true); PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_nand_1gib, imx6q_phytec_phycore_som_nand, SZ_1G, true); PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_emmc_1gib, imx6q_phytec_phycore_som_emmc, SZ_1G, true); +PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_emmc_2gib, imx6q_phytec_phycore_som_emmc, SZ_2G, true); diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig index 82b3821d91..1b0739c35c 100644 --- a/arch/arm/configs/imx_v7_defconfig +++ b/arch/arm/configs/imx_v7_defconfig @@ -54,6 +54,7 @@ CONFIG_CMD_IMD=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_ARM_MMUINFO=y CONFIG_CMD_REGULATOR=y +CONFIG_CMD_MMC_EXTCSD=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_BOOTM_VERBOSE=y CONFIG_CMD_BOOTM_INITRD=y @@ -101,6 +102,7 @@ CONFIG_CMD_FLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_LED=y +CONFIG_CMD_NANDTEST=y CONFIG_CMD_SPI=y CONFIG_CMD_LED_TRIGGER=y CONFIG_CMD_USBGADGET=y diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index b83c1109ef..813e098145 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -45,10 +45,12 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \ imx6dl-phytec-pbab01.dtb.o \ imx6q-phytec-pbab01.dtb.o \ imx6q-phytec-phyboard-alcor.dtb.o \ + imx6q-phytec-phyboard-subra.dtb.o \ imx6dl-phytec-phyboard-subra.dtb.o \ imx6q-phytec-phycore-som-nand.dtb.o \ imx6q-phytec-phycore-som-emmc.dtb.o \ - imx6dl-phytec-phycore-som-nand.dtb.o + imx6dl-phytec-phycore-som-nand.dtb.o \ + imx6dl-phytec-phycore-som-emmc.dtb.o pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o diff --git a/arch/arm/dts/am335x-phytec-phycard-som.dtsi b/arch/arm/dts/am335x-phytec-phycard-som.dtsi index d1dfa86bca..f052f0cc3a 100644 --- a/arch/arm/dts/am335x-phytec-phycard-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phycard-som.dtsi @@ -185,42 +185,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; reg = <0x980000 0x0>; }; diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi b/arch/arm/dts/am335x-phytec-phycore-som.dtsi index f3a1d4d45a..e48d545e64 100644 --- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi @@ -174,22 +174,22 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "barebox"; reg = <0x20000 0x80000>; }; - partition@2 { + partition@a0000 { label = "bareboxenv"; reg = <0xa0000 0x20000>; }; - partition@3 { + partition@c0000 { label = "oftree"; reg = <0xc0000 0x20000>; }; - partition@4 { + partition@e0000 { label = "kernel"; reg = <0xe0000 0x0>; }; @@ -269,42 +269,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; /* * Size 0x0 extends partition to diff --git a/arch/arm/dts/am335x-phytec-phyflex-som.dtsi b/arch/arm/dts/am335x-phytec-phyflex-som.dtsi index c60943ccec..6561625686 100644 --- a/arch/arm/dts/am335x-phytec-phyflex-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phyflex-som.dtsi @@ -165,22 +165,22 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "barebox"; reg = <0x20000 0x80000>; }; - partition@2 { + partition@a0000 { label = "bareboxenv"; reg = <0xa0000 0x20000>; }; - partition@3 { + partition@c0000 { label = "oftree"; reg = <0xc0000 0x20000>; }; - partition@4 { + partition@e0000 { label = "kernel"; reg = <0xe0000 0x0>; }; @@ -283,42 +283,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; reg = <0x980000 0x0>; }; diff --git a/arch/arm/dts/imx25-karo-tx25.dts b/arch/arm/dts/imx25-karo-tx25.dts index d661463282..8d79471a30 100644 --- a/arch/arm/dts/imx25-karo-tx25.dts +++ b/arch/arm/dts/imx25-karo-tx25.dts @@ -126,17 +126,17 @@ reg = <0x0 0x80000>; }; - partition@1 { + partition@80000 { label = "environment"; reg = <0x80000 0x80000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "root"; reg = <0x500000 0x7b00000>; }; diff --git a/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts b/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts index 3ea1b5b052..cb02a1dfce 100644 --- a/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts +++ b/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts @@ -18,20 +18,20 @@ &nfc { partition@0 { label = "boot"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "root"; reg = <0x500000 0x7b00000>; }; diff --git a/arch/arm/dts/imx27-phytec-phycore-rdk.dts b/arch/arm/dts/imx27-phytec-phycore-rdk.dts index f602045c7e..fff154cb97 100644 --- a/arch/arm/dts/imx27-phytec-phycore-rdk.dts +++ b/arch/arm/dts/imx27-phytec-phycore-rdk.dts @@ -32,17 +32,17 @@ reg = <0x00000000 0x00080000>; }; - environment_nand: partition@1 { + environment_nand: partition@80000 { label = "env"; reg = <0x00080000 0x00020000>; }; - partition@2 { + partition@a0000 { label = "kernel"; reg = <0x000a0000 0x00400000>; }; - partition@3 { + partition@4a0000 { label = "root"; reg = <0x004a0000 0>; }; @@ -54,17 +54,17 @@ reg = <0x00000000 0x00080000>; }; - environment_nor: partition@1 { + environment_nor: partition@80000 { label = "env"; reg = <0x00080000 0x00020000>; }; - partition@2 { + partition@a0000 { label = "kernel"; reg = <0x000a0000 0x00400000>; }; - partition@3 { + partition@4a0000 { label = "root"; reg = <0x004a0000 0>; }; diff --git a/arch/arm/dts/imx51-babbage.dts b/arch/arm/dts/imx51-babbage.dts index f8402ca8fa..bde3031d1b 100644 --- a/arch/arm/dts/imx51-babbage.dts +++ b/arch/arm/dts/imx51-babbage.dts @@ -27,9 +27,9 @@ #address-cells = <1>; #size-cells = <1>; - environment_esdhc1: partition@0 { + environment_esdhc1: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx51-genesi-efika-sb.dts b/arch/arm/dts/imx51-genesi-efika-sb.dts index 78cb1b7184..5a2c3a1c40 100644 --- a/arch/arm/dts/imx51-genesi-efika-sb.dts +++ b/arch/arm/dts/imx51-genesi-efika-sb.dts @@ -415,9 +415,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; @@ -533,9 +533,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; }; diff --git a/arch/arm/dts/imx53-ccxmx53.dts b/arch/arm/dts/imx53-ccxmx53.dts index 85d20c3b63..4b5ec6534f 100644 --- a/arch/arm/dts/imx53-ccxmx53.dts +++ b/arch/arm/dts/imx53-ccxmx53.dts @@ -12,6 +12,7 @@ /dts-v1/; #include "imx53-ccxmx53.dtsi" +#include "imx53.dtsi" / { model = "Digi ConnectCore ccxmx53"; diff --git a/arch/arm/dts/imx53-ccxmx53.dtsi b/arch/arm/dts/imx53-ccxmx53.dtsi index 5553c68e25..2ed24b65e4 100644 --- a/arch/arm/dts/imx53-ccxmx53.dtsi +++ b/arch/arm/dts/imx53-ccxmx53.dtsi @@ -27,7 +27,7 @@ / { memory { - reg = <0x70000000 0x40000000>; + reg = <0x0 0x0>; }; }; @@ -228,26 +228,27 @@ pinctrl-0 = <&pinctrl_nand>; nand-bus-width = <8>; nand-ecc-mode = "hw"; + nand-on-flash-bbt; status = "okay"; partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "rootfs"; - reg = <0x500000 0x07B00000>; + reg = <0x500000 0x0>; }; }; diff --git a/arch/arm/dts/imx53-guf-vincell-lt.dts b/arch/arm/dts/imx53-guf-vincell-lt.dts index a577ab262e..bcc378d07f 100644 --- a/arch/arm/dts/imx53-guf-vincell-lt.dts +++ b/arch/arm/dts/imx53-guf-vincell-lt.dts @@ -361,15 +361,15 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - bareboxenv: partition@1 { + bareboxenv: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "ubi"; reg = <0x100000 0x0>; }; diff --git a/arch/arm/dts/imx53-mba53.dts b/arch/arm/dts/imx53-mba53.dts index c908c61671..28f463c451 100644 --- a/arch/arm/dts/imx53-mba53.dts +++ b/arch/arm/dts/imx53-mba53.dts @@ -28,9 +28,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx53-qsb-common.dtsi b/arch/arm/dts/imx53-qsb-common.dtsi index 85e1b8bd01..f363af975d 100644 --- a/arch/arm/dts/imx53-qsb-common.dtsi +++ b/arch/arm/dts/imx53-qsb-common.dtsi @@ -43,9 +43,9 @@ #address-cells = <1>; #size-cells = <1>; - bareboxenv: partition@0 { + bareboxenv: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx53-voipac-dmm-668.dtsi b/arch/arm/dts/imx53-voipac-dmm-668.dtsi index 6f76d2867a..e91c7d02a2 100644 --- a/arch/arm/dts/imx53-voipac-dmm-668.dtsi +++ b/arch/arm/dts/imx53-voipac-dmm-668.dtsi @@ -15,20 +15,20 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "rootfs"; reg = <0x500000 0x07B00000>; }; diff --git a/arch/arm/dts/imx6dl-eltec-hipercam.dts b/arch/arm/dts/imx6dl-eltec-hipercam.dts index f272e78a59..4fe174437e 100644 --- a/arch/arm/dts/imx6dl-eltec-hipercam.dts +++ b/arch/arm/dts/imx6dl-eltec-hipercam.dts @@ -37,15 +37,15 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_nor0: partition@1 { + environment_nor0: partition@e0000 { label = "bareboxenv"; - reg = <0xc0000 0x8000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "persistent"; reg = <0x100000 0xf00000>; }; diff --git a/arch/arm/dts/imx6dl-hummingboard.dts b/arch/arm/dts/imx6dl-hummingboard.dts index 2314965260..7f4d2b42f2 100644 --- a/arch/arm/dts/imx6dl-hummingboard.dts +++ b/arch/arm/dts/imx6dl-hummingboard.dts @@ -29,11 +29,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts b/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts index 34e414413c..3d1069a965 100644 --- a/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts +++ b/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts @@ -11,24 +11,9 @@ /dts-v1/; #include "imx6s-phytec-pfla02.dtsi" +#include "imx6qdl-phytec-phyboard-subra.dtsi" / { model = "Phytec phyBOARD SUBRA"; compatible = "phytec,imx6dl-pbab05", "phytec,imx6s-pfla02", "fsl,imx6dl"; - - chosen { - stdout-path = &uart4; - }; -}; - -&fec { - status = "okay"; -}; - -&uart4 { - status = "okay"; -}; - -&usdhc3 { - status = "okay"; }; diff --git a/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts b/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts new file mode 100644 index 0000000000..fc153a6b05 --- /dev/null +++ b/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; + +#include <arm/imx6dl.dtsi> +#include "imx6dl.dtsi" +#include "imx6qdl-phytec-phycore-som.dtsi" + +/ { + model = "Phytec phyCORE-i.MX6 DualLite/SOLO with eMMC"; + compatible = "phytec,imx6dl-pcm058-emmc", "fsl,imx6dl"; +}; + +&ecspi1 { + status = "okay"; +}; + +&eeprom { + status = "okay"; +}; + +&fec { + status = "okay"; + phy-handle = <ðphy>; + phy-mode = "rgmii"; + phy-reset-gpios = <&gpio1 14 1>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy: ethernet-phy@3 { + reg = <3>; + max-speed = <100>; + }; + }; +}; + +&flash { + status = "okay"; +}; + +&usdhc1 { + status = "okay"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "barebox"; + reg = <0x0 0xe0000>; + }; + + partition@e0000 { + label = "barebox-environment"; + reg = <0xe0000 0x20000>; + }; +}; + +&usdhc4 { + status = "okay"; +}; diff --git a/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts b/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts index 2324f3a6e5..3f2f1c7320 100644 --- a/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts +++ b/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts @@ -53,11 +53,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6dl-wandboard.dts b/arch/arm/dts/imx6dl-wandboard.dts index a8674004c8..873e9d6985 100644 --- a/arch/arm/dts/imx6dl-wandboard.dts +++ b/arch/arm/dts/imx6dl-wandboard.dts @@ -27,11 +27,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@c0000 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/dts/imx6q-dmo-edmqmx6.dts index 071f5f5c5e..3576211be4 100644 --- a/arch/arm/dts/imx6q-dmo-edmqmx6.dts +++ b/arch/arm/dts/imx6q-dmo-edmqmx6.dts @@ -53,12 +53,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; }; @@ -97,11 +97,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; @@ -111,10 +111,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-embedsky-e9.dts b/arch/arm/dts/imx6q-embedsky-e9.dts index 726d620681..3bbb60bba3 100644 --- a/arch/arm/dts/imx6q-embedsky-e9.dts +++ b/arch/arm/dts/imx6q-embedsky-e9.dts @@ -41,11 +41,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_mmc1: partition@1 { + environment_mmc1: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; @@ -55,10 +55,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_mmc3: partition@1 { + environment_mmc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-guf-santaro.dts b/arch/arm/dts/imx6q-guf-santaro.dts index 27f538a356..2bd1a26317 100644 --- a/arch/arm/dts/imx6q-guf-santaro.dts +++ b/arch/arm/dts/imx6q-guf-santaro.dts @@ -587,9 +587,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-hummingboard.dts b/arch/arm/dts/imx6q-hummingboard.dts index e1d2fa8ce2..e707eb91c9 100644 --- a/arch/arm/dts/imx6q-hummingboard.dts +++ b/arch/arm/dts/imx6q-hummingboard.dts @@ -29,11 +29,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi b/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi index 05224657dc..a6ea7b5cce 100644 --- a/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi +++ b/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi @@ -139,22 +139,22 @@ reg = <0x0 0x400000>; }; - environment_nand: partition@1 { + environment_nand: partition@400000 { label = "barebox-environment"; reg = <0x400000 0x20000>; }; - partition@2 { + partition@420000 { label = "oftree"; reg = <0x420000 0x20000>; }; - partition@3 { + partition@440000 { label = "kernel"; reg = <0x440000 0x800000>; }; - partition@4 { + partition@C40000 { label = "root"; reg = <0xC40000 0x0>; }; @@ -181,10 +181,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@1 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts b/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts index a60fc186e2..1c4a78552d 100644 --- a/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts +++ b/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts @@ -35,4 +35,5 @@ &usdhc3 { status = "okay"; + max-frequency = <25000000>; /* 25 Mhz */ }; diff --git a/arch/arm/dts/imx6q-phytec-phyboard-subra.dts b/arch/arm/dts/imx6q-phytec-phyboard-subra.dts new file mode 100644 index 0000000000..561e985604 --- /dev/null +++ b/arch/arm/dts/imx6q-phytec-phyboard-subra.dts @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; +#include "imx6q-phytec-pfla02.dtsi" +#include "imx6qdl-phytec-phyboard-subra.dtsi" + +/ { + model = "Phytec phyBOARD SUBRA"; + compatible = "phytec,imx6q-pbab05", "phytec,imx6q-pfla02", "fsl,imx6q"; +}; diff --git a/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts b/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts index 6e19ab553e..74bc09b5d5 100644 --- a/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts +++ b/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts @@ -20,6 +20,10 @@ compatible = "phytec,imx6q-pcm058-emmc", "fsl,imx6q"; }; +&ecspi1 { + status = "okay"; +}; + &eeprom { status = "okay"; }; @@ -41,8 +45,25 @@ }; }; +&flash { + status = "okay"; +}; + &usdhc1 { status = "okay"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "barebox"; + reg = <0x0 0xe0000>; + }; + + partition@e0000 { + label = "barebox-environment"; + reg = <0xe0000 0x20000>; + }; }; &usdhc4 { diff --git a/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts b/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts index 06f2f71537..aa2c94abee 100644 --- a/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts +++ b/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts @@ -62,11 +62,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-var-custom.dts b/arch/arm/dts/imx6q-var-custom.dts index ef6981e3bc..fe03589454 100644 --- a/arch/arm/dts/imx6q-var-custom.dts +++ b/arch/arm/dts/imx6q-var-custom.dts @@ -127,17 +127,17 @@ reg = <0x0 0x200000>; }; - partition@1 { + partition@200000 { label = "barebox-environment"; reg = <0x200000 0x20000>; }; - partition@2 { + partition@220000 { label = "kernel"; reg = <0x220000 0x600000>; }; - partition@3 { + partition@820000 { label = "rootfs"; reg = <0x820000 0x18000000>; }; diff --git a/arch/arm/dts/imx6q-var-som.dtsi b/arch/arm/dts/imx6q-var-som.dtsi index d005f319d6..63a17fc660 100644 --- a/arch/arm/dts/imx6q-var-som.dtsi +++ b/arch/arm/dts/imx6q-var-som.dtsi @@ -42,17 +42,17 @@ reg = <0x0 0x200000>; }; - environment_nand: partition@1 { + environment_nand: partition@200000 { label = "barebox-environment"; reg = <0x200000 0x20000>; }; - partition@2 { + partition@220000 { label = "kernel"; reg = <0x220000 0x600000>; }; - partition@3 { + partition@820000 { label = "rootfs"; reg = <0x820000 0x1F7E0000>; }; diff --git a/arch/arm/dts/imx6q-wandboard.dts b/arch/arm/dts/imx6q-wandboard.dts index 26d8a0077d..0606727a11 100644 --- a/arch/arm/dts/imx6q-wandboard.dts +++ b/arch/arm/dts/imx6q-wandboard.dts @@ -27,11 +27,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@c0000 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-gw54xx.dtsi b/arch/arm/dts/imx6qdl-gw54xx.dtsi index ea5739ddcb..5f8e489aeb 100644 --- a/arch/arm/dts/imx6qdl-gw54xx.dtsi +++ b/arch/arm/dts/imx6qdl-gw54xx.dtsi @@ -31,7 +31,7 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x20000>; }; diff --git a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi index 8fcd4e48a4..9ff7395f45 100644 --- a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi @@ -31,12 +31,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi index b79ce2c0f9..9a8c7024a3 100644 --- a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi +++ b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi @@ -66,17 +66,17 @@ reg = <0x0 0x100000>; }; - partition@1 { + partition@100000 { label = "barebox-environment"; reg = <0x100000 0x20000>; }; - partition@2 { + partition@120000 { label = "oftree"; reg = <0x120000 0x20000>; }; - partition@3 { + partition@140000 { label = "kernel"; reg = <0x140000 0x0>; }; @@ -85,6 +85,7 @@ &fec { phy-handle = <ðphy>; + phy-reset-duration = <10>; /* in msecs */ mdio { #address-cells = <1>; @@ -108,22 +109,22 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; - partition@2 { + partition@500000 { label = "oftree"; reg = <0x500000 0x100000>; }; - partition@3 { + partition@600000 { label = "kernel"; reg = <0x600000 0x800000>; }; - partition@4 { + partition@e00000 { label = "root"; reg = <0xe00000 0x0>; }; @@ -180,11 +181,23 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; + }; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + eeprom: eeprom@50 { + compatible = "atmel,24c32"; + pagesize = <32>; + reg = <0x50>; }; }; diff --git a/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi b/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi new file mode 100644 index 0000000000..a38765b142 --- /dev/null +++ b/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/ { + chosen { + stdout-path = &uart4; + }; +}; + +&fec { + status = "okay"; +}; + +&uart4 { + status = "okay"; +}; + +&usdhc3 { + status = "okay"; + max-frequency = <25000000>; /* 25 Mhz */ +}; diff --git a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi index 2a975d103e..d446a5e9af 100644 --- a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi +++ b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi @@ -46,6 +46,7 @@ compatible = "m25p80"; spi-max-frequency = <20000000>; reg = <0>; + status = "disabled"; #address-cells = <1>; #size-cells = <1>; @@ -55,17 +56,17 @@ reg = <0x0 0x100000>; }; - partition@1 { + partition@100000 { label = "barebox-environment"; reg = <0x100000 0x20000>; }; - partition@2 { + partition@120000 { label = "oftree"; reg = <0x120000 0x20000>; }; - partition@3 { + partition@140000 { label = "kernel"; reg = <0x140000 0x0>; }; @@ -91,22 +92,22 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; - partition@2 { + partition@500000 { label = "oftree"; reg = <0x500000 0x100000>; }; - partition@3 { + partition@600000 { label = "kernel"; reg = <0x600000 0x800000>; }; - partition@4 { + partition@e00000 { label = "root"; reg = <0xe00000 0x0>; }; @@ -256,11 +257,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-sabrelite.dtsi b/arch/arm/dts/imx6qdl-sabrelite.dtsi index d5a6ff4b1f..10b0002ec2 100644 --- a/arch/arm/dts/imx6qdl-sabrelite.dtsi +++ b/arch/arm/dts/imx6qdl-sabrelite.dtsi @@ -31,12 +31,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-sabresd.dtsi b/arch/arm/dts/imx6qdl-sabresd.dtsi index 32318cf389..6b10229c88 100644 --- a/arch/arm/dts/imx6qdl-sabresd.dtsi +++ b/arch/arm/dts/imx6qdl-sabresd.dtsi @@ -31,11 +31,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@1 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-tx6x.dtsi b/arch/arm/dts/imx6qdl-tx6x.dtsi index 9c5d676a74..3898425d9c 100644 --- a/arch/arm/dts/imx6qdl-tx6x.dtsi +++ b/arch/arm/dts/imx6qdl-tx6x.dtsi @@ -32,7 +32,7 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; diff --git a/arch/arm/dts/imx6s-riotboard.dts b/arch/arm/dts/imx6s-riotboard.dts index 3d0a930c3f..09ac534625 100644 --- a/arch/arm/dts/imx6s-riotboard.dts +++ b/arch/arm/dts/imx6s-riotboard.dts @@ -233,9 +233,9 @@ reg = <0x0 0x80000>; }; - environment_usdhc4: partition@1 { + environment_usdhc4: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6sx-sdb.dts b/arch/arm/dts/imx6sx-sdb.dts index fbf098bbe6..7b60f9326a 100644 --- a/arch/arm/dts/imx6sx-sdb.dts +++ b/arch/arm/dts/imx6sx-sdb.dts @@ -52,9 +52,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/rk3188-radxarock.dts b/arch/arm/dts/rk3188-radxarock.dts index 47b2487dd9..cafd4d36ed 100644 --- a/arch/arm/dts/rk3188-radxarock.dts +++ b/arch/arm/dts/rk3188-radxarock.dts @@ -34,7 +34,7 @@ label = "barebox"; reg = <0x0 0x80000>; }; - partition@1 { + partition@80000 { label = "barebox-environment"; reg = <0x80000 0x80000>; }; diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 28b4f4a4b4..f6024c80ec 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -67,21 +67,30 @@ static int sdram_start_and_size(unsigned long *start, unsigned long *size) return 0; } -static void get_kernel_addresses(unsigned long mem_start, size_t image_size, +static int get_kernel_addresses(size_t image_size, int verbose, unsigned long *load_address, - unsigned long *spacing) + unsigned long *mem_free) { + unsigned long mem_start, mem_size; + int ret; + size_t image_decomp_size; + unsigned long spacing; + + ret = sdram_start_and_size(&mem_start, &mem_size); + if (ret) + return ret; + /* * We don't know the exact decompressed size so just use a conservative * default of 4 times the size of the compressed image. */ - size_t image_decomp_size = PAGE_ALIGN(image_size * 4); + image_decomp_size = PAGE_ALIGN(image_size * 4); /* * By default put oftree/initrd close behind compressed kernel image to * avoid placing it outside of the kernels lowmem region. */ - *spacing = SZ_1M; + spacing = SZ_1M; if (*load_address == UIMAGE_INVALID_ADDRESS) { /* @@ -99,8 +108,12 @@ static void get_kernel_addresses(unsigned long mem_start, size_t image_size, * spacing to allow this relocation to happen without * overwriting anything placed behind the kernel. */ - *spacing += image_decomp_size; + spacing += image_decomp_size; } + + *mem_free = PAGE_ALIGN(*load_address + image_size + spacing); + + return 0; } static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int swap) @@ -160,24 +173,20 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int static int do_bootm_linux(struct image_data *data) { - unsigned long load_address, mem_start, mem_size, mem_free, spacing; + unsigned long load_address, mem_free; int ret; - ret = sdram_start_and_size(&mem_start, &mem_size); - if (ret) - return ret; - load_address = data->os_address; - get_kernel_addresses(mem_start, bootm_get_os_size(data), - bootm_verbose(data), &load_address, &spacing); + ret = get_kernel_addresses(bootm_get_os_size(data), + bootm_verbose(data), &load_address, &mem_free); + if (ret) + return ret; ret = bootm_load_os(data, load_address); if (ret) return ret; - mem_free = PAGE_ALIGN(data->os_res->end + spacing); - return __do_bootm_linux(data, mem_free, 0); } @@ -273,11 +282,7 @@ static int do_bootz_linux(struct image_data *data) u32 end, start; size_t image_size; unsigned long load_address = data->os_address; - unsigned long mem_start, mem_size, mem_free, spacing; - - ret = sdram_start_and_size(&mem_start, &mem_size); - if (ret) - return ret; + unsigned long mem_free; fd = open(data->os_file, O_RDONLY); if (fd < 0) { @@ -315,8 +320,10 @@ static int do_bootz_linux(struct image_data *data) image_size = end - start; load_address = data->os_address; - get_kernel_addresses(mem_start, image_size, bootm_verbose(data), - &load_address, &spacing); + ret = get_kernel_addresses(image_size, bootm_verbose(data), + &load_address, &mem_free); + if (ret) + return ret; data->os_res = request_sdram_region("zimage", load_address, image_size); if (!data->os_res) { @@ -352,8 +359,6 @@ static int do_bootz_linux(struct image_data *data) close(fd); - mem_free = PAGE_ALIGN(data->os_res->end + spacing); - return __do_bootm_linux(data, mem_free, swap); err_out: @@ -570,7 +575,7 @@ static int armlinux_register_image_handler(void) register_image_handler(&aimage_handler); binfmt_register(&binfmt_aimage_hook); } - if (IS_BUILTIN(CONFIG_CMD_BOOTM_FITIMAGE)) + if (IS_BUILTIN(CONFIG_FITIMAGE)) register_image_handler(&arm_fit_handler); binfmt_register(&binfmt_arm_zimage_hook); binfmt_register(&binfmt_barebox_hook); diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c index 66ba51cde1..106e648bd3 100644 --- a/arch/arm/mach-imx/esdctl.c +++ b/arch/arm/mach-imx/esdctl.c @@ -434,7 +434,7 @@ static __maybe_unused struct of_device_id imx_esdctl_dt_ids[] = { } }; -static struct driver_d imx_serial_driver = { +static struct driver_d imx_esdctl_driver = { .name = "imx-esdctl", .probe = imx_esdctl_probe, .id_table = imx_esdctl_ids, @@ -443,7 +443,7 @@ static struct driver_d imx_serial_driver = { static int imx_esdctl_init(void) { - return platform_driver_register(&imx_serial_driver); + return platform_driver_register(&imx_esdctl_driver); } mem_initcall(imx_esdctl_init); diff --git a/arch/arm/mach-omap/am33xx_bbu_nand.c b/arch/arm/mach-omap/am33xx_bbu_nand.c index ee767d32e4..25f0e79ee6 100644 --- a/arch/arm/mach-omap/am33xx_bbu_nand.c +++ b/arch/arm/mach-omap/am33xx_bbu_nand.c @@ -40,7 +40,7 @@ static int write_image(const char *devfile, const void *image, size_t size) return fd; } - ret = erase(fd, ~0, 0); + ret = erase(fd, ERASE_SIZE_ALL, 0); if (ret < 0) { pr_err("could not erase %s: %s\n", devfile, errno_str()); diff --git a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c index 702bb9af59..69a73ffb06 100644 --- a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c +++ b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c @@ -70,7 +70,7 @@ static int spi_nor_mlo_handler(struct bbu_handler *handler, goto out; } - ret = erase(dstfd, ~0, 0); + ret = erase(dstfd, ERASE_SIZE_ALL, 0); if (ret < 0) { printf("could not erase %s: %s", data->devicefile, errno_str()); goto out1; diff --git a/commands/Kconfig b/commands/Kconfig index 875c5f4f01..13dd9bb9b3 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -266,19 +266,6 @@ endmenu menu "Boot" -# TODO: isn't a command -config FLEXIBLE_BOOTARGS - bool - prompt "flexible Linux bootargs generation" - depends on CMD_GLOBAL - help - Select this to get a more flexible bootargs generation. With this - option the bootargs are concatenated together from global variables - beginning with 'global.linux.bootargs.' and 'global.linux.mtdparts.' - This allows for more flexible scripting since with it it's possible - to replace parts of the bootargs string without reconstructing it - completely. - config CMD_AT91_BOOT_TEST bool "at91_boot_test" depends on ARCH_AT91 diff --git a/commands/bootm.c b/commands/bootm.c index 7a19fa2948..bfec62c98b 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -166,6 +166,7 @@ BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, "bootm default BAREBOX_MAGICVAR_NAMED(global_bootm_initrd_loadaddr, global.bootm.initrd.loadaddr, "bootm default initrd loadaddr"); BAREBOX_MAGICVAR_NAMED(global_bootm_oftree, global.bootm.oftree, "bootm default oftree"); BAREBOX_MAGICVAR_NAMED(global_bootm_verify, global.bootm.verify, "bootm default verify level"); +BAREBOX_MAGICVAR_NAMED(global_bootm_appendroot, global.bootm.appendroot, "Add root= option to Kernel to mount rootfs from the device the Kernel comes from"); static struct binfmt_hook binfmt_uimage_hook = { .type = filetype_uimage, diff --git a/commands/flash.c b/commands/flash.c index 99d3cb7c3f..d881b4d399 100644 --- a/commands/flash.c +++ b/commands/flash.c @@ -32,7 +32,7 @@ static int do_flerase(int argc, char *argv[]) int fd; char *filename = NULL; struct stat s; - loff_t start = 0, size = ~0; + loff_t start = 0, size; int ret = 0; if (argc == 1) diff --git a/commands/i2c.c b/commands/i2c.c index e6750e3d75..ae7f7fc6d0 100644 --- a/commands/i2c.c +++ b/commands/i2c.c @@ -243,7 +243,7 @@ BAREBOX_CMD_HELP_END BAREBOX_CMD_START(i2c_read) .cmd = do_i2c_read, BAREBOX_CMD_DESC("read from an i2c device") - BAREBOX_CMD_OPTS("[-bacrwv] DATA...") + BAREBOX_CMD_OPTS("[-bacrwv]") BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP) BAREBOX_CMD_HELP(cmd_i2c_read_help) BAREBOX_CMD_END diff --git a/common/Kconfig b/common/Kconfig index 7c09e8c117..d00ca6b0fb 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -536,6 +536,18 @@ config BLSPEC on a device and it allows the Operating System to install / update kernels. +config FLEXIBLE_BOOTARGS + bool + prompt "flexible Linux bootargs generation" + depends on GLOBALVAR + help + Select this to get a more flexible bootargs generation. With this + option the bootargs are concatenated together from global variables + beginning with 'global.linux.bootargs.' and 'global.linux.mtdparts.' + This allows for more flexible scripting since with it it's possible + to replace parts of the bootargs string without reconstructing it + completely. + config IMD bool "barebox metadata support" diff --git a/common/blspec.c b/common/blspec.c index b92f49fa2b..bf98e6b29a 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -639,29 +639,6 @@ int blspec_scan_devicename(struct blspec *blspec, const char *devname) return blspec_scan_device(blspec, dev); } -static int blspec_append_root(struct blspec_entry *entry) -{ - const char *appendroot; - char *rootarg; - - appendroot = blspec_entry_var_get(entry, "linux-appendroot"); - if (!appendroot || strcmp(appendroot, "true")) - return 0; - - rootarg = path_get_linux_rootarg(entry->rootpath); - if (IS_ERR(rootarg)) { - pr_err("Getting root argument for %s failed with: %s\n", - entry->rootpath, strerrorp(rootarg)); - return PTR_ERR(rootarg); - } - - globalvar_add_simple("linux.bootargs.dyn.blspec.appendroot", rootarg); - - free(rootarg); - - return 0; -} - /* * blspec_boot - boot an entry * @@ -673,6 +650,7 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun) { int ret; const char *abspath, *devicetree, *options, *initrd, *linuximage; + const char *appendroot; struct bootm_data data = { .initrd_address = UIMAGE_INVALID_ADDRESS, .os_address = UIMAGE_SOME_ADDRESS, @@ -711,9 +689,18 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun) globalvar_add_simple("linux.bootargs.dyn.blspec", options); - ret = blspec_append_root(entry); - if (ret) - goto err_out; + appendroot = blspec_entry_var_get(entry, "linux-appendroot"); + if (appendroot) { + int val; + + ret = strtobool(appendroot, &val); + if (ret) { + pr_err("Invalid value \"%s\" for appendroot option\n", + appendroot); + goto err_out; + } + data.appendroot = val; + } pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"), entry->cdev ? dev_name(entry->cdev->dev) : "none"); diff --git a/common/bootm.c b/common/bootm.c index 6d22aab289..cad8c73efe 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -48,6 +48,8 @@ static struct image_handler *bootm_find_handler(enum filetype filetype, return NULL; } +static int bootm_appendroot; + void bootm_data_init_defaults(struct bootm_data *data) { data->initrd_address = UIMAGE_INVALID_ADDRESS; @@ -58,6 +60,7 @@ void bootm_data_init_defaults(struct bootm_data *data) getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address); data->initrd_file = getenv_nonempty("global.bootm.initrd"); data->verify = bootm_get_verify_mode(); + data->appendroot = bootm_appendroot; } static enum bootm_verify bootm_verify_mode = BOOTM_VERIFY_HASH; @@ -576,6 +579,18 @@ int bootm_boot(struct bootm_data *bootm_data) } } + if (bootm_data->appendroot) { + char *rootarg; + + rootarg = path_get_linux_rootarg(data->os_file); + if (!IS_ERR(rootarg)) { + printf("Adding \"%s\" to Kernel commandline\n", rootarg); + globalvar_add_simple("linux.bootargs.bootm.appendroot", + rootarg); + free(rootarg); + } + } + printf("\nLoading %s '%s'", file_type_to_string(os_type), data->os_file); if (os_type == filetype_uimage && @@ -621,6 +636,7 @@ err_out: if (data->of_root_node && data->of_root_node != of_get_root_node()) of_delete_node(data->of_root_node); + globalvar_remove("linux.bootargs.bootm.appendroot"); free(data->os_file); free(data->oftree_file); free(data->initrd_file); @@ -634,6 +650,7 @@ static int bootm_init(void) globalvar_add_simple("bootm.image", NULL); globalvar_add_simple("bootm.image.loadaddr", NULL); globalvar_add_simple("bootm.oftree", NULL); + globalvar_add_simple_bool("bootm.appendroot", &bootm_appendroot); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) { globalvar_add_simple("bootm.initrd", NULL); globalvar_add_simple("bootm.initrd.loadaddr", NULL); diff --git a/common/env.c b/common/env.c index 5f63e2dd27..6f736d5add 100644 --- a/common/env.c +++ b/common/env.c @@ -28,6 +28,7 @@ #include <xfuncs.h> #include <errno.h> #include <init.h> +#include <string.h> #include <environment.h> static struct env_context root = { @@ -323,20 +324,25 @@ int getenv_uint(const char *var , unsigned int *val) } EXPORT_SYMBOL(getenv_uint); +/** + * getenv_bool - get a boolean value from an environment variable + * @var - Variable name + * @val - The boolean value returned. + * + * This function treats + * - any positive (nonzero) number as true + * - "0" as false + * - "true" (case insensitive) as true + * - "false" (case insensitive) as false + * + * Returns 0 for success or negative error code if the variable does + * not exist or contains something this function does not recognize + * as true or false. + */ int getenv_bool(const char *var, int *val) { const char *valstr = getenv(var); - if (!valstr || !*valstr) - return -EINVAL; - - if (!*valstr) - *val = false; - else if (*valstr == '0') - *val = false; - else - *val = true; - - return 0; + return strtobool(valstr, val); } EXPORT_SYMBOL(getenv_bool); diff --git a/common/environment.c b/common/environment.c index fa6b59620e..c3ad25266a 100644 --- a/common/environment.c +++ b/common/environment.c @@ -89,6 +89,7 @@ static int do_compare_file(const char *filename, const char *base) } #else +#define ERASE_SIZE_ALL 0 static inline int protect(int fd, size_t count, unsigned long offset, int prot) { return 0; @@ -330,7 +331,7 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags) goto out; } - ret = erase(envfd, ~0, 0); + ret = erase(envfd, ERASE_SIZE_ALL, 0); /* ENOSYS and EOPNOTSUPP aren't errors here, many devices don't need it */ if (ret && errno != ENOSYS && errno != EOPNOTSUPP) { diff --git a/common/filetype.c b/common/filetype.c index 74baf51446..a8666a1439 100644 --- a/common/filetype.c +++ b/common/filetype.c @@ -291,8 +291,6 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize) if (bufsize < 64) return filetype_unknown; - if (buf8[0] == 'M' && buf8[1] == 'Z') - return filetype_exe; if (le32_to_cpu(buf[5]) == 0x504d5453) return filetype_mxs_bootstream; @@ -301,6 +299,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize) if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01) return filetype_arm_zimage; + if (buf8[0] == 'M' && buf8[1] == 'Z') + return filetype_exe; + if (bufsize < 512) return filetype_unknown; diff --git a/common/globalvar.c b/common/globalvar.c index bc1734d58d..5dad4f6a45 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -33,6 +33,16 @@ int globalvar_add(const char *name, return 0; } +void globalvar_remove(const char *name) +{ + struct param_d *param = get_param_by_name(&global_device, name); + + if (!param) + return; + + dev_remove_param(param); +} + static int nv_save(const char *name, const char *val) { int fd, ret; diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c index 6a601956db..7b8036bbf3 100644 --- a/drivers/ata/sata-imx.c +++ b/drivers/ata/sata-imx.c @@ -112,7 +112,7 @@ static int imx_sata_probe(struct device_d *dev) imx_ahci->ahci.dev = dev; dev->priv = &imx_ahci->ahci; - dev->info = ahci_info, + dev->info = ahci_info; ret = ahci_add_host(&imx_ahci->ahci); if (ret) diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 282887ba78..2e189fecad 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -41,6 +41,8 @@ #define IMX_SDHCI_WML 0x44 #define IMX_SDHCI_MIXCTRL 0x48 +#define IMX_SDHCI_DLL_CTRL 0x60 +#define IMX_SDHCI_MIX_CTRL_FBCLK_SEL (BIT(25)) struct fsl_esdhc_host { struct mci_host mci; @@ -516,11 +518,23 @@ static int esdhc_reset(struct fsl_esdhc_host *host) { void __iomem *regs = host->regs; uint64_t start; + int val; /* reset the controller */ esdhc_write32(regs + SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET, SYSCTL_RSTA); + /* extra register reset for i.MX6 Solo/DualLite */ + if (cpu_is_mx6()) { + /* reset bit FBCLK_SEL */ + val = esdhc_read32(regs + IMX_SDHCI_MIXCTRL); + val &= ~IMX_SDHCI_MIX_CTRL_FBCLK_SEL; + esdhc_write32(regs + IMX_SDHCI_MIXCTRL, val); + + /* reset delay line settings in IMX_SDHCI_DLL_CTRL */ + esdhc_write32(regs + IMX_SDHCI_DLL_CTRL, 0x0); + } + start = get_time_ns(); /* hardware clears the bit when it is done */ while (1) { diff --git a/drivers/serial/serial_auart.c b/drivers/serial/serial_auart.c index 9bef576cd7..c3b9a1995f 100644 --- a/drivers/serial/serial_auart.c +++ b/drivers/serial/serial_auart.c @@ -230,9 +230,18 @@ static void auart_serial_remove(struct device_d *dev) free(priv); } +static const __maybe_unused struct of_device_id auart_serial_dt_ids[] = { + { + .compatible = "fsl,imx23-auart", + }, { + /* sentinel */ + } +}; + static struct driver_d auart_serial_driver = { .name = "auart_serial", .probe = auart_serial_probe, .remove = auart_serial_remove, + .of_compatible = DRV_OF_COMPAT(auart_serial_dt_ids), }; console_platform_driver(auart_serial_driver); diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c index 351b584796..d7bf92cdff 100644 --- a/drivers/usb/gadget/dfu.c +++ b/drivers/usb/gadget/dfu.c @@ -359,7 +359,7 @@ static int handle_dnload(struct usb_function *f, const struct usb_ctrlrequest *c ret = -EINVAL; goto err_out; } - ret = erase(fd, ~0, 0); + ret = erase(fd, ERASE_SIZE_ALL, 0); close(fd); if (ret && ret != -ENOSYS) { perror("erase"); @@ -479,7 +479,7 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) goto out; } - ret = erase(dfufd, ~0, 0); + ret = erase(dfufd, ERASE_SIZE_ALL, 0); if (ret && ret != -ENOSYS) { dfu->dfu_status = DFU_STATUS_errERASE; perror("erase"); diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index fdea52eb93..859aaff279 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -786,7 +786,7 @@ static void cb_erase(struct usb_ep *ep, struct usb_request *req, const char *cmd if (fd < 0) fastboot_tx_print(f_fb, "FAIL%s", strerror(-fd)); - ret = erase(fd, ~0, 0); + ret = erase(fd, ERASE_SIZE_ALL, 0); close(fd); @@ -937,8 +937,10 @@ int erase(int fd, loff_t count, loff_t offset) f = &files[fd]; if (offset >= f->size) return 0; - if (count > f->size - offset) + if (count == ERASE_SIZE_ALL || count > f->size - offset) count = f->size - offset; + if (count < 0) + return -EINVAL; fsdrv = f->fsdev->driver; if (fsdrv->erase) diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx index 6c7e81a9dc..8be78eff89 100644 --- a/images/Makefile.am33xx +++ b/images/Makefile.am33xx @@ -83,6 +83,12 @@ FILE_barebox-am33xx-phytec-phycore-mlo-1024mb.spi.img = start_am33xx_phytec_phyc am33xx-mlo-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-mlo-1024mb.img am33xx-mlospi-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-mlo-1024mb.spi.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += start_am33xx_phytec_phycore_r2_sram_1024mb +FILE_barebox-am33xx-phytec-phycore-r2-mlo-1024mb.img = start_am33xx_phytec_phycore_r2_sram_1024mb.pblx.mlo +FILE_barebox-am33xx-phytec-phycore-r2-mlo-1024mb.spi.img = start_am33xx_phytec_phycore_r2_sram_1024mb.pblx.mlospi +am33xx-mlo-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-r2-mlo-1024mb.img +am33xx-mlospi-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-r2-mlo-1024mb.spi.img + pblx-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += start_am33xx_phytec_phyflex_sdram FILE_barebox-am33xx-phytec-phyflex.img = start_am33xx_phytec_phyflex_sdram.pblx am33xx-barebox-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phyflex.img diff --git a/images/Makefile.imx b/images/Makefile.imx index 6870bce4ca..0ff317ba07 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -203,6 +203,11 @@ CFG_start_phytec_phyboard_subra_512mb_1bank.pblx.imximg = $(board)/phytec-som-im FILE_barebox-phytec-phyboard-subra-512mb-1bank.img = start_phytec_phyboard_subra_512mb_1bank.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phyboard-subra-512mb-1bank.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phyboard_subra_1gib_1bank +CFG_start_phytec_phyboard_subra_1gib_1bank.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg +FILE_barebox-phytec-phyboard-subra-1gib-1bank.img = start_phytec_phyboard_subra_1gib_1bank.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phyboard-subra-1gib-1bank.img + pblx-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6dl_dfi_fs700_m60_6s CFG_start_imx6dl_dfi_fs700_m60_6s.pblx.imximg = $(board)/dfi-fs700-m60/flash-header-fs700-m60-6s.imxcfg FILE_barebox-dfi-fs700-m60-6s.img = start_imx6dl_dfi_fs700_m60_6s.pblx.imximg @@ -293,6 +298,11 @@ CFG_start_imx6q_tx6x_1g.pblx.imximg = $(board)/karo-tx6x/flash-header-tx6q-1g.im FILE_barebox-karo-imx6q-tx6x-1g.img = start_imx6q_tx6x_1g.pblx.imximg image-$(CONFIG_MACH_TX6X) += barebox-karo-imx6q-tx6x-1g.img +pblx-$(CONFIG_MACH_TX6X) += start_imx6q_tx6x_2g +CFG_start_imx6q_tx6x_2g.pblx.imximg = $(board)/karo-tx6x/flash-header-tx6qp-2g.imxcfg +FILE_barebox-karo-imx6qp-tx6x-2g.img = start_imx6q_tx6x_2g.pblx.imximg +image-$(CONFIG_MACH_TX6X) += barebox-karo-imx6qp-tx6x-2g.img + pblx-$(CONFIG_MACH_UDOO) += start_imx6_udoo CFG_start_imx6_udoo.pblx.imximg = $(board)/udoo/flash-header-mx6-udoo.imxcfg FILE_barebox-udoo-imx6q.img = start_imx6_udoo.pblx.imximg @@ -348,11 +358,21 @@ CFG_start_phytec_phycore_imx6q_som_emmc_1gib.pblx.imximg = $(board)/phytec-som-i FILE_barebox-phytec-phycore-imx6q-som-emmc-1gib.img = start_phytec_phycore_imx6q_som_emmc_1gib.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-1gib.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6q_som_emmc_2gib +CFG_start_phytec_phycore_imx6q_som_emmc_2gib.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg +FILE_barebox-phytec-phycore-imx6q-som-emmc-2gib.img = start_phytec_phycore_imx6q_som_emmc_2gib.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-2gib.img + pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6dl_som_nand_256mb CFG_start_phytec_phycore_imx6dl_som_nand_256mb.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058dl-256mb.imxcfg FILE_barebox-phytec-phycore-imx6dl-som-nand-256mb.img = start_phytec_phycore_imx6dl_som_nand_256mb.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6dl-som-nand-256mb.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6dl_som_emmc_1gib +CFG_start_phytec_phycore_imx6dl_som_emmc_1gib.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg +FILE_barebox-phytec-phycore-imx6dl-som-emmc-1gib.img = start_phytec_phycore_imx6dl_som_emmc_1gib.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6dl-som-emmc-1gib.img + pblx-$(CONFIG_MACH_GW_VENTANA) += start_imx6q_gw54xx_1gx64 CFG_start_imx6q_gw54xx_1gx64.pblx.imximg = $(board)/gateworks-ventana/flash-header-ventana-quad-1gx64.imxcfg FILE_barebox-gateworks-imx6q-ventana-1gx64.img = start_imx6q_gw54xx_1gx64.pblx.imximg diff --git a/images/Makefile.socfpga b/images/Makefile.socfpga index d52b909ff3..7e642c06c9 100644 --- a/images/Makefile.socfpga +++ b/images/Makefile.socfpga @@ -2,7 +2,7 @@ # barebox image generation Makefile for Altera socfpga # -# %.socfpga - convert into socfpga image +# %.socfpgaimg - convert into socfpga image # ---------------------------------------------------------------- quiet_cmd_socfpga_image = SOCFPGA-IMG $@ cmd_socfpga_image = scripts/socfpga_mkimage -b -o $@ $< diff --git a/include/boot.h b/include/boot.h index 0198cc8826..8fcbb7f012 100644 --- a/include/boot.h +++ b/include/boot.h @@ -21,6 +21,11 @@ struct bootm_data { enum bootm_verify verify; bool force; bool dryrun; + /* + * appendroot - if true, try to add a suitable root= Kernel option to + * mount the rootfs from the same device as the Kernel comes from. + */ + bool appendroot; unsigned long initrd_address; unsigned long os_address; unsigned long os_entry; diff --git a/include/fs.h b/include/fs.h index 135cb57be4..6a592893a9 100644 --- a/include/fs.h +++ b/include/fs.h @@ -105,6 +105,7 @@ int flush(int fd); int umount_by_cdev(struct cdev *cdev); /* not-so-standard functions */ +#define ERASE_SIZE_ALL ((loff_t) - 1) int erase(int fd, loff_t count, loff_t offset); int protect(int fd, size_t count, loff_t offset, int prot); int protect_file(const char *file, int prot); diff --git a/include/globalvar.h b/include/globalvar.h index e77209bd79..d0c79c07a8 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -14,6 +14,7 @@ int globalvar_add(const char *name, int (*set)(struct device_d *dev, struct param_d *p, const char *val), const char *(*get)(struct device_d *, struct param_d *p), unsigned long flags); +void globalvar_remove(const char *name); char *globalvar_get_match(const char *match, const char *separator); void globalvar_set_match(const char *match, const char *val); diff --git a/include/string.h b/include/string.h index a833da131b..0c557d6f15 100644 --- a/include/string.h +++ b/include/string.h @@ -4,5 +4,6 @@ #include <linux/string.h> void *memdup(const void *, size_t); +int strtobool(const char *str, int *val); #endif /* __STRING_H */ diff --git a/lib/parameter.c b/lib/parameter.c index ba6b5daead..3d356fb972 100644 --- a/lib/parameter.c +++ b/lib/parameter.c @@ -27,6 +27,7 @@ #include <net.h> #include <malloc.h> #include <driver.h> +#include <string.h> #include <linux/err.h> struct param_d *get_param_by_name(struct device_d *dev, const char *name) @@ -314,10 +315,13 @@ static int param_int_set(struct device_d *dev, struct param_d *p, const char *va if (!val) return -EINVAL; - *pi->value = simple_strtol(val, NULL, 0); - - if (pi->flags & PARAM_INT_FLAG_BOOL) - *pi->value = !!*pi->value; + if (pi->flags & PARAM_INT_FLAG_BOOL) { + ret = strtobool(val, pi->value); + if (ret) + return ret; + } else { + *pi->value = simple_strtol(val, NULL, 0); + } if (!pi->set) return 0; diff --git a/lib/string.c b/lib/string.c index 6a39eb5ced..a3e9fd819b 100644 --- a/lib/string.c +++ b/lib/string.c @@ -739,3 +739,46 @@ void *memdup(const void *orig, size_t size) return buf; } EXPORT_SYMBOL(memdup); + +/** + * strtobool - convert a string to a boolean value + * @str - The string + * @val - The boolean value returned. + * + * This function treats + * - any positive (nonzero) number as true + * - "0" as false + * - "true" (case insensitive) as true + * - "false" (case insensitive) as false + * + * Every other value results in an error and the @val is not + * modified. The caller is expected to initialize @val with the + * correct default before calling strtobool. + * + * Returns 0 for success or negative error code if the variable does + * not exist or contains something this function does not recognize + * as true or false. + */ +int strtobool(const char *str, int *val) +{ + if (!str || !*str) + return -EINVAL; + + if (simple_strtoul(str, NULL, 0) > 0) { + *val = true; + return 0; + } + + if (!strcmp(str, "0") || !strcasecmp(str, "false")) { + *val = false; + return 0; + } + + if (!strcasecmp(str, "true")) { + *val = true; + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL(strtobool); diff --git a/scripts/imx/README b/scripts/imx/README index 0d6d0d03a8..474b387cfc 100644 --- a/scripts/imx/README +++ b/scripts/imx/README @@ -30,6 +30,8 @@ check <width> <cond> <addr> <mask> Poll until condition becomes true. while_all_bits_set, while_any_bit_clear, while_any_bit_set +set_bits <width> <addr> <bits> set <bits> in register <addr> +clear_bits <width> <addr> <bits> clear <bits> in register <addr> the i.MX SoCs support a wide range of fancy things doing with the flash header. We limit ourselves to a very simple case, that is the flash header has a fixed diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c index 16f086af31..0d315a2668 100644 --- a/scripts/imx/imx-image.c +++ b/scripts/imx/imx-image.c @@ -252,8 +252,13 @@ static int add_header_v1(struct config_data *data, void *buf) return 0; } -static int write_mem_v1(uint32_t addr, uint32_t val, int width) +static int write_mem_v1(uint32_t addr, uint32_t val, int width, int set_bits, int clear_bits) { + if (set_bits || clear_bits) { + fprintf(stderr, "This SoC does not support setting/clearing bits\n"); + return -EINVAL; + } + if (curdcd > MAX_DCD - 3) { fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD); return -ENOMEM; @@ -362,12 +367,20 @@ static void check_last_dcd(uint32_t cmd) } } -static int write_mem_v2(uint32_t addr, uint32_t val, int width) +static int write_mem_v2(uint32_t addr, uint32_t val, int width, int set_bits, int clear_bits) { uint32_t cmd; cmd = (TAG_WRITE << 24) | width; + if (set_bits && clear_bits) + return -EINVAL; + + if (set_bits) + cmd |= 3 << 3; + if (clear_bits) + cmd |= 2 << 3; + if (curdcd > MAX_DCD - 3) { fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD); return -ENOMEM; @@ -449,13 +462,14 @@ static int check(struct config_data *data, uint32_t cmd, uint32_t addr, uint32_t return 0; } -static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width) +static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits) { switch (data->header_version) { case 1: - return write_mem_v1(addr, val, width); + return write_mem_v1(addr, val, width, set_bits, clear_bits); case 2: - return write_mem_v2(addr, val, width); + return write_mem_v2(addr, val, width, set_bits, clear_bits); default: return -EINVAL; } diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c index ed27831386..cf9d610823 100644 --- a/scripts/imx/imx-usb-loader.c +++ b/scripts/imx/imx-usb-loader.c @@ -412,7 +412,7 @@ int do_status(void) #define V(a) (((a) >> 24) & 0xff), (((a) >> 16) & 0xff), (((a) >> 8) & 0xff), ((a) & 0xff) -static int read_memory(unsigned addr, unsigned char *dest, unsigned cnt) +static int read_memory(unsigned addr, void *dest, unsigned cnt) { static unsigned char read_reg_command[] = { 1, @@ -506,6 +506,9 @@ static int write_memory(unsigned addr, unsigned val, int width) write_reg_command[4] = (unsigned char)(addr >> 8); write_reg_command[5] = (unsigned char)(addr); + if (verbose > 1) + printf("write memory reg: 0x%08x val: 0x%08x width: %d\n", addr, val, width); + switch (width) { case 1: ds = 0x8; @@ -556,6 +559,31 @@ static int write_memory(unsigned addr, unsigned val, int width) return err; } +static int modify_memory(unsigned addr, unsigned val, int width, int set_bits, int clear_bits) +{ + int err; + + if (set_bits || clear_bits) { + uint32_t r; + + err = read_memory(addr, &r, 4); + if (err < 0) + return err; + + if (verbose > 1) + printf("reg 0x%08x val: 0x%08x %s0x%08x\n", addr, r, + set_bits ? "|= " : "&= ~", val); + + if (set_bits) + r |= val; + if (clear_bits) + r &= ~val; + val = r; + } + + return write_memory(addr, val, 4); +} + static int load_file(void *buf, unsigned len, unsigned dladdr, unsigned char type) { static unsigned char dl_command[] = { @@ -682,15 +710,24 @@ static int write_dcd_table_ivt(struct imx_flash_header_v2 *hdr, unsigned char *f while (dcd < dcd_end) { unsigned s_length = (dcd[1] << 8) + dcd[2]; unsigned char *s_end = dcd + s_length; + int set_bits = 0, clear_bits = 0; - printf("sub dcd length %x\n", s_length); + printf("command: 0x%02x sub dcd length: 0x%04x, flags: 0x%02x\n", dcd[0], s_length, dcd[3]); - if ((dcd[0] != 0xcc) || (dcd[3] != 0x04)) { + if ((dcd[0] != 0xcc)) { printf("Skipping unknown sub tag 0x%02x with len %04x\n", dcd[0], s_length); usleep(50000); dcd += s_length; continue; } + + if (dcd[3] & PARAMETER_FLAG_MASK) { + if (dcd[3] & PARAMETER_FLAG_SET) + set_bits = 1; + else + clear_bits = 1; + } + dcd += 4; if (s_end > dcd_end) { @@ -703,9 +740,8 @@ static int write_dcd_table_ivt(struct imx_flash_header_v2 *hdr, unsigned char *f unsigned val = (dcd[4] << 24) | (dcd[5] << 16) | (dcd[6] << 8) | dcd[7]; dcd += 8; - err = write_memory(addr, val, 4); - if (err < 0) - return err; + + modify_memory(addr, val, 4, set_bits, clear_bits); } } return err; @@ -1203,11 +1239,10 @@ cleanup: return ret; } -static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width) +static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits) { - printf("wr 0x%08x 0x%08x\n", addr, val); - - return write_memory(addr, val, width); + return modify_memory(addr, val, width, set_bits, clear_bits); } static int parse_initfile(const char *filename) diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c index ca653895df..70936babfd 100644 --- a/scripts/imx/imx.c +++ b/scripts/imx/imx.c @@ -130,7 +130,8 @@ static int do_cmd_check(struct config_data *data, int argc, char *argv[]) return data->check(data, cmd, addr, mask); } -static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) +static int write_mem(struct config_data *data, int argc, char *argv[], + int set_bits, int clear_bits) { uint32_t addr, val, width; char *end; @@ -170,7 +171,22 @@ static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) return -EINVAL; }; - return data->write_mem(data, addr, val, width); + return data->write_mem(data, addr, val, width, set_bits, clear_bits); +} + +static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 0, 0); +} + +static int do_cmd_set_bits(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 1, 0); +} + +static int do_cmd_clear_bits(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 0, 1); } static int do_loadaddr(struct config_data *data, int argc, char *argv[]) @@ -338,6 +354,12 @@ struct command cmds[] = { .name = "wm", .parse = do_cmd_write_mem, }, { + .name = "set_bits", + .parse = do_cmd_set_bits, + }, { + .name = "clear_bits", + .parse = do_cmd_clear_bits, + }, { .name = "check", .parse = do_cmd_check, }, { diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h index 85071b4ed3..a1369586a9 100644 --- a/scripts/imx/imx.h +++ b/scripts/imx/imx.h @@ -31,6 +31,8 @@ struct imx_boot_data { #define TAG_DCD_HEADER 0xd2 #define DCD_VERSION 0x40 #define TAG_WRITE 0xcc +#define PARAMETER_FLAG_MASK (1 << 3) +#define PARAMETER_FLAG_SET (1 << 4) #define TAG_CHECK 0xcf struct imx_ivt_header { @@ -64,7 +66,8 @@ struct config_data { int header_version; int cpu_type; int (*check)(struct config_data *data, uint32_t cmd, uint32_t addr, uint32_t mask); - int (*write_mem)(struct config_data *data, uint32_t addr, uint32_t val, int width); + int (*write_mem)(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits); int csf_space; char *csf; }; |