Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/plat-s5p/cpu.c |
| 2 | * |
| 3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
| 6 | * S5P CPU Support |
| 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 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <mach/map.h> |
| 16 | #include <asm/mach/arch.h> |
| 17 | #include <asm/mach/map.h> |
| 18 | #include <mach/regs-clock.h> |
| 19 | #include <plat/cpu.h> |
| 20 | #include <plat/s5p6440.h> |
Kukjin Kim | 5f7f6a4 | 2010-01-29 10:12:14 +0900 | [diff] [blame] | 21 | #include <plat/s5p6442.h> |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 22 | #include <plat/s5pc100.h> |
Kukjin Kim | 939d28a | 2010-02-24 16:40:29 +0900 | [diff] [blame] | 23 | #include <plat/s5pv210.h> |
Changhwan Youn | 2b12b5c | 2010-07-26 21:08:52 +0900 | [diff] [blame] | 24 | #include <plat/s5pv310.h> |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 25 | |
| 26 | /* table of supported CPUs */ |
| 27 | |
| 28 | static const char name_s5p6440[] = "S5P6440"; |
Kukjin Kim | 5f7f6a4 | 2010-01-29 10:12:14 +0900 | [diff] [blame] | 29 | static const char name_s5p6442[] = "S5P6442"; |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 30 | static const char name_s5pc100[] = "S5PC100"; |
Kukjin Kim | 939d28a | 2010-02-24 16:40:29 +0900 | [diff] [blame] | 31 | static const char name_s5pv210[] = "S5PV210/S5PC110"; |
Changhwan Youn | 2b12b5c | 2010-07-26 21:08:52 +0900 | [diff] [blame] | 32 | static const char name_s5pv310[] = "S5PV310"; |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 33 | |
| 34 | static struct cpu_table cpu_ids[] __initdata = { |
| 35 | { |
| 36 | .idcode = 0x56440100, |
| 37 | .idmask = 0xffffff00, |
| 38 | .map_io = s5p6440_map_io, |
| 39 | .init_clocks = s5p6440_init_clocks, |
| 40 | .init_uarts = s5p6440_init_uarts, |
| 41 | .init = s5p6440_init, |
| 42 | .name = name_s5p6440, |
Kukjin Kim | 5f7f6a4 | 2010-01-29 10:12:14 +0900 | [diff] [blame] | 43 | }, { |
| 44 | .idcode = 0x36442000, |
| 45 | .idmask = 0xffffff00, |
| 46 | .map_io = s5p6442_map_io, |
| 47 | .init_clocks = s5p6442_init_clocks, |
| 48 | .init_uarts = s5p6442_init_uarts, |
| 49 | .init = s5p6442_init, |
| 50 | .name = name_s5p6442, |
Kukjin Kim | 939d28a | 2010-02-24 16:40:29 +0900 | [diff] [blame] | 51 | }, { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 52 | .idcode = 0x43100000, |
| 53 | .idmask = 0xfffff000, |
| 54 | .map_io = s5pc100_map_io, |
| 55 | .init_clocks = s5pc100_init_clocks, |
| 56 | .init_uarts = s5pc100_init_uarts, |
| 57 | .init = s5pc100_init, |
| 58 | .name = name_s5pc100, |
| 59 | }, { |
Kukjin Kim | 939d28a | 2010-02-24 16:40:29 +0900 | [diff] [blame] | 60 | .idcode = 0x43110000, |
| 61 | .idmask = 0xfffff000, |
| 62 | .map_io = s5pv210_map_io, |
| 63 | .init_clocks = s5pv210_init_clocks, |
| 64 | .init_uarts = s5pv210_init_uarts, |
| 65 | .init = s5pv210_init, |
| 66 | .name = name_s5pv210, |
Changhwan Youn | 2b12b5c | 2010-07-26 21:08:52 +0900 | [diff] [blame] | 67 | }, { |
| 68 | .idcode = 0x43200000, |
| 69 | .idmask = 0xfffff000, |
| 70 | .map_io = s5pv310_map_io, |
| 71 | .init_clocks = s5pv310_init_clocks, |
| 72 | .init_uarts = s5pv310_init_uarts, |
| 73 | .init = s5pv310_init, |
| 74 | .name = name_s5pv310, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 75 | }, |
| 76 | }; |
| 77 | |
| 78 | /* minimal IO mapping */ |
| 79 | |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 80 | static struct map_desc s5p_iodesc[] __initdata = { |
| 81 | { |
Kukjin Kim | 8131796 | 2010-01-27 16:57:07 +0900 | [diff] [blame] | 82 | .virtual = (unsigned long)S5P_VA_CHIPID, |
| 83 | .pfn = __phys_to_pfn(S5P_PA_CHIPID), |
| 84 | .length = SZ_4K, |
| 85 | .type = MT_DEVICE, |
| 86 | }, { |
| 87 | .virtual = (unsigned long)S3C_VA_SYS, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 88 | .pfn = __phys_to_pfn(S5P_PA_SYSCON), |
| 89 | .length = SZ_64K, |
| 90 | .type = MT_DEVICE, |
| 91 | }, { |
Kukjin Kim | 8131796 | 2010-01-27 16:57:07 +0900 | [diff] [blame] | 92 | .virtual = (unsigned long)S3C_VA_UART, |
| 93 | .pfn = __phys_to_pfn(S3C_PA_UART), |
Changhwan Youn | 88baf20 | 2010-07-16 11:30:35 +0900 | [diff] [blame] | 94 | .length = SZ_512K, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 95 | .type = MT_DEVICE, |
Changhwan Youn | 2b12b5c | 2010-07-26 21:08:52 +0900 | [diff] [blame] | 96 | #ifdef CONFIG_ARM_VIC |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 97 | }, { |
Kukjin Kim | 8131796 | 2010-01-27 16:57:07 +0900 | [diff] [blame] | 98 | .virtual = (unsigned long)VA_VIC0, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 99 | .pfn = __phys_to_pfn(S5P_PA_VIC0), |
| 100 | .length = SZ_16K, |
| 101 | .type = MT_DEVICE, |
| 102 | }, { |
Kukjin Kim | 8131796 | 2010-01-27 16:57:07 +0900 | [diff] [blame] | 103 | .virtual = (unsigned long)VA_VIC1, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 104 | .pfn = __phys_to_pfn(S5P_PA_VIC1), |
| 105 | .length = SZ_16K, |
| 106 | .type = MT_DEVICE, |
Changhwan Youn | 2b12b5c | 2010-07-26 21:08:52 +0900 | [diff] [blame] | 107 | #endif |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 108 | }, { |
Kukjin Kim | 8131796 | 2010-01-27 16:57:07 +0900 | [diff] [blame] | 109 | .virtual = (unsigned long)S3C_VA_TIMER, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 110 | .pfn = __phys_to_pfn(S5P_PA_TIMER), |
| 111 | .length = SZ_16K, |
| 112 | .type = MT_DEVICE, |
| 113 | }, { |
| 114 | .virtual = (unsigned long)S5P_VA_GPIO, |
| 115 | .pfn = __phys_to_pfn(S5P_PA_GPIO), |
| 116 | .length = SZ_4K, |
| 117 | .type = MT_DEVICE, |
Jongpill Lee | d7f1e82 | 2010-06-23 21:31:21 +0900 | [diff] [blame] | 118 | }, { |
| 119 | .virtual = (unsigned long)S3C_VA_WATCHDOG, |
| 120 | .pfn = __phys_to_pfn(S3C_PA_WDT), |
| 121 | .length = SZ_4K, |
| 122 | .type = MT_DEVICE, |
Kukjin Kim | 209fecd | 2010-01-14 15:29:17 +0900 | [diff] [blame] | 123 | }, |
| 124 | }; |
| 125 | |
| 126 | /* read cpu identification code */ |
| 127 | |
| 128 | void __init s5p_init_io(struct map_desc *mach_desc, |
| 129 | int size, void __iomem *cpuid_addr) |
| 130 | { |
| 131 | unsigned long idcode; |
| 132 | |
| 133 | /* initialize the io descriptors we need for initialization */ |
| 134 | iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc)); |
| 135 | if (mach_desc) |
| 136 | iotable_init(mach_desc, size); |
| 137 | |
| 138 | idcode = __raw_readl(cpuid_addr); |
| 139 | s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids)); |
| 140 | } |