Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 2 | /* OLPC machine specific definitions */ |
| 3 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 4 | #ifndef _ASM_X86_OLPC_H |
| 5 | #define _ASM_X86_OLPC_H |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 6 | |
| 7 | #include <asm/geode.h> |
| 8 | |
| 9 | struct olpc_platform_t { |
| 10 | int flags; |
| 11 | uint32_t boardrev; |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 12 | }; |
| 13 | |
| 14 | #define OLPC_F_PRESENT 0x01 |
| 15 | #define OLPC_F_DCON 0x02 |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 16 | |
| 17 | #ifdef CONFIG_OLPC |
| 18 | |
| 19 | extern struct olpc_platform_t olpc_platform_info; |
| 20 | |
| 21 | /* |
| 22 | * OLPC board IDs contain the major build number within the mask 0x0ff0, |
Lucas De Marchi | 0d2eb44 | 2011-03-17 16:24:16 -0300 | [diff] [blame] | 23 | * and the minor build number within 0x000f. Pre-builds have a minor |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 24 | * number less than 8, and normal builds start at 8. For example, 0x0B10 |
| 25 | * is a PreB1, and 0x0C18 is a C1. |
| 26 | */ |
| 27 | |
| 28 | static inline uint32_t olpc_board(uint8_t id) |
| 29 | { |
| 30 | return (id << 4) | 0x8; |
| 31 | } |
| 32 | |
| 33 | static inline uint32_t olpc_board_pre(uint8_t id) |
| 34 | { |
| 35 | return id << 4; |
| 36 | } |
| 37 | |
| 38 | static 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 | */ |
| 47 | static inline int olpc_has_dcon(void) |
| 48 | { |
| 49 | return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0; |
| 50 | } |
| 51 | |
| 52 | /* |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 53 | * 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 | */ |
| 60 | static inline int olpc_board_at_least(uint32_t rev) |
| 61 | { |
| 62 | return olpc_platform_info.boardrev >= rev; |
| 63 | } |
| 64 | |
| 65 | #else |
| 66 | |
| 67 | static inline int machine_is_olpc(void) |
| 68 | { |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | static inline int olpc_has_dcon(void) |
| 73 | { |
| 74 | return 0; |
| 75 | } |
| 76 | |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 77 | #endif |
| 78 | |
Daniel Drake | 97c4cb7 | 2011-06-25 17:34:11 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_OLPC_XO1_PM |
| 80 | extern void do_olpc_suspend_lowlevel(void); |
| 81 | extern void olpc_xo1_pm_wakeup_set(u16 value); |
| 82 | extern void olpc_xo1_pm_wakeup_clear(u16 value); |
| 83 | #endif |
| 84 | |
Thomas Gleixner | d5d0e88 | 2010-02-22 05:42:04 -0800 | [diff] [blame] | 85 | extern int pci_olpc_init(void); |
| 86 | |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 87 | /* GPIO assignments */ |
| 88 | |
Andres Salomon | 3c55494 | 2009-12-14 18:00:36 -0800 | [diff] [blame] | 89 | #define OLPC_GPIO_MIC_AC 1 |
Andres Salomon | 7637c92 | 2011-01-12 17:00:11 -0800 | [diff] [blame] | 90 | #define OLPC_GPIO_DCON_STAT0 5 |
| 91 | #define OLPC_GPIO_DCON_STAT1 6 |
| 92 | #define OLPC_GPIO_DCON_IRQ 7 |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 93 | #define OLPC_GPIO_THRM_ALRM geode_gpio(10) |
Andres Salomon | 7637c92 | 2011-01-12 17:00:11 -0800 | [diff] [blame] | 94 | #define OLPC_GPIO_DCON_LOAD 11 |
| 95 | #define OLPC_GPIO_DCON_BLANK 12 |
| 96 | #define OLPC_GPIO_SMB_CLK 14 |
| 97 | #define OLPC_GPIO_SMB_DATA 15 |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 98 | #define OLPC_GPIO_WORKAUX geode_gpio(24) |
Daniel Drake | 7bc74b3 | 2011-06-25 17:34:14 +0100 | [diff] [blame] | 99 | #define OLPC_GPIO_LID 26 |
| 100 | #define OLPC_GPIO_ECSCI 27 |
Andres Salomon | 3ef0e1f | 2008-04-29 00:59:53 -0700 | [diff] [blame] | 101 | |
H. Peter Anvin | 1965aae | 2008-10-22 22:26:29 -0700 | [diff] [blame] | 102 | #endif /* _ASM_X86_OLPC_H */ |