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 | |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 13 | #include <linux/sizes.h> |
Thomas Fitzsimmons | dc7685e | 2018-07-26 22:55:37 -0400 | [diff] [blame] | 14 | |
| 15 | #ifndef __ASSEMBLY__ |
| 16 | |
Simon Glass | 1af3c7f | 2020-05-10 11:40:09 -0600 | [diff] [blame] | 17 | #include <linux/stringify.h> |
Thomas Fitzsimmons | dc7685e | 2018-07-26 22:55:37 -0400 | [diff] [blame] | 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 | /* |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 36 | * CPU configuration. |
| 37 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 38 | |
| 39 | /* |
| 40 | * Memory configuration. |
| 41 | * |
| 42 | * The prior stage BOLT bootloader sets up memory for us. |
| 43 | * |
| 44 | * An example boot memory layout after loading everything is: |
| 45 | * |
| 46 | * 0x0000 8000 vmlinux.bin.gz |
| 47 | * : [~31 MiB uncompressed max] |
| 48 | * 0x01ef f000 FIT containing signed public key |
| 49 | * : [~2 KiB in size] |
| 50 | * 0x01f0 0000 DTB copied from prior-stage-provided region |
| 51 | * : [~1 MiB max] |
| 52 | * 0x0200 0000 FIT containing ramdisk and device tree |
| 53 | * : initramfs.cpio.gz |
| 54 | * : [~208 MiB uncompressed max, to CMA/bmem low address] |
| 55 | * : [~80 MiB compressed max, to PSB low address] |
| 56 | * : device tree binary |
| 57 | * : [~60 KiB] |
| 58 | * 0x0700 0000 Prior stage bootloader (PSB) |
| 59 | * : |
| 60 | * 0x0761 7000 Prior-stage-provided device tree binary (DTB) |
| 61 | * : [~40 KiB in size] |
| 62 | * 0x0f00 0000 Contiguous memory allocator (CMA/bmem) low address |
| 63 | * : |
| 64 | * 0x8010 0000 U-Boot code at ELF load address |
| 65 | * : [~500 KiB in size, stripped] |
| 66 | * 0xc000 0000 Top of RAM |
| 67 | * |
Simon Glass | 9846390 | 2022-10-20 18:22:39 -0600 | [diff] [blame] | 68 | * Setting gd->relocaddr to CONFIG_TEXT_BASE in dram_init_banksize |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 69 | * prevents U-Boot from relocating itself when it is run as an ELF |
| 70 | * program by the prior stage bootloader. |
| 71 | * |
| 72 | * We want to keep the ramdisk and FDT in the FIT image in-place, to |
| 73 | * accommodate stblinux's bmem and CMA regions. To accomplish this, |
| 74 | * we set initrd_high and fdt_high to 0xffffffff, and the load and |
| 75 | * entry addresses of the FIT ramdisk entry to 0x0. |
| 76 | * |
| 77 | * Overwriting the prior stage bootloader causes memory instability, |
| 78 | * so the compressed initramfs needs to fit between the load address |
| 79 | * and the PSB low address. In BOLT's default configuration this |
| 80 | * limits the compressed size of the initramfs to approximately 80 |
| 81 | * MiB. However, BOLT can be configured to allow loading larger |
| 82 | * initramfs images, in which case this limitation is eliminated. |
| 83 | */ |
Tom Rini | aa6e94d | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 84 | #define CFG_SYS_SDRAM_BASE 0x00000000 |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 85 | #define CFG_SYS_INIT_RAM_SIZE 0x100000 |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 86 | |
| 87 | /* |
| 88 | * CONFIG_SYS_LOAD_ADDR - 1 MiB. |
| 89 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 90 | |
| 91 | /* |
| 92 | * Large kernel image bootm configuration. |
| 93 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 94 | |
| 95 | /* |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 96 | * Informational display configuration. |
| 97 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 98 | |
| 99 | /* |
| 100 | * Command configuration. |
| 101 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 102 | |
| 103 | /* |
| 104 | * Flash configuration. |
| 105 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 106 | |
| 107 | /* |
| 108 | * Filesystem configuration. |
| 109 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 110 | |
| 111 | /* |
| 112 | * Environment configuration. |
| 113 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 114 | |
| 115 | /* |
| 116 | * Save the prior stage provided DTB. |
| 117 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 118 | /* |
| 119 | * Enable in-place RFS with this initrd_high setting. |
| 120 | */ |
Tom Rini | 0613c36 | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 121 | #define CFG_EXTRA_ENV_SETTINGS \ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 122 | "fdtsaveaddr=" __stringify(CONFIG_SYS_FDT_SAVE_ADDRESS) "\0" \ |
| 123 | "initrd_high=0xffffffff\0" \ |
| 124 | "fdt_high=0xffffffff\0" |
| 125 | |
| 126 | /* |
| 127 | * Set fdtaddr to prior stage-provided DTB in board_late_init, when |
| 128 | * writeable environment is available. |
| 129 | */ |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 130 | |
Thomas Fitzsimmons | 894c3ad | 2018-06-08 17:59:45 -0400 | [diff] [blame] | 131 | #endif /* __BCMSTB_H */ |