Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0+ |
| 2 | * |
| 3 | * Copyright (C) Guangzhou FriendlyARM Computer Tech. Co., Ltd. |
| 4 | * (http://www.friendlyarm.com) |
| 5 | * |
| 6 | * (C) Copyright 2016 Nexell |
| 7 | * Hyejung Kwon <cjscld15@nexell.co.kr> |
| 8 | * |
| 9 | * Copyright (C) 2019 Stefan Bosch <stefan_b@posteo.net> |
| 10 | */ |
| 11 | |
| 12 | #ifndef __CONFIG_H__ |
| 13 | #define __CONFIG_H__ |
| 14 | |
| 15 | #include <linux/sizes.h> |
| 16 | #include <asm/arch/nexell.h> |
| 17 | |
| 18 | /*----------------------------------------------------------------------- |
| 19 | * System memory Configuration |
| 20 | */ |
| 21 | #define CONFIG_SYS_INIT_SP_ADDR CONFIG_SYS_TEXT_BASE |
| 22 | #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE |
| 23 | #define CONFIG_SYS_MEM_SIZE 0x40000000 |
| 24 | #define CONFIG_SYS_SDRAM_BASE 0x71000000 |
| 25 | |
| 26 | /* |
| 27 | * "(CONFIG_SYS_MEM_SIZE - CONFIG_SYS_RESERVE_MEM_SIZE)" has been used in |
| 28 | * u-boot nanopi2-v2016.01. |
| 29 | * This is not working anymore because boot_fdt_add_mem_rsv_regions() in |
| 30 | * common/image-fdt.c has been extended: |
| 31 | * Also reserved-memory sections are marked as unusable. |
| 32 | * |
| 33 | * In friendlyArm Ubuntu 16.04 source arch/arm/boot/dts/s5p4418.dtsi: |
| 34 | * reserved-memory { |
| 35 | * #address-cells = <1>; |
| 36 | * #size-cells = <1>; |
| 37 | * ranges; |
| 38 | * |
| 39 | * secure_memory@b0000000 { |
| 40 | * reg = <0xB0000000 0x1000000>; |
| 41 | * nop-map; |
| 42 | * }; |
| 43 | * }; |
| 44 | * |
| 45 | * arch_lmb_reserve() of arch/arm/lib/bootm.c: |
| 46 | * "Allocate space for command line and board info - ... below the current |
| 47 | * stack pointer." |
| 48 | * --> Memory allocated would overlap with "secure_memory@b0000000" |
| 49 | * --> lmb_add_region(rgn, base==0xb0000000, size==0x1000000) fails, |
| 50 | * boot output: |
| 51 | * ... |
| 52 | * Kernel image @ 0x71080000 [ 0x000000 - 0x60e628 ] |
| 53 | * ## Flattened Device Tree blob at 7a000000 |
| 54 | * Booting using the fdt blob at 0x7a000000 |
| 55 | * ERROR: reserving fdt memory region failed (addr=b0000000 size=1000000) |
| 56 | * Using Device Tree in place at 7a000000, end 7a00fbf0 |
| 57 | * |
| 58 | * Starting kernel ... |
| 59 | * ... |
| 60 | */ |
| 61 | #define CONFIG_SYS_SDRAM_SIZE (0xb0000000 - CONFIG_SYS_SDRAM_BASE) |
| 62 | |
| 63 | #define CONFIG_SYS_MALLOC_LEN (32 * 1024 * 1024) |
| 64 | |
| 65 | #define BMP_LOAD_ADDR 0x78000000 |
| 66 | |
| 67 | /* kernel load address */ |
| 68 | #define CONFIG_SYS_LOAD_ADDR 0x71080000 |
| 69 | #define INITRD_START 0x79000000 |
| 70 | #define KERNEL_DTB_ADDR 0x7A000000 |
| 71 | |
| 72 | /*----------------------------------------------------------------------- |
| 73 | * High Level System Configuration |
| 74 | */ |
| 75 | /* Not used: not need IRQ/FIQ stuff */ |
| 76 | #undef CONFIG_USE_IRQ |
| 77 | /* decrementer freq: 1ms ticks */ |
| 78 | #define CONFIG_SYS_HZ 1000 |
| 79 | |
| 80 | /*----------------------------------------------------------------------- |
| 81 | * System initialize options (board_init_f) |
| 82 | */ |
| 83 | /* board_init_f->init_sequence, call arch_cpu_init */ |
| 84 | #define CONFIG_ARCH_CPU_INIT |
| 85 | |
| 86 | /*----------------------------------------------------------------------- |
| 87 | * Miscellaneous configurable options |
| 88 | */ |
| 89 | #ifdef CONFIG_SYS_PROMPT |
| 90 | #undef CONFIG_SYS_PROMPT |
| 91 | /* Monitor Command Prompt */ |
| 92 | #define CONFIG_SYS_PROMPT "nanopi2# " |
| 93 | #endif |
| 94 | |
| 95 | /* Console I/O Buffer Size */ |
| 96 | #define CONFIG_SYS_CBSIZE 1024 |
| 97 | /* Print Buffer Size */ |
| 98 | #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ |
| 99 | sizeof(CONFIG_SYS_PROMPT) + 16) |
| 100 | /* max number of command args */ |
| 101 | #define CONFIG_SYS_MAXARGS 16 |
| 102 | /* Boot Argument Buffer Size */ |
| 103 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
| 104 | |
| 105 | /*----------------------------------------------------------------------- |
| 106 | * allow to overwrite serial and ethaddr |
| 107 | */ |
| 108 | #define CONFIG_ENV_OVERWRITE |
| 109 | |
| 110 | #ifdef CONFIG_HUSH_PARSER |
| 111 | #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " |
| 112 | #endif |
| 113 | |
| 114 | /*----------------------------------------------------------------------- |
| 115 | * Etc Command definition |
| 116 | */ |
| 117 | #undef CONFIG_BOOTM_NETBSD |
| 118 | #undef CONFIG_BOOTM_RTEMS |
| 119 | |
| 120 | /*----------------------------------------------------------------------- |
| 121 | * serial console configuration |
| 122 | */ |
| 123 | #define CONFIG_PL011_CLOCK 50000000 |
| 124 | #define CONFIG_PL01x_PORTS {(void *)PHY_BASEADDR_UART0, \ |
| 125 | (void *)PHY_BASEADDR_UART1, \ |
| 126 | (void *)PHY_BASEADDR_UART2, \ |
| 127 | (void *)PHY_BASEADDR_UART3} |
| 128 | #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 } |
| 129 | |
| 130 | /*----------------------------------------------------------------------- |
| 131 | * PLL |
| 132 | */ |
| 133 | #define CONFIG_SYS_PLLFIN 24000000UL |
| 134 | |
| 135 | /*----------------------------------------------------------------------- |
| 136 | * Timer |
| 137 | */ |
| 138 | #define CONFIG_TIMER_SYS_TICK_CH 0 |
| 139 | |
| 140 | /*----------------------------------------------------------------------- |
| 141 | * BACKLIGHT |
| 142 | */ |
| 143 | #ifndef CONFIG_S5P4418_ONEWIRE |
| 144 | #ifdef CONFIG_PWM_NX |
| 145 | /* fallback to pwm */ |
| 146 | #define BACKLIGHT_CH 0 |
| 147 | #define BACKLIGHT_DIV 0 |
| 148 | #define BACKLIGHT_INV 0 |
| 149 | #define BACKLIGHT_DUTY 50 |
| 150 | #define BACKLIGHT_HZ 1000 |
| 151 | #endif |
| 152 | #endif |
| 153 | |
| 154 | /*----------------------------------------------------------------------- |
| 155 | * SD/MMC |
| 156 | */ |
| 157 | #if defined(CONFIG_MMC) |
| 158 | /* eMMC = 0, SD-card = 2 */ |
| 159 | #define CONFIG_SYS_MMC_DEV 2 |
| 160 | #define CONFIG_SYS_MMC_ENV_DEV CONFIG_SYS_MMC_DEV |
| 161 | #endif |
| 162 | |
| 163 | /*----------------------------------------------------------------------- |
| 164 | * Default environment organization |
| 165 | */ |
| 166 | #if !defined(CONFIG_ENV_IS_IN_MMC) && !defined(CONFIG_ENV_IS_IN_NAND) && \ |
| 167 | !defined(CONFIG_ENV_IS_IN_FLASH) && !defined(CONFIG_ENV_IS_IN_EEPROM) |
| 168 | /* default: CONFIG_ENV_IS_NOWHERE */ |
| 169 | #define CONFIG_ENV_IS_NOWHERE |
| 170 | #define CONFIG_ENV_OFFSET 1024 |
| 171 | #define CONFIG_ENV_SIZE (4 * 1024) /* env size */ |
| 172 | #endif |
| 173 | |
| 174 | /*----------------------------------------------------------------------- |
| 175 | * VIDEO |
| 176 | */ |
| 177 | |
| 178 | #define CONFIG_VIDEO_LOGO |
| 179 | |
| 180 | #define CONFIG_SPLASH_SCREEN |
| 181 | |
| 182 | #ifdef CONFIG_VIDEO_LOGO |
| 183 | |
| 184 | #ifdef CONFIG_DM_VIDEO |
| 185 | #define CONFIG_BMP_24BPP |
| 186 | #endif |
| 187 | |
| 188 | #ifdef CONFIG_SPLASH_SCREEN |
| 189 | #define CONFIG_SPLASH_SOURCE 1 |
| 190 | #define CONFIG_SPLASH_SCREEN_ALIGN 1 |
| 191 | #define SPLASH_FILE logo.bmp |
| 192 | #endif |
| 193 | |
| 194 | #endif |
| 195 | |
| 196 | /*----------------------------------------------------------------------- |
| 197 | * ENV |
| 198 | */ |
| 199 | #define BLOADER_MMC \ |
| 200 | "ext4load mmc ${rootdev}:${bootpart} " |
| 201 | |
| 202 | #ifdef CONFIG_OF_BOARD_SETUP |
| 203 | #define EXTRA_ENV_DTB_RESERVE \ |
| 204 | "dtb_reserve=" \ |
| 205 | "if test -n \"$dtb_addr\"; then fdt addr $dtb_addr; fi\0" |
| 206 | #else |
| 207 | #define EXTRA_ENV_DTB_RESERVE \ |
| 208 | "dtb_reserve=" \ |
| 209 | "if test -n \"$fb_addr\"; then " \ |
| 210 | "fdt addr $dtb_addr;" \ |
| 211 | "fdt resize;" \ |
| 212 | "fdt mk /reserved-memory display_reserved;" \ |
| 213 | "fdt set /reserved-memory/display_reserved " \ |
| 214 | "reg <$fb_addr 0x800000>;" \ |
| 215 | "fi;\0" |
| 216 | #endif |
| 217 | |
| 218 | #ifdef CONFIG_SPLASH_SCREEN |
| 219 | #define EXTRA_ENV_BOOT_LOGO \ |
| 220 | "splashimage=" __stringify(BMP_LOAD_ADDR)"\0" \ |
| 221 | "splashfile=" __stringify(SPLASH_FILE)"\0" \ |
| 222 | "splashpos=m,m\0" \ |
| 223 | "fb_addr=\0" \ |
| 224 | EXTRA_ENV_DTB_RESERVE |
| 225 | #else |
| 226 | #define EXTRA_ENV_BOOT_LOGO EXTRA_ENV_DTB_RESERVE |
| 227 | #endif |
| 228 | |
| 229 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 230 | "fdt_high=0xffffffff\0" \ |
| 231 | "initrd_high=0xffffffff\0" \ |
| 232 | "rootdev=" __stringify(CONFIG_ROOT_DEV) "\0" \ |
| 233 | "rootpart=" __stringify(CONFIG_ROOT_PART) "\0" \ |
| 234 | "bootpart=" __stringify(CONFIG_BOOT_PART) "\0" \ |
| 235 | "kernel=zImage\0" \ |
| 236 | "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
| 237 | "dtb_name=s5p4418-nanopi2-rev01.dtb\0" \ |
| 238 | "dtb_addr=" __stringify(KERNEL_DTB_ADDR) "\0" \ |
| 239 | "initrd_name=ramdisk.img\0" \ |
| 240 | "initrd_addr=" __stringify(INITRD_START) "\0" \ |
| 241 | "initrd_size=0x600000\0" \ |
| 242 | "load_dtb=" \ |
| 243 | BLOADER_MMC "${dtb_addr} ${dtb_name}; " \ |
| 244 | "run dtb_reserve\0" \ |
| 245 | "load_kernel=" \ |
| 246 | BLOADER_MMC "${loadaddr} ${kernel}\0" \ |
| 247 | "load_initrd=" \ |
| 248 | BLOADER_MMC "${initrd_addr} ${initrd_name}; " \ |
| 249 | "setenv initrd_size 0x${filesize}\0" \ |
| 250 | "mmcboot=" \ |
| 251 | "run load_kernel; run load_initrd; run load_dtb; " \ |
| 252 | "bootz ${loadaddr} ${initrd_addr}:${initrd_size} " \ |
| 253 | "${dtb_addr}\0" \ |
| 254 | "bootcmd=run mmcboot\0" \ |
| 255 | EXTRA_ENV_BOOT_LOGO |
| 256 | |
| 257 | #endif /* __CONFIG_H__ */ |