hardware.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. * PXA935 B1 0x56056938 0x8E653013
  95. */
  96. #ifdef CONFIG_PXA25x
  97. #define __cpu_is_pxa210(id) \
  98. ({ \
  99. unsigned int _id = (id) & 0xf3f0; \
  100. _id == 0x2120; \
  101. })
  102. #define __cpu_is_pxa250(id) \
  103. ({ \
  104. unsigned int _id = (id) & 0xf3ff; \
  105. _id <= 0x2105; \
  106. })
  107. #define __cpu_is_pxa255(id) \
  108. ({ \
  109. unsigned int _id = (id) & 0xffff; \
  110. _id == 0x2d06; \
  111. })
  112. #define __cpu_is_pxa25x(id) \
  113. ({ \
  114. unsigned int _id = (id) & 0xf300; \
  115. _id == 0x2100; \
  116. })
  117. #else
  118. #define __cpu_is_pxa210(id) (0)
  119. #define __cpu_is_pxa250(id) (0)
  120. #define __cpu_is_pxa255(id) (0)
  121. #define __cpu_is_pxa25x(id) (0)
  122. #endif
  123. #ifdef CONFIG_PXA27x
  124. #define __cpu_is_pxa27x(id) \
  125. ({ \
  126. unsigned int _id = (id) >> 4 & 0xfff; \
  127. _id == 0x411; \
  128. })
  129. #else
  130. #define __cpu_is_pxa27x(id) (0)
  131. #endif
  132. #ifdef CONFIG_CPU_PXA300
  133. #define __cpu_is_pxa300(id) \
  134. ({ \
  135. unsigned int _id = (id) >> 4 & 0xfff; \
  136. _id == 0x688; \
  137. })
  138. #else
  139. #define __cpu_is_pxa300(id) (0)
  140. #endif
  141. #ifdef CONFIG_CPU_PXA310
  142. #define __cpu_is_pxa310(id) \
  143. ({ \
  144. unsigned int _id = (id) >> 4 & 0xfff; \
  145. _id == 0x689; \
  146. })
  147. #else
  148. #define __cpu_is_pxa310(id) (0)
  149. #endif
  150. #ifdef CONFIG_CPU_PXA320
  151. #define __cpu_is_pxa320(id) \
  152. ({ \
  153. unsigned int _id = (id) >> 4 & 0xfff; \
  154. _id == 0x603 || _id == 0x682; \
  155. })
  156. #else
  157. #define __cpu_is_pxa320(id) (0)
  158. #endif
  159. #ifdef CONFIG_CPU_PXA930
  160. #define __cpu_is_pxa930(id) \
  161. ({ \
  162. unsigned int _id = (id) >> 4 & 0xfff; \
  163. _id == 0x683; \
  164. })
  165. #else
  166. #define __cpu_is_pxa930(id) (0)
  167. #endif
  168. #ifdef CONFIG_CPU_PXA935
  169. #define __cpu_is_pxa935(id) \
  170. ({ \
  171. unsigned int _id = (id) >> 4 & 0xfff; \
  172. _id == 0x693; \
  173. })
  174. #else
  175. #define __cpu_is_pxa935(id) (0)
  176. #endif
  177. #ifdef CONFIG_CPU_PXA950
  178. #define __cpu_is_pxa950(id) \
  179. ({ \
  180. unsigned int _id = (id) >> 4 & 0xfff; \
  181. _id == 0x697; \
  182. })
  183. #else
  184. #define __cpu_is_pxa950(id) (0)
  185. #endif
  186. #define cpu_is_pxa210() \
  187. ({ \
  188. __cpu_is_pxa210(read_cpuid_id()); \
  189. })
  190. #define cpu_is_pxa250() \
  191. ({ \
  192. __cpu_is_pxa250(read_cpuid_id()); \
  193. })
  194. #define cpu_is_pxa255() \
  195. ({ \
  196. __cpu_is_pxa255(read_cpuid_id()); \
  197. })
  198. #define cpu_is_pxa25x() \
  199. ({ \
  200. __cpu_is_pxa25x(read_cpuid_id()); \
  201. })
  202. #define cpu_is_pxa27x() \
  203. ({ \
  204. __cpu_is_pxa27x(read_cpuid_id()); \
  205. })
  206. #define cpu_is_pxa300() \
  207. ({ \
  208. __cpu_is_pxa300(read_cpuid_id()); \
  209. })
  210. #define cpu_is_pxa310() \
  211. ({ \
  212. __cpu_is_pxa310(read_cpuid_id()); \
  213. })
  214. #define cpu_is_pxa320() \
  215. ({ \
  216. __cpu_is_pxa320(read_cpuid_id()); \
  217. })
  218. #define cpu_is_pxa930() \
  219. ({ \
  220. __cpu_is_pxa930(read_cpuid_id()); \
  221. })
  222. #define cpu_is_pxa935() \
  223. ({ \
  224. __cpu_is_pxa935(read_cpuid_id()); \
  225. })
  226. #define cpu_is_pxa950() \
  227. ({ \
  228. __cpu_is_pxa950(read_cpuid_id()); \
  229. })
  230. /*
  231. * CPUID Core Generation Bit
  232. * <= 0x2 for pxa21x/pxa25x/pxa26x/pxa27x
  233. * == 0x3 for pxa300/pxa310/pxa320
  234. */
  235. #define __cpu_is_pxa2xx(id) \
  236. ({ \
  237. unsigned int _id = (id) >> 13 & 0x7; \
  238. _id <= 0x2; \
  239. })
  240. #define __cpu_is_pxa3xx(id) \
  241. ({ \
  242. unsigned int _id = (id) >> 13 & 0x7; \
  243. _id == 0x3; \
  244. })
  245. #define __cpu_is_pxa93x(id) \
  246. ({ \
  247. unsigned int _id = (id) >> 4 & 0xfff; \
  248. _id == 0x683 || _id == 0x693; \
  249. })
  250. #define cpu_is_pxa2xx() \
  251. ({ \
  252. __cpu_is_pxa2xx(read_cpuid_id()); \
  253. })
  254. #define cpu_is_pxa3xx() \
  255. ({ \
  256. __cpu_is_pxa3xx(read_cpuid_id()); \
  257. })
  258. #define cpu_is_pxa93x() \
  259. ({ \
  260. __cpu_is_pxa93x(read_cpuid_id()); \
  261. })
  262. /*
  263. * return current memory and LCD clock frequency in units of 10kHz
  264. */
  265. extern unsigned int get_memclk_frequency_10khz(void);
  266. /* return the clock tick rate of the OS timer */
  267. extern unsigned long get_clock_tick_rate(void);
  268. #endif
  269. #if defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
  270. #define PCIBIOS_MIN_IO 0
  271. #define PCIBIOS_MIN_MEM 0
  272. #define pcibios_assign_all_busses() 1
  273. #endif
  274. #endif /* _ASM_ARCH_HARDWARE_H */