Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 1 | /* 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 Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 17 | /* MMC Config*/ |
Tom Rini | 6cc0454 | 2022-10-28 20:27:13 -0400 | [diff] [blame] | 18 | #define CFG_SYS_FSL_ESDHC_ADDR 0 |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 19 | |
Eduard Strehlau | 7f932c6 | 2023-04-26 13:04:48 -0300 | [diff] [blame] | 20 | /* default to no extra bootparams, we need an empty define for stringification*/ |
| 21 | #ifndef EXTRA_BOOTPARAMS |
| 22 | #define EXTRA_BOOTPARAMS |
| 23 | #endif |
| 24 | |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 25 | #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 Rini | 0613c36 | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 51 | #define CFG_EXTRA_ENV_SETTINGS \ |
Eduard Strehlau | f3ce9db | 2023-04-26 13:04:56 -0300 | [diff] [blame] | 52 | "image=fitImage\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 53 | "console=ttymxc0\0" \ |
| 54 | "fdtfile=imx7d-smegw01.dtb\0" \ |
| 55 | "fdt_addr=0x83000000\0" \ |
| 56 | "bootm_size=0x10000000\0" \ |
Eduard Strehlau | b1bbdf1 | 2023-04-26 13:04:55 -0300 | [diff] [blame] | 57 | "mmcdev=1\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 58 | "mmcpart=1\0" \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 59 | "mmcpart_committed=1\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 60 | "mmcargs=setenv bootargs console=${console},${baudrate} " \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 61 | "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 Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 63 | "commit_mmc=if test \"${ustate}\" = 1 -a \"${mmcpart}\" != \"${mmcpart_committed}\"; then " \ |
| 64 | "setenv mmcpart_committed ${mmcpart};" \ |
| 65 | "saveenv;" \ |
| 66 | "fi;\0" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 67 | "bootlimit=3\0" \ |
Eduard Strehlau | f3ce9db | 2023-04-26 13:04:56 -0300 | [diff] [blame] | 68 | "fit_addr=0x88000000\0" \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 69 | "loadimage=load mmc ${mmcdev}:${gpt_partition_entry} ${fit_addr} boot/${image}\0" \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 70 | "loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}\0" \ |
| 71 | "loadbootpart=mmc partconf 1 boot_part\0" \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 72 | "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 Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 81 | "run commit_mmc; " \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 82 | "echo mmcpart: ${mmcpart_committed}; " \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 83 | "run loadpart; " \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 84 | "echo gptpart: ${gpt_partition_entry}; " \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 85 | "run loadbootpart; " \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 86 | "if run loadimage; then " \ |
| 87 | "; " \ |
| 88 | "else " \ |
| 89 | "run altbootcmd; " \ |
| 90 | "fi; " \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 91 | "run mmcargs; " \ |
Eduard Strehlau | f3ce9db | 2023-04-26 13:04:56 -0300 | [diff] [blame] | 92 | "if bootm ${fit_addr}; then " \ |
| 93 | "; " \ |
Eduard Strehlau | 440dc06 | 2023-04-26 13:04:52 -0300 | [diff] [blame] | 94 | "else " \ |
| 95 | "run altbootcmd; " \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 96 | "fi;\0" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 97 | "altbootcmd=echo Performing rollback...; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 98 | "if test \"${mmcpart_committed}\" = 1; then " \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 99 | "setenv mmcpart 2; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 100 | "setenv mmcpart_committed 2;" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 101 | "else " \ |
| 102 | "setenv mmcpart 1; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 103 | "setenv mmcpart_committed 1;" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 104 | "fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \ |
Eduard Strehlau | a1bc4f1 | 2023-04-26 13:04:57 -0300 | [diff] [blame^] | 105 | "run bootcmd;\0" \ |
| 106 | SETUP_BOOT_MENU |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 107 | |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 108 | /* Physical Memory Map */ |
| 109 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 110 | |
Tom Rini | aa6e94d | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 111 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 112 | #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 113 | #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 114 | |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 115 | #endif |