1 /* 2 * (C) Copyright 2012-2016 Stephen Warren 3 * 4 * SPDX-License-Identifier: GPL-2.0 5 */ 6 7 #ifndef __CONFIG_H 8 #define __CONFIG_H 9 10 #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 17 /* 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 27 /* Memory layout */ 28 #define CONFIG_NR_DRAM_BANKS 1 29 #define CONFIG_SYS_SDRAM_BASE 0x00000000 30 #ifdef CONFIG_ARM64 31 #define CONFIG_SYS_TEXT_BASE 0x00080000 32 #else 33 #define CONFIG_SYS_TEXT_BASE 0x00008000 34 #endif 35 #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 */ 58 #define CONFIG_LCD_DT_SIMPLEFB 59 #define LCD_BPP LCD_COLOR32 60 /* 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 68 69 /* SD/MMC configuration */ 70 #define CONFIG_GENERIC_MMC 71 72 #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 79 #define CONFIG_USB_HOST_ETHER 80 #define CONFIG_USB_ETHER_SMSC95XX 81 #define CONFIG_TFTP_TSIZE 82 #define CONFIG_MISC_INIT_R 83 #define CONFIG_SYS_USB_EVENT_POLL 84 #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 109 #define CONFIG_PREBOOT "usb start" 110 111 /* Shell */ 112 #define CONFIG_SYS_MAXARGS 16 113 #define CONFIG_COMMAND_HISTORY 114 115 /* Commands */ 116 #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 184 185 186 #endif 187