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 | |
Tom Rini | 0613c36 | 2022-12-04 10:03:50 -0500 | [diff] [blame] | 25 | #define CFG_EXTRA_ENV_SETTINGS \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 26 | "image=zImage\0" \ |
| 27 | "console=ttymxc0\0" \ |
| 28 | "fdtfile=imx7d-smegw01.dtb\0" \ |
| 29 | "fdt_addr=0x83000000\0" \ |
| 30 | "bootm_size=0x10000000\0" \ |
Eduard Strehlau | b1bbdf1 | 2023-04-26 13:04:55 -0300 | [diff] [blame^] | 31 | "mmcdev=1\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 32 | "mmcpart=1\0" \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 33 | "mmcpart_committed=1\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 34 | "mmcargs=setenv bootargs console=${console},${baudrate} " \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 35 | "root=/dev/mmcblk${mmcdev}p${gpt_partition_entry} rootwait rw " \ |
| 36 | __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] | 37 | "commit_mmc=if test \"${ustate}\" = 1 -a \"${mmcpart}\" != \"${mmcpart_committed}\"; then " \ |
| 38 | "setenv mmcpart_committed ${mmcpart};" \ |
| 39 | "saveenv;" \ |
| 40 | "fi;\0" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 41 | "bootlimit=3\0" \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 42 | "loadimage=load mmc ${mmcdev}#rootfs-${mmcpart_committed} ${loadaddr} boot/${image}\0" \ |
| 43 | "loadfdt=load mmc ${mmcdev}#rootfs-${mmcpart_committed} ${fdt_addr} boot/${fdtfile}\0" \ |
| 44 | "loadpart=gpt setenv mmc ${mmcdev} rootfs-${mmcpart_committed}\0" \ |
| 45 | "loadbootpart=mmc partconf 1 boot_part\0" \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 46 | "mmcboot=echo Booting from mmc ...; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 47 | "run commit_mmc; " \ |
Eduard Strehlau | 31c6c79 | 2023-04-26 13:04:54 -0300 | [diff] [blame] | 48 | "run loadpart; " \ |
| 49 | "run loadbootpart; " \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 50 | "run mmcargs; " \ |
| 51 | "if run loadfdt; then " \ |
Eduard Strehlau | 440dc06 | 2023-04-26 13:04:52 -0300 | [diff] [blame] | 52 | "if bootz ${loadaddr} - ${fdt_addr}; then " \ |
| 53 | "; " \ |
| 54 | "else " \ |
| 55 | "run altbootcmd; " \ |
| 56 | "fi;" \ |
| 57 | "else " \ |
| 58 | "run altbootcmd; " \ |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 59 | "fi;\0" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 60 | "altbootcmd=echo Performing rollback...; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 61 | "if test \"${mmcpart_committed}\" = 1; then " \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 62 | "setenv mmcpart 2; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 63 | "setenv mmcpart_committed 2;" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 64 | "else " \ |
| 65 | "setenv mmcpart 1; " \ |
Eduard Strehlau | 52726d2 | 2023-04-26 13:04:53 -0300 | [diff] [blame] | 66 | "setenv mmcpart_committed 1;" \ |
Eduard Strehlau | ac52bb9 | 2023-04-26 13:04:51 -0300 | [diff] [blame] | 67 | "fi; setenv bootcount 0; setenv upgrade_available; setenv ustate 3; saveenv; " \ |
| 68 | "run bootcmd;\0" |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 69 | |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 70 | /* Physical Memory Map */ |
| 71 | #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR |
| 72 | |
Tom Rini | aa6e94d | 2022-11-16 13:10:37 -0500 | [diff] [blame] | 73 | #define CFG_SYS_SDRAM_BASE PHYS_SDRAM |
Tom Rini | 65cc0e2 | 2022-11-16 13:10:41 -0500 | [diff] [blame] | 74 | #define CFG_SYS_INIT_RAM_ADDR IRAM_BASE_ADDR |
| 75 | #define CFG_SYS_INIT_RAM_SIZE IRAM_SIZE |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 76 | |
Fabio Estevam | 40496ac | 2021-05-28 10:26:57 -0300 | [diff] [blame] | 77 | #endif |