aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2011-12-22 17:31:28 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-12-23 14:11:19 -0500
commitdd4153d9af67496f6545831e72c743060d33a830 (patch)
treee1ddc02db02db746a4b4f97e7b2026629aa10634 /arch/arm
parent95af214becab511b5ef76082688865d434dada1a (diff)
ARM: 7247/1: S5PC100: introduce arch/arm/mach-s5pc100/common.[ch]
This patch introduces common.[ch] which are used only in the arch/arm/mach-s5pc100/ directory. The common.c file merges the cpu.c and init.c which are used commonly on S5PC100 SoC and the common.h local header file replaces with plat/s5pc100.h file. Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-s5pc100/Makefile29
-rw-r--r--arch/arm/mach-s5pc100/clock.c3
-rw-r--r--arch/arm/mach-s5pc100/common.c (renamed from arch/arm/mach-s5pc100/cpu.c)94
-rw-r--r--arch/arm/mach-s5pc100/common.h35
-rw-r--r--arch/arm/mach-s5pc100/init.c24
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c5
-rw-r--r--arch/arm/plat-s5p/cpu.c10
-rw-r--r--arch/arm/plat-samsung/include/plat/s5pc100.h33
8 files changed, 127 insertions, 106 deletions
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index a5e6e608b498..c3166c4d2ace 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -9,28 +9,25 @@ obj-m :=
9obj-n := 9obj-n :=
10obj- := 10obj- :=
11 11
12# Core support for S5PC100 system 12# Core
13 13
14obj-$(CONFIG_CPU_S5PC100) += cpu.o init.o clock.o 14obj-y += common.o clock.o
15obj-$(CONFIG_CPU_S5PC100) += setup-i2c0.o
16obj-$(CONFIG_CPU_S5PC100) += dma.o
17 15
18# Helper and device support 16obj-y += dma.o
19
20obj-$(CONFIG_S5PC100_SETUP_FB_24BPP) += setup-fb-24bpp.o
21obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
22obj-$(CONFIG_S5PC100_SETUP_IDE) += setup-ide.o
23obj-$(CONFIG_S5PC100_SETUP_KEYPAD) += setup-keypad.o
24obj-$(CONFIG_S5PC100_SETUP_SDHCI) += setup-sdhci.o
25obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
26
27# device support
28obj-y += dev-audio.o
29obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
30 17
31# machine support 18# machine support
32 19
33obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o 20obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o
34 21
35# device support 22# device support
23
36obj-y += dev-audio.o 24obj-y += dev-audio.o
25obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
26
27obj-y += setup-i2c0.o
28obj-$(CONFIG_S5PC100_SETUP_FB_24BPP) += setup-fb-24bpp.o
29obj-$(CONFIG_S5PC100_SETUP_I2C1) += setup-i2c1.o
30obj-$(CONFIG_S5PC100_SETUP_IDE) += setup-ide.o
31obj-$(CONFIG_S5PC100_SETUP_KEYPAD) += setup-keypad.o
32obj-$(CONFIG_S5PC100_SETUP_SDHCI) += setup-sdhci.o
33obj-$(CONFIG_S5PC100_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 8d47709da713..c4c74893f53c 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -27,7 +27,8 @@
27#include <plat/pll.h> 27#include <plat/pll.h>
28#include <plat/s5p-clock.h> 28#include <plat/s5p-clock.h>
29#include <plat/clock-clksrc.h> 29#include <plat/clock-clksrc.h>
30#include <plat/s5pc100.h> 30
31#include "common.h"
31 32
32static struct clk s5p_clk_otgphy = { 33static struct clk s5p_clk_otgphy = {
33 .name = "otg_phy", 34 .name = "otg_phy",
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/common.c
index fd2708e7d8a9..e6eadacc108c 100644
--- a/arch/arm/mach-s5pc100/cpu.c
+++ b/arch/arm/mach-s5pc100/common.c
@@ -1,17 +1,16 @@
1/* linux/arch/arm/mach-s5pc100/cpu.c 1/*
2 * 2 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com 3 * http://www.samsung.com
5 * 4 *
6 * Copyright 2009 Samsung Electronics Co. 5 * Copyright 2009 Samsung Electronics Co.
7 * Byungho Min <bhmin@samsung.com> 6 * Byungho Min <bhmin@samsung.com>
8 * 7 *
9 * Based on mach-s3c6410/cpu.c 8 * Common Codes for S5PC100
10 * 9 *
11 * This program is free software; you can redistribute it and/or modify 10 * 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 11 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
14*/ 13 */
15 14
16#include <linux/kernel.h> 15#include <linux/kernel.h>
17#include <linux/types.h> 16#include <linux/types.h>
@@ -26,35 +25,72 @@
26#include <linux/platform_device.h> 25#include <linux/platform_device.h>
27#include <linux/sched.h> 26#include <linux/sched.h>
28 27
28#include <asm/irq.h>
29#include <asm/proc-fns.h>
29#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
32 33
33#include <asm/proc-fns.h>
34
35#include <mach/hardware.h>
36#include <mach/map.h> 34#include <mach/map.h>
37#include <asm/irq.h> 35#include <mach/hardware.h>
38
39#include <plat/regs-serial.h>
40#include <mach/regs-clock.h> 36#include <mach/regs-clock.h>
41 37
42#include <plat/cpu.h> 38#include <plat/cpu.h>
43#include <plat/devs.h> 39#include <plat/devs.h>
44#include <plat/clock.h> 40#include <plat/clock.h>
45#include <plat/ata-core.h>
46#include <plat/iic-core.h>
47#include <plat/sdhci.h> 41#include <plat/sdhci.h>
48#include <plat/adc-core.h> 42#include <plat/adc-core.h>
49#include <plat/onenand-core.h> 43#include <plat/ata-core.h>
50#include <plat/fb-core.h> 44#include <plat/fb-core.h>
45#include <plat/iic-core.h>
46#include <plat/onenand-core.h>
47#include <plat/regs-serial.h>
48
49#include "common.h"
51 50
52#include <plat/s5pc100.h> 51static const char name_s5pc100[] = "S5PC100";
52
53static struct cpu_table cpu_ids[] __initdata = {
54 {
55 .idcode = S5PC100_CPU_ID,
56 .idmask = S5PC100_CPU_MASK,
57 .map_io = s5pc100_map_io,
58 .init_clocks = s5pc100_init_clocks,
59 .init_uarts = s5pc100_init_uarts,
60 .init = s5pc100_init,
61 .name = name_s5pc100,
62 },
63};
53 64
54/* Initial IO mappings */ 65/* Initial IO mappings */
55 66
56static struct map_desc s5pc100_iodesc[] __initdata = { 67static struct map_desc s5pc100_iodesc[] __initdata = {
57 { 68 {
69 .virtual = (unsigned long)S5P_VA_CHIPID,
70 .pfn = __phys_to_pfn(S5PC100_PA_CHIPID),
71 .length = SZ_4K,
72 .type = MT_DEVICE,
73 }, {
74 .virtual = (unsigned long)S3C_VA_SYS,
75 .pfn = __phys_to_pfn(S5PC100_PA_SYSCON),
76 .length = SZ_64K,
77 .type = MT_DEVICE,
78 }, {
79 .virtual = (unsigned long)S3C_VA_TIMER,
80 .pfn = __phys_to_pfn(S5PC100_PA_TIMER),
81 .length = SZ_16K,
82 .type = MT_DEVICE,
83 }, {
84 .virtual = (unsigned long)S3C_VA_WATCHDOG,
85 .pfn = __phys_to_pfn(S5PC100_PA_WATCHDOG),
86 .length = SZ_4K,
87 .type = MT_DEVICE,
88 }, {
89 .virtual = (unsigned long)S5P_VA_SROMC,
90 .pfn = __phys_to_pfn(S5PC100_PA_SROMC),
91 .length = SZ_4K,
92 .type = MT_DEVICE,
93 }, {
58 .virtual = (unsigned long)S5P_VA_SYSTIMER, 94 .virtual = (unsigned long)S5P_VA_SYSTIMER,
59 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER), 95 .pfn = __phys_to_pfn(S5PC100_PA_SYSTIMER),
60 .length = SZ_16K, 96 .length = SZ_16K,
@@ -100,15 +136,27 @@ static void s5pc100_idle(void)
100 local_irq_enable(); 136 local_irq_enable();
101} 137}
102 138
103/* s5pc100_map_io 139/*
140 * s5pc100_map_io
104 * 141 *
105 * register the standard cpu IO areas 142 * register the standard CPU IO areas
106*/ 143 */
107 144
108void __init s5pc100_map_io(void) 145void __init s5pc100_init_io(struct map_desc *mach_desc, int size)
109{ 146{
147 /* initialize the io descriptors we need for initialization */
110 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); 148 iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc));
149 if (mach_desc)
150 iotable_init(mach_desc, size);
151
152 /* detect cpu id and rev. */
153 s5p_init_cpu(S5P_VA_CHIPID);
154
155 s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
156}
111 157
158void __init s5pc100_map_io(void)
159{
112 /* initialise device information early */ 160 /* initialise device information early */
113 s5pc100_default_sdhci0(); 161 s5pc100_default_sdhci0();
114 s5pc100_default_sdhci1(); 162 s5pc100_default_sdhci1();
@@ -155,7 +203,6 @@ static int __init s5pc100_core_init(void)
155{ 203{
156 return sysdev_class_register(&s5pc100_sysclass); 204 return sysdev_class_register(&s5pc100_sysclass);
157} 205}
158
159core_initcall(s5pc100_core_init); 206core_initcall(s5pc100_core_init);
160 207
161int __init s5pc100_init(void) 208int __init s5pc100_init(void)
@@ -167,3 +214,10 @@ int __init s5pc100_init(void)
167 214
168 return sysdev_register(&s5pc100_sysdev); 215 return sysdev_register(&s5pc100_sysdev);
169} 216}
217
218/* uart registration process */
219
220void __init s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no)
221{
222 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
223}
diff --git a/arch/arm/mach-s5pc100/common.h b/arch/arm/mach-s5pc100/common.h
new file mode 100644
index 000000000000..4822b872a468
--- /dev/null
+++ b/arch/arm/mach-s5pc100/common.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
3 * http://www.samsung.com
4 *
5 * Common Header for S5PC100 machines
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ARCH_ARM_MACH_S5PC100_COMMON_H
13#define __ARCH_ARM_MACH_S5PC100_COMMON_H
14
15void s5pc100_init_io(struct map_desc *mach_desc, int size);
16void s5pc100_init_irq(void);
17
18void s5pc100_register_clocks(void);
19void s5pc100_setup_clocks(void);
20
21#ifdef CONFIG_CPU_S5PC100
22
23extern int s5pc100_init(void);
24extern void s5pc100_map_io(void);
25extern void s5pc100_init_clocks(int xtal);
26extern void s5pc100_init_uarts(struct s3c2410_uartcfg *cfg, int no);
27
28#else
29#define s5pc100_init_clocks NULL
30#define s5pc100_init_uarts NULL
31#define s5pc100_map_io NULL
32#define s5pc100_init NULL
33#endif
34
35#endif /* __ARCH_ARM_MACH_S5PC100_COMMON_H */
diff --git a/arch/arm/mach-s5pc100/init.c b/arch/arm/mach-s5pc100/init.c
deleted file mode 100644
index 19d7b523c137..000000000000
--- a/arch/arm/mach-s5pc100/init.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/* linux/arch/arm/plat-s5pc100/s5pc100-init.c
2 *
3 * Copyright 2009 Samsung Electronics Co.
4 * Byungho Min <bhmin@samsung.com>
5 *
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/init.h>
15
16#include <plat/cpu.h>
17#include <plat/devs.h>
18#include <plat/s5pc100.h>
19
20/* uart registration process */
21void __init s5pc100_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
22{
23 s3c24xx_init_uartdevs("s3c6400-uart", s5p_uart_resources, cfg, no);
24}
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 26f5c91c9427..e1c41772c7bd 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -42,7 +42,6 @@
42#include <plat/clock.h> 42#include <plat/clock.h>
43#include <plat/devs.h> 43#include <plat/devs.h>
44#include <plat/cpu.h> 44#include <plat/cpu.h>
45#include <plat/s5pc100.h>
46#include <plat/fb.h> 45#include <plat/fb.h>
47#include <plat/iic.h> 46#include <plat/iic.h>
48#include <plat/ata.h> 47#include <plat/ata.h>
@@ -53,6 +52,8 @@
53#include <plat/backlight.h> 52#include <plat/backlight.h>
54#include <plat/regs-fb-v4.h> 53#include <plat/regs-fb-v4.h>
55 54
55#include "common.h"
56
56/* Following are default values for UCON, ULCON and UFCON UART registers */ 57/* Following are default values for UCON, ULCON and UFCON UART registers */
57#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 58#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
58 S3C2410_UCON_RXILEVEL | \ 59 S3C2410_UCON_RXILEVEL | \
@@ -215,7 +216,7 @@ static struct platform_pwm_backlight_data smdkc100_bl_data = {
215 216
216static void __init smdkc100_map_io(void) 217static void __init smdkc100_map_io(void)
217{ 218{
218 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 219 s5pc100_init_io(NULL, 0);
219 s3c24xx_init_clocks(12000000); 220 s3c24xx_init_clocks(12000000);
220 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); 221 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
221} 222}
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c
index 2fb9a9c87ead..74bcd716f300 100644
--- a/arch/arm/plat-s5p/cpu.c
+++ b/arch/arm/plat-s5p/cpu.c
@@ -20,13 +20,11 @@
20#include <mach/regs-clock.h> 20#include <mach/regs-clock.h>
21 21
22#include <plat/cpu.h> 22#include <plat/cpu.h>
23#include <plat/s5pc100.h>
24#include <plat/s5pv210.h> 23#include <plat/s5pv210.h>
25#include <plat/exynos4.h> 24#include <plat/exynos4.h>
26 25
27/* table of supported CPUs */ 26/* table of supported CPUs */
28 27
29static const char name_s5pc100[] = "S5PC100";
30static const char name_s5pv210[] = "S5PV210/S5PC110"; 28static const char name_s5pv210[] = "S5PV210/S5PC110";
31static const char name_exynos4210[] = "EXYNOS4210"; 29static const char name_exynos4210[] = "EXYNOS4210";
32static const char name_exynos4212[] = "EXYNOS4212"; 30static const char name_exynos4212[] = "EXYNOS4212";
@@ -34,14 +32,6 @@ static const char name_exynos4412[] = "EXYNOS4412";
34 32
35static struct cpu_table cpu_ids[] __initdata = { 33static struct cpu_table cpu_ids[] __initdata = {
36 { 34 {
37 .idcode = S5PC100_CPU_ID,
38 .idmask = S5PC100_CPU_MASK,
39 .map_io = s5pc100_map_io,
40 .init_clocks = s5pc100_init_clocks,
41 .init_uarts = s5pc100_init_uarts,
42 .init = s5pc100_init,
43 .name = name_s5pc100,
44 }, {
45 .idcode = S5PV210_CPU_ID, 35 .idcode = S5PV210_CPU_ID,
46 .idmask = S5PV210_CPU_MASK, 36 .idmask = S5PV210_CPU_MASK,
47 .map_io = s5pv210_map_io, 37 .map_io = s5pv210_map_io,
diff --git a/arch/arm/plat-samsung/include/plat/s5pc100.h b/arch/arm/plat-samsung/include/plat/s5pc100.h
deleted file mode 100644
index 9a21aeaaf452..000000000000
--- a/arch/arm/plat-samsung/include/plat/s5pc100.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/* linux/arch/arm/plat-samsung/include/plat/s5pc100.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * Header file for s5pc100 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/* Common init code for S5PC100 related SoCs */
14
15extern void s5pc100_common_init_uarts(struct s3c2410_uartcfg *cfg, int no);
16extern void s5pc100_register_clocks(void);
17extern void s5pc100_setup_clocks(void);
18
19#ifdef CONFIG_CPU_S5PC100
20
21extern int s5pc100_init(void);
22extern void s5pc100_init_irq(void);
23extern void s5pc100_map_io(void);
24extern void s5pc100_init_clocks(int xtal);
25
26#define s5pc100_init_uarts s5pc100_common_init_uarts
27
28#else
29#define s5pc100_init_clocks NULL
30#define s5pc100_init_uarts NULL
31#define s5pc100_map_io NULL
32#define s5pc100_init NULL
33#endif