blob: 977355f0a48365c34aa73cadb426321033bc4bf9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_HD64461
2#define __ASM_SH_HD64461
3/*
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +09004 * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
5 * Copyright (C) 2004 Paul Mundt
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Copyright (C) 2000 YAEGASHI Takeshi
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +09007 *
8 * Hitachi HD64461 companion chip support
9 * (please note manual reference 0x10000000 = 0xb0000000)
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
12/* Constants for PCMCIA mappings */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090013#define HD64461_PCC_WINDOW 0x01000000
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090015/* Area 6 - Slot 0 - memory and/or IO card */
Paul Mundtbec36ec2009-05-15 12:03:04 +090016#define HD64461_IOBASE 0xb0000000
17#define HD64461_IO_OFFSET(x) (HD64461_IOBASE + (x))
18#define HD64461_PCC0_BASE HD64461_IO_OFFSET(0x8000000)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090019#define HD64461_PCC0_ATTR (HD64461_PCC0_BASE) /* 0xb80000000 */
20#define HD64461_PCC0_COMM (HD64461_PCC0_BASE+HD64461_PCC_WINDOW) /* 0xb90000000 */
21#define HD64461_PCC0_IO (HD64461_PCC0_BASE+2*HD64461_PCC_WINDOW) /* 0xba0000000 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070022
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090023/* Area 5 - Slot 1 - memory card only */
Paul Mundtbec36ec2009-05-15 12:03:04 +090024#define HD64461_PCC1_BASE HD64461_IO_OFFSET(0x4000000)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090025#define HD64461_PCC1_ATTR (HD64461_PCC1_BASE) /* 0xb4000000 */
26#define HD64461_PCC1_COMM (HD64461_PCC1_BASE+HD64461_PCC_WINDOW) /* 0xb5000000 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090028/* Standby Control Register for HD64461 */
Paul Mundt62669e62009-05-20 11:27:13 +090029#define HD64461_STBCR HD64461_IO_OFFSET(0x00000000)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090030#define HD64461_STBCR_CKIO_STBY 0x2000
31#define HD64461_STBCR_SAFECKE_IST 0x1000
32#define HD64461_STBCR_SLCKE_IST 0x0800
33#define HD64461_STBCR_SAFECKE_OST 0x0400
34#define HD64461_STBCR_SLCKE_OST 0x0200
35#define HD64461_STBCR_SMIAST 0x0100
36#define HD64461_STBCR_SLCDST 0x0080
37#define HD64461_STBCR_SPC0ST 0x0040
38#define HD64461_STBCR_SPC1ST 0x0020
39#define HD64461_STBCR_SAFEST 0x0010
40#define HD64461_STBCR_STM0ST 0x0008
41#define HD64461_STBCR_STM1ST 0x0004
42#define HD64461_STBCR_SIRST 0x0002
43#define HD64461_STBCR_SURTST 0x0001
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090045/* System Configuration Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +090046#define HD64461_SYSCR HD64461_IO_OFFSET(0x02)
Linus Torvalds1da177e2005-04-16 15:20:36 -070047
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090048/* CPU Data Bus Control Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +090049#define HD64461_SCPUCR HD64461_IO_OFFSET(0x04)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Joe Perches0095d582007-12-18 09:40:33 +090051/* Base Address Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +090052#define HD64461_LCDCBAR HD64461_IO_OFFSET(0x1000)
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Joe Perches0095d582007-12-18 09:40:33 +090054/* Line increment address */
Paul Mundtbec36ec2009-05-15 12:03:04 +090055#define HD64461_LCDCLOR HD64461_IO_OFFSET(0x1002)
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090057/* Controls LCD controller */
Paul Mundtbec36ec2009-05-15 12:03:04 +090058#define HD64461_LCDCCR HD64461_IO_OFFSET(0x1004)
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090060/* LCCDR control bits */
61#define HD64461_LCDCCR_STBACK 0x0400 /* Standby Back */
62#define HD64461_LCDCCR_STREQ 0x0100 /* Standby Request */
63#define HD64461_LCDCCR_MOFF 0x0080 /* Memory Off */
64#define HD64461_LCDCCR_REFSEL 0x0040 /* Refresh Select */
65#define HD64461_LCDCCR_EPON 0x0020 /* End Power On */
66#define HD64461_LCDCCR_SPON 0x0010 /* Start Power On */
Linus Torvalds1da177e2005-04-16 15:20:36 -070067
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090068/* Controls LCD (1) */
Paul Mundtbec36ec2009-05-15 12:03:04 +090069#define HD64461_LDR1 HD64461_IO_OFFSET(0x1010)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090070#define HD64461_LDR1_DON 0x01 /* Display On */
71#define HD64461_LDR1_DINV 0x80 /* Display Invert */
72
73/* Controls LCD (2) */
Paul Mundtbec36ec2009-05-15 12:03:04 +090074#define HD64461_LDR2 HD64461_IO_OFFSET(0x1012)
75#define HD64461_LDHNCR HD64461_IO_OFFSET(0x1014) /* Number of horizontal characters */
76#define HD64461_LDHNSR HD64461_IO_OFFSET(0x1016) /* Specify output start position + width of CL1 */
77#define HD64461_LDVNTR HD64461_IO_OFFSET(0x1018) /* Specify total vertical lines */
78#define HD64461_LDVNDR HD64461_IO_OFFSET(0x101a) /* specify number of display vertical lines */
79#define HD64461_LDVSPR HD64461_IO_OFFSET(0x101c) /* specify vertical synchronization pos and AC nr */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090080
81/* Controls LCD (3) */
Paul Mundtbec36ec2009-05-15 12:03:04 +090082#define HD64461_LDR3 HD64461_IO_OFFSET(0x101e)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090083
84/* Palette Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +090085#define HD64461_CPTWAR HD64461_IO_OFFSET(0x1030) /* Color Palette Write Address Register */
86#define HD64461_CPTWDR HD64461_IO_OFFSET(0x1032) /* Color Palette Write Data Register */
87#define HD64461_CPTRAR HD64461_IO_OFFSET(0x1034) /* Color Palette Read Address Register */
88#define HD64461_CPTRDR HD64461_IO_OFFSET(0x1036) /* Color Palette Read Data Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090089
Paul Mundtbec36ec2009-05-15 12:03:04 +090090#define HD64461_GRDOR HD64461_IO_OFFSET(0x1040) /* Display Resolution Offset Register */
91#define HD64461_GRSCR HD64461_IO_OFFSET(0x1042) /* Solid Color Register */
92#define HD64461_GRCFGR HD64461_IO_OFFSET(0x1044) /* Accelerator Configuration Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +090093
94#define HD64461_GRCFGR_ACCSTATUS 0x10 /* Accelerator Status */
95#define HD64461_GRCFGR_ACCRESET 0x08 /* Accelerator Reset */
96#define HD64461_GRCFGR_ACCSTART_BITBLT 0x06 /* Accelerator Start BITBLT */
97#define HD64461_GRCFGR_ACCSTART_LINE 0x04 /* Accelerator Start Line Drawing */
98#define HD64461_GRCFGR_COLORDEPTH16 0x01 /* Sets Colordepth 16 for Accelerator */
99#define HD64461_GRCFGR_COLORDEPTH8 0x01 /* Sets Colordepth 8 for Accelerator */
100
101/* Line Drawing Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900102#define HD64461_LNSARH HD64461_IO_OFFSET(0x1046) /* Line Start Address Register (H) */
103#define HD64461_LNSARL HD64461_IO_OFFSET(0x1048) /* Line Start Address Register (L) */
104#define HD64461_LNAXLR HD64461_IO_OFFSET(0x104a) /* Axis Pixel Length Register */
105#define HD64461_LNDGR HD64461_IO_OFFSET(0x104c) /* Diagonal Register */
106#define HD64461_LNAXR HD64461_IO_OFFSET(0x104e) /* Axial Register */
107#define HD64461_LNERTR HD64461_IO_OFFSET(0x1050) /* Start Error Term Register */
108#define HD64461_LNMDR HD64461_IO_OFFSET(0x1052) /* Line Mode Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900109
110/* BitBLT Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900111#define HD64461_BBTSSARH HD64461_IO_OFFSET(0x1054) /* Source Start Address Register (H) */
112#define HD64461_BBTSSARL HD64461_IO_OFFSET(0x1056) /* Source Start Address Register (L) */
113#define HD64461_BBTDSARH HD64461_IO_OFFSET(0x1058) /* Destination Start Address Register (H) */
114#define HD64461_BBTDSARL HD64461_IO_OFFSET(0x105a) /* Destination Start Address Register (L) */
115#define HD64461_BBTDWR HD64461_IO_OFFSET(0x105c) /* Destination Block Width Register */
116#define HD64461_BBTDHR HD64461_IO_OFFSET(0x105e) /* Destination Block Height Register */
117#define HD64461_BBTPARH HD64461_IO_OFFSET(0x1060) /* Pattern Start Address Register (H) */
118#define HD64461_BBTPARL HD64461_IO_OFFSET(0x1062) /* Pattern Start Address Register (L) */
119#define HD64461_BBTMARH HD64461_IO_OFFSET(0x1064) /* Mask Start Address Register (H) */
120#define HD64461_BBTMARL HD64461_IO_OFFSET(0x1066) /* Mask Start Address Register (L) */
121#define HD64461_BBTROPR HD64461_IO_OFFSET(0x1068) /* ROP Register */
122#define HD64461_BBTMDR HD64461_IO_OFFSET(0x106a) /* BitBLT Mode Register */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123
124/* PC Card Controller Registers */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900125/* Maps to Physical Area 6 */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900126#define HD64461_PCC0ISR HD64461_IO_OFFSET(0x2000) /* socket 0 interface status */
127#define HD64461_PCC0GCR HD64461_IO_OFFSET(0x2002) /* socket 0 general control */
128#define HD64461_PCC0CSCR HD64461_IO_OFFSET(0x2004) /* socket 0 card status change */
129#define HD64461_PCC0CSCIER HD64461_IO_OFFSET(0x2006) /* socket 0 card status change interrupt enable */
130#define HD64461_PCC0SCR HD64461_IO_OFFSET(0x2008) /* socket 0 software control */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900131/* Maps to Physical Area 5 */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900132#define HD64461_PCC1ISR HD64461_IO_OFFSET(0x2010) /* socket 1 interface status */
133#define HD64461_PCC1GCR HD64461_IO_OFFSET(0x2012) /* socket 1 general control */
134#define HD64461_PCC1CSCR HD64461_IO_OFFSET(0x2014) /* socket 1 card status change */
135#define HD64461_PCC1CSCIER HD64461_IO_OFFSET(0x2016) /* socket 1 card status change interrupt enable */
136#define HD64461_PCC1SCR HD64461_IO_OFFSET(0x2018) /* socket 1 software control */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700137
138/* PCC Interface Status Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900139#define HD64461_PCCISR_READY 0x80 /* card ready */
140#define HD64461_PCCISR_MWP 0x40 /* card write-protected */
141#define HD64461_PCCISR_VS2 0x20 /* voltage select pin 2 */
142#define HD64461_PCCISR_VS1 0x10 /* voltage select pin 1 */
143#define HD64461_PCCISR_CD2 0x08 /* card detect 2 */
144#define HD64461_PCCISR_CD1 0x04 /* card detect 1 */
145#define HD64461_PCCISR_BVD2 0x02 /* battery 1 */
146#define HD64461_PCCISR_BVD1 0x01 /* battery 1 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700147
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900148#define HD64461_PCCISR_PCD_MASK 0x0c /* card detect */
149#define HD64461_PCCISR_BVD_MASK 0x03 /* battery voltage */
150#define HD64461_PCCISR_BVD_BATGOOD 0x03 /* battery good */
151#define HD64461_PCCISR_BVD_BATWARN 0x01 /* battery low warning */
152#define HD64461_PCCISR_BVD_BATDEAD1 0x02 /* battery dead */
153#define HD64461_PCCISR_BVD_BATDEAD2 0x00 /* battery dead */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154
155/* PCC General Control Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900156#define HD64461_PCCGCR_DRVE 0x80 /* output drive */
157#define HD64461_PCCGCR_PCCR 0x40 /* PC card reset */
158#define HD64461_PCCGCR_PCCT 0x20 /* PC card type, 1=IO&mem, 0=mem */
159#define HD64461_PCCGCR_VCC0 0x10 /* voltage control pin VCC0SEL0 */
160#define HD64461_PCCGCR_PMMOD 0x08 /* memory mode */
161#define HD64461_PCCGCR_PA25 0x04 /* pin A25 */
162#define HD64461_PCCGCR_PA24 0x02 /* pin A24 */
163#define HD64461_PCCGCR_REG 0x01 /* pin PCC0REG# */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164
165/* PCC Card Status Change Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900166#define HD64461_PCCCSCR_SCDI 0x80 /* sw card detect intr */
167#define HD64461_PCCCSCR_SRV1 0x40 /* reserved */
168#define HD64461_PCCCSCR_IREQ 0x20 /* IREQ intr req */
169#define HD64461_PCCCSCR_SC 0x10 /* STSCHG (status change) pin */
170#define HD64461_PCCCSCR_CDC 0x08 /* CD (card detect) change */
171#define HD64461_PCCCSCR_RC 0x04 /* READY change */
172#define HD64461_PCCCSCR_BW 0x02 /* battery warning change */
173#define HD64461_PCCCSCR_BD 0x01 /* battery dead change */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174
175/* PCC Card Status Change Interrupt Enable Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900176#define HD64461_PCCCSCIER_CRE 0x80 /* change reset enable */
177#define HD64461_PCCCSCIER_IREQE_MASK 0x60 /* IREQ enable */
178#define HD64461_PCCCSCIER_IREQE_DISABLED 0x00 /* IREQ disabled */
179#define HD64461_PCCCSCIER_IREQE_LEVEL 0x20 /* IREQ level-triggered */
180#define HD64461_PCCCSCIER_IREQE_FALLING 0x40 /* IREQ falling-edge-trig */
181#define HD64461_PCCCSCIER_IREQE_RISING 0x60 /* IREQ rising-edge-trig */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900183#define HD64461_PCCCSCIER_SCE 0x10 /* status change enable */
184#define HD64461_PCCCSCIER_CDE 0x08 /* card detect change enable */
185#define HD64461_PCCCSCIER_RE 0x04 /* ready change enable */
186#define HD64461_PCCCSCIER_BWE 0x02 /* battery warn change enable */
187#define HD64461_PCCCSCIER_BDE 0x01 /* battery dead change enable*/
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188
189/* PCC Software Control Register */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900190#define HD64461_PCCSCR_VCC1 0x02 /* voltage control pin 1 */
191#define HD64461_PCCSCR_SWP 0x01 /* write protect */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900193/* PCC0 Output Pins Control Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900194#define HD64461_P0OCR HD64461_IO_OFFSET(0x202a)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900196/* PCC1 Output Pins Control Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900197#define HD64461_P1OCR HD64461_IO_OFFSET(0x202c)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900199/* PC Card General Control Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900200#define HD64461_PGCR HD64461_IO_OFFSET(0x202e)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900202/* Port Control Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900203#define HD64461_GPACR HD64461_IO_OFFSET(0x4000) /* Port A - Handles IRDA/TIMER */
204#define HD64461_GPBCR HD64461_IO_OFFSET(0x4002) /* Port B - Handles UART */
205#define HD64461_GPCCR HD64461_IO_OFFSET(0x4004) /* Port C - Handles PCMCIA 1 */
206#define HD64461_GPDCR HD64461_IO_OFFSET(0x4006) /* Port D - Handles PCMCIA 1 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900208/* Port Control Data Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900209#define HD64461_GPADR HD64461_IO_OFFSET(0x4010) /* A */
210#define HD64461_GPBDR HD64461_IO_OFFSET(0x4012) /* B */
211#define HD64461_GPCDR HD64461_IO_OFFSET(0x4014) /* C */
212#define HD64461_GPDDR HD64461_IO_OFFSET(0x4016) /* D */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900213
214/* Interrupt Control Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900215#define HD64461_GPAICR HD64461_IO_OFFSET(0x4020) /* A */
216#define HD64461_GPBICR HD64461_IO_OFFSET(0x4022) /* B */
217#define HD64461_GPCICR HD64461_IO_OFFSET(0x4024) /* C */
218#define HD64461_GPDICR HD64461_IO_OFFSET(0x4026) /* D */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900219
220/* Interrupt Status Registers */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900221#define HD64461_GPAISR HD64461_IO_OFFSET(0x4040) /* A */
222#define HD64461_GPBISR HD64461_IO_OFFSET(0x4042) /* B */
223#define HD64461_GPCISR HD64461_IO_OFFSET(0x4044) /* C */
224#define HD64461_GPDISR HD64461_IO_OFFSET(0x4046) /* D */
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900225
226/* Interrupt Request Register & Interrupt Mask Register */
Paul Mundtbec36ec2009-05-15 12:03:04 +0900227#define HD64461_NIRR HD64461_IO_OFFSET(0x5000)
228#define HD64461_NIMR HD64461_IO_OFFSET(0x5002)
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900229
230#define HD64461_IRQBASE OFFCHIP_IRQ_BASE
Kristoffer Ericsonf12468a2007-09-11 12:37:30 +0900231#define OFFCHIP_IRQ_BASE 64
Kristoffer Ericsonbe15d652007-07-12 10:44:41 +0900232#define HD64461_IRQ_NUM 16
233
234#define HD64461_IRQ_UART (HD64461_IRQBASE+5)
235#define HD64461_IRQ_IRDA (HD64461_IRQBASE+6)
236#define HD64461_IRQ_TMU1 (HD64461_IRQBASE+9)
237#define HD64461_IRQ_TMU0 (HD64461_IRQBASE+10)
238#define HD64461_IRQ_GPIO (HD64461_IRQBASE+11)
239#define HD64461_IRQ_AFE (HD64461_IRQBASE+12)
240#define HD64461_IRQ_PCC1 (HD64461_IRQBASE+13)
241#define HD64461_IRQ_PCC0 (HD64461_IRQBASE+14)
Paul Mundt6d75e652006-09-27 13:42:57 +0900242
243#define __IO_PREFIX hd64461
244#include <asm/io_generic.h>
245
246/* arch/sh/cchips/hd6446x/hd64461/setup.c */
Paul Mundt6d75e652006-09-27 13:42:57 +0900247void hd64461_register_irq_demux(int irq,
248 int (*demux) (int irq, void *dev), void *dev);
249void hd64461_unregister_irq_demux(int irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250
251#endif