1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright (C) 2012-2015 Panasonic Corporation 4 * Copyright (C) 2015-2016 Socionext Inc. 5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com> 6 */ 7 8 /* U-Boot - Common settings for UniPhier Family */ 9 10 #ifndef __CONFIG_UNIPHIER_COMMON_H__ 11 #define __CONFIG_UNIPHIER_COMMON_H__ 12 13 #define CONFIG_ARMV7_PSCI_1_0 14 15 /*----------------------------------------------------------------------- 16 * MMU and Cache Setting 17 *----------------------------------------------------------------------*/ 18 19 /* Comment out the following to enable L1 cache */ 20 /* #define CONFIG_SYS_ICACHE_OFF */ 21 /* #define CONFIG_SYS_DCACHE_OFF */ 22 23 #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) 24 25 #define CONFIG_TIMESTAMP 26 27 /* FLASH related */ 28 29 #define CONFIG_FLASH_CFI_DRIVER 30 #define CONFIG_SYS_FLASH_CFI 31 32 #define CONFIG_SYS_MAX_FLASH_SECT 256 33 #define CONFIG_SYS_MONITOR_BASE 0 34 #define CONFIG_SYS_MONITOR_LEN 0x00090000 /* 576KB */ 35 #define CONFIG_SYS_FLASH_BASE 0 36 37 /* 38 * flash_toggle does not work for our support card. 39 * We need to use flash_status_poll. 40 */ 41 #define CONFIG_SYS_CFI_FLASH_STATUS_POLL 42 43 #define CONFIG_FLASH_SHOW_PROGRESS 45 /* count down from 45/5: 9..1 */ 44 45 #define CONFIG_SYS_MAX_FLASH_BANKS_DETECT 1 46 47 /* serial console configuration */ 48 49 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ 50 /* Boot Argument Buffer Size */ 51 #define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE) 52 53 #define CONFIG_ENV_OFFSET 0x100000 54 #define CONFIG_ENV_SIZE 0x2000 55 /* #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) */ 56 57 #define CONFIG_SYS_MMC_ENV_DEV 0 58 #define CONFIG_SYS_MMC_ENV_PART 1 59 60 #if !defined(CONFIG_ARM64) 61 /* Time clock 1MHz */ 62 #define CONFIG_SYS_TIMER_RATE 1000000 63 #endif 64 65 #define CONFIG_SYS_MAX_NAND_DEVICE 1 66 #define CONFIG_SYS_NAND_ONFI_DETECTION 67 #define CONFIG_SYS_NAND_REGS_BASE 0x68100000 68 #define CONFIG_SYS_NAND_DATA_BASE 0x68000000 69 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0 70 71 /* SD/MMC */ 72 #define CONFIG_SUPPORT_EMMC_BOOT 73 74 /* memtest works on */ 75 #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE 76 #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x01000000) 77 78 /* 79 * Network Configuration 80 */ 81 #define CONFIG_SERVERIP 192.168.11.1 82 #define CONFIG_IPADDR 192.168.11.10 83 #define CONFIG_GATEWAYIP 192.168.11.1 84 #define CONFIG_NETMASK 255.255.255.0 85 86 #define CONFIG_LOADADDR 0x85000000 87 #define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR 88 #define CONFIG_SYS_BOOTM_LEN (32 << 20) 89 90 #if defined(CONFIG_ARM64) 91 /* ARM Trusted Firmware */ 92 #define BOOT_IMAGES \ 93 "second_image=unph_bl.bin\0" \ 94 "third_image=fip.bin\0" 95 #else 96 #define BOOT_IMAGES \ 97 "second_image=u-boot-spl.bin\0" \ 98 "third_image=u-boot.bin\0" 99 #endif 100 101 #define CONFIG_BOOTCOMMAND "run $bootmode" 102 103 #define CONFIG_ROOTPATH "/nfs/root/path" 104 #define CONFIG_NFSBOOTCOMMAND \ 105 "setenv bootargs $bootargs root=/dev/nfs rw " \ 106 "nfsroot=$serverip:$rootpath " \ 107 "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off;" \ 108 "run __nfsboot" 109 110 #ifdef CONFIG_FIT 111 #define CONFIG_BOOTFILE "fitImage" 112 #define LINUXBOOT_ENV_SETTINGS \ 113 "fit_addr=0x00100000\0" \ 114 "fit_addr_r=0x85100000\0" \ 115 "fit_size=0x00f00000\0" \ 116 "norboot=setexpr fit_addr $nor_base + $fit_addr &&" \ 117 "bootm $fit_addr\0" \ 118 "nandboot=nand read $fit_addr_r $fit_addr $fit_size &&" \ 119 "bootm $fit_addr_r\0" \ 120 "tftpboot=tftpboot $fit_addr_r $bootfile &&" \ 121 "bootm $fit_addr_r\0" \ 122 "__nfsboot=run tftpboot\0" 123 #else 124 #ifdef CONFIG_ARM64 125 #define CONFIG_BOOTFILE "Image.gz" 126 #define LINUXBOOT_CMD "booti" 127 #define KERNEL_ADDR_LOAD "kernel_addr_load=0x85200000\0" 128 #define KERNEL_ADDR_R "kernel_addr_r=0x82080000\0" 129 #else 130 #define CONFIG_BOOTFILE "zImage" 131 #define LINUXBOOT_CMD "bootz" 132 #define KERNEL_ADDR_LOAD "kernel_addr_load=0x80208000\0" 133 #define KERNEL_ADDR_R "kernel_addr_r=0x80208000\0" 134 #endif 135 #define LINUXBOOT_ENV_SETTINGS \ 136 "fdt_addr=0x00100000\0" \ 137 "fdt_addr_r=0x85100000\0" \ 138 "fdt_size=0x00008000\0" \ 139 "kernel_addr=0x00200000\0" \ 140 KERNEL_ADDR_LOAD \ 141 KERNEL_ADDR_R \ 142 "kernel_size=0x00e00000\0" \ 143 "ramdisk_addr=0x01000000\0" \ 144 "ramdisk_addr_r=0x86000000\0" \ 145 "ramdisk_size=0x00800000\0" \ 146 "ramdisk_file=rootfs.cpio.uboot\0" \ 147 "boot_common=setexpr bootm_low $kernel_addr_r '&' fe000000 && " \ 148 "if test $kernel_addr_load = $kernel_addr_r; then " \ 149 "true; " \ 150 "else " \ 151 "unzip $kernel_addr_load $kernel_addr_r; " \ 152 "fi && " \ 153 LINUXBOOT_CMD " $kernel_addr_r $ramdisk_addr_r $fdt_addr_r\0" \ 154 "norboot=setexpr kernel_addr_nor $nor_base + $kernel_addr && " \ 155 "setexpr kernel_size_div4 $kernel_size / 4 && " \ 156 "cp $kernel_addr_nor $kernel_addr_load $kernel_size_div4 && " \ 157 "setexpr ramdisk_addr_nor $nor_base + $ramdisk_addr && " \ 158 "setexpr ramdisk_size_div4 $ramdisk_size / 4 && " \ 159 "cp $ramdisk_addr_nor $ramdisk_addr_r $ramdisk_size_div4 && " \ 160 "setexpr fdt_addr_nor $nor_base + $fdt_addr && " \ 161 "setexpr fdt_size_div4 $fdt_size / 4 && " \ 162 "cp $fdt_addr_nor $fdt_addr_r $fdt_size_div4 && " \ 163 "run boot_common\0" \ 164 "nandboot=nand read $kernel_addr_load $kernel_addr $kernel_size && " \ 165 "nand read $ramdisk_addr_r $ramdisk_addr $ramdisk_size &&" \ 166 "nand read $fdt_addr_r $fdt_addr $fdt_size &&" \ 167 "run boot_common\0" \ 168 "tftpboot=tftpboot $kernel_addr_load $bootfile && " \ 169 "tftpboot $ramdisk_addr_r $ramdisk_file &&" \ 170 "tftpboot $fdt_addr_r $fdtfile &&" \ 171 "run boot_common\0" \ 172 "__nfsboot=tftpboot $kernel_addr_load $bootfile && " \ 173 "tftpboot $fdt_addr_r $fdtfile &&" \ 174 "setenv ramdisk_addr_r - &&" \ 175 "run boot_common\0" 176 #endif 177 178 #define CONFIG_EXTRA_ENV_SETTINGS \ 179 "netdev=eth0\0" \ 180 "initrd_high=0xffffffffffffffff\0" \ 181 "nor_base=0x42000000\0" \ 182 "sramupdate=setexpr tmp_addr $nor_base + 0x50000 &&" \ 183 "tftpboot $tmp_addr $second_image && " \ 184 "setexpr tmp_addr $nor_base + 0x70000 && " \ 185 "tftpboot $tmp_addr $third_image\0" \ 186 "emmcupdate=mmcsetn &&" \ 187 "mmc dev $mmc_first_dev &&" \ 188 "mmc partconf $mmc_first_dev 0 1 1 &&" \ 189 "tftpboot $second_image && " \ 190 "mmc write $loadaddr 0 100 && " \ 191 "tftpboot $third_image && " \ 192 "mmc write $loadaddr 100 f00\0" \ 193 "nandupdate=nand erase 0 0x00100000 &&" \ 194 "tftpboot $second_image && " \ 195 "nand write $loadaddr 0 0x00020000 && " \ 196 "tftpboot $third_image && " \ 197 "nand write $loadaddr 0x00020000 0x001e0000\0" \ 198 "usbupdate=usb start &&" \ 199 "tftpboot $second_image && " \ 200 "usb write $loadaddr 0 100 && " \ 201 "tftpboot $third_image && " \ 202 "usb write $loadaddr 100 f00\0" \ 203 BOOT_IMAGES \ 204 LINUXBOOT_ENV_SETTINGS 205 206 #define CONFIG_SYS_BOOTMAPSZ 0x20000000 207 208 #define CONFIG_SYS_SDRAM_BASE 0x80000000 209 #define CONFIG_NR_DRAM_BANKS 3 210 211 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE) 212 213 /* only for SPL */ 214 #if defined(CONFIG_ARCH_UNIPHIER_LD4) || \ 215 defined(CONFIG_ARCH_UNIPHIER_SLD8) 216 #define CONFIG_SPL_TEXT_BASE 0x00040000 217 #else 218 #define CONFIG_SPL_TEXT_BASE 0x00100000 219 #endif 220 221 #define CONFIG_SPL_STACK (0x00200000) 222 223 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x20000 224 225 /* subtract sizeof(struct image_header) */ 226 #define CONFIG_SYS_UBOOT_BASE (0x70000 - 0x40) 227 228 #define CONFIG_SPL_TARGET "u-boot-with-spl.bin" 229 #define CONFIG_SPL_MAX_FOOTPRINT 0x10000 230 #define CONFIG_SPL_MAX_SIZE 0x10000 231 #define CONFIG_SPL_BSS_MAX_SIZE 0x2000 232 233 #define CONFIG_SPL_PAD_TO 0x20000 234 235 #endif /* __CONFIG_UNIPHIER_COMMON_H__ */ 236