18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* OLPC machine specific definitions */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _ASM_X86_OLPC_H
58c2ecf20Sopenharmony_ci#define _ASM_X86_OLPC_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <asm/geode.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_cistruct olpc_platform_t {
108c2ecf20Sopenharmony_ci	int flags;
118c2ecf20Sopenharmony_ci	uint32_t boardrev;
128c2ecf20Sopenharmony_ci};
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define OLPC_F_PRESENT		0x01
158c2ecf20Sopenharmony_ci#define OLPC_F_DCON		0x02
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifdef CONFIG_OLPC
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciextern struct olpc_platform_t olpc_platform_info;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * OLPC board IDs contain the major build number within the mask 0x0ff0,
238c2ecf20Sopenharmony_ci * and the minor build number within 0x000f.  Pre-builds have a minor
248c2ecf20Sopenharmony_ci * number less than 8, and normal builds start at 8.  For example, 0x0B10
258c2ecf20Sopenharmony_ci * is a PreB1, and 0x0C18 is a C1.
268c2ecf20Sopenharmony_ci */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_cistatic inline uint32_t olpc_board(uint8_t id)
298c2ecf20Sopenharmony_ci{
308c2ecf20Sopenharmony_ci	return (id << 4) | 0x8;
318c2ecf20Sopenharmony_ci}
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic inline uint32_t olpc_board_pre(uint8_t id)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	return id << 4;
368c2ecf20Sopenharmony_ci}
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic inline int machine_is_olpc(void)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
418c2ecf20Sopenharmony_ci}
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/*
448c2ecf20Sopenharmony_ci * The DCON is OLPC's Display Controller.  It has a number of unique
458c2ecf20Sopenharmony_ci * features that we might want to take advantage of..
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_cistatic inline int olpc_has_dcon(void)
488c2ecf20Sopenharmony_ci{
498c2ecf20Sopenharmony_ci	return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
508c2ecf20Sopenharmony_ci}
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*
538c2ecf20Sopenharmony_ci * The "Mass Production" version of OLPC's XO is identified as being model
548c2ecf20Sopenharmony_ci * C2.  During the prototype phase, the following models (in chronological
558c2ecf20Sopenharmony_ci * order) were created: A1, B1, B2, B3, B4, C1.  The A1 through B2 models
568c2ecf20Sopenharmony_ci * were based on Geode GX CPUs, and models after that were based upon
578c2ecf20Sopenharmony_ci * Geode LX CPUs.  There were also some hand-assembled models floating
588c2ecf20Sopenharmony_ci * around, referred to as PreB1, PreB2, etc.
598c2ecf20Sopenharmony_ci */
608c2ecf20Sopenharmony_cistatic inline int olpc_board_at_least(uint32_t rev)
618c2ecf20Sopenharmony_ci{
628c2ecf20Sopenharmony_ci	return olpc_platform_info.boardrev >= rev;
638c2ecf20Sopenharmony_ci}
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#else
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistatic inline int machine_is_olpc(void)
688c2ecf20Sopenharmony_ci{
698c2ecf20Sopenharmony_ci	return 0;
708c2ecf20Sopenharmony_ci}
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistatic inline int olpc_has_dcon(void)
738c2ecf20Sopenharmony_ci{
748c2ecf20Sopenharmony_ci	return 0;
758c2ecf20Sopenharmony_ci}
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#endif
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#ifdef CONFIG_OLPC_XO1_PM
808c2ecf20Sopenharmony_ciextern void do_olpc_suspend_lowlevel(void);
818c2ecf20Sopenharmony_ciextern void olpc_xo1_pm_wakeup_set(u16 value);
828c2ecf20Sopenharmony_ciextern void olpc_xo1_pm_wakeup_clear(u16 value);
838c2ecf20Sopenharmony_ci#endif
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ciextern int pci_olpc_init(void);
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* GPIO assignments */
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define OLPC_GPIO_MIC_AC	1
908c2ecf20Sopenharmony_ci#define OLPC_GPIO_DCON_STAT0	5
918c2ecf20Sopenharmony_ci#define OLPC_GPIO_DCON_STAT1	6
928c2ecf20Sopenharmony_ci#define OLPC_GPIO_DCON_IRQ	7
938c2ecf20Sopenharmony_ci#define OLPC_GPIO_THRM_ALRM	geode_gpio(10)
948c2ecf20Sopenharmony_ci#define OLPC_GPIO_DCON_LOAD    11
958c2ecf20Sopenharmony_ci#define OLPC_GPIO_DCON_BLANK   12
968c2ecf20Sopenharmony_ci#define OLPC_GPIO_SMB_CLK      14
978c2ecf20Sopenharmony_ci#define OLPC_GPIO_SMB_DATA     15
988c2ecf20Sopenharmony_ci#define OLPC_GPIO_WORKAUX	geode_gpio(24)
998c2ecf20Sopenharmony_ci#define OLPC_GPIO_LID		26
1008c2ecf20Sopenharmony_ci#define OLPC_GPIO_ECSCI		27
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#endif /* _ASM_X86_OLPC_H */
103