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