1 /*
2 *
3 * Definitions for H3600 Handheld Computer
4 *
5 * Copyright 2000 Compaq Computer Corporation.
6 *
7 * Use consistent with the GNU GPL is permitted,
8 * provided that this copyright notice is
9 * preserved in its entirety in all copies and derived works.
10 *
11 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
12 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
13 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 *
15 * Author: Jamey Hicks.
16 *
17 * History:
18 *
19 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
20 *
21 */
22
23 #ifndef _INCLUDE_H3600_H_
24 #define _INCLUDE_H3600_H_
25
26 #include <linux/config.h>
27
28 /* generalized support for H3xxx series Compaq Pocket PC's */
29 #define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800())
30
31 /* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
32 #define H3600_EGPIO_VIRT 0xf0000000
33 #define H3600_BANK_2_VIRT 0xf1000000
34 #define H3600_BANK_4_VIRT 0xf3800000
35
36 /*
37 Machine-independent GPIO definitions
38 --- these are common across all current iPAQ platforms
39 */
40
41 #define GPIO_H3600_NPOWER_BUTTON GPIO_GPIO (0) /* Also known as the "off button" */
42 #define GPIO_H3600_MICROCONTROLLER GPIO_GPIO (1) /* From ASIC2 on H3800 */
43
44 #define GPIO_H3600_PCMCIA_CD1 GPIO_GPIO (10)
45 #define GPIO_H3600_PCMCIA_IRQ1 GPIO_GPIO (11)
46
47 /* UDA1341 L3 Interface */
48 #define GPIO_H3600_L3_DATA GPIO_GPIO (14)
49 #define GPIO_H3600_L3_MODE GPIO_GPIO (15)
50 #define GPIO_H3600_L3_CLOCK GPIO_GPIO (16)
51
52 #define GPIO_H3600_PCMCIA_CD0 GPIO_GPIO (17)
53 #define GPIO_H3600_SYS_CLK GPIO_GPIO (19)
54 #define GPIO_H3600_PCMCIA_IRQ0 GPIO_GPIO (21)
55
56 #define GPIO_H3600_COM_DCD GPIO_GPIO (23)
57 #define GPIO_H3600_OPT_IRQ GPIO_GPIO (24)
58 #define GPIO_H3600_COM_CTS GPIO_GPIO (25)
59 #define GPIO_H3600_COM_RTS GPIO_GPIO (26)
60
61 #define IRQ_GPIO_H3600_NPOWER_BUTTON IRQ_GPIO0
62 #define IRQ_GPIO_H3600_MICROCONTROLLER IRQ_GPIO1
63 #define IRQ_GPIO_H3600_PCMCIA_CD1 IRQ_GPIO10
64 #define IRQ_GPIO_H3600_PCMCIA_IRQ1 IRQ_GPIO11
65 #define IRQ_GPIO_H3600_PCMCIA_CD0 IRQ_GPIO17
66 #define IRQ_GPIO_H3600_PCMCIA_IRQ0 IRQ_GPIO21
67 #define IRQ_GPIO_H3600_COM_DCD IRQ_GPIO23
68 #define IRQ_GPIO_H3600_OPT_IRQ IRQ_GPIO24
69 #define IRQ_GPIO_H3600_COM_CTS IRQ_GPIO25
70
71
72 #ifndef __ASSEMBLY__
73 enum ipaq_model {
74 IPAQ_H3100,
75 IPAQ_H3600,
76 IPAQ_H3800
77 };
78
79 enum ipaq_egpio_type {
80 IPAQ_EGPIO_LCD_ON, /* Power to the LCD panel */
81 IPAQ_EGPIO_CODEC_NRESET, /* Clear to reset the audio codec (remember to return high) */
82 IPAQ_EGPIO_AUDIO_ON, /* Audio power */
83 IPAQ_EGPIO_QMUTE, /* Audio muting */
84 IPAQ_EGPIO_OPT_NVRAM_ON, /* Non-volatile RAM on extension sleeves (SPI interface) */
85 IPAQ_EGPIO_OPT_ON, /* Power to extension sleeves */
86 IPAQ_EGPIO_CARD_RESET, /* Reset PCMCIA cards on extension sleeve (???) */
87 IPAQ_EGPIO_OPT_RESET, /* Reset option pack (???) */
88 IPAQ_EGPIO_IR_ON, /* IR sensor/emitter power */
89 IPAQ_EGPIO_IR_FSEL, /* IR speed selection 1->fast, 0->slow */
90 IPAQ_EGPIO_RS232_ON, /* Maxim RS232 chip power */
91 IPAQ_EGPIO_VPP_ON, /* Turn on power to flash programming */
92 };
93
94 struct ipaq_model_ops {
95 enum ipaq_model model;
96 const char *generic_name;
97 void (*initialize)(void);
98 void (*control)(enum ipaq_egpio_type, int);
99 unsigned long (*read)(void);
100 };
101
102 extern struct ipaq_model_ops ipaq_model_ops;
103
104 #ifdef CONFIG_SA1100_H3XXX
h3600_model(void)105 static __inline__ enum ipaq_model h3600_model( void ) {
106 return ipaq_model_ops.model;
107 }
108
h3600_generic_name(void)109 static __inline__ const char * h3600_generic_name( void ) {
110 return ipaq_model_ops.generic_name;
111 }
112
init_h3600_egpio(void)113 static __inline__ void init_h3600_egpio( void ) {
114 if (ipaq_model_ops.initialize)
115 ipaq_model_ops.initialize();
116 }
117
assign_h3600_egpio(enum ipaq_egpio_type x,int level)118 static __inline__ void assign_h3600_egpio( enum ipaq_egpio_type x, int level ) {
119 if (ipaq_model_ops.control)
120 ipaq_model_ops.control(x,level);
121 }
122
clr_h3600_egpio(enum ipaq_egpio_type x)123 static __inline__ void clr_h3600_egpio( enum ipaq_egpio_type x ) {
124 if (ipaq_model_ops.control)
125 ipaq_model_ops.control(x,0);
126 }
127
set_h3600_egpio(enum ipaq_egpio_type x)128 static __inline__ void set_h3600_egpio( enum ipaq_egpio_type x ) {
129 if (ipaq_model_ops.control)
130 ipaq_model_ops.control(x,1);
131 }
132
read_h3600_egpio(void)133 static __inline__ unsigned long read_h3600_egpio( void ) {
134 if (ipaq_model_ops.read)
135 return ipaq_model_ops.read();
136 return 0;
137 }
138
139 #else
140
141 /*
142 * This allows some drives to loose some ifdefs
143 */
144 #define assign_h3600_egpio(x,y) do { } while (0)
145 #define clr_h3600_egpio(x) do { } while (0)
146 #define set_h3600_egpio(x) do { } while (0)
147 #define read_h3600_egpio() (0)
148
149 #endif
150
151 #endif /* ASSEMBLY */
152
153 #endif /* _INCLUDE_H3600_H_ */
154