blob: c460207e64fcbb6d6a049fc3c00b5b3a30d6882f [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
Stephen Warrend8845db2016-04-04 20:00:41 -0600115/* ATAGs support for bootm/bootz */
116#define CONFIG_SETUP_MEMORY_TAGS
117#define CONFIG_CMDLINE_TAG
118#define CONFIG_INITRD_TAG
119
120#include <config_distro_defaults.h>
121
122/* Environment */
123#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
124#define ENV_DEVICE_SETTINGS \
125 "stdin=serial,usbkbd\0" \
126 "stdout=serial,lcd\0" \
127 "stderr=serial,lcd\0"
128
129/*
130 * Memory layout for where various images get loaded by boot scripts:
131 *
132 * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this.
133 *
134 * fdt_addr_r simply shouldn't overlap anything else. However, the RPi's
135 * binary firmware loads a DT to address 0x100, so we choose this address to
136 * match it. This allows custom boot scripts to pass this DT on to Linux
137 * simply by not over-writing the data at this address. When using U-Boot,
138 * U-Boot (and scripts it executes) typicaly ignore the DT loaded by the FW
139 * and loads its own DT from disk (triggered by boot.scr or extlinux.conf).
140 *
141 * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
142 * something else. Put it low in memory to avoid conflicts.
143 *
144 * kernel_addr_r must be within the first 128M of RAM in order for the
145 * kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
146 * decompress itself to 0x8000 after the start of RAM, kernel_addr_r
147 * should not overlap that area, or the kernel will have to copy itself
148 * somewhere else before decompression. Similarly, the address of any other
149 * data passed to the kernel shouldn't overlap the start of RAM. Pushing
150 * this up to 16M allows for a sizable kernel to be decompressed below the
151 * compressed load address.
152 *
153 * scriptaddr can be pretty much anywhere that doesn't conflict with something
154 * else. Choosing 32M allows for the compressed kernel to be up to 16M.
155 *
156 * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows
157 * for any boot script to be up to 1M, which is hopefully plenty.
158 */
159#define ENV_MEM_LAYOUT_SETTINGS \
160 "fdt_high=ffffffff\0" \
161 "initrd_high=ffffffff\0" \
162 "fdt_addr_r=0x00000100\0" \
163 "pxefile_addr_r=0x00100000\0" \
164 "kernel_addr_r=0x01000000\0" \
165 "scriptaddr=0x02000000\0" \
166 "ramdisk_addr_r=0x02100000\0" \
167
168#define BOOT_TARGET_DEVICES(func) \
169 func(MMC, mmc, 0) \
170 func(USB, usb, 0) \
171 func(PXE, pxe, na) \
172 func(DHCP, dhcp, na)
173#include <config_distro_bootcmd.h>
174
175#define CONFIG_EXTRA_ENV_SETTINGS \
176 "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
177 ENV_DEVICE_SETTINGS \
178 ENV_MEM_LAYOUT_SETTINGS \
179 BOOTENV
Alexander Stein50e81842015-07-24 09:22:11 +0200180
Stephen Warren0e012c32012-08-05 16:07:22 +0000181
Stephen Warren0e012c32012-08-05 16:07:22 +0000182#endif