Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Amarula Solutions B.V. |
| 4 | * Copyright (C) 2016 Engicam S.r.l. |
| 5 | * |
Jagan Teki | 8dde736 | 2017-05-12 17:18:28 +0530 | [diff] [blame] | 6 | * Configuration settings for the Engicam i.MX6 SOM Starter Kits. |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 7 | */ |
| 8 | |
Jagan Teki | 8dde736 | 2017-05-12 17:18:28 +0530 | [diff] [blame] | 9 | #ifndef __IMX6_ENGICAM_CONFIG_H |
| 10 | #define __IMX6_ENGICAM_CONFIG_H |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 11 | |
| 12 | #include <linux/sizes.h> |
Simon Glass | fb64e36 | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 13 | #include <linux/stringify.h> |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 14 | #include "mx6_common.h" |
| 15 | |
| 16 | /* Size of malloc() pool */ |
| 17 | #define CONFIG_SYS_MALLOC_LEN (16 * SZ_1M) |
| 18 | |
| 19 | /* Total Size of Environment Sector */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 20 | |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 21 | /* Environment */ |
| 22 | #ifndef CONFIG_ENV_IS_NOWHERE |
| 23 | /* Environment in MMC */ |
| 24 | # if defined(CONFIG_ENV_IS_IN_MMC) |
Jagan Teki | 0313c13 | 2016-10-25 11:53:23 +0530 | [diff] [blame] | 25 | /* Environment in NAND */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 26 | # endif |
| 27 | #endif |
| 28 | |
| 29 | /* Default environment */ |
| 30 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 31 | "script=boot.scr\0" \ |
Jagan Teki | 77df901 | 2016-12-06 00:00:56 +0100 | [diff] [blame] | 32 | "splashpos=m,m\0" \ |
Anatolij Gustschin | bfef4cd | 2019-09-18 17:23:45 +0200 | [diff] [blame] | 33 | "splashimage=" __stringify(CONFIG_LOADADDR) "\0" \ |
Jagan Teki | 7f3ff5e | 2016-12-21 12:00:21 +0100 | [diff] [blame] | 34 | "image=uImage\0" \ |
Jagan Teki | bddd17e | 2016-12-21 12:00:29 +0100 | [diff] [blame] | 35 | "fit_image=fit.itb\0" \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 36 | "fdt_high=0xffffffff\0" \ |
Jagan Teki | d052900 | 2017-05-12 17:18:27 +0530 | [diff] [blame] | 37 | "fdt_addr=" FDT_ADDR "\0" \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 38 | "boot_fdt=try\0" \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 39 | "mmcpart=1\0" \ |
Jagan Teki | 9cb7d03 | 2016-12-21 12:00:25 +0100 | [diff] [blame] | 40 | "nandroot=ubi0:rootfs rootfstype=ubifs\0" \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 41 | "mmcautodetect=yes\0" \ |
| 42 | "mmcargs=setenv bootargs console=${console},${baudrate} " \ |
| 43 | "root=${mmcroot}\0" \ |
Jagan Teki | 9cb7d03 | 2016-12-21 12:00:25 +0100 | [diff] [blame] | 44 | "ubiargs=setenv bootargs console=${console},${baudrate} " \ |
| 45 | "ubi.mtd=5 root=${nandroot} ${mtdparts}\0" \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 46 | "loadbootscript=" \ |
| 47 | "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
| 48 | "bootscript=echo Running bootscript from mmc ...; " \ |
| 49 | "source\0" \ |
| 50 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ |
| 51 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ |
Jagan Teki | bddd17e | 2016-12-21 12:00:29 +0100 | [diff] [blame] | 52 | "loadfit=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${fit_image}\0" \ |
Jagan Teki | 6ff40a4 | 2019-04-26 14:31:46 +0530 | [diff] [blame] | 53 | "altbootcmd=run recoveryboot\0"\ |
Jagan Teki | bddd17e | 2016-12-21 12:00:29 +0100 | [diff] [blame] | 54 | "fitboot=echo Booting FIT image from mmc ...; " \ |
| 55 | "run mmcargs; " \ |
| 56 | "bootm ${loadaddr}\0" \ |
Jagan Teki | 5e53ac0 | 2017-05-07 02:43:00 +0530 | [diff] [blame] | 57 | "_mmcboot=run mmcargs; " \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 58 | "run mmcargs; " \ |
| 59 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 60 | "if run loadfdt; then " \ |
Jagan Teki | 7f3ff5e | 2016-12-21 12:00:21 +0100 | [diff] [blame] | 61 | "bootm ${loadaddr} - ${fdt_addr}; " \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 62 | "else " \ |
| 63 | "if test ${boot_fdt} = try; then " \ |
Jagan Teki | 7f3ff5e | 2016-12-21 12:00:21 +0100 | [diff] [blame] | 64 | "bootm; " \ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 65 | "else " \ |
| 66 | "echo WARN: Cannot load the DT; " \ |
| 67 | "fi; " \ |
| 68 | "fi; " \ |
| 69 | "else " \ |
Jagan Teki | 7f3ff5e | 2016-12-21 12:00:21 +0100 | [diff] [blame] | 70 | "bootm; " \ |
Jagan Teki | 9cb7d03 | 2016-12-21 12:00:25 +0100 | [diff] [blame] | 71 | "fi\0" \ |
Jagan Teki | 5e53ac0 | 2017-05-07 02:43:00 +0530 | [diff] [blame] | 72 | "mmcboot=echo Booting from mmc ...; " \ |
| 73 | "if mmc rescan; then " \ |
| 74 | "if run loadbootscript; then " \ |
| 75 | "run bootscript; " \ |
| 76 | "else " \ |
| 77 | "if run loadfit; then " \ |
| 78 | "run fitboot; " \ |
| 79 | "else " \ |
| 80 | "if run loadimage; then " \ |
| 81 | "run _mmcboot; " \ |
| 82 | "fi; " \ |
| 83 | "fi; " \ |
| 84 | "fi; " \ |
| 85 | "fi\0" \ |
Jagan Teki | 9cb7d03 | 2016-12-21 12:00:25 +0100 | [diff] [blame] | 86 | "nandboot=echo Booting from nand ...; " \ |
| 87 | "if mtdparts; then " \ |
| 88 | "echo Starting nand boot ...; " \ |
| 89 | "else " \ |
| 90 | "mtdparts default; " \ |
| 91 | "fi; " \ |
| 92 | "run ubiargs; " \ |
| 93 | "nand read ${loadaddr} kernel 0x800000; " \ |
| 94 | "nand read ${fdt_addr} dtb 0x100000; " \ |
Jagan Teki | 6ff40a4 | 2019-04-26 14:31:46 +0530 | [diff] [blame] | 95 | "bootm ${loadaddr} - ${fdt_addr}\0" \ |
| 96 | "recoveryboot=if test ${modeboot} = mmcboot; then " \ |
| 97 | "run mmcboot; " \ |
| 98 | "else " \ |
| 99 | "run nandboot; " \ |
| 100 | "fi\0" |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 101 | |
Jagan Teki | 5e53ac0 | 2017-05-07 02:43:00 +0530 | [diff] [blame] | 102 | #define CONFIG_BOOTCOMMAND "run $modeboot" |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 103 | |
| 104 | /* Miscellaneous configurable options */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 105 | |
| 106 | #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR |
| 107 | #define CONFIG_SYS_HZ 1000 |
| 108 | |
Jagan Teki | 8dde736 | 2017-05-12 17:18:28 +0530 | [diff] [blame] | 109 | #ifdef CONFIG_MX6UL |
| 110 | # define DRAM_OFFSET(x) 0x87##x |
| 111 | # define FDT_ADDR __stringify(DRAM_OFFSET(800000)) |
| 112 | #else |
| 113 | # define DRAM_OFFSET(x) 0x1##x |
| 114 | # define FDT_ADDR __stringify(DRAM_OFFSET(8000000)) |
| 115 | #endif |
Jagan Teki | d052900 | 2017-05-12 17:18:27 +0530 | [diff] [blame] | 116 | |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 117 | /* Physical Memory Map */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 118 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 119 | |
| 120 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 121 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 122 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 123 | |
| 124 | #define CONFIG_SYS_INIT_SP_OFFSET (CONFIG_SYS_INIT_RAM_SIZE - \ |
| 125 | GENERATED_GBL_DATA_SIZE) |
| 126 | #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ |
| 127 | CONFIG_SYS_INIT_SP_OFFSET) |
| 128 | |
| 129 | /* UART */ |
| 130 | #ifdef CONFIG_MXC_UART |
Jagan Teki | 8dde736 | 2017-05-12 17:18:28 +0530 | [diff] [blame] | 131 | # ifdef CONFIG_MX6UL |
| 132 | # define CONFIG_MXC_UART_BASE UART1_BASE |
| 133 | # else |
| 134 | # define CONFIG_MXC_UART_BASE UART4_BASE |
| 135 | # endif |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 136 | #endif |
| 137 | |
| 138 | /* MMC */ |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 139 | |
Jagan Teki | 0313c13 | 2016-10-25 11:53:23 +0530 | [diff] [blame] | 140 | /* NAND */ |
| 141 | #ifdef CONFIG_NAND_MXS |
| 142 | # define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 143 | # define CONFIG_SYS_NAND_BASE 0x40000000 |
| 144 | # define CONFIG_SYS_NAND_5_ADDR_CYCLE |
| 145 | # define CONFIG_SYS_NAND_ONFI_DETECTION |
| 146 | # define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_TEXT_BASE |
| 147 | # define CONFIG_SYS_NAND_U_BOOT_OFFS 0x200000 |
| 148 | |
Jagan Teki | 51d7a53 | 2016-10-08 18:00:27 +0530 | [diff] [blame] | 149 | /* MTD device */ |
Jagan Teki | 0313c13 | 2016-10-25 11:53:23 +0530 | [diff] [blame] | 150 | #endif |
| 151 | |
Jagan Teki | 88d8f88 | 2017-08-28 16:45:48 +0530 | [diff] [blame] | 152 | /* Falcon Mode */ |
| 153 | #ifdef CONFIG_SPL_OS_BOOT |
| 154 | # define CONFIG_SPL_FS_LOAD_ARGS_NAME "args" |
| 155 | # define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage" |
Jagan Teki | 88d8f88 | 2017-08-28 16:45:48 +0530 | [diff] [blame] | 156 | # define CONFIG_SYS_SPL_ARGS_ADDR 0x18000000 |
Jagan Teki | 88d8f88 | 2017-08-28 16:45:48 +0530 | [diff] [blame] | 157 | |
| 158 | /* MMC support: args@1MB kernel@2MB */ |
| 159 | # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR 0x800 /* 1MB */ |
| 160 | # define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 512) |
| 161 | # define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR 0x1000 /* 2MB */ |
| 162 | #endif |
| 163 | |
Jagan Teki | b62dc48 | 2016-12-06 00:00:55 +0100 | [diff] [blame] | 164 | /* Framebuffer */ |
| 165 | #ifdef CONFIG_VIDEO_IPUV3 |
Jagan Teki | b62dc48 | 2016-12-06 00:00:55 +0100 | [diff] [blame] | 166 | # define CONFIG_IMX_VIDEO_SKIP |
| 167 | |
Jagan Teki | b62dc48 | 2016-12-06 00:00:55 +0100 | [diff] [blame] | 168 | # define CONFIG_VIDEO_LOGO |
| 169 | # define CONFIG_VIDEO_BMP_LOGO |
| 170 | #endif |
| 171 | |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 172 | /* SPL */ |
| 173 | #ifdef CONFIG_SPL |
Jagan Teki | cd19d31 | 2018-01-10 00:19:52 +0530 | [diff] [blame] | 174 | # ifdef CONFIG_ENV_IS_IN_NAND |
Jagan Teki | 0313c13 | 2016-10-25 11:53:23 +0530 | [diff] [blame] | 175 | # define CONFIG_SPL_NAND_SUPPORT |
| 176 | # else |
| 177 | # define CONFIG_SPL_MMC_SUPPORT |
| 178 | # endif |
| 179 | |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 180 | # include "imx6_spl.h" |
Jagan Teki | 0d6d48b | 2016-10-08 18:00:11 +0530 | [diff] [blame] | 181 | #endif |
| 182 | |
Jagan Teki | 8dde736 | 2017-05-12 17:18:28 +0530 | [diff] [blame] | 183 | #endif /* __IMX6_ENGICAM_CONFIG_H */ |