blob: 3e3f49abae0660b2f56533d20944b487df7d54dd [file] [log] [blame]
Patrick Delaunay123687c2022-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 */
Tom Rinibb4dd962022-11-16 13:10:37 -050016#define CFG_SYS_SDRAM_BASE STM32_DDR_BASE
Patrick Delaunay123687c2022-05-20 18:24:46 +020017
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 */
Tom Rini6a5dccc2022-11-16 13:10:41 -050022#define CFG_SYS_BOOTMAPSZ SZ_256M
Patrick Delaunay123687c2022-05-20 18:24:46 +020023
Patrick Delaunay123687c2022-05-20 18:24:46 +020024/*****************************************************************************/
25#ifdef CONFIG_DISTRO_DEFAULTS
26/*****************************************************************************/
27
28#ifdef CONFIG_CMD_MMC
29#define BOOT_TARGET_MMC0(func) func(MMC, mmc, 0)
30#define BOOT_TARGET_MMC1(func) func(MMC, mmc, 1)
31#else
32#define BOOT_TARGET_MMC0(func)
33#define BOOT_TARGET_MMC1(func)
34#endif
35
Patrick Delaunaybf99d3d2023-09-26 17:09:22 +020036#ifdef CONFIG_CMD_USB
37#define BOOT_TARGET_USB(func) func(USB, usb, 0)
38#else
39#define BOOT_TARGET_USB(func)
40#endif
41
Patrick Delaunay123687c2022-05-20 18:24:46 +020042#define BOOT_TARGET_DEVICES(func) \
43 BOOT_TARGET_MMC1(func) \
Patrick Delaunaybf99d3d2023-09-26 17:09:22 +020044 BOOT_TARGET_MMC0(func) \
45 BOOT_TARGET_USB(func)
Patrick Delaunay123687c2022-05-20 18:24:46 +020046
47/*
48 * default bootcmd for stm32mp13:
Patrick Delaunay45a68e22023-09-26 17:09:21 +020049 * for serial/usb: execute the stm32prog command
Patrick Delaunay123687c2022-05-20 18:24:46 +020050 * for mmc boot (eMMC, SD card), distro boot on the same mmc device
51 */
52#define STM32MP_BOOTCMD "bootcmd_stm32mp=" \
53 "echo \"Boot over ${boot_device}${boot_instance}!\";" \
Patrick Delaunay45a68e22023-09-26 17:09:21 +020054 "if test ${boot_device} = serial || test ${boot_device} = usb;" \
55 "then stm32prog ${boot_device} ${boot_instance}; " \
56 "else " \
Patrick Delaunay123687c2022-05-20 18:24:46 +020057 "run env_check;" \
58 "if test ${boot_device} = mmc;" \
59 "then env set boot_targets \"mmc${boot_instance}\"; fi;" \
60 "run distro_bootcmd;" \
61 "fi;\0"
62
63#define STM32MP_EXTRA \
64 "env_check=if env info -p -d -q; then env save; fi\0" \
65 "boot_net_usb_start=true\0"
66
67#ifndef STM32MP_BOARD_EXTRA_ENV
68#define STM32MP_BOARD_EXTRA_ENV
69#endif
70
71#include <config_distro_bootcmd.h>
72
73/*
74 * memory layout for 32M uncompressed/compressed kernel,
75 * 1M fdt, 1M script, 1M pxe and 1M for overlay
76 * and the ramdisk at the end.
77 */
78#define __KERNEL_ADDR_R __stringify(0xc2000000)
79#define __FDT_ADDR_R __stringify(0xc4000000)
80#define __SCRIPT_ADDR_R __stringify(0xc4100000)
81#define __PXEFILE_ADDR_R __stringify(0xc4200000)
82#define __FDTOVERLAY_ADDR_R __stringify(0xc4300000)
83#define __RAMDISK_ADDR_R __stringify(0xc4400000)
84
85#define STM32MP_MEM_LAYOUT \
86 "kernel_addr_r=" __KERNEL_ADDR_R "\0" \
87 "fdt_addr_r=" __FDT_ADDR_R "\0" \
88 "scriptaddr=" __SCRIPT_ADDR_R "\0" \
89 "pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \
90 "fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \
91 "ramdisk_addr_r=" __RAMDISK_ADDR_R "\0"
92
Tom Rinic9edebe2022-12-04 10:03:50 -050093#define CFG_EXTRA_ENV_SETTINGS \
Patrick Delaunay123687c2022-05-20 18:24:46 +020094 STM32MP_MEM_LAYOUT \
95 STM32MP_BOOTCMD \
96 BOOTENV \
97 STM32MP_EXTRA \
98 STM32MP_BOARD_EXTRA_ENV
99
100#endif /* ifdef CONFIG_DISTRO_DEFAULTS*/
101
102#endif /* __CONFIG_STM32MP13_COMMMON_H */