Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 1 | /* 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 Rini | bb4dd96 | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 16 | #define CFG_SYS_SDRAM_BASE STM32_DDR_BASE |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 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 | */ |
Tom Rini | 6a5dccc | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 22 | #define CFG_SYS_BOOTMAPSZ SZ_256M |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 23 | |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 24 | /* NAND support */ |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 25 | |
| 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 | |
Patrick Delaunay | bf99d3d | 2023-09-26 17:09:22 +0200 | [diff] [blame] | 38 | #ifdef CONFIG_CMD_USB |
| 39 | #define BOOT_TARGET_USB(func) func(USB, usb, 0) |
| 40 | #else |
| 41 | #define BOOT_TARGET_USB(func) |
| 42 | #endif |
| 43 | |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 44 | #define BOOT_TARGET_DEVICES(func) \ |
| 45 | BOOT_TARGET_MMC1(func) \ |
Patrick Delaunay | bf99d3d | 2023-09-26 17:09:22 +0200 | [diff] [blame] | 46 | BOOT_TARGET_MMC0(func) \ |
| 47 | BOOT_TARGET_USB(func) |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 48 | |
| 49 | /* |
| 50 | * default bootcmd for stm32mp13: |
Patrick Delaunay | 45a68e2 | 2023-09-26 17:09:21 +0200 | [diff] [blame] | 51 | * for serial/usb: execute the stm32prog command |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 52 | * for mmc boot (eMMC, SD card), distro boot on the same mmc device |
| 53 | */ |
| 54 | #define STM32MP_BOOTCMD "bootcmd_stm32mp=" \ |
| 55 | "echo \"Boot over ${boot_device}${boot_instance}!\";" \ |
Patrick Delaunay | 45a68e2 | 2023-09-26 17:09:21 +0200 | [diff] [blame] | 56 | "if test ${boot_device} = serial || test ${boot_device} = usb;" \ |
| 57 | "then stm32prog ${boot_device} ${boot_instance}; " \ |
| 58 | "else " \ |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 59 | "run env_check;" \ |
| 60 | "if test ${boot_device} = mmc;" \ |
| 61 | "then env set boot_targets \"mmc${boot_instance}\"; fi;" \ |
| 62 | "run distro_bootcmd;" \ |
| 63 | "fi;\0" |
| 64 | |
| 65 | #define STM32MP_EXTRA \ |
| 66 | "env_check=if env info -p -d -q; then env save; fi\0" \ |
| 67 | "boot_net_usb_start=true\0" |
| 68 | |
| 69 | #ifndef STM32MP_BOARD_EXTRA_ENV |
| 70 | #define STM32MP_BOARD_EXTRA_ENV |
| 71 | #endif |
| 72 | |
| 73 | #include <config_distro_bootcmd.h> |
| 74 | |
| 75 | /* |
| 76 | * memory layout for 32M uncompressed/compressed kernel, |
| 77 | * 1M fdt, 1M script, 1M pxe and 1M for overlay |
| 78 | * and the ramdisk at the end. |
| 79 | */ |
| 80 | #define __KERNEL_ADDR_R __stringify(0xc2000000) |
| 81 | #define __FDT_ADDR_R __stringify(0xc4000000) |
| 82 | #define __SCRIPT_ADDR_R __stringify(0xc4100000) |
| 83 | #define __PXEFILE_ADDR_R __stringify(0xc4200000) |
| 84 | #define __FDTOVERLAY_ADDR_R __stringify(0xc4300000) |
| 85 | #define __RAMDISK_ADDR_R __stringify(0xc4400000) |
| 86 | |
| 87 | #define STM32MP_MEM_LAYOUT \ |
| 88 | "kernel_addr_r=" __KERNEL_ADDR_R "\0" \ |
| 89 | "fdt_addr_r=" __FDT_ADDR_R "\0" \ |
| 90 | "scriptaddr=" __SCRIPT_ADDR_R "\0" \ |
| 91 | "pxefile_addr_r=" __PXEFILE_ADDR_R "\0" \ |
| 92 | "fdtoverlay_addr_r=" __FDTOVERLAY_ADDR_R "\0" \ |
| 93 | "ramdisk_addr_r=" __RAMDISK_ADDR_R "\0" |
| 94 | |
Tom Rini | c9edebe | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 95 | #define CFG_EXTRA_ENV_SETTINGS \ |
Patrick Delaunay | 123687c | 2022-05-20 18:24:46 +0200 | [diff] [blame] | 96 | STM32MP_MEM_LAYOUT \ |
| 97 | STM32MP_BOOTCMD \ |
| 98 | BOOTENV \ |
| 99 | STM32MP_EXTRA \ |
| 100 | STM32MP_BOARD_EXTRA_ENV |
| 101 | |
| 102 | #endif /* ifdef CONFIG_DISTRO_DEFAULTS*/ |
| 103 | |
| 104 | #endif /* __CONFIG_STM32MP13_COMMMON_H */ |