Update olpc target kernel to 2.26.5.
[openwrt.git] / target / linux / olpc / files-2.6.23 / include / asm-i386 / olpc.h
1 /* OLPC machine specific definitions */
2
3 #ifndef ASM_OLPC_H_
4 #define ASM_OLPC_H_
5
6 #include <asm/geode.h>
7
8 struct olpc_platform_t {
9         int flags;
10         int boardrev;
11         int ecver;
12 };
13
14 #define OLPC_F_PRESENT 0x01
15 #define OLPC_F_DCON    0x02
16 #define OLPC_F_VSA     0x04
17
18 enum
19 {
20         OLPC_REV_A = 0,
21
22         OLPC_REV_PRE_B1,
23         OLPC_REV_B1,
24         OLPC_REV_PRE_B2,
25         OLPC_REV_B2,
26         OLPC_REV_PRE_B3,
27         OLPC_REV_B3,
28         OLPC_REV_B4,
29         OLPC_REV_C1,
30         OLPC_REV_R1,
31         OLPC_REV_UNKNOWN        /* this should always come last */
32 };
33
34 #ifndef CONFIG_OLPC
35
36 static inline int machine_is_olpc(void) { return 0; }
37 static inline int olpc_has_dcon(void) { return 0; }
38 static inline int olpc_has_vsa(void) { return 0; }
39 static inline int olpc_get_rev(void) { return OLPC_REV_UNKNOWN; }
40
41 #else
42
43 extern struct olpc_platform_t olpc_platform_info;
44
45 static inline int
46 machine_is_olpc(void)
47 {
48         return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
49 }
50
51 static inline int
52 olpc_has_dcon(void)
53 {
54         return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
55 }
56
57 static inline int
58 olpc_has_vsa(void)
59 {
60         return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0;
61 }
62
63 static inline int
64 olpc_get_rev(void)
65 {
66         return olpc_platform_info.boardrev;
67 }
68
69 static inline int
70 olpc_rev_after(int rev)
71 {
72         return olpc_platform_info.boardrev > rev &&
73                         olpc_platform_info.boardrev != OLPC_REV_UNKNOWN;
74 }
75
76 static inline int
77 olpc_rev_before(int rev)
78 {
79         return olpc_platform_info.boardrev < rev ||
80                         olpc_platform_info.boardrev == OLPC_REV_UNKNOWN;
81 }
82
83 #endif
84
85 /* EC functions */
86
87 int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
88                 unsigned char *outbuf, size_t outlen);
89
90 void olpc_register_battery_callback(void (*f)(unsigned long));
91 void olpc_deregister_battery_callback(void);
92
93 /* EC commands and responses */
94
95 /* SCI source values */
96
97 #define EC_SCI_SRC_EMPTY   0x00
98 #define EC_SCI_SRC_GAME    0x01
99 #define EC_SCI_SRC_BATTERY 0x02
100 #define EC_SCI_SRC_BATSOC  0x04
101 #define EC_SCI_SRC_BATERR  0x08
102 #define EC_SCI_SRC_EBOOK   0x10
103 #define EC_SCI_SRC_WLAN    0x20
104 #define EC_SCI_SRC_ACPWR   0x40
105
106 /* GPIO assignments */
107
108 #define OLPC_GPIO_MIC_AC      1
109 #define OLPC_GPIO_DCON_IRQ    7
110 #define OLPC_GPIO_THRM_ALRM  10
111 #define OLPC_GPIO_WORKAUX    24
112 #define OLPC_GPIO_LID        26
113 #define OLPC_GPIO_ECSCI      27
114
115 #endif
116