cpu.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * (C) Copyright 2010 Samsung Electronics
  3. * Minkyu Kang <mk7.kang@samsung.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef _S5PC2XX_CPU_H
  22. #define _S5PC2XX_CPU_H
  23. #define S5PC2XX_ADDR_BASE 0x10000000
  24. /* S5PC210 */
  25. #define S5PC210_GPIO_PART3_BASE 0x03860000
  26. #define S5PC210_PRO_ID 0x10000000
  27. #define S5PC210_POWER_BASE 0x10020000
  28. #define S5PC210_SWRESET 0x10020400
  29. #define S5PC210_CLOCK_BASE 0x10030000
  30. #define S5PC210_SYSTIMER_BASE 0x10050000
  31. #define S5PC210_WATCHDOG_BASE 0x10060000
  32. #define S5PC210_MIU_BASE 0x10600000
  33. #define S5PC210_DMC0_BASE 0x10400000
  34. #define S5PC210_DMC1_BASE 0x10410000
  35. #define S5PC210_GPIO_PART2_BASE 0x11000000
  36. #define S5PC210_GPIO_PART1_BASE 0x11400000
  37. #define S5PC210_FIMD_BASE 0x11C00000
  38. #define S5PC210_USBOTG_BASE 0x12480000
  39. #define S5PC210_MMC_BASE 0x12510000
  40. #define S5PC210_SROMC_BASE 0x12570000
  41. #define S5PC210_USBPHY_BASE 0x125B0000
  42. #define S5PC210_UART_BASE 0x13800000
  43. #define S5PC210_ADC_BASE 0x13910000
  44. #define S5PC210_PWMTIMER_BASE 0x139D0000
  45. #define S5PC210_MODEM_BASE 0x13A00000
  46. #ifndef __ASSEMBLY__
  47. #include <asm/io.h>
  48. /* CPU detection macros */
  49. extern unsigned int s5p_cpu_id;
  50. extern unsigned int s5p_cpu_rev;
  51. static inline int s5p_get_cpu_rev(void)
  52. {
  53. return s5p_cpu_rev;
  54. }
  55. static inline void s5p_set_cpu_id(void)
  56. {
  57. s5p_cpu_id = readl(S5PC210_PRO_ID);
  58. s5p_cpu_id = (0xC000 | ((s5p_cpu_id & 0x00FFF000) >> 12));
  59. /*
  60. * 0xC200: S5PC210 EVT0
  61. * 0xC210: S5PC210 EVT1
  62. */
  63. if (s5p_cpu_id == 0xC200) {
  64. s5p_cpu_id |= 0x10;
  65. s5p_cpu_rev = 0;
  66. } else if (s5p_cpu_id == 0xC210) {
  67. s5p_cpu_rev = 1;
  68. }
  69. }
  70. #define IS_SAMSUNG_TYPE(type, id) \
  71. static inline int cpu_is_##type(void) \
  72. { \
  73. return s5p_cpu_id == id ? 1 : 0; \
  74. }
  75. IS_SAMSUNG_TYPE(s5pc210, 0xc210)
  76. #define SAMSUNG_BASE(device, base) \
  77. static inline unsigned int samsung_get_base_##device(void) \
  78. { \
  79. if (cpu_is_s5pc210()) \
  80. return S5PC210_##base; \
  81. else \
  82. return 0; \
  83. }
  84. SAMSUNG_BASE(adc, ADC_BASE)
  85. SAMSUNG_BASE(clock, CLOCK_BASE)
  86. SAMSUNG_BASE(fimd, FIMD_BASE)
  87. SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE)
  88. SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE)
  89. SAMSUNG_BASE(gpio_part3, GPIO_PART3_BASE)
  90. SAMSUNG_BASE(pro_id, PRO_ID)
  91. SAMSUNG_BASE(mmc, MMC_BASE)
  92. SAMSUNG_BASE(modem, MODEM_BASE)
  93. SAMSUNG_BASE(sromc, SROMC_BASE)
  94. SAMSUNG_BASE(swreset, SWRESET)
  95. SAMSUNG_BASE(timer, PWMTIMER_BASE)
  96. SAMSUNG_BASE(uart, UART_BASE)
  97. SAMSUNG_BASE(usb_phy, USBPHY_BASE)
  98. SAMSUNG_BASE(usb_otg, USBOTG_BASE)
  99. SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
  100. #endif
  101. #endif /* _S5PC2XX_CPU_H */