Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* OLPC machine specific definitions */
0003 
0004 #ifndef _ASM_X86_OLPC_H
0005 #define _ASM_X86_OLPC_H
0006 
0007 #include <asm/geode.h>
0008 
0009 struct olpc_platform_t {
0010     int flags;
0011     uint32_t boardrev;
0012 };
0013 
0014 #define OLPC_F_PRESENT      0x01
0015 #define OLPC_F_DCON     0x02
0016 
0017 #ifdef CONFIG_OLPC
0018 
0019 extern struct olpc_platform_t olpc_platform_info;
0020 
0021 /*
0022  * OLPC board IDs contain the major build number within the mask 0x0ff0,
0023  * and the minor build number within 0x000f.  Pre-builds have a minor
0024  * number less than 8, and normal builds start at 8.  For example, 0x0B10
0025  * is a PreB1, and 0x0C18 is a C1.
0026  */
0027 
0028 static inline uint32_t olpc_board(uint8_t id)
0029 {
0030     return (id << 4) | 0x8;
0031 }
0032 
0033 static inline uint32_t olpc_board_pre(uint8_t id)
0034 {
0035     return id << 4;
0036 }
0037 
0038 static inline int machine_is_olpc(void)
0039 {
0040     return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
0041 }
0042 
0043 /*
0044  * The DCON is OLPC's Display Controller.  It has a number of unique
0045  * features that we might want to take advantage of..
0046  */
0047 static inline int olpc_has_dcon(void)
0048 {
0049     return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
0050 }
0051 
0052 /*
0053  * The "Mass Production" version of OLPC's XO is identified as being model
0054  * C2.  During the prototype phase, the following models (in chronological
0055  * order) were created: A1, B1, B2, B3, B4, C1.  The A1 through B2 models
0056  * were based on Geode GX CPUs, and models after that were based upon
0057  * Geode LX CPUs.  There were also some hand-assembled models floating
0058  * around, referred to as PreB1, PreB2, etc.
0059  */
0060 static inline int olpc_board_at_least(uint32_t rev)
0061 {
0062     return olpc_platform_info.boardrev >= rev;
0063 }
0064 
0065 #else
0066 
0067 static inline int machine_is_olpc(void)
0068 {
0069     return 0;
0070 }
0071 
0072 static inline int olpc_has_dcon(void)
0073 {
0074     return 0;
0075 }
0076 
0077 #endif
0078 
0079 #ifdef CONFIG_OLPC_XO1_PM
0080 extern void do_olpc_suspend_lowlevel(void);
0081 extern void olpc_xo1_pm_wakeup_set(u16 value);
0082 extern void olpc_xo1_pm_wakeup_clear(u16 value);
0083 #endif
0084 
0085 extern int pci_olpc_init(void);
0086 
0087 /* GPIO assignments */
0088 
0089 #define OLPC_GPIO_MIC_AC    1
0090 #define OLPC_GPIO_DCON_STAT0    5
0091 #define OLPC_GPIO_DCON_STAT1    6
0092 #define OLPC_GPIO_DCON_IRQ  7
0093 #define OLPC_GPIO_THRM_ALRM geode_gpio(10)
0094 #define OLPC_GPIO_DCON_LOAD    11
0095 #define OLPC_GPIO_DCON_BLANK   12
0096 #define OLPC_GPIO_SMB_CLK      14
0097 #define OLPC_GPIO_SMB_DATA     15
0098 #define OLPC_GPIO_WORKAUX   geode_gpio(24)
0099 #define OLPC_GPIO_LID       26
0100 #define OLPC_GPIO_ECSCI     27
0101 
0102 #endif /* _ASM_X86_OLPC_H */