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