1 /*
2  * (c) 2015 Purna Chandra Mandal <purna.mandal@microchip.com>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  *
6  * Microchip PIC32MZ[DA] Starter Kit.
7  */
8 
9 #ifndef __PIC32MZDASK_CONFIG_H
10 #define __PIC32MZDASK_CONFIG_H
11 
12 /* System Configuration */
13 #define CONFIG_SYS_TEXT_BASE		0x9d004000 /* .text */
14 #define CONFIG_DISPLAY_BOARDINFO
15 
16 /*--------------------------------------------
17  * CPU configuration
18  */
19 /* CPU Timer rate */
20 #define CONFIG_SYS_MIPS_TIMER_FREQ	100000000
21 
22 /* Cache Configuration */
23 #define CONFIG_SYS_MIPS_CACHE_MODE	CONF_CM_CACHABLE_NONCOHERENT
24 
25 /*----------------------------------------------------------------------
26  * Memory Layout
27  */
28 #define CONFIG_SYS_SRAM_BASE		0x80000000
29 #define CONFIG_SYS_SRAM_SIZE		0x00080000 /* 512K */
30 
31 /* Initial RAM for temporary stack, global data */
32 #define CONFIG_SYS_INIT_RAM_SIZE	0x10000
33 #define CONFIG_SYS_INIT_RAM_ADDR	\
34 	(CONFIG_SYS_SRAM_BASE + CONFIG_SYS_SRAM_SIZE - CONFIG_SYS_INIT_RAM_SIZE)
35 #define CONFIG_SYS_INIT_SP_ADDR		\
36 	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE - 1)
37 
38 /* SDRAM Configuration (for final code, data, stack, heap) */
39 #define CONFIG_SYS_SDRAM_BASE		0x88000000
40 #define CONFIG_SYS_MALLOC_LEN		(256 << 10)
41 #define CONFIG_SYS_BOOTPARAMS_LEN	(4 << 10)
42 #define CONFIG_STACKSIZE		(4 << 10) /* regular stack */
43 
44 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
45 #define CONFIG_SYS_MONITOR_LEN		(192 << 10)
46 
47 #define CONFIG_SYS_LOAD_ADDR		0x88500000 /* default load address */
48 #define CONFIG_SYS_ENV_ADDR		0x88300000
49 #define CONFIG_SYS_FDT_ADDR		0x89d00000
50 
51 /* Memory Test */
52 #define CONFIG_SYS_MEMTEST_START	0x88000000
53 #define CONFIG_SYS_MEMTEST_END		0x88080000
54 
55 /*----------------------------------------------------------------------
56  * Commands
57  */
58 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
59 #define CONFIG_CMD_CLK
60 
61 /*-------------------------------------------------
62  * FLASH configuration
63  */
64 #define CONFIG_SYS_NO_FLASH
65 
66 /*------------------------------------------------------------
67  * Console Configuration
68  */
69 #define CONFIG_BAUDRATE			115200
70 #define CONFIG_SYS_CBSIZE		1024 /* Console I/O Buffer Size   */
71 #define CONFIG_SYS_MAXARGS		16   /* max number of command args*/
72 #define CONFIG_SYS_PBSIZE		\
73 		(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
74 #define CONFIG_CMDLINE_EDITING		1
75 
76 /*-----------------------------------------------------------------------
77  * Networking Configuration
78  */
79 #define CONFIG_MII
80 #define CONFIG_PHY_SMSC
81 #define CONFIG_SYS_RX_ETH_BUFFER	8
82 #define CONFIG_NET_RETRY_COUNT		20
83 #define CONFIG_ARP_TIMEOUT		500 /* millisec */
84 
85 #define CONFIG_CMD_MII
86 
87 /*
88  * BOOTP options
89  */
90 #define CONFIG_BOOTP_BOOTFILESIZE
91 #define CONFIG_BOOTP_BOOTPATH
92 #define CONFIG_BOOTP_GATEWAY
93 #define CONFIG_BOOTP_HOSTNAME
94 
95 /*
96  * Handover flattened device tree (dtb file) to Linux kernel
97  */
98 #define CONFIG_OF_LIBFDT	1
99 
100 /*-----------------------------------------------------------------------
101  * SDHC Configuration
102  */
103 #define CONFIG_SDHCI
104 #define CONFIG_MMC
105 #define CONFIG_GENERIC_MMC
106 #define CONFIG_CMD_MMC
107 
108 /*-----------------------------------------------------------------------
109  * File System Configuration
110  */
111 /* FAT FS */
112 #define CONFIG_DOS_PARTITION
113 #define CONFIG_PARTITION_UUIDS
114 #define CONFIG_SUPPORT_VFAT
115 #define CONFIG_FS_FAT
116 #define CONFIG_FAT_WRITE
117 #define CONFIG_CMD_FS_GENERIC
118 #define CONFIG_CMD_PART
119 #define CONFIG_CMD_FAT
120 
121 /* EXT4 FS */
122 #define CONFIG_FS_EXT4
123 #define CONFIG_CMD_EXT2
124 #define CONFIG_CMD_EXT4
125 #define CONFIG_CMD_EXT4_WRITE
126 
127 /* -------------------------------------------------
128  * Environment
129  */
130 #define CONFIG_ENV_IS_NOWHERE	1
131 #define CONFIG_ENV_SIZE		0x4000
132 
133 /* ---------------------------------------------------------------------
134  * Board boot configuration
135  */
136 #define CONFIG_TIMESTAMP	/* Print image info with timestamp */
137 #define CONFIG_BOOTDELAY	5
138 
139 #define MEM_LAYOUT_ENV_SETTINGS					\
140 	"kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0"	\
141 	"fdt_addr_r="__stringify(CONFIG_SYS_FDT_ADDR)"\0"	\
142 	"scriptaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0"
143 
144 #define CONFIG_LEGACY_BOOTCMD_ENV					\
145 	"legacy_bootcmd= "						\
146 		"if load mmc 0 ${scriptaddr} uEnv.txt; then "		\
147 			"env import -tr ${scriptaddr} ${filesize}; "	\
148 			"if test -n \"${bootcmd_uenv}\" ; then "	\
149 				"echo Running bootcmd_uenv ...; "	\
150 				"run bootcmd_uenv; "			\
151 			"fi; "						\
152 		"fi; \0"
153 
154 #define BOOT_TARGET_DEVICES(func)	\
155 	func(MMC, mmc, 0)		\
156 	func(DHCP, dhcp, na)
157 
158 #include <config_distro_bootcmd.h>
159 
160 #define CONFIG_EXTRA_ENV_SETTINGS	\
161 	MEM_LAYOUT_ENV_SETTINGS		\
162 	CONFIG_LEGACY_BOOTCMD_ENV	\
163 	BOOTENV
164 
165 #undef CONFIG_BOOTCOMMAND
166 #define CONFIG_BOOTCOMMAND	"run distro_bootcmd || run legacy_bootcmd"
167 
168 #endif	/* __PIC32MZDASK_CONFIG_H */
169