1 /* 2 * (C) Copyright 2011 Freescale Semiconductor, Inc. 3 * Author: Fabio Estevam <fabio.estevam@freescale.com> 4 * 5 * Based on m28evk.h: 6 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> 7 * on behalf of DENX Software Engineering GmbH 8 * 9 * SPDX-License-Identifier: GPL-2.0+ 10 */ 11 #ifndef __CONFIGS_MX28EVK_H__ 12 #define __CONFIGS_MX28EVK_H__ 13 14 /* System configurations */ 15 #define CONFIG_MX28 /* i.MX28 SoC */ 16 #define CONFIG_MACH_TYPE MACH_TYPE_MX28EVK 17 18 /* U-Boot Commands */ 19 #define CONFIG_SYS_NO_FLASH 20 #define CONFIG_DOS_PARTITION 21 22 #define CONFIG_CMD_DATE 23 #define CONFIG_CMD_NAND 24 #define CONFIG_CMD_NAND_TRIMFFS 25 #define CONFIG_VIDEO 26 27 /* Memory configuration */ 28 #define CONFIG_NR_DRAM_BANKS 1 /* 1 bank of DRAM */ 29 #define PHYS_SDRAM_1 0x40000000 /* Base address */ 30 #define PHYS_SDRAM_1_SIZE 0x40000000 /* Max 1 GB RAM */ 31 #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1 32 33 /* Environment */ 34 #ifndef CONFIG_ENV_IS_IN_SPI_FLASH 35 #define CONFIG_ENV_SIZE (16 * 1024) 36 #else 37 #define CONFIG_ENV_SIZE (4 * 1024) 38 #endif 39 #define CONFIG_ENV_OVERWRITE 40 41 /* Environment is in MMC */ 42 #if defined(CONFIG_CMD_MMC) && defined(CONFIG_ENV_IS_IN_MMC) 43 #define CONFIG_ENV_OFFSET (256 * 1024) 44 #define CONFIG_SYS_MMC_ENV_DEV 0 45 #endif 46 47 /* Environment is in NAND */ 48 #if defined(CONFIG_CMD_NAND) && defined(CONFIG_ENV_IS_IN_NAND) 49 #define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE 50 #define CONFIG_ENV_SECT_SIZE (128 * 1024) 51 #define CONFIG_ENV_RANGE (512 * 1024) 52 #define CONFIG_ENV_OFFSET 0x300000 53 #define CONFIG_ENV_OFFSET_REDUND \ 54 (CONFIG_ENV_OFFSET + CONFIG_ENV_RANGE) 55 #endif 56 57 /* Environemnt is in SPI flash */ 58 #if defined(CONFIG_CMD_SF) && defined(CONFIG_ENV_IS_IN_SPI_FLASH) 59 #define CONFIG_SYS_REDUNDAND_ENVIRONMENT 60 #define CONFIG_ENV_OFFSET 0x40000 /* 256K */ 61 #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) 62 #define CONFIG_ENV_SECT_SIZE 0x1000 63 #define CONFIG_ENV_SPI_CS 0 64 #define CONFIG_ENV_SPI_BUS 2 65 #define CONFIG_ENV_SPI_MAX_HZ 24000000 66 #define CONFIG_ENV_SPI_MODE SPI_MODE_0 67 #endif 68 69 /* UBI and NAND partitioning */ 70 #ifdef CONFIG_CMD_NAND 71 #define CONFIG_CMD_UBIFS 72 #define CONFIG_CMD_MTDPARTS 73 #define CONFIG_RBTREE 74 #define CONFIG_LZO 75 #define CONFIG_MTD_DEVICE 76 #define CONFIG_MTD_PARTITIONS 77 #define MTDIDS_DEFAULT "nand0=gpmi-nand" 78 #define MTDPARTS_DEFAULT \ 79 "mtdparts=gpmi-nand:" \ 80 "3m(bootloader)ro," \ 81 "512k(environment)," \ 82 "512k(redundant-environment)," \ 83 "4m(kernel)," \ 84 "512k(fdt)," \ 85 "8m(ramdisk)," \ 86 "-(filesystem)" 87 #endif 88 89 /* FEC Ethernet on SoC */ 90 #ifdef CONFIG_CMD_NET 91 #define CONFIG_FEC_MXC 92 #define CONFIG_MX28_FEC_MAC_IN_OCOTP 93 #endif 94 95 /* RTC */ 96 #ifdef CONFIG_CMD_DATE 97 #define CONFIG_RTC_MXS 98 #endif 99 100 /* USB */ 101 #ifdef CONFIG_CMD_USB 102 #define CONFIG_EHCI_MXS_PORT1 103 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 104 #define CONFIG_USB_HOST_ETHER 105 #define CONFIG_USB_ETHER_ASIX 106 #define CONFIG_USB_ETHER_SMSC95XX 107 #endif 108 109 /* SPI */ 110 #ifdef CONFIG_CMD_SPI 111 #define CONFIG_DEFAULT_SPI_BUS 2 112 #define CONFIG_DEFAULT_SPI_MODE SPI_MODE_0 113 114 /* SPI Flash */ 115 #ifdef CONFIG_CMD_SF 116 #define CONFIG_SF_DEFAULT_BUS 2 117 #define CONFIG_SF_DEFAULT_CS 0 118 /* this may vary and depends on the installed chip */ 119 #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0 120 #define CONFIG_SF_DEFAULT_SPEED 24000000 121 #endif 122 123 #endif 124 125 /* Framebuffer support */ 126 #ifdef CONFIG_VIDEO 127 #define CONFIG_VIDEO_LOGO 128 #define CONFIG_SPLASH_SCREEN 129 #define CONFIG_CMD_BMP 130 #define CONFIG_BMP_16BPP 131 #define CONFIG_VIDEO_BMP_RLE8 132 #define CONFIG_VIDEO_BMP_GZIP 133 #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (512 << 10) 134 #endif 135 136 /* Boot Linux */ 137 #define CONFIG_BOOTFILE "uImage" 138 #define CONFIG_LOADADDR 0x42000000 139 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR 140 141 /* Extra Environment */ 142 #define CONFIG_EXTRA_ENV_SETTINGS \ 143 "ubifs_file=filesystem.ubifs\0" \ 144 "update_nand_full_filename=u-boot.nand\0" \ 145 "update_nand_firmware_filename=u-boot.sb\0" \ 146 "update_nand_firmware_maxsz=0x100000\0" \ 147 "update_nand_stride=0x40\0" /* MX28 datasheet ch. 12.12 */ \ 148 "update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ 149 "update_nand_get_fcb_size=" /* Get size of FCB blocks */ \ 150 "nand device 0 ; " \ 151 "nand info ; " \ 152 "setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \ 153 "setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \ 154 "update_nand_firmware_full=" /* Update FCB, DBBT and FW */ \ 155 "if tftp ${update_nand_full_filename} ; then " \ 156 "run update_nand_get_fcb_size ; " \ 157 "nand scrub -y 0x0 ${filesize} ; " \ 158 "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \ 159 "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \ 160 "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \ 161 "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ 162 "fi\0" \ 163 "update_nand_firmware=" /* Update only firmware */ \ 164 "if tftp ${update_nand_firmware_filename} ; then " \ 165 "run update_nand_get_fcb_size ; " \ 166 "setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \ 167 "setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \ 168 "setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \ 169 "nand erase ${fcb_sz} ${fw_sz} ; " \ 170 "nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \ 171 "nand write ${loadaddr} ${fw_off} ${filesize} ; " \ 172 "fi\0" \ 173 "update_nand_kernel=" /* Update kernel */ \ 174 "mtdparts default; " \ 175 "nand erase.part kernel; " \ 176 "if test ${ip_dyn} = yes; then " \ 177 "setenv get_cmd dhcp; " \ 178 "else " \ 179 "setenv get_cmd tftp; " \ 180 "fi; " \ 181 "${get_cmd} ${image}; " \ 182 "nand write ${loadaddr} kernel ${filesize}\0" \ 183 "update_nand_fdt=" /* Update fdt */ \ 184 "mtdparts default; " \ 185 "nand erase.part fdt; " \ 186 "if test ${ip_dyn} = yes; then " \ 187 "setenv get_cmd dhcp; " \ 188 "else " \ 189 "setenv get_cmd tftp; " \ 190 "fi; " \ 191 "${get_cmd} ${fdt_file}; " \ 192 "nand write ${loadaddr} fdt ${filesize}\0" \ 193 "update_nand_filesystem=" /* Update filesystem */ \ 194 "mtdparts default; " \ 195 "nand erase.part filesystem; " \ 196 "if test ${ip_dyn} = yes; then " \ 197 "setenv get_cmd dhcp; " \ 198 "else " \ 199 "setenv get_cmd tftp; " \ 200 "fi; " \ 201 "${get_cmd} ${ubifs_file}; " \ 202 "ubi part filesystem; " \ 203 "ubi create filesystem; " \ 204 "ubi write ${loadaddr} filesystem ${filesize}\0" \ 205 "nandargs=setenv bootargs console=${console_mainline},${baudrate} " \ 206 "rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}\0" \ 207 "nandboot=" /* Boot from NAND */ \ 208 "mtdparts default; " \ 209 "run nandargs; " \ 210 "nand read ${loadaddr} kernel 0x00400000; " \ 211 "if test ${boot_fdt} = yes; then " \ 212 "nand read ${fdt_addr} fdt 0x00080000; " \ 213 "bootz ${loadaddr} - ${fdt_addr}; " \ 214 "else " \ 215 "if test ${boot_fdt} = no; then " \ 216 "bootz; " \ 217 "else " \ 218 "echo \"ERROR: Set boot_fdt to yes or no.\"; " \ 219 "fi; " \ 220 "fi\0" \ 221 "update_sd_firmware_filename=u-boot.sd\0" \ 222 "update_sd_firmware=" /* Update the SD firmware partition */ \ 223 "if mmc rescan ; then " \ 224 "if tftp ${update_sd_firmware_filename} ; then " \ 225 "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ 226 "setexpr fw_sz ${fw_sz} + 1 ; " \ 227 "mmc write ${loadaddr} 0x800 ${fw_sz} ; " \ 228 "fi ; " \ 229 "fi\0" \ 230 "script=boot.scr\0" \ 231 "image=zImage\0" \ 232 "console_fsl=ttyAM0\0" \ 233 "console_mainline=ttyAMA0\0" \ 234 "fdt_file=imx28-evk.dtb\0" \ 235 "fdt_addr=0x41000000\0" \ 236 "boot_fdt=try\0" \ 237 "ip_dyn=yes\0" \ 238 "mmcdev=0\0" \ 239 "mmcpart=2\0" \ 240 "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ 241 "mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \ 242 "root=${mmcroot}\0" \ 243 "loadbootscript=" \ 244 "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ 245 "bootscript=echo Running bootscript from mmc ...; " \ 246 "source\0" \ 247 "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ 248 "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ 249 "mmcboot=echo Booting from mmc ...; " \ 250 "run mmcargs; " \ 251 "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ 252 "if run loadfdt; then " \ 253 "bootz ${loadaddr} - ${fdt_addr}; " \ 254 "else " \ 255 "if test ${boot_fdt} = try; then " \ 256 "bootz; " \ 257 "else " \ 258 "echo WARN: Cannot load the DT; " \ 259 "fi; " \ 260 "fi; " \ 261 "else " \ 262 "bootz; " \ 263 "fi;\0" \ 264 "netargs=setenv bootargs console=${console_mainline},${baudrate} " \ 265 "root=/dev/nfs " \ 266 "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ 267 "netboot=echo Booting from net ...; " \ 268 "run netargs; " \ 269 "if test ${ip_dyn} = yes; then " \ 270 "setenv get_cmd dhcp; " \ 271 "else " \ 272 "setenv get_cmd tftp; " \ 273 "fi; " \ 274 "${get_cmd} ${image}; " \ 275 "if test ${boot_fdt} = yes; then " \ 276 "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ 277 "bootz ${loadaddr} - ${fdt_addr}; " \ 278 "else " \ 279 "if test ${boot_fdt} = try; then " \ 280 "bootz; " \ 281 "else " \ 282 "echo WARN: Cannot load the DT; " \ 283 "fi;" \ 284 "fi; " \ 285 "else " \ 286 "bootz; " \ 287 "fi;\0" 288 289 #define CONFIG_BOOTCOMMAND \ 290 "mmc dev ${mmcdev}; if mmc rescan; then " \ 291 "if run loadbootscript; then " \ 292 "run bootscript; " \ 293 "else " \ 294 "if run loadimage; then " \ 295 "run mmcboot; " \ 296 "else run netboot; " \ 297 "fi; " \ 298 "fi; " \ 299 "else run netboot; fi" 300 301 /* The rest of the configuration is shared */ 302 #include <configs/mxs.h> 303 304 #endif /* __CONFIGS_MX28EVK_H__ */ 305