xref: /rk3399_rockchip-uboot/include/configs/nokia_rx51.h (revision bdf10677a96d1d0c4da209b0a5d7c877760a4984)
1 /*
2  * (C) Copyright 2011-2012
3  * Pali Rohár <pali.rohar@gmail.com>
4  *
5  * (C) Copyright 2010
6  * Alistair Buxton <a.j.buxton@gmail.com>
7  *
8  * Derived from Beagle Board code:
9  * (C) Copyright 2006-2008
10  * Texas Instruments.
11  * Richard Woodruff <r-woodruff2@ti.com>
12  * Syed Mohammed Khasim <x0khasim@ti.com>
13  *
14  * Configuration settings for the Nokia RX-51 aka N900.
15  *
16  * SPDX-License-Identifier:	GPL-2.0+
17  */
18 
19 #ifndef __CONFIG_H
20 #define __CONFIG_H
21 
22 /*
23  * High Level Configuration Options
24  */
25 #define CONFIG_SYS_L2CACHE_OFF		/* pretend there is no L2 CACHE */
26 
27 #define CONFIG_MACH_TYPE		MACH_TYPE_NOKIA_RX51
28 
29 /*
30  * Nokia X-Loader loading secondary image to address 0x80400000
31  * NOLO loading boot image to random place, so it doesn't really
32  * matter what we set this to. We have to copy u-boot to this address
33  */
34 #define CONFIG_SYS_TEXT_BASE	0x80008000
35 
36 #define CONFIG_SDRC			/* The chip has SDRC controller */
37 
38 #include <asm/arch/cpu.h>		/* get chip and board defs */
39 #include <asm/arch/omap.h>
40 #include <asm/arch/mem.h>
41 #include <linux/stringify.h>
42 
43 /* Clock Defines */
44 #define V_OSCK			26000000	/* Clock output from T2 */
45 #define V_SCLK			(V_OSCK >> 1)
46 
47 #define CONFIG_MISC_INIT_R
48 #define CONFIG_SKIP_LOWLEVEL_INIT		/* X-Loader set everything up */
49 
50 #define CONFIG_CMDLINE_TAG	/* enable passing kernel command line string */
51 #define CONFIG_INITRD_TAG			/* enable passing initrd */
52 #define CONFIG_REVISION_TAG			/* enable passing revision tag*/
53 #define CONFIG_SETUP_MEMORY_TAGS		/* enable memory tag */
54 
55 /*
56  * Size of malloc() pool
57  */
58 #define CONFIG_ENV_SIZE			(128 << 10)
59 #define CONFIG_UBI_SIZE			(512 << 10)
60 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + CONFIG_UBI_SIZE + \
61 					(128 << 10))
62 
63 /*
64  * Hardware drivers
65  */
66 
67 /*
68  * NS16550 Configuration
69  */
70 #define V_NS16550_CLK		48000000		/* 48MHz (APLL96/2) */
71 
72 #define CONFIG_SYS_NS16550_SERIAL
73 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
74 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
75 
76 /*
77  * select serial console configuration
78  */
79 #define CONFIG_CONS_INDEX		3
80 #define CONFIG_SYS_NS16550_COM3		OMAP34XX_UART3
81 #define CONFIG_SERIAL3			3		/* UART3 on RX-51 */
82 
83 /* allow to overwrite serial and ethaddr */
84 #define CONFIG_ENV_OVERWRITE
85 #define CONFIG_SYS_BAUDRATE_TABLE { 4800, 9600, 19200, 38400, 57600, 115200 }
86 
87 /* USB */
88 #define CONFIG_USB_MUSB_UDC
89 #define CONFIG_USB_MUSB_HCD
90 #define CONFIG_USB_OMAP3
91 #define CONFIG_TWL4030_USB
92 
93 /* USB device configuration */
94 #define CONFIG_USB_DEVICE
95 #define CONFIG_USBD_VENDORID		0x0421
96 #define CONFIG_USBD_PRODUCTID		0x01c8
97 #define CONFIG_USBD_MANUFACTURER	"Nokia"
98 #define CONFIG_USBD_PRODUCT_NAME	"N900"
99 
100 /* commands to include */
101 
102 #define CONFIG_CMDLINE_EDITING		/* add command line history */
103 #define CONFIG_AUTO_COMPLETE		/* add autocompletion support */
104 
105 #ifdef ONENAND_SUPPORT
106 
107 #define CONFIG_CMD_ONENAND		/* ONENAND support */
108 #define CONFIG_CMD_MTDPARTS		/* mtd parts support */
109 
110 #ifdef UBIFS_SUPPORT
111 #define CONFIG_CMD_UBIFS		/* UBIFS Support */
112 #endif
113 
114 #endif
115 
116 #define CONFIG_OMAP3_SPI
117 #define CONFIG_SYS_I2C
118 #define CONFIG_SYS_OMAP24_I2C_SPEED	100000
119 #define CONFIG_SYS_OMAP24_I2C_SLAVE	1
120 #define CONFIG_SYS_I2C_OMAP34XX
121 
122 /*
123  * TWL4030
124  */
125 #define CONFIG_TWL4030_LED
126 #define CONFIG_TWL4030_KEYPAD
127 
128 #define CONFIG_OMAP_GPIO
129 #define GPIO_SLIDE			71
130 
131 /*
132  * Board ONENAND Info.
133  */
134 
135 #define PART1_NAME			"bootloader"
136 #define PART1_SIZE			128
137 #define PART1_MULL			1024
138 #define PART1_SUFF			"k"
139 #define PART1_OFFS			0x00000000
140 #define PART1_MASK			0x00000003
141 
142 #define PART2_NAME			"config"
143 #define PART2_SIZE			384
144 #define PART2_MULL			1024
145 #define PART2_SUFF			"k"
146 #define PART2_OFFS			0x00020000
147 #define PART2_MASK			0x00000000
148 
149 #define PART3_NAME			"log"
150 #define PART3_SIZE			256
151 #define PART3_MULL			1024
152 #define PART3_SUFF			"k"
153 #define PART3_OFFS			0x00080000
154 #define PART3_MASK			0x00000000
155 
156 #define PART4_NAME			"kernel"
157 #define PART4_SIZE			2
158 #define PART4_MULL			1024*1024
159 #define PART4_SUFF			"m"
160 #define PART4_OFFS			0x000c0000
161 #define PART4_MASK			0x00000000
162 
163 #define PART5_NAME			"initfs"
164 #define PART5_SIZE			2
165 #define PART5_MULL			1024*1024
166 #define PART5_SUFF			"m"
167 #define PART5_OFFS			0x002c0000
168 #define PART5_MASK			0x00000000
169 
170 #define PART6_NAME			"rootfs"
171 #define PART6_SIZE			257280
172 #define PART6_MULL			1024
173 #define PART6_SUFF			"k"
174 #define PART6_OFFS			0x004c0000
175 #define PART6_MASK			0x00000000
176 
177 #ifdef ONENAND_SUPPORT
178 
179 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
180 #define CONFIG_MTD_DEVICE
181 #define CONFIG_MTD_PARTITIONS
182 
183 #ifdef UBIFS_SUPPORT
184 #define CONFIG_RBTREE
185 #define CONFIG_LZO
186 #endif
187 
188 #define MTDIDS_DEFAULT			"onenand0=onenand"
189 #define MTDPARTS_DEFAULT		"mtdparts=onenand:" \
190 		__stringify(PART1_SIZE) PART1_SUFF "(" PART1_NAME ")ro," \
191 		__stringify(PART2_SIZE) PART2_SUFF "(" PART2_NAME ")," \
192 		__stringify(PART3_SIZE) PART3_SUFF "(" PART3_NAME ")," \
193 		__stringify(PART4_SIZE) PART4_SUFF "(" PART4_NAME ")," \
194 		__stringify(PART5_SIZE) PART5_SUFF "(" PART5_NAME ")," \
195 		"-(" PART6_NAME ")"
196 
197 #endif
198 
199 /* Watchdog support */
200 #define CONFIG_HW_WATCHDOG
201 
202 /*
203  * Framebuffer
204  */
205 /* Video console */
206 #define CONFIG_VIDEO_LOGO
207 #define VIDEO_FB_16BPP_PIXEL_SWAP
208 #define VIDEO_FB_16BPP_WORD_SWAP
209 #define CONFIG_SPLASH_SCREEN
210 
211 /* functions for cfb_console */
212 #define VIDEO_KBD_INIT_FCT		rx51_kp_init()
213 #define VIDEO_TSTC_FCT			rx51_kp_tstc
214 #define VIDEO_GETC_FCT			rx51_kp_getc
215 #ifndef __ASSEMBLY__
216 struct stdio_dev;
217 int rx51_kp_init(void);
218 int rx51_kp_tstc(struct stdio_dev *sdev);
219 int rx51_kp_getc(struct stdio_dev *sdev);
220 #endif
221 
222 #ifndef MTDPARTS_DEFAULT
223 #define MTDPARTS_DEFAULT
224 #endif
225 
226 /* Environment information */
227 #define CONFIG_EXTRA_ENV_SETTINGS \
228 	"mtdparts=" MTDPARTS_DEFAULT "\0" \
229 	"usbtty=cdc_acm\0" \
230 	"stdin=vga\0" \
231 	"stdout=vga\0" \
232 	"stderr=vga\0" \
233 	"setcon=setenv stdin ${con};" \
234 		"setenv stdout ${con};" \
235 		"setenv stderr ${con}\0" \
236 	"sercon=setenv con serial; run setcon\0" \
237 	"usbcon=setenv con usbtty; run setcon\0" \
238 	"vgacon=setenv con vga; run setcon\0" \
239 	"slide=gpio input " __stringify(GPIO_SLIDE) "\0" \
240 	"switchmmc=mmc dev ${mmcnum}\0" \
241 	"kernaddr=0x82008000\0" \
242 	"initrdaddr=0x84008000\0" \
243 	"scriptaddr=0x86008000\0" \
244 	"fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \
245 		"${loadaddr} ${mmcfile}\0" \
246 	"kernload=setenv loadaddr ${kernaddr};" \
247 		"setenv mmcfile ${mmckernfile};" \
248 		"run fileload\0" \
249 	"initrdload=setenv loadaddr ${initrdaddr};" \
250 		"setenv mmcfile ${mmcinitrdfile};" \
251 		"run fileload\0" \
252 	"scriptload=setenv loadaddr ${scriptaddr};" \
253 		"setenv mmcfile ${mmcscriptfile};" \
254 		"run fileload\0" \
255 	"scriptboot=echo Running ${mmcscriptfile} from mmc " \
256 		"${mmcnum}:${mmcpart} ...; source ${scriptaddr}\0" \
257 	"kernboot=echo Booting ${mmckernfile} from mmc " \
258 		"${mmcnum}:${mmcpart} ...; bootm ${kernaddr}\0" \
259 	"kerninitrdboot=echo Booting ${mmckernfile} ${mmcinitrdfile} from mmc "\
260 		"${mmcnum}:${mmcpart} ...; bootm ${kernaddr} ${initrdaddr}\0" \
261 	"attachboot=echo Booting attached kernel image ...;" \
262 		"setenv setup_omap_atag 1;" \
263 		"bootm ${attkernaddr};" \
264 		"setenv setup_omap_atag\0" \
265 	"trymmcscriptboot=if run switchmmc; then " \
266 			"if run scriptload; then " \
267 				"run scriptboot;" \
268 			"fi;" \
269 		"fi\0" \
270 	"trymmckernboot=if run switchmmc; then " \
271 			"if run kernload; then " \
272 				"run kernboot;" \
273 			"fi;" \
274 		"fi\0" \
275 	"trymmckerninitrdboot=if run switchmmc; then " \
276 			"if run initrdload; then " \
277 				"if run kernload; then " \
278 					"run kerninitrdboot;" \
279 				"fi;" \
280 			"fi; " \
281 		"fi\0" \
282 	"trymmcpartboot=setenv mmcscriptfile boot.scr; run trymmcscriptboot;" \
283 		"setenv mmckernfile uImage; run trymmckernboot\0" \
284 	"trymmcallpartboot=setenv mmcpart 1; run trymmcpartboot;" \
285 		"setenv mmcpart 2; run trymmcpartboot;" \
286 		"setenv mmcpart 3; run trymmcpartboot;" \
287 		"setenv mmcpart 4; run trymmcpartboot\0" \
288 	"trymmcboot=if run switchmmc; then " \
289 			"setenv mmctype fat;" \
290 			"run trymmcallpartboot;" \
291 			"setenv mmctype ext2;" \
292 			"run trymmcallpartboot;" \
293 			"setenv mmctype ext4;" \
294 			"run trymmcallpartboot;" \
295 		"fi\0" \
296 	"emmcboot=setenv mmcnum 1; run trymmcboot\0" \
297 	"sdboot=setenv mmcnum 0; run trymmcboot\0" \
298 	"menucmd=bootmenu\0" \
299 	"bootmenu_0=Attached kernel=run attachboot\0" \
300 	"bootmenu_1=Internal eMMC=run emmcboot\0" \
301 	"bootmenu_2=External SD card=run sdboot\0" \
302 	"bootmenu_3=U-Boot boot order=boot\0" \
303 	"bootmenu_delay=30\0" \
304 	""
305 
306 #define CONFIG_PREBOOT \
307 	"setenv mmcnum 1; setenv mmcpart 1;" \
308 	"setenv mmcscriptfile bootmenu.scr;" \
309 	"if run switchmmc; then " \
310 		"setenv mmcdone true;" \
311 		"setenv mmctype fat;" \
312 		"if run scriptload; then true; else " \
313 			"setenv mmctype ext2;" \
314 			"if run scriptload; then true; else " \
315 				"setenv mmctype ext4;" \
316 				"if run scriptload; then true; else " \
317 					"setenv mmcdone false;" \
318 				"fi;" \
319 			"fi;" \
320 		"fi;" \
321 		"if ${mmcdone}; then " \
322 			"run scriptboot;" \
323 		"fi;" \
324 	"fi;" \
325 	"if run slide; then true; else " \
326 		"setenv bootmenu_delay 0;" \
327 		"setenv bootdelay 0;" \
328 	"fi"
329 
330 #define CONFIG_POSTBOOTMENU \
331 	"echo;" \
332 	"echo Extra commands:;" \
333 	"echo run sercon - Use serial port for control.;" \
334 	"echo run usbcon - Use usbtty for control.;" \
335 	"echo run vgacon - Use framebuffer/keyboard.;" \
336 	"echo run sdboot - Boot from SD card slot.;" \
337 	"echo run emmcboot - Boot internal eMMC memory.;" \
338 	"echo run attachboot - Boot attached kernel image.;" \
339 	"echo"
340 
341 #define CONFIG_BOOTCOMMAND \
342 	"run sdboot;" \
343 	"run emmcboot;" \
344 	"run attachboot;" \
345 	"echo"
346 
347 #define CONFIG_MENU_SHOW
348 
349 /*
350  * Miscellaneous configurable options
351  */
352 #define CONFIG_SYS_LONGHELP			/* undef to save memory */
353 #define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size */
354 /* Print Buffer Size */
355 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
356 						sizeof(CONFIG_SYS_PROMPT) + 16)
357 #define CONFIG_SYS_MAXARGS		16	/* max number of command args */
358 /* Boot Argument Buffer Size */
359 #define CONFIG_SYS_BARGSIZE		(CONFIG_SYS_CBSIZE)
360 
361 #define CONFIG_SYS_MEMTEST_START	(OMAP34XX_SDRC_CS0)
362 #define CONFIG_SYS_MEMTEST_END		(OMAP34XX_SDRC_CS0 + 0x01F00000)/*31MB*/
363 
364 /* default load address */
365 #define CONFIG_SYS_LOAD_ADDR		(OMAP34XX_SDRC_CS0)
366 
367 /*
368  * OMAP3 has 12 GP timers, they can be driven by the system clock
369  * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK).
370  * This rate is divided by a local divisor.
371  */
372 #define CONFIG_SYS_TIMERBASE		(OMAP34XX_GPT2)
373 #define CONFIG_SYS_PTV			2	/* Divisor: 2^(PTV+1) => 8 */
374 
375 /*
376  * Physical Memory Map
377  */
378 #define CONFIG_NR_DRAM_BANKS		2
379 #define PHYS_SDRAM_1			OMAP34XX_SDRC_CS0
380 
381 /*
382  * FLASH and environment organization
383  */
384 
385 #define CONFIG_ENV_IS_NOWHERE
386 
387 #define CONFIG_SYS_SDRAM_BASE		PHYS_SDRAM_1
388 #define CONFIG_SYS_INIT_RAM_ADDR	0x4020f800
389 #define CONFIG_SYS_INIT_RAM_SIZE	0x800
390 #define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_INIT_RAM_ADDR + \
391 			CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
392 
393 /*
394  * Attached kernel image
395  */
396 
397 #define SDRAM_SIZE			0x10000000	/* 256 MB */
398 #define SDRAM_END			(CONFIG_SYS_SDRAM_BASE + SDRAM_SIZE)
399 
400 #define IMAGE_MAXSIZE			0x1FF800	/* 2 MB - 2 kB */
401 #define KERNEL_OFFSET			0x40000		/* 256 kB */
402 #define KERNEL_MAXSIZE			(IMAGE_MAXSIZE-KERNEL_OFFSET)
403 #define KERNEL_ADDRESS			(SDRAM_END-KERNEL_MAXSIZE)
404 
405 /* Reserve protected RAM for attached kernel */
406 #define CONFIG_PRAM			((KERNEL_MAXSIZE >> 10)+1)
407 
408 #endif /* __CONFIG_H */
409