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 /* 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 180 181 182 #endif 183