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