idp.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * arch/arm/mach-pxa/include/mach/idp.h
  4. *
  5. * Copyright (c) 2001 Cliff Brake, Accelent Systems Inc.
  6. *
  7. * 2001-09-13: Cliff Brake <[email protected]>
  8. * Initial code
  9. *
  10. * 2005-02-15: Cliff Brake <[email protected]>
  11. * <http://www.vibren.com> <http://bec-systems.com>
  12. * Changes for 2.6 kernel.
  13. */
  14. /*
  15. * Note: this file must be safe to include in assembly files
  16. *
  17. * Support for the Vibren PXA255 IDP requires rev04 or later
  18. * IDP hardware.
  19. */
  20. #include "irqs.h" /* PXA_GPIO_TO_IRQ */
  21. #define IDP_FLASH_PHYS (PXA_CS0_PHYS)
  22. #define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS)
  23. #define IDP_MEDIAQ_PHYS (PXA_CS3_PHYS)
  24. #define IDP_IDE_PHYS (PXA_CS5_PHYS + 0x03000000)
  25. #define IDP_ETH_PHYS (PXA_CS5_PHYS + 0x03400000)
  26. #define IDP_COREVOLT_PHYS (PXA_CS5_PHYS + 0x03800000)
  27. #define IDP_CPLD_PHYS (PXA_CS5_PHYS + 0x03C00000)
  28. /*
  29. * virtual memory map
  30. */
  31. #define IDP_COREVOLT_VIRT (0xf0000000)
  32. #define IDP_COREVOLT_SIZE (1*1024*1024)
  33. #define IDP_CPLD_VIRT (IDP_COREVOLT_VIRT + IDP_COREVOLT_SIZE)
  34. #define IDP_CPLD_SIZE (1*1024*1024)
  35. #if (IDP_CPLD_VIRT + IDP_CPLD_SIZE) > 0xfc000000
  36. #error Your custom IO space is getting a bit large !!
  37. #endif
  38. #define CPLD_P2V(x) ((x) - IDP_CPLD_PHYS + IDP_CPLD_VIRT)
  39. #define CPLD_V2P(x) ((x) - IDP_CPLD_VIRT + IDP_CPLD_PHYS)
  40. #ifndef __ASSEMBLY__
  41. # define __CPLD_REG(x) (*((volatile unsigned long *)CPLD_P2V(x)))
  42. #else
  43. # define __CPLD_REG(x) CPLD_P2V(x)
  44. #endif
  45. /* board level registers in the CPLD: (offsets from CPLD_VIRT) */
  46. #define _IDP_CPLD_REV (IDP_CPLD_PHYS + 0x00)
  47. #define _IDP_CPLD_PERIPH_PWR (IDP_CPLD_PHYS + 0x04)
  48. #define _IDP_CPLD_LED_CONTROL (IDP_CPLD_PHYS + 0x08)
  49. #define _IDP_CPLD_KB_COL_HIGH (IDP_CPLD_PHYS + 0x0C)
  50. #define _IDP_CPLD_KB_COL_LOW (IDP_CPLD_PHYS + 0x10)
  51. #define _IDP_CPLD_PCCARD_EN (IDP_CPLD_PHYS + 0x14)
  52. #define _IDP_CPLD_GPIOH_DIR (IDP_CPLD_PHYS + 0x18)
  53. #define _IDP_CPLD_GPIOH_VALUE (IDP_CPLD_PHYS + 0x1C)
  54. #define _IDP_CPLD_GPIOL_DIR (IDP_CPLD_PHYS + 0x20)
  55. #define _IDP_CPLD_GPIOL_VALUE (IDP_CPLD_PHYS + 0x24)
  56. #define _IDP_CPLD_PCCARD_PWR (IDP_CPLD_PHYS + 0x28)
  57. #define _IDP_CPLD_MISC_CTRL (IDP_CPLD_PHYS + 0x2C)
  58. #define _IDP_CPLD_LCD (IDP_CPLD_PHYS + 0x30)
  59. #define _IDP_CPLD_FLASH_WE (IDP_CPLD_PHYS + 0x34)
  60. #define _IDP_CPLD_KB_ROW (IDP_CPLD_PHYS + 0x50)
  61. #define _IDP_CPLD_PCCARD0_STATUS (IDP_CPLD_PHYS + 0x54)
  62. #define _IDP_CPLD_PCCARD1_STATUS (IDP_CPLD_PHYS + 0x58)
  63. #define _IDP_CPLD_MISC_STATUS (IDP_CPLD_PHYS + 0x5C)
  64. /* FPGA register virtual addresses */
  65. #define IDP_CPLD_REV __CPLD_REG(_IDP_CPLD_REV)
  66. #define IDP_CPLD_PERIPH_PWR __CPLD_REG(_IDP_CPLD_PERIPH_PWR)
  67. #define IDP_CPLD_LED_CONTROL __CPLD_REG(_IDP_CPLD_LED_CONTROL)
  68. #define IDP_CPLD_KB_COL_HIGH __CPLD_REG(_IDP_CPLD_KB_COL_HIGH)
  69. #define IDP_CPLD_KB_COL_LOW __CPLD_REG(_IDP_CPLD_KB_COL_LOW)
  70. #define IDP_CPLD_PCCARD_EN __CPLD_REG(_IDP_CPLD_PCCARD_EN)
  71. #define IDP_CPLD_GPIOH_DIR __CPLD_REG(_IDP_CPLD_GPIOH_DIR)
  72. #define IDP_CPLD_GPIOH_VALUE __CPLD_REG(_IDP_CPLD_GPIOH_VALUE)
  73. #define IDP_CPLD_GPIOL_DIR __CPLD_REG(_IDP_CPLD_GPIOL_DIR)
  74. #define IDP_CPLD_GPIOL_VALUE __CPLD_REG(_IDP_CPLD_GPIOL_VALUE)
  75. #define IDP_CPLD_PCCARD_PWR __CPLD_REG(_IDP_CPLD_PCCARD_PWR)
  76. #define IDP_CPLD_MISC_CTRL __CPLD_REG(_IDP_CPLD_MISC_CTRL)
  77. #define IDP_CPLD_LCD __CPLD_REG(_IDP_CPLD_LCD)
  78. #define IDP_CPLD_FLASH_WE __CPLD_REG(_IDP_CPLD_FLASH_WE)
  79. #define IDP_CPLD_KB_ROW __CPLD_REG(_IDP_CPLD_KB_ROW)
  80. #define IDP_CPLD_PCCARD0_STATUS __CPLD_REG(_IDP_CPLD_PCCARD0_STATUS)
  81. #define IDP_CPLD_PCCARD1_STATUS __CPLD_REG(_IDP_CPLD_PCCARD1_STATUS)
  82. #define IDP_CPLD_MISC_STATUS __CPLD_REG(_IDP_CPLD_MISC_STATUS)
  83. /*
  84. * Bit masks for various registers
  85. */
  86. // IDP_CPLD_PCCARD_PWR
  87. #define PCC0_PWR0 (1 << 0)
  88. #define PCC0_PWR1 (1 << 1)
  89. #define PCC0_PWR2 (1 << 2)
  90. #define PCC0_PWR3 (1 << 3)
  91. #define PCC1_PWR0 (1 << 4)
  92. #define PCC1_PWR1 (1 << 5)
  93. #define PCC1_PWR2 (1 << 6)
  94. #define PCC1_PWR3 (1 << 7)
  95. // IDP_CPLD_PCCARD_EN
  96. #define PCC0_RESET (1 << 6)
  97. #define PCC1_RESET (1 << 7)
  98. #define PCC0_ENABLE (1 << 0)
  99. #define PCC1_ENABLE (1 << 1)
  100. // IDP_CPLD_PCCARDx_STATUS
  101. #define _PCC_WRPROT (1 << 7) // 7-4 read as low true
  102. #define _PCC_RESET (1 << 6)
  103. #define _PCC_IRQ (1 << 5)
  104. #define _PCC_INPACK (1 << 4)
  105. #define PCC_BVD2 (1 << 3)
  106. #define PCC_BVD1 (1 << 2)
  107. #define PCC_VS2 (1 << 1)
  108. #define PCC_VS1 (1 << 0)
  109. /* A listing of interrupts used by external hardware devices */
  110. #define TOUCH_PANEL_IRQ PXA_GPIO_TO_IRQ(5)
  111. #define IDE_IRQ PXA_GPIO_TO_IRQ(21)
  112. #define TOUCH_PANEL_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
  113. #define ETHERNET_IRQ PXA_GPIO_TO_IRQ(4)
  114. #define ETHERNET_IRQ_EDGE IRQ_TYPE_EDGE_RISING
  115. #define IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
  116. #define PCMCIA_S0_CD_VALID PXA_GPIO_TO_IRQ(7)
  117. #define PCMCIA_S0_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
  118. #define PCMCIA_S1_CD_VALID PXA_GPIO_TO_IRQ(8)
  119. #define PCMCIA_S1_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
  120. #define PCMCIA_S0_RDYINT PXA_GPIO_TO_IRQ(19)
  121. #define PCMCIA_S1_RDYINT PXA_GPIO_TO_IRQ(22)
  122. /*
  123. * Macros for LED Driver
  124. */
  125. /* leds 0 = ON */
  126. #define IDP_HB_LED (1<<5)
  127. #define IDP_BUSY_LED (1<<6)
  128. #define IDP_LEDS_MASK (IDP_HB_LED | IDP_BUSY_LED)
  129. /*
  130. * macros for MTD driver
  131. */
  132. #define FLASH_WRITE_PROTECT_DISABLE() ((IDP_CPLD_FLASH_WE) &= ~(0x1))
  133. #define FLASH_WRITE_PROTECT_ENABLE() ((IDP_CPLD_FLASH_WE) |= (0x1))
  134. /*
  135. * macros for matrix keyboard driver
  136. */
  137. #define KEYBD_MATRIX_NUMBER_INPUTS 7
  138. #define KEYBD_MATRIX_NUMBER_OUTPUTS 14
  139. #define KEYBD_MATRIX_INVERT_OUTPUT_LOGIC FALSE
  140. #define KEYBD_MATRIX_INVERT_INPUT_LOGIC FALSE
  141. #define KEYBD_MATRIX_SETTLING_TIME_US 100
  142. #define KEYBD_MATRIX_KEYSTATE_DEBOUNCE_CONSTANT 2
  143. #define KEYBD_MATRIX_SET_OUTPUTS(outputs) \
  144. {\
  145. IDP_CPLD_KB_COL_LOW = outputs;\
  146. IDP_CPLD_KB_COL_HIGH = outputs >> 7;\
  147. }
  148. #define KEYBD_MATRIX_GET_INPUTS(inputs) \
  149. {\
  150. inputs = (IDP_CPLD_KB_ROW & 0x7f);\
  151. }