1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2016 NXP Semiconductors
4 *
5 * Configuration settings for the i.MX7S Warp board.
6 */
7
8#ifndef __WARP7_CONFIG_H
9#define __WARP7_CONFIG_H
10
11#include "mx7_common.h"
12#include <imximage.h>
13
14#define PHYS_SDRAM_SIZE			SZ_512M
15
16/* MMC Config*/
17#define CFG_SYS_FSL_ESDHC_ADDR       USDHC3_BASE_ADDR
18
19#define CFG_DFU_ENV_SETTINGS \
20	"dfu_alt_info=boot raw 0x2 0x1000 mmcpart 1\0" \
21
22/* When booting with FIT specify the node entry containing boot.scr */
23#if defined(CONFIG_FIT)
24#define BOOT_SCR_STRING "source ${bootscriptaddr}:${bootscr_fitimage_name}\0"
25#else
26#define BOOT_SCR_STRING "source ${bootscriptaddr}\0"
27#endif
28
29#define CFG_EXTRA_ENV_SETTINGS \
30	CFG_DFU_ENV_SETTINGS \
31	"script=boot.scr\0" \
32	"bootscr_fitimage_name=bootscr\0" \
33	"script_signed=boot.scr.imx-signed\0" \
34	"bootscriptaddr=0x83200000\0" \
35	"image=zImage\0" \
36	"console=ttymxc0\0" \
37	"ethact=usb_ether\0" \
38	"fdt_high=0xffffffff\0" \
39	"initrd_high=0xffffffff\0" \
40	"fdt_file=imx7s-warp.dtb\0" \
41	"fdt_addr=0x83000000\0" \
42	"fdtovaddr=0x83100000\0" \
43	"boot_fdt=try\0" \
44	"ip_dyn=yes\0" \
45	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
46	"mmcpart=1\0" \
47	"rootpart=" __stringify(CONFIG_WARP7_ROOT_PART) "\0" \
48	"finduuid=part uuid mmc 0:${rootpart} uuid\0" \
49	"mmcargs=setenv bootargs console=${console},${baudrate} " \
50		"root=PARTUUID=${uuid} rootwait rw\0" \
51	"ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\
52	"warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \
53	"do_bootscript_hab=" \
54		"if test ${hab_enabled} -eq 1; then " \
55			"setexpr hab_ivt_addr ${bootscriptaddr} - ${ivt_offset}; " \
56			"setenv script ${script_signed}; " \
57			"load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \
58			"run warp7_auth_or_fail; " \
59			"run bootscript; "\
60		"fi;\0" \
61	"loadbootscript=" \
62		"load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} ${script};\0" \
63	"bootscript=echo Running bootscript from mmc ...; " \
64		BOOT_SCR_STRING \
65	"loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
66	"loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
67	"mmcboot=echo Booting from mmc ...; " \
68		"run finduuid; " \
69		"run mmcargs; " \
70		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
71			"if run loadfdt; then " \
72				"bootz ${loadaddr} - ${fdt_addr}; " \
73			"else " \
74				"if test ${boot_fdt} = try; then " \
75					"bootz; " \
76				"else " \
77					"echo WARN: Cannot load the DT; " \
78				"fi; " \
79			"fi; " \
80		"else " \
81			"bootz; " \
82		"fi;\0" \
83
84/* Physical Memory Map */
85#define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
86
87#define CFG_SYS_SDRAM_BASE		PHYS_SDRAM
88#define CFG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
89#define CFG_SYS_INIT_RAM_SIZE	IRAM_SIZE
90
91/* environment organization */
92
93#define CFG_SYS_FSL_USDHC_NUM	1
94
95
96#define CFG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
97
98/* USB Device Firmware Update support */
99#define DFU_DEFAULT_POLL_TIMEOUT	300
100
101/* Environment variable name to represent HAB enable state */
102#define HAB_ENABLED_ENVNAME		"hab_enabled"
103
104#endif
105