Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 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 | |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 22 | #ifndef _EXYNOS4_CPU_H |
| 23 | #define _EXYNOS4_CPU_H |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 24 | |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 25 | #define EXYNOS4_ADDR_BASE 0x10000000 |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 26 | |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 27 | /* EXYNOS4 */ |
| 28 | #define EXYNOS4_GPIO_PART3_BASE 0x03860000 |
| 29 | #define EXYNOS4_PRO_ID 0x10000000 |
| 30 | #define EXYNOS4_POWER_BASE 0x10020000 |
| 31 | #define EXYNOS4_SWRESET 0x10020400 |
| 32 | #define EXYNOS4_CLOCK_BASE 0x10030000 |
| 33 | #define EXYNOS4_SYSTIMER_BASE 0x10050000 |
| 34 | #define EXYNOS4_WATCHDOG_BASE 0x10060000 |
| 35 | #define EXYNOS4_MIU_BASE 0x10600000 |
| 36 | #define EXYNOS4_DMC0_BASE 0x10400000 |
| 37 | #define EXYNOS4_DMC1_BASE 0x10410000 |
| 38 | #define EXYNOS4_GPIO_PART2_BASE 0x11000000 |
| 39 | #define EXYNOS4_GPIO_PART1_BASE 0x11400000 |
| 40 | #define EXYNOS4_FIMD_BASE 0x11C00000 |
| 41 | #define EXYNOS4_USBOTG_BASE 0x12480000 |
| 42 | #define EXYNOS4_MMC_BASE 0x12510000 |
| 43 | #define EXYNOS4_SROMC_BASE 0x12570000 |
| 44 | #define EXYNOS4_USBPHY_BASE 0x125B0000 |
| 45 | #define EXYNOS4_UART_BASE 0x13800000 |
| 46 | #define EXYNOS4_ADC_BASE 0x13910000 |
| 47 | #define EXYNOS4_PWMTIMER_BASE 0x139D0000 |
| 48 | #define EXYNOS4_MODEM_BASE 0x13A00000 |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 49 | |
| 50 | #ifndef __ASSEMBLY__ |
| 51 | #include <asm/io.h> |
| 52 | /* CPU detection macros */ |
| 53 | extern unsigned int s5p_cpu_id; |
Minkyu Kang | 5d845f2 | 2011-05-16 19:45:54 +0900 | [diff] [blame] | 54 | extern unsigned int s5p_cpu_rev; |
| 55 | |
| 56 | static inline int s5p_get_cpu_rev(void) |
| 57 | { |
| 58 | return s5p_cpu_rev; |
| 59 | } |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 60 | |
| 61 | static inline void s5p_set_cpu_id(void) |
| 62 | { |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 63 | s5p_cpu_id = readl(EXYNOS4_PRO_ID); |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 64 | s5p_cpu_id = (0xC000 | ((s5p_cpu_id & 0x00FFF000) >> 12)); |
| 65 | |
| 66 | /* |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 67 | * 0xC200: EXYNOS4210 EVT0 |
| 68 | * 0xC210: EXYNOS4210 EVT1 |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 69 | */ |
Minkyu Kang | 5d845f2 | 2011-05-16 19:45:54 +0900 | [diff] [blame] | 70 | if (s5p_cpu_id == 0xC200) { |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 71 | s5p_cpu_id |= 0x10; |
Minkyu Kang | 5d845f2 | 2011-05-16 19:45:54 +0900 | [diff] [blame] | 72 | s5p_cpu_rev = 0; |
| 73 | } else if (s5p_cpu_id == 0xC210) { |
| 74 | s5p_cpu_rev = 1; |
| 75 | } |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 76 | } |
| 77 | |
| 78 | #define IS_SAMSUNG_TYPE(type, id) \ |
| 79 | static inline int cpu_is_##type(void) \ |
| 80 | { \ |
| 81 | return s5p_cpu_id == id ? 1 : 0; \ |
| 82 | } |
| 83 | |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 84 | IS_SAMSUNG_TYPE(exynos4, 0xc210) |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 85 | |
| 86 | #define SAMSUNG_BASE(device, base) \ |
| 87 | static inline unsigned int samsung_get_base_##device(void) \ |
| 88 | { \ |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 89 | if (cpu_is_exynos4()) \ |
| 90 | return EXYNOS4_##base; \ |
Minkyu Kang | 008a351 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 91 | else \ |
| 92 | return 0; \ |
| 93 | } |
| 94 | |
| 95 | SAMSUNG_BASE(adc, ADC_BASE) |
| 96 | SAMSUNG_BASE(clock, CLOCK_BASE) |
| 97 | SAMSUNG_BASE(fimd, FIMD_BASE) |
| 98 | SAMSUNG_BASE(gpio_part1, GPIO_PART1_BASE) |
| 99 | SAMSUNG_BASE(gpio_part2, GPIO_PART2_BASE) |
| 100 | SAMSUNG_BASE(gpio_part3, GPIO_PART3_BASE) |
| 101 | SAMSUNG_BASE(pro_id, PRO_ID) |
| 102 | SAMSUNG_BASE(mmc, MMC_BASE) |
| 103 | SAMSUNG_BASE(modem, MODEM_BASE) |
| 104 | SAMSUNG_BASE(sromc, SROMC_BASE) |
| 105 | SAMSUNG_BASE(swreset, SWRESET) |
| 106 | SAMSUNG_BASE(timer, PWMTIMER_BASE) |
| 107 | SAMSUNG_BASE(uart, UART_BASE) |
| 108 | SAMSUNG_BASE(usb_phy, USBPHY_BASE) |
| 109 | SAMSUNG_BASE(usb_otg, USBOTG_BASE) |
| 110 | SAMSUNG_BASE(watchdog, WATCHDOG_BASE) |
| 111 | #endif |
| 112 | |
Chander Kashyap | 393cb36 | 2011-12-06 23:34:12 +0000 | [diff] [blame] | 113 | #endif /* _EXYNOS4_CPU_H */ |