s3c24x0reg.h revision 205354
1160892Ssobomax/* $NetBSD: s3c24x0reg.h,v 1.7 2004/02/12 03:52:46 bsh Exp $ */
2160892Ssobomax
3160892Ssobomax/*-
4160892Ssobomax * Copyright (c) 2003  Genetec corporation  All rights reserved.
5160892Ssobomax * Written by Hiroyuki Bessho for Genetec corporation.
6160892Ssobomax *
7160892Ssobomax * Redistribution and use in source and binary forms, with or without
8160892Ssobomax * modification, are permitted provided that the following conditions
9160892Ssobomax * are met:
10160892Ssobomax * 1. Redistributions of source code must retain the above copyright
11160892Ssobomax *    notice, this list of conditions and the following disclaimer.
12160892Ssobomax * 2. Redistributions in binary form must reproduce the above copyright
13160892Ssobomax *    notice, this list of conditions and the following disclaimer in the
14160892Ssobomax *    documentation and/or other materials provided with the distribution.
15160892Ssobomax * 3. The name of Genetec corporation may not be used to endorse
16160892Ssobomax *    or promote products derived from this software without specific prior
17160892Ssobomax *    written permission.
18160892Ssobomax *
19160892Ssobomax * THIS SOFTWARE IS PROVIDED BY GENETEC CORP. ``AS IS'' AND
20160892Ssobomax * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21160892Ssobomax * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22160892Ssobomax * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORP.
23160892Ssobomax * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24160892Ssobomax * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25160892Ssobomax * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26160892Ssobomax * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27160892Ssobomax * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28160892Ssobomax * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29160892Ssobomax * POSSIBILITY OF SUCH DAMAGE.
30160892Ssobomax *
31160892Ssobomax * $FreeBSD: head/sys/arm/s3c2xx0/s3c24x0reg.h 205354 2010-03-20 03:39:35Z imp $
32160892Ssobomax */
33160892Ssobomax
34160892Ssobomax
35160892Ssobomax/*
36160892Ssobomax * Samsung S3C2410X/2400 processor is ARM920T based integrated CPU
37160892Ssobomax *
38183882Snwhitehorn * Reference:
39236368Sjhibbits *  S3C2410X User's Manual
40160892Ssobomax *  S3C2400 User's Manual
41160892Ssobomax */
42160892Ssobomax#ifndef _ARM_S3C2XX0_S3C24X0REG_H_
43174782Smarcel#define	_ARM_S3C2XX0_S3C24X0REG_H_
44160892Ssobomax
45160892Ssobomax/* common definitions for S3C2800, S3C2410 and S3C2440 */
46160892Ssobomax#include <arm/s3c2xx0/s3c2xx0reg.h>
47160892Ssobomax
48160892Ssobomax/*
49160892Ssobomax * Map the device registers into kernel space
50160892Ssobomax */
51160892Ssobomax#define	S3C24X0_DEV_START	0x48000000
52160892Ssobomax#define	S3C24X0_DEV_STOP	0x60000000
53160892Ssobomax#define	S3C24X0_DEV_VA_OFFSET	0xD0000000
54160892Ssobomax#define	S3C24X0_DEV_VA_SIZE	(S3C24X0_DEV_STOP - S3C24X0_DEV_START)
55160892Ssobomax#define	S3C24X0_DEV_PA_TO_VA(x)	(x - S3C24X0_DEV_START + S3C24X0_DEV_VA_OFFSET)
56160892Ssobomax
57160892Ssobomax/*
58160892Ssobomax * Physical address of integrated peripherals
59160892Ssobomax */
60160892Ssobomax#define	S3C24X0_MEMCTL_PA_BASE	0x48000000 /* memory controller */
61160892Ssobomax#define	S3C24X0_MEMCTL_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_MEMCTL_PA_BASE)
62160892Ssobomax#define	S3C24X0_USBHC_PA_BASE 	0x49000000 /* USB Host controller */
63160892Ssobomax#define	S3C24X0_USBHC_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_USBHC_PA_BASE)
64160892Ssobomax#define	S3C24X0_INTCTL_PA_BASE	0x4a000000 /* Interrupt controller */
65160892Ssobomax#define	S3C24X0_INTCTL_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_INTCTL_PA_BASE)
66160892Ssobomax#define	S3C24X0_INTCTL_SIZE	0x20
67160892Ssobomax#define	S3C24X0_DMAC_PA_BASE	0x4b000000
68160892Ssobomax#define	S3C24X0_DMAC_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_DMAC_PA_BASE)
69160892Ssobomax#define	S3C24X0_DMAC_SIZE 	0xe4
70160892Ssobomax#define	S3C24X0_CLKMAN_PA_BASE	0x4c000000 /* clock & power management */
71160892Ssobomax#define	S3C24X0_CLKMAN_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_CLKMAN_PA_BASE)
72160892Ssobomax#define	S3C24X0_LCDC_PA_BASE 	0x4d000000 /* LCD controller */
73160892Ssobomax#define	S3C24X0_LCDC_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_LCDC_PA_BASE)
74160892Ssobomax#define	S3C24X0_LCDC_SIZE	0x64
75160892Ssobomax#define	S3C24X0_NANDFC_PA_BASE	0x4e000000 /* NAND Flash controller */
76160892Ssobomax#define	S3C24X0_NANDFC_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_NANDFC_PA_BASE)
77160892Ssobomax#define	S3C24X0_UART0_PA_BASE	0x50000000
78160892Ssobomax#define	S3C24X0_UART0_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_UART0_PA_BASE)
79160892Ssobomax#define	S3C24X0_UART_PA_BASE(n)	(S3C24X0_UART0_PA_BASE+0x4000*(n))
80160892Ssobomax#define	S3C24X0_UART_BASE(n)	S3C24X0_DEV_PA_TO_VA(S3C24X0_UART_PA_BASE(n))
81160892Ssobomax#define	S3C24X0_TIMER_PA_BASE 	0x51000000
82160892Ssobomax#define	S3C24X0_TIMER_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_TIMER_PA_BASE)
83160892Ssobomax#define	S3C24X0_USBDC_PA_BASE 	0x5200140
84160892Ssobomax#define	S3C24X0_USBDC_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_USBDC_PA_BASE)
85160892Ssobomax#define	S3C24X0_USBDC_SIZE 	0x130
86160892Ssobomax#define	S3C24X0_WDT_PA_BASE 	0x53000000
87160892Ssobomax#define	S3C24X0_WDT_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_WDT_PA_BASE)
88160892Ssobomax#define	S3C24X0_IIC_PA_BASE 	0x54000000
89160892Ssobomax#define	S3C24X0_IIC_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_IIC_PA_BASE)
90160892Ssobomax#define	S3C24X0_IIS_PA_BASE 	0x55000000
91160892Ssobomax#define	S3C24X0_IIS_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_IIS_PA_BASE)
92160892Ssobomax#define	S3C24X0_GPIO_PA_BASE	0x56000000
93160892Ssobomax#define	S3C24X0_GPIO_BASE	S3C24X0_DEV_PA_TO_VA(S3C24X0_GPIO_PA_BASE)
94160892Ssobomax#define	S3C24X0_ADC_PA_BASE 	0x58000000
95160892Ssobomax#define	S3C24X0_ADC_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_ADC_PA_BASE)
96160892Ssobomax#define	S3C24X0_SPI0_PA_BASE 	0x59000000
97160892Ssobomax#define	S3C24X0_SPI0_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_SPI0_PA_BASE)
98160892Ssobomax#define	S3C24X0_SPI1_PA_BASE 	0x59000020
99160892Ssobomax#define	S3C24X0_SPI1_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_SPI1_PA_BASE)
100160892Ssobomax#define	S3C24X0_SDI_PA_BASE 	0x5a000000 /* SD Interface */
101160892Ssobomax#define	S3C24X0_SDI_BASE 	S3C24X0_DEV_PA_TO_VA(S3C24X0_SDI_PA_BASE)
102160892Ssobomax
103160892Ssobomax#define	S3C24X0_REG_BASE	0x48000000
104160892Ssobomax#define	S3C24X0_REG_SIZE	0x13000000
105160892Ssobomax
106160892Ssobomax/* Memory controller */
107160892Ssobomax#define	MEMCTL_BWSCON   	0x00	/* Bus width and wait status */
108160892Ssobomax#define	 BWSCON_DW0_SHIFT	1 	/* bank0 is odd */
109160892Ssobomax#define	 BWSCON_BANK_SHIFT(n)	(4*(n))	/* for bank 1..7 */
110160892Ssobomax#define	 BWSCON_DW_MASK 	0x03
111183882Snwhitehorn#define	 BWSCON_DW_8 		0
112160892Ssobomax#define	 BWSCON_DW_16 		1
113183882Snwhitehorn#define	 BWSCON_DW_32 		2
114183882Snwhitehorn#define	 BWSCON_WS		0x04	/* WAIT enable for the bank */
115160892Ssobomax#define	 BWSCON_ST		0x08	/* SRAM use UB/LB for the bank */
116160892Ssobomax
117160892Ssobomax#define	MEMCTL_BANKCON0 	0x04	/* Boot ROM control */
118160892Ssobomax#define	MEMCTL_BANKCON(n)	(0x04+4*(n)) /* BANKn control */
119212240Smav#define	 BANKCON_MT_SHIFT 	15
120160892Ssobomax#define	 BANKCON_MT_ROM 	(0<<BANKCON_MT_SHIFT)
121212240Smav#define	 BANKCON_MT_DRAM 	(3<<BANKCON_MT_SHIFT)
122236368Sjhibbits#define	 BANKCON_TACS_SHIFT 	13	/* address set-up time to nGCS */
123212240Smav#define	 BANKCON_TCOS_SHIFT 	11	/* CS set-up to nOE */
124160892Ssobomax#define	 BANKCON_TACC_SHIFT 	8	/* CS set-up to nOE */
125160892Ssobomax#define	 BANKCON_TOCH_SHIFT 	6	/* CS hold time from OE */
126160892Ssobomax#define	 BANKCON_TCAH_SHIFT 	4	/* address hold time from OE */
127160892Ssobomax#define	 BANKCON_TACP_SHIFT 	2	/* page mode access cycle */
128160892Ssobomax#define	 BANKCON_TACP_2 	(0<<BANKCON_TACP_SHIFT)
129160892Ssobomax#define	 BANKCON_TACP_3  	(1<<BANKCON_TACP_SHIFT)
130160892Ssobomax#define	 BANKCON_TACP_4  	(2<<BANKCON_TACP_SHIFT)
131160892Ssobomax#define	 BANKCON_TACP_6  	(3<<BANKCON_TACP_SHIFT)
132160892Ssobomax#define	 BANKCON_PMC_4   	(1<<0)
133212240Smav#define	 BANKCON_PMC_8   	(2<<0)
134160892Ssobomax#define	 BANKCON_PMC_16   	(3<<0)
135190681Snwhitehorn#define	 BANKCON_TRCD_SHIFT 	2	/* RAS to CAS delay */
136190681Snwhitehorn#define	 BANKCON_TRCD_2  	(0<<2)
137160892Ssobomax#define	 BANKCON_TRCD_3  	(1<<2)
138183882Snwhitehorn#define	 BANKCON_TRCD_4  	(2<<2)
139160892Ssobomax#define	 BANKCON_SCAN_8 	(0<<0)	/* Column address number */
140160892Ssobomax#define	 BANKCON_SCAN_9 	(1<<0)
141190681Snwhitehorn#define	 BANKCON_SCAN_10 	(2<<0)
142160892Ssobomax#define	MEMCTL_REFRESH   	0x24	/* DRAM?SDRAM Refresh */
143160892Ssobomax#define	 REFRESH_REFEN 		(1<<23)
144160892Ssobomax#define	 REFRESH_TREFMD  	(1<<22)	/* 1=self refresh */
145160892Ssobomax#define	 REFRESH_TRP_2 		(0<<20)
146160892Ssobomax#define	 REFRESH_TRP_3 		(1<<20)
147212240Smav#define	 REFRESH_TRP_4 		(2<<20)
148212240Smav#define	 REFRESH_TRC_4 		(0<<18)
149212240Smav#define	 REFRESH_TRC_5 		(1<<18)
150212240Smav#define	 REFRESH_TRC_6 		(2<<18)
151212240Smav#define	 REFRESH_TRC_7 		(3<<18)
152212240Smav#define	 REFRESH_COUNTER_MASK	0x3ff
153190681Snwhitehorn#define	MEMCTL_BANKSIZE 	0x28 	/* Flexible Bank size */
154190681Snwhitehorn#define	MEMCTL_MRSRB6    	0x2c	/* SDRAM Mode register */
155190681Snwhitehorn#define	MEMCTL_MRSRB7    	0x30
156190681Snwhitehorn#define	 MRSR_CL_SHIFT		4	/* CAS Latency */
157190681Snwhitehorn
158190681Snwhitehorn#define	S3C24X0_MEMCTL_SIZE	0x34
159190681Snwhitehorn
160160892Ssobomax/* USB Host controller */
161160892Ssobomax#define	S3C24X0_USBHC_SIZE	0x5c
162160892Ssobomax
163160892Ssobomax/* Interrupt controller */
164160892Ssobomax#define	INTCTL_PRIORITY 	0x0c	/* IRQ Priority control */
165160892Ssobomax#define	INTCTL_INTPND   	0x10	/* Interrupt request status */
166160892Ssobomax#define	INTCTL_INTOFFSET	0x14	/* Interrupt request source */
167160892Ssobomax#define	INTCTL_SUBSRCPND 	0x18	/* sub source pending */
168160892Ssobomax#define	INTCTL_INTSUBMSK  	0x1c	/* sub mask */
169160892Ssobomax
170160892Ssobomax/* Interrupt source */
171160892Ssobomax#define	S3C24X0_INT_ADCTC 	31	/* ADC (and TC for 2410) */
172160892Ssobomax#define	S3C24X0_INT_RTC  	30	/* RTC alarm */
173160892Ssobomax#define	S3C24X0_INT_SPI1	29	/* SPI 1 */
174160892Ssobomax#define	S3C24X0_INT_UART0	28	/* UART0 */
175160892Ssobomax#define	S3C24X0_INT_IIC  	27
176160892Ssobomax#define	S3C24X0_INT_USBH	26	/* USB Host */
177160892Ssobomax#define	S3C24X0_INT_USBD	25	/* USB Device */
178160892Ssobomax#define	S3C24X0_INT_UART1	23	/* UART0  (2410 only) */
179191058Sed#define	S3C24X0_INT_SPI0  	22	/* SPI 0 */
180160892Ssobomax#define	S3C24X0_INT_SDI 	21
181160892Ssobomax#define	S3C24X0_INT_DMA3	20
182160892Ssobomax#define	S3C24X0_INT_DMA2	19
183160892Ssobomax#define	S3C24X0_INT_DMA1	18
184160892Ssobomax#define	S3C24X0_INT_DMA0	17
185160892Ssobomax#define	S3C24X0_INT_LCD 	16
186160892Ssobomax
187160892Ssobomax#define	S3C24X0_INT_UART2 	15	/* UART2 int (2410) */
188160892Ssobomax#define	S3C24X0_INT_TIMER4	14
189160892Ssobomax#define	S3C24X0_INT_TIMER3	13
190160892Ssobomax#define	S3C24X0_INT_TIMER2	12
191160892Ssobomax#define	S3C24X0_INT_TIMER1	11
192160892Ssobomax#define	S3C24X0_INT_TIMER0	10
193160892Ssobomax#define	S3C24X0_INT_TIMER(n)	(10+(n)) /* timer interrupt [4:0] */
194160892Ssobomax#define	S3C24X0_INT_WDT 	9	/* Watch dog timer */
195160892Ssobomax#define	S3C24X0_INT_TICK 	8
196160892Ssobomax#define	S3C24X0_INT_BFLT 	7	/* Battery fault */
197160892Ssobomax#define	S3C24X0_INT_8_23	5	/* Ext int 8..23 */
198160892Ssobomax#define	S3C24X0_INT_4_7 	4	/* Ext int 4..7 */
199160892Ssobomax#define	S3C24X0_INT_EXT(n)	(n) /* External interrupt [3:0] for 24{1,4}0 */
200160892Ssobomax
201160892Ssobomax/* 24{1,4}0 has more than 32 interrupt sources.  These are sub-sources
202160892Ssobomax * that are OR-ed into main interrupt sources, and controlled via
203191058Sed * SUBSRCPND and  SUBSRCMSK registers */
204160892Ssobomax#define	S3C24X0_SUBIRQ_MIN	32
205160892Ssobomax
206160892Ssobomax/* cascaded to INT_ADCTC */
207160892Ssobomax#define	S3C24X0_INT_ADC		(S3C24X0_SUBIRQ_MIN+10)	/* AD converter */
208160892Ssobomax#define	S3C24X0_INT_TC 		(S3C24X0_SUBIRQ_MIN+9)	/* Touch screen */
209160892Ssobomax/* cascaded to INT_UART2 */
210160892Ssobomax#define	S3C24X0_INT_ERR2	(S3C24X0_SUBIRQ_MIN+8)	/* UART2 Error */
211160892Ssobomax#define	S3C24X0_INT_TXD2	(S3C24X0_SUBIRQ_MIN+7)	/* UART2 Tx */
212160892Ssobomax#define	S3C24X0_INT_RXD2	(S3C24X0_SUBIRQ_MIN+6)	/* UART2 Rx */
213160892Ssobomax/* cascaded to INT_UART1 */
214160892Ssobomax#define	S3C24X0_INT_ERR1	(S3C24X0_SUBIRQ_MIN+5)	/* UART1 Error */
215191058Sed#define	S3C24X0_INT_TXD1	(S3C24X0_SUBIRQ_MIN+4)	/* UART1 Tx */
216160892Ssobomax#define	S3C24X0_INT_RXD1	(S3C24X0_SUBIRQ_MIN+3)	/* UART1 Rx */
217160892Ssobomax/* cascaded to INT_UART0 */
218160892Ssobomax#define	S3C24X0_INT_ERR0	(S3C24X0_SUBIRQ_MIN+2)	/* UART0 Error */
219160892Ssobomax#define	S3C24X0_INT_TXD0	(S3C24X0_SUBIRQ_MIN+1)	/* UART0 Tx */
220160892Ssobomax#define	S3C24X0_INT_RXD0	(S3C24X0_SUBIRQ_MIN+0)	/* UART0 Rx */
221160892Ssobomax
222160892Ssobomax/* DMA controller */
223160892Ssobomax/* XXX */
224160892Ssobomax
225160892Ssobomax/* Clock & power manager */
226160892Ssobomax#define	CLKMAN_LOCKTIME 0x00	/* PLL lock time */
227160892Ssobomax#define	CLKMAN_MPLLCON 	0x04	/* MPLL control */
228160892Ssobomax#define	CLKMAN_UPLLCON 	0x08	/* UPLL control */
229160892Ssobomax#define	 PLLCON_MDIV_SHIFT	12
230160892Ssobomax#define	 PLLCON_MDIV_MASK	(0xff<<PLLCON_MDIV_SHIFT)
231160892Ssobomax#define	 PLLCON_PDIV_SHIFT	4
232160892Ssobomax#define	 PLLCON_PDIV_MASK	(0x3f<<PLLCON_PDIV_SHIFT)
233160892Ssobomax#define	 PLLCON_SDIV_SHIFT	0
234160892Ssobomax#define	 PLLCON_SDIV_MASK	(0x03<<PLLCON_SDIV_SHIFT)
235160892Ssobomax#define	CLKMAN_CLKCON	0x0c
236160892Ssobomax#define	 CLKCON_SPI 	(1<<18)
237160892Ssobomax#define	 CLKCON_IIS 	(1<<17)
238160892Ssobomax#define	 CLKCON_IIC 	(1<<16)
239160892Ssobomax#define	 CLKCON_ADC 	(1<<15)
240160892Ssobomax#define	 CLKCON_RTC 	(1<<14)
241160892Ssobomax#define	 CLKCON_GPIO 	(1<<13)
242160892Ssobomax#define	 CLKCON_UART2 	(1<<12)
243160892Ssobomax#define	 CLKCON_UART1 	(1<<11)
244160892Ssobomax#define	 CLKCON_UART0	(1<<10)	/* PCLK to UART0 */
245160892Ssobomax#define	 CLKCON_SDI	(1<<9)
246160892Ssobomax#define	 CLKCON_TIMER	(1<<8)	/* PCLK to TIMER */
247160892Ssobomax#define	 CLKCON_USBD	(1<<7)	/* PCLK to USB device controller */
248160892Ssobomax#define	 CLKCON_USBH	(1<<6)	/* PCLK to USB host controller */
249160892Ssobomax#define	 CLKCON_LCDC	(1<<5)	/* PCLK to LCD controller */
250160892Ssobomax#define	 CLKCON_NANDFC	(1<<4)	/* PCLK to NAND Flash controller */
251160892Ssobomax#define	 CLKCON_IDLE	(1<<2)	/* 1=transition to IDLE mode */
252160892Ssobomax#define	CLKMAN_CLKSLOW	0x10
253160892Ssobomax#define	CLKMAN_CLKDIVN	0x14
254191058Sed#define	 CLKDIVN_PDIVN	(1<<0)	/* pclk=hclk/2 */
255160892Ssobomax
256160892Ssobomax#define	CLKMAN_CLKSLOW	0x10	/* slow clock controll */
257160892Ssobomax#define	 CLKSLOW_UCLK 	(1<<7)	/* 1=UPLL off */
258160892Ssobomax#define	 CLKSLOW_MPLL 	(1<<5)	/* 1=PLL off */
259160892Ssobomax#define	 CLKSLOW_SLOW	(1<<4)	/* 1: Enable SLOW mode */
260160892Ssobomax#define	 CLKSLOW_VAL_MASK  0x0f	/* divider value for slow clock */
261160892Ssobomax
262160892Ssobomax#define	CLKMAN_CLKDIVN	0x14	/* Software reset control */
263160892Ssobomax#define	 CLKDIVN_PDIVN	(1<<0)
264160892Ssobomax
265160892Ssobomax#define	S3C24X0_CLKMAN_SIZE	0x18
266160892Ssobomax
267160892Ssobomax/* LCD controller */
268160892Ssobomax#define	LCDC_LCDCON1	0x00	/* control 1 */
269160892Ssobomax#define	 LCDCON1_ENVID   	(1<<0)	/* enable video */
270160892Ssobomax#define	 LCDCON1_BPPMODE_SHIFT 	1
271160892Ssobomax#define	 LCDCON1_BPPMODE_MASK	(0x0f<<LCDCON1_BPPMODE_SHIFT)
272160892Ssobomax#define	 LCDCON1_BPPMODE_STN1	(0x0<<LCDCON1_BPPMODE_SHIFT)
273160892Ssobomax#define	 LCDCON1_BPPMODE_STN2	(0x1<<LCDCON1_BPPMODE_SHIFT)
274160892Ssobomax#define	 LCDCON1_BPPMODE_STN4	(0x2<<LCDCON1_BPPMODE_SHIFT)
275160892Ssobomax#define	 LCDCON1_BPPMODE_STN8	(0x3<<LCDCON1_BPPMODE_SHIFT)
276160892Ssobomax#define	 LCDCON1_BPPMODE_STN12	(0x4<<LCDCON1_BPPMODE_SHIFT)
277191058Sed#define	 LCDCON1_BPPMODE_TFT1	(0x8<<LCDCON1_BPPMODE_SHIFT)
278160892Ssobomax#define	 LCDCON1_BPPMODE_TFT2	(0x9<<LCDCON1_BPPMODE_SHIFT)
279160892Ssobomax#define	 LCDCON1_BPPMODE_TFT4	(0xa<<LCDCON1_BPPMODE_SHIFT)
280160892Ssobomax#define	 LCDCON1_BPPMODE_TFT8	(0xb<<LCDCON1_BPPMODE_SHIFT)
281160892Ssobomax#define	 LCDCON1_BPPMODE_TFT16	(0xc<<LCDCON1_BPPMODE_SHIFT)
282160892Ssobomax#define	 LCDCON1_BPPMODE_TFT24	(0xd<<LCDCON1_BPPMODE_SHIFT)
283160892Ssobomax#define	 LCDCON1_BPPMODE_TFTX	(0x8<<LCDCON1_BPPMODE_SHIFT)
284160892Ssobomax
285160892Ssobomax#define	 LCDCON1_PNRMODE_SHIFT	5
286160892Ssobomax#define	 LCDCON1_PNRMODE_MASK	(0x3<<LCDCON1_PNRMODE_SHIFT)
287160892Ssobomax#define	 LCDCON1_PNRMODE_DUALSTN4    (0x0<<LCDCON1_PNRMODE_SHIFT)
288160892Ssobomax#define	 LCDCON1_PNRMODE_SINGLESTN4  (0x1<<LCDCON1_PNRMODE_SHIFT)
289160892Ssobomax#define	 LCDCON1_PNRMODE_SINGLESTN8  (0x2<<LCDCON1_PNRMODE_SHIFT)
290160892Ssobomax#define	 LCDCON1_PNRMODE_TFT         (0x3<<LCDCON1_PNRMODE_SHIFT)
291160892Ssobomax
292160892Ssobomax#define	 LCDCON1_MMODE  	(1<<7) /* VM toggle rate */
293160892Ssobomax#define	 LCDCON1_CLKVAL_SHIFT 	8
294160892Ssobomax#define	 LCDCON1_CLKVAL_MASK	(0x3ff<<LCDCON1_CLKVAL_SHIFT)
295160892Ssobomax#define	 LCDCON1_LINCNT_SHIFT 	18
296160892Ssobomax#define	 LCDCON1_LINCNT_MASK	(0x3ff<<LCDCON1_LINCNT_SHIFT)
297160892Ssobomax
298160892Ssobomax#define	LCDC_LCDCON2	0x04	/* control 2 */
299160892Ssobomax#define	 LCDCON2_VPSW_SHIFT	0 	/* TFT Vsync pulse width */
300160892Ssobomax#define	 LCDCON2_VPSW_MASK	(0x3f<<LCDCON2_VPSW_SHIFT)
301160892Ssobomax#define	 LCDCON2_VFPD_SHIFT	6 	/* TFT V front porch */
302160892Ssobomax#define	 LCDCON2_VFPD_MASK	(0xff<<LCDCON2_VFPD_SHIFT)
303160892Ssobomax#define	 LCDCON2_LINEVAL_SHIFT	14 	/* Vertical size */
304160892Ssobomax#define	 LCDCON2_LINEVAL_MASK	(0x3ff<<LCDCON2_LINEVAL_SHIFT)
305160892Ssobomax#define	 LCDCON2_VBPD_SHIFT	24 	/* TFT V back porch */
306160892Ssobomax#define	 LCDCON2_VBPD_MASK	(0xff<<LCDCON2_VBPD_SHIFT)
307160892Ssobomax
308160892Ssobomax#define	LCDC_LCDCON3	0x08	/* control 2 */
309160892Ssobomax#define	 LCDCON3_HFPD_SHIFT	0 	/* TFT H front porch */
310160892Ssobomax#define	 LCDCON3_HFPD_MASK	(0xff<<LCDCON3_VPFD_SHIFT)
311160892Ssobomax#define	 LCDCON3_LINEBLANK_SHIFT  0 	/* STN H blank time */
312160892Ssobomax#define	 LCDCON3_LINEBLANK_MASK	  (0xff<<LCDCON3_LINEBLANK_SHIFT)
313160892Ssobomax#define	 LCDCON3_HOZVAL_SHIFT	8 	/* Horizontal size */
314160892Ssobomax#define	 LCDCON3_HOZVAL_MASK	(0x7ff<<LCDCON3_HOZVAL_SHIFT)
315160892Ssobomax#define	 LCDCON3_HBPD_SHIFT	19 	/* TFT H back porch */
316160892Ssobomax#define	 LCDCON3_HBPD_MASK	(0x7f<<LCDCON3_HPBD_SHIFT)
317160892Ssobomax#define	 LCDCON3_WDLY_SHIFT	19	/* STN vline delay */
318160892Ssobomax#define	 LCDCON3_WDLY_MASK	(0x03<<LCDCON3_WDLY_SHIFT)
319160892Ssobomax#define	 LCDCON3_WDLY_16	(0x00<<LCDCON3_WDLY_SHIFT)
320160892Ssobomax#define	 LCDCON3_WDLY_32	(0x01<<LCDCON3_WDLY_SHIFT)
321160892Ssobomax#define	 LCDCON3_WDLY_64	(0x02<<LCDCON3_WDLY_SHIFT)
322160892Ssobomax#define	 LCDCON3_WDLY_128	(0x03<<LCDCON3_WDLY_SHIFT)
323160892Ssobomax
324160892Ssobomax#define	LCDC_LCDCON4	0x0c	/* control 4 */
325160892Ssobomax#define	 LCDCON4_HPSW_SHIFT	0 	/* TFT Hsync pulse width */
326160892Ssobomax#define	 LCDCON4_HPSW_MASK	(0xff<<LCDCON4_HPSW_SHIFT)
327160892Ssobomax#define	 LCDCON4_WLH_SHIFT	0	/* STN VLINE high width */
328160892Ssobomax#define	 LCDCON4_WLH_MASK	(0x03<<LCDCON4_WLH_SHIFT)
329160892Ssobomax#define	 LCDCON4_WLH_16 	(0x00<<LCDCON4_WLH_SHIFT)
330160892Ssobomax#define	 LCDCON4_WLH_32  	(0x01<<LCDCON4_WLH_SHIFT)
331160892Ssobomax#define	 LCDCON4_WLH_64  	(0x02<<LCDCON4_WLH_SHIFT)
332160892Ssobomax#define	 LCDCON4_WLH_128	(0x03<<LCDCON4_WLH_SHIFT)
333160892Ssobomax
334160892Ssobomax#define	 LCDCON4_MVAL_SHIFT	8	/* STN VM toggle rate */
335160892Ssobomax#define	 LCDCON4_MVAL_MASK	(0xff<<LCDCON4_MVAL_SHIFT)
336160892Ssobomax
337160892Ssobomax#define	LCDC_LCDCON5	0x10	/* control 5 */
338160892Ssobomax#define	 LCDCON5_HWSWP		(1<<0)	/* half-word swap */
339160892Ssobomax#define	 LCDCON5_BSWP 		(1<<1)	/* byte swap */
340160892Ssobomax#define	 LCDCON5_ENLEND		(1<<2)	/* TFT: enable LEND signal */
341160892Ssobomax#define	 LCDCON5_PWREN		(1<<3)	/* enable PWREN signale */
342160892Ssobomax#define	 LCDCON5_INVLEND	(1<<4)	/* TFT: LEND signal polarity */
343160892Ssobomax#define	 LCDCON5_INVPWREN	(1<<5)	/* PWREN signal polarity */
344160892Ssobomax#define	 LCDCON5_INVVDEN	(1<<6)	/* VDEN signal polarity */
345160892Ssobomax#define	 LCDCON5_INVVD		(1<<7)	/* video data signal polarity */
346160892Ssobomax#define	 LCDCON5_INVVFRAME	(1<<8)	/* VFRAME/VSYNC signal polarity */
347160892Ssobomax#define	 LCDCON5_INVVLINE	(1<<9)	/* VLINE/HSYNC signal polarity */
348160892Ssobomax#define	 LCDCON5_INVVCLK	(1<<10)	/* VCLK signal polarity */
349160892Ssobomax#define	 LCDCON5_INVVCLK_RISING	LCDCON5_INVVCLK
350160892Ssobomax#define	 LCDCON5_INVVCLK_FALLING  0
351160892Ssobomax#define	 LCDCON5_FRM565  	(1<<11)	/* RGB:565 format*/
352160892Ssobomax#define	 LCDCON5_FRM555I	0	/* RGBI:5551 format */
353160892Ssobomax#define	 LCDCON5_BPP24BL	(1<<12)	/* bit order for bpp24 */
354160892Ssobomax
355160892Ssobomax#define	 LCDCON5_HSTATUS_SHIFT	17 /* TFT: horizontal status */
356212240Smav#define	 LCDCON5_HSTATUS_MASK	(0x03<<LCDCON5_HSTATUS_SHIFT)
357160892Ssobomax#define	 LCDCON5_HSTATUS_HSYNC	(0x00<<LCDCON5_HSTATUS_SHIFT)
358160892Ssobomax#define	 LCDCON5_HSTATUS_BACKP	(0x01<<LCDCON5_HSTATUS_SHIFT)
359160892Ssobomax#define	 LCDCON5_HSTATUS_ACTIVE	(0x02<<LCDCON5_HSTATUS_SHIFT)
360160892Ssobomax#define	 LCDCON5_HSTATUS_FRONTP	(0x03<<LCDCON5_HSTATUS_SHIFT)
361160892Ssobomax
362160892Ssobomax#define	 LCDCON5_VSTATUS_SHIFT	19 /* TFT: vertical status */
363160892Ssobomax#define	 LCDCON5_VSTATUS_MASK	(0x03<<LCDCON5_VSTATUS_SHIFT)
364160892Ssobomax#define	 LCDCON5_VSTATUS_HSYNC	(0x00<<LCDCON5_VSTATUS_SHIFT)
365160892Ssobomax#define	 LCDCON5_VSTATUS_BACKP	(0x01<<LCDCON5_VSTATUS_SHIFT)
366160892Ssobomax#define	 LCDCON5_VSTATUS_ACTIVE	(0x02<<LCDCON5_VSTATUS_SHIFT)
367212240Smav#define	 LCDCON5_VSTATUS_FRONTP	(0x03<<LCDCON5_VSTATUS_SHIFT)
368160892Ssobomax
369160892Ssobomax#define	LCDC_LCDSADDR1	0x14	/* frame buffer start address */
370160892Ssobomax#define	LCDC_LCDSADDR2	0x18
371160892Ssobomax#define	LCDC_LCDSADDR3	0x1c
372160892Ssobomax#define	 LCDSADDR3_OFFSIZE_SHIFT     11
373160892Ssobomax#define	 LCDSADDR3_PAGEWIDTH_SHIFT   0
374160892Ssobomax
375160892Ssobomax#define	LCDC_REDLUT	0x20	/* STN: red lookup table */
376160892Ssobomax#define	LCDC_GREENLUT	0x24	/* STN: green lookup table */
377160892Ssobomax#define	LCDC_BLUELUT	0x28	/* STN: blue lookup table */
378160892Ssobomax#define	LCDC_DITHMODE	0x4c	/* STN: dithering mode */
379160892Ssobomax
380160892Ssobomax#define	LCDC_TPAL	0x50	/* TFT: temporary palette */
381160892Ssobomax#define	 TPAL_TPALEN		(1<<24)
382212240Smav#define	 TPAL_RED_SHIFT  	16
383160892Ssobomax#define	 TPAL_GREEN_SHIFT	8
384160892Ssobomax#define	 TPAL_BLUE_SHIFT 	0
385160892Ssobomax
386160892Ssobomax#define	LCDC_LCDINTPND	0x54
387160892Ssobomax#define	LCDC_LCDSRCPND	0x58
388160892Ssobomax#define	LCDC_LCDINTMSK	0x5c
389160892Ssobomax#define	 LCDINT_FICNT	(1<<0)	/* FIFO trigger interrupt pending */
390160892Ssobomax#define	 LCDINT_FRSYN	(1<<1)	/* frame sync interrupt pending */
391160892Ssobomax#define	 LCDINT_FIWSEL	(1<<2)	/* FIFO trigger level: 1=8 words, 0=4 words*/
392160892Ssobomax
393160892Ssobomax#define	LCDC_LPCSEL	0x60	/* LPC3600 mode  */
394160892Ssobomax#define	 LPCSEL_LPC_EN		(1<<0)	/* enable LPC3600 mode */
395160892Ssobomax#define	 LPCSEL_RES_SEL		(1<<1)	/* 1=240x320 0=320x240 */
396160892Ssobomax#define	 LPCSEL_MODE_SEL	(1<<2)
397160892Ssobomax#define	 LPCSEL_CPV_SEL		(1<<3)
398160892Ssobomax
399160892Ssobomax
400212240Smav#define	LCDC_PALETTE		0x0400
401160892Ssobomax#define	LCDC_PALETTE_SIZE	0x0400
402160892Ssobomax
403160892Ssobomax/* NAND Flash controller */
404160892Ssobomax#define	NANDFC_NFCONF	0x00	/* Configuration */
405160892Ssobomax/* NANDFC_NFSTAT */
406160892Ssobomax#define	 NFSTAT_READY	(1<<0)	/* NAND flash memory ready/busy status */
407160892Ssobomax
408160892Ssobomax
409160892Ssobomax/* MMC/SD */
410160892Ssobomax#define	SDI_CON		0x00
411160892Ssobomax#define	 CON_BYTEORDER		(1<<4)
412160892Ssobomax#define	 CON_SDIO_INTR		(1<<3)
413212240Smav#define	 CON_READWAIT_EN	(1<<2)
414160892Ssobomax#define	 CON_CLOCK_EN		(1<<0)
415160892Ssobomax#define	SDI_PRE		0x04
416160892Ssobomax#define	SDI_CARG	0x08
417160892Ssobomax#define	SDI_CCON	0x0c
418160892Ssobomax#define	 CCON_ABORDCMD		(1<<12) /* Abort SDIO CMD12/52 */
419160892Ssobomax#define	 CCON_WITHDATA  	(1<<11) /* CMD with data */
420160892Ssobomax#define	 CCON_LONGRSP		(1<<10) /* 136 bit response */
421160892Ssobomax#define	 CCON_WAITRSP		(1<<9)  /* Host waits for response */
422160892Ssobomax#define	 CCON_CMD_START		(1<<8)
423160892Ssobomax#define	 CCON_CMDINDEX_MASK	(0x7F) /* Command number index */
424160892Ssobomax#define	SDI_CSTA	0x10
425160892Ssobomax#define	 CSTA_RSPCRCFAIL	(1<<12)
426160892Ssobomax#define	 CSTA_CMDSENT		(1<<11)
427160892Ssobomax#define	 CSTA_CMDTOUT		(1<<10)
428160892Ssobomax#define	 CSTA_RSPFIN		(1<<9)
429160892Ssobomax/* All the bits to be cleared */
430212240Smav#define	 CSTA_ALL_CLEAR		(CSTA_RSPCRCFAIL | CSTA_CMDSENT | \
431212240Smav				 CSTA_CMDTOUT | CSTA_RSPFIN)
432212240Smav#define	 CSTA_ERROR		(CSTA_RSPCRCFAIL | CSTA_CMDTOUT)
433212240Smav#define	 CSTA_CMDON		(1<<8)
434212240Smav#define	SDI_RSP0	0x14
435212240Smav#define	SDI_RSP1	0x18
436212240Smav#define	SDI_RSP2	0x1c
437212240Smav#define	SDI_RSP3	0x20
438212240Smav#define	SDI_DTIMER	0x24
439212240Smav#define	SDI_BSIZE	0x28
440212240Smav#define	SDI_DCON	0x2c
441212240Smav#define	 DCON_PRDTYPE		(1<<21)
442212240Smav#define	 DCON_TARSP		(1<<20) /* Transmit after response */
443212240Smav#define	 DCON_RACMD		(1<<19) /* Receive after command */
444212240Smav#define	 DCON_BACMD		(1<<18) /* Busy after command */
445212240Smav#define	 DCON_BLKMODE		(1<<17) /* Stream/Block mode */
446212240Smav#define	 DCON_WIDEBUS		(1<<16) /* Standard/Wide bus */
447212240Smav#define	 DCON_ENDMA		(1<<15) /* DMA Enable */
448212240Smav/* Determine the direction of the data transfer */
449212240Smav#define	 DCON_DATA_READY	(0<<12) /* No transfer */
450212240Smav#define	 DCON_ONLYBUST		(1<<12) /* Check if busy */
451212240Smav#define	 DCON_DATA_RECEIVE	(2<<12) /* Receive data from SD */
452212240Smav#define	 DCON_DATA_TRANSMIT	(3<<12) /* Send data to SD */
453212240Smav#define	 DCON_BLKNUM_MASK	(0x7FF) /* Block number */
454212240Smav#define	SDI_DCNT	0x30
455212240Smav#define	SDI_DSTA	0x34
456212240Smav#define	SDI_FSTA	0x38
457212240Smav#define	 FSTA_TX_AVAIL		(1<<13)
458212240Smav#define	 FSTA_RX_AVAIL		(1<<12)
459212240Smav#define	 FSTA_TX_FIFO_HALF_FULL	(1<<11)
460212240Smav#define	 FSTA_TX_FIFO_EMPTY	(1<<10)
461212240Smav#define	 FSTA_RX_FIFO_LAST_DATA	(1<<9)
462212240Smav#define	 FSTA_RX_FIFO_FULL	(1<<8)
463212240Smav#define	 FSTA_RX_FIFO_HALF_FULL	(1<<7)
464212240Smav#define	 FSTA_FIFO_COUNT_MSK	(0x7F)
465212240Smav
466212240Smav/* Timer */
467212240Smav#define	TIMER_TCFG0 	0x00	/* Timer configuration */
468212240Smav#define	TIMER_TCFG1	0x04
469212240Smav#define	 TCFG1_MUX_SHIFT(n)	(4*(n))
470212240Smav#define	 TCFG1_MUX_MASK(n)	(0x0f << TCFG1_MUX_SHIFT(n))
471212240Smav#define	 TCFG1_MUX_DIV2		0
472212240Smav#define	 TCFG1_MUX_DIV4		1
473212240Smav#define	 TCFG1_MUX_DIV8		2
474212240Smav#define	 TCFG1_MUX_DIV16	3
475212240Smav#define	 TCFG1_MUX_EXT 		4
476212240Smav#define	TIMER_TCON 	0x08	/* control */
477212240Smav#define	 TCON_SHIFT(n)		(4 * ((n)==0 ? 0 : (n)+1))
478212240Smav#define	 TCON_START(n)		(1 << TCON_SHIFT(n))
479212240Smav#define	 TCON_MANUALUPDATE(n)	(1 << (TCON_SHIFT(n) + 1))
480212240Smav#define	 TCON_INVERTER(n)	(1 << (TCON_SHIFT(n) + 2))
481212240Smav#define	 __TCON_AUTORELOAD(n)	(1 << (TCON_SHIFT(n) + 3)) /* n=0..3 */
482212240Smav#define	 TCON_AUTORELOAD4 	(1<<22)	       /* stupid hardware design */
483212240Smav#define	 TCON_AUTORELOAD(n)	\
484212240Smav	((n)==4 ? TCON_AUTORELOAD4 : __TCON_AUTORELOAD(n))
485212240Smav#define	 TCON_MASK(n)		(0x0f << TCON_SHIFT(n))
486212240Smav#define	TIMER_TCNTB(n) 	 (0x0c+0x0c*(n))	/* count buffer */
487212240Smav#define	TIMER_TCMPB(n)	 (0x10+0x0c*(n))	/* compare buffer */
488212240Smav#define	__TIMER_TCNTO(n) (0x14+0x0c*(n))	/* count observation */
489212240Smav#define	TIMER_TCNTO4	0x40
490212240Smav#define	TIMER_TCNTO(n)	((n)==4 ? TIMER_TCNTO4 : __TIMER_TCNTO(n))
491212240Smav
492212240Smav#define	S3C24X0_TIMER_SIZE	0x44
493212240Smav
494212240Smav/* UART */
495212240Smav/* diffs to s3c2800 */
496212240Smav/* SSCOM_UMCON */
497212240Smav#define	 UMCON_AFC	(1<<4)	/* auto flow control */
498212240Smav/* SSCOM_UMSTAT */
499212240Smav#define	 UMSTAT_DCTS	(1<<2)	/* CTS change */
500212240Smav/* SSCOM_UMSTAT */
501212240Smav#define	 ULCON_IR  	(1<<6)
502212240Smav#define	 ULCON_PARITY_SHIFT  3
503212240Smav
504212240Smav#define	S3C24X0_UART_SIZE 	0x2c
505212240Smav
506212240Smav/* USB device */
507212240Smav/* XXX */
508212240Smav
509212240Smav/* Watch dog timer */
510212240Smav#define	WDT_WTCON 	0x00	/* WDT mode */
511212240Smav#define	 WTCON_PRESCALE_SHIFT	8
512212240Smav#define	 WTCON_PRESCALE	(0xff<<WTCON_PRESCALE_SHIFT)
513212240Smav#define	 WTCON_ENABLE   (1<<5)
514212240Smav#define	 WTCON_CLKSEL	(3<<3)
515212240Smav#define	 WTCON_CLKSEL_16  (0<<3)
516212240Smav#define	 WTCON_CLKSEL_32  (1<<3)
517212240Smav#define	 WTCON_CLKSEL_64  (2<<3)
518#define	 WTCON_CLKSEL_128 (3<<3)
519#define	 WTCON_ENINT    (1<<2)
520#define	 WTCON_ENRST	(1<<0)
521
522#define	 WTCON_WDTSTOP	0
523
524#define	WDT_WTDAT 	0x04	/* timer data */
525#define	WDT_WTCNT 	0x08	/* timer count */
526
527#define	S3C24X0_WDT_SIZE 	0x0c
528
529/* IIC */
530#define	S3C24X0_IIC_SIZE 	0x0c
531
532
533/* IIS */
534#define	S3C24X0_IIS_SIZE 	0x14
535
536/* GPIO */
537#define	GPIO_PACON	0x00	/* port A configuration */
538#define	GPIO_PADAT	0x04	/* port A data */
539
540#define	GPIO_PBCON	0x10
541/* These are only used on port B-H on 2410 & B-H,J on 2440 */
542#define	 PCON_INPUT	0	/* Input port */
543#define	 PCON_OUTPUT	1	/* Output port */
544#define	 PCON_ALTFUN	2	/* Alternate function */
545#define	 PCON_ALTFUN2	3	/* Alternate function */
546#define	GPIO_PBDAT	0x14
547/* This is different between 2440 and 2442 (pull up vs pull down): */
548#define	GPIO_PBUP 	0x18	/* 2410 & 2440 */
549#define	GPIO_PBDOWN	0x18	/* 2442 */
550
551#define	GPIO_PCCON	0x20
552#define	GPIO_PCDAT	0x24
553#define	GPIO_PCUP	0x28	/* 2410 & 2440 */
554#define	GPIO_PCDOWN	0x28	/* 2442 */
555
556#define	GPIO_PDCON	0x30
557#define	GPIO_PDDAT	0x34
558#define	GPIO_PDUP	0x38	/* 2410 & 2440 */
559#define	GPIO_PDDOWN	0x38	/* 2442 */
560
561#define	GPIO_PECON	0x40
562#define	 PECON_INPUT(x)		(0<<((x)*2)) /* Pin is used for input */
563#define	 PECON_OUTPUT(x)	(1<<((x)*2)) /* Pin is used for output */
564#define	 PECON_FUNC_A(x)	(2<<((x)*2)) /* Pin is used for function 'A' */
565#define	 PECON_FUNC_B(x)	(3<<((x)*2)) /* Pin is used for function 'B' */
566#define	 PECON_MASK(x)		(3<<((x)*2))
567#define	GPIO_PEDAT	0x44
568#define	GPIO_PEUP	0x48	/* 2410 & 2440 */
569#define	GPIO_PEDOWN	0x48	/* 2442 */
570#define	 PEUD_ENABLE(x)		(~(1<<(x))) /* Enable the pull Up/Down */
571#define	 PEUD_DISABLE(x)	(1<<(x)) /* Disable the pull Up/Down */
572
573#define	GPIO_PFCON	0x50
574#define	GPIO_PFDAT	0x54
575#define	GPIO_PFUP	0x58	/* 2410 & 2440 */
576#define	GPIO_PFDOWN	0x58	/* 2442 */
577
578#define	GPIO_PGCON	0x60
579#define	GPIO_PGDAT	0x64
580#define	GPIO_PGUP	0x68	/* 2410 & 2440 */
581#define	GPIO_PGDOWN	0x68	/* 2442 */
582
583#define	GPIO_PHCON	0x70
584#define	GPIO_PHDAT	0x74
585#define	GPIO_PHUP	0x78	/* 2410 & 2440 */
586#define	GPIO_PHDOWN	0x78	/* 2442 */
587
588#define	GPIO_MISCCR 	0x80	/* miscellaneous control */
589#define	GPIO_DCLKCON 	0x84	/* DCLK 0/1 */
590#define	GPIO_EXTINT(n)	(0x88+4*(n))	/* external int control 0/1/2 */
591#define	GPIO_EINTFLT(n)	(0x94+4*(n))	/* external int filter control 0..3 */
592#define	 EXTINTR_LOW	 0x00
593#define	 EXTINTR_HIGH	 0x01
594#define	 EXTINTR_FALLING 0x02
595#define	 EXTINTR_RISING  0x04
596#define	 EXTINTR_BOTH    0x06
597#define	GPIO_EINTMASK	0xa4
598#define	GPIO_EINTPEND	0xa8
599#define	GPIO_GSTATUS0	0xac	/* external pin status */
600#define	GPIO_GSTATUS1	0xb0	/* Chip ID */
601#define	 CHIPID_S3C2410A	0x32410002
602#define	 CHIPID_S3C2440A	0x32440001
603#define	 CHIPID_S3C2442B	0x32440AAB
604#define	GPIO_GSTATUS2	0xb4	/* Reset status */
605#define	GPIO_GSTATUS3	0xb8
606#define	GPIO_GSTATUS4	0xbc
607
608#define	GPIO_SET_FUNC(v,port,func)	\
609		(((v) & ~(3<<(2*(port))))|((func)<<(2*(port))))
610
611/* ADC */
612#define	ADC_ADCCON	0x00
613#define	 ADCCON_ENABLE_START	(1<<0)
614#define	 ADCCON_READ_START	(1<<1)
615#define	 ADCCON_STDBM    	(1<<2)
616#define	 ADCCON_SEL_MUX_SHIFT	3
617#define	 ADCCON_SEL_MUX_MASK	(0x7<<ADCCON_SEL_MUX_SHIFT)
618#define	 ADCCON_PRSCVL_SHIFT	6
619#define	 ADCCON_PRSCVL_MASK	(0xff<<ADCCON_PRSCVL_SHIFT)
620#define	 ADCCON_PRSCEN  	(1<<14)
621#define	 ADCCON_ECFLG   	(1<<15)
622
623#define	ADC_ADCTSC 	0x04
624#define	 ADCTSC_XY_PST   	0x03
625#define	 ADCTSC_AUTO_PST    	(1<<2)
626#define	 ADCTSC_PULL_UP		(1<<3)
627#define	 ADCTSC_XP_SEN		(1<<4)
628#define	 ADCTSC_XM_SEN		(1<<5)
629#define	 ADCTSC_YP_SEN		(1<<6)
630#define	 ADCTSC_YM_SEN		(1<<7)
631#define	ADC_ADCDLY	0x08
632#define	ADC_ADCDAT0	0x0c
633#define	ADC_ADCDAT1	0x10
634
635#define	ADCDAT_DATAMASK  	0x3ff
636
637/* RTC */ /* XXX */
638
639/* SPI */
640#define	S3C24X0_SPI_SIZE 	0x20
641
642#define	SPI_SPCON		0x00
643#define	 SPCON_TAGD		(1<<0) /* Tx auto garbage */
644#define	 SPCON_CPHA		(1<<1)
645#define	 SPCON_CPOL		(1<<2)
646#define	 SPCON_IDLELOW_RISING	  (0|0)
647#define	 SPCON_IDLELOW_FALLING	  (0|SPCON_CPHA)
648#define	 SPCON_IDLEHIGH_FALLING  (SPCON_CPOL|0)
649#define	 SPCON_IDLEHIGH_RISING	  (SPCON_CPOL|SPCON_CPHA)
650#define	 SPCON_MSTR		(1<<3)
651#define	 SPCON_ENSCK		(1<<4)
652#define	 SPCON_SMOD_SHIFT	5
653#define	 SPCON_SMOD_MASK	(0x03<<SPCON_SMOD_SHIFT)
654#define	 SPCON_SMOD_POLL	(0x00<<SPCON_SMOD_SHIFT)
655#define	 SPCON_SMOD_INT 	(0x01<<SPCON_SMOD_SHIFT)
656#define	 SPCON_SMOD_DMA 	(0x02<<SPCON_SMOD_SHIFT)
657
658#define	SPI_SPSTA		0x04 /* status register */
659#define	 SPSTA_REDY		(1<<0) /* ready */
660#define	 SPSTA_MULF		(1<<1) /* multi master error */
661#define	 SPSTA_DCOL		(1<<2) /* Data collision error */
662
663#define	SPI_SPPIN		0x08
664#define	 SPPIN_KEEP		(1<<0)
665#define	 SPPIN_ENMUL		(1<<2) /* multi master error detect */
666
667#define	SPI_SPPRE		0x0c /* prescaler */
668#define	SPI_SPTDAT		0x10 /* tx data */
669#define	SPI_SPRDAT		0x14 /* rx data */
670
671
672#endif /* _ARM_S3C2XX0_S3C24X0REG_H_ */
673