• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 typedef int __bitwise pm_request_t;
27 
28 #define PM_SUSPEND	((__force pm_request_t) 1)	/* enter D1-D3 */
29 #define PM_RESUME	((__force pm_request_t) 2)	/* enter D0 */
30 
31 /* generalized support for H3xxx series Compaq Pocket PC's */
32 #define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800())
33 
34 /* Physical memory regions corresponding to chip selects */
35 #define H3600_EGPIO_PHYS	(SA1100_CS5_PHYS + 0x01000000)
36 #define H3600_BANK_2_PHYS	SA1100_CS2_PHYS
37 #define H3600_BANK_4_PHYS	SA1100_CS4_PHYS
38 
39 /* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
40 #define H3600_EGPIO_VIRT	0xf0000000
41 #define H3600_BANK_2_VIRT	0xf1000000
42 #define H3600_BANK_4_VIRT	0xf3800000
43 
44 /*
45    Machine-independent GPIO definitions
46    --- these are common across all current iPAQ platforms
47 */
48 
49 #define GPIO_H3600_NPOWER_BUTTON	GPIO_GPIO (0)	/* Also known as the "off button"  */
50 
51 #define GPIO_H3600_PCMCIA_CD1		GPIO_GPIO (10)
52 #define GPIO_H3600_PCMCIA_IRQ1		GPIO_GPIO (11)
53 
54 /* UDA1341 L3 Interface */
55 #define GPIO_H3600_L3_DATA		GPIO_GPIO (14)
56 #define GPIO_H3600_L3_MODE		GPIO_GPIO (15)
57 #define GPIO_H3600_L3_CLOCK		GPIO_GPIO (16)
58 
59 #define GPIO_H3600_PCMCIA_CD0		GPIO_GPIO (17)
60 #define GPIO_H3600_SYS_CLK		GPIO_GPIO (19)
61 #define GPIO_H3600_PCMCIA_IRQ0		GPIO_GPIO (21)
62 
63 #define GPIO_H3600_COM_DCD		GPIO_GPIO (23)
64 #define GPIO_H3600_OPT_IRQ		GPIO_GPIO (24)
65 #define GPIO_H3600_COM_CTS		GPIO_GPIO (25)
66 #define GPIO_H3600_COM_RTS		GPIO_GPIO (26)
67 
68 #define IRQ_GPIO_H3600_NPOWER_BUTTON	IRQ_GPIO0
69 #define IRQ_GPIO_H3600_PCMCIA_CD1	IRQ_GPIO10
70 #define IRQ_GPIO_H3600_PCMCIA_IRQ1	IRQ_GPIO11
71 #define IRQ_GPIO_H3600_PCMCIA_CD0	IRQ_GPIO17
72 #define IRQ_GPIO_H3600_PCMCIA_IRQ0	IRQ_GPIO21
73 #define IRQ_GPIO_H3600_COM_DCD		IRQ_GPIO23
74 #define IRQ_GPIO_H3600_OPT_IRQ		IRQ_GPIO24
75 #define IRQ_GPIO_H3600_COM_CTS		IRQ_GPIO25
76 
77 
78 #ifndef __ASSEMBLY__
79 
80 enum ipaq_egpio_type {
81 	IPAQ_EGPIO_LCD_POWER,	  /* Power to the LCD panel */
82 	IPAQ_EGPIO_CODEC_NRESET,  /* Clear to reset the audio codec (remember to return high) */
83 	IPAQ_EGPIO_AUDIO_ON,	  /* Audio power */
84 	IPAQ_EGPIO_QMUTE,	  /* Audio muting */
85 	IPAQ_EGPIO_OPT_NVRAM_ON,  /* Non-volatile RAM on extension sleeves (SPI interface) */
86 	IPAQ_EGPIO_OPT_ON,	  /* Power to extension sleeves */
87 	IPAQ_EGPIO_CARD_RESET,	  /* Reset PCMCIA cards on extension sleeve (???) */
88 	IPAQ_EGPIO_OPT_RESET,	  /* Reset option pack (???) */
89 	IPAQ_EGPIO_IR_ON,	  /* IR sensor/emitter power */
90 	IPAQ_EGPIO_IR_FSEL,	  /* IR speed selection 1->fast, 0->slow */
91 	IPAQ_EGPIO_RS232_ON,	  /* Maxim RS232 chip power */
92 	IPAQ_EGPIO_VPP_ON,	  /* Turn on power to flash programming */
93 	IPAQ_EGPIO_LCD_ENABLE,	  /* Enable/disable LCD controller */
94 };
95 
96 struct ipaq_model_ops {
97 	const char     *generic_name;
98 	void	      (*control)(enum ipaq_egpio_type, int);
99 	unsigned long (*read)(void);
100 	void	      (*blank_callback)(int blank);
101 	int	      (*pm_callback)(int req);	    /* Primary model callback */
102 	int	      (*pm_callback_aux)(int req);  /* Secondary callback (used by HAL modules) */
103 };
104 
105 extern struct ipaq_model_ops ipaq_model_ops;
106 
h3600_generic_name(void)107 static __inline__ const char * h3600_generic_name(void)
108 {
109 	return ipaq_model_ops.generic_name;
110 }
111 
assign_h3600_egpio(enum ipaq_egpio_type x,int level)112 static __inline__ void assign_h3600_egpio(enum ipaq_egpio_type x, int level)
113 {
114 	if (ipaq_model_ops.control)
115 		ipaq_model_ops.control(x,level);
116 }
117 
clr_h3600_egpio(enum ipaq_egpio_type x)118 static __inline__ void clr_h3600_egpio(enum ipaq_egpio_type x)
119 {
120 	if (ipaq_model_ops.control)
121 		ipaq_model_ops.control(x,0);
122 }
123 
set_h3600_egpio(enum ipaq_egpio_type x)124 static __inline__ void set_h3600_egpio(enum ipaq_egpio_type x)
125 {
126 	if (ipaq_model_ops.control)
127 		ipaq_model_ops.control(x,1);
128 }
129 
read_h3600_egpio(void)130 static __inline__ unsigned long read_h3600_egpio(void)
131 {
132 	if (ipaq_model_ops.read)
133 		return ipaq_model_ops.read();
134 	return 0;
135 }
136 
h3600_register_blank_callback(void (* f)(int))137 static __inline__ int  h3600_register_blank_callback(void (*f)(int))
138 {
139 	ipaq_model_ops.blank_callback = f;
140 	return 0;
141 }
142 
h3600_unregister_blank_callback(void (* f)(int))143 static __inline__ void h3600_unregister_blank_callback(void (*f)(int))
144 {
145 	ipaq_model_ops.blank_callback = NULL;
146 }
147 
148 
h3600_register_pm_callback(int (* f)(int))149 static __inline__ int  h3600_register_pm_callback(int (*f)(int))
150 {
151 	ipaq_model_ops.pm_callback_aux = f;
152 	return 0;
153 }
154 
h3600_unregister_pm_callback(int (* f)(int))155 static __inline__ void h3600_unregister_pm_callback(int (*f)(int))
156 {
157 	ipaq_model_ops.pm_callback_aux = NULL;
158 }
159 
h3600_power_management(int req)160 static __inline__ int h3600_power_management(int req)
161 {
162 	if (ipaq_model_ops.pm_callback)
163 		return ipaq_model_ops.pm_callback(req);
164 	return 0;
165 }
166 
167 #endif /* ASSEMBLY */
168 
169 #endif /* _INCLUDE_H3600_H_ */
170