hardware.h 6.7 KB

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