aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Abraham <thomas.abraham@linaro.org>2012-07-12 18:15:14 -0400
committerKukjin Kim <kgene.kim@samsung.com>2012-07-13 02:23:46 -0400
commita5238e360b715e9a1bb39d7d3537f78cc9e9e286 (patch)
treeb6503a7429b93b7c15f90d5e3b0124a191215423
parent2b54be661191532ddf1628c3b151b81ae8743caa (diff)
spi: s3c64xx: move controller information into driver data
Platform data is used to specify controller hardware specific information such as the tx/rx fifo level mask and bit offset of rx fifo level. Such information is not suitable to be supplied from device tree. Instead, it can be moved into the driver data and removed from platform data. Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org> Acked-by: Jaswinder Singh <jaswinder.singh@linaro.org> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
-rw-r--r--arch/arm/mach-exynos/clock-exynos4.c18
-rw-r--r--arch/arm/mach-exynos/setup-spi.c25
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2416.c3
-rw-r--r--arch/arm/mach-s3c24xx/clock-s3c2443.c2
-rw-r--r--arch/arm/mach-s3c24xx/common-s3c2443.c4
-rw-r--r--arch/arm/mach-s3c24xx/setup-spi.c8
-rw-r--r--arch/arm/mach-s3c64xx/clock.c20
-rw-r--r--arch/arm/mach-s3c64xx/setup-spi.c13
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c12
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c12
-rw-r--r--arch/arm/mach-s5p64x0/setup-spi.c16
-rw-r--r--arch/arm/mach-s5pc100/clock.c30
-rw-r--r--arch/arm/mach-s5pc100/setup-spi.c22
-rw-r--r--arch/arm/mach-s5pv210/clock.c14
-rw-r--r--arch/arm/mach-s5pv210/setup-spi.c15
-rw-r--r--arch/arm/plat-samsung/include/plat/s3c64xx-spi.h15
-rw-r--r--drivers/spi/spi-s3c64xx.c150
17 files changed, 181 insertions, 198 deletions
diff --git a/arch/arm/mach-exynos/clock-exynos4.c b/arch/arm/mach-exynos/clock-exynos4.c
index bcb7db453145..10a46a9f0ea7 100644
--- a/arch/arm/mach-exynos/clock-exynos4.c
+++ b/arch/arm/mach-exynos/clock-exynos4.c
@@ -586,17 +586,17 @@ static struct clk exynos4_init_clocks_off[] = {
586 .ctrlbit = (1 << 13), 586 .ctrlbit = (1 << 13),
587 }, { 587 }, {
588 .name = "spi", 588 .name = "spi",
589 .devname = "s3c64xx-spi.0", 589 .devname = "exynos4210-spi.0",
590 .enable = exynos4_clk_ip_peril_ctrl, 590 .enable = exynos4_clk_ip_peril_ctrl,
591 .ctrlbit = (1 << 16), 591 .ctrlbit = (1 << 16),
592 }, { 592 }, {
593 .name = "spi", 593 .name = "spi",
594 .devname = "s3c64xx-spi.1", 594 .devname = "exynos4210-spi.1",
595 .enable = exynos4_clk_ip_peril_ctrl, 595 .enable = exynos4_clk_ip_peril_ctrl,
596 .ctrlbit = (1 << 17), 596 .ctrlbit = (1 << 17),
597 }, { 597 }, {
598 .name = "spi", 598 .name = "spi",
599 .devname = "s3c64xx-spi.2", 599 .devname = "exynos4210-spi.2",
600 .enable = exynos4_clk_ip_peril_ctrl, 600 .enable = exynos4_clk_ip_peril_ctrl,
601 .ctrlbit = (1 << 18), 601 .ctrlbit = (1 << 18),
602 }, { 602 }, {
@@ -1245,7 +1245,7 @@ static struct clksrc_clk exynos4_clk_sclk_mmc3 = {
1245static struct clksrc_clk exynos4_clk_sclk_spi0 = { 1245static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1246 .clk = { 1246 .clk = {
1247 .name = "sclk_spi", 1247 .name = "sclk_spi",
1248 .devname = "s3c64xx-spi.0", 1248 .devname = "exynos4210-spi.0",
1249 .enable = exynos4_clksrc_mask_peril1_ctrl, 1249 .enable = exynos4_clksrc_mask_peril1_ctrl,
1250 .ctrlbit = (1 << 16), 1250 .ctrlbit = (1 << 16),
1251 }, 1251 },
@@ -1257,7 +1257,7 @@ static struct clksrc_clk exynos4_clk_sclk_spi0 = {
1257static struct clksrc_clk exynos4_clk_sclk_spi1 = { 1257static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1258 .clk = { 1258 .clk = {
1259 .name = "sclk_spi", 1259 .name = "sclk_spi",
1260 .devname = "s3c64xx-spi.1", 1260 .devname = "exynos4210-spi.1",
1261 .enable = exynos4_clksrc_mask_peril1_ctrl, 1261 .enable = exynos4_clksrc_mask_peril1_ctrl,
1262 .ctrlbit = (1 << 20), 1262 .ctrlbit = (1 << 20),
1263 }, 1263 },
@@ -1269,7 +1269,7 @@ static struct clksrc_clk exynos4_clk_sclk_spi1 = {
1269static struct clksrc_clk exynos4_clk_sclk_spi2 = { 1269static struct clksrc_clk exynos4_clk_sclk_spi2 = {
1270 .clk = { 1270 .clk = {
1271 .name = "sclk_spi", 1271 .name = "sclk_spi",
1272 .devname = "s3c64xx-spi.2", 1272 .devname = "exynos4210-spi.2",
1273 .enable = exynos4_clksrc_mask_peril1_ctrl, 1273 .enable = exynos4_clksrc_mask_peril1_ctrl,
1274 .ctrlbit = (1 << 24), 1274 .ctrlbit = (1 << 24),
1275 }, 1275 },
@@ -1347,9 +1347,9 @@ static struct clk_lookup exynos4_clk_lookup[] = {
1347 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0), 1347 CLKDEV_INIT("dma-pl330.0", "apb_pclk", &exynos4_clk_pdma0),
1348 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1), 1348 CLKDEV_INIT("dma-pl330.1", "apb_pclk", &exynos4_clk_pdma1),
1349 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1), 1349 CLKDEV_INIT("dma-pl330.2", "apb_pclk", &exynos4_clk_mdma1),
1350 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk), 1350 CLKDEV_INIT("exynos4210-spi.0", "spi_busclk0", &exynos4_clk_sclk_spi0.clk),
1351 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk), 1351 CLKDEV_INIT("exynos4210-spi.1", "spi_busclk0", &exynos4_clk_sclk_spi1.clk),
1352 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk), 1352 CLKDEV_INIT("exynos4210-spi.2", "spi_busclk0", &exynos4_clk_sclk_spi2.clk),
1353}; 1353};
1354 1354
1355static int xtal_rate; 1355static int xtal_rate;
diff --git a/arch/arm/mach-exynos/setup-spi.c b/arch/arm/mach-exynos/setup-spi.c
index 833ff40ee0e8..a71ec4db4cf4 100644
--- a/arch/arm/mach-exynos/setup-spi.c
+++ b/arch/arm/mach-exynos/setup-spi.c
@@ -12,17 +12,8 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/s3c64xx-spi.h>
16 15
17#ifdef CONFIG_S3C64XX_DEV_SPI0 16#ifdef CONFIG_S3C64XX_DEV_SPI0
18struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
19 .fifo_lvl_mask = 0x1ff,
20 .rx_lvl_offset = 15,
21 .high_speed = 1,
22 .clk_from_cmu = true,
23 .tx_st_done = 25,
24};
25
26int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) 17int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
27{ 18{
28 s3c_gpio_cfgpin(EXYNOS4_GPB(0), S3C_GPIO_SFN(2)); 19 s3c_gpio_cfgpin(EXYNOS4_GPB(0), S3C_GPIO_SFN(2));
@@ -34,14 +25,6 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
34#endif 25#endif
35 26
36#ifdef CONFIG_S3C64XX_DEV_SPI1 27#ifdef CONFIG_S3C64XX_DEV_SPI1
37struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = {
38 .fifo_lvl_mask = 0x7f,
39 .rx_lvl_offset = 15,
40 .high_speed = 1,
41 .clk_from_cmu = true,
42 .tx_st_done = 25,
43};
44
45int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) 28int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
46{ 29{
47 s3c_gpio_cfgpin(EXYNOS4_GPB(4), S3C_GPIO_SFN(2)); 30 s3c_gpio_cfgpin(EXYNOS4_GPB(4), S3C_GPIO_SFN(2));
@@ -53,14 +36,6 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
53#endif 36#endif
54 37
55#ifdef CONFIG_S3C64XX_DEV_SPI2 38#ifdef CONFIG_S3C64XX_DEV_SPI2
56struct s3c64xx_spi_info s3c64xx_spi2_pdata __initdata = {
57 .fifo_lvl_mask = 0x7f,
58 .rx_lvl_offset = 15,
59 .high_speed = 1,
60 .clk_from_cmu = true,
61 .tx_st_done = 25,
62};
63
64int s3c64xx_spi2_cfg_gpio(struct platform_device *dev) 39int s3c64xx_spi2_cfg_gpio(struct platform_device *dev)
65{ 40{
66 s3c_gpio_cfgpin(EXYNOS4_GPC1(1), S3C_GPIO_SFN(5)); 41 s3c_gpio_cfgpin(EXYNOS4_GPC1(1), S3C_GPIO_SFN(5));
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2416.c b/arch/arm/mach-s3c24xx/clock-s3c2416.c
index 8702ecfaab30..14a81c2317a4 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2416.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2416.c
@@ -144,7 +144,8 @@ static struct clk_lookup s3c2416_clk_lookup[] = {
144 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk), 144 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.0", &hsmmc0_clk),
145 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk), 145 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &hsmmc_mux0.clk),
146 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk), 146 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &hsmmc_mux1.clk),
147 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &hsspi_mux.clk), 147 /* s3c2443-spi.0 is used on s3c2416 and s3c2450 as well */
148 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &hsspi_mux.clk),
148}; 149};
149 150
150void __init s3c2416_init_clocks(int xtal) 151void __init s3c2416_init_clocks(int xtal)
diff --git a/arch/arm/mach-s3c24xx/clock-s3c2443.c b/arch/arm/mach-s3c24xx/clock-s3c2443.c
index a4c5a520d994..7f689ce1be61 100644
--- a/arch/arm/mach-s3c24xx/clock-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/clock-s3c2443.c
@@ -181,7 +181,7 @@ static struct clk *clks[] __initdata = {
181 181
182static struct clk_lookup s3c2443_clk_lookup[] = { 182static struct clk_lookup s3c2443_clk_lookup[] = {
183 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc), 183 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_hsmmc),
184 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_hsspi.clk), 184 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk2", &clk_hsspi.clk),
185}; 185};
186 186
187void __init s3c2443_init_clocks(int xtal) 187void __init s3c2443_init_clocks(int xtal)
diff --git a/arch/arm/mach-s3c24xx/common-s3c2443.c b/arch/arm/mach-s3c24xx/common-s3c2443.c
index aeeb2be283fa..aeb4a24ff3ed 100644
--- a/arch/arm/mach-s3c24xx/common-s3c2443.c
+++ b/arch/arm/mach-s3c24xx/common-s3c2443.c
@@ -559,7 +559,7 @@ static struct clk hsmmc1_clk = {
559 559
560static struct clk hsspi_clk = { 560static struct clk hsspi_clk = {
561 .name = "spi", 561 .name = "spi",
562 .devname = "s3c64xx-spi.0", 562 .devname = "s3c2443-spi.0",
563 .parent = &clk_p, 563 .parent = &clk_p,
564 .enable = s3c2443_clkcon_enable_p, 564 .enable = s3c2443_clkcon_enable_p,
565 .ctrlbit = S3C2443_PCLKCON_HSSPI, 565 .ctrlbit = S3C2443_PCLKCON_HSSPI,
@@ -633,7 +633,7 @@ static struct clk_lookup s3c2443_clk_lookup[] = {
633 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p), 633 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_p),
634 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk), 634 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_esys_uart.clk),
635 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk), 635 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.0", &hsmmc1_clk),
636 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk0", &hsspi_clk), 636 CLKDEV_INIT("s3c2443-spi.0", "spi_busclk0", &hsspi_clk),
637}; 637};
638 638
639void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll, 639void __init s3c2443_common_init_clocks(int xtal, pll_fn get_mpll,
diff --git a/arch/arm/mach-s3c24xx/setup-spi.c b/arch/arm/mach-s3c24xx/setup-spi.c
index 5712c85f39b1..42abe157f98f 100644
--- a/arch/arm/mach-s3c24xx/setup-spi.c
+++ b/arch/arm/mach-s3c24xx/setup-spi.c
@@ -13,19 +13,11 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14 14
15#include <plat/gpio-cfg.h> 15#include <plat/gpio-cfg.h>
16#include <plat/s3c64xx-spi.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19#include <mach/regs-gpio.h> 18#include <mach/regs-gpio.h>
20 19
21#ifdef CONFIG_S3C64XX_DEV_SPI0 20#ifdef CONFIG_S3C64XX_DEV_SPI0
22struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
23 .fifo_lvl_mask = 0x7f,
24 .rx_lvl_offset = 13,
25 .tx_st_done = 21,
26 .high_speed = 1,
27};
28
29int s3c64xx_spi0_cfg_gpio(struct platform_device *pdev) 21int s3c64xx_spi0_cfg_gpio(struct platform_device *pdev)
30{ 22{
31 /* enable hsspi bit in misccr */ 23 /* enable hsspi bit in misccr */
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c
index 52f079a691cb..28041e83dc82 100644
--- a/arch/arm/mach-s3c64xx/clock.c
+++ b/arch/arm/mach-s3c64xx/clock.c
@@ -178,13 +178,13 @@ static struct clk init_clocks_off[] = {
178 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD, 178 .ctrlbit = S3C_CLKCON_PCLK_KEYPAD,
179 }, { 179 }, {
180 .name = "spi", 180 .name = "spi",
181 .devname = "s3c64xx-spi.0", 181 .devname = "s3c6410-spi.0",
182 .parent = &clk_p, 182 .parent = &clk_p,
183 .enable = s3c64xx_pclk_ctrl, 183 .enable = s3c64xx_pclk_ctrl,
184 .ctrlbit = S3C_CLKCON_PCLK_SPI0, 184 .ctrlbit = S3C_CLKCON_PCLK_SPI0,
185 }, { 185 }, {
186 .name = "spi", 186 .name = "spi",
187 .devname = "s3c64xx-spi.1", 187 .devname = "s3c6410-spi.1",
188 .parent = &clk_p, 188 .parent = &clk_p,
189 .enable = s3c64xx_pclk_ctrl, 189 .enable = s3c64xx_pclk_ctrl,
190 .ctrlbit = S3C_CLKCON_PCLK_SPI1, 190 .ctrlbit = S3C_CLKCON_PCLK_SPI1,
@@ -331,7 +331,7 @@ static struct clk init_clocks_off[] = {
331 331
332static struct clk clk_48m_spi0 = { 332static struct clk clk_48m_spi0 = {
333 .name = "spi_48m", 333 .name = "spi_48m",
334 .devname = "s3c64xx-spi.0", 334 .devname = "s3c6410-spi.0",
335 .parent = &clk_48m, 335 .parent = &clk_48m,
336 .enable = s3c64xx_sclk_ctrl, 336 .enable = s3c64xx_sclk_ctrl,
337 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48, 337 .ctrlbit = S3C_CLKCON_SCLK_SPI0_48,
@@ -339,7 +339,7 @@ static struct clk clk_48m_spi0 = {
339 339
340static struct clk clk_48m_spi1 = { 340static struct clk clk_48m_spi1 = {
341 .name = "spi_48m", 341 .name = "spi_48m",
342 .devname = "s3c64xx-spi.1", 342 .devname = "s3c6410-spi.1",
343 .parent = &clk_48m, 343 .parent = &clk_48m,
344 .enable = s3c64xx_sclk_ctrl, 344 .enable = s3c64xx_sclk_ctrl,
345 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48, 345 .ctrlbit = S3C_CLKCON_SCLK_SPI1_48,
@@ -802,7 +802,7 @@ static struct clksrc_clk clk_sclk_mmc2 = {
802static struct clksrc_clk clk_sclk_spi0 = { 802static struct clksrc_clk clk_sclk_spi0 = {
803 .clk = { 803 .clk = {
804 .name = "spi-bus", 804 .name = "spi-bus",
805 .devname = "s3c64xx-spi.0", 805 .devname = "s3c6410-spi.0",
806 .ctrlbit = S3C_CLKCON_SCLK_SPI0, 806 .ctrlbit = S3C_CLKCON_SCLK_SPI0,
807 .enable = s3c64xx_sclk_ctrl, 807 .enable = s3c64xx_sclk_ctrl,
808 }, 808 },
@@ -814,7 +814,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
814static struct clksrc_clk clk_sclk_spi1 = { 814static struct clksrc_clk clk_sclk_spi1 = {
815 .clk = { 815 .clk = {
816 .name = "spi-bus", 816 .name = "spi-bus",
817 .devname = "s3c64xx-spi.1", 817 .devname = "s3c6410-spi.1",
818 .ctrlbit = S3C_CLKCON_SCLK_SPI1, 818 .ctrlbit = S3C_CLKCON_SCLK_SPI1,
819 .enable = s3c64xx_sclk_ctrl, 819 .enable = s3c64xx_sclk_ctrl,
820 }, 820 },
@@ -858,10 +858,10 @@ static struct clk_lookup s3c64xx_clk_lookup[] = {
858 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), 858 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
859 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), 859 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
860 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 860 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
861 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), 861 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
862 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_48m_spi0), 862 CLKDEV_INIT("s3c6410-spi.0", "spi_busclk2", &clk_48m_spi0),
863 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), 863 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
864 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk2", &clk_48m_spi1), 864 CLKDEV_INIT("s3c6410-spi.1", "spi_busclk2", &clk_48m_spi1),
865}; 865};
866 866
867#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1) 867#define GET_DIV(clk, field) ((((clk) & field##_MASK) >> field##_SHIFT) + 1)
diff --git a/arch/arm/mach-s3c64xx/setup-spi.c b/arch/arm/mach-s3c64xx/setup-spi.c
index d9592ad7a825..ff999d95b370 100644
--- a/arch/arm/mach-s3c64xx/setup-spi.c
+++ b/arch/arm/mach-s3c64xx/setup-spi.c
@@ -12,15 +12,8 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/s3c64xx-spi.h>
16 15
17#ifdef CONFIG_S3C64XX_DEV_SPI0 16#ifdef CONFIG_S3C64XX_DEV_SPI0
18struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
19 .fifo_lvl_mask = 0x7f,
20 .rx_lvl_offset = 13,
21 .tx_st_done = 21,
22};
23
24int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) 17int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
25{ 18{
26 s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3, 19 s3c_gpio_cfgall_range(S3C64XX_GPC(0), 3,
@@ -30,12 +23,6 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
30#endif 23#endif
31 24
32#ifdef CONFIG_S3C64XX_DEV_SPI1 25#ifdef CONFIG_S3C64XX_DEV_SPI1
33struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = {
34 .fifo_lvl_mask = 0x7f,
35 .rx_lvl_offset = 13,
36 .tx_st_done = 21,
37};
38
39int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) 26int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
40{ 27{
41 s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3, 28 s3c_gpio_cfgall_range(S3C64XX_GPC(4), 3,
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index ee1e8e7f5631..000445596ec4 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -227,13 +227,13 @@ static struct clk init_clocks_off[] = {
227 .ctrlbit = (1 << 17), 227 .ctrlbit = (1 << 17),
228 }, { 228 }, {
229 .name = "spi", 229 .name = "spi",
230 .devname = "s3c64xx-spi.0", 230 .devname = "s5p64x0-spi.0",
231 .parent = &clk_pclk_low.clk, 231 .parent = &clk_pclk_low.clk,
232 .enable = s5p64x0_pclk_ctrl, 232 .enable = s5p64x0_pclk_ctrl,
233 .ctrlbit = (1 << 21), 233 .ctrlbit = (1 << 21),
234 }, { 234 }, {
235 .name = "spi", 235 .name = "spi",
236 .devname = "s3c64xx-spi.1", 236 .devname = "s5p64x0-spi.1",
237 .parent = &clk_pclk_low.clk, 237 .parent = &clk_pclk_low.clk,
238 .enable = s5p64x0_pclk_ctrl, 238 .enable = s5p64x0_pclk_ctrl,
239 .ctrlbit = (1 << 22), 239 .ctrlbit = (1 << 22),
@@ -467,7 +467,7 @@ static struct clksrc_clk clk_sclk_uclk = {
467static struct clksrc_clk clk_sclk_spi0 = { 467static struct clksrc_clk clk_sclk_spi0 = {
468 .clk = { 468 .clk = {
469 .name = "sclk_spi", 469 .name = "sclk_spi",
470 .devname = "s3c64xx-spi.0", 470 .devname = "s5p64x0-spi.0",
471 .ctrlbit = (1 << 20), 471 .ctrlbit = (1 << 20),
472 .enable = s5p64x0_sclk_ctrl, 472 .enable = s5p64x0_sclk_ctrl,
473 }, 473 },
@@ -479,7 +479,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
479static struct clksrc_clk clk_sclk_spi1 = { 479static struct clksrc_clk clk_sclk_spi1 = {
480 .clk = { 480 .clk = {
481 .name = "sclk_spi", 481 .name = "sclk_spi",
482 .devname = "s3c64xx-spi.1", 482 .devname = "s5p64x0-spi.1",
483 .ctrlbit = (1 << 21), 483 .ctrlbit = (1 << 21),
484 .enable = s5p64x0_sclk_ctrl, 484 .enable = s5p64x0_sclk_ctrl,
485 }, 485 },
@@ -519,8 +519,8 @@ static struct clk_lookup s5p6440_clk_lookup[] = {
519 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), 519 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
520 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), 520 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
521 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 521 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
522 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), 522 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
523 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), 523 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
524 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), 524 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
525 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), 525 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
526 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), 526 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index dae6a13f43bb..f3e0ef3d27c9 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -236,13 +236,13 @@ static struct clk init_clocks_off[] = {
236 .ctrlbit = (1 << 17), 236 .ctrlbit = (1 << 17),
237 }, { 237 }, {
238 .name = "spi", 238 .name = "spi",
239 .devname = "s3c64xx-spi.0", 239 .devname = "s5p64x0-spi.0",
240 .parent = &clk_pclk_low.clk, 240 .parent = &clk_pclk_low.clk,
241 .enable = s5p64x0_pclk_ctrl, 241 .enable = s5p64x0_pclk_ctrl,
242 .ctrlbit = (1 << 21), 242 .ctrlbit = (1 << 21),
243 }, { 243 }, {
244 .name = "spi", 244 .name = "spi",
245 .devname = "s3c64xx-spi.1", 245 .devname = "s5p64x0-spi.1",
246 .parent = &clk_pclk_low.clk, 246 .parent = &clk_pclk_low.clk,
247 .enable = s5p64x0_pclk_ctrl, 247 .enable = s5p64x0_pclk_ctrl,
248 .ctrlbit = (1 << 22), 248 .ctrlbit = (1 << 22),
@@ -528,7 +528,7 @@ static struct clksrc_clk clk_sclk_uclk = {
528static struct clksrc_clk clk_sclk_spi0 = { 528static struct clksrc_clk clk_sclk_spi0 = {
529 .clk = { 529 .clk = {
530 .name = "sclk_spi", 530 .name = "sclk_spi",
531 .devname = "s3c64xx-spi.0", 531 .devname = "s5p64x0-spi.0",
532 .ctrlbit = (1 << 20), 532 .ctrlbit = (1 << 20),
533 .enable = s5p64x0_sclk_ctrl, 533 .enable = s5p64x0_sclk_ctrl,
534 }, 534 },
@@ -540,7 +540,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
540static struct clksrc_clk clk_sclk_spi1 = { 540static struct clksrc_clk clk_sclk_spi1 = {
541 .clk = { 541 .clk = {
542 .name = "sclk_spi", 542 .name = "sclk_spi",
543 .devname = "s3c64xx-spi.1", 543 .devname = "s5p64x0-spi.1",
544 .ctrlbit = (1 << 21), 544 .ctrlbit = (1 << 21),
545 .enable = s5p64x0_sclk_ctrl, 545 .enable = s5p64x0_sclk_ctrl,
546 }, 546 },
@@ -562,8 +562,8 @@ static struct clk_lookup s5p6450_clk_lookup[] = {
562 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk), 562 CLKDEV_INIT(NULL, "clk_uart_baud2", &clk_pclk_low.clk),
563 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk), 563 CLKDEV_INIT(NULL, "clk_uart_baud3", &clk_sclk_uclk.clk),
564 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 564 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
565 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), 565 CLKDEV_INIT("s5p64x0-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
566 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), 566 CLKDEV_INIT("s5p64x0-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
567 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk), 567 CLKDEV_INIT("s3c-sdhci.0", "mmc_busclk.2", &clk_sclk_mmc0.clk),
568 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), 568 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
569 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), 569 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
diff --git a/arch/arm/mach-s5p64x0/setup-spi.c b/arch/arm/mach-s5p64x0/setup-spi.c
index e9b841240352..1cf84b524698 100644
--- a/arch/arm/mach-s5p64x0/setup-spi.c
+++ b/arch/arm/mach-s5p64x0/setup-spi.c
@@ -10,19 +10,9 @@
10 10
11#include <linux/gpio.h> 11#include <linux/gpio.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/io.h>
14
15#include <plat/gpio-cfg.h> 13#include <plat/gpio-cfg.h>
16#include <plat/cpu.h>
17#include <plat/s3c64xx-spi.h>
18 14
19#ifdef CONFIG_S3C64XX_DEV_SPI0 15#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) 16int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
27{ 17{
28 if (soc_is_s5p6450()) 18 if (soc_is_s5p6450())
@@ -36,12 +26,6 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
36#endif 26#endif
37 27
38#ifdef CONFIG_S3C64XX_DEV_SPI1 28#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) 29int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
46{ 30{
47 if (soc_is_s5p6450()) 31 if (soc_is_s5p6450())
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 16eca4ea2010..926219791f0d 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -564,19 +564,19 @@ static struct clk init_clocks_off[] = {
564 .ctrlbit = (1 << 5), 564 .ctrlbit = (1 << 5),
565 }, { 565 }, {
566 .name = "spi", 566 .name = "spi",
567 .devname = "s3c64xx-spi.0", 567 .devname = "s5pc100-spi.0",
568 .parent = &clk_div_d1_bus.clk, 568 .parent = &clk_div_d1_bus.clk,
569 .enable = s5pc100_d1_4_ctrl, 569 .enable = s5pc100_d1_4_ctrl,
570 .ctrlbit = (1 << 6), 570 .ctrlbit = (1 << 6),
571 }, { 571 }, {
572 .name = "spi", 572 .name = "spi",
573 .devname = "s3c64xx-spi.1", 573 .devname = "s5pc100-spi.1",
574 .parent = &clk_div_d1_bus.clk, 574 .parent = &clk_div_d1_bus.clk,
575 .enable = s5pc100_d1_4_ctrl, 575 .enable = s5pc100_d1_4_ctrl,
576 .ctrlbit = (1 << 7), 576 .ctrlbit = (1 << 7),
577 }, { 577 }, {
578 .name = "spi", 578 .name = "spi",
579 .devname = "s3c64xx-spi.2", 579 .devname = "s5pc100-spi.2",
580 .parent = &clk_div_d1_bus.clk, 580 .parent = &clk_div_d1_bus.clk,
581 .enable = s5pc100_d1_4_ctrl, 581 .enable = s5pc100_d1_4_ctrl,
582 .ctrlbit = (1 << 8), 582 .ctrlbit = (1 << 8),
@@ -702,7 +702,7 @@ static struct clk clk_hsmmc0 = {
702 702
703static struct clk clk_48m_spi0 = { 703static struct clk clk_48m_spi0 = {
704 .name = "spi_48m", 704 .name = "spi_48m",
705 .devname = "s3c64xx-spi.0", 705 .devname = "s5pc100-spi.0",
706 .parent = &clk_mout_48m.clk, 706 .parent = &clk_mout_48m.clk,
707 .enable = s5pc100_sclk0_ctrl, 707 .enable = s5pc100_sclk0_ctrl,
708 .ctrlbit = (1 << 7), 708 .ctrlbit = (1 << 7),
@@ -710,7 +710,7 @@ static struct clk clk_48m_spi0 = {
710 710
711static struct clk clk_48m_spi1 = { 711static struct clk clk_48m_spi1 = {
712 .name = "spi_48m", 712 .name = "spi_48m",
713 .devname = "s3c64xx-spi.1", 713 .devname = "s5pc100-spi.1",
714 .parent = &clk_mout_48m.clk, 714 .parent = &clk_mout_48m.clk,
715 .enable = s5pc100_sclk0_ctrl, 715 .enable = s5pc100_sclk0_ctrl,
716 .ctrlbit = (1 << 8), 716 .ctrlbit = (1 << 8),
@@ -718,7 +718,7 @@ static struct clk clk_48m_spi1 = {
718 718
719static struct clk clk_48m_spi2 = { 719static struct clk clk_48m_spi2 = {
720 .name = "spi_48m", 720 .name = "spi_48m",
721 .devname = "s3c64xx-spi.2", 721 .devname = "s5pc100-spi.2",
722 .parent = &clk_mout_48m.clk, 722 .parent = &clk_mout_48m.clk,
723 .enable = s5pc100_sclk0_ctrl, 723 .enable = s5pc100_sclk0_ctrl,
724 .ctrlbit = (1 << 9), 724 .ctrlbit = (1 << 9),
@@ -1085,7 +1085,7 @@ static struct clksrc_clk clk_sclk_mmc2 = {
1085static struct clksrc_clk clk_sclk_spi0 = { 1085static struct clksrc_clk clk_sclk_spi0 = {
1086 .clk = { 1086 .clk = {
1087 .name = "sclk_spi", 1087 .name = "sclk_spi",
1088 .devname = "s3c64xx-spi.0", 1088 .devname = "s5pc100-spi.0",
1089 .ctrlbit = (1 << 4), 1089 .ctrlbit = (1 << 4),
1090 .enable = s5pc100_sclk0_ctrl, 1090 .enable = s5pc100_sclk0_ctrl,
1091 }, 1091 },
@@ -1097,7 +1097,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
1097static struct clksrc_clk clk_sclk_spi1 = { 1097static struct clksrc_clk clk_sclk_spi1 = {
1098 .clk = { 1098 .clk = {
1099 .name = "sclk_spi", 1099 .name = "sclk_spi",
1100 .devname = "s3c64xx-spi.1", 1100 .devname = "s5pc100-spi.1",
1101 .ctrlbit = (1 << 5), 1101 .ctrlbit = (1 << 5),
1102 .enable = s5pc100_sclk0_ctrl, 1102 .enable = s5pc100_sclk0_ctrl,
1103 }, 1103 },
@@ -1109,7 +1109,7 @@ static struct clksrc_clk clk_sclk_spi1 = {
1109static struct clksrc_clk clk_sclk_spi2 = { 1109static struct clksrc_clk clk_sclk_spi2 = {
1110 .clk = { 1110 .clk = {
1111 .name = "sclk_spi", 1111 .name = "sclk_spi",
1112 .devname = "s3c64xx-spi.2", 1112 .devname = "s5pc100-spi.2",
1113 .ctrlbit = (1 << 6), 1113 .ctrlbit = (1 << 6),
1114 .enable = s5pc100_sclk0_ctrl, 1114 .enable = s5pc100_sclk0_ctrl,
1115 }, 1115 },
@@ -1315,12 +1315,12 @@ static struct clk_lookup s5pc100_clk_lookup[] = {
1315 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk), 1315 CLKDEV_INIT("s3c-sdhci.1", "mmc_busclk.2", &clk_sclk_mmc1.clk),
1316 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), 1316 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1317 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 1317 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1318 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_48m_spi0), 1318 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk1", &clk_48m_spi0),
1319 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk2", &clk_sclk_spi0.clk), 1319 CLKDEV_INIT("s5pc100-spi.0", "spi_busclk2", &clk_sclk_spi0.clk),
1320 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_48m_spi1), 1320 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk1", &clk_48m_spi1),
1321 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk2", &clk_sclk_spi1.clk), 1321 CLKDEV_INIT("s5pc100-spi.1", "spi_busclk2", &clk_sclk_spi1.clk),
1322 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk1", &clk_48m_spi2), 1322 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk1", &clk_48m_spi2),
1323 CLKDEV_INIT("s3c64xx-spi.2", "spi_busclk2", &clk_sclk_spi2.clk), 1323 CLKDEV_INIT("s5pc100-spi.2", "spi_busclk2", &clk_sclk_spi2.clk),
1324}; 1324};
1325 1325
1326void __init s5pc100_register_clocks(void) 1326void __init s5pc100_register_clocks(void)
diff --git a/arch/arm/mach-s5pc100/setup-spi.c b/arch/arm/mach-s5pc100/setup-spi.c
index 431a6f747caa..4b42718948a4 100644
--- a/arch/arm/mach-s5pc100/setup-spi.c
+++ b/arch/arm/mach-s5pc100/setup-spi.c
@@ -12,16 +12,8 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/s3c64xx-spi.h>
16 15
17#ifdef CONFIG_S3C64XX_DEV_SPI0 16#ifdef CONFIG_S3C64XX_DEV_SPI0
18struct s3c64xx_spi_info s3c64xx_spi0_pdata __initdata = {
19 .fifo_lvl_mask = 0x7f,
20 .rx_lvl_offset = 13,
21 .high_speed = 1,
22 .tx_st_done = 21,
23};
24
25int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) 17int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
26{ 18{
27 s3c_gpio_cfgall_range(S5PC100_GPB(0), 3, 19 s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
@@ -31,13 +23,6 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
31#endif 23#endif
32 24
33#ifdef CONFIG_S3C64XX_DEV_SPI1 25#ifdef CONFIG_S3C64XX_DEV_SPI1
34struct s3c64xx_spi_info s3c64xx_spi1_pdata __initdata = {
35 .fifo_lvl_mask = 0x7f,
36 .rx_lvl_offset = 13,
37 .high_speed = 1,
38 .tx_st_done = 21,
39};
40
41int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) 26int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
42{ 27{
43 s3c_gpio_cfgall_range(S5PC100_GPB(4), 3, 28 s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
@@ -47,13 +32,6 @@ int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
47#endif 32#endif
48 33
49#ifdef CONFIG_S3C64XX_DEV_SPI2 34#ifdef CONFIG_S3C64XX_DEV_SPI2
50struct s3c64xx_spi_info s3c64xx_spi2_pdata __initdata = {
51 .fifo_lvl_mask = 0x7f,
52 .rx_lvl_offset = 13,
53 .high_speed = 1,
54 .tx_st_done = 21,
55};
56
57int s3c64xx_spi2_cfg_gpio(struct platform_device *dev) 35int s3c64xx_spi2_cfg_gpio(struct platform_device *dev)
58{ 36{
59 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3)); 37 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 09609d50961d..fcdf52dbcc49 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -445,19 +445,19 @@ static struct clk init_clocks_off[] = {
445 .ctrlbit = (1 << 11), 445 .ctrlbit = (1 << 11),
446 }, { 446 }, {
447 .name = "spi", 447 .name = "spi",
448 .devname = "s3c64xx-spi.0", 448 .devname = "s5pv210-spi.0",
449 .parent = &clk_pclk_psys.clk, 449 .parent = &clk_pclk_psys.clk,
450 .enable = s5pv210_clk_ip3_ctrl, 450 .enable = s5pv210_clk_ip3_ctrl,
451 .ctrlbit = (1<<12), 451 .ctrlbit = (1<<12),
452 }, { 452 }, {
453 .name = "spi", 453 .name = "spi",
454 .devname = "s3c64xx-spi.1", 454 .devname = "s5pv210-spi.1",
455 .parent = &clk_pclk_psys.clk, 455 .parent = &clk_pclk_psys.clk,
456 .enable = s5pv210_clk_ip3_ctrl, 456 .enable = s5pv210_clk_ip3_ctrl,
457 .ctrlbit = (1<<13), 457 .ctrlbit = (1<<13),
458 }, { 458 }, {
459 .name = "spi", 459 .name = "spi",
460 .devname = "s3c64xx-spi.2", 460 .devname = "s5pv210-spi.2",
461 .parent = &clk_pclk_psys.clk, 461 .parent = &clk_pclk_psys.clk,
462 .enable = s5pv210_clk_ip3_ctrl, 462 .enable = s5pv210_clk_ip3_ctrl,
463 .ctrlbit = (1<<14), 463 .ctrlbit = (1<<14),
@@ -1035,7 +1035,7 @@ static struct clksrc_clk clk_sclk_mmc3 = {
1035static struct clksrc_clk clk_sclk_spi0 = { 1035static struct clksrc_clk clk_sclk_spi0 = {
1036 .clk = { 1036 .clk = {
1037 .name = "sclk_spi", 1037 .name = "sclk_spi",
1038 .devname = "s3c64xx-spi.0", 1038 .devname = "s5pv210-spi.0",
1039 .enable = s5pv210_clk_mask0_ctrl, 1039 .enable = s5pv210_clk_mask0_ctrl,
1040 .ctrlbit = (1 << 16), 1040 .ctrlbit = (1 << 16),
1041 }, 1041 },
@@ -1047,7 +1047,7 @@ static struct clksrc_clk clk_sclk_spi0 = {
1047static struct clksrc_clk clk_sclk_spi1 = { 1047static struct clksrc_clk clk_sclk_spi1 = {
1048 .clk = { 1048 .clk = {
1049 .name = "sclk_spi", 1049 .name = "sclk_spi",
1050 .devname = "s3c64xx-spi.1", 1050 .devname = "s5pv210-spi.1",
1051 .enable = s5pv210_clk_mask0_ctrl, 1051 .enable = s5pv210_clk_mask0_ctrl,
1052 .ctrlbit = (1 << 17), 1052 .ctrlbit = (1 << 17),
1053 }, 1053 },
@@ -1331,8 +1331,8 @@ static struct clk_lookup s5pv210_clk_lookup[] = {
1331 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk), 1331 CLKDEV_INIT("s3c-sdhci.2", "mmc_busclk.2", &clk_sclk_mmc2.clk),
1332 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk), 1332 CLKDEV_INIT("s3c-sdhci.3", "mmc_busclk.2", &clk_sclk_mmc3.clk),
1333 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p), 1333 CLKDEV_INIT(NULL, "spi_busclk0", &clk_p),
1334 CLKDEV_INIT("s3c64xx-spi.0", "spi_busclk1", &clk_sclk_spi0.clk), 1334 CLKDEV_INIT("s5pv210-spi.0", "spi_busclk1", &clk_sclk_spi0.clk),
1335 CLKDEV_INIT("s3c64xx-spi.1", "spi_busclk1", &clk_sclk_spi1.clk), 1335 CLKDEV_INIT("s5pv210-spi.1", "spi_busclk1", &clk_sclk_spi1.clk),
1336}; 1336};
1337 1337
1338void __init s5pv210_register_clocks(void) 1338void __init s5pv210_register_clocks(void)
diff --git a/arch/arm/mach-s5pv210/setup-spi.c b/arch/arm/mach-s5pv210/setup-spi.c
index f43c5048a37d..2cd66a632791 100644
--- a/arch/arm/mach-s5pv210/setup-spi.c
+++ b/arch/arm/mach-s5pv210/setup-spi.c
@@ -12,16 +12,8 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13 13
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/s3c64xx-spi.h>
16 15
17#ifdef CONFIG_S3C64XX_DEV_SPI0 16#ifdef CONFIG_S3C64XX_DEV_SPI0
18struct s3c64xx_spi_info s3c64xx_spi0_pdata = {
19 .fifo_lvl_mask = 0x1ff,
20 .rx_lvl_offset = 15,
21 .high_speed = 1,
22 .tx_st_done = 25,
23};
24
25int s3c64xx_spi0_cfg_gpio(struct platform_device *dev) 17int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
26{ 18{
27 s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2)); 19 s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2));
@@ -33,13 +25,6 @@ int s3c64xx_spi0_cfg_gpio(struct platform_device *dev)
33#endif 25#endif
34 26
35#ifdef CONFIG_S3C64XX_DEV_SPI1 27#ifdef CONFIG_S3C64XX_DEV_SPI1
36struct s3c64xx_spi_info s3c64xx_spi1_pdata = {
37 .fifo_lvl_mask = 0x7f,
38 .rx_lvl_offset = 15,
39 .high_speed = 1,
40 .tx_st_done = 25,
41};
42
43int s3c64xx_spi1_cfg_gpio(struct platform_device *dev) 28int s3c64xx_spi1_cfg_gpio(struct platform_device *dev)
44{ 29{
45 s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2)); 30 s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2));
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
index fa95e9a00972..4e9b9c314a29 100644
--- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
+++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h
@@ -33,28 +33,13 @@ struct s3c64xx_spi_csinfo {
33/** 33/**
34 * struct s3c64xx_spi_info - SPI Controller defining structure 34 * struct s3c64xx_spi_info - SPI Controller defining structure
35 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field. 35 * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
36 * @clk_from_cmu: If the SPI clock/prescalar control block is present
37 * by the platform's clock-management-unit and not in SPI controller.
38 * @num_cs: Number of CS this controller emulates. 36 * @num_cs: Number of CS this controller emulates.
39 * @cfg_gpio: Configure pins for this SPI controller. 37 * @cfg_gpio: Configure pins for this SPI controller.
40 * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
41 * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
42 * @high_speed: If the controller supports HIGH_SPEED_EN bit
43 * @tx_st_done: Depends on tx fifo_lvl field
44 */ 38 */
45struct s3c64xx_spi_info { 39struct s3c64xx_spi_info {
46 int src_clk_nr; 40 int src_clk_nr;
47 bool clk_from_cmu;
48
49 int num_cs; 41 int num_cs;
50
51 int (*cfg_gpio)(struct platform_device *pdev); 42 int (*cfg_gpio)(struct platform_device *pdev);
52
53 /* Following two fields are for future compatibility */
54 int fifo_lvl_mask;
55 int rx_lvl_offset;
56 int high_speed;
57 int tx_st_done;
58}; 43};
59 44
60/** 45/**
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 6e60eecbfc4f..8698618e56fe 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -31,6 +31,8 @@
31#include <mach/dma.h> 31#include <mach/dma.h>
32#include <plat/s3c64xx-spi.h> 32#include <plat/s3c64xx-spi.h>
33 33
34#define MAX_SPI_PORTS 3
35
34/* Registers and bit-fields */ 36/* Registers and bit-fields */
35 37
36#define S3C64XX_SPI_CH_CFG 0x00 38#define S3C64XX_SPI_CH_CFG 0x00
@@ -113,9 +115,12 @@
113 115
114#define S3C64XX_SPI_FBCLK_MSK (3<<0) 116#define S3C64XX_SPI_FBCLK_MSK (3<<0)
115 117
116#define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & (1 << (i)->tx_st_done)) ? 1 : 0) 118#define FIFO_LVL_MASK(i) ((i)->port_conf->fifo_lvl_mask[i->port_id])
117#define TX_FIFO_LVL(v, i) (((v) >> 6) & (i)->fifo_lvl_mask) 119#define S3C64XX_SPI_ST_TX_DONE(v, i) (((v) & \
118#define RX_FIFO_LVL(v, i) (((v) >> (i)->rx_lvl_offset) & (i)->fifo_lvl_mask) 120 (1 << (i)->port_conf->tx_st_done)) ? 1 : 0)
121#define TX_FIFO_LVL(v, i) (((v) >> 6) & FIFO_LVL_MASK(i))
122#define RX_FIFO_LVL(v, i) (((v) >> (i)->port_conf->rx_lvl_offset) & \
123 FIFO_LVL_MASK(i))
119 124
120#define S3C64XX_SPI_MAX_TRAILCNT 0x3ff 125#define S3C64XX_SPI_MAX_TRAILCNT 0x3ff
121#define S3C64XX_SPI_TRAILCNT_OFF 19 126#define S3C64XX_SPI_TRAILCNT_OFF 19
@@ -134,6 +139,28 @@ struct s3c64xx_spi_dma_data {
134}; 139};
135 140
136/** 141/**
142 * struct s3c64xx_spi_info - SPI Controller hardware info
143 * @fifo_lvl_mask: Bit-mask for {TX|RX}_FIFO_LVL bits in SPI_STATUS register.
144 * @rx_lvl_offset: Bit offset of RX_FIFO_LVL bits in SPI_STATUS regiter.
145 * @tx_st_done: Bit offset of TX_DONE bit in SPI_STATUS regiter.
146 * @high_speed: True, if the controller supports HIGH_SPEED_EN bit.
147 * @clk_from_cmu: True, if the controller does not include a clock mux and
148 * prescaler unit.
149 *
150 * The Samsung s3c64xx SPI controller are used on various Samsung SoC's but
151 * differ in some aspects such as the size of the fifo and spi bus clock
152 * setup. Such differences are specified to the driver using this structure
153 * which is provided as driver data to the driver.
154 */
155struct s3c64xx_spi_port_config {
156 int fifo_lvl_mask[MAX_SPI_PORTS];
157 int rx_lvl_offset;
158 int tx_st_done;
159 bool high_speed;
160 bool clk_from_cmu;
161};
162
163/**
137 * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver. 164 * struct s3c64xx_spi_driver_data - Runtime info holder for SPI driver.
138 * @clk: Pointer to the spi clock. 165 * @clk: Pointer to the spi clock.
139 * @src_clk: Pointer to the clock used to generate SPI signals. 166 * @src_clk: Pointer to the clock used to generate SPI signals.
@@ -171,6 +198,8 @@ struct s3c64xx_spi_driver_data {
171 struct s3c64xx_spi_dma_data rx_dma; 198 struct s3c64xx_spi_dma_data rx_dma;
172 struct s3c64xx_spi_dma_data tx_dma; 199 struct s3c64xx_spi_dma_data tx_dma;
173 struct samsung_dma_ops *ops; 200 struct samsung_dma_ops *ops;
201 struct s3c64xx_spi_port_config *port_conf;
202 unsigned int port_id;
174}; 203};
175 204
176static struct s3c2410_dma_client s3c64xx_spi_dma_client = { 205static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
@@ -179,7 +208,6 @@ static struct s3c2410_dma_client s3c64xx_spi_dma_client = {
179 208
180static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) 209static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
181{ 210{
182 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
183 void __iomem *regs = sdd->regs; 211 void __iomem *regs = sdd->regs;
184 unsigned long loops; 212 unsigned long loops;
185 u32 val; 213 u32 val;
@@ -195,7 +223,7 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
195 loops = msecs_to_loops(1); 223 loops = msecs_to_loops(1);
196 do { 224 do {
197 val = readl(regs + S3C64XX_SPI_STATUS); 225 val = readl(regs + S3C64XX_SPI_STATUS);
198 } while (TX_FIFO_LVL(val, sci) && loops--); 226 } while (TX_FIFO_LVL(val, sdd) && loops--);
199 227
200 if (loops == 0) 228 if (loops == 0)
201 dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n"); 229 dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n");
@@ -204,7 +232,7 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd)
204 loops = msecs_to_loops(1); 232 loops = msecs_to_loops(1);
205 do { 233 do {
206 val = readl(regs + S3C64XX_SPI_STATUS); 234 val = readl(regs + S3C64XX_SPI_STATUS);
207 if (RX_FIFO_LVL(val, sci)) 235 if (RX_FIFO_LVL(val, sdd))
208 readl(regs + S3C64XX_SPI_RX_DATA); 236 readl(regs + S3C64XX_SPI_RX_DATA);
209 else 237 else
210 break; 238 break;
@@ -307,7 +335,6 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
307 struct spi_device *spi, 335 struct spi_device *spi,
308 struct spi_transfer *xfer, int dma_mode) 336 struct spi_transfer *xfer, int dma_mode)
309{ 337{
310 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
311 void __iomem *regs = sdd->regs; 338 void __iomem *regs = sdd->regs;
312 u32 modecfg, chcfg; 339 u32 modecfg, chcfg;
313 340
@@ -357,7 +384,7 @@ static void enable_datapath(struct s3c64xx_spi_driver_data *sdd,
357 if (xfer->rx_buf != NULL) { 384 if (xfer->rx_buf != NULL) {
358 sdd->state |= RXBUSY; 385 sdd->state |= RXBUSY;
359 386
360 if (sci->high_speed && sdd->cur_speed >= 30000000UL 387 if (sdd->port_conf->high_speed && sdd->cur_speed >= 30000000UL
361 && !(sdd->cur_mode & SPI_CPHA)) 388 && !(sdd->cur_mode & SPI_CPHA))
362 chcfg |= S3C64XX_SPI_CH_HS_EN; 389 chcfg |= S3C64XX_SPI_CH_HS_EN;
363 390
@@ -397,7 +424,6 @@ static inline void enable_cs(struct s3c64xx_spi_driver_data *sdd,
397static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd, 424static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
398 struct spi_transfer *xfer, int dma_mode) 425 struct spi_transfer *xfer, int dma_mode)
399{ 426{
400 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
401 void __iomem *regs = sdd->regs; 427 void __iomem *regs = sdd->regs;
402 unsigned long val; 428 unsigned long val;
403 int ms; 429 int ms;
@@ -414,7 +440,7 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
414 val = msecs_to_loops(ms); 440 val = msecs_to_loops(ms);
415 do { 441 do {
416 status = readl(regs + S3C64XX_SPI_STATUS); 442 status = readl(regs + S3C64XX_SPI_STATUS);
417 } while (RX_FIFO_LVL(status, sci) < xfer->len && --val); 443 } while (RX_FIFO_LVL(status, sdd) < xfer->len && --val);
418 } 444 }
419 445
420 if (!val) 446 if (!val)
@@ -433,8 +459,8 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd,
433 if (xfer->rx_buf == NULL) { 459 if (xfer->rx_buf == NULL) {
434 val = msecs_to_loops(10); 460 val = msecs_to_loops(10);
435 status = readl(regs + S3C64XX_SPI_STATUS); 461 status = readl(regs + S3C64XX_SPI_STATUS);
436 while ((TX_FIFO_LVL(status, sci) 462 while ((TX_FIFO_LVL(status, sdd)
437 || !S3C64XX_SPI_ST_TX_DONE(status, sci)) 463 || !S3C64XX_SPI_ST_TX_DONE(status, sdd))
438 && --val) { 464 && --val) {
439 cpu_relax(); 465 cpu_relax();
440 status = readl(regs + S3C64XX_SPI_STATUS); 466 status = readl(regs + S3C64XX_SPI_STATUS);
@@ -483,12 +509,11 @@ static inline void disable_cs(struct s3c64xx_spi_driver_data *sdd,
483 509
484static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) 510static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
485{ 511{
486 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
487 void __iomem *regs = sdd->regs; 512 void __iomem *regs = sdd->regs;
488 u32 val; 513 u32 val;
489 514
490 /* Disable Clock */ 515 /* Disable Clock */
491 if (sci->clk_from_cmu) { 516 if (sdd->port_conf->clk_from_cmu) {
492 clk_disable(sdd->src_clk); 517 clk_disable(sdd->src_clk);
493 } else { 518 } else {
494 val = readl(regs + S3C64XX_SPI_CLK_CFG); 519 val = readl(regs + S3C64XX_SPI_CLK_CFG);
@@ -532,7 +557,7 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
532 557
533 writel(val, regs + S3C64XX_SPI_MODE_CFG); 558 writel(val, regs + S3C64XX_SPI_MODE_CFG);
534 559
535 if (sci->clk_from_cmu) { 560 if (sdd->port_conf->clk_from_cmu) {
536 /* Configure Clock */ 561 /* Configure Clock */
537 /* There is half-multiplier before the SPI */ 562 /* There is half-multiplier before the SPI */
538 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); 563 clk_set_rate(sdd->src_clk, sdd->cur_speed * 2);
@@ -558,7 +583,6 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd)
558static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd, 583static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
559 struct spi_message *msg) 584 struct spi_message *msg)
560{ 585{
561 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
562 struct device *dev = &sdd->pdev->dev; 586 struct device *dev = &sdd->pdev->dev;
563 struct spi_transfer *xfer; 587 struct spi_transfer *xfer;
564 588
@@ -574,7 +598,7 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
574 /* Map until end or first fail */ 598 /* Map until end or first fail */
575 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 599 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
576 600
577 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1)) 601 if (xfer->len <= ((FIFO_LVL_MASK(sdd) >> 1) + 1))
578 continue; 602 continue;
579 603
580 if (xfer->tx_buf != NULL) { 604 if (xfer->tx_buf != NULL) {
@@ -608,7 +632,6 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd,
608static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd, 632static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
609 struct spi_message *msg) 633 struct spi_message *msg)
610{ 634{
611 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
612 struct device *dev = &sdd->pdev->dev; 635 struct device *dev = &sdd->pdev->dev;
613 struct spi_transfer *xfer; 636 struct spi_transfer *xfer;
614 637
@@ -617,7 +640,7 @@ static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
617 640
618 list_for_each_entry(xfer, &msg->transfers, transfer_list) { 641 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
619 642
620 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1)) 643 if (xfer->len <= ((FIFO_LVL_MASK(sdd) >> 1) + 1))
621 continue; 644 continue;
622 645
623 if (xfer->rx_buf != NULL 646 if (xfer->rx_buf != NULL
@@ -636,7 +659,6 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
636 struct spi_message *msg) 659 struct spi_message *msg)
637{ 660{
638 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); 661 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
639 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
640 struct spi_device *spi = msg->spi; 662 struct spi_device *spi = msg->spi;
641 struct s3c64xx_spi_csinfo *cs = spi->controller_data; 663 struct s3c64xx_spi_csinfo *cs = spi->controller_data;
642 struct spi_transfer *xfer; 664 struct spi_transfer *xfer;
@@ -691,7 +713,7 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
691 } 713 }
692 714
693 /* Polling method for xfers not bigger than FIFO capacity */ 715 /* Polling method for xfers not bigger than FIFO capacity */
694 if (xfer->len <= ((sci->fifo_lvl_mask >> 1) + 1)) 716 if (xfer->len <= ((FIFO_LVL_MASK(sdd) >> 1) + 1))
695 use_dma = 0; 717 use_dma = 0;
696 else 718 else
697 use_dma = 1; 719 use_dma = 1;
@@ -845,7 +867,7 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
845 pm_runtime_get_sync(&sdd->pdev->dev); 867 pm_runtime_get_sync(&sdd->pdev->dev);
846 868
847 /* Check if we can provide the requested rate */ 869 /* Check if we can provide the requested rate */
848 if (!sci->clk_from_cmu) { 870 if (!sdd->port_conf->clk_from_cmu) {
849 u32 psr, speed; 871 u32 psr, speed;
850 872
851 /* Max possible */ 873 /* Max possible */
@@ -926,7 +948,7 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
926 /* Disable Interrupts - we use Polling if not DMA mode */ 948 /* Disable Interrupts - we use Polling if not DMA mode */
927 writel(0, regs + S3C64XX_SPI_INT_EN); 949 writel(0, regs + S3C64XX_SPI_INT_EN);
928 950
929 if (!sci->clk_from_cmu) 951 if (!sdd->port_conf->clk_from_cmu)
930 writel(sci->src_clk_nr << S3C64XX_SPI_CLKSEL_SRCSHFT, 952 writel(sci->src_clk_nr << S3C64XX_SPI_CLKSEL_SRCSHFT,
931 regs + S3C64XX_SPI_CLK_CFG); 953 regs + S3C64XX_SPI_CLK_CFG);
932 writel(0, regs + S3C64XX_SPI_MODE_CFG); 954 writel(0, regs + S3C64XX_SPI_MODE_CFG);
@@ -947,6 +969,13 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
947 flush_fifo(sdd); 969 flush_fifo(sdd);
948} 970}
949 971
972static inline struct s3c64xx_spi_port_config *s3c64xx_spi_get_port_config(
973 struct platform_device *pdev)
974{
975 return (struct s3c64xx_spi_port_config *)
976 platform_get_device_id(pdev)->driver_data;
977}
978
950static int __init s3c64xx_spi_probe(struct platform_device *pdev) 979static int __init s3c64xx_spi_probe(struct platform_device *pdev)
951{ 980{
952 struct resource *mem_res, *dmatx_res, *dmarx_res; 981 struct resource *mem_res, *dmatx_res, *dmarx_res;
@@ -1005,6 +1034,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
1005 platform_set_drvdata(pdev, master); 1034 platform_set_drvdata(pdev, master);
1006 1035
1007 sdd = spi_master_get_devdata(master); 1036 sdd = spi_master_get_devdata(master);
1037 sdd->port_conf = s3c64xx_spi_get_port_config(pdev);
1008 sdd->master = master; 1038 sdd->master = master;
1009 sdd->cntrlr_info = sci; 1039 sdd->cntrlr_info = sci;
1010 sdd->pdev = pdev; 1040 sdd->pdev = pdev;
@@ -1013,10 +1043,11 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
1013 sdd->tx_dma.direction = DMA_MEM_TO_DEV; 1043 sdd->tx_dma.direction = DMA_MEM_TO_DEV;
1014 sdd->rx_dma.dmach = dmarx_res->start; 1044 sdd->rx_dma.dmach = dmarx_res->start;
1015 sdd->rx_dma.direction = DMA_DEV_TO_MEM; 1045 sdd->rx_dma.direction = DMA_DEV_TO_MEM;
1046 sdd->port_id = pdev->id;
1016 1047
1017 sdd->cur_bpw = 8; 1048 sdd->cur_bpw = 8;
1018 1049
1019 master->bus_num = pdev->id; 1050 master->bus_num = sdd->port_id;
1020 master->setup = s3c64xx_spi_setup; 1051 master->setup = s3c64xx_spi_setup;
1021 master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; 1052 master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer;
1022 master->transfer_one_message = s3c64xx_spi_transfer_one_message; 1053 master->transfer_one_message = s3c64xx_spi_transfer_one_message;
@@ -1076,7 +1107,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
1076 } 1107 }
1077 1108
1078 /* Setup Deufult Mode */ 1109 /* Setup Deufult Mode */
1079 s3c64xx_spi_hwinit(sdd, pdev->id); 1110 s3c64xx_spi_hwinit(sdd, sdd->port_id);
1080 1111
1081 spin_lock_init(&sdd->lock); 1112 spin_lock_init(&sdd->lock);
1082 init_completion(&sdd->xfer_completion); 1113 init_completion(&sdd->xfer_completion);
@@ -1101,7 +1132,7 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev)
1101 1132
1102 dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d " 1133 dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d "
1103 "with %d Slaves attached\n", 1134 "with %d Slaves attached\n",
1104 pdev->id, master->num_chipselect); 1135 sdd->port_id, master->num_chipselect);
1105 dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n", 1136 dev_dbg(&pdev->dev, "\tIOmem=[0x%x-0x%x]\tDMA=[Rx-%d, Tx-%d]\n",
1106 mem_res->end, mem_res->start, 1137 mem_res->end, mem_res->start,
1107 sdd->rx_dma.dmach, sdd->tx_dma.dmach); 1138 sdd->rx_dma.dmach, sdd->tx_dma.dmach);
@@ -1194,7 +1225,7 @@ static int s3c64xx_spi_resume(struct device *dev)
1194 clk_enable(sdd->src_clk); 1225 clk_enable(sdd->src_clk);
1195 clk_enable(sdd->clk); 1226 clk_enable(sdd->clk);
1196 1227
1197 s3c64xx_spi_hwinit(sdd, pdev->id); 1228 s3c64xx_spi_hwinit(sdd, sdd->port_id);
1198 1229
1199 spi_master_resume(master); 1230 spi_master_resume(master);
1200 1231
@@ -1232,6 +1263,70 @@ static const struct dev_pm_ops s3c64xx_spi_pm = {
1232 s3c64xx_spi_runtime_resume, NULL) 1263 s3c64xx_spi_runtime_resume, NULL)
1233}; 1264};
1234 1265
1266struct s3c64xx_spi_port_config s3c2443_spi_port_config = {
1267 .fifo_lvl_mask = { 0x7f },
1268 .rx_lvl_offset = 13,
1269 .tx_st_done = 21,
1270 .high_speed = true,
1271};
1272
1273struct s3c64xx_spi_port_config s3c6410_spi_port_config = {
1274 .fifo_lvl_mask = { 0x7f, 0x7F },
1275 .rx_lvl_offset = 13,
1276 .tx_st_done = 21,
1277};
1278
1279struct s3c64xx_spi_port_config s5p64x0_spi_port_config = {
1280 .fifo_lvl_mask = { 0x1ff, 0x7F },
1281 .rx_lvl_offset = 15,
1282 .tx_st_done = 25,
1283};
1284
1285struct s3c64xx_spi_port_config s5pc100_spi_port_config = {
1286 .fifo_lvl_mask = { 0x7f, 0x7F },
1287 .rx_lvl_offset = 13,
1288 .tx_st_done = 21,
1289 .high_speed = true,
1290};
1291
1292struct s3c64xx_spi_port_config s5pv210_spi_port_config = {
1293 .fifo_lvl_mask = { 0x1ff, 0x7F },
1294 .rx_lvl_offset = 15,
1295 .tx_st_done = 25,
1296 .high_speed = true,
1297};
1298
1299struct s3c64xx_spi_port_config exynos4_spi_port_config = {
1300 .fifo_lvl_mask = { 0x1ff, 0x7F, 0x7F },
1301 .rx_lvl_offset = 15,
1302 .tx_st_done = 25,
1303 .high_speed = true,
1304 .clk_from_cmu = true,
1305};
1306
1307static struct platform_device_id s3c64xx_spi_driver_ids[] = {
1308 {
1309 .name = "s3c2443-spi",
1310 .driver_data = (kernel_ulong_t)&s3c2443_spi_port_config,
1311 }, {
1312 .name = "s3c6410-spi",
1313 .driver_data = (kernel_ulong_t)&s3c6410_spi_port_config,
1314 }, {
1315 .name = "s5p64x0-spi",
1316 .driver_data = (kernel_ulong_t)&s5p64x0_spi_port_config,
1317 }, {
1318 .name = "s5pc100-spi",
1319 .driver_data = (kernel_ulong_t)&s5pc100_spi_port_config,
1320 }, {
1321 .name = "s5pv210-spi",
1322 .driver_data = (kernel_ulong_t)&s5pv210_spi_port_config,
1323 }, {
1324 .name = "exynos4210-spi",
1325 .driver_data = (kernel_ulong_t)&exynos4_spi_port_config,
1326 },
1327 { },
1328};
1329
1235static struct platform_driver s3c64xx_spi_driver = { 1330static struct platform_driver s3c64xx_spi_driver = {
1236 .driver = { 1331 .driver = {
1237 .name = "s3c64xx-spi", 1332 .name = "s3c64xx-spi",
@@ -1239,6 +1334,7 @@ static struct platform_driver s3c64xx_spi_driver = {
1239 .pm = &s3c64xx_spi_pm, 1334 .pm = &s3c64xx_spi_pm,
1240 }, 1335 },
1241 .remove = s3c64xx_spi_remove, 1336 .remove = s3c64xx_spi_remove,
1337 .id_table = s3c64xx_spi_driver_ids,
1242}; 1338};
1243MODULE_ALIAS("platform:s3c64xx-spi"); 1339MODULE_ALIAS("platform:s3c64xx-spi");
1244 1340