olpc.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* OLPC machine specific definitions */
  3. #ifndef _ASM_X86_OLPC_H
  4. #define _ASM_X86_OLPC_H
  5. #include <asm/geode.h>
  6. struct olpc_platform_t {
  7. int flags;
  8. uint32_t boardrev;
  9. };
  10. #define OLPC_F_PRESENT 0x01
  11. #define OLPC_F_DCON 0x02
  12. #ifdef CONFIG_OLPC
  13. extern struct olpc_platform_t olpc_platform_info;
  14. /*
  15. * OLPC board IDs contain the major build number within the mask 0x0ff0,
  16. * and the minor build number within 0x000f. Pre-builds have a minor
  17. * number less than 8, and normal builds start at 8. For example, 0x0B10
  18. * is a PreB1, and 0x0C18 is a C1.
  19. */
  20. static inline uint32_t olpc_board(uint8_t id)
  21. {
  22. return (id << 4) | 0x8;
  23. }
  24. static inline uint32_t olpc_board_pre(uint8_t id)
  25. {
  26. return id << 4;
  27. }
  28. static inline int machine_is_olpc(void)
  29. {
  30. return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
  31. }
  32. /*
  33. * The DCON is OLPC's Display Controller. It has a number of unique
  34. * features that we might want to take advantage of..
  35. */
  36. static inline int olpc_has_dcon(void)
  37. {
  38. return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
  39. }
  40. /*
  41. * The "Mass Production" version of OLPC's XO is identified as being model
  42. * C2. During the prototype phase, the following models (in chronological
  43. * order) were created: A1, B1, B2, B3, B4, C1. The A1 through B2 models
  44. * were based on Geode GX CPUs, and models after that were based upon
  45. * Geode LX CPUs. There were also some hand-assembled models floating
  46. * around, referred to as PreB1, PreB2, etc.
  47. */
  48. static inline int olpc_board_at_least(uint32_t rev)
  49. {
  50. return olpc_platform_info.boardrev >= rev;
  51. }
  52. #else
  53. static inline int machine_is_olpc(void)
  54. {
  55. return 0;
  56. }
  57. static inline int olpc_has_dcon(void)
  58. {
  59. return 0;
  60. }
  61. #endif
  62. #ifdef CONFIG_OLPC_XO1_PM
  63. extern void do_olpc_suspend_lowlevel(void);
  64. extern void olpc_xo1_pm_wakeup_set(u16 value);
  65. extern void olpc_xo1_pm_wakeup_clear(u16 value);
  66. #endif
  67. extern int pci_olpc_init(void);
  68. /* GPIO assignments */
  69. #define OLPC_GPIO_MIC_AC 1
  70. #define OLPC_GPIO_DCON_STAT0 5
  71. #define OLPC_GPIO_DCON_STAT1 6
  72. #define OLPC_GPIO_DCON_IRQ 7
  73. #define OLPC_GPIO_THRM_ALRM geode_gpio(10)
  74. #define OLPC_GPIO_DCON_LOAD 11
  75. #define OLPC_GPIO_DCON_BLANK 12
  76. #define OLPC_GPIO_SMB_CLK 14
  77. #define OLPC_GPIO_SMB_DATA 15
  78. #define OLPC_GPIO_WORKAUX geode_gpio(24)
  79. #define OLPC_GPIO_LID 26
  80. #define OLPC_GPIO_ECSCI 27
  81. #endif /* _ASM_X86_OLPC_H */