881a93729f582a3f4444ae841253367eee274362
[oweals/u-boot.git] / include / configs / pdm360ng.h
1 /*
2  * (C) Copyright 2009-2010
3  * Michael Weiß, ifm ecomatic gmbh, michael.weiss@ifm.com
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 /*
9  * pdm360ng board configuration file
10  */
11
12 #ifndef __CONFIG_H
13 #define __CONFIG_H
14
15 #define CONFIG_PDM360NG 1
16
17 /*
18  * Memory map for the PDM360NG board:
19  *
20  * 0x0000_0000 - 0x1FFF_FFFF    DDR RAM (512 MB)
21  * 0x2000_0000 - 0x3FFF_FFFF    reserved (DDR RAM (512 MB)
22  * 0x5000_0000 - 0x5001_FFFF    SRAM (128 KB)
23  * 0x5004_0000 - 0x5005_FFFF    MRAM (CS2) (128 KB)
24  * 0x8000_0000 - 0x803F_FFFF    IMMR (4 MB)
25  * 0xF000_0000 - 0xF7FF_FFFF    NOR FLASH (CS0) (128 MB)
26  * 0xF800_0000 - 0xFFFF_FFFF    NOR FLASH (CS1) (128 MB) optional
27  */
28
29 /*
30  * High Level Configuration Options
31  */
32 #define CONFIG_E300             1       /* E300 Family */
33 #define CONFIG_FSL_DIU_FB       1       /* FSL DIU */
34
35 #define CONFIG_SYS_TEXT_BASE    0xF0000000
36
37 /* Used for silent command in environment */
38 #define CONFIG_SYS_DEVICE_NULLDEV
39
40 /* Video */
41
42 #if defined(CONFIG_VIDEO)
43 #define CONFIG_CFB_CONSOLE
44 #define CONFIG_VGA_AS_SINGLE_DEVICE
45 #define CONFIG_SPLASH_SCREEN
46 #define CONFIG_VIDEO_LOGO
47 #define CONFIG_VIDEO_BMP_RLE8
48 #endif
49
50 #define CONFIG_SYS_MPC512X_CLKIN        33333333        /* in Hz */
51
52 #define CONFIG_MISC_INIT_R
53
54 #define CONFIG_SYS_IMMR                 0x80000000
55 #define CONFIG_SYS_DIU_ADDR             ((CONFIG_SYS_IMMR) + 0x2100)
56
57 /*
58  * DDR Setup
59  */
60
61 /* DDR is system memory */
62 #define CONFIG_SYS_DDR_BASE             0x00000000
63 #define CONFIG_SYS_SDRAM_BASE           CONFIG_SYS_DDR_BASE
64 #define CONFIG_SYS_MAX_RAM_SIZE         0x40000000
65
66 /* DDR pin mux and slew rate */
67 #define CONFIG_SYS_IOCTRL_MUX_DDR       0x00000012
68
69 /* Manually set all parameters as there's no SPD etc. */
70 /*
71  * DDR Controller Configuration for Micron DDR2 SDRAM MT47H128M8-3
72  *
73  * SYS_CFG:
74  *      [31:31] MDDRC Soft Reset:       Diabled
75  *      [30:30] DRAM CKE pin:           Enabled
76  *      [29:29] DRAM CLK:               Enabled
77  *      [28:28] Command Mode:           Enabled (For initialization only)
78  *      [27:25] DRAM Row Select:        dram_row[15:0] = magenta_address[25:10]
79  *      [24:21] DRAM Bank Select:       dram_bank[1:0] = magenta_address[11:10]
80  *      [20:19] Read Test:              DON'T USE
81  *      [18:18] Self Refresh:           Enabled
82  *      [17:17] 16bit Mode:             Disabled
83  *      [16:13] Read Delay:             3
84  *      [12:12] Half DQS Delay:         Disabled
85  *      [11:11] Quarter DQS Delay:      Disabled
86  *      [10:08] Write Delay:            2
87  *      [07:07] Early ODT:              Disabled
88  *      [06:06] On DIE Termination:     Enabled
89  *      [05:05] FIFO Overflow Clear:    DON'T USE here
90  *      [04:04] FIFO Underflow Clear:   DON'T USE here
91  *      [03:03] FIFO Overflow Pending:  DON'T USE here
92  *      [02:02] FIFO Underlfow Pending: DON'T USE here
93  *      [01:01] FIFO Overlfow Enabled:  Enabled
94  *      [00:00] FIFO Underflow Enabled: Enabled
95  * TIME_CFG0
96  *      [31:16] DRAM Refresh Time:      0 CSB clocks
97  *      [15:8]  DRAM Command Time:      0 CSB clocks
98  *      [07:00] DRAM Precharge Time:    0 CSB clocks
99  * TIME_CFG1
100  *      [31:26] DRAM tRFC:
101  *      [25:21] DRAM tWR1:
102  *      [20:17] DRAM tWRT1:
103  *      [16:11] DRAM tDRR:
104  *      [10:05] DRAM tRC:
105  *      [04:00] DRAM tRAS:
106  * TIME_CFG2
107  *      [31:28] DRAM tRCD:
108  *      [27:23] DRAM tFAW:
109  *      [22:19] DRAM tRTW1:
110  *      [18:15] DRAM tCCD:
111  *      [14:10] DRAM tRTP:
112  *      [09:05] DRAM tRP:
113  *      [04:00] DRAM tRPA
114  */
115 #define CONFIG_SYS_MDDRC_SYS_CFG        0xEA804A40
116 #define CONFIG_SYS_MDDRC_TIME_CFG0      0x030C3D2E
117 #define CONFIG_SYS_MDDRC_TIME_CFG1      0x68EC1168
118 #define CONFIG_SYS_MDDRC_TIME_CFG2      0x34310864
119
120 /*
121  * Alternative 1: small RAM (128 MB) configuration
122  */
123 #define CONFIG_SYS_MDDRC_SYS_CFG_ALT1   0xE8604A40
124 #define CONFIG_SYS_MDDRC_TIME_CFG0_ALT1 0x030C3D2E
125 #define CONFIG_SYS_MDDRC_TIME_CFG1_ALT1 0x3CEC1168
126 #define CONFIG_SYS_MDDRC_TIME_CFG2_ALT1 0x33310863
127
128 #define CONFIG_SYS_MDDRC_SYS_CFG_EN     0xF0000000
129
130 #define CONFIG_SYS_DDRCMD_NOP           0x01380000
131 #define CONFIG_SYS_DDRCMD_PCHG_ALL      0x01100400
132 #define CONFIG_SYS_DDRCMD_EM2           0x01020000  /* EMR2 */
133 #define CONFIG_SYS_DDRCMD_EM3           0x01030000  /* EMR3 */
134 /* EMR with 150 ohm ODT todo: verify */
135 #define CONFIG_SYS_DDRCMD_EN_DLL        0x01010040
136 #define CONFIG_SYS_DDRCMD_RES_DLL       0x01000100
137 #define CONFIG_SYS_DDRCMD_RFSH          0x01080000
138 #define CONFIG_SYS_MICRON_INIT_DEV_OP   0x01000432
139 /* EMR with 150 ohm ODT todo: verify */
140 #define CONFIG_SYS_DDRCMD_OCD_DEFAULT   0x010107C0
141 /* EMR new command with 150 ohm ODT todo: verify */
142 #define CONFIG_SYS_DDRCMD_OCD_EXIT      0x01010440
143
144 /* DDR Priority Manager Configuration */
145 #define CONFIG_SYS_MDDRCGRP_PM_CFG1     0x00077777
146 #define CONFIG_SYS_MDDRCGRP_PM_CFG2     0x00000000
147 #define CONFIG_SYS_MDDRCGRP_HIPRIO_CFG  0x00000001
148 #define CONFIG_SYS_MDDRCGRP_LUT0_MU     0xFFEEDDCC
149 #define CONFIG_SYS_MDDRCGRP_LUT0_ML     0xBBAAAAAA
150 #define CONFIG_SYS_MDDRCGRP_LUT1_MU     0x66666666
151 #define CONFIG_SYS_MDDRCGRP_LUT1_ML     0x55555555
152 #define CONFIG_SYS_MDDRCGRP_LUT2_MU     0x44444444
153 #define CONFIG_SYS_MDDRCGRP_LUT2_ML     0x44444444
154 #define CONFIG_SYS_MDDRCGRP_LUT3_MU     0x55555555
155 #define CONFIG_SYS_MDDRCGRP_LUT3_ML     0x55555558
156 #define CONFIG_SYS_MDDRCGRP_LUT4_MU     0x11111111
157 #define CONFIG_SYS_MDDRCGRP_LUT4_ML     0x11111122
158 #define CONFIG_SYS_MDDRCGRP_LUT0_AU     0xaaaaaaaa
159 #define CONFIG_SYS_MDDRCGRP_LUT0_AL     0xaaaaaaaa
160 #define CONFIG_SYS_MDDRCGRP_LUT1_AU     0x66666666
161 #define CONFIG_SYS_MDDRCGRP_LUT1_AL     0x66666666
162 #define CONFIG_SYS_MDDRCGRP_LUT2_AU     0x11111111
163 #define CONFIG_SYS_MDDRCGRP_LUT2_AL     0x11111111
164 #define CONFIG_SYS_MDDRCGRP_LUT3_AU     0x11111111
165 #define CONFIG_SYS_MDDRCGRP_LUT3_AL     0x11111111
166 #define CONFIG_SYS_MDDRCGRP_LUT4_AU     0x11111111
167 #define CONFIG_SYS_MDDRCGRP_LUT4_AL     0x11111111
168
169 /*
170  * NOR FLASH on the Local Bus
171  */
172 #define CONFIG_SYS_FLASH_CFI            /* use Common Flash Interface */
173 #define CONFIG_FLASH_CFI_DRIVER         /* use the CFI driver */
174 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
175
176 #define CONFIG_SYS_FLASH_BASE           0xF0000000 /* start of FLASH-Bank0 */
177 #define CONFIG_SYS_FLASH_SIZE           0x08000000 /* max size of a Bank */
178 /* start of FLASH-Bank1 */
179 #define CONFIG_SYS_FLASH1_BASE          (CONFIG_SYS_FLASH_BASE + \
180                                          CONFIG_SYS_FLASH_SIZE)
181 #define CONFIG_SYS_MAX_FLASH_SECT       512     /* max sectors per device */
182 #define CONFIG_SYS_MAX_FLASH_BANKS      2       /* number of banks */
183 #define CONFIG_SYS_FLASH_BANKS_LIST \
184         {CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH1_BASE}
185
186 #define CONFIG_SYS_SRAM_BASE            0x50000000
187 #define CONFIG_SYS_SRAM_SIZE            0x00020000      /* 128 KB */
188
189 #define CONFIG_SYS_CS1_START            CONFIG_SYS_FLASH1_BASE
190 #define CONFIG_SYS_CS1_SIZE             CONFIG_SYS_FLASH_SIZE
191
192 /* ALE active low, data size 4 bytes */
193 #define CONFIG_SYS_CS0_CFG              0x05059350
194 /* ALE active low, data size 4 bytes */
195 #define CONFIG_SYS_CS1_CFG              0x05059350
196
197 #define CONFIG_SYS_MRAM_BASE            0x50040000
198 #define CONFIG_SYS_MRAM_SIZE            0x00020000
199 #define CONFIG_SYS_CS2_START            CONFIG_SYS_MRAM_BASE
200 #define CONFIG_SYS_CS2_SIZE             CONFIG_SYS_MRAM_SIZE
201
202 /* ALE active low, data size 4 bytes */
203 #define CONFIG_SYS_CS2_CFG              0x05059110
204
205 /* alt. CS timing for CS0, CS1, CS2 */
206 #define CONFIG_SYS_CS_ALETIMING         0x00000007
207
208 /*
209  * NAND FLASH
210  */
211 #define CONFIG_CMD_NAND                 /* enable NAND support */
212 #define CONFIG_NAND_MPC5121_NFC
213 #define CONFIG_SYS_NAND_BASE            0x40000000
214 #define CONFIG_SYS_MAX_NAND_DEVICE      1
215 #define CONFIG_SYS_NAND_SELECT_DEVICE   /* driver supports mutipl. chips */
216
217 /*
218  * Configuration parameters for MPC5121 NAND driver
219  */
220 #define CONFIG_FSL_NFC_WIDTH 1
221 #define CONFIG_FSL_NFC_WRITE_SIZE 2048
222 #define CONFIG_FSL_NFC_SPARE_SIZE 64
223 #define CONFIG_FSL_NFC_CHIPS CONFIG_SYS_MAX_NAND_DEVICE
224
225 /*
226  * Dynamic MTD partition support
227  */
228 #define CONFIG_CMD_MTDPARTS
229 #define CONFIG_MTD_DEVICE       /* needed for mtdparts commands */
230 #define CONFIG_FLASH_CFI_MTD
231 #define MTDIDS_DEFAULT          "nor0=f0000000.flash,nor1=f8000000.flash," \
232                                                 "nand0=MPC5121 NAND"
233
234 /*
235  * Flash layout
236  */
237 #define MTDPARTS_DEFAULT        "mtdparts=f0000000.flash:512k(u-boot)," \
238                                                 "256k(environment1),"   \
239                                                 "256k(environment2),"   \
240                                                 "256k(splash-factory)," \
241                                                 "2m(FIT: recovery),"    \
242                                                 "4608k(fs-recovery),"   \
243                                                 "256k(splash-customer),"\
244                                                 "5m(FIT: kernel+dtb),"  \
245                                                 "64m(rootfs squash)ro," \
246                                                 "51m(userfs ubi);"      \
247                                         "f8000000.flash:-(unused);"     \
248                                         "MPC5121 NAND:1024m(extended-userfs)"
249
250 #define CONFIG_SYS_MONITOR_BASE         CONFIG_SYS_TEXT_BASE    /* Start of monitor */
251 #define CONFIG_SYS_MONITOR_LEN          (512 * 1024)    /* 512 kB for monitor */
252 #ifdef  CONFIG_FSL_DIU_FB
253 #define CONFIG_SYS_MALLOC_LEN           (6 * 1024 * 1024) /* for malloc */
254 #else
255 #define CONFIG_SYS_MALLOC_LEN           (512 * 1024)
256 #endif
257
258 /*
259  * Serial Port
260  */
261 #define CONFIG_CONS_INDEX     1
262
263 /*
264  * Serial console configuration
265  */
266 #define CONFIG_PSC_CONSOLE      6       /* console is on PSC6 */
267 #if CONFIG_PSC_CONSOLE != 6
268 #error CONFIG_PSC_CONSOLE must be 6
269 #endif
270
271 #define CONSOLE_FIFO_TX_SIZE    FIFOC_PSC6_TX_SIZE
272 #define CONSOLE_FIFO_TX_ADDR    FIFOC_PSC6_TX_ADDR
273 #define CONSOLE_FIFO_RX_SIZE    FIFOC_PSC6_RX_SIZE
274 #define CONSOLE_FIFO_RX_ADDR    FIFOC_PSC6_RX_ADDR
275
276 /*
277  * Clocks in use
278  */
279 #define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN |                           \
280                          CLOCK_SCCR1_LPC_EN |                           \
281                          CLOCK_SCCR1_NFC_EN |                           \
282                          CLOCK_SCCR1_PSC_EN(CONFIG_PSC_CONSOLE) |       \
283                          CLOCK_SCCR1_PSCFIFO_EN |                       \
284                          CLOCK_SCCR1_DDR_EN |                           \
285                          CLOCK_SCCR1_FEC_EN |                           \
286                          CLOCK_SCCR1_TPR_EN)
287
288 #define SCCR2_CLOCKS_EN (CLOCK_SCCR2_MEM_EN |           \
289                          CLOCK_SCCR2_SPDIF_EN |         \
290                          CLOCK_SCCR2_DIU_EN |           \
291                          CLOCK_SCCR2_I2C_EN)
292
293 /*
294  * Used PSC UART devices
295  */
296 #define CONFIG_SYS_PSC1
297 #define CONFIG_SYS_PSC4
298 #define CONFIG_SYS_PSC6
299
300 /*
301  * Co-processor communication parameters
302  */
303 #define CONFIG_SYS_PDM360NG_COPROC_READ_DELAY   5000
304 #define CONFIG_SYS_PDM360NG_COPROC_BAUDRATE     38400
305
306 /*
307  * I2C
308  */
309 #define CONFIG_HARD_I2C                 /* I2C with hardware support */
310 #define CONFIG_I2C_MULTI_BUS
311 #define CONFIG_I2C_CMD_TREE
312 /* I2C speed and slave address */
313 #define CONFIG_SYS_I2C_SPEED            100000
314 #define CONFIG_SYS_I2C_SLAVE            0x7F
315
316 /*
317  * IIM - IC Identification Module
318  */
319 #undef CONFIG_FSL_IIM
320
321 /*
322  * EEPROM configuration
323  */
324 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN          2       /* 16-bit EEPROM addr */
325 #define CONFIG_SYS_I2C_EEPROM_ADDR              0x50    /* ST AT24C01 */
326 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS   10      /* 10ms of delay */
327 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS       4       /* 16-Byte Write Mode */
328
329 /*
330  * MAC addr in EEPROM
331  */
332 #define CONFIG_SYS_I2C_EEPROM_BUS_NUM           0
333 #define CONFIG_SYS_I2C_EEPROM_MAC_OFFSET        0x10
334 /*
335  * Enabled only to delete "ethaddr" before testing
336  * "ethaddr" setting from EEPROM
337  */
338 #define CONFIG_ENV_OVERWRITE
339
340 /*
341  * Ethernet configuration
342  */
343 #define CONFIG_MPC512x_FEC      1
344 #define CONFIG_PHY_ADDR         0x1F
345 #define CONFIG_MII              1       /* MII PHY management   */
346 #define CONFIG_FEC_AN_TIMEOUT   1
347 #define CONFIG_HAS_ETH0
348
349 /*
350  * Configure on-board RTC
351  */
352 #define CONFIG_RTC_M41T62                       /* use M41T00 rtc via i2c */
353 #define CONFIG_SYS_I2C_RTC_ADDR         0x68    /* at address 0x68      */
354
355 /*
356  * Environment
357  */
358 #define CONFIG_ENV_IS_IN_FLASH  1
359 /* This has to be a multiple of the Flash sector size */
360 #define CONFIG_ENV_ADDR         (CONFIG_SYS_MONITOR_BASE + \
361                                  CONFIG_SYS_MONITOR_LEN)
362 #define CONFIG_ENV_SIZE         0x2000
363 #define CONFIG_ENV_SECT_SIZE    0x40000         /* one sector (256K) for env */
364
365 /* Address and size of Redundant Environment Sector     */
366 #define CONFIG_ENV_ADDR_REDUND  (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
367 #define CONFIG_ENV_SIZE_REDUND  (CONFIG_ENV_SIZE)
368
369 #define CONFIG_LOADS_ECHO       1       /* echo on for serial download */
370 #define CONFIG_SYS_LOADS_BAUD_CHANGE    1       /* allow baudrate change */
371
372 #define CONFIG_CMD_DATE
373 #define CONFIG_CMD_EEPROM
374 #define CONFIG_CMD_REGINFO
375
376 #undef CONFIG_CMD_FUSE
377
378 #ifdef CONFIG_VIDEO
379 #define CONFIG_CMD_BMP
380 #endif
381
382 /*
383  * Miscellaneous configurable options
384  */
385 #define CONFIG_SYS_LONGHELP                     /* undef to save memory */
386 #define CONFIG_SYS_LOAD_ADDR    0x2000000       /* default load address */
387
388 #ifdef CONFIG_CMD_KGDB
389         #define CONFIG_SYS_CBSIZE       1024    /* Console I/O Buffer Size */
390 #else
391         #define CONFIG_SYS_CBSIZE       256     /* Console I/O Buffer Size */
392 #endif
393
394 /* Print Buffer Size */
395 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
396 /* Max number of command args */
397 #define CONFIG_SYS_MAXARGS      16
398 /* Boot Argument Buffer Size */
399 #define CONFIG_SYS_BARGSIZE     CONFIG_SYS_CBSIZE
400 /* Decrementer freq: 1ms ticks */
401
402 /*
403  * For booting Linux, the board info and command line data
404  * have to be in the first 256 MB of memory, since this is
405  * the maximum mapped by the Linux kernel during initialization.
406  */
407 /* Initial Memory map for Linux */
408 #define CONFIG_SYS_BOOTMAPSZ    (256 << 20)
409
410 /* Cache Configuration */
411 #define CONFIG_SYS_DCACHE_SIZE          32768
412 #define CONFIG_SYS_CACHELINE_SIZE       32
413 #ifdef CONFIG_CMD_KGDB
414 /* log base 2 of the above value */
415 #define CONFIG_SYS_CACHELINE_SHIFT      5
416 #endif
417
418 #define CONFIG_SYS_HID0_INIT    0x000000000
419 #define CONFIG_SYS_HID0_FINAL   (HID0_ENABLE_MACHINE_CHECK | HID0_ICE)
420 #define CONFIG_SYS_HID2 HID2_HBE
421
422 #define CONFIG_HIGH_BATS        1       /* High BATs supported */
423
424 #ifdef CONFIG_CMD_KGDB
425 #define CONFIG_KGDB_BAUDRATE    230400  /* speed of kgdb serial port */
426 #endif
427
428 /* POST support */
429 #define CONFIG_POST             (CONFIG_SYS_POST_COPROC)
430
431 /*
432  * Environment Configuration
433  */
434 #define CONFIG_TIMESTAMP
435
436 #define CONFIG_HOSTNAME         pdm360ng
437 /* default location for tftp and bootm */
438 #define CONFIG_LOADADDR         400000
439
440
441 #define CONFIG_PREBOOT  "echo;" \
442         "echo PDM360NG SAMPLE;" \
443         "echo"
444
445 #define CONFIG_BOOTCOMMAND      "run env_cont"
446
447 #define CONFIG_OF_SUPPORT_OLD_DEVICE_TREES      1
448
449 #define OF_CPU                  "PowerPC,5121@0"
450 #define OF_SOC_COMPAT           "fsl,mpc5121-immr"
451 #define OF_TBCLK                (bd->bi_busfreq / 4)
452 #define OF_STDOUT_PATH          "/soc@80000000/serial@11600"
453
454 /*
455  * Include common options for all mpc5121 boards
456  */
457 #include "mpc5121-common.h"
458
459 #endif  /* __CONFIG_H */