1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2016 Freescale Semiconductor, Inc.
4  *
5  * Configuration settings for the Freescale i.MX7ULP EVK board.
6  */
7 
8 #ifndef __MX7ULP_EVK_CONFIG_H
9 #define __MX7ULP_EVK_CONFIG_H
10 
11 #include <linux/sizes.h>
12 #include <asm/arch/imx-regs.h>
13 
14 #define CONFIG_BOARD_POSTCLK_INIT
15 #define CONFIG_SYS_BOOTM_LEN		0x1000000
16 
17 #define CONFIG_MMCROOT                  "/dev/mmcblk0p2"  /* USDHC1 */
18 #define CONFIG_SYS_MMC_IMG_LOAD_PART    1
19 
20 /* Using ULP WDOG for reset */
21 #define WDOG_BASE_ADDR			WDG1_RBASE
22 
23 #define CONFIG_SYS_HZ_CLOCK		1000000 /* Fixed at 1Mhz from TSTMR */
24 
25 #define CONFIG_INITRD_TAG
26 #define CONFIG_CMDLINE_TAG
27 #define CONFIG_SETUP_MEMORY_TAGS
28 /*#define CONFIG_REVISION_TAG*/
29 
30 /* Size of malloc() pool */
31 #define CONFIG_SYS_MALLOC_LEN		(8 * SZ_1M)
32 
33 /* UART */
34 #define LPUART_BASE			LPUART4_RBASE
35 
36 #define CONFIG_SYS_CACHELINE_SIZE      64
37 
38 /* Miscellaneous configurable options */
39 #define CONFIG_SYS_PROMPT		"=> "
40 #define CONFIG_SYS_CBSIZE		512
41 
42 #define CONFIG_SYS_MAXARGS		256
43 
44 /* Physical Memory Map */
45 
46 #define PHYS_SDRAM			0x60000000
47 #define PHYS_SDRAM_SIZE			SZ_1G
48 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM
49 
50 #define CONFIG_LOADADDR             0x60800000
51 
52 #define CONFIG_EXTRA_ENV_SETTINGS \
53 	"script=boot.scr\0" \
54 	"image=zImage\0" \
55 	"console=ttyLP0\0" \
56 	"fdt_high=0xffffffff\0" \
57 	"initrd_high=0xffffffff\0" \
58 	"fdt_file=imx7ulp-evk.dtb\0" \
59 	"fdt_addr=0x63000000\0" \
60 	"boot_fdt=try\0" \
61 	"earlycon=lpuart32,0x402D0010\0" \
62 	"ip_dyn=yes\0" \
63 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
64 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
65 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
66 	"mmcautodetect=yes\0" \
67 	"mmcargs=setenv bootargs console=${console},${baudrate} " \
68 		"root=${mmcroot}\0" \
69 	"loadbootscript=" \
70 		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
71 	"bootscript=echo Running bootscript from mmc ...; " \
72 		"source\0" \
73 	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
74 	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
75 	"mmcboot=echo Booting from mmc ...; " \
76 		"run mmcargs; " \
77 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
78 			"if run loadfdt; then " \
79 				"bootz ${loadaddr} - ${fdt_addr}; " \
80 			"else " \
81 				"if test ${boot_fdt} = try; then " \
82 					"bootz; " \
83 				"else " \
84 					"echo WARN: Cannot load the DT; " \
85 				"fi; " \
86 			"fi; " \
87 		"else " \
88 			"bootz; " \
89 		"fi;\0" \
90 	"netargs=setenv bootargs console=${console},${baudrate} " \
91 		"root=/dev/nfs " \
92 		"ip=:::::eth0:dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
93 	"netboot=echo Booting from net ...; " \
94 		"run netargs; " \
95 		"if test ${ip_dyn} = yes; then " \
96 			"setenv get_cmd dhcp; " \
97 		"else " \
98 			"setenv get_cmd tftp; " \
99 		"fi; " \
100 		"usb start; "\
101 		"${get_cmd} ${image}; " \
102 		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
103 			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
104 				"bootz ${loadaddr} - ${fdt_addr}; " \
105 			"else " \
106 				"if test ${boot_fdt} = try; then " \
107 					"bootz; " \
108 				"else " \
109 					"echo WARN: Cannot load the DT; " \
110 				"fi; " \
111 			"fi; " \
112 		"else " \
113 			"bootz; " \
114 		"fi;\0" \
115 
116 #define CONFIG_BOOTCOMMAND \
117 	   "mmc dev ${mmcdev}; if mmc rescan; then " \
118 		   "if run loadbootscript; then " \
119 			   "run bootscript; " \
120 		   "else " \
121 			   "if run loadimage; then " \
122 				   "run mmcboot; " \
123 			   "fi; " \
124 		   "fi; " \
125 	   "fi"
126 
127 #define CONFIG_SYS_HZ			1000
128 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
129 
130 #define CONFIG_SYS_INIT_RAM_ADDR	IRAM_BASE_ADDR
131 #define CONFIG_SYS_INIT_RAM_SIZE	SZ_256K
132 
133 #define CONFIG_SYS_INIT_SP_OFFSET \
134 	(CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
135 #define CONFIG_SYS_INIT_SP_ADDR \
136 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
137 
138 #endif	/* __CONFIG_H */
139