2 * include/asm-ppc/platforms/ibm405lp.h 405LP-specific definitions
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Copyright (C) 2002, International Business Machines Corporation
19 * All Rights Reserved.
22 * IBM Research, Austin Center for Low-Power Computing
29 #ifndef __ASM_IBM405LP_H__
30 #define __ASM_IBM405LP_H__
32 #include <linux/config.h>
33 #include <asm/ibm4xx.h>
35 /* See beech.c for a concise diagram of the Beech physical memory map. */
37 #define PPC4xx_ONB_IO_PADDR ((uint)0xef600000)
38 #define PPC4xx_ONB_IO_VADDR PPC4xx_ONB_IO_PADDR
39 #define PPC4xx_ONB_IO_SIZE ((uint)4*1024)
41 /* Machine-specific register naming for the 4xx processors is a mess. It seems
42 that everyone had a different idea on how to prefix/abbreviate/configure the
43 DCR numbers and MMIO addresses. I'm no different! For the 405LP we have
44 defined all of the DCRs and MMIO address consistently with their names as
45 documented in the official IBM hardware manual for the processor.
47 DCRs are all given a DCRN_ prefix, which seems to be the most
48 common consistent naming scheme in old code (although the official IBM DCR
49 names are so unique that there's really little need for the DCRN_).
51 At the end of the DCR defines several synonyms are defined for backwards
52 compatibility, but all new code specific to the 405LP uses the consistent
55 Version 07/24/02 1.1 - Armin
56 added default pm define
59 /*****************************************************************************
60 * Directly accessed DCRs
61 *****************************************************************************/
63 /* DCRs used for Indirect Access */
65 #define DCRN_SDRAM0_CFGADDR 0x010 /* Memory Ctlr. DCR Address Register */
66 #define DCRN_SDRAM0_CFGDATA 0x011 /* Memory Ctlr. DCR Data Register */
67 #define DCRN_EBC0_CFGADDR 0x012 /* Peripheral Ctlr. DCR Address Register */
68 #define DCRN_EBC0_CFGDATA 0x013 /* Peripheral Ctlr. DCR Data Register */
69 #define DCRN_SLA0_CFGADDR 0x0e0 /* Speech Label Accel. DCR Address Reg. */
70 #define DCRN_SLA0_CFGDATA 0x0e1 /* Speech Label Accel. DCR Data Reg. */
71 #define DCRN_LCD0_CFGADDR 0x3c8 /* LCD Ctlr. DCR Address Reg. */
72 #define DCRN_LCD0_CFGDATA 0x3c9 /* LCD Ctlr. DCR Data Reg. */
76 #define DCRN_PLB0_BESR 0x084 /* PLB Bus Error Status Register */
77 #define DCRN_PLB0_BEAR 0x086 /* PLB Bus Error Address Register */
78 #define DCRN_PLB0_ACR 0x087 /* PLB Arbiter Control Register */
79 #define DCRN_POB0_BESR0 0x0a0 /* PLB to OPB Bus Error Status Register 0 */
80 #define DCRN_POB0_BEAR 0x0a2 /* PLB to OPB Bus Error Address Register */
81 #define DCRN_POB0_BESR1 0x0a4 /* PLB to OPB Bus Error Status Register 1 */
83 /* Clocking and Chip Control */
85 #define DCRN_CPC0_PLLMR 0x0b0 /* PLL Mode Register */
86 #define DCRN_CPC0_CGCR0 0x0b1 /* Clock Generation Control Register 0 */
87 #define DCRN_CPC0_CGCR1 0x0b2 /* Clock Generation Control Register 1 */
88 #define DCRN_CPC0_CR0 0x0b5 /* Chip Control Register 0 */
89 #define DCRN_CHCR0 DCRN_CPC0_CR0
90 #define DCRN_CPC0_CR1 0x0b4 /* Chip Control Register 1 */
91 #define DCRN_CPC0_PLBAPR 0x0b6 /* PLB Arbiter Priority Register */
92 #define DCRN_CPC0_JTAGID 0x0b7 /* JTAG ID Register */
94 /* Clock and Power Management */
96 #define DCRN_CPMSR_BASE 0x0b8 /* CPM Status Register */
97 #define DCRN_CPMFR_BASE 0x0ba /* CPM Force Register */
99 /* Universal Interrupt Controller */
101 #define DCRN_UIC0_SR 0x0c0 /* UIC Status Register */
102 #define DCRN_UIC0_ER 0x0c2 /* UIC Enable Register */
103 #define DCRN_UIC0_CR 0x0c3 /* UIC Critical Register */
104 #define DCRN_UIC0_PR 0x0c4 /* UIC Polarity Register */
105 #define DCRN_UIC0_TR 0x0c5 /* UIC Triggering Register */
106 #define DCRN_UIC0_MSR 0x0c6 /* UIC Masked Status Register */
107 #define DCRN_UIC0_VR 0x0c7 /* UIC Vector Register */
108 #define DCRN_UIC0_VCR 0x0c8 /* UIC Vector Configuration Register */
110 /* Real-time Clock */
112 #define DCRN_RTC0_SEC 0x140 /* RTC Seconds Register */
113 #define DCRN_RTC0_SECAL 0x141 /* RTC Seconds Alarm Register */
114 #define DCRN_RTC0_MIN 0x142 /* RTC Minutes Register */
115 #define DCRN_RTC0_MINAL 0x143 /* RTC Minutes Alarm Register */
116 #define DCRN_RTC0_HR 0x144 /* RTC Hours Register */
117 #define DCRN_RTC0_HRAL 0x145 /* RTC Hours Alarm Register */
118 #define DCRN_RTC0_DOW 0x146 /* RTC Day of Week Register */
119 #define DCRN_RTC0_DOM 0x147 /* RTC Date of Month Register */
120 #define DCRN_RTC0_MONTH 0x148 /* RTC Month Register */
121 #define DCRN_RTC0_YEAR 0x149 /* RTC Year Register */
122 #define DCRN_RTC0_CR0 0x14a /* RTC "A" Register */
123 #define DCRN_RTC0_CR1 0x14b /* RTC "B" Register */
124 #define DCRN_RTC0_CR2 0x14c /* RTC "C" Register */
125 #define DCRN_RTC0_CR3 0x14d /* RTC "D" Register */
126 #define DCRN_RTC0_CEN 0x14e /* RTC Century Register */
127 #define DCRN_RTC0_WRAP 0x150 /* RTC Wrapper */
129 /* Advanced Power Management Controller */
131 #define DCRN_APM0_ISR 0x160 /* APM Interrupt Status Register */
132 #define DCRN_APM0_IER 0x162 /* APM Interrupt Enable Register */
133 #define DCRN_APM0_IPR 0x163 /* APM Interrupt Polarity Register */
134 #define DCRN_APM0_ITR 0x164 /* APM Interrupt Trigger Register */
135 #define DCRN_APM0_CFG 0x165 /* APM Configuration Register */
136 #define DCRN_APM0_SR 0x166 /* APM Status Register */
137 #define DCRN_APM0_ID 0x167 /* APM Revision ID Register */
139 /* Triple DES Controller */
141 #define DCRN_TDES0_ADDR 0x180 /* TDES OPB Slave Base Address */
142 #define DCRN_TDES0_CFG 0x181 /* TDES OPB Slave Configuration */
143 #define DCRN_TDES0_STAT 0x182 /* TDES Status */
144 #define DCRN_TDES0_ID 0x183 /* TDES Core ID */
148 #define DCRN_LCD0_CFG 0x3c0 /* LCD Configuration Register */
149 #define DCRN_LCD0_ICR 0x3c1 /* LCD Interrupt Control Register */
150 #define DCRN_LCD0_ISR 0x3c2 /* LCD Interrupt Status Register */
151 #define DCRN_LCD0_IMR 0x3c3 /* LCD Interrupt Mask Register */
153 /*****************************************************************************
154 * Indirectly accessed DCRs. Note that unlike direct-access DCRs whose numbers
155 * must be hard-coded into the instruction, indirect-access DCR numbers can be
157 *****************************************************************************/
159 /* Offsets for SDRAM Controler Registers */
161 #define DCRN_SDRAM0_BESR0 0x00 /* Bus Error Syndrome Register 0 */
162 #define DCRN_SDRAM0_BESR1 0x08 /* Bus Error Syndrome Register 1 */
163 #define DCRN_SDRAM0_BEAR 0x10 /* Bus Error Address Register */
164 #define DCRN_SDRAM0_CFG 0x20 /* Memory Controller Options 1 */
165 #define DCRN_SDRAM0_STATUS 0x24 /* SDRAM controller status */
166 #define DCRN_SDRAM0_RTR 0x30 /* Refresh Timer Register */
167 #define DCRN_SDRAM0_PMIT 0x34 /* Power Management Idle Timer */
168 #define DCRN_SDRAM0_B0CR 0x40 /* Memory Bank 0 Configuration */
169 #define DCRN_SDRAM0_B1CR 0x44 /* Memory Bank 1 Configuration */
170 #define DCRN_SDRAM0_B2CR 0x48 /* Memory Bank 2 Configuration */
171 #define DCRN_SDRAM0_B3CR 0x4c /* Memory Bank 3 Configuration */
172 #define DCRN_SDRAM0_TR 0x80 /* Sdram Timing Register 1 */
173 #define DCRN_SDRAM0_ECCCFG 0x94 /* ECC Configuration */
174 #define DCRN_SDRAM0_ECCESR 0x98 /* ECC Error Status Register */
176 #define SDRAM0_BANKS 4
177 #define DCRN_SDRAM0_BnCR(bank) (0x40 + (4 * (bank)))
179 /* Offsets for External Bus Controller Registers */
181 #define DCRN_EBC0_B0CR 0x00 /* Peripheral Bank 0 Configuration Register */
182 #define DCRN_EBC0_B1CR 0x01 /* Peripheral Bank 1 Configuration Register */
183 #define DCRN_EBC0_B2CR 0x02 /* Peripheral Bank 2 Configuration Register */
184 #define DCRN_EBC0_B3CR 0x03 /* Peripheral Bank 3 Configuration Register */
185 #define DCRN_EBC0_B4CR 0x04 /* Peripheral Bank 4 Configuration Register */
186 #define DCRN_EBC0_B5CR 0x05 /* Peripheral Bank 5 Configuration Register */
187 #define DCRN_EBC0_B6CR 0x06 /* Peripheral Bank 6 Configuration Register */
188 #define DCRN_EBC0_B7CR 0x07 /* Peripheral Bank 7 Configuration Register */
189 #define DCRN_EBC0_B0AP 0x10 /* Peripheral Bank 0 Access Parameters */
190 #define DCRN_EBC0_B1AP 0x11 /* Peripheral Bank 1 Access Parameters */
191 #define DCRN_EBC0_B2AP 0x12 /* Peripheral Bank 2 Access Parameters */
192 #define DCRN_EBC0_B3AP 0x13 /* Peripheral Bank 3 Access Parameters */
193 #define DCRN_EBC0_B4AP 0x14 /* Peripheral Bank 4 Access Parameters */
194 #define DCRN_EBC0_B5AP 0x15 /* Peripheral Bank 5 Access Parameters */
195 #define DCRN_EBC0_B6AP 0x16 /* Peripheral Bank 6 Access Parameters */
196 #define DCRN_EBC0_B7AP 0x17 /* Peripheral Bank 7 Access Parameters */
197 #define DCRN_EBC0_BEAR 0x20 /* Periperal Bus Error Address Register */
198 #define DCRN_EBC0_BESR0 0x21 /* Peripheral Bus Error Status Register 0 */
199 #define DCRN_EBC0_BESR1 0x22 /* Peripheral Bus Error Status Register 0 */
200 #define DCRN_EBC0_CFG 0x23 /* External Peripheral Control Register */
203 #define DCRN_EBC0_BnCR(bank) (bank)
204 #define DCRN_EBC0_BnAP(bank) (0x10 + (bank))
206 #define EBC_CFG_RTC 0x38000000
207 #define EBC_CFG_RTC_16 0x00000000
208 #define EBC_CFG_RTC_32 0x08000000
209 #define EBC_CFG_RTC_64 0x10000000
210 #define EBC_CFG_RTC_128 0x18000000
211 #define EBC_CFG_RTC_256 0x20000000
212 #define EBC_CFG_RTC_512 0x28000000
213 #define EBC_CFG_RTC_1024 0x30000000
214 #define EBC_CFG_RTC_2048 0x38000000
216 /* Offsets for LCD Controller DCRs */
218 #define DCRN_LCD0_DER 0x80010000 /* Display Enable Regsiter */
219 #define DCRN_LCD0_DCFG 0x80010010 /* Display Configuration Register */
220 #define DCRN_LCD0_DSR 0x80010040 /* Display Status Register */
221 #define DCRN_LCD0_FRDR 0x80010080 /* Dither and Frame Rate Modulation Reg. */
222 #define DCRN_LCD0_SDR 0x800100c0 /* Signal Delay Register */
223 #define DCRN_LCD0_ADSR 0x80010100 /* Active Display Size Register */
224 #define DCRN_LCD0_TDSR 0x80010104 /* Total Display Size Register */
225 #define DCRN_LCD0_FPLCR 0x80010140 /* FPLINE Control Register */
226 #define DCRN_LCD0_FPLOR 0x80010144 /* FPLINE Offset Register */
227 #define DCRN_LCD0_FPFCR 0x80010148 /* FPFRAME Control Register */
228 #define DCRN_LCD0_FPFOR 0x8001014c /* FPFRAME Control Register */
229 #define DCRN_LCD0_FPSCR 0x80010150 /* FPSHIFT Control Register */
230 #define DCRN_LCD0_FPDRR 0x80010158 /* FPDRDY Control Register */
231 #define DCRN_LCD0_FPDCR 0x80010160 /* FPDATA Control Register */
232 #define DCRN_LCD0_PFBFR 0x80010800 /* Pixel and Frame Buffer Format Reg. */
233 #define DCRN_LCD0_PFR 0x80011000 /* Pixel Format Register */
234 #define DCRN_LCD0_FBBAR 0x80011008 /* Frame Buffer Base Address Register */
235 #define DCRN_LCD0_STRIDE 0x8001100c /* Stride Register */
236 #define DCRN_LCD0_PAR 0x80011800 /* Palette Access Registers Base */
237 #define DCRN_LCD0_CER 0x80012000 /* Cursor Enable Register */
238 #define DCRN_LCD0_CBAR 0x80012008 /* Cursor Base Address Register */
239 #define DCRN_LCD0_CLR 0x8001200c /* Cursor Location Register */
240 #define DCRN_LCD0_CC0R 0x80012010 /* Cursor Color 0 */
241 #define DCRN_LCD0_CC1R 0x80012014 /* Cursor Color 1 */
243 #define LCD0_PAR_REGS 256
244 #define DCRN_LCD0_PARn(n) (DCRN_LCD0_PAR + (4 * (n)))
246 /* Offsets for Decompression Controller DCRs */
248 #define DCRN_DCP0_ITOR0 0x00 /* Index Table Origin Register 0 */
249 #define DCRN_DCP0_ITOR1 0x01 /* Index Table Origin Register 1 */
250 #define DCRN_DCP0_ITOR2 0x02 /* Index Table Origin Register 2 */
251 #define DCRN_DCP0_ITOR3 0x03 /* Index Table Origin Register 3 */
252 #define DCRN_DCP0_ADDR0 0x04 /* Address Decode Definition Register 0 */
253 #define DCRN_DCP0_ADDR1 0x05 /* Address Decode Definition Register 1 */
254 #define DCRN_DCP0_CFG 0x40 /* Decompression Controller Cfg. Register */
255 #define DCRN_DCP0_ID 0x41 /* Decompression Controller ID Register */
256 #define DCRN_DCP0_VER 0x42 /* Decompression Controller Version Register */
257 #define DCRN_DCP0_PLBBEAR 0x50 /* Bus Error Address Register (PLB) */
258 #define DCRN_DCP0_MEMBEAR 0x51 /* Bus Error Address Register (EBC/SDRAM) */
259 #define DCRN_DCP0_ESR 0x52 /* Bus Error Status Register 0 (Masters 0-3) */
261 #define DCRN_DCP0_RAMn(n) (0x400 + (n)) /* Decompression Decode Table Entries
262 0x400-0x5FF Low 16-bit decode table
263 0x600-0x7FF High 16-bit decode table
266 /* Offsets for Speech Label Accelerator DCRs */
268 #define DCRN_SLA0_CR 0x00 /* SLA Control Register */
269 #define DCRN_SLA0_SR 0x01 /* SLA Status Register */
270 #define DCRN_SLA0_BESR 0x02 /* SLA Bus Error Status Register */
271 #define DCRN_SLA0_BEAR 0x03 /* SLA Bus Error Address Register */
272 #define DCRN_SLA0_UADDR 0x04 /* SLA PLB Upper Address Register */
273 #define DCRN_SLA0_GMBA 0x05 /* SLA General Indirect Memory Base Address */
274 #define DCRN_SLA0_GMLL 0x06 /* SLA General Indirect Memory Link List */
275 #define DCRN_SLA0_AMBA 0x07 /* SLA Atom Memory Base Address Register */
276 #define DCRN_SLA0_ACBA 0x08 /* SLA Accumulator Base Address Register */
277 #define DCRN_SLA0_DIBA 0x09 /* SLA Done Indication Base Address Register */
278 #define DCRN_SLA0_GPOFF 0x0A /* SLA General Indirect Pass Offset Register */
279 #define DCRN_SLA0_SLPMD 0x0B /* SLA Sleep Mode Control Register */
280 #define DCRN_SLA0_ID 0x0C /* SLA ID Register */
281 #define DCRN_SLA0_GMLLR 0x0D /* SLA General Indirect Memory Link List Reset */
283 #define DCRN_DMA0_BASE 0x100
284 #define DCRN_DMA1_BASE 0x108
285 #define DCRN_DMA2_BASE 0x110
286 #define DCRN_DMA3_BASE 0x118
287 #define DCRNCAP_DMA_SG 1 /* have DMA scatter/gather capability */
288 #define DCRN_DMASR_BASE 0x120
289 #define DCRN_EBC_BASE 0x012
290 #define DCRN_DCP0_BASE 0x014
291 #define DCRN_UIC0_BASE 0x0C0
293 #define UIC0 DCRN_UIC0_BASE
298 /* More memory-mapped I/O bases, etc., esp. for OCP, that should be moved
301 #define IIC0_BASE 0xEF600500
302 #define OPB0_BASE 0xEF600600
303 #define GPIO0_BASE 0xEF600700
307 /****************************************************************************
309 ***************************************************************************/
311 /* Touch Panel/PWM Controller */
313 #define TPC0_IO_BASE 0xef600a00
315 #define TPC_CR 0x00 /* TPC Command Register */
316 #define TPC_PCRX 0x04 /* TPC Precharge Count Register X1 */
317 #define TPC_DCRX 0x08 /* TPC Discharge Count Register X1 */
318 #define TPC_PCRY 0x0c /* TPC Precharge Count Register Y1 */
319 #define TPC_DCRY 0x10 /* TPC Discharge Count Register Y1 */
320 #define TPC_RRX 0x14 /* TPC Read Register X1 */
321 #define TPC_RRY 0x18 /* TPC Read Register Y1 */
322 #define TPC_SRX 0x1c /* TPC Status Register X1 */
323 #define TPC_SRY 0x20 /* TPC Status Register Y1 */
325 /* Triple-DES Controller */
327 #define TDES0_IO_BASE 0xef600b00
329 /* The PCMCIA controller driver 4xx_pccf.c is responsible for the EBC setup of
330 PCMCIA. Externally, EBC bank selects 3..7 take on PCMCIA functions when
331 PCMCIA is enabled. */
333 #define PCCF_4XX_PADDR (0xf0000000UL)
334 #define PCCF_4XX_SIZE (32 * 1024 * 1024)
335 #define PCCF_4XX_MACRO_IRQ UIC_IRQ_EIR5
336 #define PCCF_4XX_CARD_IRQ UIC_IRQ_EIR6
339 /*****************************************************************************
340 * CPM bits for the 405LP. Field names are as documented in the 405LP manual.
341 * Backwards-compatible synonyms appear at the end.
342 *****************************************************************************/
344 #define CPM_BITMASK(i) (((unsigned)0x80000000) >> i)
346 #define CPM_IIC CPM_BITMASK(0) /* IIC Interface */
347 #define CPM_CPU CPM_BITMASK(1) /* Processor Core */
348 #define CPM_DMA CPM_BITMASK(3) /* DMA Controller */
349 #define CPM_BRG CPM_BITMASK(4) /* PLB to OPB Bridge */
350 #define CPM_DCP CPM_BITMASK(5) /* CodePack */
351 #define CPM_EBC CPM_BITMASK(6) /* ROM/SRAM Peripheral Controller */
352 #define CPM_SDRAM CPM_BITMASK(7) /* SDRAM memory controller */
353 #define CPM_PLB CPM_BITMASK(8) /* PLB bus arbiter */
354 #define CPM_GPIO CPM_BITMASK(9) /* General Purpose IO (??) */
355 #define CPM_UART0 CPM_BITMASK(10) /* Serial Port 0 */
356 #define CPM_UART1 CPM_BITMASK(11) /* Serial Port 1 */
357 #define CPM_UIC CPM_BITMASK(12) /* Universal Interrupt Controller */
358 #define CPM_CPU_TMRCLK CPM_BITMASK(13) /* CPU Timers */
359 #define CPM_SLA CPM_BITMASK(14) /* Speech Label Accelerator */
360 #define CPM_CSI CPM_BITMASK(15) /* CODEC Serial Interface */
361 #define CPM_TPC CPM_BITMASK(16) /* Touch Panel Controller */
362 #define CPM_TDES CPM_BITMASK(18) /* Triple DES */
364 #define CPM_GPIO0 CPM_GPIO /* ppc4xx_setup.c */
365 #define CPM_IIC0 CPM_IIC /* ppc4xx_setup.c */
366 #define CPM_IIC1 0 /* ppc4xx_setup.c */
368 #define DFLT_IBM4xx_PM 0 /* for now until we get a better hable on this one - armin */
370 /*****************************************************************************
371 * UIC IRQ ordinals for the 405LP. IRQ bit names are as documented in the
372 * 405LP manual (except for reserved fields). Backwards-compatible synonyms
374 *****************************************************************************/
376 #define UIC_IRQ_U0 0 /* UART0 */
377 #define UIC_IRQ_U1 1 /* UART1 */
378 #define UIC_IRQ_IIC 2 /* IIC */
379 #define UIC_IRQ_EM 3 /* EBC ??? */
380 #define UIC_IRQ_IRQ4 4 /* Reserved */
381 #define UIC_IRQ_D0 5 /* DMA Channel 0 */
382 #define UIC_IRQ_D1 6 /* DMA Channel 1 */
383 #define UIC_IRQ_D2 7 /* DMA Channel 2 */
384 #define UIC_IRQ_D3 8 /* DMA Channel 3 */
385 #define UIC_IRQ_IRQ9 9 /* Reserved */
386 #define UIC_IRQ_IRQ10 10 /* Reserved */
387 #define UIC_IRQ_IRQ11 11 /* Reserved */
388 #define UIC_IRQ_IRQ12 12 /* Reserved */
389 #define UIC_IRQ_IRQ13 13 /* Reserved */
390 #define UIC_IRQ_IRQ14 14 /* Reserved */
391 #define UIC_IRQ_IRQ15 15 /* Reserved */
392 #define UIC_IRQ_IRQ16 16 /* Reserved */
393 #define UIC_IRQ_EC 17 /* ECC Correctable Error ??? */
394 #define UIC_IRQ_TPX 18 /* Touch Panel X */
395 #define UIC_IRQ_TPY 19 /* Touch Panel Y */
396 #define UIC_IRQ_SLA 20 /* SLA Interrupt */
397 #define UIC_IRQ_CSI 21 /* CSI Interrupt */
398 #define UIC_IRQ_LCD 22 /* LCD Interrupt */
399 #define UIC_IRQ_RTC 23 /* RTC Interrupt */
400 #define UIC_IRQ_APM 24 /* APM Interrupt */
401 #define UIC_IRQ_EIR0 25 /* External IRQ 0 */
402 #define UIC_IRQ_EIR1 26 /* External IRQ 1 */
403 #define UIC_IRQ_EIR2 27 /* External IRQ 2 */
404 #define UIC_IRQ_EIR3 28 /* External IRQ 3 */
405 #define UIC_IRQ_EIR4 29 /* External IRQ 4 */
406 #define UIC_IRQ_EIR5 30 /* External IRQ 5 */
407 #define UIC_IRQ_EIR6 31 /* External IRQ 6 */
409 /*****************************************************************************
410 * Serial port definitions
411 *****************************************************************************/
413 #ifdef CONFIG_SERIAL_MANY_PORTS
414 #define RS_TABLE_SIZE 64
416 #define RS_TABLE_SIZE 4
419 #define UART0_INT UIC_IRQ_U0
420 #define UART1_INT UIC_IRQ_U1
421 #define UART0_IO_BASE 0xEF600300
422 #define UART1_IO_BASE 0xEF600400
424 #define STD_UART_OP(num) \
425 { 0, BASE_BAUD, 0, UART##num##_INT, \
426 (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST), \
427 iomem_base:(u8 *) UART##num##_IO_BASE, \
428 io_type: SERIAL_IO_MEM},
430 #if defined(CONFIG_UART0_TTYS0)
431 #define SERIAL_DEBUG_IO_BASE UART0_IO_BASE
432 #define SERIAL_PORT_DFNS \
437 #if defined(CONFIG_UART0_TTYS1)
438 #define SERIAL_DEBUG_IO_BASE UART1_IO_BASE
439 #define SERIAL_PORT_DFNS \
446 #include <linux/types.h>
447 #include <asm/system.h>
449 /****************************************************************************
450 * DCR type structures and field definitions for DCRs manipulated by the 405LP
452 ****************************************************************************/
454 /* APM0_CFG - APM Configuration Register */
459 unsigned int rsvd:17;
460 unsigned int isp:1; /* Initiate Sleep */
461 unsigned int ewt:1; /* Enable Watchdog Timer */
462 unsigned int sm:2; /* Sleep Mode */
463 unsigned int iica:3; /* I2C Address (low-order 3 bits) */
464 unsigned int psc:1; /* Power Select Control */
465 unsigned int cdiv:6; /* IIC Clock Divider */
466 unsigned int v:1; /* Valid bit */
470 #define APM0_CFG_MASK 0xffff8000 /* AND to clear all non-reserved fields */
472 /* APM0_SR - APM Status Register */
477 unsigned int rsvd:17;
478 unsigned int cdet:1; /* Clock Detect */
479 unsigned int en:1; /* APM Enable Indicator */
480 unsigned int rset:1; /* Processor Reset by APM? */
481 unsigned int pfr:1; /* Power Fail Reset? */
482 unsigned int rsrt:1; /* Restart Successful? */
483 unsigned int sdwn:1; /* Shutdown Complete */
484 unsigned int errc:8; /* Error Code */
485 unsigned int v:1; /* Valid Bit */
489 #define APM0_SR_MASK 0xffff8000 /* AND to clear all non-reserved fields */
491 /* APM0_IER -- APM Interrupt Enable Register
492 APM0_IPR -- APM Interrupt Polarity Register
493 APM0_ISR -- APM Interrupt Status Register
494 APM0_ITR -- APM Interrupt Trigger Register
496 The interrupts are also accessed via standard interrupt numbers:
501 62 : Real-Time Clock Interrupt
507 unsigned int rsvd:27;
519 unsigned int rsvd:27;
531 unsigned int rsvd:27;
543 unsigned int rsvd:27;
552 #define APM0_IER_MASK 0xffffffe0 /* AND to clear all non-reserved fields */
553 #define APM0_IPR_MASK 0xffffffe0 /* AND to clear all non-reserved fields */
554 #define APM0_ISR_MASK 0xffffffe0 /* AND to clear all non-reserved fields */
555 #define APM0_ITR_MASK 0xffffffe0 /* AND to clear all non-reserved fields */
557 /* CPC0_PLLMR - PLL Mode Register */
562 unsigned int pmul:5; /* PLL Multiplier */
563 unsigned int pdiv:5; /* PLL Divider */
564 unsigned int tun:10; /* PLL Tuning Control */
565 unsigned int db2:1; /* Divide VCO by 2 Select */
566 unsigned int csel:2; /* PLL Clock Output Select */
567 unsigned int rsvd:8; /* Reserved */
568 unsigned int v:1; /* Valid bit */
572 #define CPC0_PLLMR_MASK 0x000001fe /* AND to clear all non-reserved fields */
573 #define CPC0_PLLMR_RTVFS_MASK CPC0_PLLMR_MASK /* All bits controlled by RTVFS */
575 /* The PLL multiplier/divider are always multiples of 4. */
577 #define CPC0_PLLMR_MULDIV_ENCODE(n) ((((unsigned)(n)) / 4) - 1)
578 #define CPC0_PLLMR_MULDIV_DECODE(n) (((n) + 1) * 4)
579 #define CPC0_PLLMR_MULDIV_MAX 128
581 #define CPC0_PLLMR_TUN_HIGH 0x200 /* High-band tuning */
582 #define CPC0_PLLMR_TUN_LOW 0x000 /* Low-band tuning */
584 #define CPC0_PLLMR_CSEL_REFCLK 0 /* System Reference Clock */
585 #define CPC0_PLLMR_CSEL_PLLVCO 1 /* PLL VCO */
586 #define CPC0_PLLMR_CSEL_RTC 2 /* RTC */
587 #define CPC0_PLLMR_CSEL_EBCPLB5 3 /* EBC-PLB divisor is 5 ??? */
589 /* CPC0_CGCR0 - Clock Generation and Control Register 0 */
594 unsigned int pcp:5; /* Proc. Core/PLB Clock Divisor */
595 unsigned int pcsc:5; /* Proc. Core/SysClkOut Divisor */
596 unsigned int pcu:5; /* Proc. Core/UARTSerClk Clock Div. */
597 unsigned int u0cs:1; /* UART0 Clock Select */
598 unsigned int u1cs:1; /* UART1 Clock Select */
599 unsigned int scsel:2; /* SysClkOut Select */
600 unsigned int rsvd:13; /* Reserved */
604 #define CPC0_CGCR0_MASK 0x00001fff /* AND to clear all non-reserved fields */
605 #define CPC0_CGCR0_RTVFS_MASK 0x0001ffff /* AND to clear all rtvfs-modified
608 #define CPC0_CGCR0_SCSEL_OFF 0 /* SysClkOut driven low (low power) */
609 #define CPC0_CGCR0_SCSEL_CPU 1 /* Select CPU clock as SysClkOut */
610 #define CPC0_CGCR0_SCSEL_PLB 2 /* SysClkOut is PLB Sample Cycle */
611 #define CPC0_CGCR0_SCSEL_OPB 3 /* SysClkOut is OPB Sample Cycle */
613 /* CPC0_CGCR1 - Clock Generation and Control Register 1 */
618 unsigned int po:5; /* PLB/OPB Clock Divisor */
619 unsigned int pext:5; /* PLB/External Clock Divisor */
620 unsigned int ppxl:5; /* PLB/LCD Pixel Clock Divisor */
621 unsigned int csel:2; /* PerClk Select */
622 unsigned int rsvd:15; /* Reserved */
626 #define CPC0_CGCR1_MASK 0x00007fff /* AND to clear all non-reserved fields */
627 #define CPC0_CGCR1_RTVFS_MASK 0x0001ffff /* AND to clear all rtvfs-modified
630 /* 5-bit clock dividers are directly encoded, except that an encoding of 0
631 indicates divide-by-32. */
633 #define CPC0_DIV_MAX 32
634 #define CPC0_DIV_VALID(n) (((n) > 0) && ((n) <= CPC0_DIV_MAX))
635 #define CPC0_DIV_ENCODE(n) (((unsigned)(n) >= CPC0_DIV_MAX) ? 0 : (unsigned)(n))
636 #define CPC0_DIV_DECODE(n) (((n) == 0) ? CPC0_DIV_MAX : (n))
638 #define CPC0_CGCR1_CSEL_OFF 0 /* PerClk driven low (low power) */
639 #define CPC0_CGCR1_CSEL_PERCLK 1 /* Select PerClk */
640 #define CPC0_CGCR1_CSEL_PLBCLK 2 /* Select PLB clock */
641 #define CPC0_CGCR1_CSEL_OPBCLK 3 /* Select OPB clock */
643 /* CPC0_CR0 - Chip Control Register 0 */
648 unsigned int rsvd0:7; /* Reserved */
649 unsigned int ssr:1; /* SDRAM Self-Refresh on Sleep Req. */
650 unsigned int gpms:2; /* GPIO Pin Muxing Select */
651 unsigned int u0pms:2; /* UART0 Pin Muxing Select */
652 unsigned int u1pms:2; /* UART1 Pin Muxing Select */
653 unsigned int ipms:2; /* IIC Pin Muxing Select */
654 unsigned int cpms:2; /* CSI Pin Muxing Select */
655 unsigned int tpms:2; /* TPC Pin Muxing Select */
656 unsigned int irpms:2; /* IRQ Pin Muxing Select */
657 unsigned int pcmd:1; /* PCMCIA Mode Disable */
658 unsigned int u0dte:1; /* UART0 DMA Transmit Channel Enable */
659 unsigned int u0rde:1; /* UART0 DMA Receive Channel Enable */
660 unsigned int u0dce:1; /* UART0 DMA CLear on Enable */
661 unsigned int rsvd1:6; /* Reserved */
665 #define CPC0_CR0_MASK 0xfe00003f /* AND to clear all non-reserved fields */
667 /* CPC0_CR1 - Chip Control Register 1 */
672 unsigned int rsvd0:28; /* Reserved */
673 unsigned int tbsed:1; /* TB. Src. in Edge Detect Mode */
674 unsigned int edmd:1; /* TB. Src. Edge Detect Mode Disable */
675 unsigned int rsvd1:2; /* Reserved */
679 #define CPC0_CR1_MASK 0xfffffff3 /* AND to clear all non-reserved fields */
681 /* DCP0_CFG - DCP Configuration Register */
686 unsigned int rsvd0:18;
687 unsigned int sldy:10; /* Sleep Delay */
688 unsigned int slen:1; /* Sleep Enable */
689 unsigned int cdb:1; /* Clear Decompression Buffer */
690 unsigned int rsvd1:1;
691 unsigned int ikb:1; /* Enable Decompression */
695 #define DCP0_CFG_MASK 0xffffc002 /* AND to clear all non-reserved fields */
697 /* DMA0_SLP - DMA Sleep Mode Register */
702 unsigned idu:5; /* Idle Timer Upper */
704 unsigned sme:1; /* Sleep Mode Enable */
709 #define DMA0_SLP_MASK 0x07dfffff /* AND to clear all non-reserved fields */
711 /* EBC0_BnAP - EBC Bank Access Parameters */
716 unsigned bme:1; /* Burst Mode Enable */
717 unsigned twt:8; /* Transfer Wait (non-burst) */
719 unsigned csn:2; /* Chip Select On Timing */
720 unsigned oen:2; /* Output Enable On Timing */
721 unsigned wbn:2; /* Write Byte Enable On Timing */
722 unsigned wbf:2; /* Write Byte Enable Off Timing */
723 unsigned th:3; /* Transfer Hold */
724 unsigned re:1; /* Ready Enable */
725 unsigned sor:1; /* Sample On Ready */
726 unsigned bem:1; /* Byte Enable Mode */
727 unsigned pen:1; /* Parity Enable */
732 #define EBC0_BnAP_MASK 0x0070001f /* AND to clear all non-reserved fields */
734 /* EBC0_BnCR - EBC Bank Configuration Registers */
739 unsigned bas:12; /* Base Address */
740 unsigned bs:3; /* Bank Size */
741 unsigned bu:2; /* Bank Usage */
742 unsigned bw:2; /* Bank Width */
747 #define EBC0_BnCR_MASK 0x00001fff /* AND to clear all non-reserved fields */
749 #define EBC0_BnCR_BS_1MB 0
750 #define EBC0_BnCR_BS_2MB 1
751 #define EBC0_BnCR_BS_4MB 2
752 #define EBC0_BnCR_BS_8MB 3
753 #define EBC0_BnCR_BS_16MB 4
754 #define EBC0_BnCR_BS_32MB 5
755 #define EBC0_BnCR_BS_64MB 6
756 #define EBC0_BnCR_BS_128MB 7
758 #define EBC0_BnCR_BU_R 1
759 #define EBC0_BnCR_BU_W 2
760 #define EBC0_BnCR_BU_RW 3
762 #define EBC0_BnCR_BW_8 0
763 #define EBC0_BnCR_BW_16 1
764 #define EBC0_BnCR_BW_32 2
766 /* EBC0_CFG -EBC Configuration Register */
771 unsigned ebtc:1; /* External Bus Three State Control */
772 unsigned ptd:1; /* Device-paced Time-out Disable */
773 unsigned rtc:3; /* Ready Timeout Count */
775 unsigned cstc:1; /* Chip Select Three State Control */
776 unsigned bpf:2; /* Burst Prefetch */
778 unsigned pme:1; /* Power Management Enable */
779 unsigned pmt:5; /* Power Management Timer */
784 #define EBC0_CFG_MASK 0x078c0fff /* AND to clear all non-reserved fields */
786 #define EBC0_CFG_RTC_16 0
787 #define EBC0_CFG_RTC_32 1
788 #define EBC0_CFG_RTC_64 2
789 #define EBC0_CFG_RTC_128 3
790 #define EBC0_CFG_RTC_256 4
791 #define EBC0_CFG_RTC_512 5
792 #define EBC0_CFG_RTC_1024 6
793 #define EBC0_CFG_RTC_2048 7
795 /* SDRAM0_CFG - SDRAM Controller Configuration Register */
800 unsigned int dce:1; /* SDRAM Controller Enable */
801 unsigned int sre:1; /* Self-Refresh Enable */
802 unsigned int pme:1; /* Power Management Enable */
803 unsigned int rsvd0:1;
804 unsigned int regen:1; /* Registered Memory Enable */
805 unsigned int drw:2; /* SDRAM Width */
806 unsigned int brpf:2; /* Burst Read Prefetch Granularity */
807 unsigned int rsvd1:1;
808 unsigned int emdulr:1; /* Enable Memory Data Unless Read */
809 unsigned int rsvd2:21;
813 #define SDRAM0_CFG_MASK 0x106fffff /* AND to clear all non-reserved fields */
815 #define SDRAM0_CFG_BRPF_16 1
816 #define SDRAM0_CFG_BRPF_32 2
818 /* SDRAM0_PMIT - SDRAM Power Management Idle Timer */
823 unsigned int cnt:5; /* Cycle Count Before Sleep Request */
824 unsigned int rsvd:27;
828 #define SDRAM0_PMIT_MASK 0x07ffffff /* AND to clear all non-reserved fields */
830 /* SDRAM0_RTR - Refresh timer register */
841 #define SDRAM0_RTR_MASK 0xc007ffff /* AND to clear non-reserved fields */
842 #define SDRAM0_RTR_RTVFS_MASK SDRAM0_RTR_MASK
844 #define SDRAM0_RTR_IV(n) (((n) & 0x3ff8) >> 2)
846 /* SDRAM0_TR - SDRAM Timing Register */
851 unsigned int rsvd0:7;
852 unsigned int casl:2; /* CAS Latency */
853 unsigned int rsvd1:3;
854 unsigned int pta:2; /* Precharge-to-activate */
855 unsigned int ctp:2; /* Read/Write to Precharge */
856 unsigned int ldf:2; /* Command Leadoff */
857 unsigned int rsvd2:9;
858 unsigned int rfta:3; /* Refresh-to-Activate */
859 unsigned int rcd:2; /* RAS-CAS Delay */
863 #define SDRAM0_TR_MASK 0xfe703fe0 /* AND to clear non-reserved fields */
864 #define SDRAM0_TR_RTVFS_MASK SDRAM0_TR_MASK
866 #define SDRAM0_TR_ENCODE(n) ((n) - 1)
867 #define SDRAM0_TR_ENCODE_RFTA(n) ((n) - 4)
869 /* SLA0_SLPMD - SLA Sleep Mode Control Register */
874 unsigned slcr:5; /* Sleep Counter */
876 unsigned slen:1; /* Sleep Mode Enable */
881 #define SLA0_SLPMD_MASK 0x07dfffff /* AND to clear all non-reserved fields */
883 /* these defines are for the DV bits of RTC0_CR0 */
884 #define RTC_DVBITS_4MHZ 0 /* 4.194304 MHz */
885 #define RTC_DVBITS_1MHZ 1 /* 1.048576 MHz */
886 #define RTC_DVBITS_33KHZ 2 /* 32.768 kHz */
888 /* Several direct-write DCRs on the 405LP have an interlock requirement,
889 implemented by a "valid" bit in the low-order bit. This routine handles the
890 handshaking for these registers, by
892 1) Rewriting the current value with the valid bit clear;
893 2) Rewriting the new value with the valid bit clear;
894 3) Rewriting the new value with the valid bit set.
896 The mask is a mask with 1s in every reserved bit position.
898 NB: This routine always writes the register with the valid bit set,
899 regardless of the valid bit setting in the 'new' parameter.
901 Unfortunately this must be a macro to work (due to mtdcr()).
903 Note that for APM registers, it takes multiple RTC clock cycles for the DCR
904 writes to take effect. Any time delays after writes to APM are the
905 resonsibility of the caller.
908 #define mtdcr_interlock(dcrn, new, mask) \
912 __old = mfdcr(dcrn); \
913 mtdcr(dcrn, __old & 0xfffffffe); \
914 __new = ((__old & (mask)) | ((new) & ~(mask))) & 0xfffffffe; \
915 mtdcr(dcrn, __new); \
916 mtdcr(dcrn, __new | 1); \
919 /****************************************************************************
920 * Power Managament Routines
921 ****************************************************************************/
923 int ibm405lp_set_pixclk(unsigned pixclk_min, unsigned pixclk_max);
924 int ibm405lp_setup_pccf(volatile u16 **vaddr, unsigned long *io_base,
925 unsigned long *mem_base);
927 void ibm405lp_reset_sdram(u32 new_rtr, u32 new_tr);
929 extern int (*set_pixclk_hook) (unsigned pixclk_min, unsigned pixclk_max);
930 extern unsigned last_pixclk_min;
931 extern unsigned last_pixclk_max;
933 extern long ibm405lp_time_init(void);
934 extern unsigned long ibm405lp_get_rtc_time(void);
935 extern int ibm405lp_set_rtc_time(unsigned long nowtime);
937 #endif /* __ASSEMBLY__ */
939 #include <platforms/ibm405.h>
941 #endif /* __ASM_IBM405LP_H__ */
942 #endif /* __KERNEL__ */