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