aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s5p64x0
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 17:30:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 17:30:28 -0500
commit190a44e65b0f32eaf5b4db3969f5eb224f83a7a2 (patch)
tree577c9a3949ba06e62d082eb11894b7045ebe3ef3 /arch/arm/mach-s5p64x0
parentdfc1ebe76663d582a01c9dc572395cf8086d01de (diff)
parentb48741cce3be32a48af9a2b272f3f13a077375cf (diff)
Merge tag 'cleanup2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Cleanups for the Samsung platforms Various cleanup changes that the device driver changes are built upon. Since the samsung cleanups depend on the device tree series, which depends on the first set of cleanups for tegra. * tag 'cleanup2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: ARM: EXYNOS: Use gpio_request_one ARM: S5PV210: Use gpio_request_one ARM: S3C64XX: Modified according to SPI consolidation work ARM: S5PV210: Modified files for SPI consolidation work ARM: S5P64X0: Modified files for SPI consolidation work ARM: S5PC100: Modified files for SPI consolidation work ARM: S3C64XX: Modified files for SPI consolidation work ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung ARM: SAMSUNG: Remove SPI bus clocks from platform data ARM: S5PV210: Add SPI clkdev support ARM: S5P64X0: Add SPI clkdev support ARM: S5PC100: Add SPI clkdev support ARM: S3C64XX: Add SPI clkdev support spi/s3c64xx: Use bus clocks created using clkdev mmc: sdhci-s3c: Use generic clock names for sdhci bus clock options ARM: SAMSUNG: Add lookup of sdhci-s3c clocks using generic names ARM: SAMSUNG: Remove SDHCI bus clocks from platform data ARM: SAMSUNG: Use kmemdup rather than duplicating its implementation ARM: EXYNOS: remove exynos4_scu_enable()
Diffstat (limited to 'arch/arm/mach-s5p64x0')
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig7
-rw-r--r--arch/arm/mach-s5p64x0/Makefile2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c61
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c49
-rw-r--r--arch/arm/mach-s5p64x0/dev-spi.c224
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/map.h2
-rw-r--r--arch/arm/mach-s5p64x0/setup-spi.c55
7 files changed, 121 insertions, 279 deletions
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index 18690c5f99e6..dd8c85ef6dab 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -36,6 +36,11 @@ config S5P64X0_SETUP_I2C1
36 help 36 help
37 Common setup code for i2c bus 1. 37 Common setup code for i2c bus 1.
38 38
39config S5P64X0_SETUP_SPI
40 bool
41 help
42 Common setup code for SPI GPIO configurations
43
39# machine support 44# machine support
40 45
41config MACH_SMDK6440 46config MACH_SMDK6440
@@ -45,7 +50,6 @@ config MACH_SMDK6440
45 select S3C_DEV_I2C1 50 select S3C_DEV_I2C1
46 select S3C_DEV_RTC 51 select S3C_DEV_RTC
47 select S3C_DEV_WDT 52 select S3C_DEV_WDT
48 select S3C64XX_DEV_SPI
49 select SAMSUNG_DEV_ADC 53 select SAMSUNG_DEV_ADC
50 select SAMSUNG_DEV_BACKLIGHT 54 select SAMSUNG_DEV_BACKLIGHT
51 select SAMSUNG_DEV_PWM 55 select SAMSUNG_DEV_PWM
@@ -62,7 +66,6 @@ config MACH_SMDK6450
62 select S3C_DEV_I2C1 66 select S3C_DEV_I2C1
63 select S3C_DEV_RTC 67 select S3C_DEV_RTC
64 select S3C_DEV_WDT 68 select S3C_DEV_WDT
65 select S3C64XX_DEV_SPI
66 select SAMSUNG_DEV_ADC 69 select SAMSUNG_DEV_ADC
67 select SAMSUNG_DEV_BACKLIGHT 70 select SAMSUNG_DEV_BACKLIGHT
68 select SAMSUNG_DEV_PWM 71 select SAMSUNG_DEV_PWM
diff --git a/arch/arm/mach-s5p64x0/Makefile b/arch/arm/mach-s5p64x0/Makefile
index d3f7409999f2..e167ca136f5d 100644
--- a/arch/arm/mach-s5p64x0/Makefile
+++ b/arch/arm/mach-s5p64x0/Makefile
@@ -28,8 +28,8 @@ obj-$(CONFIG_MACH_SMDK6450) += mach-smdk6450.o
28# device support 28# device support
29 29
30obj-y += dev-audio.o 30obj-y += dev-audio.o
31obj-$(CONFIG_S3C64XX_DEV_SPI) += dev-spi.o
32 31
33obj-y += setup-i2c0.o 32obj-y += setup-i2c0.o
34obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o 33obj-$(CONFIG_S5P64X0_SETUP_I2C1) += setup-i2c1.o
35obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o 34obj-$(CONFIG_S5P64X0_SETUP_FB_24BPP) += setup-fb-24bpp.o
35obj-$(CONFIG_S5P64X0_SETUP_SPI) += setup-spi.o
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index 4c797ab3b3fd..925d2daa60c7 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -269,18 +269,6 @@ static struct clk init_clocks_off[] = {
269 .enable = s5p64x0_pclk_ctrl, 269 .enable = s5p64x0_pclk_ctrl,
270 .ctrlbit = (1 << 31), 270 .ctrlbit = (1 << 31),
271 }, { 271 }, {
272 .name = "sclk_spi_48",
273 .devname = "s3c64xx-spi.0",
274 .parent = &clk_48m,
275 .enable = s5p64x0_sclk_ctrl,
276 .ctrlbit = (1 << 22),
277 }, {
278 .name = "sclk_spi_48",
279 .devname = "s3c64xx-spi.1",
280 .parent = &clk_48m,
281 .enable = s5p64x0_sclk_ctrl,
282 .ctrlbit = (1 << 23),
283 }, {
284 .name = "mmc_48m", 272 .name = "mmc_48m",
285 .devname = "s3c-sdhci.0", 273 .devname = "s3c-sdhci.0",
286 .parent = &clk_48m, 274 .parent = &clk_48m,
@@ -422,26 +410,6 @@ static struct clksrc_clk clksrcs[] = {
422 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 }, 410 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
423 }, { 411 }, {
424 .clk = { 412 .clk = {
425 .name = "sclk_spi",
426 .devname = "s3c64xx-spi.0",
427 .ctrlbit = (1 << 20),
428 .enable = s5p64x0_sclk_ctrl,
429 },
430 .sources = &clkset_group1,
431 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
432 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
433 }, {
434 .clk = {
435 .name = "sclk_spi",
436 .devname = "s3c64xx-spi.1",
437 .ctrlbit = (1 << 21),
438 .enable = s5p64x0_sclk_ctrl,
439 },
440 .sources = &clkset_group1,
441 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
442 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
443 }, {
444 .clk = {
445 .name = "sclk_post", 413 .name = "sclk_post",
446 .ctrlbit = (1 << 10), 414 .ctrlbit = (1 << 10),
447 .enable = s5p64x0_sclk_ctrl, 415 .enable = s5p64x0_sclk_ctrl,
@@ -490,6 +458,30 @@ static struct clksrc_clk clk_sclk_uclk = {
490 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 }, 458 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
491}; 459};
492 460
461static struct clksrc_clk clk_sclk_spi0 = {
462 .clk = {
463 .name = "sclk_spi",
464 .devname = "s3c64xx-spi.0",
465 .ctrlbit = (1 << 20),
466 .enable = s5p64x0_sclk_ctrl,
467 },
468 .sources = &clkset_group1,
469 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
470 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
471};
472
473static struct clksrc_clk clk_sclk_spi1 = {
474 .clk = {
475 .name = "sclk_spi",
476 .devname = "s3c64xx-spi.1",
477 .ctrlbit = (1 << 21),
478 .enable = s5p64x0_sclk_ctrl,
479 },
480 .sources = &clkset_group1,
481 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
482 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
483};
484
493/* Clock initialization code */ 485/* Clock initialization code */
494static struct clksrc_clk *sysclks[] = { 486static struct clksrc_clk *sysclks[] = {
495 &clk_mout_apll, 487 &clk_mout_apll,
@@ -510,11 +502,16 @@ static struct clk dummy_apb_pclk = {
510 502
511static struct clksrc_clk *clksrc_cdev[] = { 503static struct clksrc_clk *clksrc_cdev[] = {
512 &clk_sclk_uclk, 504 &clk_sclk_uclk,
505 &clk_sclk_spi0,
506 &clk_sclk_spi1,
513}; 507};
514 508
515static struct clk_lookup s5p6440_clk_lookup[] = { 509static struct clk_lookup s5p6440_clk_lookup[] = {
516 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), 510 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
517 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), 511 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
512 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
513 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
514 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
518}; 515};
519 516
520void __init_or_cpufreq s5p6440_setup_clocks(void) 517void __init_or_cpufreq s5p6440_setup_clocks(void)
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index 26aa63402d6b..c390a59f68ac 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -444,26 +444,6 @@ static struct clksrc_clk clksrcs[] = {
444 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 }, 444 .reg_div = { .reg = S5P64X0_CLK_DIV1, .shift = 8, .size = 4 },
445 }, { 445 }, {
446 .clk = { 446 .clk = {
447 .name = "sclk_spi",
448 .devname = "s3c64xx-spi.0",
449 .ctrlbit = (1 << 20),
450 .enable = s5p64x0_sclk_ctrl,
451 },
452 .sources = &clkset_group2,
453 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
454 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
455 }, {
456 .clk = {
457 .name = "sclk_spi",
458 .devname = "s3c64xx-spi.1",
459 .ctrlbit = (1 << 21),
460 .enable = s5p64x0_sclk_ctrl,
461 },
462 .sources = &clkset_group2,
463 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
464 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
465 }, {
466 .clk = {
467 .name = "sclk_fimc", 447 .name = "sclk_fimc",
468 .ctrlbit = (1 << 10), 448 .ctrlbit = (1 << 10),
469 .enable = s5p64x0_sclk_ctrl, 449 .enable = s5p64x0_sclk_ctrl,
@@ -539,13 +519,42 @@ static struct clksrc_clk clk_sclk_uclk = {
539 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 }, 519 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 16, .size = 4 },
540}; 520};
541 521
522static struct clksrc_clk clk_sclk_spi0 = {
523 .clk = {
524 .name = "sclk_spi",
525 .devname = "s3c64xx-spi.0",
526 .ctrlbit = (1 << 20),
527 .enable = s5p64x0_sclk_ctrl,
528 },
529 .sources = &clkset_group2,
530 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 14, .size = 2 },
531 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 0, .size = 4 },
532};
533
534static struct clksrc_clk clk_sclk_spi1 = {
535 .clk = {
536 .name = "sclk_spi",
537 .devname = "s3c64xx-spi.1",
538 .ctrlbit = (1 << 21),
539 .enable = s5p64x0_sclk_ctrl,
540 },
541 .sources = &clkset_group2,
542 .reg_src = { .reg = S5P64X0_CLK_SRC0, .shift = 16, .size = 2 },
543 .reg_div = { .reg = S5P64X0_CLK_DIV2, .shift = 4, .size = 4 },
544};
545
542static struct clksrc_clk *clksrc_cdev[] = { 546static struct clksrc_clk *clksrc_cdev[] = {
543 &clk_sclk_uclk, 547 &clk_sclk_uclk,
548 &clk_sclk_spi0,
549 &clk_sclk_spi1,
544}; 550};
545 551
546static struct clk_lookup s5p6450_clk_lookup[] = { 552static struct clk_lookup s5p6450_clk_lookup[] = {
547 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), 553 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
548 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), 554 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
555 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
556 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
557 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
549}; 558};
550 559
551/* Clock initialization code */ 560/* Clock initialization code */
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
deleted file mode 100644
index 1fd9c79c7dbc..000000000000
--- a/arch/arm/mach-s5p64x0/dev-spi.c
+++ /dev/null
@@ -1,224 +0,0 @@
1/* linux/arch/arm/mach-s5p64x0/dev-spi.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright (C) 2010 Samsung Electronics Co. Ltd.
7 * Jaswinder Singh <jassi.brar@samsung.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12*/
13
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17
18#include <mach/dma.h>
19#include <mach/map.h>
20#include <mach/irqs.h>
21#include <mach/regs-clock.h>
22#include <mach/spi-clocks.h>
23
24#include <plat/cpu.h>
25#include <plat/s3c64xx-spi.h>
26#include <plat/gpio-cfg.h>
27
28static char *s5p64x0_spi_src_clks[] = {
29 [S5P64X0_SPI_SRCCLK_PCLK] = "pclk",
30 [S5P64X0_SPI_SRCCLK_SCLK] = "sclk_spi",
31};
32
33/* SPI Controller platform_devices */
34
35/* Since we emulate multi-cs capability, we do not touch the CS.
36 * The emulated CS is toggled by board specific mechanism, as it can
37 * be either some immediate GPIO or some signal out of some other
38 * chip in between ... or some yet another way.
39 * We simply do not assume anything about CS.
40 */
41static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
42{
43 unsigned int base;
44
45 switch (pdev->id) {
46 case 0:
47 base = S5P6440_GPC(0);
48 break;
49
50 case 1:
51 base = S5P6440_GPC(4);
52 break;
53
54 default:
55 dev_err(&pdev->dev, "Invalid SPI Controller number!");
56 return -EINVAL;
57 }
58
59 s3c_gpio_cfgall_range(base, 3,
60 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
61
62 return 0;
63}
64
65static int s5p6450_spi_cfg_gpio(struct platform_device *pdev)
66{
67 unsigned int base;
68
69 switch (pdev->id) {
70 case 0:
71 base = S5P6450_GPC(0);
72 break;
73
74 case 1:
75 base = S5P6450_GPC(4);
76 break;
77
78 default:
79 dev_err(&pdev->dev, "Invalid SPI Controller number!");
80 return -EINVAL;
81 }
82
83 s3c_gpio_cfgall_range(base, 3,
84 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
85
86 return 0;
87}
88
89static struct resource s5p64x0_spi0_resource[] = {
90 [0] = {
91 .start = S5P64X0_PA_SPI0,
92 .end = S5P64X0_PA_SPI0 + 0x100 - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 [1] = {
96 .start = DMACH_SPI0_TX,
97 .end = DMACH_SPI0_TX,
98 .flags = IORESOURCE_DMA,
99 },
100 [2] = {
101 .start = DMACH_SPI0_RX,
102 .end = DMACH_SPI0_RX,
103 .flags = IORESOURCE_DMA,
104 },
105 [3] = {
106 .start = IRQ_SPI0,
107 .end = IRQ_SPI0,
108 .flags = IORESOURCE_IRQ,
109 },
110};
111
112static struct s3c64xx_spi_info s5p6440_spi0_pdata = {
113 .cfg_gpio = s5p6440_spi_cfg_gpio,
114 .fifo_lvl_mask = 0x1ff,
115 .rx_lvl_offset = 15,
116 .tx_st_done = 25,
117};
118
119static struct s3c64xx_spi_info s5p6450_spi0_pdata = {
120 .cfg_gpio = s5p6450_spi_cfg_gpio,
121 .fifo_lvl_mask = 0x1ff,
122 .rx_lvl_offset = 15,
123 .tx_st_done = 25,
124};
125
126static u64 spi_dmamask = DMA_BIT_MASK(32);
127
128struct platform_device s5p64x0_device_spi0 = {
129 .name = "s3c64xx-spi",
130 .id = 0,
131 .num_resources = ARRAY_SIZE(s5p64x0_spi0_resource),
132 .resource = s5p64x0_spi0_resource,
133 .dev = {
134 .dma_mask = &spi_dmamask,
135 .coherent_dma_mask = DMA_BIT_MASK(32),
136 },
137};
138
139static struct resource s5p64x0_spi1_resource[] = {
140 [0] = {
141 .start = S5P64X0_PA_SPI1,
142 .end = S5P64X0_PA_SPI1 + 0x100 - 1,
143 .flags = IORESOURCE_MEM,
144 },
145 [1] = {
146 .start = DMACH_SPI1_TX,
147 .end = DMACH_SPI1_TX,
148 .flags = IORESOURCE_DMA,
149 },
150 [2] = {
151 .start = DMACH_SPI1_RX,
152 .end = DMACH_SPI1_RX,
153 .flags = IORESOURCE_DMA,
154 },
155 [3] = {
156 .start = IRQ_SPI1,
157 .end = IRQ_SPI1,
158 .flags = IORESOURCE_IRQ,
159 },
160};
161
162static struct s3c64xx_spi_info s5p6440_spi1_pdata = {
163 .cfg_gpio = s5p6440_spi_cfg_gpio,
164 .fifo_lvl_mask = 0x7f,
165 .rx_lvl_offset = 15,
166 .tx_st_done = 25,
167};
168
169static struct s3c64xx_spi_info s5p6450_spi1_pdata = {
170 .cfg_gpio = s5p6450_spi_cfg_gpio,
171 .fifo_lvl_mask = 0x7f,
172 .rx_lvl_offset = 15,
173 .tx_st_done = 25,
174};
175
176struct platform_device s5p64x0_device_spi1 = {
177 .name = "s3c64xx-spi",
178 .id = 1,
179 .num_resources = ARRAY_SIZE(s5p64x0_spi1_resource),
180 .resource = s5p64x0_spi1_resource,
181 .dev = {
182 .dma_mask = &spi_dmamask,
183 .coherent_dma_mask = DMA_BIT_MASK(32),
184 },
185};
186
187void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
188{
189 struct s3c64xx_spi_info *pd;
190
191 /* Reject invalid configuration */
192 if (!num_cs || src_clk_nr < 0
193 || src_clk_nr > S5P64X0_SPI_SRCCLK_SCLK) {
194 printk(KERN_ERR "%s: Invalid SPI configuration\n", __func__);
195 return;
196 }
197
198 switch (cntrlr) {
199 case 0:
200 if (soc_is_s5p6450())
201 pd = &s5p6450_spi0_pdata;
202 else
203 pd = &s5p6440_spi0_pdata;
204
205 s5p64x0_device_spi0.dev.platform_data = pd;
206 break;
207 case 1:
208 if (soc_is_s5p6450())
209 pd = &s5p6450_spi1_pdata;
210 else
211 pd = &s5p6440_spi1_pdata;
212
213 s5p64x0_device_spi1.dev.platform_data = pd;
214 break;
215 default:
216 printk(KERN_ERR "%s: Invalid SPI controller(%d)\n",
217 __func__, cntrlr);
218 return;
219 }
220
221 pd->num_cs = num_cs;
222 pd->src_clk_nr = src_clk_nr;
223 pd->src_clk_name = s5p64x0_spi_src_clks[src_clk_nr];
224}
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h
index 4d3ac8a3709d..0c0175dbfa34 100644
--- a/arch/arm/mach-s5p64x0/include/mach/map.h
+++ b/arch/arm/mach-s5p64x0/include/mach/map.h
@@ -67,6 +67,8 @@
67#define S3C_PA_RTC S5P64X0_PA_RTC 67#define S3C_PA_RTC S5P64X0_PA_RTC
68#define S3C_PA_WDT S5P64X0_PA_WDT 68#define S3C_PA_WDT S5P64X0_PA_WDT
69#define S3C_PA_FB S5P64X0_PA_FB 69#define S3C_PA_FB S5P64X0_PA_FB
70#define S3C_PA_SPI0 S5P64X0_PA_SPI0
71#define S3C_PA_SPI1 S5P64X0_PA_SPI1
70 72
71#define S5P_PA_CHIPID S5P64X0_PA_CHIPID 73#define S5P_PA_CHIPID S5P64X0_PA_CHIPID
72#define S5P_PA_SROMC S5P64X0_PA_SROMC 74#define S5P_PA_SROMC S5P64X0_PA_SROMC
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
new file mode 100644
index 000000000000..e9b841240352
--- /dev/null
+++ b/arch/arm/mach-s5p64x0/setup-spi.c
@@ -0,0 +1,55 @@
1/* linux/arch/arm/mach-s5p64x0/setup-spi.c
2 *
3 * Copyright (C) 2011 Samsung Electronics 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/gpio.h>
12#include <linux/platform_device.h>
13#include <linux/io.h>
14
15#include <plat/gpio-cfg.h>
16#include <plat/cpu.h>
17#include <plat/s3c64xx-spi.h>
18
19#ifdef CONFIG_S3C64XX_DEV_SPI0
20struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
21 .fifo_lvl_mask = 0x1ff,
22 .rx_lvl_offset = 15,
23 .tx_st_done = 25,
24};
25
26int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
27{
28 if (soc_is_s5p6450())
29 s3c_gpio_cfgall_range(S5P6450_GPC(0), 3,
30 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
31 else
32 s3c_gpio_cfgall_range(S5P6440_GPC(0), 3,
33 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
34 return 0;
35}
36#endif
37
38#ifdef CONFIG_S3C64XX_DEV_SPI1
39struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = {
40 .fifo_lvl_mask = 0x7f,
41 .rx_lvl_offset = 15,
42 .tx_st_done = 25,
43};
44
45int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
46{
47 if (soc_is_s5p6450())
48 s3c_gpio_cfgall_range(S5P6450_GPC(4), 3,
49 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
50 else
51 s3c_gpio_cfgall_range(S5P6440_GPC(4), 3,
52 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
53 return 0;
54}
55#endif