Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * (C) Copyright 2018 Cisco Systems, Inc. |
| 4 | * |
| 5 | * Author: Thomas Fitzsimmons <fitzsim@fitzsim.org> |
| 6 | * |
| 7 | * Configuration settings for the Broadcom BCMSTB SoC family. |
| 8 | */ |
| 9 | |
| 10 | #ifndef __BCMSTB_H |
| 11 | #define __BCMSTB_H |
| 12 | |
| 13 | #include "version.h" |
| 14 | #include <linux/sizes.h> |
Thomas Fitzsimmons | dc7685e | 2018-07-26 22:55:37 -0400 | [diff] [blame] | 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | |
| 18 | #include <linux/types.h> |
| 19 | |
| 20 | struct bcmstb_boot_parameters { |
| 21 | u32 r0; |
| 22 | u32 r1; |
| 23 | u32 r2; |
| 24 | u32 r3; |
| 25 | u32 sp; |
| 26 | u32 lr; |
| 27 | }; |
| 28 | |
| 29 | extern struct bcmstb_boot_parameters bcmstb_boot_parameters; |
| 30 | |
| 31 | extern phys_addr_t prior_stage_fdt_address; |
| 32 | |
| 33 | #endif /* __ASSEMBLY__ */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 34 | |
| 35 | /* |
| 36 | * Generic board configuration. |
| 37 | */ |
| 38 | #define CONFIG_SYS_GENERIC_BOARD |
| 39 | |
| 40 | /* |
| 41 | * CPU configuration. |
| 42 | */ |
| 43 | #define CONFIG_SKIP_LOWLEVEL_INIT |
| 44 | |
| 45 | /* |
| 46 | * Memory configuration. |
| 47 | * |
| 48 | * The prior stage BOLT bootloader sets up memory for us. |
| 49 | * |
| 50 | * An example boot memory layout after loading everything is: |
| 51 | * |
| 52 | * 0x0000 8000 vmlinux.bin.gz |
| 53 | * : [~31 MiB uncompressed max] |
| 54 | * 0x01ef f000 FIT containing signed public key |
| 55 | * : [~2 KiB in size] |
| 56 | * 0x01f0 0000 DTB copied from prior-stage-provided region |
| 57 | * : [~1 MiB max] |
| 58 | * 0x0200 0000 FIT containing ramdisk and device tree |
| 59 | * : initramfs.cpio.gz |
| 60 | * : [~208 MiB uncompressed max, to CMA/bmem low address] |
| 61 | * : [~80 MiB compressed max, to PSB low address] |
| 62 | * : device tree binary |
| 63 | * : [~60 KiB] |
| 64 | * 0x0700 0000 Prior stage bootloader (PSB) |
| 65 | * : |
| 66 | * 0x0761 7000 Prior-stage-provided device tree binary (DTB) |
| 67 | * : [~40 KiB in size] |
| 68 | * 0x0f00 0000 Contiguous memory allocator (CMA/bmem) low address |
| 69 | * : |
| 70 | * 0x8010 0000 U-Boot code at ELF load address |
| 71 | * : [~500 KiB in size, stripped] |
| 72 | * 0xc000 0000 Top of RAM |
| 73 | * |
| 74 | * Setting gd->relocaddr to CONFIG_SYS_TEXT_BASE in dram_init_banksize |
| 75 | * prevents U-Boot from relocating itself when it is run as an ELF |
| 76 | * program by the prior stage bootloader. |
| 77 | * |
| 78 | * We want to keep the ramdisk and FDT in the FIT image in-place, to |
| 79 | * accommodate stblinux's bmem and CMA regions. To accomplish this, |
| 80 | * we set initrd_high and fdt_high to 0xffffffff, and the load and |
| 81 | * entry addresses of the FIT ramdisk entry to 0x0. |
| 82 | * |
| 83 | * Overwriting the prior stage bootloader causes memory instability, |
| 84 | * so the compressed initramfs needs to fit between the load address |
| 85 | * and the PSB low address. In BOLT's default configuration this |
| 86 | * limits the compressed size of the initramfs to approximately 80 |
| 87 | * MiB. However, BOLT can be configured to allow loading larger |
| 88 | * initramfs images, in which case this limitation is eliminated. |
| 89 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 90 | #define CONFIG_SYS_SDRAM_BASE 0x00000000 |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 91 | #define CONFIG_SYS_INIT_RAM_SIZE 0x100000 |
| 92 | #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ |
| 93 | CONFIG_SYS_INIT_RAM_SIZE - \ |
| 94 | GENERATED_GBL_DATA_SIZE) |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 95 | #define CONFIG_SYS_LOAD_ADDR 0x2000000 |
| 96 | |
| 97 | /* |
| 98 | * CONFIG_SYS_LOAD_ADDR - 1 MiB. |
| 99 | */ |
| 100 | #define CONFIG_SYS_FDT_SAVE_ADDRESS 0x1f00000 |
| 101 | #define CONFIG_SYS_CBSIZE 512 |
| 102 | #define CONFIG_SYS_MAXARGS 32 |
| 103 | |
| 104 | /* |
| 105 | * Large kernel image bootm configuration. |
| 106 | */ |
| 107 | #define CONFIG_SYS_BOOTM_LEN SZ_64M |
| 108 | |
| 109 | /* |
| 110 | * NS16550 configuration. |
| 111 | */ |
| 112 | #define V_NS16550_CLK 81000000 |
| 113 | |
| 114 | #define CONFIG_SYS_NS16550 |
| 115 | #define CONFIG_SYS_NS16550_SERIAL |
| 116 | #define CONFIG_SYS_NS16550_REG_SIZE (-4) |
| 117 | #define CONFIG_SYS_NS16550_CLK V_NS16550_CLK |
| 118 | |
| 119 | /* |
| 120 | * Serial console configuration. |
| 121 | */ |
| 122 | #define CONFIG_SERIAL3 3 |
| 123 | |
| 124 | #define CONFIG_BAUDRATE 115200 |
| 125 | #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, \ |
| 126 | 115200} |
| 127 | |
| 128 | /* |
| 129 | * Informational display configuration. |
| 130 | */ |
| 131 | #define CONFIG_REVISION_TAG |
| 132 | |
| 133 | /* |
| 134 | * Command configuration. |
| 135 | */ |
| 136 | #define CONFIG_CMD_ASKENV |
| 137 | #define CONFIG_CMD_CACHE |
| 138 | #define CONFIG_CMD_EXT2 |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 139 | #define CONFIG_CMD_MMC |
| 140 | |
| 141 | /* |
| 142 | * Flash configuration. |
| 143 | */ |
| 144 | #define CONFIG_ST_SMI |
| 145 | #define CONFIG_SPI_FLASH_STMICRO |
| 146 | #define CONFIG_SPI_FLASH_MACRONIX |
| 147 | |
| 148 | /* |
| 149 | * Filesystem configuration. |
| 150 | */ |
| 151 | #define CONFIG_DOS_PARTITION |
| 152 | #define CONFIG_CMD_EXT4 |
| 153 | #define CONFIG_FS_EXT4 |
| 154 | #define CONFIG_CMD_FS_GENERIC |
| 155 | |
| 156 | /* |
| 157 | * Environment configuration. |
| 158 | */ |
| 159 | #define CONFIG_SYS_REDUNDAND_ENVIRONMENT |
| 160 | |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 161 | #define CONFIG_ENV_OFFSET 0x1e0000 |
| 162 | #define CONFIG_ENV_SIZE (64 << 10) /* 64 KiB */ |
| 163 | #define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE |
| 164 | #define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) |
| 165 | #define CONFIG_ENV_OVERWRITE |
| 166 | |
| 167 | /* |
| 168 | * Save the prior stage provided DTB. |
| 169 | */ |
| 170 | #define CONFIG_PREBOOT \ |
| 171 | "fdt addr ${fdtcontroladdr};" \ |
| 172 | "fdt move ${fdtcontroladdr} ${fdtsaveaddr};" \ |
| 173 | "fdt addr ${fdtsaveaddr};" |
| 174 | /* |
| 175 | * Enable in-place RFS with this initrd_high setting. |
| 176 | */ |
| 177 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 178 | "fdtsaveaddr=" __stringify(CONFIG_SYS_FDT_SAVE_ADDRESS) "\0" \ |
| 179 | "initrd_high=0xffffffff\0" \ |
| 180 | "fdt_high=0xffffffff\0" |
| 181 | |
| 182 | /* |
| 183 | * Set fdtaddr to prior stage-provided DTB in board_late_init, when |
| 184 | * writeable environment is available. |
| 185 | */ |
| 186 | #define CONFIG_BOARD_LATE_INIT |
| 187 | |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 188 | #endif /* __BCMSTB_H */ |