* The PS/2 mux on the BMS2003 board needs 450 ms after power on
[platform/kernel/u-boot.git] / include / configs / hymod.h
1 /*
2  * (C) Copyright 2000
3  * Murray Jensen <Murray.Jensen@cmst.csiro.au>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23
24 /*
25  * Config header file for Hymod board
26  */
27
28 #ifndef __CONFIG_H
29 #define __CONFIG_H
30
31 /*
32  * High Level Configuration Options
33  * (easy to change)
34  */
35
36 #define CONFIG_MPC8260          1       /* This is an MPC8260 CPU       */
37 #define CONFIG_HYMOD            1       /* ...on a Hymod board          */
38
39 #define CONFIG_MISC_INIT_F      1       /* Use misc_init_f()            */
40
41 #define CONFIG_BOARD_POSTCLK_INIT       /* have board_postclk_init() function */
42
43 /*
44  * select serial console configuration
45  *
46  * if either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
47  * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
48  * for SCC).
49  *
50  * if CONFIG_CONS_NONE is defined, then the serial console routines must
51  * defined elsewhere (for example, on the cogent platform, there are serial
52  * ports on the motherboard which are used for the serial console - see
53  * cogent/cma101/serial.[ch]).
54  */
55 #undef  CONFIG_CONS_ON_SMC              /* define if console on SMC */
56 #define CONFIG_CONS_ON_SCC              /* define if console on SCC */
57 #undef  CONFIG_CONS_NONE                /* define if console on something else*/
58 #define CONFIG_CONS_INDEX       1       /* which serial channel for console */
59 #define CONFIG_CONS_USE_EXTC            /* SMC/SCC use ext clock not brg_clk */
60 #define CONFIG_CONS_EXTC_RATE   3686400 /* SMC/SCC ext clk rate in Hz */
61 #define CONFIG_CONS_EXTC_PINSEL 0       /* pin select 0=CLK3/CLK9,1=CLK5/CLK15*/
62
63 /*
64  * select ethernet configuration
65  *
66  * if either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
67  * CONFIG_ETHER_INDEX must be set to the channel number (1-4 for SCC, 1-3
68  * for FCC)
69  *
70  * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
71  * defined elsewhere (as for the console), or CFG_CMD_NET must be removed
72  * from CONFIG_COMMANDS to remove support for networking.
73  */
74 #undef  CONFIG_ETHER_ON_SCC             /* define if ether on SCC       */
75 #define CONFIG_ETHER_ON_FCC             /* define if ether on FCC       */
76 #undef  CONFIG_ETHER_NONE               /* define if ether on something else */
77 #define CONFIG_ETHER_INDEX      1       /* which channel for ether      */
78 #define CONFIG_ETHER_LOOPBACK_TEST      /* add ether external loopback test */
79
80 #ifdef CONFIG_ETHER_ON_FCC
81
82 #if (CONFIG_ETHER_INDEX == 1)
83
84 /*
85  * - Rx-CLK is CLK10
86  * - Tx-CLK is CLK11
87  * - RAM for BD/Buffers is on the 60x Bus (see 28-13)
88  * - Enable Full Duplex in FSMR
89  */
90 # define CFG_CMXFCR_MASK        (CMXFCR_FC1|CMXFCR_RF1CS_MSK|CMXFCR_TF1CS_MSK)
91 # define CFG_CMXFCR_VALUE       (CMXFCR_RF1CS_CLK10|CMXFCR_TF1CS_CLK11)
92 # define CFG_CPMFCR_RAMTYPE     0
93 # define CFG_FCC_PSMR           (FCC_PSMR_FDE|FCC_PSMR_LPB)
94
95 # define MDIO_PORT              0               /* Port A */
96 # define MDIO_DATA_PINMASK      0x00040000      /* Pin 13 */
97 # define MDIO_CLCK_PINMASK      0x00080000      /* Pin 12 */
98
99 #elif (CONFIG_ETHER_INDEX == 2)
100
101 /*
102  * - Rx-CLK is CLK13
103  * - Tx-CLK is CLK14
104  * - RAM for BD/Buffers is on the 60x Bus (see 28-13)
105  * - Enable Full Duplex in FSMR
106  */
107 # define CFG_CMXFCR_MASK        (CMXFCR_FC2|CMXFCR_RF2CS_MSK|CMXFCR_TF2CS_MSK)
108 # define CFG_CMXFCR_VALUE       (CMXFCR_RF2CS_CLK13|CMXFCR_TF2CS_CLK14)
109 # define CFG_CPMFCR_RAMTYPE     0
110 # define CFG_FCC_PSMR           (FCC_PSMR_FDE|FCC_PSMR_LPB)
111
112 # define MDIO_PORT              0               /* Port A */
113 # define MDIO_DATA_PINMASK      0x00000040      /* Pin 25 */
114 # define MDIO_CLCK_PINMASK      0x00000080      /* Pin 24 */
115
116 #elif (CONFIG_ETHER_INDEX == 3)
117
118 /*
119  * - Rx-CLK is CLK15
120  * - Tx-CLK is CLK16
121  * - RAM for BD/Buffers is on the 60x Bus (see 28-13)
122  * - Enable Full Duplex in FSMR
123  */
124 # define CFG_CMXFCR_MASK        (CMXFCR_FC3|CMXFCR_RF3CS_MSK|CMXFCR_TF3CS_MSK)
125 # define CFG_CMXFCR_VALUE       (CMXFCR_RF3CS_CLK15|CMXFCR_TF3CS_CLK16)
126 # define CFG_CPMFCR_RAMTYPE     0
127 # define CFG_FCC_PSMR           (FCC_PSMR_FDE|FCC_PSMR_LPB)
128
129 # define MDIO_PORT              0               /* Port A */
130 # define MDIO_DATA_PINMASK      0x00000100      /* Pin 23 */
131 # define MDIO_CLCK_PINMASK      0x00000200      /* Pin 22 */
132
133 #endif  /* CONFIG_ETHER_INDEX */
134
135 #define CONFIG_MII                      /* MII PHY management   */
136 #define CONFIG_BITBANGMII               /* bit-bang MII PHY management  */
137
138 #define MDIO_ACTIVE     (iop->pdir |=  MDIO_DATA_PINMASK)
139 #define MDIO_TRISTATE   (iop->pdir &= ~MDIO_DATA_PINMASK)
140 #define MDIO_READ       ((iop->pdat &  MDIO_DATA_PINMASK) != 0)
141
142 #define MDIO(bit)       if(bit) iop->pdat |=  MDIO_DATA_PINMASK; \
143                         else    iop->pdat &= ~MDIO_DATA_PINMASK
144
145 #define MDC(bit)        if(bit) iop->pdat |=  MDIO_CLCK_PINMASK; \
146                         else    iop->pdat &= ~MDIO_CLCK_PINMASK
147
148 #define MIIDELAY        udelay(1)
149
150 #endif  /* CONFIG_ETHER_ON_FCC */
151
152
153 /* other options */
154 #define CONFIG_HARD_I2C         1       /* To enable I2C hardware support       */
155 #define CONFIG_DTT_ADM1021      1       /* ADM1021 temp sensor support */
156
157 /* system clock rate (CLKIN) - equal to the 60x and local bus speed */
158 #ifdef DEBUG
159 #define CONFIG_8260_CLKIN       33333333        /* in Hz */
160 #else
161 #define CONFIG_8260_CLKIN       66666666        /* in Hz */
162 #endif
163
164 #if defined(CONFIG_CONS_USE_EXTC)
165 #define CONFIG_BAUDRATE         115200
166 #else
167 #define CONFIG_BAUDRATE         9600
168 #endif
169
170 /* default ip addresses - these will be overridden */
171 #define CONFIG_IPADDR           192.168.1.1     /* hymod "boot" address */
172 #define CONFIG_SERVERIP         192.168.1.254   /* hymod "server" address */
173
174 #define CONFIG_LAST_STAGE_INIT
175
176 #define CONFIG_COMMANDS         (CFG_CMD_ALL & ~( \
177                                         CFG_CMD_BEDBUG  | \
178                                         CFG_CMD_BMP     | \
179                                         CFG_CMD_DOC     | \
180                                         CFG_CMD_FDC     | \
181                                         CFG_CMD_FDOS    | \
182                                         CFG_CMD_FPGA    | \
183                                         CFG_CMD_HWFLOW  | \
184                                         CFG_CMD_IDE     | \
185                                         CFG_CMD_JFFS2   | \
186                                         CFG_CMD_NAND    | \
187                                         CFG_CMD_MMC     | \
188                                         CFG_CMD_PCMCIA  | \
189                                         CFG_CMD_PCI     | \
190                                         CFG_CMD_USB     | \
191                                         CFG_CMD_SCSI    | \
192                                         CFG_CMD_SPI     | \
193                                         CFG_CMD_VFD     ) )
194
195 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
196 #include <cmd_confdefs.h>
197
198 #ifdef DEBUG
199 #define CONFIG_BOOTDELAY        -1      /* autoboot disabled            */
200 #else
201 #define CONFIG_BOOTDELAY        5       /* autoboot after 5 seconds     */
202 #define CONFIG_BOOT_RETRY_TIME 30       /* retry autoboot after 30 secs */
203 #define CONFIG_BOOT_RETRY_MIN   1       /* can go down to 1 second timeout */
204 /* Be selective on what keys can delay or stop the autoboot process
205  *      To stop use: " "
206  */
207 #define CONFIG_AUTOBOOT_KEYED
208 #define CONFIG_AUTOBOOT_PROMPT          "Autobooting in %d seconds, " \
209                                         "press <SPACE> to stop\n"
210 #define CONFIG_AUTOBOOT_STOP_STR        " "
211 #undef CONFIG_AUTOBOOT_DELAY_STR
212 #define DEBUG_BOOTKEYS          0
213 #endif
214
215 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
216 #undef  CONFIG_KGDB_ON_SMC              /* define if kgdb on SMC */
217 #define CONFIG_KGDB_ON_SCC              /* define if kgdb on SCC */
218 #undef  CONFIG_KGDB_NONE                /* define if kgdb on something else */
219 #define CONFIG_KGDB_INDEX       2       /* which serial channel for kgdb */
220 #define CONFIG_KGDB_USE_EXTC            /* SMC/SCC use ext clock not brg_clk */
221 #define CONFIG_KGDB_EXTC_RATE   3686400 /* serial ext clk rate in Hz */
222 #define CONFIG_KGDB_EXTC_PINSEL 0       /* pin select 0=CLK3/CLK9,1=CLK5/CLK15*/
223 # if defined(CONFIG_KGDB_USE_EXTC)
224 #define CONFIG_KGDB_BAUDRATE    115200  /* speed to run kgdb serial port at */
225 # else
226 #define CONFIG_KGDB_BAUDRATE    9600    /* speed to run kgdb serial port at */
227 # endif
228 #endif
229
230 #undef  CONFIG_WATCHDOG                 /* disable platform specific watchdog */
231
232 #define CONFIG_RTC_PCF8563              /* use Philips PCF8563 RTC      */
233
234 /*
235  * Hymod specific configurable options
236  */
237 #undef  CFG_HYMOD_DBLEDS                        /* walk mezz board LEDs */
238
239 /*
240  * Miscellaneous configurable options
241  */
242 #define CFG_LONGHELP                    /* undef to save memory         */
243 #define CFG_PROMPT      "=> "           /* Monitor Command Prompt       */
244 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
245 #define CFG_CBSIZE      1024            /* Console I/O Buffer Size      */
246 #else
247 #define CFG_CBSIZE      256             /* Console I/O Buffer Size      */
248 #endif
249 #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
250 #define CFG_MAXARGS     16              /* max number of command args   */
251 #define CFG_BARGSIZE    CFG_CBSIZE      /* Boot Argument Buffer Size    */
252
253 #define CFG_MEMTEST_START       0x00400000      /* memtest works on     */
254 #define CFG_MEMTEST_END         0x03c00000      /* 4 ... 60 MB in DRAM  */
255
256 #define CFG_CLKS_IN_HZ          1       /* everything, incl board info, in Hz */
257
258 #define CFG_LOAD_ADDR           0x100000        /* default load address */
259
260 #define CFG_HZ          1000            /* decrementer freq: 1 ms ticks */
261
262 #define CFG_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 230400 }
263
264 #define CFG_I2C_SPEED           50000
265 #define CFG_I2C_SLAVE           0x7e
266
267 /* these are for the ST M24C02 2kbit serial i2c eeprom */
268 #define CFG_I2C_EEPROM_ADDR     0x50            /* base address */
269 #define CFG_I2C_EEPROM_ADDR_LEN 1               /* bytes of address */
270 /* mask of address bits that overflow into the "EEPROM chip address"    */
271 #define CFG_I2C_EEPROM_ADDR_OVERFLOW    0x07
272
273 #define CFG_EEPROM_PAGE_WRITE_ENABLE    1       /* write eeprom in pages */
274 #define CFG_EEPROM_PAGE_WRITE_BITS      4       /* 16 byte write page size */
275 #define CFG_EEPROM_PAGE_WRITE_DELAY_MS  10      /* and takes up to 10 msec */
276
277 #define CFG_I2C_MULTI_EEPROMS   1               /* hymod has two eeproms */
278
279 #define CFG_I2C_RTC_ADDR        0x51    /* philips PCF8563 RTC address */
280
281 /*
282  * standard dtt sensor configuration - bottom bit will determine local or
283  * remote sensor of the ADM1021, the rest determines index into
284  * CFG_DTT_ADM1021 array below.
285  *
286  * On HYMOD board, the remote sensor should be connected to the MPC8260
287  * temperature diode thingy, but an errata said this didn't work and
288  * should be disabled - so it isn't connected.
289  */
290 #if 0
291 #define CONFIG_DTT_SENSORS              { 0, 1 }
292 #else
293 #define CONFIG_DTT_SENSORS              { 0 }
294 #endif
295
296 /*
297  * ADM1021 temp sensor configuration (see dtt/adm1021.c for details).
298  * there will be one entry in this array for each two (dummy) sensors in
299  * CONFIG_DTT_SENSORS.
300  *
301  * For HYMOD board:
302  * - only one ADM1021
303  * - i2c addr 0x2a (both ADD0 and ADD1 are N/C)
304  * - conversion rate 0x02 = 0.25 conversions/second
305  * - ALERT ouput disabled
306  * - local temp sensor enabled, min set to 0 deg, max set to 85 deg
307  * - remote temp sensor disabled (see comment for CONFIG_DTT_SENSORS above)
308  */
309 #define CFG_DTT_ADM1021         { { 0x2a, 0x02, 0, 1, 0, 85, 0, } }
310
311 /*
312  * Low Level Configuration Settings
313  * (address mappings, register initial values, etc.)
314  * You should know what you are doing if you make changes here.
315  */
316
317 /*-----------------------------------------------------------------------
318  * Hard Reset Configuration Words
319  *
320  * if you change bits in the HRCW, you must also change the CFG_*
321  * defines for the various registers affected by the HRCW e.g. changing
322  * HRCW_DPPCxx requires you to also change CFG_SIUMCR.
323  */
324 #ifdef DEBUG
325 #define CFG_HRCW_MASTER (HRCW_BPS11|HRCW_CIP|HRCW_L2CPC01|HRCW_DPPC10|\
326                          HRCW_ISB100|HRCW_BMS|HRCW_MMR11|HRCW_APPC10|\
327                          HRCW_MODCK_H0010)
328 #else
329 #define CFG_HRCW_MASTER (HRCW_BPS11|HRCW_CIP|HRCW_L2CPC01|HRCW_DPPC10|\
330                          HRCW_ISB100|HRCW_BMS|HRCW_MMR11|HRCW_APPC10|\
331                          HRCW_MODCK_H0101)
332 #endif
333 /* no slaves so just duplicate the master hrcw */
334 #define CFG_HRCW_SLAVE1 CFG_HRCW_MASTER
335 #define CFG_HRCW_SLAVE2 CFG_HRCW_MASTER
336 #define CFG_HRCW_SLAVE3 CFG_HRCW_MASTER
337 #define CFG_HRCW_SLAVE4 CFG_HRCW_MASTER
338 #define CFG_HRCW_SLAVE5 CFG_HRCW_MASTER
339 #define CFG_HRCW_SLAVE6 CFG_HRCW_MASTER
340 #define CFG_HRCW_SLAVE7 CFG_HRCW_MASTER
341
342 /*-----------------------------------------------------------------------
343  * Internal Memory Mapped Register
344  */
345 #define CFG_IMMR                0xF0000000
346
347 /*-----------------------------------------------------------------------
348  * Definitions for initial stack pointer and data area (in DPRAM)
349  */
350 #define CFG_INIT_RAM_ADDR       CFG_IMMR
351 #define CFG_INIT_RAM_END        0x4000  /* End of used area in DPRAM    */
352 #define CFG_GBL_DATA_SIZE       128  /* size in bytes reserved for initial data */
353 #define CFG_GBL_DATA_OFFSET     (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
354 #define CFG_INIT_SP_OFFSET      CFG_GBL_DATA_OFFSET
355
356 /*-----------------------------------------------------------------------
357  * Start addresses for the final memory configuration
358  * (Set up by the startup code)
359  * Please note that CFG_SDRAM_BASE _must_ start at 0
360  */
361 #define CFG_SDRAM_BASE          0x00000000
362 #define CFG_FLASH_BASE          TEXT_BASE
363 #define CFG_MONITOR_BASE        TEXT_BASE
364 #define CFG_FPGA_BASE           0x80000000
365 /*
366  * unfortunately, CFG_MONITOR_LEN must include the
367  * (very large i.e. 256kB) environment flash sector
368  */
369 #define CFG_MONITOR_LEN         (512 << 10)     /* Reserve 512 kB for Monitor*/
370 #define CFG_MALLOC_LEN          (128 << 10)     /* Reserve 128 kB for malloc()*/
371
372 /*
373  * For booting Linux, the board info and command line data
374  * have to be in the first 8 MB of memory, since this is
375  * the maximum mapped by the Linux kernel during initialization.
376  */
377 #define CFG_BOOTMAPSZ           (8 << 20)       /* Initial Mem map for Linux*/
378
379 /*-----------------------------------------------------------------------
380  * FLASH organization
381  */
382 #define CFG_MAX_FLASH_BANKS     2       /* max num of memory banks      */
383 #define CFG_MAX_FLASH_SECT      67      /* max num of sects on one chip */
384
385 #define CFG_FLASH_ERASE_TOUT    120000  /* Flash Erase Timeout (in ms)  */
386 #define CFG_FLASH_WRITE_TOUT    500     /* Flash Write Timeout (in ms)  */
387
388 #define CFG_ENV_IS_IN_FLASH     1
389 #define CFG_ENV_SIZE            0x40000 /* Total Size of Environment Sector */
390 #define CFG_ENV_SECT_SIZE       0x40000 /* see README - env sect real size */
391 #define CFG_ENV_ADDR    (CFG_FLASH_BASE+CFG_MONITOR_LEN-CFG_ENV_SECT_SIZE)
392
393 /*-----------------------------------------------------------------------
394  * Cache Configuration
395  */
396 #define CFG_CACHELINE_SIZE      32      /* For MPC8260 CPU              */
397 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
398 #define CFG_CACHELINE_SHIFT     5       /* log base 2 of the above value*/
399 #endif
400
401 /*-----------------------------------------------------------------------
402  * HIDx - Hardware Implementation-dependent Registers                    2-11
403  *-----------------------------------------------------------------------
404  * HID0 also contains cache control - initially enable both caches and
405  * invalidate contents, then the final state leaves only the instruction
406  * cache enabled. Note that Power-On and Hard reset invalidate the caches,
407  * but Soft reset does not.
408  *
409  * HID1 has only read-only information - nothing to set.
410  */
411 #define CFG_HID0_INIT   (HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI|\
412                                 HID0_IFEM|HID0_ABE)
413 #ifdef DEBUG
414 #define CFG_HID0_FINAL  0
415 #else
416 #define CFG_HID0_FINAL  (HID0_ICE|HID0_IFEM|HID0_ABE)
417 #endif
418 #define CFG_HID2        0
419
420 /*-----------------------------------------------------------------------
421  * RMR - Reset Mode Register                                     5-5
422  *-----------------------------------------------------------------------
423  * turn on Checkstop Reset Enable
424  */
425 #ifdef DEBUG
426 #define CFG_RMR         0
427 #else
428 #define CFG_RMR         RMR_CSRE
429 #endif
430
431 /*-----------------------------------------------------------------------
432  * BCR - Bus Configuration                                       4-25
433  *-----------------------------------------------------------------------
434  */
435 #define CFG_BCR         (BCR_ETM)
436
437 /*-----------------------------------------------------------------------
438  * SIUMCR - SIU Module Configuration                             4-31
439  *-----------------------------------------------------------------------
440  */
441 #define CFG_SIUMCR      (SIUMCR_DPPC10|SIUMCR_L2CPC01|\
442                          SIUMCR_APPC10|SIUMCR_MMR11)
443
444 /*-----------------------------------------------------------------------
445  * SYPCR - System Protection Control                             4-35
446  * SYPCR can only be written once after reset!
447  *-----------------------------------------------------------------------
448  * Watchdog & Bus Monitor Timer max, 60x & Local Bus Monitor enable
449  */
450 #if defined(CONFIG_WATCHDOG)
451 #define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
452                          SYPCR_SWRI|SYPCR_SWP|SYPCR_SWE)
453 #else
454 #define CFG_SYPCR       (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
455                          SYPCR_SWRI|SYPCR_SWP)
456 #endif /* CONFIG_WATCHDOG */
457
458 /*-----------------------------------------------------------------------
459  * TMCNTSC - Time Counter Status and Control                     4-40
460  *-----------------------------------------------------------------------
461  * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
462  * and enable Time Counter
463  */
464 #define CFG_TMCNTSC     (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
465
466 /*-----------------------------------------------------------------------
467  * PISCR - Periodic Interrupt Status and Control                 4-42
468  *-----------------------------------------------------------------------
469  * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
470  * Periodic timer
471  */
472 #define CFG_PISCR       (PISCR_PS|PISCR_PTF|PISCR_PTE)
473
474 /*-----------------------------------------------------------------------
475  * SCCR - System Clock Control                                   9-8
476  *-----------------------------------------------------------------------
477  * Ensure DFBRG is Divide by 16
478  */
479 #define CFG_SCCR        (SCCR_DFBRG01)
480
481 /*-----------------------------------------------------------------------
482  * RCCR - RISC Controller Configuration                         13-7
483  *-----------------------------------------------------------------------
484  */
485 #define CFG_RCCR        0
486
487 /*
488  * Init Memory Controller:
489  *
490  * Bank Bus     Machine PortSz  Device
491  * ---- ---     ------- ------  ------
492  *  0   60x     GPCM    32 bit  FLASH
493  *  1   60x     GPCM    32 bit  FLASH (same as 0 - unused for now)
494  *  2   60x     SDRAM   64 bit  SDRAM
495  *  3   Local   UPMC     8 bit  Main Xilinx configuration
496  *  4   Local   GPCM    32 bit  Main Xilinx register mode
497  *  5   Local   UPMB    32 bit  Main Xilinx port mode
498  *  6   Local   UPMC     8 bit  Mezz Xilinx configuration
499  */
500
501 /*
502  * Bank 0 - FLASH
503  *
504  * Quotes from the HYMOD IO Board Reference manual:
505  *
506  * "The flash memory is two Intel StrataFlash chips, each configured for
507  *  16 bit operation and connected to give a 32 bit wide port."
508  *
509  * "The chip select logic is configured to respond to both *CS0 and *CS1.
510  *  Therefore the FLASH memory will be mapped to both bank 0 and bank 1.
511  *  It is suggested that bank 0 be read-only and bank 1 be read/write. The
512  *  FLASH will then appear as ROM during boot."
513  *
514  * Initially, we are only going to use bank 0 in read/write mode.
515  */
516
517 /* 32 bit, read-write, GPCM on 60x bus */
518 #define CFG_BR0_PRELIM  ((CFG_FLASH_BASE&BRx_BA_MSK)|\
519                                 BRx_PS_32|BRx_MS_GPCM_P|BRx_V)
520 /* up to 32 Mb */
521 #define CFG_OR0_PRELIM  (MEG_TO_AM(32)|ORxG_CSNT|ORxG_ACS_DIV2|ORxG_SCY_10_CLK)
522
523 /*
524  * Bank 2 - SDRAM
525  *
526  * Quotes from the HYMOD IO Board Reference manual:
527  *
528  * "The main memory is implemented using TC59SM716FTL-10 SDRAM and has a
529  *  fixed size of 64 Mbytes. The Toshiba TC59SM716FTL-10 is a CMOS synchronous
530  *  dynamic random access memory organised as 4 banks by 4096 rows by 512
531  *  columns by 16 bits. Four chips provide a 64-bit port on the 60x bus."
532  *
533  * "The locations in SDRAM are accessed using multiplexed address pins to
534  *  specify row and column. The pins also act to specify commands. The state
535  *  of the inputs *RAS, *CAS and *WE defines the required action. The a10/AP
536  *  pin may function as a row address or as the AUTO PRECHARGE control line,
537  *  depending on the cycle type. The 60x bus SDRAM machine allows the MPC8260
538  *  address lines to be configured to the required multiplexing scheme."
539  */
540
541 #define CFG_SDRAM_SIZE  64
542
543 /* 64 bit, read-write, SDRAM on 60x bus */
544 #define CFG_BR2_PRELIM  ((CFG_SDRAM_BASE&BRx_BA_MSK)|\
545                                 BRx_PS_64|BRx_MS_SDRAM_P|BRx_V)
546 /* 64 Mb, 4 int banks per dev, row start addr bit = A6, 12 row addr lines */
547 #define CFG_OR2_PRELIM  (MEG_TO_AM(CFG_SDRAM_SIZE)|\
548                                 ORxS_BPD_4|ORxS_ROWST_PBI1_A6|ORxS_NUMR_12)
549
550 /*
551  * The 60x Bus SDRAM Mode Register (PDSMR) is set as follows:
552  *
553  * Page Based Interleaving, Refresh Enable, Address Multiplexing where A5
554  * is output on A16 pin (A6 on A17, and so on), use address pins A14-A16
555  * as bank select, A7 is output on SDA10 during an ACTIVATE command,
556  * earliest timing for ACTIVATE command after REFRESH command is 6 clocks,
557  * earliest timing for ACTIVATE or REFRESH command after PRECHARGE command
558  * is 2 clocks, earliest timing for READ/WRITE command after ACTIVATE
559  * command is 2 clocks, earliest timing for PRECHARGE after last data
560  * was read is 1 clock, earliest timing for PRECHARGE after last data
561  * was written is 1 clock, CAS Latency is 2.
562  */
563
564 #define CFG_PSDMR       (PSDMR_PBI|PSDMR_SDAM_A16_IS_A5|\
565                                 PSDMR_BSMA_A14_A16|PSDMR_SDA10_PBI1_A7|\
566                                 PSDMR_RFRC_6_CLK|PSDMR_PRETOACT_2W|\
567                                 PSDMR_ACTTORW_2W|PSDMR_LDOTOPRE_1C|\
568                                 PSDMR_WRC_1C|PSDMR_CL_2)
569
570 /*
571  * The 60x bus-assigned SDRAM Refresh Timer (PSRT) (10-31) and the Refresh
572  * Timers Prescale (PTP) value in the Memory Refresh Timer Prescaler Register
573  * (MPTPR) (10-32) must also be set up (it used to be called the Periodic Timer
574  * Prescaler, hence the P instead of the R). The refresh timer period is given
575  * by (note that there was a change in the 8260 UM Errata):
576  *
577  *      TimerPeriod = (PSRT + 1) / Fmptc
578  *
579  * where Fmptc is the BusClock divided by PTP. i.e.
580  *
581  *      TimerPeriod = (PSRT + 1) / (BusClock / PTP)
582  *
583  * or
584  *
585  *      TImerPeriod = (PTP * (PSRT + 1)) / BusClock
586  *
587  * The requirement for the Toshiba TC59SM716FTL-10 is that there must be
588  * 4K refresh cycles every 64 ms. i.e. one refresh cycle every 64000/4096
589  * = 15.625 usecs.
590  *
591  * So PTP * (PSRT + 1) <= 15.625 * BusClock. At 66.666MHz, PSRT=31 and PTP=32
592  * appear to be reasonable.
593  */
594
595 #ifdef DEBUG
596 #define CFG_PSRT        39
597 #define CFG_MPTPR       MPTPR_PTP_DIV8
598 #else
599 #define CFG_PSRT        31
600 #define CFG_MPTPR       MPTPR_PTP_DIV32
601 #endif
602
603 /*
604  * Banks 3,4,5 and 6 - FPGA access
605  *
606  * Quotes from the HYMOD IO Board Reference manual:
607  *
608  * "The IO Board is fitted with a Xilinx XCV300E main FPGA. Provision is made
609  *  for configuring an optional FPGA on the mezzanine interface.
610  *
611  *  Access to the FPGAs may be divided into several catagories:
612  *
613  *  1. Configuration
614  *  2. Register mode access
615  *  3. Port mode access
616  *
617  *  The main FPGA is supported for modes 1, 2 and 3. The mezzanine FPGA can be
618  *  configured only (mode 1). Consequently there are four access types.
619  *
620  *  To improve interface performance and simplify software design, the four
621  *  possible access types are separately mapped to different memory banks.
622  *
623  *  All are accessed using the local bus."
624  *
625  *       Device             Mode      Memory Bank Machine Port Size    Access
626  *
627  *        Main          Configuration      3       UPMC      8bit       R/W
628  *        Main            Register         4       GPCM     32bit       R/W
629  *        Main              Port           5       UPMB     32bit       R/W
630  *      Mezzanine       Configuration      6       UPMC      8bit       W/O
631  *
632  * "Note that mezzanine mode 1 access is write-only."
633  */
634
635 /* all the bank sizes must be a power of two, greater or equal to 32768 */
636 #define FPGA_MAIN_CFG_BASE      (CFG_FPGA_BASE)
637 #define FPGA_MAIN_CFG_SIZE      32768
638 #define FPGA_MAIN_REG_BASE      (FPGA_MAIN_CFG_BASE + FPGA_MAIN_CFG_SIZE)
639 #define FPGA_MAIN_REG_SIZE      32768
640 #define FPGA_MAIN_PORT_BASE     (FPGA_MAIN_REG_BASE + FPGA_MAIN_REG_SIZE)
641 #define FPGA_MAIN_PORT_SIZE     32768
642 #define FPGA_MEZZ_CFG_BASE      (FPGA_MAIN_PORT_BASE + FPGA_MAIN_PORT_SIZE)
643 #define FPGA_MEZZ_CFG_SIZE      32768
644
645 /* 8 bit, read-write, UPMC */
646 #define CFG_BR3_PRELIM  (FPGA_MAIN_CFG_BASE|BRx_PS_8|BRx_MS_UPMC|BRx_V)
647 /* up to 32Kbyte, burst inhibit */
648 #define CFG_OR3_PRELIM  (P2SZ_TO_AM(FPGA_MAIN_CFG_SIZE)|ORxU_BI)
649
650 /* 32 bit, read-write, GPCM */
651 #define CFG_BR4_PRELIM  (FPGA_MAIN_REG_BASE|BRx_PS_32|BRx_MS_GPCM_L|BRx_V)
652 /* up to 32Kbyte */
653 #define CFG_OR4_PRELIM  (P2SZ_TO_AM(FPGA_MAIN_REG_SIZE))
654
655 /* 32 bit, read-write, UPMB */
656 #define CFG_BR5_PRELIM  (FPGA_MAIN_PORT_BASE|BRx_PS_32|BRx_MS_UPMB|BRx_V)
657 /* up to 32Kbyte */
658 #define CFG_OR5_PRELIM  (P2SZ_TO_AM(FPGA_MAIN_PORT_SIZE)|ORxU_BI)
659
660 /* 8 bit, write-only, UPMC */
661 #define CFG_BR6_PRELIM  (FPGA_MEZZ_CFG_BASE|BRx_PS_8|BRx_MS_UPMC|BRx_V)
662 /* up to 32Kbyte, burst inhibit */
663 #define CFG_OR6_PRELIM  (P2SZ_TO_AM(FPGA_MEZZ_CFG_SIZE)|ORxU_BI)
664
665 /*-----------------------------------------------------------------------
666  * MBMR - Machine B Mode                                        10-27
667  *-----------------------------------------------------------------------
668  */
669 #define CFG_MBMR        (MxMR_BSEL|MxMR_OP_NORM)        /* XXX - needs more */
670
671 /*-----------------------------------------------------------------------
672  * MCMR - Machine C Mode                                        10-27
673  *-----------------------------------------------------------------------
674  */
675 #define CFG_MCMR        (MxMR_BSEL|MxMR_DSx_2_CYCL)     /* XXX - needs more */
676
677 /*
678  * FPGA I/O Port/Bit information
679  */
680
681 #define FPGA_MAIN_PROG_PORT     IOPIN_PORTA
682 #define FPGA_MAIN_PROG_PIN      4       /* PA4 */
683 #define FPGA_MAIN_INIT_PORT     IOPIN_PORTA
684 #define FPGA_MAIN_INIT_PIN      5       /* PA5 */
685 #define FPGA_MAIN_DONE_PORT     IOPIN_PORTA
686 #define FPGA_MAIN_DONE_PIN      6       /* PA6 */
687
688 #define FPGA_MEZZ_PROG_PORT     IOPIN_PORTA
689 #define FPGA_MEZZ_PROG_PIN      0       /* PA0 */
690 #define FPGA_MEZZ_INIT_PORT     IOPIN_PORTA
691 #define FPGA_MEZZ_INIT_PIN      1       /* PA1 */
692 #define FPGA_MEZZ_DONE_PORT     IOPIN_PORTA
693 #define FPGA_MEZZ_DONE_PIN      2       /* PA2 */
694 #define FPGA_MEZZ_ENABLE_PORT   IOPIN_PORTA
695 #define FPGA_MEZZ_ENABLE_PIN    3       /* PA3 */
696
697 /*
698  * FPGA Interrupt configuration
699  */
700 #define FPGA_MAIN_IRQ           SIU_INT_IRQ2
701
702 /*
703  * Internal Definitions
704  *
705  * Boot Flags
706  */
707 #define BOOTFLAG_COLD   0x01            /* Normal Power-On: Boot from FLASH*/
708 #define BOOTFLAG_WARM   0x02            /* Software reboot              */
709
710 #endif  /* __CONFIG_H */