blob: ce539a008cce7a62fa4b2079f17bffae52c2f014 [file] [log] [blame]
Stephen Warren0e012c32012-08-05 16:07:22 +00001/*
Stephen Warrend8845db2016-04-04 20:00:41 -06002 * (C) Copyright 2012-2016 Stephen Warren
Stephen Warren0e012c32012-08-05 16:07:22 +00003 *
Stephen Warren29e494c2015-02-16 12:16:13 -07004 * SPDX-License-Identifier: GPL-2.0
Stephen Warren0e012c32012-08-05 16:07:22 +00005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
Stephen Warrend8845db2016-04-04 20:00:41 -060010#include <linux/sizes.h>
11#include <asm/arch/timer.h>
12
13#if defined(CONFIG_TARGET_RPI_2) || defined(CONFIG_TARGET_RPI_3_32B)
14#define CONFIG_SKIP_LOWLEVEL_INIT
15#endif
16
Stephen Warrend8845db2016-04-04 20:00:41 -060017/* Architecture, CPU, etc.*/
18#define CONFIG_ARCH_CPU_INIT
19
20/* Use SoC timer for AArch32, but architected timer for AArch64 */
21#ifndef CONFIG_ARM64
22#define CONFIG_SYS_TIMER_RATE 1000000
23#define CONFIG_SYS_TIMER_COUNTER \
24 (&((struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR)->clo)
25#endif
26
Stephen Warrend8845db2016-04-04 20:00:41 -060027/* Memory layout */
28#define CONFIG_NR_DRAM_BANKS 1
29#define CONFIG_SYS_SDRAM_BASE 0x00000000
Stephen Warren3d3d91c2016-04-15 20:42:59 -060030#ifdef CONFIG_ARM64
31#define CONFIG_SYS_TEXT_BASE 0x00080000
32#else
Stephen Warrend8845db2016-04-04 20:00:41 -060033#define CONFIG_SYS_TEXT_BASE 0x00008000
Stephen Warren3d3d91c2016-04-15 20:42:59 -060034#endif
Stephen Warrend8845db2016-04-04 20:00:41 -060035#define CONFIG_SYS_UBOOT_BASE CONFIG_SYS_TEXT_BASE
36/*
37 * The board really has 256M. However, the VC (VideoCore co-processor) shares
38 * the RAM, and uses a configurable portion at the top. We tell U-Boot that a
39 * smaller amount of RAM is present in order to avoid stomping on the area
40 * the VC uses.
41 */
42#define CONFIG_SYS_SDRAM_SIZE SZ_128M
43#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + \
44 CONFIG_SYS_SDRAM_SIZE - \
45 GENERATED_GBL_DATA_SIZE)
46#define CONFIG_SYS_MALLOC_LEN SZ_4M
47#define CONFIG_SYS_MEMTEST_START 0x00100000
48#define CONFIG_SYS_MEMTEST_END 0x00200000
49#define CONFIG_LOADADDR 0x00200000
50
51/* Flash */
52#define CONFIG_SYS_NO_FLASH
53
54/* Devices */
55/* GPIO */
56#define CONFIG_BCM2835_GPIO
57/* LCD */
Stephen Warrend8845db2016-04-04 20:00:41 -060058#define CONFIG_LCD_DT_SIMPLEFB
Alexander Graf13b66972016-11-02 10:36:19 +010059#define LCD_BPP LCD_COLOR32
Stephen Warrend8845db2016-04-04 20:00:41 -060060/*
61 * Prevent allocation of RAM for FB; the real FB address is queried
62 * dynamically from the VideoCore co-processor, and comes from RAM
63 * not owned by the ARM CPU.
64 */
65#define CONFIG_FB_ADDR 0
66#define CONFIG_VIDEO_BCM2835
67#define CONFIG_SYS_WHITE_ON_BLACK
Stephen Warrend8845db2016-04-04 20:00:41 -060068
69/* SD/MMC configuration */
70#define CONFIG_GENERIC_MMC
Stephen Warrend8845db2016-04-04 20:00:41 -060071
Stephen Warrend8845db2016-04-04 20:00:41 -060072#ifdef CONFIG_CMD_USB
73#define CONFIG_USB_DWC2
74#ifndef CONFIG_BCM2835
75#define CONFIG_USB_DWC2_REG_ADDR 0x3f980000
76#else
77#define CONFIG_USB_DWC2_REG_ADDR 0x20980000
78#endif
Stephen Warrend8845db2016-04-04 20:00:41 -060079#define CONFIG_USB_HOST_ETHER
80#define CONFIG_USB_ETHER_SMSC95XX
Simon Glass1536d8b2015-08-07 07:42:22 -060081#define CONFIG_TFTP_TSIZE
Stephen Warrend8845db2016-04-04 20:00:41 -060082#define CONFIG_MISC_INIT_R
Stephen Warrend8845db2016-04-04 20:00:41 -060083#define CONFIG_SYS_USB_EVENT_POLL
Stephen Warrend8845db2016-04-04 20:00:41 -060084#endif
85
86/* Console UART */
87#ifdef CONFIG_BCM2837
88#define CONFIG_BCM283X_MU_SERIAL
89#else
90#define CONFIG_PL01X_SERIAL
91#endif
92#define CONFIG_CONS_INDEX 0
93#define CONFIG_BAUDRATE 115200
94
95/* Console configuration */
96#define CONFIG_SYS_CBSIZE 1024
97#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
98 sizeof(CONFIG_SYS_PROMPT) + 16)
99
100/* Environment */
101#define CONFIG_ENV_SIZE SZ_16K
102#define CONFIG_ENV_IS_IN_FAT
103#define FAT_ENV_INTERFACE "mmc"
104#define FAT_ENV_DEVICE_AND_PART "0:1"
105#define FAT_ENV_FILE "uboot.env"
106#define CONFIG_FAT_WRITE
107#define CONFIG_ENV_VARS_UBOOT_CONFIG
108#define CONFIG_SYS_LOAD_ADDR 0x1000000
Stephen Warrend8845db2016-04-04 20:00:41 -0600109#define CONFIG_PREBOOT "usb start"
110
111/* Shell */
112#define CONFIG_SYS_MAXARGS 16
113#define CONFIG_COMMAND_HISTORY
114
115/* Commands */
Stephen Warrend8845db2016-04-04 20:00:41 -0600116#define CONFIG_PARTITION_UUIDS
117#define CONFIG_CMD_PART
118
119/* ATAGs support for bootm/bootz */
120#define CONFIG_SETUP_MEMORY_TAGS
121#define CONFIG_CMDLINE_TAG
122#define CONFIG_INITRD_TAG
123
124#include <config_distro_defaults.h>
125
126/* Environment */
127#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
128#define ENV_DEVICE_SETTINGS \
129 "stdin=serial,usbkbd\0" \
130 "stdout=serial,lcd\0" \
131 "stderr=serial,lcd\0"
132
133/*
134 * Memory layout for where various images get loaded by boot scripts:
135 *
136 * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this.
137 *
138 * fdt_addr_r simply shouldn't overlap anything else. However, the RPi's
139 * binary firmware loads a DT to address 0x100, so we choose this address to
140 * match it. This allows custom boot scripts to pass this DT on to Linux
141 * simply by not over-writing the data at this address. When using U-Boot,
142 * U-Boot (and scripts it executes) typicaly ignore the DT loaded by the FW
143 * and loads its own DT from disk (triggered by boot.scr or extlinux.conf).
144 *
145 * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
146 * something else. Put it low in memory to avoid conflicts.
147 *
148 * kernel_addr_r must be within the first 128M of RAM in order for the
149 * kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
150 * decompress itself to 0x8000 after the start of RAM, kernel_addr_r
151 * should not overlap that area, or the kernel will have to copy itself
152 * somewhere else before decompression. Similarly, the address of any other
153 * data passed to the kernel shouldn't overlap the start of RAM. Pushing
154 * this up to 16M allows for a sizable kernel to be decompressed below the
155 * compressed load address.
156 *
157 * scriptaddr can be pretty much anywhere that doesn't conflict with something
158 * else. Choosing 32M allows for the compressed kernel to be up to 16M.
159 *
160 * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows
161 * for any boot script to be up to 1M, which is hopefully plenty.
162 */
163#define ENV_MEM_LAYOUT_SETTINGS \
164 "fdt_high=ffffffff\0" \
165 "initrd_high=ffffffff\0" \
166 "fdt_addr_r=0x00000100\0" \
167 "pxefile_addr_r=0x00100000\0" \
168 "kernel_addr_r=0x01000000\0" \
169 "scriptaddr=0x02000000\0" \
170 "ramdisk_addr_r=0x02100000\0" \
171
172#define BOOT_TARGET_DEVICES(func) \
173 func(MMC, mmc, 0) \
174 func(USB, usb, 0) \
175 func(PXE, pxe, na) \
176 func(DHCP, dhcp, na)
177#include <config_distro_bootcmd.h>
178
179#define CONFIG_EXTRA_ENV_SETTINGS \
180 "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
181 ENV_DEVICE_SETTINGS \
182 ENV_MEM_LAYOUT_SETTINGS \
183 BOOTENV
Alexander Stein50e81842015-07-24 09:22:11 +0200184
Stephen Warren0e012c32012-08-05 16:07:22 +0000185
Stephen Warren0e012c32012-08-05 16:07:22 +0000186#endif