diff options
Diffstat (limited to 'arch/arm/mach-s5pv210')
-rw-r--r-- | arch/arm/mach-s5pv210/cpu.c | 197 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/dev-spi.c | 175 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/clkdev.h | 7 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/entry-macro.S | 54 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/io.h | 26 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/pwm-clock.h | 70 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/spi-clocks.h | 17 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/system.h | 23 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/include/mach/vmalloc.h | 22 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/init.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/setup-sdhci.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-s5pv210/sleep.S | 52 |
12 files changed, 750 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c new file mode 100644 index 00000000000..79907ec78d4 --- /dev/null +++ b/arch/arm/mach-s5pv210/cpu.c | |||
@@ -0,0 +1,197 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/cpu.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/interrupt.h> | ||
14 | #include <linux/list.h> | ||
15 | #include <linux/timer.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/clk.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/sysdev.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/sched.h> | ||
23 | |||
24 | #include <asm/mach/arch.h> | ||
25 | #include <asm/mach/map.h> | ||
26 | #include <asm/mach/irq.h> | ||
27 | |||
28 | #include <asm/proc-fns.h> | ||
29 | #include <mach/map.h> | ||
30 | #include <mach/regs-clock.h> | ||
31 | |||
32 | #include <plat/cpu.h> | ||
33 | #include <plat/devs.h> | ||
34 | #include <plat/clock.h> | ||
35 | #include <plat/fb-core.h> | ||
36 | #include <plat/s5pv210.h> | ||
37 | #include <plat/adc-core.h> | ||
38 | #include <plat/ata-core.h> | ||
39 | #include <plat/fimc-core.h> | ||
40 | #include <plat/iic-core.h> | ||
41 | #include <plat/keypad-core.h> | ||
42 | #include <plat/sdhci.h> | ||
43 | #include <plat/reset.h> | ||
44 | |||
45 | /* Initial IO mappings */ | ||
46 | |||
47 | static struct map_desc s5pv210_iodesc[] __initdata = { | ||
48 | { | ||
49 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | ||
50 | .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER), | ||
51 | .length = SZ_4K, | ||
52 | .type = MT_DEVICE, | ||
53 | }, { | ||
54 | .virtual = (unsigned long)S5P_VA_GPIO, | ||
55 | .pfn = __phys_to_pfn(S5PV210_PA_GPIO), | ||
56 | .length = SZ_4K, | ||
57 | .type = MT_DEVICE, | ||
58 | }, { | ||
59 | .virtual = (unsigned long)VA_VIC0, | ||
60 | .pfn = __phys_to_pfn(S5PV210_PA_VIC0), | ||
61 | .length = SZ_16K, | ||
62 | .type = MT_DEVICE, | ||
63 | }, { | ||
64 | .virtual = (unsigned long)VA_VIC1, | ||
65 | .pfn = __phys_to_pfn(S5PV210_PA_VIC1), | ||
66 | .length = SZ_16K, | ||
67 | .type = MT_DEVICE, | ||
68 | }, { | ||
69 | .virtual = (unsigned long)VA_VIC2, | ||
70 | .pfn = __phys_to_pfn(S5PV210_PA_VIC2), | ||
71 | .length = SZ_16K, | ||
72 | .type = MT_DEVICE, | ||
73 | }, { | ||
74 | .virtual = (unsigned long)VA_VIC3, | ||
75 | .pfn = __phys_to_pfn(S5PV210_PA_VIC3), | ||
76 | .length = SZ_16K, | ||
77 | .type = MT_DEVICE, | ||
78 | }, { | ||
79 | .virtual = (unsigned long)S3C_VA_UART, | ||
80 | .pfn = __phys_to_pfn(S3C_PA_UART), | ||
81 | .length = SZ_512K, | ||
82 | .type = MT_DEVICE, | ||
83 | }, { | ||
84 | .virtual = (unsigned long)S5P_VA_DMC0, | ||
85 | .pfn = __phys_to_pfn(S5PV210_PA_DMC0), | ||
86 | .length = SZ_4K, | ||
87 | .type = MT_DEVICE, | ||
88 | }, { | ||
89 | .virtual = (unsigned long)S5P_VA_DMC1, | ||
90 | .pfn = __phys_to_pfn(S5PV210_PA_DMC1), | ||
91 | .length = SZ_4K, | ||
92 | .type = MT_DEVICE, | ||
93 | }, { | ||
94 | .virtual = (unsigned long)S3C_VA_USB_HSPHY, | ||
95 | .pfn =__phys_to_pfn(S5PV210_PA_HSPHY), | ||
96 | .length = SZ_4K, | ||
97 | .type = MT_DEVICE, | ||
98 | } | ||
99 | }; | ||
100 | |||
101 | static void s5pv210_idle(void) | ||
102 | { | ||
103 | if (!need_resched()) | ||
104 | cpu_do_idle(); | ||
105 | |||
106 | local_irq_enable(); | ||
107 | } | ||
108 | |||
109 | static void s5pv210_sw_reset(void) | ||
110 | { | ||
111 | __raw_writel(0x1, S5P_SWRESET); | ||
112 | } | ||
113 | |||
114 | /* s5pv210_map_io | ||
115 | * | ||
116 | * register the standard cpu IO areas | ||
117 | */ | ||
118 | |||
119 | void __init s5pv210_map_io(void) | ||
120 | { | ||
121 | iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc)); | ||
122 | |||
123 | /* initialise device information early */ | ||
124 | s5pv210_default_sdhci0(); | ||
125 | s5pv210_default_sdhci1(); | ||
126 | s5pv210_default_sdhci2(); | ||
127 | s5pv210_default_sdhci3(); | ||
128 | |||
129 | s3c_adc_setname("samsung-adc-v3"); | ||
130 | |||
131 | s3c_cfcon_setname("s5pv210-pata"); | ||
132 | |||
133 | s3c_fimc_setname(0, "s5pv210-fimc"); | ||
134 | s3c_fimc_setname(1, "s5pv210-fimc"); | ||
135 | s3c_fimc_setname(2, "s5pv210-fimc"); | ||
136 | |||
137 | /* the i2c devices are directly compatible with s3c2440 */ | ||
138 | s3c_i2c0_setname("s3c2440-i2c"); | ||
139 | s3c_i2c1_setname("s3c2440-i2c"); | ||
140 | s3c_i2c2_setname("s3c2440-i2c"); | ||
141 | |||
142 | s3c_fb_setname("s5pv210-fb"); | ||
143 | |||
144 | /* Use s5pv210-keypad instead of samsung-keypad */ | ||
145 | samsung_keypad_setname("s5pv210-keypad"); | ||
146 | } | ||
147 | |||
148 | void __init s5pv210_init_clocks(int xtal) | ||
149 | { | ||
150 | printk(KERN_DEBUG "%s: initializing clocks\n", __func__); | ||
151 | |||
152 | s3c24xx_register_baseclocks(xtal); | ||
153 | s5p_register_clocks(xtal); | ||
154 | s5pv210_register_clocks(); | ||
155 | s5pv210_setup_clocks(); | ||
156 | } | ||
157 | |||
158 | void __init s5pv210_init_irq(void) | ||
159 | { | ||
160 | u32 vic[4]; /* S5PV210 supports 4 VIC */ | ||
161 | |||
162 | /* All the VICs are fully populated. */ | ||
163 | vic[0] = ~0; | ||
164 | vic[1] = ~0; | ||
165 | vic[2] = ~0; | ||
166 | vic[3] = ~0; | ||
167 | |||
168 | s5p_init_irq(vic, ARRAY_SIZE(vic)); | ||
169 | } | ||
170 | |||
171 | struct sysdev_class s5pv210_sysclass = { | ||
172 | .name = "s5pv210-core", | ||
173 | }; | ||
174 | |||
175 | static struct sys_device s5pv210_sysdev = { | ||
176 | .cls = &s5pv210_sysclass, | ||
177 | }; | ||
178 | |||
179 | static int __init s5pv210_core_init(void) | ||
180 | { | ||
181 | return sysdev_class_register(&s5pv210_sysclass); | ||
182 | } | ||
183 | |||
184 | core_initcall(s5pv210_core_init); | ||
185 | |||
186 | int __init s5pv210_init(void) | ||
187 | { | ||
188 | printk(KERN_INFO "S5PV210: Initializing architecture\n"); | ||
189 | |||
190 | /* set idle function */ | ||
191 | pm_idle = s5pv210_idle; | ||
192 | |||
193 | /* set sw_reset function */ | ||
194 | s5p_reset_hook = s5pv210_sw_reset; | ||
195 | |||
196 | return sysdev_register(&s5pv210_sysdev); | ||
197 | } | ||
diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c new file mode 100644 index 00000000000..eaf9a7bff7a --- /dev/null +++ b/arch/arm/mach-s5pv210/dev-spi.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/dev-spi.c | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/gpio.h> | ||
14 | |||
15 | #include <mach/dma.h> | ||
16 | #include <mach/map.h> | ||
17 | #include <mach/irqs.h> | ||
18 | #include <mach/spi-clocks.h> | ||
19 | |||
20 | #include <plat/s3c64xx-spi.h> | ||
21 | #include <plat/gpio-cfg.h> | ||
22 | |||
23 | static char *spi_src_clks[] = { | ||
24 | [S5PV210_SPI_SRCCLK_PCLK] = "pclk", | ||
25 | [S5PV210_SPI_SRCCLK_SCLK] = "sclk_spi", | ||
26 | }; | ||
27 | |||
28 | /* SPI Controller platform_devices */ | ||
29 | |||
30 | /* Since we emulate multi-cs capability, we do not touch the CS. | ||
31 | * The emulated CS is toggled by board specific mechanism, as it can | ||
32 | * be either some immediate GPIO or some signal out of some other | ||
33 | * chip in between ... or some yet another way. | ||
34 | * We simply do not assume anything about CS. | ||
35 | */ | ||
36 | static int s5pv210_spi_cfg_gpio(struct platform_device *pdev) | ||
37 | { | ||
38 | unsigned int base; | ||
39 | |||
40 | switch (pdev->id) { | ||
41 | case 0: | ||
42 | base = S5PV210_GPB(0); | ||
43 | break; | ||
44 | |||
45 | case 1: | ||
46 | base = S5PV210_GPB(4); | ||
47 | break; | ||
48 | |||
49 | default: | ||
50 | dev_err(&pdev->dev, "Invalid SPI Controller number!"); | ||
51 | return -EINVAL; | ||
52 | } | ||
53 | |||
54 | s3c_gpio_cfgall_range(base, 3, | ||
55 | S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP); | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static struct resource s5pv210_spi0_resource[] = { | ||
61 | [0] = { | ||
62 | .start = S5PV210_PA_SPI0, | ||
63 | .end = S5PV210_PA_SPI0 + 0x100 - 1, | ||
64 | .flags = IORESOURCE_MEM, | ||
65 | }, | ||
66 | [1] = { | ||
67 | .start = DMACH_SPI0_TX, | ||
68 | .end = DMACH_SPI0_TX, | ||
69 | .flags = IORESOURCE_DMA, | ||
70 | }, | ||
71 | [2] = { | ||
72 | .start = DMACH_SPI0_RX, | ||
73 | .end = DMACH_SPI0_RX, | ||
74 | .flags = IORESOURCE_DMA, | ||
75 | }, | ||
76 | [3] = { | ||
77 | .start = IRQ_SPI0, | ||
78 | .end = IRQ_SPI0, | ||
79 | .flags = IORESOURCE_IRQ, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct s3c64xx_spi_info s5pv210_spi0_pdata = { | ||
84 | .cfg_gpio = s5pv210_spi_cfg_gpio, | ||
85 | .fifo_lvl_mask = 0x1ff, | ||
86 | .rx_lvl_offset = 15, | ||
87 | .high_speed = 1, | ||
88 | .tx_st_done = 25, | ||
89 | }; | ||
90 | |||
91 | static u64 spi_dmamask = DMA_BIT_MASK(32); | ||
92 | |||
93 | struct platform_device s5pv210_device_spi0 = { | ||
94 | .name = "s3c64xx-spi", | ||
95 | .id = 0, | ||
96 | .num_resources = ARRAY_SIZE(s5pv210_spi0_resource), | ||
97 | .resource = s5pv210_spi0_resource, | ||
98 | .dev = { | ||
99 | .dma_mask = &spi_dmamask, | ||
100 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
101 | .platform_data = &s5pv210_spi0_pdata, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | static struct resource s5pv210_spi1_resource[] = { | ||
106 | [0] = { | ||
107 | .start = S5PV210_PA_SPI1, | ||
108 | .end = S5PV210_PA_SPI1 + 0x100 - 1, | ||
109 | .flags = IORESOURCE_MEM, | ||
110 | }, | ||
111 | [1] = { | ||
112 | .start = DMACH_SPI1_TX, | ||
113 | .end = DMACH_SPI1_TX, | ||
114 | .flags = IORESOURCE_DMA, | ||
115 | }, | ||
116 | [2] = { | ||
117 | .start = DMACH_SPI1_RX, | ||
118 | .end = DMACH_SPI1_RX, | ||
119 | .flags = IORESOURCE_DMA, | ||
120 | }, | ||
121 | [3] = { | ||
122 | .start = IRQ_SPI1, | ||
123 | .end = IRQ_SPI1, | ||
124 | .flags = IORESOURCE_IRQ, | ||
125 | }, | ||
126 | }; | ||
127 | |||
128 | static struct s3c64xx_spi_info s5pv210_spi1_pdata = { | ||
129 | .cfg_gpio = s5pv210_spi_cfg_gpio, | ||
130 | .fifo_lvl_mask = 0x7f, | ||
131 | .rx_lvl_offset = 15, | ||
132 | .high_speed = 1, | ||
133 | .tx_st_done = 25, | ||
134 | }; | ||
135 | |||
136 | struct platform_device s5pv210_device_spi1 = { | ||
137 | .name = "s3c64xx-spi", | ||
138 | .id = 1, | ||
139 | .num_resources = ARRAY_SIZE(s5pv210_spi1_resource), | ||
140 | .resource = s5pv210_spi1_resource, | ||
141 | .dev = { | ||
142 | .dma_mask = &spi_dmamask, | ||
143 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
144 | .platform_data = &s5pv210_spi1_pdata, | ||
145 | }, | ||
146 | }; | ||
147 | |||
148 | void __init s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs) | ||
149 | { | ||
150 | struct s3c64xx_spi_info *pd; | ||
151 | |||
152 | /* Reject invalid configuration */ | ||
153 | if (!num_cs || src_clk_nr < 0 | ||
154 | || src_clk_nr > S5PV210_SPI_SRCCLK_SCLK) { | ||
155 | printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__); | ||
156 | return; | ||
157 | } | ||
158 | |||
159 | switch (cntrlr) { | ||
160 | case 0: | ||
161 | pd = &s5pv210_spi0_pdata; | ||
162 | break; | ||
163 | case 1: | ||
164 | pd = &s5pv210_spi1_pdata; | ||
165 | break; | ||
166 | default: | ||
167 | printk(KERN_ERR "%s: Invalid SPI controller(%d)\n", | ||
168 | __func__, cntrlr); | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | pd->num_cs = num_cs; | ||
173 | pd->src_clk_nr = src_clk_nr; | ||
174 | pd->src_clk_name = spi_src_clks[src_clk_nr]; | ||
175 | } | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/clkdev.h b/arch/arm/mach-s5pv210/include/mach/clkdev.h new file mode 100644 index 00000000000..7dffa83d23f --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/clkdev.h | |||
@@ -0,0 +1,7 @@ | |||
1 | #ifndef __MACH_CLKDEV_H__ | ||
2 | #define __MACH_CLKDEV_H__ | ||
3 | |||
4 | #define __clk_get(clk) ({ 1; }) | ||
5 | #define __clk_put(clk) do {} while (0) | ||
6 | |||
7 | #endif | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/entry-macro.S b/arch/arm/mach-s5pv210/include/mach/entry-macro.S new file mode 100644 index 00000000000..3aa41ac59f0 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/entry-macro.S | |||
@@ -0,0 +1,54 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/entry-macro.S | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Low-level IRQ helper macros for the Samsung S5PV210 | ||
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 <asm/hardware/vic.h> | ||
14 | #include <mach/map.h> | ||
15 | #include <plat/irqs.h> | ||
16 | |||
17 | .macro disable_fiq | ||
18 | .endm | ||
19 | |||
20 | .macro get_irqnr_preamble, base, tmp | ||
21 | ldr \base, =VA_VIC0 | ||
22 | .endm | ||
23 | |||
24 | .macro arch_ret_to_user, tmp1, tmp2 | ||
25 | .endm | ||
26 | |||
27 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
28 | |||
29 | @ check the vic0 | ||
30 | mov \irqnr, # S5P_IRQ_OFFSET + 31 | ||
31 | ldr \irqstat, [ \base, # VIC_IRQ_STATUS ] | ||
32 | teq \irqstat, #0 | ||
33 | |||
34 | @ otherwise try vic1 | ||
35 | addeq \tmp, \base, #(VA_VIC1 - VA_VIC0) | ||
36 | addeq \irqnr, \irqnr, #32 | ||
37 | ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ] | ||
38 | teqeq \irqstat, #0 | ||
39 | |||
40 | @ otherwise try vic2 | ||
41 | addeq \tmp, \base, #(VA_VIC2 - VA_VIC0) | ||
42 | addeq \irqnr, \irqnr, #32 | ||
43 | ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ] | ||
44 | teqeq \irqstat, #0 | ||
45 | |||
46 | @ otherwise try vic3 | ||
47 | addeq \tmp, \base, #(VA_VIC3 - VA_VIC0) | ||
48 | addeq \irqnr, \irqnr, #32 | ||
49 | ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ] | ||
50 | teqeq \irqstat, #0 | ||
51 | |||
52 | clzne \irqstat, \irqstat | ||
53 | subne \irqnr, \irqnr, \irqstat | ||
54 | .endm | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/io.h b/arch/arm/mach-s5pv210/include/mach/io.h new file mode 100644 index 00000000000..5ab9d560bc8 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/io.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/io.h | ||
2 | * | ||
3 | * Copyright 2008-2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
6 | * http://www.samsung.com/ | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6442/include/mach/io.h | ||
9 | * | ||
10 | * Default IO routines for S5PV210 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARM_ARCH_IO_H | ||
18 | #define __ASM_ARM_ARCH_IO_H __FILE__ | ||
19 | |||
20 | /* No current ISA/PCI bus support. */ | ||
21 | #define __io(a) __typesafe_io(a) | ||
22 | #define __mem_pci(a) (a) | ||
23 | |||
24 | #define IO_SPACE_LIMIT (0xFFFFFFFF) | ||
25 | |||
26 | #endif /* __ASM_ARM_ARCH_IO_H */ | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/pwm-clock.h b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h new file mode 100644 index 00000000000..f8a9f1b330e --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/pwm-clock.h | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * Copyright 2008 Openmoko, Inc. | ||
7 | * Copyright 2008 Simtec Electronics | ||
8 | * Ben Dooks <ben@simtec.co.uk> | ||
9 | * http://armlinux.simtec.co.uk/ | ||
10 | * | ||
11 | * Based on arch/arm/mach-s3c64xx/include/mach/pwm-clock.h | ||
12 | * | ||
13 | * S5PV210 - pwm clock and timer support | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | */ | ||
19 | |||
20 | #ifndef __ASM_ARCH_PWMCLK_H | ||
21 | #define __ASM_ARCH_PWMCLK_H __FILE__ | ||
22 | |||
23 | /** | ||
24 | * pwm_cfg_src_is_tclk() - return whether the given mux config is a tclk | ||
25 | * @tcfg: The timer TCFG1 register bits shifted down to 0. | ||
26 | * | ||
27 | * Return true if the given configuration from TCFG1 is a TCLK instead | ||
28 | * any of the TDIV clocks. | ||
29 | */ | ||
30 | static inline int pwm_cfg_src_is_tclk(unsigned long tcfg) | ||
31 | { | ||
32 | return tcfg == S3C64XX_TCFG1_MUX_TCLK; | ||
33 | } | ||
34 | |||
35 | /** | ||
36 | * tcfg_to_divisor() - convert tcfg1 setting to a divisor | ||
37 | * @tcfg1: The tcfg1 setting, shifted down. | ||
38 | * | ||
39 | * Get the divisor value for the given tcfg1 setting. We assume the | ||
40 | * caller has already checked to see if this is not a TCLK source. | ||
41 | */ | ||
42 | static inline unsigned long tcfg_to_divisor(unsigned long tcfg1) | ||
43 | { | ||
44 | return 1 << tcfg1; | ||
45 | } | ||
46 | |||
47 | /** | ||
48 | * pwm_tdiv_has_div1() - does the tdiv setting have a /1 | ||
49 | * | ||
50 | * Return true if we have a /1 in the tdiv setting. | ||
51 | */ | ||
52 | static inline unsigned int pwm_tdiv_has_div1(void) | ||
53 | { | ||
54 | return 1; | ||
55 | } | ||
56 | |||
57 | /** | ||
58 | * pwm_tdiv_div_bits() - calculate TCFG1 divisor value. | ||
59 | * @div: The divisor to calculate the bit information for. | ||
60 | * | ||
61 | * Turn a divisor into the necessary bit field for TCFG1. | ||
62 | */ | ||
63 | static inline unsigned long pwm_tdiv_div_bits(unsigned int div) | ||
64 | { | ||
65 | return ilog2(div); | ||
66 | } | ||
67 | |||
68 | #define S3C_TCFG1_MUX_TCLK S3C64XX_TCFG1_MUX_TCLK | ||
69 | |||
70 | #endif /* __ASM_ARCH_PWMCLK_H */ | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/spi-clocks.h b/arch/arm/mach-s5pv210/include/mach/spi-clocks.h new file mode 100644 index 00000000000..02acded5f73 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/spi-clocks.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/spi-clocks.h | ||
2 | * | ||
3 | * Copyright (C) 2010 Samsung Electronics Co. Ltd. | ||
4 | * Jaswinder Singh <jassi.brar@samsung.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __S5PV210_PLAT_SPI_CLKS_H | ||
12 | #define __S5PV210_PLAT_SPI_CLKS_H __FILE__ | ||
13 | |||
14 | #define S5PV210_SPI_SRCCLK_PCLK 0 | ||
15 | #define S5PV210_SPI_SRCCLK_SCLK 1 | ||
16 | |||
17 | #endif /* __S5PV210_PLAT_SPI_CLKS_H */ | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/system.h b/arch/arm/mach-s5pv210/include/mach/system.h new file mode 100644 index 00000000000..af8a200b213 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/system.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/system.h | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5PV210 - system support header | ||
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 | #ifndef __ASM_ARCH_SYSTEM_H | ||
14 | #define __ASM_ARCH_SYSTEM_H __FILE__ | ||
15 | |||
16 | #include <plat/system-reset.h> | ||
17 | |||
18 | static void arch_idle(void) | ||
19 | { | ||
20 | /* nothing here yet */ | ||
21 | } | ||
22 | |||
23 | #endif /* __ASM_ARCH_SYSTEM_H */ | ||
diff --git a/arch/arm/mach-s5pv210/include/mach/vmalloc.h b/arch/arm/mach-s5pv210/include/mach/vmalloc.h new file mode 100644 index 00000000000..a6c659d68a5 --- /dev/null +++ b/arch/arm/mach-s5pv210/include/mach/vmalloc.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/vmalloc.h | ||
2 | * | ||
3 | * Copyright 2010 Ben Dooks <ben-linux@fluff.org> | ||
4 | * | ||
5 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
6 | * http://www.samsung.com/ | ||
7 | * | ||
8 | * Based on arch/arm/mach-s5p6442/include/mach/vmalloc.h | ||
9 | * | ||
10 | * S5PV210 vmalloc definition | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASM_ARCH_VMALLOC_H | ||
18 | #define __ASM_ARCH_VMALLOC_H __FILE__ | ||
19 | |||
20 | #define VMALLOC_END 0xF6000000UL | ||
21 | |||
22 | #endif /* __ASM_ARCH_VMALLOC_H */ | ||
diff --git a/arch/arm/mach-s5pv210/init.c b/arch/arm/mach-s5pv210/init.c new file mode 100644 index 00000000000..4865ae2c475 --- /dev/null +++ b/arch/arm/mach-s5pv210/init.c | |||
@@ -0,0 +1,44 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/init.c | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/serial_core.h> | ||
15 | |||
16 | #include <plat/cpu.h> | ||
17 | #include <plat/devs.h> | ||
18 | #include <plat/s5pv210.h> | ||
19 | #include <plat/regs-serial.h> | ||
20 | |||
21 | static struct s3c24xx_uart_clksrc s5pv210_serial_clocks[] = { | ||
22 | [0] = { | ||
23 | .name = "pclk", | ||
24 | .divisor = 1, | ||
25 | .min_baud = 0, | ||
26 | .max_baud = 0, | ||
27 | }, | ||
28 | }; | ||
29 | |||
30 | /* uart registration process */ | ||
31 | void __init s5pv210_common_init_uarts(struct s3c2410_uartcfg *cfg, int no) | ||
32 | { | ||
33 | struct s3c2410_uartcfg *tcfg = cfg; | ||
34 | u32 ucnt; | ||
35 | |||
36 | for (ucnt = 0; ucnt < no; ucnt++, tcfg++) { | ||
37 | if (!tcfg->clocks) { | ||
38 | tcfg->clocks = s5pv210_serial_clocks; | ||
39 | tcfg->clocks_size = ARRAY_SIZE(s5pv210_serial_clocks); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | s3c24xx_init_uartdevs("s5pv210-uart", s5p_uart_resources, cfg, no); | ||
44 | } | ||
diff --git a/arch/arm/mach-s5pv210/setup-sdhci.c b/arch/arm/mach-s5pv210/setup-sdhci.c new file mode 100644 index 00000000000..a83b6c909f6 --- /dev/null +++ b/arch/arm/mach-s5pv210/setup-sdhci.c | |||
@@ -0,0 +1,63 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/setup-sdhci.c | ||
2 | * | ||
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
6 | * S5PV210 - Helper functions for settign up SDHCI device(s) (HSMMC) | ||
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/platform_device.h> | ||
17 | #include <linux/io.h> | ||
18 | |||
19 | #include <linux/mmc/card.h> | ||
20 | #include <linux/mmc/host.h> | ||
21 | |||
22 | #include <plat/regs-sdhci.h> | ||
23 | #include <plat/sdhci.h> | ||
24 | |||
25 | /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ | ||
26 | |||
27 | char *s5pv210_hsmmc_clksrcs[4] = { | ||
28 | [0] = "hsmmc", /* HCLK */ | ||
29 | /* [1] = "hsmmc", - duplicate HCLK entry */ | ||
30 | [2] = "sclk_mmc", /* mmc_bus */ | ||
31 | /* [3] = NULL, - reserved */ | ||
32 | }; | ||
33 | |||
34 | void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev, | ||
35 | void __iomem *r, | ||
36 | struct mmc_ios *ios, | ||
37 | struct mmc_card *card) | ||
38 | { | ||
39 | u32 ctrl2, ctrl3; | ||
40 | |||
41 | /* don't need to alter anything according to card-type */ | ||
42 | |||
43 | writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4); | ||
44 | |||
45 | ctrl2 = readl(r + S3C_SDHCI_CONTROL2); | ||
46 | ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK; | ||
47 | ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR | | ||
48 | S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK | | ||
49 | S3C_SDHCI_CTRL2_ENFBCLKRX | | ||
50 | S3C_SDHCI_CTRL2_DFCNT_NONE | | ||
51 | S3C_SDHCI_CTRL2_ENCLKOUTHOLD); | ||
52 | |||
53 | if (ios->clock < 25 * 1000000) | ||
54 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 | | ||
55 | S3C_SDHCI_CTRL3_FCSEL2 | | ||
56 | S3C_SDHCI_CTRL3_FCSEL1 | | ||
57 | S3C_SDHCI_CTRL3_FCSEL0); | ||
58 | else | ||
59 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); | ||
60 | |||
61 | writel(ctrl2, r + S3C_SDHCI_CONTROL2); | ||
62 | writel(ctrl3, r + S3C_SDHCI_CONTROL3); | ||
63 | } | ||
diff --git a/arch/arm/mach-s5pv210/sleep.S b/arch/arm/mach-s5pv210/sleep.S new file mode 100644 index 00000000000..e3452ccd4b0 --- /dev/null +++ b/arch/arm/mach-s5pv210/sleep.S | |||
@@ -0,0 +1,52 @@ | |||
1 | /* linux/arch/arm/plat-s5p/sleep.S | ||
2 | * | ||
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com | ||
5 | * | ||
6 | * S5PV210 power Manager (Suspend-To-RAM) support | ||
7 | * Based on S3C2410 sleep code by: | ||
8 | * Ben Dooks, (c) 2004 Simtec Electronics | ||
9 | * | ||
10 | * Based on PXA/SA1100 sleep code by: | ||
11 | * Nicolas Pitre, (c) 2002 Monta Vista Software Inc | ||
12 | * Cliff Brake, (c) 2001 | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | */ | ||
28 | |||
29 | #include <linux/linkage.h> | ||
30 | #include <asm/assembler.h> | ||
31 | #include <asm/memory.h> | ||
32 | |||
33 | .text | ||
34 | |||
35 | /* sleep magic, to allow the bootloader to check for an valid | ||
36 | * image to resume to. Must be the first word before the | ||
37 | * s3c_cpu_resume entry. | ||
38 | */ | ||
39 | |||
40 | .word 0x2bedf00d | ||
41 | |||
42 | /* s3c_cpu_resume | ||
43 | * | ||
44 | * resume code entry for bootloader to call | ||
45 | * | ||
46 | * we must put this code here in the data segment as we have no | ||
47 | * other way of restoring the stack pointer after sleep, and we | ||
48 | * must not write to the code segment (code is read-only) | ||
49 | */ | ||
50 | |||
51 | ENTRY(s3c_cpu_resume) | ||
52 | b cpu_resume | ||