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 | */ |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 21 | #define CONFIG_SYS_MEM_SIZE 0x40000000 |
| 22 | #define CONFIG_SYS_SDRAM_BASE 0x71000000 |
| 23 | |
| 24 | /* |
| 25 | * "(CONFIG_SYS_MEM_SIZE - CONFIG_SYS_RESERVE_MEM_SIZE)" has been used in |
| 26 | * u-boot nanopi2-v2016.01. |
| 27 | * This is not working anymore because boot_fdt_add_mem_rsv_regions() in |
| 28 | * common/image-fdt.c has been extended: |
| 29 | * Also reserved-memory sections are marked as unusable. |
| 30 | * |
| 31 | * In friendlyArm Ubuntu 16.04 source arch/arm/boot/dts/s5p4418.dtsi: |
| 32 | * reserved-memory { |
| 33 | * #address-cells = <1>; |
| 34 | * #size-cells = <1>; |
| 35 | * ranges; |
| 36 | * |
| 37 | * secure_memory@b0000000 { |
| 38 | * reg = <0xB0000000 0x1000000>; |
| 39 | * nop-map; |
| 40 | * }; |
| 41 | * }; |
| 42 | * |
| 43 | * arch_lmb_reserve() of arch/arm/lib/bootm.c: |
| 44 | * "Allocate space for command line and board info - ... below the current |
| 45 | * stack pointer." |
| 46 | * --> Memory allocated would overlap with "secure_memory@b0000000" |
| 47 | * --> lmb_add_region(rgn, base==0xb0000000, size==0x1000000) fails, |
| 48 | * boot output: |
| 49 | * ... |
| 50 | * Kernel image @ 0x71080000 [ 0x000000 - 0x60e628 ] |
| 51 | * ## Flattened Device Tree blob at 7a000000 |
| 52 | * Booting using the fdt blob at 0x7a000000 |
| 53 | * ERROR: reserving fdt memory region failed (addr=b0000000 size=1000000) |
| 54 | * Using Device Tree in place at 7a000000, end 7a00fbf0 |
| 55 | * |
| 56 | * Starting kernel ... |
| 57 | * ... |
| 58 | */ |
| 59 | #define CONFIG_SYS_SDRAM_SIZE (0xb0000000 - CONFIG_SYS_SDRAM_BASE) |
| 60 | |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 61 | #define BMP_LOAD_ADDR 0x78000000 |
| 62 | |
| 63 | /* kernel load address */ |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 64 | #define INITRD_START 0x79000000 |
| 65 | #define KERNEL_DTB_ADDR 0x7A000000 |
| 66 | |
| 67 | /*----------------------------------------------------------------------- |
| 68 | * High Level System Configuration |
| 69 | */ |
| 70 | /* Not used: not need IRQ/FIQ stuff */ |
| 71 | #undef CONFIG_USE_IRQ |
| 72 | /* decrementer freq: 1ms ticks */ |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 73 | |
| 74 | /*----------------------------------------------------------------------- |
| 75 | * System initialize options (board_init_f) |
| 76 | */ |
| 77 | /* board_init_f->init_sequence, call arch_cpu_init */ |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 78 | |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 79 | /*----------------------------------------------------------------------- |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 80 | * serial console configuration |
| 81 | */ |
| 82 | #define CONFIG_PL011_CLOCK 50000000 |
| 83 | #define CONFIG_PL01x_PORTS {(void *)PHY_BASEADDR_UART0, \ |
| 84 | (void *)PHY_BASEADDR_UART1, \ |
| 85 | (void *)PHY_BASEADDR_UART2, \ |
| 86 | (void *)PHY_BASEADDR_UART3} |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 87 | |
| 88 | /*----------------------------------------------------------------------- |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 89 | * BACKLIGHT |
| 90 | */ |
| 91 | #ifndef CONFIG_S5P4418_ONEWIRE |
| 92 | #ifdef CONFIG_PWM_NX |
| 93 | /* fallback to pwm */ |
| 94 | #define BACKLIGHT_CH 0 |
| 95 | #define BACKLIGHT_DIV 0 |
| 96 | #define BACKLIGHT_INV 0 |
| 97 | #define BACKLIGHT_DUTY 50 |
| 98 | #define BACKLIGHT_HZ 1000 |
| 99 | #endif |
| 100 | #endif |
| 101 | |
| 102 | /*----------------------------------------------------------------------- |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 103 | * VIDEO |
| 104 | */ |
| 105 | |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 106 | #ifdef CONFIG_VIDEO_LOGO |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 107 | #ifdef CONFIG_SPLASH_SCREEN |
Stefan Bosch | e7001ed | 2020-07-10 19:07:38 +0200 | [diff] [blame] | 108 | #define SPLASH_FILE logo.bmp |
| 109 | #endif |
| 110 | |
| 111 | #endif |
| 112 | |
| 113 | /*----------------------------------------------------------------------- |
| 114 | * ENV |
| 115 | */ |
| 116 | #define BLOADER_MMC \ |
| 117 | "ext4load mmc ${rootdev}:${bootpart} " |
| 118 | |
| 119 | #ifdef CONFIG_OF_BOARD_SETUP |
| 120 | #define EXTRA_ENV_DTB_RESERVE \ |
| 121 | "dtb_reserve=" \ |
| 122 | "if test -n \"$dtb_addr\"; then fdt addr $dtb_addr; fi\0" |
| 123 | #else |
| 124 | #define EXTRA_ENV_DTB_RESERVE \ |
| 125 | "dtb_reserve=" \ |
| 126 | "if test -n \"$fb_addr\"; then " \ |
| 127 | "fdt addr $dtb_addr;" \ |
| 128 | "fdt resize;" \ |
| 129 | "fdt mk /reserved-memory display_reserved;" \ |
| 130 | "fdt set /reserved-memory/display_reserved " \ |
| 131 | "reg <$fb_addr 0x800000>;" \ |
| 132 | "fi;\0" |
| 133 | #endif |
| 134 | |
| 135 | #ifdef CONFIG_SPLASH_SCREEN |
| 136 | #define EXTRA_ENV_BOOT_LOGO \ |
| 137 | "splashimage=" __stringify(BMP_LOAD_ADDR)"\0" \ |
| 138 | "splashfile=" __stringify(SPLASH_FILE)"\0" \ |
| 139 | "splashpos=m,m\0" \ |
| 140 | "fb_addr=\0" \ |
| 141 | EXTRA_ENV_DTB_RESERVE |
| 142 | #else |
| 143 | #define EXTRA_ENV_BOOT_LOGO EXTRA_ENV_DTB_RESERVE |
| 144 | #endif |
| 145 | |
| 146 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 147 | "fdt_high=0xffffffff\0" \ |
| 148 | "initrd_high=0xffffffff\0" \ |
| 149 | "rootdev=" __stringify(CONFIG_ROOT_DEV) "\0" \ |
| 150 | "rootpart=" __stringify(CONFIG_ROOT_PART) "\0" \ |
| 151 | "bootpart=" __stringify(CONFIG_BOOT_PART) "\0" \ |
| 152 | "kernel=zImage\0" \ |
| 153 | "loadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
| 154 | "dtb_name=s5p4418-nanopi2-rev01.dtb\0" \ |
| 155 | "dtb_addr=" __stringify(KERNEL_DTB_ADDR) "\0" \ |
| 156 | "initrd_name=ramdisk.img\0" \ |
| 157 | "initrd_addr=" __stringify(INITRD_START) "\0" \ |
| 158 | "initrd_size=0x600000\0" \ |
| 159 | "load_dtb=" \ |
| 160 | BLOADER_MMC "${dtb_addr} ${dtb_name}; " \ |
| 161 | "run dtb_reserve\0" \ |
| 162 | "load_kernel=" \ |
| 163 | BLOADER_MMC "${loadaddr} ${kernel}\0" \ |
| 164 | "load_initrd=" \ |
| 165 | BLOADER_MMC "${initrd_addr} ${initrd_name}; " \ |
| 166 | "setenv initrd_size 0x${filesize}\0" \ |
| 167 | "mmcboot=" \ |
| 168 | "run load_kernel; run load_initrd; run load_dtb; " \ |
| 169 | "bootz ${loadaddr} ${initrd_addr}:${initrd_size} " \ |
| 170 | "${dtb_addr}\0" \ |
| 171 | "bootcmd=run mmcboot\0" \ |
| 172 | EXTRA_ENV_BOOT_LOGO |
| 173 | |
| 174 | #endif /* __CONFIG_H__ */ |