hardware.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /*
  2. * arch/arm/mach-pxa/include/mach/hardware.h
  3. *
  4. * Author: Nicolas Pitre
  5. * Created: Jun 15, 2001
  6. * Copyright: MontaVista Software Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __ASM_ARCH_HARDWARE_H
  13. #define __ASM_ARCH_HARDWARE_H
  14. /*
  15. * We requires absolute addresses.
  16. */
  17. #define PCIO_BASE 0
  18. /*
  19. * Workarounds for at least 2 errata so far require this.
  20. * The mapping is set in mach-pxa/generic.c.
  21. */
  22. #define UNCACHED_PHYS_0 0xff000000
  23. #define UNCACHED_ADDR UNCACHED_PHYS_0
  24. /*
  25. * Intel PXA2xx internal register mapping:
  26. *
  27. * 0x40000000 - 0x41ffffff <--> 0xf2000000 - 0xf3ffffff
  28. * 0x44000000 - 0x45ffffff <--> 0xf4000000 - 0xf5ffffff
  29. * 0x48000000 - 0x49ffffff <--> 0xf6000000 - 0xf7ffffff
  30. * 0x4c000000 - 0x4dffffff <--> 0xf8000000 - 0xf9ffffff
  31. * 0x50000000 - 0x51ffffff <--> 0xfa000000 - 0xfbffffff
  32. * 0x54000000 - 0x55ffffff <--> 0xfc000000 - 0xfdffffff
  33. * 0x58000000 - 0x59ffffff <--> 0xfe000000 - 0xffffffff
  34. *
  35. * Note that not all PXA2xx chips implement all those addresses, and the
  36. * kernel only maps the minimum needed range of this mapping.
  37. */
  38. #define io_p2v(x) (0xf2000000 + ((x) & 0x01ffffff) + (((x) & 0x1c000000) >> 1))
  39. #define io_v2p(x) (0x3c000000 + ((x) & 0x01ffffff) + (((x) & 0x0e000000) << 1))
  40. #ifndef __ASSEMBLY__
  41. # define __REG(x) (*((volatile u32 *)io_p2v(x)))
  42. /* With indexed regs we don't want to feed the index through io_p2v()
  43. especially if it is a variable, otherwise horrible code will result. */
  44. # define __REG2(x,y) \
  45. (*(volatile u32 *)((u32)&__REG(x) + (y)))
  46. # define __PREG(x) (io_v2p((u32)&(x)))
  47. #else
  48. # define __REG(x) io_p2v(x)
  49. # define __PREG(x) io_v2p(x)
  50. #endif
  51. #ifndef __ASSEMBLY__
  52. #include <asm/cputype.h>
  53. /*
  54. * CPU Stepping CPU_ID JTAG_ID
  55. *
  56. * PXA210 B0 0x69052922 0x2926C013
  57. * PXA210 B1 0x69052923 0x3926C013
  58. * PXA210 B2 0x69052924 0x4926C013
  59. * PXA210 C0 0x69052D25 0x5926C013
  60. *
  61. * PXA250 A0 0x69052100 0x09264013
  62. * PXA250 A1 0x69052101 0x19264013
  63. * PXA250 B0 0x69052902 0x29264013
  64. * PXA250 B1 0x69052903 0x39264013
  65. * PXA250 B2 0x69052904 0x49264013
  66. * PXA250 C0 0x69052D05 0x59264013
  67. *
  68. * PXA255 A0 0x69052D06 0x69264013
  69. *
  70. * PXA26x A0 0x69052903 0x39264013
  71. * PXA26x B0 0x69052D05 0x59264013
  72. *
  73. * PXA27x A0 0x69054110 0x09265013
  74. * PXA27x A1 0x69054111 0x19265013
  75. * PXA27x B0 0x69054112 0x29265013
  76. * PXA27x B1 0x69054113 0x39265013
  77. * PXA27x C0 0x69054114 0x49265013
  78. * PXA27x C5 0x69054117 0x79265013
  79. *
  80. * PXA30x A0 0x69056880 0x0E648013
  81. * PXA30x A1 0x69056881 0x1E648013
  82. * PXA31x A0 0x69056890 0x0E649013
  83. * PXA31x A1 0x69056891 0x1E649013
  84. * PXA31x A2 0x69056892 0x2E649013
  85. * PXA32x B1 0x69056825 0x5E642013
  86. * PXA32x B2 0x69056826 0x6E642013
  87. *
  88. * PXA930 B0 0x69056835 0x5E643013
  89. * PXA930 B1 0x69056837 0x7E643013
  90. * PXA930 B2 0x69056838 0x8E643013
  91. *
  92. * PXA935 A0 0x56056931 0x1E653013
  93. * PXA935 B0 0x56056936 0x6E653013
  94. */
  95. #ifdef CONFIG_PXA25x
  96. #define __cpu_is_pxa210(id) \
  97. ({ \
  98. unsigned int _id = (id) & 0xf3f0; \
  99. _id == 0x2120; \
  100. })
  101. #define __cpu_is_pxa250(id) \
  102. ({ \
  103. unsigned int _id = (id) & 0xf3ff; \
  104. _id <= 0x2105; \
  105. })
  106. #define __cpu_is_pxa255(id) \
  107. ({ \
  108. unsigned int _id = (id) & 0xffff; \
  109. _id == 0x2d06; \
  110. })
  111. #define __cpu_is_pxa25x(id) \
  112. ({ \
  113. unsigned int _id = (id) & 0xf300; \
  114. _id == 0x2100; \
  115. })
  116. #else
  117. #define __cpu_is_pxa210(id) (0)
  118. #define __cpu_is_pxa250(id) (0)
  119. #define __cpu_is_pxa255(id) (0)
  120. #define __cpu_is_pxa25x(id) (0)
  121. #endif
  122. #ifdef CONFIG_PXA27x
  123. #define __cpu_is_pxa27x(id) \
  124. ({ \
  125. unsigned int _id = (id) >> 4 & 0xfff; \
  126. _id == 0x411; \
  127. })
  128. #else
  129. #define __cpu_is_pxa27x(id) (0)
  130. #endif
  131. #ifdef CONFIG_CPU_PXA300
  132. #define __cpu_is_pxa300(id) \
  133. ({ \
  134. unsigned int _id = (id) >> 4 & 0xfff; \
  135. _id == 0x688; \
  136. })
  137. #else
  138. #define __cpu_is_pxa300(id) (0)
  139. #endif
  140. #ifdef CONFIG_CPU_PXA310
  141. #define __cpu_is_pxa310(id) \
  142. ({ \
  143. unsigned int _id = (id) >> 4 & 0xfff; \
  144. _id == 0x689; \
  145. })
  146. #else
  147. #define __cpu_is_pxa310(id) (0)
  148. #endif
  149. #ifdef CONFIG_CPU_PXA320
  150. #define __cpu_is_pxa320(id) \
  151. ({ \
  152. unsigned int _id = (id) >> 4 & 0xfff; \
  153. _id == 0x603 || _id == 0x682; \
  154. })
  155. #else
  156. #define __cpu_is_pxa320(id) (0)
  157. #endif
  158. #ifdef CONFIG_CPU_PXA930
  159. #define __cpu_is_pxa930(id) \
  160. ({ \
  161. unsigned int _id = (id) >> 4 & 0xfff; \
  162. _id == 0x683; \
  163. })
  164. #else
  165. #define __cpu_is_pxa930(id) (0)
  166. #endif
  167. #ifdef CONFIG_CPU_PXA935
  168. #define __cpu_is_pxa935(id) \
  169. ({ \
  170. unsigned int _id = (id) >> 4 & 0xfff; \
  171. _id == 0x693; \
  172. })
  173. #else
  174. #define __cpu_is_pxa935(id) (0)
  175. #endif
  176. #define cpu_is_pxa210() \
  177. ({ \
  178. __cpu_is_pxa210(read_cpuid_id()); \
  179. })
  180. #define cpu_is_pxa250() \
  181. ({ \
  182. __cpu_is_pxa250(read_cpuid_id()); \
  183. })
  184. #define cpu_is_pxa255() \
  185. ({ \
  186. __cpu_is_pxa255(read_cpuid_id()); \
  187. })
  188. #define cpu_is_pxa25x() \
  189. ({ \
  190. __cpu_is_pxa25x(read_cpuid_id()); \
  191. })
  192. #define cpu_is_pxa27x() \
  193. ({ \
  194. __cpu_is_pxa27x(read_cpuid_id()); \
  195. })
  196. #define cpu_is_pxa300() \
  197. ({ \
  198. __cpu_is_pxa300(read_cpuid_id()); \
  199. })
  200. #define cpu_is_pxa310() \
  201. ({ \
  202. __cpu_is_pxa310(read_cpuid_id()); \
  203. })
  204. #define cpu_is_pxa320() \
  205. ({ \
  206. __cpu_is_pxa320(read_cpuid_id()); \
  207. })
  208. #define cpu_is_pxa930() \
  209. ({ \
  210. unsigned int id = read_cpuid(CPUID_ID); \
  211. __cpu_is_pxa930(id); \
  212. })
  213. #define cpu_is_pxa935() \
  214. ({ \
  215. unsigned int id = read_cpuid(CPUID_ID); \
  216. __cpu_is_pxa935(id); \
  217. })
  218. /*
  219. * CPUID Core Generation Bit
  220. * <= 0x2 for pxa21x/pxa25x/pxa26x/pxa27x
  221. * == 0x3 for pxa300/pxa310/pxa320
  222. */
  223. #define __cpu_is_pxa2xx(id) \
  224. ({ \
  225. unsigned int _id = (id) >> 13 & 0x7; \
  226. _id <= 0x2; \
  227. })
  228. #define __cpu_is_pxa3xx(id) \
  229. ({ \
  230. unsigned int _id = (id) >> 13 & 0x7; \
  231. _id == 0x3; \
  232. })
  233. #define __cpu_is_pxa9xx(id) \
  234. ({ \
  235. unsigned int _id = (id) >> 4 & 0xfff; \
  236. _id == 0x683 || _id == 0x693; \
  237. })
  238. #define cpu_is_pxa2xx() \
  239. ({ \
  240. __cpu_is_pxa2xx(read_cpuid_id()); \
  241. })
  242. #define cpu_is_pxa3xx() \
  243. ({ \
  244. __cpu_is_pxa3xx(read_cpuid_id()); \
  245. })
  246. #define cpu_is_pxa9xx() \
  247. ({ \
  248. __cpu_is_pxa9xx(read_cpuid_id()); \
  249. })
  250. /*
  251. * return current memory and LCD clock frequency in units of 10kHz
  252. */
  253. extern unsigned int get_memclk_frequency_10khz(void);
  254. /* return the clock tick rate of the OS timer */
  255. extern unsigned long get_clock_tick_rate(void);
  256. #endif
  257. #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
  258. #define PCIBIOS_MIN_IO 0
  259. #define PCIBIOS_MIN_MEM 0
  260. #define pcibios_assign_all_busses() 1
  261. #define HAVE_ARCH_PCI_SET_DMA_MASK 1
  262. #endif
  263. #endif /* _ASM_ARCH_HARDWARE_H */