1b037c9b11b8563051ba76bfea4997e689eb52c1
[pandora-u-boot.git] / include / configs / ADS860.h
1 /*
2   * A collection of structures, addresses, and values associated with
3   * the Motorola 860 ADS board.  Copied from the MBX stuff.
4   * Magnus Damm added defines for 8xxrom and extended bd_info.
5   * Helmut Buchsbaum added bitvalues for BCSRx
6   *
7   * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
8   */
9
10 /* ------------------------------------------------------------------------- */
11
12 #ifndef _CONFIG_ADS860_H
13 #define _CONFIG_ADS860_H
14
15 /*
16  * High Level Configuration Options
17  * (easy to change)
18  */
19
20 /* Board type */
21 #define CONFIG_ADS              1       /* Old Motorola MPC821/860ADS */
22
23 /* Processor type */
24 #define CONFIG_MPC860           1
25
26 #define CONFIG_8xx_CONS_SMC1    1       /* Console is on SMC1 */
27 #undef  CONFIG_8xx_CONS_SMC2
28 #undef  CONFIG_8xx_CONS_NONE
29
30 #define CONFIG_BAUDRATE         38400   /* Console baudrate */
31
32 /* CFG_8XX_FACT * CFG_8XX_XIN = 50 MHz */
33 #if 0
34 #define CFG_8XX_XIN             32768   /* 32.768 kHz input frequency   */
35 #define CFG_8XX_FACT            0x5F6   /* Multiply by 1526 */
36 #else
37 #define CFG_8XX_XIN             4000000 /* 4 MHz input frequency        */
38 #define CFG_8XX_FACT            12      /* Multiply by 12 */
39 #endif
40
41 #define CONFIG_8xx_GCLK_FREQ   ((CFG_8XX_XIN) * (CFG_8XX_FACT))
42
43 #define CONFIG_DRAM_50MHZ       1
44
45 #if 0
46 #define CONFIG_BOOTDELAY        -1      /* autoboot disabled        */
47 #else
48 #define CONFIG_BOOTDELAY        5       /* autoboot after 5 seconds */
49 #endif
50
51 #undef  CONFIG_BOOTARGS
52 #define CONFIG_BOOTCOMMAND                                              \
53    "dhcp;"                                                              \
54    "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath) "  \
55    "ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off;" \
56    "bootm"
57
58 #define CONFIG_LOADS_ECHO       1   /* echo on for serial download  */
59 #undef  CFG_LOADS_BAUD_CHANGE       /* don't allow baudrate change  */
60
61 #undef  CONFIG_WATCHDOG             /* watchdog disabled        */
62
63 #define CONFIG_BOOTP_MASK   (CONFIG_BOOTP_DEFAULT | CONFIG_BOOTP_BOOTFILESIZE)
64
65 #define CONFIG_COMMANDS (CONFIG_CMD_DFL  \
66                          | CFG_CMD_DHCP  \
67                          | CFG_CMD_IMMAP \
68                          | CFG_CMD_PCMCIA \
69                          | CFG_CMD_PING  \
70                         )
71
72 /* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
73 #include <cmd_confdefs.h>
74
75 /*
76  * Miscellaneous configurable options
77  */
78 #undef  CFG_LONGHELP                    /* undef to save memory     */
79 #define CFG_PROMPT          "=>"        /* Monitor Command Prompt   */
80 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
81 #define CFG_CBSIZE          1024        /* Console I/O Buffer Size  */
82 #else
83 #define CFG_CBSIZE          256         /* Console I/O Buffer Size  */
84 #endif
85 #define CFG_PBSIZE          (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
86 #define CFG_MAXARGS         16          /* max number of command args   */
87 #define CFG_BARGSIZE        CFG_CBSIZE  /* Boot Argument Buffer Size    */
88
89 #define CFG_MEMTEST_START   0x00100000  /* memtest works on */
90 #define CFG_MEMTEST_END     0x00F00000  /* 1 ... 15 MB in DRAM  */
91
92 #define CFG_LOAD_ADDR       0x00100000
93
94 #define CFG_HZ              1000        /* decrementer freq: 1 ms ticks */
95
96 #define CFG_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
97
98 /*
99  * Low Level Configuration Settings
100  * (address mappings, register initial values, etc.)
101  * You should know what you are doing if you make changes here.
102  */
103 /*-----------------------------------------------------------------------
104  * Internal Memory Mapped Register
105  */
106 #define CFG_IMMR                0xFF000000
107 #define CFG_IMMR_SIZE           ((uint)(64 * 1024))
108
109 /*-----------------------------------------------------------------------
110  * Definitions for initial stack pointer and data area (in DPRAM)
111  */
112 #define CFG_INIT_RAM_ADDR       CFG_IMMR
113 #define CFG_INIT_RAM_END        0x2F00  /* End of used area in DPRAM    */
114 #define CFG_GBL_DATA_SIZE       64  /* size in bytes reserved for initial data */
115 #define CFG_GBL_DATA_OFFSET     (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
116 #define CFG_INIT_SP_OFFSET      CFG_GBL_DATA_OFFSET
117
118 /*-----------------------------------------------------------------------
119  * Start addresses for the final memory configuration
120  * (Set up by the startup code)
121  * Please note that CFG_SDRAM_BASE _must_ start at 0
122  */
123 #define CFG_SDRAM_BASE      0x00000000
124
125 /*
126  * For booting Linux, the board info and command line data
127  * have to be in the first 8 MB of memory, since this is
128  * the maximum mapped by the Linux kernel during initialization.
129  */
130 #define CFG_BOOTMAPSZ       (8 << 20)   /* Initial Memory map for Linux */
131 /*-----------------------------------------------------------------------
132  * FLASH organization
133  */
134 #define CFG_FLASH_BASE      TEXT_BASE
135 #define CFG_FLASH_SIZE      ((uint)(8 * 1024 * 1024))   /* max 8Mbyte */
136
137 #define CFG_MAX_FLASH_BANKS     1       /* max number of memory banks       */
138 #define CFG_MAX_FLASH_SECT      16      /* max number of sectors on one chip    */
139
140 #define CFG_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms)  */
141 #define CFG_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms)  */
142
143 #undef  CFG_ENV_IS_IN_NVRAM
144 #undef  CFG_ENV_IS_IN_EEPROM
145 #define CFG_ENV_IS_IN_FLASH     1
146
147 #define CFG_ENV_SECT_SIZE       0x40000 /* see README - env sector total size   */
148 #define CFG_ENV_OFFSET          CFG_ENV_SECT_SIZE
149 #define CFG_ENV_SIZE            0x4000  /* Total Size of Environment */
150
151 #define CFG_MONITOR_BASE    CFG_FLASH_BASE
152 #define CFG_MONITOR_LEN     (256 << 10) /* Reserve one flash sector
153                                            (256 KB) for monitor */
154 #define CFG_MALLOC_LEN      (384 << 10) /* Reserve 384 kB for malloc()  */
155
156 /* the other CS:s are determined by looking at parameters in BCSRx */
157
158 /*-----------------------------------------------------------------------
159  * Cache Configuration
160  */
161 #define CFG_CACHELINE_SIZE  16          /* For all MPC8xx CPUs          */
162 #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
163 #define CFG_CACHELINE_SHIFT 4           /* log base 2 of the above value    */
164 #endif
165
166 /*-----------------------------------------------------------------------
167  * I2C configuration
168  */
169 #if (CONFIG_COMMANDS & CFG_CMD_I2C)
170 #define CONFIG_HARD_I2C         1       /* I2C with hardware support */
171 #define CFG_I2C_SPEED           400000  /* I2C speed and slave address defaults */
172 #define CFG_I2C_SLAVE           0x7F
173 #endif
174
175 /*-----------------------------------------------------------------------
176  * SYPCR - System Protection Control                    11-9
177  * SYPCR can only be written once after reset!
178  *-----------------------------------------------------------------------
179  * Software & Bus Monitor Timer max, Bus Monitor enable, SW Watchdog freeze
180  */
181 #if defined(CONFIG_WATCHDOG)
182 #define CFG_SYPCR   (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | \
183              SYPCR_SWE | SYPCR_SWRI | SYPCR_SWP)
184 #else
185 #define CFG_SYPCR   (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME | SYPCR_SWF | SYPCR_SWP)
186 #endif
187
188 /*-----------------------------------------------------------------------
189  * SUMCR - SIU Module Configuration                     11-6
190  *-----------------------------------------------------------------------
191  * PCMCIA config., multi-function pin tri-state
192  */
193 #define CFG_SIUMCR  (SIUMCR_DBGC00 | SIUMCR_DBPC00 | SIUMCR_MLRC01)
194
195 /*-----------------------------------------------------------------------
196  * TBSCR - Time Base Status and Control                 11-26
197  *-----------------------------------------------------------------------
198  * Clear Reference Interrupt Status, Timebase freezing enabled
199  */
200 #define CFG_TBSCR   (TBSCR_REFA | TBSCR_REFB | TBSCR_TBE)
201
202 /*-----------------------------------------------------------------------
203  * PISCR - Periodic Interrupt Status and Control        11-31
204  *-----------------------------------------------------------------------
205  * Clear Periodic Interrupt Status, Interrupt Timer freezing enabled
206  */
207 #define CFG_PISCR   (PISCR_PS | PISCR_PITF)
208
209 /*-----------------------------------------------------------------------
210  * PLPRCR - PLL, Low-Power, and Reset Control Register  15-30
211  *-----------------------------------------------------------------------
212  * set the PLL, the low-power modes and the reset control (15-29)
213  */
214 #define CFG_PLPRCR  (((CFG_8XX_FACT-1) << PLPRCR_MF_SHIFT) |    \
215                 PLPRCR_SPLSS | PLPRCR_TEXPS | PLPRCR_TMIST)
216
217 /*-----------------------------------------------------------------------
218  * SCCR - System Clock and reset Control Register       15-27
219  *-----------------------------------------------------------------------
220  * Set clock output, timebase and RTC source and divider,
221  * power management and some other internal clocks
222  */
223 #define SCCR_MASK   SCCR_EBDF11
224 #define CFG_SCCR    (SCCR_TBS | SCCR_COM00 | SCCR_DFSYNC00 | \
225                    SCCR_DFBRG00 | SCCR_DFNL000 | SCCR_DFNH000 | \
226                    SCCR_DFLCD000 | SCCR_DFALCD00)
227
228
229  /*-----------------------------------------------------------------------
230  *
231  *-----------------------------------------------------------------------
232  *
233  */
234 #define CFG_DER     0
235
236 /* Because of the way the 860 starts up and assigns CS0 the
237 * entire address space, we have to set the memory controller
238 * differently.  Normally, you write the option register
239 * first, and then enable the chip select by writing the
240 * base register.  For CS0, you must write the base register
241 * first, followed by the option register.
242 */
243
244 /*
245  * Init Memory Controller:
246  *
247  * BR0 and OR0 (FLASH)
248  * BR1 and OR1 (BCSR)
249  */
250 /* the other CS:s are determined by looking at parameters in BCSRx */
251
252 #define BCSR_ADDR          ((uint) 0xff010000)
253
254 #define CFG_PRELIM_OR_AM    0xff800000  /* OR addr mask */
255
256 /* FLASH timing: ACS = 10, TRLX = 1, CSNT = 1, SCY = 3, EHTR = 0    */
257 #define CFG_OR_TIMING_FLASH (OR_CSNT_SAM  | OR_ACS_DIV4 | OR_BI | OR_SCY_3_CLK | OR_TRLX)
258
259 #define CFG_OR0_PRELIM  (CFG_PRELIM_OR_AM | CFG_OR_TIMING_FLASH)   /* 8 Mbyte until detected */
260 #define CFG_BR0_PRELIM  (CFG_FLASH_BASE | BR_V)
261
262 /* BCSRx - Board Control and Status Registers */
263 #define CFG_OR1_PRELIM  0xffff8110      /* 64Kbyte address space */
264 #define CFG_BR1_PRELIM  ((BCSR_ADDR) | BR_V )
265
266 /*
267  * Memory Periodic Timer Prescaler
268  */
269
270 /* refresh rate 15.6 us (= 64 ms / 4K = 62.4 / quad bursts) for <= 128 MBit */
271 #define CFG_MPTPR_2BK_4K    MPTPR_PTP_DIV16     /* setting for 2 banks  */
272 #define CFG_MPTPR_1BK_4K    MPTPR_PTP_DIV32     /* setting for 1 bank   */
273
274 /* refresh rate 7.8 us (= 64 ms / 8K = 31.2 / quad bursts) for 256 MBit     */
275 #define CFG_MPTPR_2BK_8K    MPTPR_PTP_DIV8      /* setting for 2 banks  */
276 #define CFG_MPTPR_1BK_8K    MPTPR_PTP_DIV16     /* setting for 1 bank   */
277
278 /*
279  * Internal Definitions
280  *
281  * Boot Flags
282  */
283 #define BOOTFLAG_COLD   0x01        /* Normal Power-On: Boot from FLASH */
284 #define BOOTFLAG_WARM   0x02        /* Software reboot          */
285
286
287 /* values according to the manual */
288 #define BCSR0   (BCSR_ADDR + 0x00)
289 #define BCSR1   (BCSR_ADDR + 0x04)
290 #define BCSR2   (BCSR_ADDR + 0x08)
291 #define BCSR3   (BCSR_ADDR + 0x0c)
292
293
294 /*-----------------------------------------------------------------------
295  * PCMCIA stuff
296  *-----------------------------------------------------------------------
297  *
298  */
299 #ifdef CONFIG_MPC860
300 #define PCMCIA_SLOT_A 1
301 #endif
302
303 #define CFG_PCMCIA_MEM_ADDR     (0xE0000000)
304 #define CFG_PCMCIA_MEM_SIZE     ( 64 << 20 )
305 #define CFG_PCMCIA_DMA_ADDR     (0xE4000000)
306 #define CFG_PCMCIA_DMA_SIZE     ( 64 << 20 )
307 #define CFG_PCMCIA_ATTRB_ADDR   (0xE8000000)
308 #define CFG_PCMCIA_ATTRB_SIZE   ( 64 << 20 )
309 #define CFG_PCMCIA_IO_ADDR      (0xEC000000)
310 #define CFG_PCMCIA_IO_SIZE      ( 64 << 20 )
311
312 /*-----------------------------------------------------------------------
313  * IDE/ATA stuff
314  *-----------------------------------------------------------------------
315  */
316 #define CONFIG_IDE_8xx_DIRECT   1   /* PCMCIA interface required    */
317 #undef  CONFIG_IDE_LED              /* LED   for ide supported  */
318 #define CONFIG_IDE_RESET        1   /* reset for ide supported  */
319
320 #define CFG_IDE_MAXBUS          1   /* max. 2 IDE busses        */
321 #define CFG_IDE_MAXDEVICE       (CFG_IDE_MAXBUS*2) /* max. 2 drives per IDE bus */
322
323 #define CFG_PIO_MODE            0   /* IDE interface in PIO Mode 0  */
324 #define CFG_PC_IDE_RESET        ((ushort)0x0008)    /* PC 12    */
325
326 #define CFG_ATA_BASE_ADDR       CFG_PCMCIA_MEM_ADDR
327 #define CFG_ATA_IDE0_OFFSET     0x0000
328
329 #define CFG_ATA_DATA_OFFSET     0x0000  /* Offset for data I/O          */
330 #define CFG_ATA_REG_OFFSET      0x0080  /* Offset for normal register accesses  */
331 #define CFG_ATA_ALT_OFFSET      0x0100  /* Offset for alternate registers   */
332
333 #define CONFIG_DISK_SPINUP_TIME 1000000
334 #undef CONFIG_DISK_SPINUP_TIME  /* usinĀ“ Compact Flash */
335
336 /* (F)ADS bitvalues by Helmut Buchsbaum
337  * see MPC8xxADS User's Manual for a proper description
338  * of the following structures
339  */
340
341 #define BCSR0_ERB       ((uint)0x80000000)
342 #define BCSR0_IP        ((uint)0x40000000)
343 #define BCSR0_BDIS      ((uint)0x10000000)
344 #define BCSR0_BPS_MASK  ((uint)0x0C000000)
345 #define BCSR0_ISB_MASK  ((uint)0x01800000)
346 #define BCSR0_DBGC_MASK ((uint)0x00600000)
347 #define BCSR0_DBPC_MASK ((uint)0x00180000)
348 #define BCSR0_EBDF_MASK ((uint)0x00060000)
349
350 #define BCSR1_FLASH_EN           ((uint)0x80000000)
351 #define BCSR1_DRAM_EN            ((uint)0x40000000)
352 #define BCSR1_ETHEN              ((uint)0x20000000)
353 #define BCSR1_IRDEN              ((uint)0x10000000)
354 #define BCSR1_FLASH_CFG_EN       ((uint)0x08000000)
355 #define BCSR1_CNT_REG_EN_PROTECT ((uint)0x04000000)
356 #define BCSR1_BCSR_EN            ((uint)0x02000000)
357 #define BCSR1_RS232EN_1          ((uint)0x01000000)
358 #define BCSR1_PCCEN              ((uint)0x00800000)
359 #define BCSR1_PCCVCC0            ((uint)0x00400000)
360 #define BCSR1_PCCVCCON              BCSR1_PCCVCC0
361 #define BCSR1_PCCVPP_MASK        ((uint)0x00300000)
362 #define BCSR1_DRAM_HALF_WORD     ((uint)0x00080000)
363 #define BCSR1_RS232EN_2          ((uint)0x00040000)
364 #define BCSR1_SDRAM_EN           ((uint)0x00020000)
365 #define BCSR1_PCCVCC1            ((uint)0x00010000)
366
367 #define BCSR2_FLASH_PD_MASK      ((uint)0xF0000000)
368 #define BCSR2_DRAM_PD_MASK       ((uint)0x07800000)
369 #define BCSR2_DRAM_PD_SHIFT      (23)
370 #define BCSR2_EXTTOLI_MASK       ((uint)0x00780000)
371 #define BCSR2_DBREVNR_MASK       ((uint)0x00030000)
372
373 #define BCSR3_DBID_MASK          ((ushort)0x3800)
374 #define BCSR3_CNT_REG_EN_PROTECT ((ushort)0x0400)
375 #define BCSR3_BREVNR0            ((ushort)0x0080)
376 #define BCSR3_FLASH_PD_MASK      ((ushort)0x0070)
377 #define BCSR3_BREVN1             ((ushort)0x0008)
378 #define BCSR3_BREVN2_MASK        ((ushort)0x0003)
379
380 /* We don't use the 8259.
381  */
382 #define NR_8259_INTS    0
383
384 /* Machine type
385  */
386 #define _MACH_8xx (_MACH_ads)
387
388 #endif  /* _CONFIG_ADS860_H */