blob: beb56fcb5af83e780a89e38a19e6352c50879e79 [file] [log] [blame]
Patrick Delaunay960debb2022-05-20 18:24:46 +02001/* SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause */
2/*
3 * Copyright (C) 2022, STMicroelectronics - All Rights Reserved
4 *
5 * Configuration settings for the STM32MP13x CPU
6 */
7
8#ifndef __CONFIG_STM32MP13_COMMMON_H
9#define __CONFIG_STM32MP13_COMMMON_H
10#include <linux/sizes.h>
11#include <asm/arch/stm32.h>
12
13/*
14 * Configuration of the external SRAM memory used by U-Boot
15 */
16#define CONFIG_SYS_SDRAM_BASE STM32_DDR_BASE
17
18/*
19 * For booting Linux, use the first 256 MB of memory, since this is
20 * the maximum mapped by the Linux kernel during initialization.
21 */
22#define CONFIG_SYS_BOOTMAPSZ SZ_256M
23
24/* Extend size of kernel image for uncompression */
25#define CONFIG_SYS_BOOTM_LEN SZ_32M
26
27/*MMC SD*/
28#define CONFIG_SYS_MMC_MAX_DEVICE 2
29
30/* NAND support */
31#define CONFIG_SYS_MAX_NAND_DEVICE 1
32
33/*****************************************************************************/
34#ifdef CONFIG_DISTRO_DEFAULTS
35/*****************************************************************************/
36
37#ifdef CONFIG_CMD_MMC
38#define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0)
39#define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1)
40#else
41#define BOOT_TARGET_MMC0(func)
42#define BOOT_TARGET_MMC1(func)
43#endif
44
45#define BOOT_TARGET_DEVICES(func) \
46 BOOT_TARGET_MMC1(func) \
47 BOOT_TARGET_MMC0(func)
48
49/*
50 * default bootcmd for stm32mp13:
51 * for mmc boot (eMMC, SD card), distro boot on the same mmc device
52 */
53#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
54 "echo \"Boot over ${boot_device}${boot_instance}!\";" \
55 "run env_check;" \
56 "if test ${boot_device} = mmc;" \
57 "then env set boot_targets \"mmc${boot_instance}\"; fi;" \
58 "run distro_bootcmd;" \
59 "fi;\0"
60
61#define STM32MP_EXTRA \
62 "env_check=if env info -p -d -q; then env save; fi\0" \
63 "boot_net_usb_start=true\0"
64
65#ifndef STM32MP_BOARD_EXTRA_ENV
66#define STM32MP_BOARD_EXTRA_ENV
67#endif
68
69#include <config_distro_bootcmd.h>
70
71/*
72 * memory layout for 32M uncompressed/compressed kernel,
73 * 1M fdt, 1M script, 1M pxe and 1M for overlay
74 * and the ramdisk at the end.
75 */
76#define __KERNEL_ADDR_R __stringify(0xc2000000)
77#define __FDT_ADDR_R __stringify(0xc4000000)
78#define __SCRIPT_ADDR_R __stringify(0xc4100000)
79#define __PXEFILE_ADDR_R __stringify(0xc4200000)
80#define __FDTOVERLAY_ADDR_R __stringify(0xc4300000)
81#define __RAMDISK_ADDR_R __stringify(0xc4400000)
82
83#define STM32MP_MEM_LAYOUT \
84 "kernel_addr_r=" __KERNEL_ADDR_R "\0" \
85 "fdt_addr_r=" __FDT_ADDR_R "\0" \
86 "scriptaddr=" __SCRIPT_ADDR_R "\0" \
87 "pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \
88 "fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \
89 "ramdisk_addr_r=" __RAMDISK_ADDR_R "\0"
90
91#define CONFIG_EXTRA_ENV_SETTINGS \
92 STM32MP_MEM_LAYOUT \
93 STM32MP_BOOTCMD \
94 BOOTENV \
95 STM32MP_EXTRA \
96 STM32MP_BOARD_EXTRA_ENV
97
98#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
99
100#endif /* __CONFIG_STM32MP13_COMMMON_H */