Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2011 Freescale Semiconductor, Inc. |
| 4 | * Author: Fabio Estevam <fabio.estevam@freescale.com> |
| 5 | * |
| 6 | * Based on m28evk.h: |
| 7 | * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com> |
| 8 | * on behalf of DENX Software Engineering GmbH |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 9 | */ |
Marek Vasut | b51f8ae | 2013-06-16 15:39:02 +0200 | [diff] [blame] | 10 | #ifndef __CONFIGS_MX28EVK_H__ |
| 11 | #define __CONFIGS_MX28EVK_H__ |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 12 | |
Marek Vasut | b51f8ae | 2013-06-16 15:39:02 +0200 | [diff] [blame] | 13 | /* Memory configuration */ |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 14 | #define PHYS_SDRAM_1 0x40000000 /* Base address */ |
| 15 | #define PHYS_SDRAM_1_SIZE 0x40000000 /* Max 1 GB RAM */ |
Tom Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 16 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM_1 |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 17 | |
Marek Vasut | b51f8ae | 2013-06-16 15:39:02 +0200 | [diff] [blame] | 18 | /* UBI and NAND partitioning */ |
Lauri Hintsala | 6f515f7 | 2012-04-17 00:35:46 +0000 | [diff] [blame] | 19 | |
Marek Vasut | b51f8ae | 2013-06-16 15:39:02 +0200 | [diff] [blame] | 20 | /* Extra Environment */ |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 21 | #define CFG_EXTRA_ENV_SETTINGS \ |
Otavio Salvador | c1f9a4d | 2013-12-16 20:44:03 -0200 | [diff] [blame] | 22 | "ubifs_file=filesystem.ubifs\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 23 | "update_nand_full_filename=u-boot.nand\0" \ |
| 24 | "update_nand_firmware_filename=u-boot.sb\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 25 | "update_nand_firmware_maxsz=0x100000\0" \ |
| 26 | "update_nand_stride=0x40\0" /* MX28 datasheet ch. 12.12 */ \ |
| 27 | "update_nand_count=0x4\0" /* MX28 datasheet ch. 12.12 */ \ |
| 28 | "update_nand_get_fcb_size=" /* Get size of FCB blocks */ \ |
| 29 | "nand device 0 ; " \ |
| 30 | "nand info ; " \ |
| 31 | "setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \ |
| 32 | "setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \ |
Otavio Salvador | c1f9a4d | 2013-12-16 20:44:03 -0200 | [diff] [blame] | 33 | "update_nand_firmware_full=" /* Update FCB, DBBT and FW */ \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 34 | "if tftp ${update_nand_full_filename} ; then " \ |
| 35 | "run update_nand_get_fcb_size ; " \ |
| 36 | "nand scrub -y 0x0 ${filesize} ; " \ |
Eric Benard | 1a06819 | 2012-12-11 11:36:21 +0000 | [diff] [blame] | 37 | "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 38 | "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \ |
| 39 | "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \ |
| 40 | "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \ |
| 41 | "fi\0" \ |
| 42 | "update_nand_firmware=" /* Update only firmware */ \ |
| 43 | "if tftp ${update_nand_firmware_filename} ; then " \ |
| 44 | "run update_nand_get_fcb_size ; " \ |
| 45 | "setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \ |
| 46 | "setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \ |
| 47 | "setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \ |
| 48 | "nand erase ${fcb_sz} ${fw_sz} ; " \ |
| 49 | "nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \ |
| 50 | "nand write ${loadaddr} ${fw_off} ${filesize} ; " \ |
| 51 | "fi\0" \ |
Otavio Salvador | c1f9a4d | 2013-12-16 20:44:03 -0200 | [diff] [blame] | 52 | "update_nand_kernel=" /* Update kernel */ \ |
| 53 | "mtdparts default; " \ |
| 54 | "nand erase.part kernel; " \ |
| 55 | "if test ${ip_dyn} = yes; then " \ |
| 56 | "setenv get_cmd dhcp; " \ |
| 57 | "else " \ |
| 58 | "setenv get_cmd tftp; " \ |
| 59 | "fi; " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 60 | "${get_cmd} ${image}; " \ |
Otavio Salvador | c1f9a4d | 2013-12-16 20:44:03 -0200 | [diff] [blame] | 61 | "nand write ${loadaddr} kernel ${filesize}\0" \ |
| 62 | "update_nand_fdt=" /* Update fdt */ \ |
| 63 | "mtdparts default; " \ |
| 64 | "nand erase.part fdt; " \ |
| 65 | "if test ${ip_dyn} = yes; then " \ |
| 66 | "setenv get_cmd dhcp; " \ |
| 67 | "else " \ |
| 68 | "setenv get_cmd tftp; " \ |
| 69 | "fi; " \ |
| 70 | "${get_cmd} ${fdt_file}; " \ |
| 71 | "nand write ${loadaddr} fdt ${filesize}\0" \ |
| 72 | "update_nand_filesystem=" /* Update filesystem */ \ |
| 73 | "mtdparts default; " \ |
| 74 | "nand erase.part filesystem; " \ |
| 75 | "if test ${ip_dyn} = yes; then " \ |
| 76 | "setenv get_cmd dhcp; " \ |
| 77 | "else " \ |
| 78 | "setenv get_cmd tftp; " \ |
| 79 | "fi; " \ |
| 80 | "${get_cmd} ${ubifs_file}; " \ |
| 81 | "ubi part filesystem; " \ |
| 82 | "ubi create filesystem; " \ |
| 83 | "ubi write ${loadaddr} filesystem ${filesize}\0" \ |
Otavio Salvador | a81ab70 | 2013-12-16 20:44:02 -0200 | [diff] [blame] | 84 | "nandargs=setenv bootargs console=${console_mainline},${baudrate} " \ |
| 85 | "rootfstype=ubifs ubi.mtd=6 root=ubi0_0 ${mtdparts}\0" \ |
| 86 | "nandboot=" /* Boot from NAND */ \ |
| 87 | "mtdparts default; " \ |
| 88 | "run nandargs; " \ |
| 89 | "nand read ${loadaddr} kernel 0x00400000; " \ |
| 90 | "if test ${boot_fdt} = yes; then " \ |
| 91 | "nand read ${fdt_addr} fdt 0x00080000; " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 92 | "bootz ${loadaddr} - ${fdt_addr}; " \ |
Otavio Salvador | a81ab70 | 2013-12-16 20:44:02 -0200 | [diff] [blame] | 93 | "else " \ |
| 94 | "if test ${boot_fdt} = no; then " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 95 | "bootz; " \ |
Otavio Salvador | a81ab70 | 2013-12-16 20:44:02 -0200 | [diff] [blame] | 96 | "else " \ |
| 97 | "echo \"ERROR: Set boot_fdt to yes or no.\"; " \ |
| 98 | "fi; " \ |
| 99 | "fi\0" \ |
| 100 | "update_sd_firmware_filename=u-boot.sd\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 101 | "update_sd_firmware=" /* Update the SD firmware partition */ \ |
| 102 | "if mmc rescan ; then " \ |
| 103 | "if tftp ${update_sd_firmware_filename} ; then " \ |
| 104 | "setexpr fw_sz ${filesize} / 0x200 ; " /* SD block size */ \ |
| 105 | "setexpr fw_sz ${fw_sz} + 1 ; " \ |
| 106 | "mmc write ${loadaddr} 0x800 ${fw_sz} ; " \ |
| 107 | "fi ; " \ |
| 108 | "fi\0" \ |
| 109 | "script=boot.scr\0" \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 110 | "image=zImage\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 111 | "console_fsl=ttyAM0\0" \ |
| 112 | "console_mainline=ttyAMA0\0" \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 113 | "fdt_file=imx28-evk.dtb\0" \ |
| 114 | "fdt_addr=0x41000000\0" \ |
| 115 | "boot_fdt=try\0" \ |
| 116 | "ip_dyn=yes\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 117 | "mmcdev=0\0" \ |
| 118 | "mmcpart=2\0" \ |
Otavio Salvador | ac46d56 | 2013-01-10 09:45:05 +0000 | [diff] [blame] | 119 | "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 120 | "mmcargs=setenv bootargs console=${console_mainline},${baudrate} " \ |
Otavio Salvador | ac46d56 | 2013-01-10 09:45:05 +0000 | [diff] [blame] | 121 | "root=${mmcroot}\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 122 | "loadbootscript=" \ |
| 123 | "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ |
| 124 | "bootscript=echo Running bootscript from mmc ...; " \ |
| 125 | "source\0" \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 126 | "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 127 | "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 128 | "mmcboot=echo Booting from mmc ...; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 129 | "run mmcargs; " \ |
| 130 | "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ |
| 131 | "if run loadfdt; then " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 132 | "bootz ${loadaddr} - ${fdt_addr}; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 133 | "else " \ |
| 134 | "if test ${boot_fdt} = try; then " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 135 | "bootz; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 136 | "else " \ |
| 137 | "echo WARN: Cannot load the DT; " \ |
| 138 | "fi; " \ |
| 139 | "fi; " \ |
| 140 | "else " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 141 | "bootz; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 142 | "fi;\0" \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 143 | "netargs=setenv bootargs console=${console_mainline},${baudrate} " \ |
Fabio Estevam | 5ffd3c5 | 2011-12-20 05:46:34 +0000 | [diff] [blame] | 144 | "root=/dev/nfs " \ |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 145 | "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ |
| 146 | "netboot=echo Booting from net ...; " \ |
| 147 | "run netargs; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 148 | "if test ${ip_dyn} = yes; then " \ |
| 149 | "setenv get_cmd dhcp; " \ |
| 150 | "else " \ |
| 151 | "setenv get_cmd tftp; " \ |
| 152 | "fi; " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 153 | "${get_cmd} ${image}; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 154 | "if test ${boot_fdt} = yes; then " \ |
| 155 | "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 156 | "bootz ${loadaddr} - ${fdt_addr}; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 157 | "else " \ |
| 158 | "if test ${boot_fdt} = try; then " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 159 | "bootz; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 160 | "else " \ |
| 161 | "echo WARN: Cannot load the DT; " \ |
| 162 | "fi;" \ |
| 163 | "fi; " \ |
| 164 | "else " \ |
Otavio Salvador | c0c94a2 | 2014-01-16 19:57:59 -0200 | [diff] [blame] | 165 | "bootz; " \ |
Otavio Salvador | 016bb5f | 2013-01-10 09:45:06 +0000 | [diff] [blame] | 166 | "fi;\0" |
Otavio Salvador | e8301fc | 2012-09-15 08:26:17 +0000 | [diff] [blame] | 167 | |
Marek Vasut | b51f8ae | 2013-06-16 15:39:02 +0200 | [diff] [blame] | 168 | /* The rest of the configuration is shared */ |
| 169 | #include <configs/mxs.h> |
| 170 | |
| 171 | #endif /* __CONFIGS_MX28EVK_H__ */ |