blob: 10ea59594b71abf6acbc75e55cca495918fb20ac [file] [log] [blame]
Andres Salomon3ef0e1f2008-04-29 00:59:53 -07001/* OLPC machine specific definitions */
2
H. Peter Anvin1965aae2008-10-22 22:26:29 -07003#ifndef _ASM_X86_OLPC_H
4#define _ASM_X86_OLPC_H
Andres Salomon3ef0e1f2008-04-29 00:59:53 -07005
6#include <asm/geode.h>
7
8struct olpc_platform_t {
9 int flags;
10 uint32_t boardrev;
11 int ecver;
12};
13
14#define OLPC_F_PRESENT 0x01
15#define OLPC_F_DCON 0x02
Andres Salomon3ef0e1f2008-04-29 00:59:53 -070016
17#ifdef CONFIG_OLPC
18
19extern struct olpc_platform_t olpc_platform_info;
20
21/*
22 * OLPC board IDs contain the major build number within the mask 0x0ff0,
Lucas De Marchi0d2eb442011-03-17 16:24:16 -030023 * and the minor build number within 0x000f. Pre-builds have a minor
Andres Salomon3ef0e1f2008-04-29 00:59:53 -070024 * number less than 8, and normal builds start at 8. For example, 0x0B10
25 * is a PreB1, and 0x0C18 is a C1.
26 */
27
28static inline uint32_t olpc_board(uint8_t id)
29{
30 return (id << 4) | 0x8;
31}
32
33static inline uint32_t olpc_board_pre(uint8_t id)
34{
35 return id << 4;
36}
37
38static inline int machine_is_olpc(void)
39{
40 return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
41}
42
43/*
44 * The DCON is OLPC's Display Controller. It has a number of unique
45 * features that we might want to take advantage of..
46 */
47static inline int olpc_has_dcon(void)
48{
49 return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
50}
51
52/*
Andres Salomon3ef0e1f2008-04-29 00:59:53 -070053 * The "Mass Production" version of OLPC's XO is identified as being model
54 * C2. During the prototype phase, the following models (in chronological
55 * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models
56 * were based on Geode GX CPUs, and models after that were based upon
57 * Geode LX CPUs. There were also some hand-assembled models floating
58 * around, referred to as PreB1, PreB2, etc.
59 */
60static inline int olpc_board_at_least(uint32_t rev)
61{
62 return olpc_platform_info.boardrev >= rev;
63}
64
65#else
66
67static inline int machine_is_olpc(void)
68{
69 return 0;
70}
71
72static inline int olpc_has_dcon(void)
73{
74 return 0;
75}
76
Andres Salomon3ef0e1f2008-04-29 00:59:53 -070077#endif
78
Daniel Drake97c4cb72011-06-25 17:34:11 +010079#ifdef CONFIG_OLPC_XO1_PM
80extern void do_olpc_suspend_lowlevel(void);
81extern void olpc_xo1_pm_wakeup_set(u16 value);
82extern void olpc_xo1_pm_wakeup_clear(u16 value);
83#endif
84
Thomas Gleixnerd5d0e882010-02-22 05:42:04 -080085extern int pci_olpc_init(void);
86
Andres Salomon3ef0e1f2008-04-29 00:59:53 -070087/* EC related functions */
88
89extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
90 unsigned char *outbuf, size_t outlen);
91
92extern int olpc_ec_mask_set(uint8_t bits);
93extern int olpc_ec_mask_unset(uint8_t bits);
94
95/* EC commands */
96
Daniel Drake97c4cb72011-06-25 17:34:11 +010097#define EC_FIRMWARE_REV 0x08
98#define EC_WAKE_UP_WLAN 0x24
99#define EC_WLAN_LEAVE_RESET 0x25
100#define EC_SET_SCI_INHIBIT 0x32
101#define EC_SET_SCI_INHIBIT_RELEASE 0x34
102#define EC_WLAN_ENTER_RESET 0x35
Andres Salomon3ef0e1f2008-04-29 00:59:53 -0700103
104/* SCI source values */
105
106#define EC_SCI_SRC_EMPTY 0x00
107#define EC_SCI_SRC_GAME 0x01
108#define EC_SCI_SRC_BATTERY 0x02
109#define EC_SCI_SRC_BATSOC 0x04
110#define EC_SCI_SRC_BATERR 0x08
111#define EC_SCI_SRC_EBOOK 0x10
112#define EC_SCI_SRC_WLAN 0x20
113#define EC_SCI_SRC_ACPWR 0x40
114#define EC_SCI_SRC_ALL 0x7F
115
116/* GPIO assignments */
117
Andres Salomon3c554942009-12-14 18:00:36 -0800118#define OLPC_GPIO_MIC_AC 1
Andres Salomon7637c922011-01-12 17:00:11 -0800119#define OLPC_GPIO_DCON_STAT0 5
120#define OLPC_GPIO_DCON_STAT1 6
121#define OLPC_GPIO_DCON_IRQ 7
Andres Salomon3ef0e1f2008-04-29 00:59:53 -0700122#define OLPC_GPIO_THRM_ALRM geode_gpio(10)
Andres Salomon7637c922011-01-12 17:00:11 -0800123#define OLPC_GPIO_DCON_LOAD 11
124#define OLPC_GPIO_DCON_BLANK 12
125#define OLPC_GPIO_SMB_CLK 14
126#define OLPC_GPIO_SMB_DATA 15
Andres Salomon3ef0e1f2008-04-29 00:59:53 -0700127#define OLPC_GPIO_WORKAUX geode_gpio(24)
128#define OLPC_GPIO_LID geode_gpio(26)
129#define OLPC_GPIO_ECSCI geode_gpio(27)
130
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700131#endif /* _ASM_X86_OLPC_H */