blob: 6086a73ba95598cc3b35f2ecf00aa60c7268160d [file] [log] [blame]
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02001/*
Wolfgang Denkfd3166d2009-05-16 10:47:42 +02002 * (C) Copyright 2007-2009 DENX Software Engineering
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02003 *
4 * MPC512x Internal Memory Map
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02007 *
8 * Based on the MPC83xx header.
9 */
10
11#ifndef __IMMAP_512x__
12#define __IMMAP_512x__
13
14#include <asm/types.h>
Wolfgang Denkf342f862009-05-16 10:47:45 +020015#if defined(CONFIG_E300)
16#include <asm/e300.h>
17#endif
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020018
Wolfgang Denkf342f862009-05-16 10:47:45 +020019/*
20 * System reset offset (PowerPC standard)
21 */
22#define EXC_OFF_SYS_RESET 0x0100
23#define _START_OFFSET EXC_OFF_SYS_RESET
24
25#define SPR_5121E 0x80180000
26
27/*
28 * IMMRBAR - Internal Memory Register Base Address
29 */
30#define CONFIG_DEFAULT_IMMR 0xFF400000 /* Default IMMR base address */
31#define IMMRBAR 0x0000 /* Register offset to immr */
32#define IMMRBAR_BASE_ADDR 0xFFF00000 /* Base address mask */
33#define IMMRBAR_RES ~(IMMRBAR_BASE_ADDR)
34
35
36#ifndef __ASSEMBLY__
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020037typedef struct law512x {
38 u32 bar; /* Base Addr Register */
39 u32 ar; /* Attributes Register */
John Rigbyd1228c92008-02-26 09:38:14 -070040} law512x_t;
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020041
42/*
43 * System configuration registers
44 */
45typedef struct sysconf512x {
46 u32 immrbar; /* Internal memory map base address register */
47 u8 res0[0x1c];
48 u32 lpbaw; /* LP Boot Access Window */
49 u32 lpcs0aw; /* LP CS0 Access Window */
50 u32 lpcs1aw; /* LP CS1 Access Window */
51 u32 lpcs2aw; /* LP CS2 Access Window */
52 u32 lpcs3aw; /* LP CS3 Access Window */
53 u32 lpcs4aw; /* LP CS4 Access Window */
54 u32 lpcs5aw; /* LP CS5 Access Window */
55 u32 lpcs6aw; /* LP CS6 Access Window */
56 u32 lpcs7aw; /* LP CS7 Access Window */
57 u8 res1[0x1c];
John Rigbyd1228c92008-02-26 09:38:14 -070058 law512x_t pcilaw[3]; /* PCI Local Access Window 0-2 Registers */
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020059 u8 res2[0x28];
John Rigbyd1228c92008-02-26 09:38:14 -070060 law512x_t ddrlaw; /* DDR Local Access Window */
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020061 u8 res3[0x18];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020062 u32 srambar; /* SRAM Base Address */
63 u32 nfcbar; /* NFC Base Address */
64 u8 res4[0x34];
65 u32 spridr; /* System Part and Revision ID Register */
66 u32 spcr; /* System Priority Configuration Register */
67 u8 res5[0xf8];
68} sysconf512x_t;
69
Wolfgang Denkf342f862009-05-16 10:47:45 +020070#define LAWBAR_BAR 0xFFFFF000 /* Base address mask */
71
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +020072/*
73 * Watch Dog Timer (WDT) Registers
74 */
75typedef struct wdt512x {
76 u8 res0[4];
77 u32 swcrr; /* System watchdog control register */
78 u32 swcnr; /* System watchdog count register */
79 u8 res1[2];
80 u16 swsrr; /* System watchdog service register */
81 u8 res2[0xF0];
82} wdt512x_t;
83
84/*
85 * RTC Module Registers
86 */
87typedef struct rtclk512x {
88 u8 fixme[0x100];
89} rtclk512x_t;
90
91/*
92 * General Purpose Timer
93 */
94typedef struct gpt512x {
95 u8 fixme[0x100];
96} gpt512x_t;
97
98/*
99 * Integrated Programmable Interrupt Controller
100 */
101typedef struct ipic512x {
102 u8 fixme[0x100];
103} ipic512x_t;
104
105/*
106 * System Arbiter Registers
107 */
108typedef struct arbiter512x {
109 u32 acr; /* Arbiter Configuration Register */
110 u32 atr; /* Arbiter Timers Register */
111 u32 ater; /* Arbiter Transfer Error Register */
112 u32 aer; /* Arbiter Event Register */
113 u32 aidr; /* Arbiter Interrupt Definition Register */
114 u32 amr; /* Arbiter Mask Register */
115 u32 aeatr; /* Arbiter Event Attributes Register */
116 u32 aeadr; /* Arbiter Event Address Register */
117 u32 aerr; /* Arbiter Event Response Register */
118 u8 res1[0xDC];
119} arbiter512x_t;
120
121/*
122 * Reset Module
123 */
124typedef struct reset512x {
125 u32 rcwl; /* Reset Configuration Word Low Register */
126 u32 rcwh; /* Reset Configuration Word High Register */
127 u8 res0[8];
128 u32 rsr; /* Reset Status Register */
129 u32 rmr; /* Reset Mode Register */
130 u32 rpr; /* Reset protection Register */
131 u32 rcr; /* Reset Control Register */
132 u32 rcer; /* Reset Control Enable Register */
133 u8 res1[0xDC];
134} reset512x_t;
135
Wolfgang Denkf342f862009-05-16 10:47:45 +0200136/* RSR - Reset Status Register */
137#define RSR_SWSR 0x00002000 /* software soft reset */
138#define RSR_SWHR 0x00001000 /* software hard reset */
139#define RSR_JHRS 0x00000200 /* jtag hreset */
140#define RSR_JSRS 0x00000100 /* jtag sreset status */
141#define RSR_CSHR 0x00000010 /* checkstop reset status */
142#define RSR_SWRS 0x00000008 /* software watchdog reset status */
143#define RSR_BMRS 0x00000004 /* bus monitop reset status */
144#define RSR_SRS 0x00000002 /* soft reset status */
145#define RSR_HRS 0x00000001 /* hard reset status */
146#define RSR_RES ~(RSR_SWSR | RSR_SWHR |\
147 RSR_JHRS | RSR_JSRS | RSR_CSHR | RSR_SWRS |\
148 RSR_BMRS | RSR_SRS | RSR_HRS)
149
150/* RMR - Reset Mode Register */
151#define RMR_CSRE 0x00000001 /* checkstop reset enable */
152#define RMR_CSRE_SHIFT 0
153#define RMR_RES (~(RMR_CSRE))
154
155/* RCR - Reset Control Register */
156#define RCR_SWHR 0x00000002 /* software hard reset */
157#define RCR_SWSR 0x00000001 /* software soft reset */
158#define RCR_RES (~(RCR_SWHR | RCR_SWSR))
159
160/* RCER - Reset Control Enable Register */
161#define RCER_CRE 0x00000001 /* software hard reset */
162#define RCER_RES (~(RCER_CRE))
163
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200164/*
165 * Clock Module
166 */
167typedef struct clk512x {
168 u32 spmr; /* System PLL Mode Register */
169 u32 sccr[2]; /* System Clock Control Registers */
170 u32 scfr[2]; /* System Clock Frequency Registers */
171 u8 res0[4];
172 u32 bcr; /* Bread Crumb Register */
173 u32 pscccr[12]; /* PSC0-11 Clock Control Registers */
Wolfgang Denkd616a922009-06-14 20:58:45 +0200174 u32 spccr; /* SPDIF Clock Control Register */
175 u32 cccr; /* CFM Clock Control Register */
176 u32 dccr; /* DIU Clock Control Register */
177 u32 msccr[4]; /* MSCAN1-4 Clock Control Registers */
178 u8 res1[0x98];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200179} clk512x_t;
180
Wolfgang Denkf342f862009-05-16 10:47:45 +0200181/* SPMR - System PLL Mode Register */
182#define SPMR_SPMF 0x0F000000
183#define SPMR_SPMF_SHIFT 24
184#define SPMR_CPMF 0x000F0000
185#define SPMR_CPMF_SHIFT 16
186
187/* System Clock Control Register 1 commands */
188#define CLOCK_SCCR1_CFG_EN 0x80000000
189#define CLOCK_SCCR1_LPC_EN 0x40000000
190#define CLOCK_SCCR1_NFC_EN 0x20000000
191#define CLOCK_SCCR1_PATA_EN 0x10000000
192#define CLOCK_SCCR1_PSC_EN(cn) (0x08000000 >> (cn))
193#define CLOCK_SCCR1_PSCFIFO_EN 0x00008000
194#define CLOCK_SCCR1_SATA_EN 0x00004000
195#define CLOCK_SCCR1_FEC_EN 0x00002000
196#define CLOCK_SCCR1_TPR_EN 0x00001000
197#define CLOCK_SCCR1_PCI_EN 0x00000800
198#define CLOCK_SCCR1_DDR_EN 0x00000400
199
200/* System Clock Control Register 2 commands */
201#define CLOCK_SCCR2_DIU_EN 0x80000000
202#define CLOCK_SCCR2_AXE_EN 0x40000000
203#define CLOCK_SCCR2_MEM_EN 0x20000000
Martha Stan3054eb42009-10-07 04:38:46 -0400204#define CLOCK_SCCR2_USB1_EN 0x10000000
205#define CLOCK_SCCR2_USB2_EN 0x08000000
Wolfgang Denkf342f862009-05-16 10:47:45 +0200206#define CLOCK_SCCR2_I2C_EN 0x04000000
207#define CLOCK_SCCR2_BDLC_EN 0x02000000
208#define CLOCK_SCCR2_SDHC_EN 0x01000000
209#define CLOCK_SCCR2_SPDIF_EN 0x00800000
210#define CLOCK_SCCR2_MBX_BUS_EN 0x00400000
211#define CLOCK_SCCR2_MBX_EN 0x00200000
212#define CLOCK_SCCR2_MBX_3D_EN 0x00100000
213#define CLOCK_SCCR2_IIM_EN 0x00080000
214
215/* SCFR1 System Clock Frequency Register 1 */
Anatolij Gustschina4911f52013-02-08 00:03:47 +0000216#ifndef SCFR1_IPS_DIV
Wolfgang Denkf342f862009-05-16 10:47:45 +0200217#define SCFR1_IPS_DIV 0x3
Anatolij Gustschina4911f52013-02-08 00:03:47 +0000218#endif
Wolfgang Denkf342f862009-05-16 10:47:45 +0200219#define SCFR1_IPS_DIV_MASK 0x03800000
220#define SCFR1_IPS_DIV_SHIFT 23
221
222#define SCFR1_PCI_DIV 0x6
223#define SCFR1_PCI_DIV_MASK 0x00700000
224#define SCFR1_PCI_DIV_SHIFT 20
225
Stefan Roese5538b5f2009-06-09 11:50:05 +0200226#define SCFR1_LPC_DIV_MASK 0x00003800
227#define SCFR1_LPC_DIV_SHIFT 11
228
Anatolij Gustschindb20e912013-02-08 00:03:46 +0000229#define SCFR1_NFC_DIV_MASK 0x00000700
230#define SCFR1_NFC_DIV_SHIFT 8
231
232#define SCFR1_DIU_DIV_MASK 0x000000FF
233#define SCFR1_DIU_DIV_SHIFT 0
234
Wolfgang Denkf342f862009-05-16 10:47:45 +0200235/* SCFR2 System Clock Frequency Register 2 */
236#define SCFR2_SYS_DIV 0xFC000000
237#define SCFR2_SYS_DIV_SHIFT 26
238
239/* SPCR - System Priority Configuration Register */
240#define SPCR_TBEN 0x00400000 /* E300 core time base unit enable */
241
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200242/*
243 * Power Management Control Module
244 */
245typedef struct pmc512x {
246 u8 fixme[0x100];
247} pmc512x_t;
248
249/*
250 * General purpose I/O module
251 */
252typedef struct gpio512x {
Wolfgang Denkfd3166d2009-05-16 10:47:42 +0200253 u32 gpdir;
254 u32 gpodr;
255 u32 gpdat;
256 u32 gpier;
257 u32 gpimr;
258 u32 gpicr1;
259 u32 gpicr2;
260 u8 res0[0xE4];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200261} gpio512x_t;
262
263/*
264 * DDR Memory Controller Memory Map
265 */
266typedef struct ddr512x {
267 u32 ddr_sys_config; /* System Configuration Register */
268 u32 ddr_time_config0; /* Timing Configuration Register */
269 u32 ddr_time_config1; /* Timing Configuration Register */
270 u32 ddr_time_config2; /* Timing Configuration Register */
271 u32 ddr_command; /* Command Register */
272 u32 ddr_compact_command; /* Compact Command Register */
273 u32 self_refresh_cmd_0; /* Enter/Exit Self Refresh Registers */
274 u32 self_refresh_cmd_1; /* Enter/Exit Self Refresh Registers */
275 u32 self_refresh_cmd_2; /* Enter/Exit Self Refresh Registers */
276 u32 self_refresh_cmd_3; /* Enter/Exit Self Refresh Registers */
277 u32 self_refresh_cmd_4; /* Enter/Exit Self Refresh Registers */
278 u32 self_refresh_cmd_5; /* Enter/Exit Self Refresh Registers */
279 u32 self_refresh_cmd_6; /* Enter/Exit Self Refresh Registers */
280 u32 self_refresh_cmd_7; /* Enter/Exit Self Refresh Registers */
Priyanka Jain4a717412013-09-25 10:41:19 +0530281 u32 dqs_config_offset_count; /* DQS Config Offset Count */
282 u32 dqs_config_offset_time; /* DQS Config Offset Time */
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200283 u32 DQS_delay_status; /* DQS Delay Status */
284 u32 res0[0xF];
285 u32 prioman_config1; /* Priority Manager Configuration */
286 u32 prioman_config2; /* Priority Manager Configuration */
287 u32 hiprio_config; /* High Priority Configuration */
288 u32 lut_table0_main_upper; /* LUT0 Main Upper */
289 u32 lut_table1_main_upper; /* LUT1 Main Upper */
290 u32 lut_table2_main_upper; /* LUT2 Main Upper */
291 u32 lut_table3_main_upper; /* LUT3 Main Upper */
292 u32 lut_table4_main_upper; /* LUT4 Main Upper */
293 u32 lut_table0_main_lower; /* LUT0 Main Lower */
294 u32 lut_table1_main_lower; /* LUT1 Main Lower */
295 u32 lut_table2_main_lower; /* LUT2 Main Lower */
296 u32 lut_table3_main_lower; /* LUT3 Main Lower */
297 u32 lut_table4_main_lower; /* LUT4 Main Lower */
298 u32 lut_table0_alternate_upper; /* LUT0 Alternate Upper */
299 u32 lut_table1_alternate_upper; /* LUT1 Alternate Upper */
300 u32 lut_table2_alternate_upper; /* LUT2 Alternate Upper */
301 u32 lut_table3_alternate_upper; /* LUT3 Alternate Upper */
302 u32 lut_table4_alternate_upper; /* LUT4 Alternate Upper */
303 u32 lut_table0_alternate_lower; /* LUT0 Alternate Lower */
304 u32 lut_table1_alternate_lower; /* LUT1 Alternate Lower */
305 u32 lut_table2_alternate_lower; /* LUT2 Alternate Lower */
306 u32 lut_table3_alternate_lower; /* LUT3 Alternate Lower */
307 u32 lut_table4_alternate_lower; /* LUT4 Alternate Lower */
308 u32 performance_monitor_config;
309 u32 event_time_counter;
310 u32 event_time_preset;
311 u32 performance_monitor1_address_low;
312 u32 performance_monitor2_address_low;
313 u32 performance_monitor1_address_hi;
314 u32 performance_monitor2_address_hi;
315 u32 res1[2];
316 u32 performance_monitor1_read_counter;
317 u32 performance_monitor2_read_counter;
318 u32 performance_monitor1_write_counter;
319 u32 performance_monitor2_write_counter;
320 u32 granted_ack_counter0;
321 u32 granted_ack_counter1;
322 u32 granted_ack_counter2;
323 u32 granted_ack_counter3;
324 u32 granted_ack_counter4;
325 u32 cumulative_wait_counter0;
326 u32 cumulative_wait_counter1;
327 u32 cumulative_wait_counter2;
328 u32 cumulative_wait_counter3;
329 u32 cumulative_wait_counter4;
330 u32 summed_priority_counter0;
331 u32 summed_priority_counter1;
332 u32 summed_priority_counter2;
333 u32 summed_priority_counter3;
334 u32 summed_priority_counter4;
335 u32 res2[0x3AD];
336} ddr512x_t;
337
Martha M Stanc12ecae2009-09-21 14:07:14 -0400338/* MDDRC SYS CFG and Timing CFG0 Registers */
339#define MDDRC_SYS_CFG_EN 0xF0000000
Anatolij Gustschin32a7cb32013-02-08 00:03:49 +0000340#define MDDRC_SYS_CFG_CKE_MASK 0x40000000
Martha M Stanc12ecae2009-09-21 14:07:14 -0400341#define MDDRC_SYS_CFG_CMD_MASK 0x10000000
342#define MDDRC_REFRESH_ZERO_MASK 0x0000FFFF
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200343
344/*
Wolfgang Denkce33a012009-10-04 22:56:08 +0200345 * DDR Memory Controller Configuration settings
346 */
347typedef struct ddr512x_config {
348 u32 ddr_sys_config; /* System Configuration Register */
349 u32 ddr_time_config0; /* Timing Configuration Register */
350 u32 ddr_time_config1; /* Timing Configuration Register */
351 u32 ddr_time_config2; /* Timing Configuration Register */
352} ddr512x_config_t;
353
Anatolij Gustschin81cad142010-04-24 19:27:09 +0200354typedef struct sdram_conf_s {
355 unsigned long size;
356 ddr512x_config_t cfg;
357} sdram_conf_t;
358
Wolfgang Denkce33a012009-10-04 22:56:08 +0200359/*
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200360 * DMA/Messaging Unit
361 */
362typedef struct dma512x {
363 u8 fixme[0x1800];
364} dma512x_t;
365
366/*
367 * PCI Software Configuration Registers
368 */
369typedef struct pciconf512x {
John Rigbyd1228c92008-02-26 09:38:14 -0700370 u32 config_address;
371 u32 config_data;
372 u32 int_ack;
373 u8 res[116];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200374} pciconf512x_t;
375
376/*
John Rigbyd1228c92008-02-26 09:38:14 -0700377 * PCI Outbound Translation Register
378 */
379typedef struct pci_outbound_window {
380 u32 potar;
381 u8 res0[4];
382 u32 pobar;
383 u8 res1[4];
384 u32 pocmr;
385 u8 res2[4];
386} pot512x_t;
387
Wolfgang Denkf342f862009-05-16 10:47:45 +0200388/* POTAR - PCI Outbound Translation Address Register */
389#define POTAR_TA_MASK 0x000fffff
390
391/* POBAR - PCI Outbound Base Address Register */
392#define POBAR_BA_MASK 0x000fffff
393
394/* POCMR - PCI Outbound Comparision Mask Register */
395#define POCMR_EN 0x80000000
396#define POCMR_IO 0x40000000 /* 0-memory space 1-I/O space */
397#define POCMR_PRE 0x20000000 /* prefetch enable */
398#define POCMR_SBS 0x00100000 /* special byte swap enable */
399#define POCMR_CM_MASK 0x000fffff
400#define POCMR_CM_4G 0x00000000
401#define POCMR_CM_2G 0x00080000
402#define POCMR_CM_1G 0x000C0000
403#define POCMR_CM_512M 0x000E0000
404#define POCMR_CM_256M 0x000F0000
405#define POCMR_CM_128M 0x000F8000
406#define POCMR_CM_64M 0x000FC000
407#define POCMR_CM_32M 0x000FE000
408#define POCMR_CM_16M 0x000FF000
409#define POCMR_CM_8M 0x000FF800
410#define POCMR_CM_4M 0x000FFC00
411#define POCMR_CM_2M 0x000FFE00
412#define POCMR_CM_1M 0x000FFF00
413#define POCMR_CM_512K 0x000FFF80
414#define POCMR_CM_256K 0x000FFFC0
415#define POCMR_CM_128K 0x000FFFE0
416#define POCMR_CM_64K 0x000FFFF0
417#define POCMR_CM_32K 0x000FFFF8
418#define POCMR_CM_16K 0x000FFFFC
419#define POCMR_CM_8K 0x000FFFFE
420#define POCMR_CM_4K 0x000FFFFF
421
John Rigbyd1228c92008-02-26 09:38:14 -0700422/*
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200423 * Sequencer
424 */
425typedef struct ios512x {
John Rigbyd1228c92008-02-26 09:38:14 -0700426 pot512x_t pot[6];
427 u8 res0[0x60];
428 u32 pmcr;
429 u8 res1[4];
430 u32 dtcr;
431 u8 res2[4];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200432} ios512x_t;
433
434/*
435 * PCI Controller
436 */
437typedef struct pcictrl512x {
John Rigbyd1228c92008-02-26 09:38:14 -0700438 u32 esr;
439 u32 ecdr;
440 u32 eer;
441 u32 eatcr;
442 u32 eacr;
443 u32 eeacr;
444 u32 edlcr;
445 u32 edhcr;
446 u32 gcr;
447 u32 ecr;
448 u32 gsr;
449 u8 res0[12];
450 u32 pitar2;
451 u8 res1[4];
452 u32 pibar2;
453 u32 piebar2;
454 u32 piwar2;
455 u8 res2[4];
456 u32 pitar1;
457 u8 res3[4];
458 u32 pibar1;
459 u32 piebar1;
460 u32 piwar1;
461 u8 res4[4];
462 u32 pitar0;
463 u8 res5[4];
464 u32 pibar0;
465 u8 res6[4];
466 u32 piwar0;
467 u8 res7[132];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200468} pcictrl512x_t;
469
Wolfgang Denkf342f862009-05-16 10:47:45 +0200470
471/* PITAR - PCI Inbound Translation Address Register
472 */
473#define PITAR_TA_MASK 0x000fffff
474
475/* PIBAR - PCI Inbound Base/Extended Address Register
476 */
477#define PIBAR_MASK 0xffffffff
478#define PIEBAR_EBA_MASK 0x000fffff
479
480/* PIWAR - PCI Inbound Windows Attributes Register
481 */
482#define PIWAR_EN 0x80000000
483#define PIWAR_SBS 0x40000000
484#define PIWAR_PF 0x20000000
485#define PIWAR_RTT_MASK 0x000f0000
486#define PIWAR_RTT_NO_SNOOP 0x00040000
487#define PIWAR_RTT_SNOOP 0x00050000
488#define PIWAR_WTT_MASK 0x0000f000
489#define PIWAR_WTT_NO_SNOOP 0x00004000
490#define PIWAR_WTT_SNOOP 0x00005000
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200491
492/*
493 * MSCAN
494 */
495typedef struct mscan512x {
496 u8 fixme[0x100];
497} mscan512x_t;
498
499/*
500 * BDLC
501 */
502typedef struct bdlc512x {
503 u8 fixme[0x100];
504} bdlc512x_t;
505
506/*
507 * SDHC
508 */
509typedef struct sdhc512x {
510 u8 fixme[0x100];
511} sdhc512x_t;
512
513/*
514 * SPDIF
515 */
516typedef struct spdif512x {
517 u8 fixme[0x100];
518} spdif512x_t;
519
520/*
521 * I2C
522 */
523typedef struct i2c512x_dev {
524 volatile u32 madr; /* I2Cn + 0x00 */
525 volatile u32 mfdr; /* I2Cn + 0x04 */
526 volatile u32 mcr; /* I2Cn + 0x08 */
527 volatile u32 msr; /* I2Cn + 0x0C */
528 volatile u32 mdr; /* I2Cn + 0x10 */
529 u8 res0[0x0C];
530} i2c512x_dev_t;
531
Wolfgang Denkf342f862009-05-16 10:47:45 +0200532/* Number of I2C buses */
533#define I2C_BUS_CNT 3
534
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200535typedef struct i2c512x {
Wolfgang Denkf342f862009-05-16 10:47:45 +0200536 i2c512x_dev_t dev[I2C_BUS_CNT];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200537 volatile u32 icr;
538 volatile u32 mifr;
539 u8 res0[0x98];
540} i2c512x_t;
541
Wolfgang Denkf342f862009-05-16 10:47:45 +0200542/* I2Cn control register bits */
543#define I2C_EN 0x80
544#define I2C_IEN 0x40
545#define I2C_STA 0x20
546#define I2C_TX 0x10
547#define I2C_TXAK 0x08
548#define I2C_RSTA 0x04
549#define I2C_INIT_MASK (I2C_EN | I2C_STA | I2C_TX | I2C_RSTA)
550
551/* I2Cn status register bits */
552#define I2C_CF 0x80
553#define I2C_AAS 0x40
554#define I2C_BB 0x20
555#define I2C_AL 0x10
556#define I2C_SRW 0x04
557#define I2C_IF 0x02
558#define I2C_RXAK 0x01
559
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200560/*
561 * AXE
562 */
563typedef struct axe512x {
564 u8 fixme[0x100];
565} axe512x_t;
566
567/*
568 * DIU
569 */
570typedef struct diu512x {
571 u8 fixme[0x100];
572} diu512x_t;
573
574/*
575 * CFM
576 */
577typedef struct cfm512x {
578 u8 fixme[0x100];
579} cfm512x_t;
580
581/*
582 * FEC
583 */
584typedef struct fec512x {
Wolfgang Denkfd3166d2009-05-16 10:47:42 +0200585 u32 fec_id; /* FEC_ID register */
586 u32 ievent; /* Interrupt event register */
587 u32 imask; /* Interrupt mask register */
588 u32 reserved_01;
589 u32 r_des_active; /* Receive ring updated flag */
590 u32 x_des_active; /* Transmit ring updated flag */
591 u32 reserved_02[3];
592 u32 ecntrl; /* Ethernet control register */
593 u32 reserved_03[6];
594 u32 mii_data; /* MII data register */
595 u32 mii_speed; /* MII speed register */
596 u32 reserved_04[7];
597 u32 mib_control; /* MIB control/status register */
598 u32 reserved_05[7];
599 u32 r_cntrl; /* Receive control register */
600 u32 r_hash; /* Receive hash */
601 u32 reserved_06[14];
602 u32 x_cntrl; /* Transmit control register */
603 u32 reserved_07[7];
604 u32 paddr1; /* Physical address low */
605 u32 paddr2; /* Physical address high + type field */
606 u32 op_pause; /* Opcode + pause duration */
607 u32 reserved_08[10];
608 u32 iaddr1; /* Upper 32 bits of individual hash table */
609 u32 iaddr2; /* Lower 32 bits of individual hash table */
610 u32 gaddr1; /* Upper 32 bits of group hash table */
611 u32 gaddr2; /* Lower 32 bits of group hash table */
612 u32 reserved_09[7];
613 u32 x_wmrk; /* Transmit FIFO watermark */
614 u32 reserved_10;
615 u32 r_bound; /* End of RAM */
616 u32 r_fstart; /* Receive FIFO start address */
617 u32 reserved_11[11];
618 u32 r_des_start; /* Beginning of receive descriptor ring */
619 u32 x_des_start; /* Pointer to beginning of transmit descriptor ring */
620 u32 r_buff_size; /* Receive buffer size */
621 u32 reserved_12[26];
622 u32 dma_control; /* DMA control for IP bus, AMBA IF + DMA revision */
623 u32 reserved_13[2];
624
625 u32 mib[128]; /* MIB Block Counters */
626
627 u32 fifo[256]; /* used by FEC, can only be accessed by DMA */
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200628} fec512x_t;
629
630/*
631 * ULPI
632 */
633typedef struct ulpi512x {
634 u8 fixme[0x600];
635} ulpi512x_t;
636
637/*
638 * UTMI
639 */
640typedef struct utmi512x {
641 u8 fixme[0x3000];
642} utmi512x_t;
643
644/*
645 * PCI DMA
646 */
647typedef struct pcidma512x {
648 u8 fixme[0x300];
649} pcidma512x_t;
650
651/*
652 * IO Control
653 */
654typedef struct ioctrl512x {
Wolfgang Denkfd3166d2009-05-16 10:47:42 +0200655 u32 io_control_mem; /* MEM pad ctrl reg */
656 u32 io_control_gp; /* GP pad ctrl reg */
657 u32 io_control_lpc_clk; /* LPC_CLK pad ctrl reg */
658 u32 io_control_lpc_oe; /* LPC_OE pad ctrl reg */
659 u32 io_control_lpc_rw; /* LPC_R/W pad ctrl reg */
660 u32 io_control_lpc_ack; /* LPC_ACK pad ctrl reg */
661 u32 io_control_lpc_cs0; /* LPC_CS0 pad ctrl reg */
662 u32 io_control_nfc_ce0; /* NFC_CE0 pad ctrl reg */
663 u32 io_control_lpc_cs1; /* LPC_CS1 pad ctrl reg */
664 u32 io_control_lpc_cs2; /* LPC_CS2 pad ctrl reg */
665 u32 io_control_lpc_ax03; /* LPC_AX03 pad ctrl reg */
666 u32 io_control_emb_ax02; /* EMB_AX02 pad ctrl reg */
667 u32 io_control_emb_ax01; /* EMB_AX01 pad ctrl reg */
668 u32 io_control_emb_ax00; /* EMB_AX00 pad ctrl reg */
669 u32 io_control_emb_ad31; /* EMB_AD31 pad ctrl reg */
670 u32 io_control_emb_ad30; /* EMB_AD30 pad ctrl reg */
671 u32 io_control_emb_ad29; /* EMB_AD29 pad ctrl reg */
672 u32 io_control_emb_ad28; /* EMB_AD28 pad ctrl reg */
673 u32 io_control_emb_ad27; /* EMB_AD27 pad ctrl reg */
674 u32 io_control_emb_ad26; /* EMB_AD26 pad ctrl reg */
675 u32 io_control_emb_ad25; /* EMB_AD25 pad ctrl reg */
676 u32 io_control_emb_ad24; /* EMB_AD24 pad ctrl reg */
677 u32 io_control_emb_ad23; /* EMB_AD23 pad ctrl reg */
678 u32 io_control_emb_ad22; /* EMB_AD22 pad ctrl reg */
679 u32 io_control_emb_ad21; /* EMB_AD21 pad ctrl reg */
680 u32 io_control_emb_ad20; /* EMB_AD20 pad ctrl reg */
681 u32 io_control_emb_ad19; /* EMB_AD19 pad ctrl reg */
682 u32 io_control_emb_ad18; /* EMB_AD18 pad ctrl reg */
683 u32 io_control_emb_ad17; /* EMB_AD17 pad ctrl reg */
684 u32 io_control_emb_ad16; /* EMB_AD16 pad ctrl reg */
685 u32 io_control_emb_ad15; /* EMB_AD15 pad ctrl reg */
686 u32 io_control_emb_ad14; /* EMB_AD14 pad ctrl reg */
687 u32 io_control_emb_ad13; /* EMB_AD13 pad ctrl reg */
688 u32 io_control_emb_ad12; /* EMB_AD12 pad ctrl reg */
689 u32 io_control_emb_ad11; /* EMB_AD11 pad ctrl reg */
690 u32 io_control_emb_ad10; /* EMB_AD10 pad ctrl reg */
691 u32 io_control_emb_ad09; /* EMB_AD09 pad ctrl reg */
692 u32 io_control_emb_ad08; /* EMB_AD08 pad ctrl reg */
693 u32 io_control_emb_ad07; /* EMB_AD07 pad ctrl reg */
694 u32 io_control_emb_ad06; /* EMB_AD06 pad ctrl reg */
695 u32 io_control_emb_ad05; /* EMB_AD05 pad ctrl reg */
696 u32 io_control_emb_ad04; /* EMB_AD04 pad ctrl reg */
697 u32 io_control_emb_ad03; /* EMB_AD03 pad ctrl reg */
698 u32 io_control_emb_ad02; /* EMB_AD02 pad ctrl reg */
699 u32 io_control_emb_ad01; /* EMB_AD01 pad ctrl reg */
700 u32 io_control_emb_ad00; /* EMB_AD00 pad ctrl reg */
701 u32 io_control_pata_ce1; /* PATA_CE1 pad ctrl reg */
702 u32 io_control_pata_ce2; /* PATA_CE2 pad ctrl reg */
703 u32 io_control_pata_isolate; /* PATA_ISOLATE pad ctrl reg */
704 u32 io_control_pata_ior; /* PATA_IOR pad ctrl reg */
705 u32 io_control_pata_iow; /* PATA_IOW pad ctrl reg */
706 u32 io_control_pata_iochrdy; /* PATA_IOCHRDY pad ctrl reg */
707 u32 io_control_pata_intrq; /* PATA_INTRQ pad ctrl reg */
708 u32 io_control_pata_drq; /* PATA_DRQ pad ctrl reg */
709 u32 io_control_pata_dack; /* PATA_DACK pad ctrl reg */
710 u32 io_control_nfc_wp; /* NFC_WP pad ctrl reg */
711 u32 io_control_nfc_rb; /* NFC_RB pad ctrl reg */
712 u32 io_control_nfc_ale; /* NFC_ALE pad ctrl reg */
713 u32 io_control_nfc_cle; /* NFC_CLE pad ctrl reg */
714 u32 io_control_nfc_we; /* NFC_WE pad ctrl reg */
715 u32 io_control_nfc_re; /* NFC_RE pad ctrl reg */
716 u32 io_control_pci_ad31; /* PCI_AD31 pad ctrl reg */
717 u32 io_control_pci_ad30; /* PCI_AD30 pad ctrl reg */
718 u32 io_control_pci_ad29; /* PCI_AD29 pad ctrl reg */
719 u32 io_control_pci_ad28; /* PCI_AD28 pad ctrl reg */
720 u32 io_control_pci_ad27; /* PCI_AD27 pad ctrl reg */
721 u32 io_control_pci_ad26; /* PCI_AD26 pad ctrl reg */
722 u32 io_control_pci_ad25; /* PCI_AD25 pad ctrl reg */
723 u32 io_control_pci_ad24; /* PCI_AD24 pad ctrl reg */
724 u32 io_control_pci_ad23; /* PCI_AD23 pad ctrl reg */
725 u32 io_control_pci_ad22; /* PCI_AD22 pad ctrl reg */
726 u32 io_control_pci_ad21; /* PCI_AD21 pad ctrl reg */
727 u32 io_control_pci_ad20; /* PCI_AD20 pad ctrl reg */
728 u32 io_control_pci_ad19; /* PCI_AD19 pad ctrl reg */
729 u32 io_control_pci_ad18; /* PCI_AD18 pad ctrl reg */
730 u32 io_control_pci_ad17; /* PCI_AD17 pad ctrl reg */
731 u32 io_control_pci_ad16; /* PCI_AD16 pad ctrl reg */
732 u32 io_control_pci_ad15; /* PCI_AD15 pad ctrl reg */
733 u32 io_control_pci_ad14; /* PCI_AD14 pad ctrl reg */
734 u32 io_control_pci_ad13; /* PCI_AD13 pad ctrl reg */
735 u32 io_control_pci_ad12; /* PCI_AD12 pad ctrl reg */
736 u32 io_control_pci_ad11; /* PCI_AD11 pad ctrl reg */
737 u32 io_control_pci_ad10; /* PCI_AD10 pad ctrl reg */
738 u32 io_control_pci_ad09; /* PCI_AD09 pad ctrl reg */
739 u32 io_control_pci_ad08; /* PCI_AD08 pad ctrl reg */
740 u32 io_control_pci_ad07; /* PCI_AD07 pad ctrl reg */
741 u32 io_control_pci_ad06; /* PCI_AD06 pad ctrl reg */
742 u32 io_control_pci_ad05; /* PCI_AD05 pad ctrl reg */
743 u32 io_control_pci_ad04; /* PCI_AD04 pad ctrl reg */
744 u32 io_control_pci_ad03; /* PCI_AD03 pad ctrl reg */
745 u32 io_control_pci_ad02; /* PCI_AD02 pad ctrl reg */
746 u32 io_control_pci_ad01; /* PCI_AD01 pad ctrl reg */
747 u32 io_control_pci_ad00; /* PCI_AD00 pad ctrl reg */
748 u32 io_control_pci_cbe0; /* PCI_CBE0 pad ctrl reg */
749 u32 io_control_pci_cbe1; /* PCI_CBE1 pad ctrl reg */
750 u32 io_control_pci_cbe2; /* PCI_CBE2 pad ctrl reg */
751 u32 io_control_pci_cbe3; /* PCI_CBE3 pad ctrl reg */
752 u32 io_control_pci_grant2; /* PCI_GRANT2 pad ctrl reg */
753 u32 io_control_pci_req2; /* PCI_REQ2 pad ctrl reg */
754 u32 io_control_pci_grant1; /* PCI_GRANT1 pad ctrl reg */
755 u32 io_control_pci_req1; /* PCI_REQ1 pad ctrl reg */
756 u32 io_control_pci_grant0; /* PCI_GRANT0 pad ctrl reg */
757 u32 io_control_pci_req0; /* PCI_REQ0 pad ctrl reg */
758 u32 io_control_pci_inta; /* PCI_INTA pad ctrl reg */
759 u32 io_control_pci_clk; /* PCI_CLK pad ctrl reg */
760 u32 io_control_pci_rst; /* PCI_RST- pad ctrl reg */
761 u32 io_control_pci_frame; /* PCI_FRAME pad ctrl reg */
762 u32 io_control_pci_idsel; /* PCI_IDSEL pad ctrl reg */
763 u32 io_control_pci_devsel; /* PCI_DEVSEL pad ctrl reg */
764 u32 io_control_pci_irdy; /* PCI_IRDY pad ctrl reg */
765 u32 io_control_pci_trdy; /* PCI_TRDY pad ctrl reg */
766 u32 io_control_pci_stop; /* PCI_STOP pad ctrl reg */
767 u32 io_control_pci_par; /* PCI_PAR pad ctrl reg */
768 u32 io_control_pci_perr; /* PCI_PERR pad ctrl reg */
769 u32 io_control_pci_serr; /* PCI_SERR pad ctrl reg */
770 u32 io_control_spdif_txclk; /* SPDIF_TXCLK pad ctrl reg */
771 u32 io_control_spdif_tx; /* SPDIF_TX pad ctrl reg */
772 u32 io_control_spdif_rx; /* SPDIF_RX pad ctrl reg */
773 u32 io_control_i2c0_scl; /* I2C0_SCL pad ctrl reg */
774 u32 io_control_i2c0_sda; /* I2C0_SDA pad ctrl reg */
775 u32 io_control_i2c1_scl; /* I2C1_SCL pad ctrl reg */
776 u32 io_control_i2c1_sda; /* I2C1_SDA pad ctrl reg */
777 u32 io_control_i2c2_scl; /* I2C2_SCL pad ctrl reg */
778 u32 io_control_i2c2_sda; /* I2C2_SDA pad ctrl reg */
779 u32 io_control_irq0; /* IRQ0 pad ctrl reg */
780 u32 io_control_irq1; /* IRQ1 pad ctrl reg */
781 u32 io_control_can1_tx; /* CAN1_TX pad ctrl reg */
782 u32 io_control_can2_tx; /* CAN2_TX pad ctrl reg */
783 u32 io_control_j1850_tx; /* J1850_TX pad ctrl reg */
784 u32 io_control_j1850_rx; /* J1850_RX pad ctrl reg */
785 u32 io_control_psc_mclk_in; /* PSC_MCLK_IN pad ctrl reg */
786 u32 io_control_psc0_0; /* PSC0_0 pad ctrl reg */
787 u32 io_control_psc0_1; /* PSC0_1 pad ctrl reg */
788 u32 io_control_psc0_2; /* PSC0_2 pad ctrl reg */
789 u32 io_control_psc0_3; /* PSC0_3 pad ctrl reg */
790 u32 io_control_psc0_4; /* PSC0_4 pad ctrl reg */
791 u32 io_control_psc1_0; /* PSC1_0 pad ctrl reg */
792 u32 io_control_psc1_1; /* PSC1_1 pad ctrl reg */
793 u32 io_control_psc1_2; /* PSC1_2 pad ctrl reg */
794 u32 io_control_psc1_3; /* PSC1_3 pad ctrl reg */
795 u32 io_control_psc1_4; /* PSC1_4 pad ctrl reg */
796 u32 io_control_psc2_0; /* PSC2_0 pad ctrl reg */
797 u32 io_control_psc2_1; /* PSC2_1 pad ctrl reg */
798 u32 io_control_psc2_2; /* PSC2_2 pad ctrl reg */
799 u32 io_control_psc2_3; /* PSC2_3 pad ctrl reg */
800 u32 io_control_psc2_4; /* PSC2_4 pad ctrl reg */
801 u32 io_control_psc3_0; /* PSC3_0 pad ctrl reg */
802 u32 io_control_psc3_1; /* PSC3_1 pad ctrl reg */
803 u32 io_control_psc3_2; /* PSC3_2 pad ctrl reg */
804 u32 io_control_psc3_3; /* PSC3_3 pad ctrl reg */
805 u32 io_control_psc3_4; /* PSC3_4 pad ctrl reg */
806 u32 io_control_psc4_0; /* PSC4_0 pad ctrl reg */
807 u32 io_control_psc4_1; /* PSC4_1 pad ctrl reg */
808 u32 io_control_psc4_2; /* PSC4_2 pad ctrl reg */
809 u32 io_control_psc4_3; /* PSC4_3 pad ctrl reg */
810 u32 io_control_psc4_4; /* PSC4_4 pad ctrl reg */
811 u32 io_control_psc5_0; /* PSC5_0 pad ctrl reg */
812 u32 io_control_psc5_1; /* PSC5_1 pad ctrl reg */
813 u32 io_control_psc5_2; /* PSC5_2 pad ctrl reg */
814 u32 io_control_psc5_3; /* PSC5_3 pad ctrl reg */
815 u32 io_control_psc5_4; /* PSC5_4 pad ctrl reg */
816 u32 io_control_psc6_0; /* PSC6_0 pad ctrl reg */
817 u32 io_control_psc6_1; /* PSC6_1 pad ctrl reg */
818 u32 io_control_psc6_2; /* PSC6_2 pad ctrl reg */
819 u32 io_control_psc6_3; /* PSC6_3 pad ctrl reg */
820 u32 io_control_psc6_4; /* PSC6_4 pad ctrl reg */
821 u32 io_control_psc7_0; /* PSC7_0 pad ctrl reg */
822 u32 io_control_psc7_1; /* PSC7_1 pad ctrl reg */
823 u32 io_control_psc7_2; /* PSC7_2 pad ctrl reg */
824 u32 io_control_psc7_3; /* PSC7_3 pad ctrl reg */
825 u32 io_control_psc7_4; /* PSC7_4 pad ctrl reg */
826 u32 io_control_psc8_0; /* PSC8_0 pad ctrl reg */
827 u32 io_control_psc8_1; /* PSC8_1 pad ctrl reg */
828 u32 io_control_psc8_2; /* PSC8_2 pad ctrl reg */
829 u32 io_control_psc8_3; /* PSC8_3 pad ctrl reg */
830 u32 io_control_psc8_4; /* PSC8_4 pad ctrl reg */
831 u32 io_control_psc9_0; /* PSC9_0 pad ctrl reg */
832 u32 io_control_psc9_1; /* PSC9_1 pad ctrl reg */
833 u32 io_control_psc9_2; /* PSC9_2 pad ctrl reg */
834 u32 io_control_psc9_3; /* PSC9_3 pad ctrl reg */
835 u32 io_control_psc9_4; /* PSC9_4 pad ctrl reg */
836 u32 io_control_psc10_0; /* PSC10_0 pad ctrl reg */
837 u32 io_control_psc10_1; /* PSC10_1 pad ctrl reg */
838 u32 io_control_psc10_2; /* PSC10_2 pad ctrl reg */
839 u32 io_control_psc10_3; /* PSC10_3 pad ctrl reg */
840 u32 io_control_psc10_4; /* PSC10_4 pad ctrl reg */
841 u32 io_control_psc11_0; /* PSC11_0 pad ctrl reg */
842 u32 io_control_psc11_1; /* PSC11_1 pad ctrl reg */
843 u32 io_control_psc11_2; /* PSC11_2 pad ctrl reg */
844 u32 io_control_psc11_3; /* PSC11_3 pad ctrl reg */
845 u32 io_control_psc11_4; /* PSC11_4 pad ctrl reg */
846 u32 io_control_ckstp_out; /* CKSTP_OUT pad ctrl reg */
847 u32 io_control_usb_phy_drvvbus; /* USB2_DRVVBUS pad ctrl reg */
848 u8 reserved[0x0cfc]; /* fill to 4096 bytes size */
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200849} ioctrl512x_t;
850
Wolfgang Denkf342f862009-05-16 10:47:45 +0200851/* IO pin fields */
852#define IO_PIN_FMUX(v) ((v) << 7) /* pin function */
853#define IO_PIN_HOLD(v) ((v) << 5) /* hold time, pci only */
854#define IO_PIN_PUD(v) ((v) << 4) /* if PUE, 0=pull-down, 1=pull-up */
855#define IO_PIN_PUE(v) ((v) << 3) /* pull up/down enable */
856#define IO_PIN_ST(v) ((v) << 2) /* schmitt trigger */
857#define IO_PIN_DS(v) ((v)) /* slew rate */
858
859typedef struct iopin_t {
860 int p_offset; /* offset from IOCTL_MEM_OFFSET */
861 int nr_pins; /* number of pins to set this way */
862 int bit_or; /* or in the value instead of overwrite */
863 u_long val; /* value to write or or */
864}iopin_t;
865
866void iopin_initialize(iopin_t *,int);
867
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200868/*
Anatolij Gustschind6398902013-02-08 00:03:48 +0000869 * support to adjust individual parts of the IO pin setup
870 */
871
872#define IO_PIN_OVER_EACH (1 << 0) /* for compatibility */
873#define IO_PIN_OVER_FMUX (1 << 1)
874#define IO_PIN_OVER_HOLD (1 << 2)
875#define IO_PIN_OVER_PULL (1 << 3)
876#define IO_PIN_OVER_STRIG (1 << 4)
877#define IO_PIN_OVER_DRVSTR (1 << 5)
878
879void iopin_initialize_bits(iopin_t *, int);
880
881/*
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200882 * IIM
883 */
884typedef struct iim512x {
Martha Marx5d3e23f2009-01-26 10:45:07 -0700885 u32 stat; /* IIM status register */
886 u32 statm; /* IIM status IRQ mask */
887 u32 err; /* IIM errors register */
888 u32 emask; /* IIM error IRQ mask */
889 u32 fctl; /* IIM fuse control register */
890 u32 ua; /* IIM upper address register */
891 u32 la; /* IIM lower address register */
892 u32 sdat; /* IIM explicit sense data */
893 u8 res0[0x08];
894 u32 prg_p; /* IIM program protection register */
895 u8 res1[0x10];
896 u32 divide; /* IIM divide factor register */
897 u8 res2[0x7c0];
898 u32 fbac0; /* IIM fuse bank 0 prot (for Freescale use) */
899 u32 fb0w0[0x1f]; /* IIM fuse bank 0 data (for Freescale use) */
900 u8 res3[0x380];
901 u32 fbac1; /* IIM fuse bank 1 protection */
902 u32 fb1w1[0x01f]; /* IIM fuse bank 1 data */
903 u8 res4[0x380];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200904} iim512x_t;
905
906/*
907 * LPC
908 */
909typedef struct lpc512x {
910 u32 cs_cfg[8]; /* Chip Select N Configuration Registers
911 No dedicated entry for CS Boot as == CS0 */
912 u32 cs_cr; /* Chip Select Control Register */
913 u32 cs_sr; /* Chip Select Status Register */
914 u32 cs_bcr; /* Chip Select Burst Control Register */
915 u32 cs_dccr; /* Chip Select Deadcycle Control Register */
916 u32 cs_hccr; /* Chip Select Holdcycle Control Register */
Wolfgang Denkfd3166d2009-05-16 10:47:42 +0200917 u32 altr; /* Address Latch Timing Register */
918 u8 res0[0xc8];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200919 u32 sclpc_psr; /* SCLPC Packet Size Register */
920 u32 sclpc_sar; /* SCLPC Start Address Register */
921 u32 sclpc_cr; /* SCLPC Control Register */
922 u32 sclpc_er; /* SCLPC Enable Register */
923 u32 sclpc_nar; /* SCLPC NextAddress Register */
924 u32 sclpc_sr; /* SCLPC Status Register */
925 u32 sclpc_bdr; /* SCLPC Bytes Done Register */
926 u32 emb_scr; /* EMB Share Counter Register */
927 u32 emb_pcr; /* EMB Pause Control Register */
928 u8 res1[0x1c];
929 u32 lpc_fdwr; /* LPC RX/TX FIFO Data Word Register */
930 u32 lpc_fsr; /* LPC RX/TX FIFO Status Register */
931 u32 lpc_cr; /* LPC RX/TX FIFO Control Register */
932 u32 lpc_ar; /* LPC RX/TX FIFO Alarm Register */
933 u8 res2[0xb0];
934} lpc512x_t;
935
936/*
937 * PATA
938 */
939typedef struct pata512x {
Ralph Kondziellad074bfe2009-01-26 12:34:36 -0700940 /* LOCAL Registers */
941 u32 pata_time1; /* Time register 1: PIO and tx timing parameter */
942 u32 pata_time2; /* Time register 2: PIO timing parameter */
943 u32 pata_time3; /* Time register 3: PIO and MDMA timing parameter */
944 u32 pata_time4; /* Time register 4: MDMA and UDMA timing parameter */
945 u32 pata_time5; /* Time register 5: UDMA timing parameter */
946 u32 pata_time6; /* Time register 6: UDMA timing parameter */
947 u32 pata_fifo_data32; /* 32bit wide dataport to/from FIFO */
948 u32 pata_fifo_data16; /* 16bit wide dataport to/from FIFO */
949 u32 pata_fifo_fill; /* FIFO filling in halfwords (READONLY)*/
950 u32 pata_ata_control; /* ATA Interface control register */
951 u32 pata_irq_pending; /* Interrupt pending register (READONLY) */
952 u32 pata_irq_enable; /* Interrupt enable register */
953 u32 pata_irq_clear; /* Interrupt clear register (WRITEONLY)*/
954 u32 pata_fifo_alarm; /* fifo alarm threshold */
955 u32 res1[0x1A];
956 /* DRIVE Registers */
957 u32 pata_drive_data; /* drive data register*/
958 u32 pata_drive_features;/* drive features register */
959 u32 pata_drive_sectcnt; /* drive sector count register */
960 u32 pata_drive_sectnum; /* drive sector number register */
961 u32 pata_drive_cyllow; /* drive cylinder low register */
962 u32 pata_drive_cylhigh; /* drive cylinder high register */
963 u32 pata_drive_dev_head;/* drive device head register */
964 u32 pata_drive_command; /* write = drive command, read = drive status reg */
965 u32 res2[0x06];
966 u32 pata_drive_alt_stat;/* write = drive control, read = drive alt status reg */
967 u32 res3[0x09];
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +0200968} pata512x_t;
969
970/*
971 * PSC
972 */
973typedef struct psc512x {
974 volatile u8 mode; /* PSC + 0x00 */
975 volatile u8 res0[3];
976 union { /* PSC + 0x04 */
977 volatile u16 status;
978 volatile u16 clock_select;
979 } sr_csr;
980#define psc_status sr_csr.status
981#define psc_clock_select sr_csr.clock_select
982 volatile u16 res1;
983 volatile u8 command; /* PSC + 0x08 */
984 volatile u8 res2[3];
985 union { /* PSC + 0x0c */
986 volatile u8 buffer_8;
987 volatile u16 buffer_16;
988 volatile u32 buffer_32;
989 } buffer;
990#define psc_buffer_8 buffer.buffer_8
991#define psc_buffer_16 buffer.buffer_16
992#define psc_buffer_32 buffer.buffer_32
993 union { /* PSC + 0x10 */
994 volatile u8 ipcr;
995 volatile u8 acr;
996 } ipcr_acr;
997#define psc_ipcr ipcr_acr.ipcr
998#define psc_acr ipcr_acr.acr
999 volatile u8 res3[3];
1000 union { /* PSC + 0x14 */
1001 volatile u16 isr;
1002 volatile u16 imr;
1003 } isr_imr;
1004#define psc_isr isr_imr.isr
1005#define psc_imr isr_imr.imr
1006 volatile u16 res4;
1007 volatile u8 ctur; /* PSC + 0x18 */
1008 volatile u8 res5[3];
1009 volatile u8 ctlr; /* PSC + 0x1c */
1010 volatile u8 res6[3];
1011 volatile u32 ccr; /* PSC + 0x20 */
1012 volatile u8 res7[12];
1013 volatile u8 ivr; /* PSC + 0x30 */
1014 volatile u8 res8[3];
1015 volatile u8 ip; /* PSC + 0x34 */
1016 volatile u8 res9[3];
1017 volatile u8 op1; /* PSC + 0x38 */
1018 volatile u8 res10[3];
1019 volatile u8 op0; /* PSC + 0x3c */
1020 volatile u8 res11[3];
1021 volatile u32 sicr; /* PSC + 0x40 */
1022 volatile u8 res12[60];
1023 volatile u32 tfcmd; /* PSC + 0x80 */
1024 volatile u32 tfalarm; /* PSC + 0x84 */
1025 volatile u32 tfstat; /* PSC + 0x88 */
1026 volatile u32 tfintstat; /* PSC + 0x8C */
1027 volatile u32 tfintmask; /* PSC + 0x90 */
1028 volatile u32 tfcount; /* PSC + 0x94 */
1029 volatile u16 tfwptr; /* PSC + 0x98 */
1030 volatile u16 tfrptr; /* PSC + 0x9A */
1031 volatile u32 tfsize; /* PSC + 0x9C */
1032 volatile u8 res13[28];
1033 union { /* PSC + 0xBC */
1034 volatile u8 buffer_8;
1035 volatile u16 buffer_16;
1036 volatile u32 buffer_32;
1037 } tfdata_buffer;
1038#define tfdata_8 tfdata_buffer.buffer_8
1039#define tfdata_16 tfdata_buffer.buffer_16
1040#define tfdata_32 tfdata_buffer.buffer_32
1041
1042 volatile u32 rfcmd; /* PSC + 0xC0 */
1043 volatile u32 rfalarm; /* PSC + 0xC4 */
1044 volatile u32 rfstat; /* PSC + 0xC8 */
1045 volatile u32 rfintstat; /* PSC + 0xCC */
1046 volatile u32 rfintmask; /* PSC + 0xD0 */
1047 volatile u32 rfcount; /* PSC + 0xD4 */
1048 volatile u16 rfwptr; /* PSC + 0xD8 */
1049 volatile u16 rfrptr; /* PSC + 0xDA */
1050 volatile u32 rfsize; /* PSC + 0xDC */
1051 volatile u8 res18[28];
1052 union { /* PSC + 0xFC */
1053 volatile u8 buffer_8;
1054 volatile u16 buffer_16;
1055 volatile u32 buffer_32;
1056 } rfdata_buffer;
1057#define rfdata_8 rfdata_buffer.buffer_8
1058#define rfdata_16 rfdata_buffer.buffer_16
1059#define rfdata_32 rfdata_buffer.buffer_32
1060} psc512x_t;
1061
Wolfgang Denkf342f862009-05-16 10:47:45 +02001062/* PSC FIFO Command values */
1063#define PSC_FIFO_RESET_SLICE 0x80
1064#define PSC_FIFO_ENABLE_SLICE 0x01
1065
1066/* PSC FIFO Controller Command values */
1067#define FIFOC_ENABLE_CLOCK_GATE 0x01
1068#define FIFOC_DISABLE_CLOCK_GATE 0x00
1069
1070/* PSC FIFO status */
1071#define PSC_FIFO_EMPTY 0x01
1072
1073/* PSC Command values */
1074#define PSC_RX_ENABLE 0x01
1075#define PSC_RX_DISABLE 0x02
1076#define PSC_TX_ENABLE 0x04
1077#define PSC_TX_DISABLE 0x08
1078#define PSC_SEL_MODE_REG_1 0x10
1079#define PSC_RST_RX 0x20
1080#define PSC_RST_TX 0x30
1081#define PSC_RST_ERR_STAT 0x40
1082#define PSC_RST_BRK_CHG_INT 0x50
1083#define PSC_START_BRK 0x60
1084#define PSC_STOP_BRK 0x70
1085
1086/* PSC status register bits */
1087#define PSC_SR_CDE 0x0080
1088#define PSC_SR_TXEMP 0x0800
1089#define PSC_SR_OE 0x1000
1090#define PSC_SR_PE 0x2000
1091#define PSC_SR_FE 0x4000
1092#define PSC_SR_RB 0x8000
1093
1094/* PSC mode fields */
1095#define PSC_MODE_5_BITS 0x00
1096#define PSC_MODE_6_BITS 0x01
1097#define PSC_MODE_7_BITS 0x02
1098#define PSC_MODE_8_BITS 0x03
1099#define PSC_MODE_PAREVEN 0x00
1100#define PSC_MODE_PARODD 0x04
1101#define PSC_MODE_PARFORCE 0x08
1102#define PSC_MODE_PARNONE 0x10
1103#define PSC_MODE_ENTIMEOUT 0x20
1104#define PSC_MODE_RXRTS 0x80
1105#define PSC_MODE_1_STOPBIT 0x07
1106
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02001107/*
1108 * FIFOC
1109 */
1110typedef struct fifoc512x {
1111 u32 fifoc_cmd;
1112 u32 fifoc_int;
1113 u32 fifoc_dma;
1114 u32 fifoc_axe;
1115 u32 fifoc_debug;
1116 u8 fixme[0xEC];
1117} fifoc512x_t;
1118
1119/*
Wolfgang Denkf342f862009-05-16 10:47:45 +02001120 * Centralized FIFO Controller has internal memory for all 12 PSCs FIFOs
1121 *
1122 * NOTE: individual PSC units are free to use whatever area (and size) of the
1123 * FIFOC internal memory, so make sure memory areas for FIFO slices used by
1124 * different PSCs do not overlap!
1125 *
1126 * Overall size of FIFOC memory is not documented in the MPC5121e RM, but
1127 * tests indicate that it is 1024 words total.
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001128 *
1129 * *_TX_SIZE and *_RX_SIZE is the number of 4-byte words for FIFO slice.
Wolfgang Denkf342f862009-05-16 10:47:45 +02001130 */
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001131#define FIFOC_PSC0_TX_SIZE 0x04
Wolfgang Denkf342f862009-05-16 10:47:45 +02001132#define FIFOC_PSC0_TX_ADDR 0x0
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001133#define FIFOC_PSC0_RX_SIZE 0x04
1134#define FIFOC_PSC0_RX_ADDR 0x10
Wolfgang Denkf342f862009-05-16 10:47:45 +02001135
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001136#define FIFOC_PSC1_TX_SIZE 0x04
1137#define FIFOC_PSC1_TX_ADDR 0x20
1138#define FIFOC_PSC1_RX_SIZE 0x04
1139#define FIFOC_PSC1_RX_ADDR 0x30
Wolfgang Denkf342f862009-05-16 10:47:45 +02001140
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001141#define FIFOC_PSC2_TX_SIZE 0x04
1142#define FIFOC_PSC2_TX_ADDR 0x40
1143#define FIFOC_PSC2_RX_SIZE 0x04
1144#define FIFOC_PSC2_RX_ADDR 0x50
Wolfgang Denkf342f862009-05-16 10:47:45 +02001145
1146#define FIFOC_PSC3_TX_SIZE 0x04
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001147#define FIFOC_PSC3_TX_ADDR 0x60
Wolfgang Denkf342f862009-05-16 10:47:45 +02001148#define FIFOC_PSC3_RX_SIZE 0x04
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001149#define FIFOC_PSC3_RX_ADDR 0x70
Wolfgang Denkf342f862009-05-16 10:47:45 +02001150
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001151#define FIFOC_PSC4_TX_SIZE 0x04
1152#define FIFOC_PSC4_TX_ADDR 0x80
1153#define FIFOC_PSC4_RX_SIZE 0x04
1154#define FIFOC_PSC4_RX_ADDR 0x90
Wolfgang Denkf342f862009-05-16 10:47:45 +02001155
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001156#define FIFOC_PSC5_TX_SIZE 0x04
1157#define FIFOC_PSC5_TX_ADDR 0xa0
1158#define FIFOC_PSC5_RX_SIZE 0x04
1159#define FIFOC_PSC5_RX_ADDR 0xb0
Wolfgang Denkf342f862009-05-16 10:47:45 +02001160
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001161#define FIFOC_PSC6_TX_SIZE 0x04
1162#define FIFOC_PSC6_TX_ADDR 0xc0
1163#define FIFOC_PSC6_RX_SIZE 0x04
1164#define FIFOC_PSC6_RX_ADDR 0xd0
Wolfgang Denkf342f862009-05-16 10:47:45 +02001165
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001166#define FIFOC_PSC7_TX_SIZE 0x04
1167#define FIFOC_PSC7_TX_ADDR 0xe0
1168#define FIFOC_PSC7_RX_SIZE 0x04
1169#define FIFOC_PSC7_RX_ADDR 0xf0
Wolfgang Denkf342f862009-05-16 10:47:45 +02001170
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001171#define FIFOC_PSC8_TX_SIZE 0x04
1172#define FIFOC_PSC8_TX_ADDR 0x100
1173#define FIFOC_PSC8_RX_SIZE 0x04
1174#define FIFOC_PSC8_RX_ADDR 0x110
Wolfgang Denkf342f862009-05-16 10:47:45 +02001175
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001176#define FIFOC_PSC9_TX_SIZE 0x04
1177#define FIFOC_PSC9_TX_ADDR 0x120
1178#define FIFOC_PSC9_RX_SIZE 0x04
1179#define FIFOC_PSC9_RX_ADDR 0x130
Wolfgang Denkf342f862009-05-16 10:47:45 +02001180
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001181#define FIFOC_PSC10_TX_SIZE 0x04
1182#define FIFOC_PSC10_TX_ADDR 0x140
1183#define FIFOC_PSC10_RX_SIZE 0x04
1184#define FIFOC_PSC10_RX_ADDR 0x150
Wolfgang Denkf342f862009-05-16 10:47:45 +02001185
Anatolij Gustschinee4aac82010-04-24 19:27:05 +02001186#define FIFOC_PSC11_TX_SIZE 0x04
1187#define FIFOC_PSC11_TX_ADDR 0x160
1188#define FIFOC_PSC11_RX_SIZE 0x04
1189#define FIFOC_PSC11_RX_ADDR 0x170
Wolfgang Denkf342f862009-05-16 10:47:45 +02001190
1191/*
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02001192 * SATA
1193 */
1194typedef struct sata512x {
1195 u8 fixme[0x2000];
1196} sata512x_t;
1197
1198typedef struct immap {
1199 sysconf512x_t sysconf; /* System configuration */
1200 u8 res0[0x700];
1201 wdt512x_t wdt; /* Watch Dog Timer (WDT) */
1202 rtclk512x_t rtc; /* Real Time Clock Module */
1203 gpt512x_t gpt; /* General Purpose Timer */
1204 ipic512x_t ipic; /* Integrated Programmable Interrupt Controller */
1205 arbiter512x_t arbiter; /* CSB Arbiter */
1206 reset512x_t reset; /* Reset Module */
1207 clk512x_t clk; /* Clock Module */
1208 pmc512x_t pmc; /* Power Management Control Module */
1209 gpio512x_t gpio; /* General purpose I/O module */
1210 u8 res1[0x100];
1211 mscan512x_t mscan; /* MSCAN */
1212 bdlc512x_t bdlc; /* BDLC */
1213 sdhc512x_t sdhc; /* SDHC */
1214 spdif512x_t spdif; /* SPDIF */
1215 i2c512x_t i2c; /* I2C Controllers */
1216 u8 res2[0x800];
1217 axe512x_t axe; /* AXE */
1218 diu512x_t diu; /* Display Interface Unit */
1219 cfm512x_t cfm; /* Clock Frequency Measurement */
1220 u8 res3[0x500];
1221 fec512x_t fec; /* Fast Ethernet Controller */
1222 ulpi512x_t ulpi; /* USB ULPI */
1223 u8 res4[0xa00];
1224 utmi512x_t utmi; /* USB UTMI */
1225 u8 res5[0x1000];
1226 pcidma512x_t pci_dma; /* PCI DMA */
1227 pciconf512x_t pci_conf; /* PCI Configuration */
1228 u8 res6[0x80];
1229 ios512x_t ios; /* PCI Sequencer */
1230 pcictrl512x_t pci_ctrl; /* PCI Controller Control and Status */
1231 u8 res7[0xa00];
1232 ddr512x_t mddrc; /* Multi-port DDR Memory Controller */
1233 ioctrl512x_t io_ctrl; /* IO Control */
1234 iim512x_t iim; /* IC Identification module */
1235 u8 res8[0x4000];
1236 lpc512x_t lpc; /* LocalPlus Controller */
1237 pata512x_t pata; /* Parallel ATA */
1238 u8 res9[0xd00];
1239 psc512x_t psc[12]; /* PSCs */
1240 u8 res10[0x300];
1241 fifoc512x_t fifoc; /* FIFO Controller */
1242 u8 res11[0x2000];
1243 dma512x_t dma; /* DMA */
1244 u8 res12[0xa800];
1245 sata512x_t sata; /* Serial ATA */
1246 u8 res13[0xde000];
1247} immap_t;
Wolfgang Denkf342f862009-05-16 10:47:45 +02001248
1249/* provide interface to get PATA base address */
1250static inline u32 get_pata_base (void)
1251{
1252 volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
1253 return (u32)(&im->pata);
1254}
1255#endif /* __ASSEMBLY__ */
1256
ramneek mehresh16b08062013-09-12 16:35:49 +05301257#define CONFIG_SYS_MPC512x_USB1_OFFSET 0x4000
1258#define CONFIG_SYS_MPC512x_USB1_ADDR \
1259 (CONFIG_SYS_IMMR + CONFIG_SYS_MPC512x_USB1_OFFSET)
Damien Dusha7c3be662010-10-14 15:27:06 +02001260
Benoît Thébaudeau7ee151d2013-04-23 10:17:41 +00001261#define IIM_BASE_ADDR (CONFIG_SYS_IMMR + offsetof(immap_t, iim))
1262
Rafal Jaworowskid3a02c32007-07-27 14:43:59 +02001263#endif /* __IMMAP_512x__ */