1 /*
2  * arch/arm/mach-sa1100/include/mach/simpad.h
3  *
4  * based of assabet.h same as HUW_Webpanel
5  *
6  * This file contains the hardware specific definitions for SIMpad
7  *
8  * 2001/05/14 Juergen Messerer <juergen.messerer@freesurf.ch>
9  */
10 
11 #ifndef __ASM_ARCH_SIMPAD_H
12 #define __ASM_ARCH_SIMPAD_H
13 
14 
15 #define GPIO_UART1_RTS	GPIO_GPIO14
16 #define GPIO_UART1_DTR	GPIO_GPIO7
17 #define GPIO_UART1_CTS	GPIO_GPIO8
18 #define GPIO_UART1_DCD	GPIO_GPIO23
19 #define GPIO_UART1_DSR	GPIO_GPIO6
20 
21 #define GPIO_UART3_RTS	GPIO_GPIO12
22 #define GPIO_UART3_DTR	GPIO_GPIO16
23 #define GPIO_UART3_CTS	GPIO_GPIO13
24 #define GPIO_UART3_DCD	GPIO_GPIO18
25 #define GPIO_UART3_DSR	GPIO_GPIO17
26 
27 #define GPIO_POWER_BUTTON	GPIO_GPIO0
28 #define GPIO_UCB1300_IRQ	GPIO_GPIO22	/* UCB GPIO and touchscreen */
29 
30 #define IRQ_UART1_CTS	IRQ_GPIO15
31 #define IRQ_UART1_DCD	GPIO_GPIO23
32 #define IRQ_UART1_DSR	GPIO_GPIO6
33 #define IRQ_UART3_CTS	GPIO_GPIO13
34 #define IRQ_UART3_DCD	GPIO_GPIO18
35 #define IRQ_UART3_DSR	GPIO_GPIO17
36 
37 #define IRQ_GPIO_UCB1300_IRQ IRQ_GPIO22
38 #define IRQ_GPIO_POWER_BUTTON IRQ_GPIO0
39 
40 
41 /*---  PCMCIA  ---*/
42 #define GPIO_CF_CD              GPIO_GPIO24
43 #define GPIO_CF_IRQ             GPIO_GPIO1
44 #define IRQ_GPIO_CF_IRQ         IRQ_GPIO1
45 #define IRQ_GPIO_CF_CD          IRQ_GPIO24
46 
47 /*--- SmartCard ---*/
48 #define GPIO_SMART_CARD		GPIO_GPIO10
49 #define IRQ_GPIO_SMARD_CARD	IRQ_GPIO10
50 
51 /*--- ucb1x00 GPIO ---*/
52 #define SIMPAD_UCB1X00_GPIO_BASE	(GPIO_MAX + 1)
53 #define SIMPAD_UCB1X00_GPIO_PROG1	(SIMPAD_UCB1X00_GPIO_BASE)
54 #define SIMPAD_UCB1X00_GPIO_PROG2	(SIMPAD_UCB1X00_GPIO_BASE + 1)
55 #define SIMPAD_UCB1X00_GPIO_UP		(SIMPAD_UCB1X00_GPIO_BASE + 2)
56 #define SIMPAD_UCB1X00_GPIO_DOWN	(SIMPAD_UCB1X00_GPIO_BASE + 3)
57 #define SIMPAD_UCB1X00_GPIO_LEFT	(SIMPAD_UCB1X00_GPIO_BASE + 4)
58 #define SIMPAD_UCB1X00_GPIO_RIGHT	(SIMPAD_UCB1X00_GPIO_BASE + 5)
59 #define SIMPAD_UCB1X00_GPIO_6		(SIMPAD_UCB1X00_GPIO_BASE + 6)
60 #define SIMPAD_UCB1X00_GPIO_7		(SIMPAD_UCB1X00_GPIO_BASE + 7)
61 #define SIMPAD_UCB1X00_GPIO_HEADSET	(SIMPAD_UCB1X00_GPIO_BASE + 8)
62 #define SIMPAD_UCB1X00_GPIO_SPEAKER	(SIMPAD_UCB1X00_GPIO_BASE + 9)
63 
64 /*--- CS3 Latch ---*/
65 #define SIMPAD_CS3_GPIO_BASE		(GPIO_MAX + 11)
66 #define SIMPAD_CS3_VCC_5V_EN		(SIMPAD_CS3_GPIO_BASE)
67 #define SIMPAD_CS3_VCC_3V_EN		(SIMPAD_CS3_GPIO_BASE + 1)
68 #define SIMPAD_CS3_EN1			(SIMPAD_CS3_GPIO_BASE + 2)
69 #define SIMPAD_CS3_EN0			(SIMPAD_CS3_GPIO_BASE + 3)
70 #define SIMPAD_CS3_DISPLAY_ON		(SIMPAD_CS3_GPIO_BASE + 4)
71 #define SIMPAD_CS3_PCMCIA_BUFF_DIS	(SIMPAD_CS3_GPIO_BASE + 5)
72 #define SIMPAD_CS3_MQ_RESET		(SIMPAD_CS3_GPIO_BASE + 6)
73 #define SIMPAD_CS3_PCMCIA_RESET		(SIMPAD_CS3_GPIO_BASE + 7)
74 #define SIMPAD_CS3_DECT_POWER_ON	(SIMPAD_CS3_GPIO_BASE + 8)
75 #define SIMPAD_CS3_IRDA_SD		(SIMPAD_CS3_GPIO_BASE + 9)
76 #define SIMPAD_CS3_RS232_ON		(SIMPAD_CS3_GPIO_BASE + 10)
77 #define SIMPAD_CS3_SD_MEDIAQ		(SIMPAD_CS3_GPIO_BASE + 11)
78 #define SIMPAD_CS3_LED2_ON		(SIMPAD_CS3_GPIO_BASE + 12)
79 #define SIMPAD_CS3_IRDA_MODE		(SIMPAD_CS3_GPIO_BASE + 13)
80 #define SIMPAD_CS3_ENABLE_5V		(SIMPAD_CS3_GPIO_BASE + 14)
81 #define SIMPAD_CS3_RESET_SIMCARD	(SIMPAD_CS3_GPIO_BASE + 15)
82 
83 #define SIMPAD_CS3_PCMCIA_BVD1		(SIMPAD_CS3_GPIO_BASE + 16)
84 #define SIMPAD_CS3_PCMCIA_BVD2		(SIMPAD_CS3_GPIO_BASE + 17)
85 #define SIMPAD_CS3_PCMCIA_VS1		(SIMPAD_CS3_GPIO_BASE + 18)
86 #define SIMPAD_CS3_PCMCIA_VS2		(SIMPAD_CS3_GPIO_BASE + 19)
87 #define SIMPAD_CS3_LOCK_IND		(SIMPAD_CS3_GPIO_BASE + 20)
88 #define SIMPAD_CS3_CHARGING_STATE	(SIMPAD_CS3_GPIO_BASE + 21)
89 #define SIMPAD_CS3_PCMCIA_SHORT		(SIMPAD_CS3_GPIO_BASE + 22)
90 #define SIMPAD_CS3_GPIO_23		(SIMPAD_CS3_GPIO_BASE + 23)
91 
92 #define CS3_BASE        0xf1000000
93 
94 long simpad_get_cs3_ro(void);
95 long simpad_get_cs3_shadow(void);
96 void simpad_set_cs3_bit(int value);
97 void simpad_clear_cs3_bit(int value);
98 
99 #define VCC_5V_EN	0x0001 /* For 5V PCMCIA */
100 #define VCC_3V_EN	0x0002 /* FOR 3.3V PCMCIA */
101 #define EN1		0x0004 /* This is only for EPROM's */
102 #define EN0		0x0008 /* Both should be enable for 3.3V or 5V */
103 #define DISPLAY_ON	0x0010
104 #define PCMCIA_BUFF_DIS	0x0020
105 #define MQ_RESET	0x0040
106 #define PCMCIA_RESET	0x0080
107 #define DECT_POWER_ON	0x0100
108 #define IRDA_SD		0x0200 /* Shutdown for powersave */
109 #define RS232_ON	0x0400
110 #define SD_MEDIAQ	0x0800 /* Shutdown for powersave */
111 #define LED2_ON		0x1000
112 #define IRDA_MODE	0x2000 /* Fast/Slow IrDA mode */
113 #define ENABLE_5V	0x4000 /* Enable 5V circuit */
114 #define RESET_SIMCARD	0x8000
115 
116 #define PCMCIA_BVD1	0x01
117 #define PCMCIA_BVD2	0x02
118 #define PCMCIA_VS1	0x04
119 #define PCMCIA_VS2	0x08
120 #define LOCK_IND	0x10
121 #define CHARGING_STATE	0x20
122 #define PCMCIA_SHORT	0x40
123 
124 /*--- Battery ---*/
125 struct simpad_battery {
126 	unsigned char ac_status;	/* line connected yes/no */
127 	unsigned char status;		/* battery loading yes/no */
128 	unsigned char percentage;	/* percentage loaded */
129 	unsigned short life;		/* life till empty */
130 };
131 
132 /* These should match the apm_bios.h definitions */
133 #define SIMPAD_AC_STATUS_AC_OFFLINE      0x00
134 #define SIMPAD_AC_STATUS_AC_ONLINE       0x01
135 #define SIMPAD_AC_STATUS_AC_BACKUP       0x02   /* What does this mean? */
136 #define SIMPAD_AC_STATUS_AC_UNKNOWN      0xff
137 
138 /* These bitfields are rarely "or'd" together */
139 #define SIMPAD_BATT_STATUS_HIGH          0x01
140 #define SIMPAD_BATT_STATUS_LOW           0x02
141 #define SIMPAD_BATT_STATUS_CRITICAL      0x04
142 #define SIMPAD_BATT_STATUS_CHARGING      0x08
143 #define SIMPAD_BATT_STATUS_CHARGE_MAIN   0x10
144 #define SIMPAD_BATT_STATUS_DEAD          0x20   /* Battery will not charge */
145 #define SIMPAD_BATT_NOT_INSTALLED        0x20   /* For expansion pack batteries */
146 #define SIMPAD_BATT_STATUS_FULL          0x40   /* Battery fully charged (and connected to AC) */
147 #define SIMPAD_BATT_STATUS_NOBATT        0x80
148 #define SIMPAD_BATT_STATUS_UNKNOWN       0xff
149 
150 extern int simpad_get_battery(struct simpad_battery* );
151 
152 #endif // __ASM_ARCH_SIMPAD_H
153 
154 
155 
156 
157 
158 
159 
160 
161