1356290Sjkim/* SPDX-License-Identifier: GPL-2.0 */
296593Smarkm/* OLPC machine specific definitions */
396593Smarkm
4142429Snectar#ifndef _ASM_X86_OLPC_H
596593Smarkm#define _ASM_X86_OLPC_H
696593Smarkm
796593Smarkm#include <asm/geode.h>
896593Smarkm
996593Smarkmstruct olpc_platform_t {
1096593Smarkm	int flags;
1196593Smarkm	uint32_t boardrev;
1296593Smarkm};
1396593Smarkm
1496593Smarkm#define OLPC_F_PRESENT		0x01
1596593Smarkm#define OLPC_F_DCON		0x02
1696593Smarkm
1796593Smarkm#ifdef CONFIG_OLPC
1896593Smarkm
1996593Smarkmextern struct olpc_platform_t olpc_platform_info;
20215698Ssimon
21215698Ssimon/*
22215698Ssimon * OLPC board IDs contain the major build number within the mask 0x0ff0,
23215698Ssimon * and the minor build number within 0x000f.  Pre-builds have a minor
24215698Ssimon * number less than 8, and normal builds start at 8.  For example, 0x0B10
2596593Smarkm * is a PreB1, and 0x0C18 is a C1.
2696593Smarkm */
2796593Smarkm
2896593Smarkmstatic inline uint32_t olpc_board(uint8_t id)
2996593Smarkm{
3096593Smarkm	return (id << 4) | 0x8;
3196593Smarkm}
3296593Smarkm
3396593Smarkmstatic inline uint32_t olpc_board_pre(uint8_t id)
3496593Smarkm{
3596593Smarkm	return id << 4;
3696593Smarkm}
3796593Smarkm
3896593Smarkmstatic inline int machine_is_olpc(void)
3996593Smarkm{
4096593Smarkm	return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
41276861Sjkim}
42276861Sjkim
4396593Smarkm/*
4496593Smarkm * The DCON is OLPC's Display Controller.  It has a number of unique
45215698Ssimon * features that we might want to take advantage of..
46215698Ssimon */
47215698Ssimonstatic inline int olpc_has_dcon(void)
48215698Ssimon{
49312826Sjkim	return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
50215698Ssimon}
51142429Snectar
52142429Snectar/*
53276861Sjkim * The "Mass Production" version of OLPC's XO is identified as being model
54276861Sjkim * C2.  During the prototype phase, the following models (in chronological
55276861Sjkim * order) were created: A1, B1, B2, B3, B4, C1.  The A1 through B2 models
5696593Smarkm * were based on Geode GX CPUs, and models after that were based upon
57344604Sjkim * Geode LX CPUs.  There were also some hand-assembled models floating
58344604Sjkim * around, referred to as PreB1, PreB2, etc.
59344604Sjkim */
60344604Sjkimstatic inline int olpc_board_at_least(uint32_t rev)
61344604Sjkim{
62344604Sjkim	return olpc_platform_info.boardrev >= rev;
63215698Ssimon}
64344604Sjkim
65344604Sjkim#else
66344604Sjkim
67344604Sjkimstatic inline int machine_is_olpc(void)
68276861Sjkim{
69215698Ssimon	return 0;
70344604Sjkim}
7196593Smarkm
7296593Smarkmstatic inline int olpc_has_dcon(void)
7396593Smarkm{
7496593Smarkm	return 0;
7596593Smarkm}
7696593Smarkm
7796593Smarkm#endif
7896593Smarkm
7996593Smarkm#ifdef CONFIG_OLPC_XO1_PM
8096593Smarkmextern void do_olpc_suspend_lowlevel(void);
8196593Smarkmextern void olpc_xo1_pm_wakeup_set(u16 value);
8296593Smarkmextern void olpc_xo1_pm_wakeup_clear(u16 value);
8396593Smarkm#endif
8496593Smarkm
8596593Smarkmextern int pci_olpc_init(void);
8696593Smarkm
8796593Smarkm/* GPIO assignments */
8896593Smarkm
8996593Smarkm#define OLPC_GPIO_MIC_AC	1
9096593Smarkm#define OLPC_GPIO_DCON_STAT0	5
9196593Smarkm#define OLPC_GPIO_DCON_STAT1	6
9296593Smarkm#define OLPC_GPIO_DCON_IRQ	7
9396593Smarkm#define OLPC_GPIO_THRM_ALRM	geode_gpio(10)
9496593Smarkm#define OLPC_GPIO_DCON_LOAD    11
9596593Smarkm#define OLPC_GPIO_DCON_BLANK   12
9696593Smarkm#define OLPC_GPIO_SMB_CLK      14
9796593Smarkm#define OLPC_GPIO_SMB_DATA     15
9896593Smarkm#define OLPC_GPIO_WORKAUX	geode_gpio(24)
9996593Smarkm#define OLPC_GPIO_LID		26
10096593Smarkm#define OLPC_GPIO_ECSCI		27
10196593Smarkm
10296593Smarkm#endif /* _ASM_X86_OLPC_H */
10396593Smarkm