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