blob: 07a5bfc8a86e627e764ccacdc7063096ae534bab [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
Patrick Delaunay960debb2022-05-20 18:24:46 +020024/* NAND support */
Patrick Delaunay960debb2022-05-20 18:24:46 +020025
26/*****************************************************************************/
27#ifdef CONFIG_DISTRO_DEFAULTS
28/*****************************************************************************/
29
30#ifdef CONFIG_CMD_MMC
31#define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0)
32#define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1)
33#else
34#define BOOT_TARGET_MMC0(func)
35#define BOOT_TARGET_MMC1(func)
36#endif
37
38#define BOOT_TARGET_DEVICES(func) \
39 BOOT_TARGET_MMC1(func) \
40 BOOT_TARGET_MMC0(func)
41
42/*
43 * default bootcmd for stm32mp13:
44 * for mmc boot (eMMC, SD card), distro boot on the same mmc device
45 */
46#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
47 "echo \"Boot over ${boot_device}${boot_instance}!\";" \
48 "run env_check;" \
49 "if test ${boot_device} = mmc;" \
50 "then env set boot_targets \"mmc${boot_instance}\"; fi;" \
51 "run distro_bootcmd;" \
52 "fi;\0"
53
54#define STM32MP_EXTRA \
55 "env_check=if env info -p -d -q; then env save; fi\0" \
56 "boot_net_usb_start=true\0"
57
58#ifndef STM32MP_BOARD_EXTRA_ENV
59#define STM32MP_BOARD_EXTRA_ENV
60#endif
61
62#include <config_distro_bootcmd.h>
63
64/*
65 * memory layout for 32M uncompressed/compressed kernel,
66 * 1M fdt, 1M script, 1M pxe and 1M for overlay
67 * and the ramdisk at the end.
68 */
69#define __KERNEL_ADDR_R __stringify(0xc2000000)
70#define __FDT_ADDR_R __stringify(0xc4000000)
71#define __SCRIPT_ADDR_R __stringify(0xc4100000)
72#define __PXEFILE_ADDR_R __stringify(0xc4200000)
73#define __FDTOVERLAY_ADDR_R __stringify(0xc4300000)
74#define __RAMDISK_ADDR_R __stringify(0xc4400000)
75
76#define STM32MP_MEM_LAYOUT \
77 "kernel_addr_r=" __KERNEL_ADDR_R "\0" \
78 "fdt_addr_r=" __FDT_ADDR_R "\0" \
79 "scriptaddr=" __SCRIPT_ADDR_R "\0" \
80 "pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \
81 "fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \
82 "ramdisk_addr_r=" __RAMDISK_ADDR_R "\0"
83
84#define CONFIG_EXTRA_ENV_SETTINGS \
85 STM32MP_MEM_LAYOUT \
86 STM32MP_BOOTCMD \
87 BOOTENV \
88 STM32MP_EXTRA \
89 STM32MP_BOARD_EXTRA_ENV
90
91#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
92
93#endif /* __CONFIG_STM32MP13_COMMMON_H */