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