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