Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 2 | /* |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 3 | * Copyright (C) 2018 |
| 4 | * Lukasz Majewski, DENX Software Engineering, lukma@denx.de |
| 5 | * |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 6 | * Copyright 2016 3ADEV <http://3adev.com> |
| 7 | * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr> |
| 8 | * |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 9 | * Configuration settings for BK4R1. |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 10 | */ |
| 11 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 12 | #ifndef __CONFIG_H |
| 13 | #define __CONFIG_H |
| 14 | |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 15 | /* Define the BK4r1-specific env commands */ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 16 | #define BK4_EXTRA_ENV_SETTINGS \ |
| 17 | "bootlimit=3\0" \ |
| 18 | "eraseuserdata=false\0" \ |
| 19 | "altbootcmd=led 5 on; " \ |
| 20 | "boot\0" \ |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 21 | "set_gpio103=mw 0x400ff0c4 0x0080; mw 0x4004819C 0x000011bf\0" \ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 22 | "set_gpio102=mw 0x400ff0c4 0x40; mw 0x40048198 0x000011bf\0" \ |
| 23 | "set_gpio96=mw 0x40048180 0x282; mw 0x400ff0c4 0x1\0"\ |
| 24 | "set_gpio122=mw 0x400481e8 0x0282; mw 0x400ff0c4 0x04000000\0"\ |
| 25 | "set_gpio6=mw 0x40048018 0x282; mw 0x400ff008 0x40\0"\ |
| 26 | "manage_userdata=" MANAGE_USERDATA "\0"\ |
| 27 | "ncenable=true\0"\ |
| 28 | "ncserverip=192.168.0.77\0"\ |
| 29 | "if_netconsole=ping $ncserverip\0"\ |
| 30 | "start_netconsole=setenv ncip $serverip; setenv bootdelay 10;" \ |
| 31 | "setenv stdin nc; setenv stdout nc; setenv stderr nc; version;\0" \ |
| 32 | "preboot=" BK4_NET_INIT \ |
| 33 | "if ${ncenable}; then run if_netconsole start_netconsole; fi\0" |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 34 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 35 | /* Enable PREBOOT variable */ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 36 | |
| 37 | /* Set ARP_TIMEOUT to 500ms */ |
| 38 | #define CONFIG_ARP_TIMEOUT 500UL |
| 39 | |
| 40 | /* Set ARP_TIMEOUT_COUNT to 3 repetitions */ |
| 41 | #define CONFIG_NET_RETRY_COUNT 5 |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 42 | |
| 43 | /* BK4r1 net init sets GPIO122/PTE17 to enable Ethernet */ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 44 | #define BK4_NET_INIT "run set_gpio122;" |
| 45 | |
| 46 | /* Check if userdata volume shall be erased */ |
| 47 | #define MANAGE_USERDATA "if ${eraseuserdata}; " \ |
| 48 | "then ubi part system; " \ |
| 49 | "ubi remove userdata; " \ |
| 50 | "ubi create userdata; " \ |
| 51 | "ubi detach; " \ |
| 52 | "setenv eraseuserdata false; " \ |
| 53 | "saveenv; " \ |
| 54 | "fi; " |
| 55 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 56 | #include <asm/arch/imx-regs.h> |
| 57 | #include <linux/sizes.h> |
| 58 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 59 | /* NAND support */ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 60 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
Albert ARIBAUD \(3ADEV\) | ddef3b6 | 2016-09-26 09:08:08 +0200 | [diff] [blame] | 61 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 62 | #define IMX_FEC1_BASE ENET1_BASE_ADDR |
| 63 | |
| 64 | /* QSPI Configs*/ |
| 65 | #ifdef CONFIG_FSL_QSPI |
| 66 | #define FSL_QSPI_FLASH_SIZE (SZ_16M) |
| 67 | #define FSL_QSPI_FLASH_NUM 2 |
| 68 | #define CONFIG_SYS_FSL_QSPI_LE |
| 69 | #endif |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 70 | |
| 71 | /* We boot from the gfxRAM area of the OCRAM. */ |
| 72 | #define CONFIG_BOARD_SIZE_LIMIT 520192 |
| 73 | |
| 74 | /* boot command, including the target-defined one if any */ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 75 | |
| 76 | /* Extra env settings (including the target-defined ones if any) */ |
| 77 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 78 | BK4_EXTRA_ENV_SETTINGS \ |
| 79 | "autoload=no\0" \ |
| 80 | "fdt_high=0xffffffff\0" \ |
| 81 | "initrd_high=0xffffffff\0" \ |
| 82 | "blimg_file=u-boot.vyb\0" \ |
| 83 | "blimg_addr=0x81000000\0" \ |
| 84 | "dtbkernel_file=fitImage\0" \ |
| 85 | "dtbkernel_addr=0x82000000\0" \ |
| 86 | "ram_file=uRamdisk\0" \ |
| 87 | "ram_addr=0x83000000\0" \ |
| 88 | "filesys=rootfs.ubifs\0" \ |
| 89 | "sys_addr=0x81000000\0" \ |
| 90 | "nfs_root=/path/to/nfs/root\0" \ |
| 91 | "tftptimeout=1000\0" \ |
| 92 | "tftptimeoutcountmax=1000000\0" \ |
| 93 | "mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \ |
| 94 | "ipaddr=192.168.0.60\0" \ |
| 95 | "serverip=192.168.0.1\0" \ |
| 96 | "bootargs_base=setenv bootargs rw " \ |
| 97 | "console=ttyLP1,115200n8\0" \ |
| 98 | "bootargs_sd=setenv bootargs ${bootargs} " \ |
| 99 | "root=/dev/mmcblk0p2 rootwait\0" \ |
| 100 | "bootargs_nand=setenv bootargs ${bootargs} " \ |
| 101 | "ubi.mtd=5 rootfstype=" \ |
| 102 | "ubifs root=ubi0:rootfs${active_workset}\0" \ |
| 103 | "bootargs_ram=setenv bootargs ${bootargs} " \ |
| 104 | "root=/dev/ram rw initrd=${ram_addr}\0" \ |
| 105 | "bootargs_mtd=setenv bootargs ${bootargs} ${mtdparts}\0" \ |
| 106 | "bootcmd_sd=run bootargs_base bootargs_sd bootargs_mtd; " \ |
| 107 | "fatload mmc 0:2 ${dtbkernel_addr} ${dtbkernel_file}; " \ |
| 108 | "bootm ${dtbkernel_addr}\0" \ |
| 109 | "bootcmd_nand=sf probe;run bootargs_base bootargs_nand bootargs_mtd; " \ |
| 110 | "ubi part dtbkernel; " \ |
| 111 | "ubi readvol ${dtbkernel_addr} dtbkernel${active_workset}; " \ |
| 112 | "led 0 on; " \ |
| 113 | "bootm ${dtbkernel_addr}\0" \ |
| 114 | "bootcmd_ram=run bootargs_base bootargs_ram bootargs_mtd; " \ |
| 115 | "nand read ${fdt_addr} dtb; " \ |
| 116 | "nand read ${kernel_addr} kernel; " \ |
| 117 | "nand read ${ram_addr} root; " \ |
| 118 | "bootz ${kernel_addr} ${ram_addr} ${fdt_addr}\0" \ |
| 119 | "update_bootloader_from_sd=if fatload mmc 0:2 ${blimg_addr} " \ |
| 120 | "${blimg_file}; " \ |
| 121 | "then sf probe; " \ |
| 122 | "mtdparts default; " \ |
| 123 | "nand erase.part bootloader; " \ |
| 124 | "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \ |
| 125 | "update_bootloader_from_tftp=if tftp ${blimg_addr} "\ |
| 126 | "${tftpdir}${blimg_file}; "\ |
| 127 | "then sf probe; " \ |
| 128 | "mtdparts default; " \ |
| 129 | "nand erase.part bootloader; " \ |
| 130 | "nand write ${blimg_addr} bootloader ${filesize}; fi\0" \ |
| 131 | "update_dtbkernel_from_sd=if fatload mmc 0:2 ${dtbkernel_addr} " \ |
| 132 | "${dtbkernel_file}; " \ |
| 133 | "then sf probe; " \ |
| 134 | "ubi part dtbkernel; " \ |
| 135 | "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \ |
| 136 | "${filesize}; " \ |
| 137 | "ubi detach; fi\0" \ |
| 138 | "update_dtbkernel_from_tftp=if tftp ${dtbkernel_addr} " \ |
| 139 | "${tftpdir}${dtbkernel_file}; " \ |
| 140 | "then sf probe; " \ |
| 141 | "ubi part dtbkernel; " \ |
| 142 | "ubi write ${dtbkernel_addr} dtbkernel${active_workset} " \ |
| 143 | "${filesize}; " \ |
| 144 | "ubi detach; fi\0" \ |
| 145 | "update_ramdisk_from_sd=if fatload mmc 0:2 ${ram_addr} " \ |
| 146 | "${ram_file}; " \ |
| 147 | "then sf probe; " \ |
| 148 | "mtdparts default; " \ |
| 149 | "nand erase.part initrd; " \ |
| 150 | "nand write ${ram_addr} initrd ${filesize}; fi\0" \ |
| 151 | "update_ramdisk_from_tftp=if tftp ${ram_addr} ${tftpdir}${ram_file}; " \ |
| 152 | "then sf probe; " \ |
| 153 | "nand erase.part initrd; " \ |
| 154 | "nand write ${ram_addr} initrd ${filesize}; fi\0" \ |
| 155 | "update_rootfs_from_sd=if fatload mmc 0:2 ${sys_addr} " \ |
| 156 | "${filesys}; " \ |
| 157 | "then sf probe; " \ |
| 158 | "ubi part system; " \ |
| 159 | "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \ |
| 160 | "ubi detach; fi\0" \ |
| 161 | "update_rootfs_from_tftp=if tftp ${sys_addr} ${tftpdir}${filesys}; " \ |
| 162 | "then sf probe; " \ |
| 163 | "ubi part system; " \ |
| 164 | "ubi write ${sys_addr} rootfs${active_workset} ${filesize}; " \ |
| 165 | "ubi detach; fi\0" \ |
Lukasz Majewski | ad3d7a7 | 2019-02-13 22:46:54 +0100 | [diff] [blame] | 166 | "setup_dtbkernel=nand erase.part dtbkernel; " \ |
| 167 | "ubi part dtbkernel; " \ |
| 168 | "ubi create dtbkernel1 972000 s; " \ |
| 169 | "ubi create dtbkernel2 972000 s; " \ |
| 170 | "ubi detach\0" \ |
| 171 | "setup_system=nand erase.part system; " \ |
| 172 | "ubi part system; " \ |
| 173 | "ubi create rootfs1 15E15000 d; " \ |
| 174 | "ubi create rootfs2 15E15000 d; " \ |
| 175 | "ubi create userdata; " \ |
| 176 | "ubi detach\0" \ |
Lukasz Majewski | 9050cfc | 2019-02-13 22:46:55 +0100 | [diff] [blame] | 177 | "setup_nor1=" BK4_NET_INIT \ |
| 178 | "if tftp ${sys_addr} ${tftpdir}ubinor1.img; " \ |
| 179 | "then sf probe 0:0; " \ |
| 180 | "sf erase 0 01000000; " \ |
| 181 | "mtdparts default; " \ |
| 182 | "ubi part nor; " \ |
| 183 | "ubi create nor1fs; " \ |
| 184 | "ubi write ${sys_addr} nor1fs ${filesize}; " \ |
| 185 | "ubi detach; fi\0" \ |
| 186 | "setup_nor2=" BK4_NET_INIT \ |
| 187 | "if tftp ${sys_addr} ${tftpdir}ubinor2.img; " \ |
| 188 | "then sf probe 0:1; " \ |
| 189 | "sf erase 0 01000000; " \ |
| 190 | "mtdparts default; " \ |
| 191 | "ubi part nor; " \ |
| 192 | "ubi create nor2fs; " \ |
| 193 | "ubi write ${sys_addr} nor2fs ${filesize}; " \ |
| 194 | "ubi detach; fi\0" \ |
Lukasz Majewski | ad3d7a7 | 2019-02-13 22:46:54 +0100 | [diff] [blame] | 195 | "prepare_install_bk4r1_envs=" \ |
| 196 | "echo 'Preparing envs for SD card recovery!';" \ |
| 197 | "setenv ipaddr 192.168.0.99;" \ |
| 198 | "setenv serverip 192.168.0.50;" \ |
| 199 | "\0" \ |
| 200 | "install_bk4r1rs="\ |
| 201 | "led 0 on; " \ |
| 202 | "nand erase.chip; mtdparts default; "\ |
| 203 | "led 1 on; "\ |
| 204 | "run setup_dtbkernel; " \ |
| 205 | "run setup_system; " \ |
| 206 | "led 2 on;" \ |
| 207 | "run update_bootloader_from_sd; "\ |
| 208 | "run update_dtbkernel_from_sd; "\ |
| 209 | "run update_rootfs_from_sd; "\ |
| 210 | "setenv bootcmd 'run bootcmd_nand'; "\ |
| 211 | "saveenv; " \ |
| 212 | "led 3 on; " \ |
| 213 | "echo Finished - Please Power off, REMOVE SDCARD and set boot" \ |
| 214 | "source to NAND\0" \ |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 215 | "active_workset=1\0" |
| 216 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 217 | /* Physical memory map */ |
| 218 | #define PHYS_SDRAM (0x80000000) |
| 219 | #define PHYS_SDRAM_SIZE (SZ_512M) |
| 220 | |
| 221 | #define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM |
| 222 | #define CONFIG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 223 | #define CONFIG_SYS_INIT_RAM_SIZE IRAM_SIZE |
| 224 | |
| 225 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
| 226 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
| 227 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 228 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
| 229 | |
Lukasz Majewski | 8c6248c | 2019-02-13 22:46:52 +0100 | [diff] [blame] | 230 | #endif /* __CONFIG_H */ |