h3600.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. *
  3. * Definitions for H3600 Handheld Computer
  4. *
  5. * Copyright 2000 Compaq Computer Corporation.
  6. *
  7. * Use consistent with the GNU GPL is permitted,
  8. * provided that this copyright notice is
  9. * preserved in its entirety in all copies and derived works.
  10. *
  11. * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
  12. * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
  13. * FITNESS FOR ANY PARTICULAR PURPOSE.
  14. *
  15. * Author: Jamey Hicks.
  16. *
  17. * History:
  18. *
  19. * 2001-10-?? Andrew Christian Added support for iPAQ H3800
  20. *
  21. */
  22. #ifndef _INCLUDE_H3600_H_
  23. #define _INCLUDE_H3600_H_
  24. /* generalized support for H3xxx series Compaq Pocket PC's */
  25. #define machine_is_h3xxx() (machine_is_h3100() || machine_is_h3600() || machine_is_h3800())
  26. /* Physical memory regions corresponding to chip selects */
  27. #define H3600_EGPIO_PHYS (SA1100_CS5_PHYS + 0x01000000)
  28. #define H3600_BANK_2_PHYS SA1100_CS2_PHYS
  29. #define H3600_BANK_4_PHYS SA1100_CS4_PHYS
  30. /* Virtual memory regions corresponding to chip selects 2 & 4 (used on sleeves) */
  31. #define H3600_EGPIO_VIRT 0xf0000000
  32. #define H3600_BANK_2_VIRT 0xf1000000
  33. #define H3600_BANK_4_VIRT 0xf3800000
  34. /*
  35. Machine-independent GPIO definitions
  36. --- these are common across all current iPAQ platforms
  37. */
  38. #define GPIO_H3600_NPOWER_BUTTON GPIO_GPIO (0) /* Also known as the "off button" */
  39. #define GPIO_H3600_PCMCIA_CD1 GPIO_GPIO (10)
  40. #define GPIO_H3600_PCMCIA_IRQ1 GPIO_GPIO (11)
  41. /* UDA1341 L3 Interface */
  42. #define GPIO_H3600_L3_DATA GPIO_GPIO (14)
  43. #define GPIO_H3600_L3_MODE GPIO_GPIO (15)
  44. #define GPIO_H3600_L3_CLOCK GPIO_GPIO (16)
  45. #define GPIO_H3600_PCMCIA_CD0 GPIO_GPIO (17)
  46. #define GPIO_H3600_SYS_CLK GPIO_GPIO (19)
  47. #define GPIO_H3600_PCMCIA_IRQ0 GPIO_GPIO (21)
  48. #define GPIO_H3600_COM_DCD GPIO_GPIO (23)
  49. #define GPIO_H3600_OPT_IRQ GPIO_GPIO (24)
  50. #define GPIO_H3600_COM_CTS GPIO_GPIO (25)
  51. #define GPIO_H3600_COM_RTS GPIO_GPIO (26)
  52. #define IRQ_GPIO_H3600_NPOWER_BUTTON IRQ_GPIO0
  53. #define IRQ_GPIO_H3600_PCMCIA_CD1 IRQ_GPIO10
  54. #define IRQ_GPIO_H3600_PCMCIA_IRQ1 IRQ_GPIO11
  55. #define IRQ_GPIO_H3600_PCMCIA_CD0 IRQ_GPIO17
  56. #define IRQ_GPIO_H3600_PCMCIA_IRQ0 IRQ_GPIO21
  57. #define IRQ_GPIO_H3600_COM_DCD IRQ_GPIO23
  58. #define IRQ_GPIO_H3600_OPT_IRQ IRQ_GPIO24
  59. #define IRQ_GPIO_H3600_COM_CTS IRQ_GPIO25
  60. #ifndef __ASSEMBLY__
  61. enum ipaq_egpio_type {
  62. IPAQ_EGPIO_LCD_POWER, /* Power to the LCD panel */
  63. IPAQ_EGPIO_CODEC_NRESET, /* Clear to reset the audio codec (remember to return high) */
  64. IPAQ_EGPIO_AUDIO_ON, /* Audio power */
  65. IPAQ_EGPIO_QMUTE, /* Audio muting */
  66. IPAQ_EGPIO_OPT_NVRAM_ON, /* Non-volatile RAM on extension sleeves (SPI interface) */
  67. IPAQ_EGPIO_OPT_ON, /* Power to extension sleeves */
  68. IPAQ_EGPIO_CARD_RESET, /* Reset PCMCIA cards on extension sleeve (???) */
  69. IPAQ_EGPIO_OPT_RESET, /* Reset option pack (???) */
  70. IPAQ_EGPIO_IR_ON, /* IR sensor/emitter power */
  71. IPAQ_EGPIO_IR_FSEL, /* IR speed selection 1->fast, 0->slow */
  72. IPAQ_EGPIO_RS232_ON, /* Maxim RS232 chip power */
  73. IPAQ_EGPIO_VPP_ON, /* Turn on power to flash programming */
  74. IPAQ_EGPIO_LCD_ENABLE, /* Enable/disable LCD controller */
  75. };
  76. struct ipaq_model_ops {
  77. const char *generic_name;
  78. void (*control)(enum ipaq_egpio_type, int);
  79. unsigned long (*read)(void);
  80. void (*blank_callback)(int blank);
  81. int (*pm_callback)(int req); /* Primary model callback */
  82. int (*pm_callback_aux)(int req); /* Secondary callback (used by HAL modules) */
  83. };
  84. extern struct ipaq_model_ops ipaq_model_ops;
  85. static __inline__ const char * h3600_generic_name(void)
  86. {
  87. return ipaq_model_ops.generic_name;
  88. }
  89. static __inline__ void assign_h3600_egpio(enum ipaq_egpio_type x, int level)
  90. {
  91. if (ipaq_model_ops.control)
  92. ipaq_model_ops.control(x,level);
  93. }
  94. static __inline__ void clr_h3600_egpio(enum ipaq_egpio_type x)
  95. {
  96. if (ipaq_model_ops.control)
  97. ipaq_model_ops.control(x,0);
  98. }
  99. static __inline__ void set_h3600_egpio(enum ipaq_egpio_type x)
  100. {
  101. if (ipaq_model_ops.control)
  102. ipaq_model_ops.control(x,1);
  103. }
  104. static __inline__ unsigned long read_h3600_egpio(void)
  105. {
  106. if (ipaq_model_ops.read)
  107. return ipaq_model_ops.read();
  108. return 0;
  109. }
  110. static __inline__ int h3600_register_blank_callback(void (*f)(int))
  111. {
  112. ipaq_model_ops.blank_callback = f;
  113. return 0;
  114. }
  115. static __inline__ void h3600_unregister_blank_callback(void (*f)(int))
  116. {
  117. ipaq_model_ops.blank_callback = NULL;
  118. }
  119. static __inline__ int h3600_register_pm_callback(int (*f)(int))
  120. {
  121. ipaq_model_ops.pm_callback_aux = f;
  122. return 0;
  123. }
  124. static __inline__ void h3600_unregister_pm_callback(int (*f)(int))
  125. {
  126. ipaq_model_ops.pm_callback_aux = NULL;
  127. }
  128. static __inline__ int h3600_power_management(int req)
  129. {
  130. if (ipaq_model_ops.pm_callback)
  131. return ipaq_model_ops.pm_callback(req);
  132. return 0;
  133. }
  134. #endif /* ASSEMBLY */
  135. #endif /* _INCLUDE_H3600_H_ */