blob: b906c750edc8641a7a1705d5285ac982a7ca7e0c [file] [log] [blame]
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -04001/* 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 Fitzsimmonsf5befba2018-07-26 22:55:37 -040015
16#ifndef __ASSEMBLY__
17
Simon Glassfb64e362020-05-10 11:40:09 -060018#include <linux/stringify.h>
Thomas Fitzsimmonsf5befba2018-07-26 22:55:37 -040019#include <linux/types.h>
20
21struct bcmstb_boot_parameters {
22 u32 r0;
23 u32 r1;
24 u32 r2;
25 u32 r3;
26 u32 sp;
27 u32 lr;
28};
29
30extern struct bcmstb_boot_parameters bcmstb_boot_parameters;
31
32extern phys_addr_t prior_stage_fdt_address;
33
34#endif /* __ASSEMBLY__ */
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -040035
36/*
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -040037 * CPU configuration.
38 */
39#define CONFIG_SKIP_LOWLEVEL_INIT
40
41/*
42 * Memory configuration.
43 *
44 * The prior stage BOLT bootloader sets up memory for us.
45 *
46 * An example boot memory layout after loading everything is:
47 *
48 * 0x0000 8000 vmlinux.bin.gz
49 * : [~31 MiB uncompressed max]
50 * 0x01ef f000 FIT containing signed public key
51 * : [~2 KiB in size]
52 * 0x01f0 0000 DTB copied from prior-stage-provided region
53 * : [~1 MiB max]
54 * 0x0200 0000 FIT containing ramdisk and device tree
55 * : initramfs.cpio.gz
56 * : [~208 MiB uncompressed max, to CMA/bmem low address]
57 * : [~80 MiB compressed max, to PSB low address]
58 * : device tree binary
59 * : [~60 KiB]
60 * 0x0700 0000 Prior stage bootloader (PSB)
61 * :
62 * 0x0761 7000 Prior-stage-provided device tree binary (DTB)
63 * : [~40 KiB in size]
64 * 0x0f00 0000 Contiguous memory allocator (CMA/bmem) low address
65 * :
66 * 0x8010 0000 U-Boot code at ELF load address
67 * : [~500 KiB in size, stripped]
68 * 0xc000 0000 Top of RAM
69 *
70 * Setting gd->relocaddr to CONFIG_SYS_TEXT_BASE in dram_init_banksize
71 * prevents U-Boot from relocating itself when it is run as an ELF
72 * program by the prior stage bootloader.
73 *
74 * We want to keep the ramdisk and FDT in the FIT image in-place, to
75 * accommodate stblinux's bmem and CMA regions. To accomplish this,
76 * we set initrd_high and fdt_high to 0xffffffff, and the load and
77 * entry addresses of the FIT ramdisk entry to 0x0.
78 *
79 * Overwriting the prior stage bootloader causes memory instability,
80 * so the compressed initramfs needs to fit between the load address
81 * and the PSB low address. In BOLT's default configuration this
82 * limits the compressed size of the initramfs to approximately 80
83 * MiB. However, BOLT can be configured to allow loading larger
84 * initramfs images, in which case this limitation is eliminated.
85 */
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -040086#define CONFIG_SYS_SDRAM_BASE 0x00000000
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -040087#define CONFIG_SYS_INIT_RAM_SIZE 0x100000
88#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \
89 CONFIG_SYS_INIT_RAM_SIZE - \
90 GENERATED_GBL_DATA_SIZE)
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -040091#define CONFIG_SYS_LOAD_ADDR 0x2000000
92
93/*
94 * CONFIG_SYS_LOAD_ADDR - 1 MiB.
95 */
96#define CONFIG_SYS_FDT_SAVE_ADDRESS 0x1f00000
97#define CONFIG_SYS_CBSIZE 512
98#define CONFIG_SYS_MAXARGS 32
99
100/*
101 * Large kernel image bootm configuration.
102 */
103#define CONFIG_SYS_BOOTM_LEN SZ_64M
104
105/*
106 * NS16550 configuration.
107 */
108#define V_NS16550_CLK 81000000
109
110#define CONFIG_SYS_NS16550
111#define CONFIG_SYS_NS16550_SERIAL
112#define CONFIG_SYS_NS16550_REG_SIZE (-4)
113#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK
114
115/*
116 * Serial console configuration.
117 */
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400118#define CONFIG_BAUDRATE 115200
119#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, \
120 115200}
121
122/*
123 * Informational display configuration.
124 */
125#define CONFIG_REVISION_TAG
126
127/*
128 * Command configuration.
129 */
130#define CONFIG_CMD_ASKENV
131#define CONFIG_CMD_CACHE
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400132
133/*
134 * Flash configuration.
135 */
136#define CONFIG_ST_SMI
137#define CONFIG_SPI_FLASH_STMICRO
138#define CONFIG_SPI_FLASH_MACRONIX
139
140/*
141 * Filesystem configuration.
142 */
143#define CONFIG_DOS_PARTITION
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400144#define CONFIG_CMD_FS_GENERIC
145
146/*
147 * Environment configuration.
148 */
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400149#define CONFIG_ENV_OVERWRITE
150
151/*
152 * Save the prior stage provided DTB.
153 */
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400154/*
155 * Enable in-place RFS with this initrd_high setting.
156 */
157#define CONFIG_EXTRA_ENV_SETTINGS \
158 "fdtsaveaddr=" __stringify(CONFIG_SYS_FDT_SAVE_ADDRESS) "\0" \
159 "initrd_high=0xffffffff\0" \
160 "fdt_high=0xffffffff\0"
161
162/*
163 * Set fdtaddr to prior stage-provided DTB in board_late_init, when
164 * writeable environment is available.
165 */
166#define CONFIG_BOARD_LATE_INIT
167
Thomas Fitzsimmons919646d2018-06-08 17:59:45 -0400168#endif /* __BCMSTB_H */