* Fix problems caused by Robert Schwebel's cramfs patch
[platform/kernel/u-boot.git] / board / fads / fads.h
1 /*
2  * (C) Copyright 2000-2004
3  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4  *
5  * Derived from FADS860T definitions by Magnus Damm, Helmut Buchsbaum,
6  * and Dan Malek
7  *
8  * Modified by, Yuli Barcohen, Arabella Software Ltd., yuli@arabellasw.com
9  *
10  * This header file contains values common to all FADS family boards.
11  *
12  * See file CREDITS for list of people who contributed to this
13  * project.
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License as
17  * published by the Free Software Foundation; either version 2 of
18  * the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28  * MA 02111-1307 USA
29  */
30
31 /****************************************************************************
32  * Flash Memory Map as used by U-Boot:
33  *
34  *                          Start Address    Length
35  * +-----------------------+ 0xFE00_0000     Start of Flash -----------------
36  * |                       | 0xFE00_0100     Reset Vector
37  * +                       + 0xFE0?_????
38  * | U-Boot code           |
39  * |                       |
40  * +-----------------------+ 0xFE04_0000 (sector border)
41  * |                       |
42  * |                       |
43  * | U-Boot environment    |
44  * |                       |                                 ^
45  * |                       |                                 | U-Boot
46  * +=======================+ 0xFE08_0000 (sector border)    -----------------
47  * | Available             |                                 | Applications
48  * | ...                   |                                 v
49  *
50  *****************************************************************************/
51 /* should ALWAYS define this, measure_gclk in speed.c is unreliable */
52 /* in general, we always know this for FADS+new ADS anyway */
53 #define CONFIG_8xx_GCLK_FREQ     ((CFG_8XX_XIN) * (CFG_8XX_FACT))
54
55 #if 0
56 #define CONFIG_BOOTDELAY        -1      /* autoboot disabled            */
57 #else
58 #define CONFIG_BOOTDELAY        5       /* autoboot after 5 seconds     */
59 #endif
60
61 #undef  CONFIG_BOOTARGS
62 #define CONFIG_BOOTCOMMAND                                                      \
63     "dhcp;"                                                                     \
64     "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) "         \
65     "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off;"        \
66     "bootm"
67
68 #undef  CONFIG_WATCHDOG                 /* watchdog disabled            */
69
70 /*
71  * New MPC86xADS and Duet provide two Ethernet connectivity options:
72  * 10Mbit/s on SCC and 100Mbit/s on FEC. FADS provides SCC Ethernet on
73  * motherboard and FEC Ethernet on daughterboard. All new PQ1 chips have
74  * got FEC so FEC is the default.
75  */
76 #ifndef CONFIG_ADS
77 #undef  CONFIG_SCC1_ENET                /* Disable SCC1 ethernet */
78 #define CONFIG_FEC_ENET                 /* Use FEC ethernet  */
79 #else                                   /* Old ADS has not got FEC option */
80 #define CONFIG_SCC1_ENET                /* Use SCC1 ethernet */
81 #undef  CONFIG_FEC_ENET                 /* No FEC ethernet  */
82 #endif /* !CONFIG_ADS */
83
84 #if defined(CONFIG_SCC1_ENET) && defined(CONFIG_FEC_ENET)
85 #error Both CONFIG_SCC1_ENET and CONFIG_FEC_ENET configured
86 #endif
87
88 #ifdef CONFIG_FEC_ENET
89 #define CFG_DISCOVER_PHY
90 #endif
91
92 #ifndef CONFIG_COMMANDS
93 #define CONFIG_COMMANDS (CONFIG_CMD_DFL  \
94                          | CFG_CMD_DHCP  \
95                          | CFG_CMD_IMMAP \
96                          | CFG_CMD_MII   \
97                          | CFG_CMD_PING  \
98                         )
99 #endif /* !CONFIG_COMMANDS */
100
101 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
102 #include <cmd_confdefs.h>
103
104 /*
105  * Miscellaneous configurable options
106  */
107 #undef  CFG_LONGHELP                    /* undef to save memory         */
108 #define CFG_PROMPT              "=>"    /* Monitor Command Prompt       */
109 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
110 #define CFG_CBSIZE      1024            /* Console I/O Buffer Size      */
111 #else
112 #define CFG_CBSIZE      256             /* Console I/O Buffer Size      */
113 #endif
114 #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
115 #define CFG_MAXARGS     16              /* max number of command args   */
116 #define CFG_BARGSIZE    CFG_CBSIZE      /* Boot Argument Buffer Size    */
117
118 #define CFG_LOAD_ADDR           0x00100000
119
120 #define CFG_HZ                  1000    /* decrementer freq: 1 ms ticks */
121
122 #define CFG_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
123
124 /*
125  * Low Level Configuration Settings
126  * (address mappings, register initial values, etc.)
127  * You should know what you are doing if you make changes here.
128  */
129 /*-----------------------------------------------------------------------
130  * Internal Memory Mapped Register
131  */
132 #define CFG_IMMR                0xFF000000
133
134 /*-----------------------------------------------------------------------
135  * Definitions for initial stack pointer and data area (in DPRAM)
136  */
137 #define CFG_INIT_RAM_ADDR       CFG_IMMR
138 #define CFG_INIT_RAM_END        0x2F00  /* End of used area in DPRAM    */
139 #define CFG_GBL_DATA_SIZE       64  /* size in bytes reserved for initial data */
140 #define CFG_GBL_DATA_OFFSET     (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
141 #define CFG_INIT_SP_OFFSET      CFG_GBL_DATA_OFFSET
142
143 /*-----------------------------------------------------------------------
144  * Start addresses for the final memory configuration
145  * (Set up by the startup code)
146  * Please note that CFG_SDRAM_BASE _must_ start at 0
147  */
148 #define CFG_SDRAM_BASE          0x00000000
149 #if defined(CONFIG_MPC86xADS) || defined(CONFIG_DUET_ADS) /* New ADS or Duet */
150 #define CFG_SDRAM_SIZE          0x00800000              /* 8 Mbyte */
151 #elif defined(CONFIG_FADS)                              /* Old/new FADS */
152 #define CFG_SDRAM_SIZE          0x00400000              /* 4 Mbyte */
153 #else                                                   /* Old ADS */
154 #define CFG_SDRAM_SIZE          0x00000000              /* No SDRAM */
155 #endif
156
157 #define CFG_MEMTEST_START       0x0100000       /* memtest works on     */
158 #if (CFG_SDRAM_SIZE)
159 #define CFG_MEMTEST_END         CFG_SDRAM_SIZE  /* 1 ... SDRAM_SIZE     */
160 #else
161 #define CFG_MEMTEST_END         0x0400000       /* 1 ... 4 MB in DRAM   */
162 #endif /* CFG_SDRAM_SIZE */
163
164 /*
165  * For booting Linux, the board info and command line data
166  * have to be in the first 8 MB of memory, since this is
167  * the maximum mapped by the Linux kernel during initialization.
168  */
169 #define CFG_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
170 /*-----------------------------------------------------------------------
171  * Flash organization
172  */
173 #define CFG_FLASH_BASE          TEXT_BASE
174 #define CFG_FLASH_SIZE          ((uint)(8 * 1024 * 1024))       /* max 8Mbyte */
175
176 #define CFG_MAX_FLASH_BANKS     1       /* max number of memory banks           */
177 #define CFG_MAX_FLASH_SECT      16      /* max number of sectors on one chip    */
178
179 #define CFG_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms)      */
180 #define CFG_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms)      */
181
182 #define CFG_ENV_IS_IN_FLASH     1
183 #define CFG_ENV_SECT_SIZE       0x40000 /* see README - env sector total size   */
184 #define CFG_ENV_OFFSET          CFG_ENV_SECT_SIZE
185 #define CFG_ENV_SIZE            0x4000  /* Total Size of Environment            */
186
187 #define CFG_MONITOR_BASE        CFG_FLASH_BASE
188 #define CFG_MONITOR_LEN         (256 << 10)     /* Reserve 256 KB for monitor   */
189 #define CFG_MALLOC_LEN          (384 << 10)     /* Reserve 384 kB for malloc()  */
190
191 /*-----------------------------------------------------------------------
192  * Cache Configuration
193  */
194 #define CFG_CACHELINE_SIZE      16      /* For all MPC8xx CPUs                  */
195 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
196 #define CFG_CACHELINE_SHIFT     4       /* log base 2 of the above value        */
197 #endif
198
199 /*-----------------------------------------------------------------------
200  * I2C configuration
201  */
202 #if (CONFIG_COMMANDS & CFG_CMD_I2C)
203 #define CONFIG_HARD_I2C         1       /* I2C with hardware support */
204 #define CFG_I2C_SPEED           400000  /* I2C speed and slave address defaults */
205 #define CFG_I2C_SLAVE           0x7F
206 #endif
207
208 /*-----------------------------------------------------------------------
209  * SYPCR - System Protection Control                            11-9
210  * SYPCR can only be written once after reset!
211  *-----------------------------------------------------------------------
212  * Software & Bus Monitor Timer max, Bus Monitor enable, SW Watchdog freeze
213  */
214 #if defined(CONFIG_WATCHDOG)
215 #define CFG_SYPCR       (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | \
216                          SYPCR_SWE  | SYPCR_SWRI| SYPCR_SWP)
217 #else
218 #define CFG_SYPCR       (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | SYPCR_SWP)
219 #endif
220
221 /*-----------------------------------------------------------------------
222  * SIUMCR - SIU Module Configuration                            11-6
223  *-----------------------------------------------------------------------
224  * PCMCIA config., multi-function pin tri-state
225  */
226 #define CFG_SIUMCR      (SIUMCR_DBGC00 | SIUMCR_DBPC00 | SIUMCR_MLRC01)
227
228 /*-----------------------------------------------------------------------
229  * TBSCR - Time Base Status and Control                         11-26
230  *-----------------------------------------------------------------------
231  * Clear Reference Interrupt Status, Timebase freezing enabled
232  */
233 #define CFG_TBSCR       (TBSCR_REFA | TBSCR_REFB | TBSCR_TBE)
234
235 /*-----------------------------------------------------------------------
236  * PISCR - Periodic Interrupt Status and Control                11-31
237  *-----------------------------------------------------------------------
238  * Clear Periodic Interrupt Status, Interrupt Timer freezing enabled
239  */
240 #define CFG_PISCR       (PISCR_PS | PISCR_PITF)
241
242 /*-----------------------------------------------------------------------
243  * SCCR - System Clock and reset Control Register               15-27
244  *-----------------------------------------------------------------------
245  * Set clock output, timebase and RTC source and divider,
246  * power management and some other internal clocks
247  */
248 #define SCCR_MASK       SCCR_EBDF11
249 #define CFG_SCCR        (SCCR_TBS|SCCR_COM00|SCCR_DFSYNC00|SCCR_DFBRG00|SCCR_DFNL000|SCCR_DFNH000|SCCR_DFLCD000|SCCR_DFALCD00)
250
251  /*-----------------------------------------------------------------------
252  *
253  *-----------------------------------------------------------------------
254  *
255  */
256 #define CFG_DER          0
257
258 /* Because of the way the 860 starts up and assigns CS0 the
259 * entire address space, we have to set the memory controller
260 * differently.  Normally, you write the option register
261 * first, and then enable the chip select by writing the
262 * base register.  For CS0, you must write the base register
263 * first, followed by the option register.
264 */
265
266 /*
267  * Init Memory Controller:
268  *
269  * BR0/OR0 (Flash)
270  * BR1/OR1 (BCSR)
271  */
272 /* the other CS:s are determined by looking at parameters in BCSRx */
273
274 #define BCSR_ADDR               ((uint) 0xFF080000)
275
276 #define CFG_PRELIM_OR_AM        0xFF800000      /* OR addr mask */
277
278 /* FLASH timing: ACS = 10, TRLX = 1, CSNT = 1, SCY = 3, EHTR = 0 */
279 #define CFG_OR_TIMING_FLASH     (OR_CSNT_SAM  | OR_ACS_DIV4 | OR_BI | OR_SCY_3_CLK | OR_TRLX)
280
281 #define CFG_OR0_PRELIM  (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH)   /* 8 Mbyte until detected */
282 #define CFG_BR0_PRELIM  ((CFG_FLASH_BASE & BR_BA_MSK) | BR_V )
283
284 /* BCSRx - Board Control and Status Registers */
285 #define CFG_OR1_PRELIM  0xFFFF8110              /* 64Kbyte address space */
286 #define CFG_BR1_PRELIM  ((BCSR_ADDR) | BR_V)
287
288 /*
289  * Internal Definitions
290  *
291  * Boot Flags
292  */
293 #define BOOTFLAG_COLD   0x01            /* Normal Power-On: Boot from FLASH     */
294 #define BOOTFLAG_WARM   0x02            /* Software reboot                      */
295
296 /* values according to the manual */
297
298 #define PCMCIA_MEM_ADDR         ((uint)0xFF020000)
299 #define PCMCIA_MEM_SIZE         ((uint)(64 * 1024))
300
301 #define BCSR0                   ((uint) (BCSR_ADDR + 0x00))
302 #define BCSR1                   ((uint) (BCSR_ADDR + 0x04))
303 #define BCSR2                   ((uint) (BCSR_ADDR + 0x08))
304 #define BCSR3                   ((uint) (BCSR_ADDR + 0x0c))
305 #define BCSR4                   ((uint) (BCSR_ADDR + 0x10))
306
307 /*
308  * (F)ADS bitvalues by Helmut Buchsbaum
309  *
310  * See User's Manual for a proper
311  * description of the following structures
312  */
313
314 #define BCSR0_ERB       ((uint)0x80000000)
315 #define BCSR0_IP        ((uint)0x40000000)
316 #define BCSR0_BDIS      ((uint)0x10000000)
317 #define BCSR0_BPS_MASK  ((uint)0x0C000000)
318 #define BCSR0_ISB_MASK  ((uint)0x01800000)
319 #define BCSR0_DBGC_MASK ((uint)0x00600000)
320 #define BCSR0_DBPC_MASK ((uint)0x00180000)
321 #define BCSR0_EBDF_MASK ((uint)0x00060000)
322
323 #define BCSR1_FLASH_EN           ((uint)0x80000000)
324 #define BCSR1_DRAM_EN            ((uint)0x40000000)
325 #define BCSR1_ETHEN              ((uint)0x20000000)
326 #define BCSR1_IRDEN              ((uint)0x10000000)
327 #define BCSR1_FLASH_CFG_EN       ((uint)0x08000000)
328 #define BCSR1_CNT_REG_EN_PROTECT ((uint)0x04000000)
329 #define BCSR1_BCSR_EN            ((uint)0x02000000)
330 #define BCSR1_RS232EN_1          ((uint)0x01000000)
331 #define BCSR1_PCCEN              ((uint)0x00800000)
332 #define BCSR1_PCCVCC0            ((uint)0x00400000)
333 #define BCSR1_PCCVPP_MASK        ((uint)0x00300000)
334 #define BCSR1_DRAM_HALF_WORD     ((uint)0x00080000)
335 #define BCSR1_RS232EN_2          ((uint)0x00040000)
336 #define BCSR1_SDRAM_EN           ((uint)0x00020000)
337 #define BCSR1_PCCVCC1            ((uint)0x00010000)
338
339 #define BCSR1_PCCVCCON           BCSR1_PCCVCC0
340
341 #define BCSR2_FLASH_PD_MASK      ((uint)0xF0000000)
342 #define BCSR2_DRAM_PD_MASK       ((uint)0x07800000)
343 #define BCSR2_DRAM_PD_SHIFT      23
344 #define BCSR2_EXTTOLI_MASK       ((uint)0x00780000)
345 #define BCSR2_DBREVNR_MASK       ((uint)0x00030000)
346
347 #define BCSR3_DBID_MASK          ((ushort)0x3800)
348 #define BCSR3_CNT_REG_EN_PROTECT ((ushort)0x0400)
349 #define BCSR3_BREVNR0            ((ushort)0x0080)
350 #define BCSR3_FLASH_PD_MASK      ((ushort)0x0070)
351 #define BCSR3_BREVN1             ((ushort)0x0008)
352 #define BCSR3_BREVN2_MASK        ((ushort)0x0003)
353
354 #define BCSR4_ETHLOOP            ((uint)0x80000000)
355 #define BCSR4_TFPLDL             ((uint)0x40000000)
356 #define BCSR4_TPSQEL             ((uint)0x20000000)
357 #define BCSR4_SIGNAL_LAMP        ((uint)0x10000000)
358 #define BCSR4_FETH_EN            ((uint)0x08000000)
359 #define BCSR4_FETHCFG0           ((uint)0x04000000)
360 #define BCSR4_FETHFDE            ((uint)0x02000000)
361 #define BCSR4_FETHCFG1           ((uint)0x00400000)
362 #define BCSR4_FETHRST            ((uint)0x00200000)
363
364 #ifdef CONFIG_MPC823
365 #define BCSR4_USB_EN             ((uint)0x08000000)
366 #endif /* CONFIG_MPC823 */
367 #ifdef CONFIG_MPC860SAR
368 #define BCSR4_UTOPIA_EN          ((uint)0x08000000)
369 #endif /* CONFIG_MPC860SAR */
370 #ifdef CONFIG_MPC860T
371 #define BCSR4_FETH_EN            ((uint)0x08000000)
372 #endif /* CONFIG_MPC860T */
373 #ifdef CONFIG_MPC823
374 #define BCSR4_USB_SPEED          ((uint)0x04000000)
375 #endif /* CONFIG_MPC823 */
376 #ifdef CONFIG_MPC860T
377 #define BCSR4_FETHCFG0           ((uint)0x04000000)
378 #endif /* CONFIG_MPC860T */
379 #ifdef CONFIG_MPC823
380 #define BCSR4_VCCO               ((uint)0x02000000)
381 #endif /* CONFIG_MPC823 */
382 #ifdef CONFIG_MPC860T
383 #define BCSR4_FETHFDE            ((uint)0x02000000)
384 #endif /* CONFIG_MPC860T */
385 #ifdef CONFIG_MPC823
386 #define BCSR4_VIDEO_ON           ((uint)0x00800000)
387 #endif /* CONFIG_MPC823 */
388 #ifdef CONFIG_MPC823
389 #define BCSR4_VDO_EKT_CLK_EN     ((uint)0x00400000)
390 #endif /* CONFIG_MPC823 */
391 #ifdef CONFIG_MPC860T
392 #define BCSR4_FETHCFG1           ((uint)0x00400000)
393 #endif /* CONFIG_MPC860T */
394 #ifdef CONFIG_MPC823
395 #define BCSR4_VIDEO_RST          ((uint)0x00200000)
396 #endif /* CONFIG_MPC823 */
397 #ifdef CONFIG_MPC860T
398 #define BCSR4_FETHRST            ((uint)0x00200000)
399 #endif /* CONFIG_MPC860T */
400 #ifdef CONFIG_MPC823
401 #define BCSR4_MODEM_EN           ((uint)0x00100000)
402 #endif /* CONFIG_MPC823 */
403 #ifdef CONFIG_MPC823
404 #define BCSR4_DATA_VOICE         ((uint)0x00080000)
405 #endif /* CONFIG_MPC823 */
406 #ifdef CONFIG_MPC850
407 #define BCSR4_DATA_VOICE         ((uint)0x00080000)
408 #endif /* CONFIG_MPC850 */
409
410 /* We don't use the 8259.
411 */
412 #define NR_8259_INTS    0
413
414 /* Machine type
415 */
416 #define _MACH_8xx (_MACH_fads)
417
418 /*-----------------------------------------------------------------------
419  * PCMCIA stuff
420  *-----------------------------------------------------------------------
421  */
422 #if !defined(CONFIG_MPC823) && !defined(CONFIG_MPC850)
423 #define PCMCIA_SLOT_A 1
424 #endif
425
426 #define CFG_PCMCIA_MEM_ADDR     (0xE0000000)
427 #define CFG_PCMCIA_MEM_SIZE     ( 64 << 20 )
428 #define CFG_PCMCIA_DMA_ADDR     (0xE4000000)
429 #define CFG_PCMCIA_DMA_SIZE     ( 64 << 20 )
430 #define CFG_PCMCIA_ATTRB_ADDR   (0xE8000000)
431 #define CFG_PCMCIA_ATTRB_SIZE   ( 64 << 20 )
432 #define CFG_PCMCIA_IO_ADDR      (0xEC000000)
433 #define CFG_PCMCIA_IO_SIZE      ( 64 << 20 )
434
435 /*-----------------------------------------------------------------------
436  * IDE/ATA stuff
437  *-----------------------------------------------------------------------
438  */
439 #define CONFIG_MAC_PARTITION    1
440 #define CONFIG_DOS_PARTITION    1
441 #define CONFIG_ISO_PARTITION    1
442
443 #undef  CONFIG_ATAPI
444 #define CONFIG_IDE_8xx_PCCARD   1       /* Use IDE with PC Card Adapter */
445 #undef  CONFIG_IDE_8xx_DIRECT           /* Direct IDE    not supported  */
446 #undef  CONFIG_IDE_LED                  /* LED   for ide not supported  */
447 #undef  CONFIG_IDE_RESET                /* reset for ide not supported  */
448
449 #define CFG_IDE_MAXBUS          1       /* max. 2 IDE busses    */
450 #define CFG_IDE_MAXDEVICE       (CFG_IDE_MAXBUS*2) /* max. 2 drives per IDE bus */
451
452 #define CFG_ATA_BASE_ADDR       CFG_PCMCIA_MEM_ADDR
453 #define CFG_ATA_IDE0_OFFSET     0x0000
454
455 /* Offset for data I/O                  */
456 #define CFG_ATA_DATA_OFFSET     (CFG_PCMCIA_MEM_SIZE + 0x320)
457 /* Offset for normal register accesses  */
458 #define CFG_ATA_REG_OFFSET      (2 * CFG_PCMCIA_MEM_SIZE + 0x320)
459 /* Offset for alternate registers       */
460 #define CFG_ATA_ALT_OFFSET      0x0000
461
462 #define CONFIG_DISK_SPINUP_TIME 1000000
463 #undef CONFIG_DISK_SPINUP_TIME  /* usinĀ“ Compact Flash */