| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pc100/cpu.c | 
 | 2 |  * | 
| Kukjin Kim | 19a2c06 | 2010-08-31 16:30:51 +0900 | [diff] [blame] | 3 |  * Copyright (c) 2010 Samsung Electronics Co., Ltd. | 
 | 4 |  *		http://www.samsung.com | 
 | 5 |  * | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 6 |  * Copyright 2009 Samsung Electronics Co. | 
 | 7 |  *	Byungho Min <bhmin@samsung.com> | 
 | 8 |  * | 
 | 9 |  * Based on mach-s3c6410/cpu.c | 
 | 10 |  * | 
 | 11 |  * This program is free software; you can redistribute it and/or modify | 
 | 12 |  * it under the terms of the GNU General Public License version 2 as | 
 | 13 |  * published by the Free Software Foundation. | 
 | 14 | */ | 
 | 15 |  | 
 | 16 | #include <linux/kernel.h> | 
 | 17 | #include <linux/types.h> | 
 | 18 | #include <linux/interrupt.h> | 
 | 19 | #include <linux/list.h> | 
 | 20 | #include <linux/timer.h> | 
 | 21 | #include <linux/init.h> | 
 | 22 | #include <linux/clk.h> | 
 | 23 | #include <linux/io.h> | 
 | 24 | #include <linux/sysdev.h> | 
 | 25 | #include <linux/serial_core.h> | 
 | 26 | #include <linux/platform_device.h> | 
| SeungChull Suh | 4341f9b | 2010-10-02 12:48:12 +0900 | [diff] [blame] | 27 | #include <linux/sched.h> | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 28 |  | 
 | 29 | #include <asm/mach/arch.h> | 
 | 30 | #include <asm/mach/map.h> | 
 | 31 | #include <asm/mach/irq.h> | 
 | 32 |  | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 33 | #include <asm/proc-fns.h> | 
 | 34 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 35 | #include <mach/hardware.h> | 
 | 36 | #include <mach/map.h> | 
 | 37 | #include <asm/irq.h> | 
 | 38 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 39 | #include <plat/regs-serial.h> | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 40 | #include <mach/regs-clock.h> | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 41 |  | 
 | 42 | #include <plat/cpu.h> | 
 | 43 | #include <plat/devs.h> | 
 | 44 | #include <plat/clock.h> | 
| Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame] | 45 | #include <plat/ata-core.h> | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 46 | #include <plat/iic-core.h> | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 47 | #include <plat/sdhci.h> | 
| Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 48 | #include <plat/adc-core.h> | 
| Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 49 | #include <plat/onenand-core.h> | 
| Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame] | 50 | #include <plat/fb-core.h> | 
| Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 51 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 52 | #include <plat/s5pc100.h> | 
 | 53 |  | 
 | 54 | /* Initial IO mappings */ | 
 | 55 |  | 
 | 56 | static struct map_desc s5pc100_iodesc[] __initdata = { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 57 | 	{ | 
 | 58 | 		.virtual	= (unsigned long)S5P_VA_SYSTIMER, | 
 | 59 | 		.pfn		= __phys_to_pfn(S5PC100_PA_SYSTIMER), | 
 | 60 | 		.length		= SZ_16K, | 
 | 61 | 		.type		= MT_DEVICE, | 
 | 62 | 	}, { | 
| Kukjin Kim | 19a2c06 | 2010-08-31 16:30:51 +0900 | [diff] [blame] | 63 | 		.virtual	= (unsigned long)S5P_VA_GPIO, | 
 | 64 | 		.pfn		= __phys_to_pfn(S5PC100_PA_GPIO), | 
 | 65 | 		.length		= SZ_4K, | 
 | 66 | 		.type		= MT_DEVICE, | 
 | 67 | 	}, { | 
 | 68 | 		.virtual	= (unsigned long)VA_VIC0, | 
 | 69 | 		.pfn		= __phys_to_pfn(S5PC100_PA_VIC0), | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 70 | 		.length		= SZ_16K, | 
 | 71 | 		.type		= MT_DEVICE, | 
 | 72 | 	}, { | 
| Kukjin Kim | 19a2c06 | 2010-08-31 16:30:51 +0900 | [diff] [blame] | 73 | 		.virtual	= (unsigned long)VA_VIC1, | 
 | 74 | 		.pfn		= __phys_to_pfn(S5PC100_PA_VIC1), | 
 | 75 | 		.length		= SZ_16K, | 
 | 76 | 		.type		= MT_DEVICE, | 
 | 77 | 	}, { | 
 | 78 | 		.virtual	= (unsigned long)VA_VIC2, | 
 | 79 | 		.pfn		= __phys_to_pfn(S5PC100_PA_VIC2), | 
 | 80 | 		.length		= SZ_16K, | 
 | 81 | 		.type		= MT_DEVICE, | 
 | 82 | 	}, { | 
 | 83 | 		.virtual	= (unsigned long)S3C_VA_UART, | 
 | 84 | 		.pfn		= __phys_to_pfn(S3C_PA_UART), | 
 | 85 | 		.length		= SZ_512K, | 
 | 86 | 		.type		= MT_DEVICE, | 
 | 87 | 	}, { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 88 | 		.virtual	= (unsigned long)S5PC100_VA_OTHERS, | 
 | 89 | 		.pfn		= __phys_to_pfn(S5PC100_PA_OTHERS), | 
 | 90 | 		.length		= SZ_4K, | 
 | 91 | 		.type		= MT_DEVICE, | 
 | 92 | 	} | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 93 | }; | 
 | 94 |  | 
| Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 95 | static void s5pc100_idle(void) | 
 | 96 | { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 97 | 	if (!need_resched()) | 
 | 98 | 		cpu_do_idle(); | 
| Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 99 |  | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 100 | 	local_irq_enable(); | 
| Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 101 | } | 
 | 102 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 103 | /* s5pc100_map_io | 
 | 104 |  * | 
 | 105 |  * register the standard cpu IO areas | 
 | 106 | */ | 
 | 107 |  | 
 | 108 | void __init s5pc100_map_io(void) | 
 | 109 | { | 
 | 110 | 	iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); | 
 | 111 |  | 
 | 112 | 	/* initialise device information early */ | 
| Kyungmin Park | 86cd4f5 | 2009-11-17 08:41:23 +0100 | [diff] [blame] | 113 | 	s5pc100_default_sdhci0(); | 
 | 114 | 	s5pc100_default_sdhci1(); | 
 | 115 | 	s5pc100_default_sdhci2(); | 
| Kyungmin Park | 5eda288 | 2009-11-17 08:41:21 +0100 | [diff] [blame] | 116 |  | 
| Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 117 | 	s3c_adc_setname("s3c64xx-adc"); | 
 | 118 |  | 
| Kyungmin Park | 5eda288 | 2009-11-17 08:41:21 +0100 | [diff] [blame] | 119 | 	/* the i2c devices are directly compatible with s3c2440 */ | 
 | 120 | 	s3c_i2c0_setname("s3c2440-i2c"); | 
 | 121 | 	s3c_i2c1_setname("s3c2440-i2c"); | 
| Marek Szyprowski | 999304b | 2010-05-20 08:59:05 +0200 | [diff] [blame] | 122 |  | 
 | 123 | 	s3c_onenand_setname("s5pc100-onenand"); | 
| Pawel Osciak | eb42b04 | 2010-08-10 18:02:37 -0700 | [diff] [blame] | 124 | 	s3c_fb_setname("s5pc100-fb"); | 
| Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame] | 125 | 	s3c_cfcon_setname("s5pc100-pata"); | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 126 | } | 
 | 127 |  | 
 | 128 | void __init s5pc100_init_clocks(int xtal) | 
 | 129 | { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 130 | 	printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | 
 | 131 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 132 | 	s3c24xx_register_baseclocks(xtal); | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 133 | 	s5p_register_clocks(xtal); | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 134 | 	s5pc100_register_clocks(); | 
 | 135 | 	s5pc100_setup_clocks(); | 
 | 136 | } | 
 | 137 |  | 
 | 138 | void __init s5pc100_init_irq(void) | 
 | 139 | { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 140 | 	u32 vic[] = {~0, ~0, ~0}; | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 141 |  | 
 | 142 | 	/* VIC0, VIC1, and VIC2 are fully populated. */ | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 143 | 	s5p_init_irq(vic, ARRAY_SIZE(vic)); | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 144 | } | 
 | 145 |  | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 146 | static struct sysdev_class s5pc100_sysclass = { | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 147 | 	.name	= "s5pc100-core", | 
 | 148 | }; | 
 | 149 |  | 
 | 150 | static struct sys_device s5pc100_sysdev = { | 
 | 151 | 	.cls	= &s5pc100_sysclass, | 
 | 152 | }; | 
 | 153 |  | 
 | 154 | static int __init s5pc100_core_init(void) | 
 | 155 | { | 
 | 156 | 	return sysdev_class_register(&s5pc100_sysclass); | 
 | 157 | } | 
 | 158 |  | 
 | 159 | core_initcall(s5pc100_core_init); | 
 | 160 |  | 
 | 161 | int __init s5pc100_init(void) | 
 | 162 | { | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 163 | 	printk(KERN_INFO "S5PC100: Initializing architecture\n"); | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 164 |  | 
| Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 165 | 	/* set idle function */ | 
 | 166 | 	pm_idle = s5pc100_idle; | 
| Kyungmin Park | c3fcf5d | 2009-11-17 08:41:17 +0100 | [diff] [blame] | 167 |  | 
| Byungho Min | 8acd1ad | 2009-06-23 21:40:15 +0900 | [diff] [blame] | 168 | 	return sysdev_register(&s5pc100_sysdev); | 
 | 169 | } |