hardware.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * Copyright (C) 2009 ST-Ericsson.
  3. *
  4. * U8500 hardware definitions
  5. *
  6. * This file is licensed under the terms of the GNU General Public
  7. * License version 2. This program is licensed "as is" without any
  8. * warranty of any kind, whether express or implied.
  9. */
  10. #ifndef __MACH_HARDWARE_H
  11. #define __MACH_HARDWARE_H
  12. /* macros to get at IO space when running virtually
  13. * We dont map all the peripherals, let ioremap do
  14. * this for us. We map only very basic peripherals here.
  15. */
  16. #define U8500_IO_VIRTUAL 0xf0000000
  17. #define U8500_IO_PHYSICAL 0xa0000000
  18. /* this macro is used in assembly, so no cast */
  19. #define IO_ADDRESS(x) \
  20. (((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + U8500_IO_VIRTUAL)
  21. /* typesafe io address */
  22. #define __io_address(n) __io(IO_ADDRESS(n))
  23. /* used by some plat-nomadik code */
  24. #define io_p2v(n) __io_address(n)
  25. #include <mach/db8500-regs.h>
  26. #include <mach/db5500-regs.h>
  27. #ifdef CONFIG_UX500_SOC_DB8500
  28. #define UX500(periph) U8500_##periph##_BASE
  29. #elif defined(CONFIG_UX500_SOC_DB5500)
  30. #define UX500(periph) U5500_##periph##_BASE
  31. #endif
  32. #define UX500_BACKUPRAM0_BASE UX500(BACKUPRAM0)
  33. #define UX500_BACKUPRAM1_BASE UX500(BACKUPRAM1)
  34. #define UX500_B2R2_BASE UX500(B2R2)
  35. #define UX500_CLKRST1_BASE UX500(CLKRST1)
  36. #define UX500_CLKRST2_BASE UX500(CLKRST2)
  37. #define UX500_CLKRST3_BASE UX500(CLKRST3)
  38. #define UX500_CLKRST5_BASE UX500(CLKRST5)
  39. #define UX500_CLKRST6_BASE UX500(CLKRST6)
  40. #define UX500_DMA_BASE UX500(DMA)
  41. #define UX500_FSMC_BASE UX500(FSMC)
  42. #define UX500_GIC_CPU_BASE UX500(GIC_CPU)
  43. #define UX500_GIC_DIST_BASE UX500(GIC_DIST)
  44. #define UX500_I2C1_BASE UX500(I2C1)
  45. #define UX500_I2C2_BASE UX500(I2C2)
  46. #define UX500_I2C3_BASE UX500(I2C3)
  47. #define UX500_L2CC_BASE UX500(L2CC)
  48. #define UX500_MCDE_BASE UX500(MCDE)
  49. #define UX500_MTU0_BASE UX500(MTU0)
  50. #define UX500_MTU1_BASE UX500(MTU1)
  51. #define UX500_PRCMU_BASE UX500(PRCMU)
  52. #define UX500_RNG_BASE UX500(RNG)
  53. #define UX500_RTC_BASE UX500(RTC)
  54. #define UX500_SCU_BASE UX500(SCU)
  55. #define UX500_SDI0_BASE UX500(SDI0)
  56. #define UX500_SDI1_BASE UX500(SDI1)
  57. #define UX500_SDI2_BASE UX500(SDI2)
  58. #define UX500_SDI3_BASE UX500(SDI3)
  59. #define UX500_SDI4_BASE UX500(SDI4)
  60. #define UX500_SPI0_BASE UX500(SPI0)
  61. #define UX500_SPI1_BASE UX500(SPI1)
  62. #define UX500_SPI2_BASE UX500(SPI2)
  63. #define UX500_SPI3_BASE UX500(SPI3)
  64. #define UX500_SIA_BASE UX500(SIA)
  65. #define UX500_SVA_BASE UX500(SVA)
  66. #define UX500_TWD_BASE UX500(TWD)
  67. #define UX500_UART0_BASE UX500(UART0)
  68. #define UX500_UART1_BASE UX500(UART1)
  69. #define UX500_UART2_BASE UX500(UART2)
  70. #define UX500_USBOTG_BASE UX500(USBOTG)
  71. /* ST-Ericsson modified pl022 id */
  72. #define SSP_PER_ID 0x01080022
  73. #ifndef __ASSEMBLY__
  74. #include <asm/cputype.h>
  75. static inline bool cpu_is_u8500(void)
  76. {
  77. #ifdef CONFIG_UX500_SOC_DB8500
  78. return 1;
  79. #else
  80. return 0;
  81. #endif
  82. }
  83. static inline bool cpu_is_u8500ed(void)
  84. {
  85. return cpu_is_u8500() && (read_cpuid_id() & 15) == 0;
  86. }
  87. static inline bool cpu_is_u8500v1(void)
  88. {
  89. return cpu_is_u8500() && (read_cpuid_id() & 15) == 1;
  90. }
  91. static inline bool cpu_is_u5500(void)
  92. {
  93. #ifdef CONFIG_UX500_SOC_DB5500
  94. return 1;
  95. #else
  96. return 0;
  97. #endif
  98. }
  99. #endif
  100. #endif /* __MACH_HARDWARE_H */