g42xxeb_reg.h revision 1.1 1 /*
2 * Copyright (c) 2002 Genetec corp. All rights reserved.
3 * Written by Hiroyuki Bessho for Genetec corp.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of Genetec corp. may not be used to endorse
14 * or promote products derived from this software without specific prior
15 * written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY GENETEC CORP. ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GENETEC CORP.
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30 #ifndef _EVBARM_G42XXEB_REG_H
31 #define _EVBARM_G42XXEB_REG_H
32
33 #include <arm/xscale/pxa2x0reg.h>
34
35 /* g42xxeb on-board IOs */
36 #define G42XXEB_PLDREG_BASE PXA2X0_CS3_START /* Phisical address */
37 #define G42XXEB_PLDREG_SIZE 0x00000100
38
39 #define G42XXEB_AX88796_PBASE (PXA2X0_CS3_START+0x02000000)
40
41
42 /*
43 * Logical mapping for onboard/integrated peripherals
44 * that are used while bootstrapping.
45 */
46 #define G42XXEB_IO_AREA_VBASE 0xfd000000
47 #define G42XXEB_PLDREG_VBASE 0xfd000000
48 #define G42XXEB_INTCTL_VBASE 0xfd100000
49 #define G42XXEB_CLKMAN_VBASE 0xfd200000
50 #define G42XXEB_GPIO_VBASE 0xfd300000
51
52 #define G42XXEB_VBASE_FREE 0xfd400000
53 /* FFUART and/or BTUART are mapped to this area when
54 used for console or kgdb port */
55
56 /*
57 * Onboard register address
58 * (offset from G42XXEB_OBIO_PBASE)
59 */
60 #define G42XXEB_INTSTS1 0x0a
61 #define G42XXEB_INTSTS2 0x0c
62 #define G42XXEB_INTCNTL 0x0e
63 #define G42XXEB_INTCNTH 0x10
64 #define G42XXEB_INTMASK 0x14
65
66 #define G42XXEB_INT_MMCSD 0
67 #define G42XXEB_INT_SDIO 1
68 #define G42XXEB_INT_EXT0 2
69 #define G42XXEB_INT_EXT1 3
70 #define G42XXEB_INT_USB 4
71 #define G42XXEB_INT_ETH 5
72 #define G42XXEB_INT_CODEC 6
73 #define G42XXEB_INT_EXT2 7
74 #define G42XXEB_INT_KEY 8
75 #define G42XXEB_INT_EXT3 9
76
77 #define G42XXEB_N_INTS 10
78
79 /* interrupt type */
80 #define G42XXEB_INT_LEVEL_LOW 0
81 #define G42XXEB_INT_LEVEL_HIGH 1
82 #define G42XXEB_INT_EDGE_FALLING 4
83 #define G42XXEB_INT_EDGE_RISING 5
84 #define G42XXEB_INT_EDGE_BOTH 6
85
86
87 #define G42XXEB_DIPSW 0x16
88 #define G42XXEB_LED 0x18
89
90 #define G42XXEB_RST 0x1a
91 #define RST_ASIX88796 (1<<0)
92 #define RST_EXT(n) (1<<((n)+1))
93 #define G42XXEB_EXTCTRL 0x1c
94 #define G42XXEB_OPTBRDID 0x20
95 #define G42XXEB_PLDVER 0x22
96
97
98 #define G42XXEB_LCDCTL 0x28
99 #define LCDCTL_BL_ON (1<<7)
100 #define LCDCTL_DPSH (1<<1)
101 #define LCDCTL_DPSV (1<<0)
102 #define LCDCTL_BL_PWM_SHIFT 8 /* Backlight blightness */
103 #define LCDCTL_BL_PWN (0xff<<LCDCTL_BL_PWM_SHIFT)
104
105 #define G42XXEB_KEYSCAN 0x2a
106 #define KEYSCAN_SCAN_OUT 0x1f00
107 #define KEYSCAN_SENSE_IN 0x0f
108 #define G42XXEB_WP 0x2c // SD/MMC write protect status
109
110 #define ioreg_read(a) (*(volatile unsigned *)(a))
111 #define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v))
112
113 #define ioreg16_read(a) (*(volatile uint16_t *)(a))
114 #define ioreg16_write(a,v) (*(volatile uint16_t *)(a)=(v))
115
116 #define ioreg8_read(a) (*(volatile uint8_t *)(a))
117 #define ioreg8_write(a,v) (*(volatile uint8_t *)(a)=(v))
118
119 #define pldreg16_read(off) ioreg16_read(G42XXEB_PLDREG_VBASE+(off))
120 #define pldreg16_write(off,v) ioreg16_write(G42XXEB_PLDREG_VBASE+(off),v)
121 #define pldreg8_read(off) ioreg8_read(G42XXEB_PLDREG_VBASE+(off))
122 #define pldreg8_write(off,v) ioreg8_write(G42XXEB_PLDREG_VBASE+(off),v)
123
124 #endif /* _EVBARM_G42XXEB_REG_H */
125