Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pc100/cpu.c |
| 2 | * |
| 3 | * Copyright 2009 Samsung Electronics Co. |
| 4 | * Byungho Min <bhmin@samsung.com> |
| 5 | * |
| 6 | * Based on mach-s3c6410/cpu.c |
| 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/kernel.h> |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/list.h> |
| 17 | #include <linux/timer.h> |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/clk.h> |
| 20 | #include <linux/io.h> |
| 21 | #include <linux/sysdev.h> |
| 22 | #include <linux/serial_core.h> |
| 23 | #include <linux/platform_device.h> |
| 24 | |
| 25 | #include <asm/mach/arch.h> |
| 26 | #include <asm/mach/map.h> |
| 27 | #include <asm/mach/irq.h> |
| 28 | |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 29 | #include <asm/proc-fns.h> |
| 30 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 31 | #include <mach/hardware.h> |
| 32 | #include <mach/map.h> |
| 33 | #include <asm/irq.h> |
| 34 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 35 | #include <plat/regs-serial.h> |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 36 | #include <mach/regs-clock.h> |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 37 | |
| 38 | #include <plat/cpu.h> |
| 39 | #include <plat/devs.h> |
| 40 | #include <plat/clock.h> |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 41 | #include <plat/iic-core.h> |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 42 | #include <plat/sdhci.h> |
Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 43 | #include <plat/onenand-core.h> |
Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame^] | 44 | #include <plat/fb-core.h> |
Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 45 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 46 | #include <plat/s5pc100.h> |
| 47 | |
| 48 | /* Initial IO mappings */ |
| 49 | |
| 50 | static struct map_desc s5pc100_iodesc[] __initdata = { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 51 | { |
| 52 | .virtual = (unsigned long)S5P_VA_SYSTIMER, |
| 53 | .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER), |
| 54 | .length = SZ_16K, |
| 55 | .type = MT_DEVICE, |
| 56 | }, { |
| 57 | .virtual = (unsigned long)VA_VIC2, |
Ben Dooks | 45c7943 | 2010-05-23 16:17:10 +0100 | [diff] [blame] | 58 | .pfn = __phys_to_pfn(S5P_PA_VIC2), |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 59 | .length = SZ_16K, |
| 60 | .type = MT_DEVICE, |
| 61 | }, { |
| 62 | .virtual = (unsigned long)S5PC100_VA_OTHERS, |
| 63 | .pfn = __phys_to_pfn(S5PC100_PA_OTHERS), |
| 64 | .length = SZ_4K, |
| 65 | .type = MT_DEVICE, |
| 66 | } |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 67 | }; |
| 68 | |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 69 | static void s5pc100_idle(void) |
| 70 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 71 | if (!need_resched()) |
| 72 | cpu_do_idle(); |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 73 | |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 74 | local_irq_enable(); |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 75 | } |
| 76 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 77 | /* s5pc100_map_io |
| 78 | * |
| 79 | * register the standard cpu IO areas |
| 80 | */ |
| 81 | |
| 82 | void __init s5pc100_map_io(void) |
| 83 | { |
| 84 | iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); |
| 85 | |
| 86 | /* initialise device information early */ |
Kyungmin Park | 86cd4f5 | 2009-11-17 08:41:23 +0100 | [diff] [blame] | 87 | s5pc100_default_sdhci0(); |
| 88 | s5pc100_default_sdhci1(); |
| 89 | s5pc100_default_sdhci2(); |
Kyungmin Park | 5eda288 | 2009-11-17 08:41:21 +0100 | [diff] [blame] | 90 | |
| 91 | /* the i2c devices are directly compatible with s3c2440 */ |
| 92 | s3c_i2c0_setname("s3c2440-i2c"); |
| 93 | s3c_i2c1_setname("s3c2440-i2c"); |
Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 94 | |
| 95 | s3c_onenand_setname("s5pc100-onenand"); |
Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame^] | 96 | s3c_fb_setname("s5pc100-fb"); |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 97 | } |
| 98 | |
| 99 | void __init s5pc100_init_clocks(int xtal) |
| 100 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 101 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); |
| 102 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 103 | s3c24xx_register_baseclocks(xtal); |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 104 | s5p_register_clocks(xtal); |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 105 | s5pc100_register_clocks(); |
| 106 | s5pc100_setup_clocks(); |
| 107 | } |
| 108 | |
| 109 | void __init s5pc100_init_irq(void) |
| 110 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 111 | u32 vic[] = {~0, ~0, ~0}; |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 112 | |
| 113 | /* VIC0, VIC1, and VIC2 are fully populated. */ |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 114 | s5p_init_irq(vic, ARRAY_SIZE(vic)); |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 115 | } |
| 116 | |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 117 | static struct sysdev_class s5pc100_sysclass = { |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 118 | .name = "s5pc100-core", |
| 119 | }; |
| 120 | |
| 121 | static struct sys_device s5pc100_sysdev = { |
| 122 | .cls = &s5pc100_sysclass, |
| 123 | }; |
| 124 | |
| 125 | static int __init s5pc100_core_init(void) |
| 126 | { |
| 127 | return sysdev_class_register(&s5pc100_sysclass); |
| 128 | } |
| 129 | |
| 130 | core_initcall(s5pc100_core_init); |
| 131 | |
| 132 | int __init s5pc100_init(void) |
| 133 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 134 | printk(KERN_INFO "S5PC100: Initializing architecture\n"); |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 135 | |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 136 | /* set idle function */ |
| 137 | pm_idle = s5pc100_idle; |
Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 138 | |
Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 139 | return sysdev_register(&s5pc100_sysdev); |
| 140 | } |