Initial revision
[platform/kernel/u-boot.git] / include / configs / sacsng.h
1 /*
2  * (C) Copyright 2000
3  * Murray Jensen <Murray.Jensen@cmst.csiro.au>
4  *
5  * (C) Copyright 2000
6  * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
7  * Marius Groeger <mgroeger@sysgo.de>
8  *
9  * (C) Copyright 2001
10  * Advent Networks, Inc. <http://www.adventnetworks.com>
11  * Jay Monkman <jtm@smoothsmoothie.com>
12  *
13  * Configuration settings for the WindRiver SBC8260 board.
14  *      See http://www.windriver.com/products/html/sbc8260.html
15  *
16  * See file CREDITS for list of people who contributed to this
17  * project.
18  *
19  * This program is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU General Public License as
21  * published by the Free Software Foundation; either version 2 of
22  * the License, or (at your option) any later version.
23  *
24  * This program is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27  * GNU General Public License for more details.
28  *
29  * You should have received a copy of the GNU General Public License
30  * along with this program; if not, write to the Free Software
31  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32  * MA 02111-1307 USA
33  */
34
35 #ifndef __CONFIG_H
36 #define __CONFIG_H
37
38 /* Enable debug prints */
39 #undef DEBUG                  /* General debug */
40 #undef DEBUG_BOOTP_EXT        /* Debug received vendor fields */
41
42 /*****************************************************************************
43  *
44  * These settings must match the way _your_ board is set up
45  *
46  *****************************************************************************/
47
48 /* What is the oscillator's (UX2) frequency in Hz? */
49 #define CONFIG_8260_CLKIN  66666600
50
51 /*-----------------------------------------------------------------------
52  * MODCK_H & MODCLK[1-3] - Ref: Section 9.2 in MPC8206 User Manual
53  *-----------------------------------------------------------------------
54  * What should MODCK_H be? It is dependent on the oscillator
55  * frequency, MODCK[1-3], and desired CPM and core frequencies.
56  * Here are some example values (all frequencies are in MHz):
57  *
58  * MODCK_H   MODCK[1-3]  Osc    CPM    Core  S2-6   S2-7   S2-8
59  * -------   ----------  ---    ---    ----  -----  -----  -----
60  * 0x1       0x5         33     100    133   Open   Close  Open
61  * 0x1       0x6         33     100    166   Open   Open   Close
62  * 0x1       0x7         33     100    200   Open   Open   Open
63  *
64  * 0x2       0x2         33     133    133   Close  Open   Close
65  * 0x2       0x3         33     133    166   Close  Open   Open
66  * 0x2       0x4         33     133    200   Open   Close  Close
67  * 0x2       0x5         33     133    233   Open   Close  Open
68  * 0x2       0x6         33     133    266   Open   Open   Close
69  *
70  * 0x5       0x5         66     133    133   Open   Close  Open
71  * 0x5       0x6         66     133    166   Open   Open   Close
72  * 0x5       0x7         66     133    200   Open   Open   Open
73  * 0x6       0x0         66     133    233   Close  Close  Close
74  * 0x6       0x1         66     133    266   Close  Close  Open
75  * 0x6       0x2         66     133    300   Close  Open   Close
76  */
77 #define CFG_SBC_MODCK_H 0x05
78
79 /* Define this if you want to boot from 0x00000100. If you don't define
80  * this, you will need to program the bootloader to 0xfff00000, and
81  * get the hardware reset config words at 0xfe000000. The simplest
82  * way to do that is to program the bootloader at both addresses.
83  * It is suggested that you just let U-Boot live at 0x00000000.
84  */
85 #define CFG_SBC_BOOT_LOW 1
86
87 /* What should the base address of the main FLASH be and how big is
88  * it (in MBytes)?  This must contain TEXT_BASE from board/sacsng/config.mk
89  * The main FLASH is whichever is connected to *CS0.
90  */
91 #define CFG_FLASH0_BASE 0x40000000
92 #define CFG_FLASH0_SIZE 2
93
94 /* What should the base address of the secondary FLASH be and how big
95  * is it (in Mbytes)?  The secondary FLASH is whichever is connected
96  * to *CS6.
97  */
98 #define CFG_FLASH1_BASE 0x60000000
99 #define CFG_FLASH1_SIZE 2
100
101 /* Define CONFIG_VERY_BIG_RAM to allow use of SDRAMs larger than 256MBytes
102  */
103 #define CONFIG_VERY_BIG_RAM     1
104
105 /* What should be the base address of SDRAM DIMM and how big is
106  * it (in Mbytes)?  This will normally auto-configure via the SPD.
107 */
108 #define CFG_SDRAM0_BASE 0x00000000
109 #define CFG_SDRAM0_SIZE 64
110
111 /*
112  * Memory map example with 64 MB DIMM:
113  *
114  *     0x0000 0000     Exception Vector code, 8k
115  *           :
116  *     0x0000 1FFF
117  *     0x0000 2000     Free for Application Use
118  *           :
119  *           :
120  *
121  *           :
122  *           :
123  *     0x03F5 FF30     Monitor Stack (Growing downward)
124  *                     Monitor Stack Buffer (0x80)
125  *     0x03F5 FFB0     Board Info Data
126  *     0x03F6 0000     Malloc Arena
127  *           :              CFG_ENV_SECT_SIZE, 16k
128  *           :              CFG_MALLOC_LEN,    128k
129  *     0x03FC 0000     RAM Copy of Monitor Code
130  *           :              CFG_MONITOR_LEN,   256k
131  *     0x03FF FFFF     [End of RAM], CFG_SDRAM_SIZE - 1
132  */
133
134 #define CONFIG_POST             (CFG_POST_MEMORY | \
135                                  CFG_POST_CPU)
136
137
138 /*
139  * select serial console configuration
140  *
141  * if either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
142  * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
143  * for SCC).
144  *
145  * if CONFIG_CONS_NONE is defined, then the serial console routines must
146  * defined elsewhere.
147  */
148 #define CONFIG_CONS_ON_SMC      1       /* define if console on SMC */
149 #undef  CONFIG_CONS_ON_SCC              /* define if console on SCC */
150 #undef  CONFIG_CONS_NONE                /* define if console on neither */
151 #define CONFIG_CONS_INDEX       1       /* which SMC/SCC channel for console */
152
153 /*
154  * select ethernet configuration
155  *
156  * if either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
157  * CONFIG_ETHER_INDEX must be set to the channel number (1-4 for SCC, 1-3
158  * for FCC)
159  *
160  * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
161  * defined elsewhere (as for the console), or CFG_CMD_NET must be removed
162  * from CONFIG_COMMANDS to remove support for networking.
163  */
164
165 #undef  CONFIG_ETHER_ON_SCC
166 #define CONFIG_ETHER_ON_FCC
167 #undef  CONFIG_ETHER_NONE               /* define if ethernet on neither */
168
169 #ifdef  CONFIG_ETHER_ON_SCC
170 #define CONFIG_ETHER_INDEX      1       /* which SCC/FCC channel for ethernet */
171 #endif  /* CONFIG_ETHER_ON_SCC */
172
173 #ifdef  CONFIG_ETHER_ON_FCC
174 #define CONFIG_ETHER_INDEX      2       /* which SCC/FCC channel for ethernet */
175 #define CONFIG_MII                      /* MII PHY management           */
176 #define CONFIG_BITBANGMII               /* bit-bang MII PHY management  */
177 /*
178  * Port pins used for bit-banged MII communictions (if applicable).
179  */
180
181 #define MDIO_PORT       2               /* Port A=0, B=1, C=2, D=3 */
182 #define MDIO_ACTIVE     (iop->pdir |=  0x40000000)
183 #define MDIO_TRISTATE   (iop->pdir &= ~0x40000000)
184 #define MDIO_READ       ((iop->pdat &  0x40000000) != 0)
185
186 #define MDIO(bit)       if(bit) iop->pdat |=  0x40000000; \
187                         else    iop->pdat &= ~0x40000000
188
189 #define MDC(bit)        if(bit) iop->pdat |=  0x80000000; \
190                         else    iop->pdat &= ~0x80000000
191
192 #define MIIDELAY        udelay(50)
193 #endif  /* CONFIG_ETHER_ON_FCC */
194
195 #if defined(CONFIG_ETHER_ON_SCC) && (CONFIG_ETHER_INDEX == 1)
196
197 /*
198  *  - RX clk is CLK11
199  *  - TX clk is CLK12
200  */
201 # define CFG_CMXSCR_VALUE       (CMXSCR_RS1CS_CLK11  | CMXSCR_TS1CS_CLK12)
202
203 #elif defined(CONFIG_ETHER_ON_FCC) && (CONFIG_ETHER_INDEX == 2)
204
205 /*
206  * - Rx-CLK is CLK13
207  * - Tx-CLK is CLK14
208  * - Select bus for bd/buffers (see 28-13)
209  * - Enable Full Duplex in FSMR
210  */
211 # define CFG_CMXFCR_MASK        (CMXFCR_FC2|CMXFCR_RF2CS_MSK|CMXFCR_TF2CS_MSK)
212 # define CFG_CMXFCR_VALUE       (CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14)
213 # define CFG_CPMFCR_RAMTYPE     0
214 # define CFG_FCC_PSMR           (FCC_PSMR_FDE | FCC_PSMR_LPB)
215
216 #endif /* CONFIG_ETHER_ON_FCC, CONFIG_ETHER_INDEX */
217
218 #define CONFIG_SHOW_BOOT_PROGRESS 1     /* boot progress enabled        */
219
220 /*
221  * Configure for RAM tests.
222  */
223 #undef  CFG_DRAM_TEST                   /* calls other tests in board.c */
224
225
226 /*
227  * Status LED for power up status feedback.
228  */
229 #define CONFIG_STATUS_LED       1       /* Status LED enabled           */
230
231 #define STATUS_LED_PAR          im_ioport.iop_ppara
232 #define STATUS_LED_DIR          im_ioport.iop_pdira
233 #define STATUS_LED_ODR          im_ioport.iop_podra
234 #define STATUS_LED_DAT          im_ioport.iop_pdata
235
236 #define STATUS_LED_BIT          0x00000800      /* LED 0 is on PA.20    */
237 #define STATUS_LED_PERIOD       (CFG_HZ)
238 #define STATUS_LED_STATE        STATUS_LED_OFF
239 #define STATUS_LED_BIT1         0x00001000      /* LED 1 is on PA.19    */
240 #define STATUS_LED_PERIOD1      (CFG_HZ)
241 #define STATUS_LED_STATE1       STATUS_LED_OFF
242 #define STATUS_LED_BIT2         0x00002000      /* LED 2 is on PA.18    */
243 #define STATUS_LED_PERIOD2      (CFG_HZ/2)
244 #define STATUS_LED_STATE2       STATUS_LED_ON
245
246 #define STATUS_LED_ACTIVE       0               /* LED on for bit == 0  */
247
248 #define STATUS_LED_YELLOW       0
249 #define STATUS_LED_GREEN        1
250 #define STATUS_LED_RED          2
251 #define STATUS_LED_BOOT         1
252
253
254 /*
255  * select SPI support configuration
256  */
257 #define  CONFIG_SOFT_SPI                /* enable SPI driver            */
258
259 /*
260  * Software (bit-bang) SPI driver configuration
261  */
262 #ifdef CONFIG_SOFT_SPI
263
264 /*
265  * Software (bit-bang) SPI driver configuration
266  */
267 #define I2C_SCLK        0x00002000      /* PD 18: Shift clock */
268 #define I2C_MOSI        0x00004000      /* PD 17: Master Out, Slave In */
269 #define I2C_MISO        0x00008000      /* PD 16: Master In, Slave Out */
270
271 #undef  SPI_INIT                        /* no port initialization needed */
272 #define SPI_READ        ((immr->im_ioport.iop_pdatd & I2C_MISO) != 0)
273 #define SPI_SDA(bit)    if(bit) immr->im_ioport.iop_pdatd |=  I2C_MOSI; \
274                         else    immr->im_ioport.iop_pdatd &= ~I2C_MOSI
275 #define SPI_SCL(bit)    if(bit) immr->im_ioport.iop_pdatd |=  I2C_SCLK; \
276                         else    immr->im_ioport.iop_pdatd &= ~I2C_SCLK
277 #define SPI_DELAY       /*udelay(1)*/   /* 1/2 SPI clock duration */
278 #endif /* CONFIG_SOFT_SPI */
279
280
281 /*
282  * select I2C support configuration
283  *
284  * Supported configurations are {none, software, hardware} drivers.
285  * If the software driver is chosen, there are some additional
286  * configuration items that the driver uses to drive the port pins.
287  */
288 #undef  CONFIG_HARD_I2C                 /* I2C with hardware support    */
289 #define CONFIG_SOFT_I2C         1       /* I2C bit-banged               */
290 #define CFG_I2C_SPEED           400000  /* I2C speed and slave address  */
291 #define CFG_I2C_SLAVE           0x7F
292
293 /*
294  * Software (bit-bang) I2C driver configuration
295  */
296 #ifdef CONFIG_SOFT_I2C
297 #define I2C_PORT        3               /* Port A=0, B=1, C=2, D=3 */
298 #define I2C_ACTIVE      (iop->pdir |=  0x00010000)
299 #define I2C_TRISTATE    (iop->pdir &= ~0x00010000)
300 #define I2C_READ        ((iop->pdat & 0x00010000) != 0)
301 #define I2C_SDA(bit)    if(bit) iop->pdat |=  0x00010000; \
302                         else    iop->pdat &= ~0x00010000
303 #define I2C_SCL(bit)    if(bit) iop->pdat |=  0x00020000; \
304                         else    iop->pdat &= ~0x00020000
305 #define I2C_DELAY       udelay(20)      /* 1/4 I2C clock duration */
306 #endif /* CONFIG_SOFT_I2C */
307
308 /* Define this to reserve an entire FLASH sector for
309  * environment variables. Otherwise, the environment will be
310  * put in the same sector as U-Boot, and changing variables
311  * will erase U-Boot temporarily
312  */
313 #define CFG_ENV_IN_OWN_SECT     1
314
315 /* Define this to contain any number of null terminated strings that
316  * will be part of the default enviroment compiled into the boot image.
317  */
318 #define CONFIG_EXTRA_ENV_SETTINGS \
319 "serverip=192.168.123.201\0" \
320 "ipaddr=192.168.123.203\0" \
321 "checkhostname=VR8500\0" \
322 "reprog="\
323     "tftpboot 0x140000 /bdi2000/u-boot.bin; " \
324     "protect off 60000000 6003FFFF; " \
325     "erase 60000000 6003FFFF; " \
326     "cp.b 140000 60000000 $(filesize); " \
327     "protect on 60000000 6003FFFF\0" \
328 "copyenv="\
329     "protect off 60040000 6004FFFF; " \
330     "erase 60040000 6004FFFF; " \
331     "cp.b 40040000 60040000 10000; " \
332     "protect on 60040000 6004FFFF\0" \
333 "copyprog="\
334     "protect off 60000000 6003FFFF; " \
335     "erase 60000000 6003FFFF; " \
336     "cp.b 40000000 60000000 40000; " \
337     "protect on 60000000 6003FFFF\0" \
338 "zapenv="\
339     "protect off 40040000 4004FFFF; " \
340     "erase 40040000 4004FFFF; " \
341     "protect on 40040000 4004FFFF\0" \
342 "zapotherenv="\
343     "protect off 60040000 6004FFFF; " \
344     "erase 60040000 6004FFFF; " \
345     "protect on 60040000 6004FFFF\0" \
346 "root-on-initrd="\
347     "setenv bootcmd "\
348     "version\\;" \
349     "echo\\;" \
350     "bootp\\;" \
351     "setenv bootargs root=/dev/ram0 rw quiet " \
352     "ip=\\$(ipaddr):\\$(serverip):\\$(gatewayip):\\$(netmask):\\$(hostname)::off\\;" \
353     "run boot-hook\\;" \
354     "bootm\0" \
355 "root-on-initrd-debug="\
356     "setenv bootcmd "\
357     "version\\;" \
358     "echo\\;" \
359     "bootp\\;" \
360     "setenv bootargs root=/dev/ram0 rw debug " \
361     "ip=\\$(ipaddr):\\$(serverip):\\$(gatewayip):\\$(netmask):\\$(hostname)::off\\;" \
362     "run debug-hook\\;" \
363     "run boot-hook\\;" \
364     "bootm\0" \
365 "root-on-nfs="\
366     "setenv bootcmd "\
367     "version\\;" \
368     "echo\\;" \
369     "bootp\\;" \
370     "setenv bootargs root=/dev/nfs rw quiet " \
371     "nfsroot=\\$(serverip):\\$(rootpath) " \
372     "ip=\\$(ipaddr):\\$(serverip):\\$(gatewayip):\\$(netmask):\\$(hostname)::off\\;" \
373     "run boot-hook\\;" \
374     "bootm\0" \
375 "root-on-nfs-debug="\
376     "setenv bootcmd "\
377     "version\\;" \
378     "echo\\;" \
379     "bootp\\;" \
380     "setenv bootargs root=/dev/nfs rw debug " \
381     "nfsroot=\\$(serverip):\\$(rootpath) " \
382     "ip=\\$(ipaddr):\\$(serverip):\\$(gatewayip):\\$(netmask):\\$(hostname)::off\\;" \
383     "run debug-hook\\;" \
384     "run boot-hook\\;" \
385     "bootm\0" \
386 "debug-checkout="\
387     "setenv checkhostname;" \
388     "setenv ethaddr 00:09:70:00:00:01;" \
389     "bootp;" \
390     "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) debug " \
391     "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off;" \
392     "run debug-hook;" \
393     "run boot-hook;" \
394     "bootm\0" \
395 "debug-hook="\
396     "echo ipaddr    $(ipaddr);" \
397     "echo serverip  $(serverip);" \
398     "echo gatewayip $(gatewayip);" \
399     "echo netmask   $(netmask);" \
400     "echo hostname  $(hostname)\0" \
401 "ana=run adc ; run dac\0" \
402 "adc=run adc-12 ; run adc-34\0" \
403 "adc-12=echo ### ADC-12 ; imd.b e 81 e\0" \
404 "adc-34=echo ### ADC-34 ; imd.b f 81 e\0" \
405 "dac=echo ### DAC ; imd.b 11 81 5\0" \
406 "boot-hook=run ana\0"
407
408 /* What should the console's baud rate be? */
409 #define CONFIG_BAUDRATE         9600
410
411 /* Ethernet MAC address */
412 #define CONFIG_ETHADDR          00:09:70:00:00:00
413
414 /* The default Ethernet MAC address can be overwritten just once  */
415 #ifdef  CONFIG_ETHADDR
416 #define CONFIG_OVERWRITE_ETHADDR_ONCE 1
417 #endif
418
419 /*
420  * Define this to do some miscellaneous board-specific initialization.
421  */
422 #define CONFIG_MISC_INIT_R
423
424 /* Set to a positive value to delay for running BOOTCOMMAND */
425 #define CONFIG_BOOTDELAY        1       /* autoboot after 1 second */
426
427 /* Be selective on what keys can delay or stop the autoboot process
428  *     To stop  use: " "
429  */
430 #define CONFIG_AUTOBOOT_KEYED
431 #define CONFIG_AUTOBOOT_PROMPT "Autobooting...\n"
432 #define CONFIG_AUTOBOOT_STOP_STR        " "
433 #undef  CONFIG_AUTOBOOT_DELAY_STR
434 #define CONFIG_ZERO_BOOTDELAY_CHECK
435 #define DEBUG_BOOTKEYS          0
436
437 /* Define a command string that is automatically executed when no character
438  * is read on the console interface withing "Boot Delay" after reset.
439  */
440 #define CONFIG_BOOT_ROOT_INITRD 0       /* Use ram disk for the root file system */
441 #define CONFIG_BOOT_ROOT_NFS    1       /* Use a NFS mounted root file system */
442
443 #if CONFIG_BOOT_ROOT_INITRD
444 #define CONFIG_BOOTCOMMAND \
445         "version;" \
446         "echo;" \
447         "bootp;" \
448         "setenv bootargs root=/dev/ram0 rw quiet " \
449         "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off;" \
450         "run boot-hook;" \
451         "bootm"
452 #endif /* CONFIG_BOOT_ROOT_INITRD */
453
454 #if CONFIG_BOOT_ROOT_NFS
455 #define CONFIG_BOOTCOMMAND \
456         "version;" \
457         "echo;" \
458         "bootp;" \
459         "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) quiet " \
460         "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off;" \
461         "run boot-hook;" \
462         "bootm"
463 #endif /* CONFIG_BOOT_ROOT_NFS */
464
465 #define CONFIG_BOOTP_RANDOM_DELAY       /* Randomize the BOOTP retry delay */
466
467 #define CONFIG_BOOTP_RETRY_COUNT 0x40000000 /* # of timeouts before giving up */
468
469 /* Add support for a few extra bootp options like:
470  *      - File size
471  *      - DNS
472  */
473 #define CONFIG_BOOTP_MASK       (CONFIG_BOOTP_DEFAULT | \
474                                  CONFIG_BOOTP_BOOTFILESIZE | \
475                                  CONFIG_BOOTP_DNS)
476
477 /* undef this to save memory */
478 #define CFG_LONGHELP
479
480 /* Monitor Command Prompt */
481 #define CFG_PROMPT              "=> "
482
483 #undef  CFG_HUSH_PARSER
484 #ifdef  CFG_HUSH_PARSER
485 #define CFG_PROMPT_HUSH_PS2     "> "
486 #endif
487
488 /* What U-Boot subsytems do you want enabled? */
489 #ifdef CONFIG_ETHER_ON_FCC
490 # define CONFIG_COMMANDS        (((CONFIG_CMD_DFL & ~(CFG_CMD_KGDB))) | \
491                                 CFG_CMD_ELF     | \
492                                 CFG_CMD_ASKENV  | \
493                                 CFG_CMD_ECHO    | \
494                                 CFG_CMD_I2C     | \
495                                 CFG_CMD_SPI     | \
496                                 CFG_CMD_SDRAM   | \
497                                 CFG_CMD_REGINFO | \
498                                 CFG_CMD_IMMAP   | \
499                                 CFG_CMD_MII     )
500 #else
501 # define CONFIG_COMMANDS        (((CONFIG_CMD_DFL & ~(CFG_CMD_KGDB))) | \
502                                 CFG_CMD_ELF     | \
503                                 CFG_CMD_ASKENV  | \
504                                 CFG_CMD_ECHO    | \
505                                 CFG_CMD_I2C     | \
506                                 CFG_CMD_SPI     | \
507                                 CFG_CMD_SDRAM   | \
508                                 CFG_CMD_REGINFO | \
509                                 CFG_CMD_IMMAP   )
510 #endif /* CONFIG_ETHER_ON_FCC */
511
512 /* Where do the internal registers live? */
513 #define CFG_IMMR                0xF0000000
514
515 /*****************************************************************************
516  *
517  * You should not have to modify any of the following settings
518  *
519  *****************************************************************************/
520
521 #define CONFIG_MPC8260          1       /* This is an MPC8260 CPU   */
522 #define CONFIG_SBC8260          1       /* on an EST SBC8260 Board  */
523 #define CONFIG_SACSng           1       /* munged for the SACSng */
524
525 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
526 #include <cmd_confdefs.h>
527
528 /*
529  * Miscellaneous configurable options
530  */
531 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
532 #  define CFG_CBSIZE            1024    /* Console I/O Buffer Size           */
533 #else
534 #  define CFG_CBSIZE            256     /* Console I/O Buffer Size           */
535 #endif
536
537 /* Print Buffer Size */
538 #define CFG_PBSIZE        (CFG_CBSIZE + sizeof(CFG_PROMPT)+16)
539
540 #define CFG_MAXARGS             32      /* max number of command args   */
541
542 #define CFG_BARGSIZE            CFG_CBSIZE /* Boot Argument Buffer Size    */
543
544 #define CFG_LOAD_ADDR           0x400000   /* default load address */
545 #define CFG_HZ                  1000    /* decrementer freq: 1 ms ticks */
546
547 #define CFG_MEMTEST_START       0x2000  /* memtest works from the end of */
548                                         /* the exception vector table */
549                                         /* to the end of the DRAM  */
550                                         /* less monitor and malloc area */
551 #define CFG_STACK_USAGE         0x10000 /* Reserve 64k for the stack usage */
552 #define CFG_MEM_END_USAGE       ( CFG_MONITOR_LEN \
553                                 + CFG_MALLOC_LEN \
554                                 + CFG_ENV_SECT_SIZE \
555                                 + CFG_STACK_USAGE )
556
557 #define CFG_MEMTEST_END         ( CFG_SDRAM_SIZE * 1024 * 1024 \
558                                 - CFG_MEM_END_USAGE )
559
560 /* valid baudrates */
561 #define CFG_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
562
563 /*
564  * Low Level Configuration Settings
565  * (address mappings, register initial values, etc.)
566  * You should know what you are doing if you make changes here.
567  */
568
569 #define CFG_FLASH_BASE  CFG_FLASH0_BASE
570 #define CFG_FLASH_SIZE  CFG_FLASH0_SIZE
571 #define CFG_SDRAM_BASE  CFG_SDRAM0_BASE
572 #define CFG_SDRAM_SIZE  CFG_SDRAM0_SIZE
573
574 /*-----------------------------------------------------------------------
575  * Hard Reset Configuration Words
576  */
577 #if defined(CFG_SBC_BOOT_LOW)
578 #  define  CFG_SBC_HRCW_BOOT_FLAGS  (HRCW_CIP | HRCW_BMS)
579 #else
580 #  define  CFG_SBC_HRCW_BOOT_FLAGS  (0)
581 #endif /* defined(CFG_SBC_BOOT_LOW) */
582
583 /* get the HRCW ISB field from CFG_IMMR */
584 #define CFG_SBC_HRCW_IMMR       ( ((CFG_IMMR & 0x10000000) >> 10) | \
585                                   ((CFG_IMMR & 0x01000000) >>  7) | \
586                                   ((CFG_IMMR & 0x00100000) >>  4) )
587
588 #define CFG_HRCW_MASTER         ( HRCW_BPS10                            | \
589                                   HRCW_DPPC11                           | \
590                                   CFG_SBC_HRCW_IMMR                     | \
591                                   HRCW_MMR00                            | \
592                                   HRCW_LBPC11                           | \
593                                   HRCW_APPC10                           | \
594                                   HRCW_CS10PC00                         | \
595                                   (CFG_SBC_MODCK_H & HRCW_MODCK_H1111)  | \
596                                   CFG_SBC_HRCW_BOOT_FLAGS )
597
598 /* no slaves */
599 #define CFG_HRCW_SLAVE1         0
600 #define CFG_HRCW_SLAVE2         0
601 #define CFG_HRCW_SLAVE3         0
602 #define CFG_HRCW_SLAVE4         0
603 #define CFG_HRCW_SLAVE5         0
604 #define CFG_HRCW_SLAVE6         0
605 #define CFG_HRCW_SLAVE7         0
606
607 /*-----------------------------------------------------------------------
608  * Definitions for initial stack pointer and data area (in DPRAM)
609  */
610 #define CFG_INIT_RAM_ADDR       CFG_IMMR
611 #define CFG_INIT_RAM_END        0x4000  /* End of used area in DPRAM    */
612 #define CFG_GBL_DATA_SIZE       128     /* bytes reserved for initial data */
613 #define CFG_GBL_DATA_OFFSET     (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
614 #define CFG_INIT_SP_OFFSET      CFG_GBL_DATA_OFFSET
615
616 /*-----------------------------------------------------------------------
617  * Start addresses for the final memory configuration
618  * (Set up by the startup code)
619  * Please note that CFG_SDRAM_BASE _must_ start at 0
620  * Note also that the logic that sets CFG_RAMBOOT is platform dependent.
621  */
622 #define CFG_MONITOR_BASE        CFG_FLASH0_BASE
623
624 #if (CFG_MONITOR_BASE < CFG_FLASH_BASE)
625 #  define CFG_RAMBOOT
626 #endif
627
628 #define CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
629 #define CFG_MALLOC_LEN          (128 << 10)     /* Reserve 128 kB for malloc()  */
630
631 /*
632  * For booting Linux, the board info and command line data
633  * have to be in the first 8 MB of memory, since this is
634  * the maximum mapped by the Linux kernel during initialization.
635  */
636 #define CFG_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
637
638 /*-----------------------------------------------------------------------
639  * FLASH and environment organization
640  */
641
642 #define CFG_FLASH_CFI           1       /* Flash is CFI conformant              */
643 #undef  CFG_FLASH_PROTECTION            /* use hardware protection              */
644 #define CFG_MAX_FLASH_BANKS     2       /* max number of memory banks           */
645 #define CFG_MAX_FLASH_SECT      (64+4)  /* max number of sectors on one chip    */
646
647 #define CFG_FLASH_ERASE_TOUT    8000    /* Timeout for Flash Erase (in ms)      */
648 #define CFG_FLASH_WRITE_TOUT    1       /* Timeout for Flash Write (in ms)      */
649
650 #ifndef CFG_RAMBOOT
651 #  define CFG_ENV_IS_IN_FLASH   1
652
653 #  ifdef CFG_ENV_IN_OWN_SECT
654 #    define CFG_ENV_ADDR        (CFG_MONITOR_BASE + CFG_MONITOR_LEN)
655 #    define CFG_ENV_SECT_SIZE   0x10000
656 #  else
657 #    define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_MONITOR_LEN - CFG_ENV_SECT_SIZE)
658 #    define CFG_ENV_SIZE        0x1000  /* Total Size of Environment Sector     */
659 #    define CFG_ENV_SECT_SIZE   0x10000 /* see README - env sect real size      */
660 #  endif /* CFG_ENV_IN_OWN_SECT */
661
662 #else
663 #  define CFG_ENV_IS_IN_NVRAM   1
664 #  define CFG_ENV_ADDR          (CFG_MONITOR_BASE - 0x1000)
665 #  define CFG_ENV_SIZE          0x200
666 #endif /* CFG_RAMBOOT */
667
668 /*-----------------------------------------------------------------------
669  * Cache Configuration
670  */
671 #define CFG_CACHELINE_SIZE      32      /* For MPC8260 CPU */
672
673 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
674 # define CFG_CACHELINE_SHIFT    5       /* log base 2 of the above value */
675 #endif
676
677 /*-----------------------------------------------------------------------
678  * HIDx - Hardware Implementation-dependent Registers                    2-11
679  *-----------------------------------------------------------------------
680  * HID0 also contains cache control - initially enable both caches and
681  * invalidate contents, then the final state leaves only the instruction
682  * cache enabled. Note that Power-On and Hard reset invalidate the caches,
683  * but Soft reset does not.
684  *
685  * HID1 has only read-only information - nothing to set.
686  */
687 #define CFG_HID0_INIT   (HID0_ICE  |\
688                          HID0_DCE  |\
689                          HID0_ICFI |\
690                          HID0_DCI  |\
691                          HID0_IFEM |\
692                          HID0_ABE)
693
694 #define CFG_HID0_FINAL  (HID0_ICE  |\
695                          HID0_IFEM |\
696                          HID0_ABE  |\
697                          HID0_EMCP)
698 #define CFG_HID2        0
699
700 /*-----------------------------------------------------------------------
701  * RMR - Reset Mode Register
702  *-----------------------------------------------------------------------
703  */
704 #define CFG_RMR         0
705
706 /*-----------------------------------------------------------------------
707  * BCR - Bus Configuration                                       4-25
708  *-----------------------------------------------------------------------
709  */
710 #define CFG_BCR         (BCR_ETM)
711
712 /*-----------------------------------------------------------------------
713  * SIUMCR - SIU Module Configuration                             4-31
714  *-----------------------------------------------------------------------
715  */
716
717 #define CFG_SIUMCR      (SIUMCR_DPPC11  |\
718                          SIUMCR_L2CPC00 |\
719                          SIUMCR_APPC10  |\
720                          SIUMCR_MMR00)
721
722
723 /*-----------------------------------------------------------------------
724  * SYPCR - System Protection Control                            11-9
725  * SYPCR can only be written once after reset!
726  *-----------------------------------------------------------------------
727  * Watchdog & Bus Monitor Timer max, 60x Bus Monitor enable
728  */
729 #define CFG_SYPCR       (SYPCR_SWTC |\
730                          SYPCR_BMT  |\
731                          SYPCR_PBME |\
732                          SYPCR_LBME |\
733                          SYPCR_SWRI |\
734                          SYPCR_SWP)
735
736 /*-----------------------------------------------------------------------
737  * TMCNTSC - Time Counter Status and Control                     4-40
738  *-----------------------------------------------------------------------
739  * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
740  * and enable Time Counter
741  */
742 #define CFG_TMCNTSC     (TMCNTSC_SEC |\
743                          TMCNTSC_ALR |\
744                          TMCNTSC_TCF |\
745                          TMCNTSC_TCE)
746
747 /*-----------------------------------------------------------------------
748  * PISCR - Periodic Interrupt Status and Control                 4-42
749  *-----------------------------------------------------------------------
750  * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
751  * Periodic timer
752  */
753 #define CFG_PISCR       (PISCR_PS  |\
754                          PISCR_PTF |\
755                          PISCR_PTE)
756
757 /*-----------------------------------------------------------------------
758  * SCCR - System Clock Control                                   9-8
759  *-----------------------------------------------------------------------
760  */
761 #define CFG_SCCR        0
762
763 /*-----------------------------------------------------------------------
764  * RCCR - RISC Controller Configuration                         13-7
765  *-----------------------------------------------------------------------
766  */
767 #define CFG_RCCR        0
768
769 /*
770  * Initialize Memory Controller:
771  *
772  * Bank Bus     Machine PortSz  Device
773  * ---- ---     ------- ------  ------
774  *  0   60x     GPCM    16 bit  FLASH (primary flash - 2MB)
775  *  1   60x     GPCM    -- bit  (Unused)
776  *  2   60x     SDRAM   64 bit  SDRAM (DIMM)
777  *  3   60x     SDRAM   64 bit  SDRAM (DIMM)
778  *  4   60x     GPCM    -- bit  (Unused)
779  *  5   60x     GPCM    -- bit  (Unused)
780  *  6   60x     GPCM    16 bit  FLASH  (secondary flash - 2MB)
781  */
782
783 /*-----------------------------------------------------------------------
784  * BR0,BR1 - Base Register
785  *     Ref: Section 10.3.1 on page 10-14
786  * OR0,OR1 - Option Register
787  *     Ref: Section 10.3.2 on page 10-18
788  *-----------------------------------------------------------------------
789  */
790
791 /* Bank 0 - Primary FLASH
792  */
793
794 /* BR0 is configured as follows:
795  *
796  *     - Base address of 0x40000000
797  *     - 16 bit port size
798  *     - Data errors checking is disabled
799  *     - Read and write access
800  *     - GPCM 60x bus
801  *     - Access are handled by the memory controller according to MSEL
802  *     - Not used for atomic operations
803  *     - No data pipelining is done
804  *     - Valid
805  */
806 #define CFG_BR0_PRELIM  ((CFG_FLASH0_BASE & BRx_BA_MSK) |\
807                          BRx_PS_16                      |\
808                          BRx_MS_GPCM_P                  |\
809                          BRx_V)
810
811 /* OR0 is configured as follows:
812  *
813  *     - 4 MB
814  *     - *BCTL0 is asserted upon access to the current memory bank
815  *     - *CW / *WE are negated a quarter of a clock earlier
816  *     - *CS is output at the same time as the address lines
817  *     - Uses a clock cycle length of 5
818  *     - *PSDVAL is generated internally by the memory controller
819  *       unless *GTA is asserted earlier externally.
820  *     - Relaxed timing is generated by the GPCM for accesses
821  *       initiated to this memory region.
822  *     - One idle clock is inserted between a read access from the
823  *       current bank and the next access.
824  */
825 #define CFG_OR0_PRELIM  (MEG_TO_AM(CFG_FLASH0_SIZE)     |\
826                          ORxG_CSNT                      |\
827                          ORxG_ACS_DIV1                  |\
828                          ORxG_SCY_5_CLK                 |\
829                          ORxG_TRLX                      |\
830                          ORxG_EHTR)
831
832 /*-----------------------------------------------------------------------
833  * BR2,BR3 - Base Register
834  *     Ref: Section 10.3.1 on page 10-14
835  * OR2,OR3 - Option Register
836  *     Ref: Section 10.3.2 on page 10-16
837  *-----------------------------------------------------------------------
838  */
839
840 /* Bank 2,3 - SDRAM DIMM
841  */
842
843 /* The BR2 is configured as follows:
844  *
845  *     - Base address of 0x00000000
846  *     - 64 bit port size (60x bus only)
847  *     - Data errors checking is disabled
848  *     - Read and write access
849  *     - SDRAM 60x bus
850  *     - Access are handled by the memory controller according to MSEL
851  *     - Not used for atomic operations
852  *     - No data pipelining is done
853  *     - Valid
854  */
855 #define CFG_BR2_PRELIM  ((CFG_SDRAM0_BASE & BRx_BA_MSK) |\
856                          BRx_PS_64                      |\
857                          BRx_MS_SDRAM_P                 |\
858                          BRx_V)
859
860 #define CFG_BR3_PRELIM  ((CFG_SDRAM0_BASE & BRx_BA_MSK) |\
861                          BRx_PS_64                      |\
862                          BRx_MS_SDRAM_P                 |\
863                          BRx_V)
864
865 /* With a 64 MB DIMM, the OR2 is configured as follows:
866  *
867  *     - 64 MB
868  *     - 4 internal banks per device
869  *     - Row start address bit is A8 with PSDMR[PBI] = 0
870  *     - 12 row address lines
871  *     - Back-to-back page mode
872  *     - Internal bank interleaving within save device enabled
873  */
874 #if (CFG_SDRAM0_SIZE == 64)
875 #define CFG_OR2_PRELIM  (MEG_TO_AM(CFG_SDRAM0_SIZE)     |\
876                          ORxS_BPD_4                     |\
877                          ORxS_ROWST_PBI0_A8             |\
878                          ORxS_NUMR_12)
879 #else
880 #error "INVALID SDRAM CONFIGURATION"
881 #endif
882
883 /*-----------------------------------------------------------------------
884  * PSDMR - 60x Bus SDRAM Mode Register
885  *     Ref: Section 10.3.3 on page 10-21
886  *-----------------------------------------------------------------------
887  */
888
889 /* Address that the DIMM SPD memory lives at.
890  */
891 #define SDRAM_SPD_ADDR 0x50
892
893 #if (CFG_SDRAM0_SIZE == 64)
894 /* With a 64 MB DIMM, the PSDMR is configured as follows:
895  *
896  *     - Bank Based Interleaving,
897  *     - Refresh Enable,
898  *     - Address Multiplexing where A5 is output on A14 pin
899  *       (A6 on A15, and so on),
900  *     - use address pins A14-A16 as bank select,
901  *     - A9 is output on SDA10 during an ACTIVATE command,
902  *     - earliest timing for ACTIVATE command after REFRESH command is 7 clocks,
903  *     - earliest timing for ACTIVATE or REFRESH command after PRECHARGE command
904  *       is 3 clocks,
905  *     - earliest timing for READ/WRITE command after ACTIVATE command is
906  *       2 clocks,
907  *     - earliest timing for PRECHARGE after last data was read is 1 clock,
908  *     - earliest timing for PRECHARGE after last data was written is 1 clock,
909  *     - CAS Latency is 2.
910  */
911 #define CFG_PSDMR       (PSDMR_RFEN           |\
912                          PSDMR_SDAM_A14_IS_A5 |\
913                          PSDMR_BSMA_A14_A16   |\
914                          PSDMR_SDA10_PBI0_A9  |\
915                          PSDMR_RFRC_7_CLK     |\
916                          PSDMR_PRETOACT_3W    |\
917                          PSDMR_ACTTORW_2W     |\
918                          PSDMR_LDOTOPRE_1C    |\
919                          PSDMR_WRC_1C         |\
920                          PSDMR_CL_2)
921 #else
922 #error "INVALID SDRAM CONFIGURATION"
923 #endif
924
925 /*
926  * Shoot for approximately 1MHz on the prescaler.
927  */
928 #if (CONFIG_8260_CLKIN >= (60 * 1000 * 1000))
929 #define CFG_MPTPR       MPTPR_PTP_DIV64
930 #elif (CONFIG_8260_CLKIN >= (30 * 1000 * 1000))
931 #define CFG_MPTPR       MPTPR_PTP_DIV32
932 #else
933 #warning "Unconfigured bus clock freq: check CFG_MPTPR and CFG_PSRT are OK"
934 #define CFG_MPTPR       MPTPR_PTP_DIV32
935 #endif
936 #define CFG_PSRT        14
937
938
939 /*-----------------------------------------------------------------------
940  * BR6 - Base Register
941  *     Ref: Section 10.3.1 on page 10-14
942  * OR6 - Option Register
943  *     Ref: Section 10.3.2 on page 10-18
944  *-----------------------------------------------------------------------
945  */
946
947 /* Bank 6 - Secondary FLASH
948  *
949  * The secondary FLASH is connected to *CS6
950  */
951 #if (defined(CFG_FLASH1_BASE) && defined(CFG_FLASH1_SIZE))
952
953 /* BR6 is configured as follows:
954  *
955  *     - Base address of 0x60000000
956  *     - 16 bit port size
957  *     - Data errors checking is disabled
958  *     - Read and write access
959  *     - GPCM 60x bus
960  *     - Access are handled by the memory controller according to MSEL
961  *     - Not used for atomic operations
962  *     - No data pipelining is done
963  *     - Valid
964  */
965 #  define CFG_BR6_PRELIM  ((CFG_FLASH1_BASE & BRx_BA_MSK) |\
966                            BRx_PS_16                      |\
967                            BRx_MS_GPCM_P                  |\
968                            BRx_V)
969
970 /* OR6 is configured as follows:
971  *
972  *     - 2 MB
973  *     - *BCTL0 is asserted upon access to the current memory bank
974  *     - *CW / *WE are negated a quarter of a clock earlier
975  *     - *CS is output at the same time as the address lines
976  *     - Uses a clock cycle length of 5
977  *     - *PSDVAL is generated internally by the memory controller
978  *       unless *GTA is asserted earlier externally.
979  *     - Relaxed timing is generated by the GPCM for accesses
980  *       initiated to this memory region.
981  *     - One idle clock is inserted between a read access from the
982  *       current bank and the next access.
983  */
984 #  define CFG_OR6_PRELIM  (MEG_TO_AM(CFG_FLASH1_SIZE)  |\
985                            ORxG_CSNT                   |\
986                            ORxG_ACS_DIV1               |\
987                            ORxG_SCY_5_CLK              |\
988                            ORxG_TRLX                   |\
989                            ORxG_EHTR)
990 #endif /* (defined(CFG_FLASH1_BASE) && defined(CFG_FLASH1_SIZE)) */
991
992 /*
993  * Internal Definitions
994  *
995  * Boot Flags
996  */
997 #define BOOTFLAG_COLD   0x01    /* Normal Power-On: Boot from FLASH  */
998 #define BOOTFLAG_WARM   0x02    /* Software reboot                   */
999
1000 #endif  /* __CONFIG_H */