blob: 6f373973ab84a900833a38595ddc9b51a7dbb7aa [file] [log] [blame]
Fabio Estevam40496ac2021-05-28 10:26:57 -03001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2016 NXP Semiconductors
4 * Copyright (C) 2021 Fabio Estevam <festevam@denx.de>
5 *
6 * Configuration settings for the smegw01 board.
7 */
8
9#ifndef __SMEGW01_CONFIG_H
10#define __SMEGW01_CONFIG_H
11
12#include "mx7_common.h"
13#include <imximage.h>
14
15#define PHYS_SDRAM_SIZE SZ_512M
16
Fabio Estevam40496ac2021-05-28 10:26:57 -030017/* MMC Config*/
Tom Rini6cc04542022-10-28 20:27:13 -040018#define CFG_SYS_FSL_ESDHC_ADDR 0
Fabio Estevam40496ac2021-05-28 10:26:57 -030019
Eduard Strehlau7f932c62023-04-26 13:04:48 -030020/* default to no extra bootparams, we need an empty define for stringification*/
21#ifndef EXTRA_BOOTPARAMS
22#define EXTRA_BOOTPARAMS
23#endif
24
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030025#ifdef CONFIG_SYS_BOOT_LOCKED
26#define EXTRA_ENV_FLAGS
27#define SETUP_BOOT_MENU "setup_boot_menu=setenv bootmenu_0 eMMC=run bootcmd\0"
28#else
29#define EXTRA_ENV_FLAGS "mmcdev:dw,"
30#define SETUP_BOOT_MENU "setup_boot_menu=" \
31 "if test \"${mmcdev}\" = 1; then " \
32 "setenv emmc_priority 0;" \
33 "setenv sd_priority 1;" \
34 "else " \
35 "setenv emmc_priority 1;" \
36 "setenv sd_priority 0;" \
37 "fi;" \
38 "setenv bootmenu_${emmc_priority} eMMC=run boot_emmc;" \
39 "setenv bootmenu_${sd_priority} SD=run boot_sd;\0"
40#endif
41
42#define CFG_ENV_FLAGS_LIST_STATIC \
43 "mmcpart:dw," \
44 "mmcpart_committed:dw," \
45 "ustate:dw," \
46 "bootcount:dw," \
47 "bootlimit:dw," \
48 "upgrade_available:dw," \
49 EXTRA_ENV_FLAGS
50
Tom Rini0613c362022-12-04 10:03:50 -050051#define CFG_EXTRA_ENV_SETTINGS \
Eduard Strehlauf3ce9db2023-04-26 13:04:56 -030052 "image=fitImage\0" \
Fabio Estevam40496ac2021-05-28 10:26:57 -030053 "console=ttymxc0\0" \
54 "fdtfile=imx7d-smegw01.dtb\0" \
55 "fdt_addr=0x83000000\0" \
56 "bootm_size=0x10000000\0" \
Eduard Strehlaub1bbdf12023-04-26 13:04:55 -030057 "mmcdev=1\0" \
Fabio Estevam40496ac2021-05-28 10:26:57 -030058 "mmcpart=1\0" \
Eduard Strehlau52726d22023-04-26 13:04:53 -030059 "mmcpart_committed=1\0" \
Fabio Estevam40496ac2021-05-28 10:26:57 -030060 "mmcargs=setenv bootargs console=${console},${baudrate} " \
Eduard Strehlau31c6c792023-04-26 13:04:54 -030061 "root=/dev/mmcblk${mmcdev}p${gpt_partition_entry} rootwait rw " \
62 __stringify(EXTRA_BOOTPARAMS) " SM_ROOT_DEV=${mmcdev} SM_ROOT_PART=${gpt_partition_entry} SM_BOOT_PART=${boot_part}\0" \
Eduard Strehlau52726d22023-04-26 13:04:53 -030063 "commit_mmc=if test \"${ustate}\" = 1 -a \"${mmcpart}\" != \"${mmcpart_committed}\"; then " \
64 "setenv mmcpart_committed ${mmcpart};" \
65 "saveenv;" \
66 "fi;\0" \
Eduard Strehlauac52bb92023-04-26 13:04:51 -030067 "bootlimit=3\0" \
Eduard Strehlauf3ce9db2023-04-26 13:04:56 -030068 "fit_addr=0x88000000\0" \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030069 "loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image}\0" \
Eduard Strehlau31c6c792023-04-26 13:04:54 -030070 "loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}\0" \
71 "loadbootpart=mmc partconf 1 boot_part\0" \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030072 "boot_sd=setenv mmcdev_wanted 0; run persist_mmcdev; run bootcmd;\0" \
73 "boot_emmc=setenv mmcdev_wanted 1; run persist_mmcdev; run bootcmd;\0" \
74 "persist_mmcdev=" \
75 "if test \"${mmcdev}\" != \"${mmcdev_wanted}\"; then " \
76 "setenv mmcdev \"${mmcdev_wanted}\";" \
77 "saveenv;" \
78 "fi;\0" \
79 "mmcboot=echo Booting...; " \
80 "echo mmcdev: ${mmcdev}; " \
Eduard Strehlau52726d22023-04-26 13:04:53 -030081 "run commit_mmc; " \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030082 "echo mmcpart: ${mmcpart_committed}; " \
Eduard Strehlau31c6c792023-04-26 13:04:54 -030083 "run loadpart; " \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030084 "echo gptpart: ${gpt_partition_entry}; " \
Eduard Strehlau31c6c792023-04-26 13:04:54 -030085 "run loadbootpart; " \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -030086 "if run loadimage; then " \
87 "; " \
88 "else " \
89 "run altbootcmd; " \
90 "fi; " \
Fabio Estevam40496ac2021-05-28 10:26:57 -030091 "run mmcargs; " \
Eduard Strehlauf3ce9db2023-04-26 13:04:56 -030092 "if bootm ${fit_addr}; then " \
93 "; " \
Eduard Strehlau440dc062023-04-26 13:04:52 -030094 "else " \
95 "run altbootcmd; " \
Fabio Estevam40496ac2021-05-28 10:26:57 -030096 "fi;\0" \
Eduard Strehlauac52bb92023-04-26 13:04:51 -030097 "altbootcmd=echo Performing rollback...; " \
Eduard Strehlau52726d22023-04-26 13:04:53 -030098 "if test \"${mmcpart_committed}\" = 1; then " \
Eduard Strehlauac52bb92023-04-26 13:04:51 -030099 "setenv mmcpart 2; " \
Eduard Strehlau52726d22023-04-26 13:04:53 -0300100 "setenv mmcpart_committed 2;" \
Eduard Strehlauac52bb92023-04-26 13:04:51 -0300101 "else " \
102 "setenv mmcpart 1; " \
Eduard Strehlau52726d22023-04-26 13:04:53 -0300103 "setenv mmcpart_committed 1;" \
Eduard Strehlauac52bb92023-04-26 13:04:51 -0300104 "fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \
Eduard Strehlaua1bc4f12023-04-26 13:04:57 -0300105 "run bootcmd;\0" \
106 SETUP_BOOT_MENU
Fabio Estevam40496ac2021-05-28 10:26:57 -0300107
Fabio Estevam40496ac2021-05-28 10:26:57 -0300108/* Physical Memory Map */
109#define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
110
Tom Riniaa6e94d2022-11-16 13:10:37 -0500111#define CFG_SYS_SDRAM_BASE PHYS_SDRAM
Tom Rini65cc0e22022-11-16 13:10:41 -0500112#define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR
113#define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE
Fabio Estevam40496ac2021-05-28 10:26:57 -0300114
Fabio Estevam40496ac2021-05-28 10:26:57 -0300115#endif