diff options
author | Padmavathi Venna <padma.v@samsung.com> | 2011-12-22 20:14:31 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-12-22 20:49:53 -0500 |
commit | 875a59374cd10200ac24f03877ccd8f73af590cc (patch) | |
tree | a7a933bd6a567fd2daa51439bcb17597aa337814 /arch/arm/plat-samsung | |
parent | a153e31abb01484d0088ac28425dc98204848ad4 (diff) |
ARM: SAMSUNG: Consolidation of SPI platform devices to plat-samsung
SPI platform device definitions consolidated from respective machine
folder to plat-samsung
Signed-off-by: Padmavathi Venna <padma.v@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r-- | arch/arm/plat-samsung/Kconfig | 16 | ||||
-rw-r--r-- | arch/arm/plat-samsung/devs.c | 118 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/devs.h | 8 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 15 |
4 files changed, 141 insertions, 16 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 313eb26cfa62..160eea15a6ef 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig | |||
@@ -226,11 +226,23 @@ config SAMSUNG_DEV_IDE | |||
226 | help | 226 | help |
227 | Compile in platform device definitions for IDE | 227 | Compile in platform device definitions for IDE |
228 | 228 | ||
229 | config S3C64XX_DEV_SPI | 229 | config S3C64XX_DEV_SPI0 |
230 | bool | 230 | bool |
231 | help | 231 | help |
232 | Compile in platform device definitions for S3C64XX's type | 232 | Compile in platform device definitions for S3C64XX's type |
233 | SPI controllers. | 233 | SPI controller 0 |
234 | |||
235 | config S3C64XX_DEV_SPI1 | ||
236 | bool | ||
237 | help | ||
238 | Compile in platform device definitions for S3C64XX's type | ||
239 | SPI controller 1 | ||
240 | |||
241 | config S3C64XX_DEV_SPI2 | ||
242 | bool | ||
243 | help | ||
244 | Compile in platform device definitions for S3C64XX's type | ||
245 | SPI controller 2 | ||
234 | 246 | ||
235 | config SAMSUNG_DEV_TS | 247 | config SAMSUNG_DEV_TS |
236 | bool | 248 | bool |
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 4ca8b571f971..8b27e61d0345 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <plat/regs-iic.h> | 61 | #include <plat/regs-iic.h> |
62 | #include <plat/regs-serial.h> | 62 | #include <plat/regs-serial.h> |
63 | #include <plat/regs-spi.h> | 63 | #include <plat/regs-spi.h> |
64 | #include <plat/s3c64xx-spi.h> | ||
64 | 65 | ||
65 | static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); | 66 | static u64 samsung_device_dma_mask = DMA_BIT_MASK(32); |
66 | 67 | ||
@@ -1461,3 +1462,120 @@ struct platform_device s3c_device_wdt = { | |||
1461 | .resource = s3c_wdt_resource, | 1462 | .resource = s3c_wdt_resource, |
1462 | }; | 1463 | }; |
1463 | #endif /* CONFIG_S3C_DEV_WDT */ | 1464 | #endif /* CONFIG_S3C_DEV_WDT */ |
1465 | |||
1466 | #ifdef CONFIG_S3C64XX_DEV_SPI0 | ||
1467 | static struct resource s3c64xx_spi0_resource[] = { | ||
1468 | [0] = DEFINE_RES_MEM(S3C_PA_SPI0, SZ_256), | ||
1469 | [1] = DEFINE_RES_DMA(DMACH_SPI0_TX), | ||
1470 | [2] = DEFINE_RES_DMA(DMACH_SPI0_RX), | ||
1471 | [3] = DEFINE_RES_IRQ(IRQ_SPI0), | ||
1472 | }; | ||
1473 | |||
1474 | struct platform_device s3c64xx_device_spi0 = { | ||
1475 | .name = "s3c64xx-spi", | ||
1476 | .id = 0, | ||
1477 | .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), | ||
1478 | .resource = s3c64xx_spi0_resource, | ||
1479 | .dev = { | ||
1480 | .dma_mask = &samsung_device_dma_mask, | ||
1481 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1482 | }, | ||
1483 | }; | ||
1484 | |||
1485 | void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, | ||
1486 | int src_clk_nr, int num_cs) | ||
1487 | { | ||
1488 | if (!pd) { | ||
1489 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1490 | return; | ||
1491 | } | ||
1492 | |||
1493 | /* Reject invalid configuration */ | ||
1494 | if (!num_cs || src_clk_nr < 0) { | ||
1495 | pr_err("%s: Invalid SPI configuration\n", __func__); | ||
1496 | return; | ||
1497 | } | ||
1498 | |||
1499 | pd->num_cs = num_cs; | ||
1500 | pd->src_clk_nr = src_clk_nr; | ||
1501 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0); | ||
1502 | } | ||
1503 | #endif /* CONFIG_S3C64XX_DEV_SPI0 */ | ||
1504 | |||
1505 | #ifdef CONFIG_S3C64XX_DEV_SPI1 | ||
1506 | static struct resource s3c64xx_spi1_resource[] = { | ||
1507 | [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256), | ||
1508 | [1] = DEFINE_RES_DMA(DMACH_SPI1_TX), | ||
1509 | [2] = DEFINE_RES_DMA(DMACH_SPI1_RX), | ||
1510 | [3] = DEFINE_RES_IRQ(IRQ_SPI1), | ||
1511 | }; | ||
1512 | |||
1513 | struct platform_device s3c64xx_device_spi1 = { | ||
1514 | .name = "s3c64xx-spi", | ||
1515 | .id = 1, | ||
1516 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), | ||
1517 | .resource = s3c64xx_spi1_resource, | ||
1518 | .dev = { | ||
1519 | .dma_mask = &samsung_device_dma_mask, | ||
1520 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1521 | }, | ||
1522 | }; | ||
1523 | |||
1524 | void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, | ||
1525 | int src_clk_nr, int num_cs) | ||
1526 | { | ||
1527 | if (!pd) { | ||
1528 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1529 | return; | ||
1530 | } | ||
1531 | |||
1532 | /* Reject invalid configuration */ | ||
1533 | if (!num_cs || src_clk_nr < 0) { | ||
1534 | pr_err("%s: Invalid SPI configuration\n", __func__); | ||
1535 | return; | ||
1536 | } | ||
1537 | |||
1538 | pd->num_cs = num_cs; | ||
1539 | pd->src_clk_nr = src_clk_nr; | ||
1540 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1); | ||
1541 | } | ||
1542 | #endif /* CONFIG_S3C64XX_DEV_SPI1 */ | ||
1543 | |||
1544 | #ifdef CONFIG_S3C64XX_DEV_SPI2 | ||
1545 | static struct resource s3c64xx_spi2_resource[] = { | ||
1546 | [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256), | ||
1547 | [1] = DEFINE_RES_DMA(DMACH_SPI2_TX), | ||
1548 | [2] = DEFINE_RES_DMA(DMACH_SPI2_RX), | ||
1549 | [3] = DEFINE_RES_IRQ(IRQ_SPI2), | ||
1550 | }; | ||
1551 | |||
1552 | struct platform_device s3c64xx_device_spi2 = { | ||
1553 | .name = "s3c64xx-spi", | ||
1554 | .id = 2, | ||
1555 | .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), | ||
1556 | .resource = s3c64xx_spi2_resource, | ||
1557 | .dev = { | ||
1558 | .dma_mask = &samsung_device_dma_mask, | ||
1559 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1560 | }, | ||
1561 | }; | ||
1562 | |||
1563 | void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | ||
1564 | int src_clk_nr, int num_cs) | ||
1565 | { | ||
1566 | if (!pd) { | ||
1567 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1568 | return; | ||
1569 | } | ||
1570 | |||
1571 | /* Reject invalid configuration */ | ||
1572 | if (!num_cs || src_clk_nr < 0) { | ||
1573 | pr_err("%s: Invalid SPI configuration\n", __func__); | ||
1574 | return; | ||
1575 | } | ||
1576 | |||
1577 | pd->num_cs = num_cs; | ||
1578 | pd->src_clk_nr = src_clk_nr; | ||
1579 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2); | ||
1580 | } | ||
1581 | #endif /* CONFIG_S3C64XX_DEV_SPI2 */ | ||
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h index ab633c9c2aec..83b1e31696d9 100644 --- a/arch/arm/plat-samsung/include/plat/devs.h +++ b/arch/arm/plat-samsung/include/plat/devs.h | |||
@@ -39,6 +39,7 @@ extern struct platform_device s3c64xx_device_pcm0; | |||
39 | extern struct platform_device s3c64xx_device_pcm1; | 39 | extern struct platform_device s3c64xx_device_pcm1; |
40 | extern struct platform_device s3c64xx_device_spi0; | 40 | extern struct platform_device s3c64xx_device_spi0; |
41 | extern struct platform_device s3c64xx_device_spi1; | 41 | extern struct platform_device s3c64xx_device_spi1; |
42 | extern struct platform_device s3c64xx_device_spi2; | ||
42 | 43 | ||
43 | extern struct platform_device s3c_device_adc; | 44 | extern struct platform_device s3c_device_adc; |
44 | extern struct platform_device s3c_device_cfcon; | 45 | extern struct platform_device s3c_device_cfcon; |
@@ -98,8 +99,6 @@ extern struct platform_device s5p6450_device_iis1; | |||
98 | extern struct platform_device s5p6450_device_iis2; | 99 | extern struct platform_device s5p6450_device_iis2; |
99 | extern struct platform_device s5p6450_device_pcm0; | 100 | extern struct platform_device s5p6450_device_pcm0; |
100 | 101 | ||
101 | extern struct platform_device s5p64x0_device_spi0; | ||
102 | extern struct platform_device s5p64x0_device_spi1; | ||
103 | 102 | ||
104 | extern struct platform_device s5pc100_device_ac97; | 103 | extern struct platform_device s5pc100_device_ac97; |
105 | extern struct platform_device s5pc100_device_iis0; | 104 | extern struct platform_device s5pc100_device_iis0; |
@@ -108,9 +107,6 @@ extern struct platform_device s5pc100_device_iis2; | |||
108 | extern struct platform_device s5pc100_device_pcm0; | 107 | extern struct platform_device s5pc100_device_pcm0; |
109 | extern struct platform_device s5pc100_device_pcm1; | 108 | extern struct platform_device s5pc100_device_pcm1; |
110 | extern struct platform_device s5pc100_device_spdif; | 109 | extern struct platform_device s5pc100_device_spdif; |
111 | extern struct platform_device s5pc100_device_spi0; | ||
112 | extern struct platform_device s5pc100_device_spi1; | ||
113 | extern struct platform_device s5pc100_device_spi2; | ||
114 | 110 | ||
115 | extern struct platform_device s5pv210_device_ac97; | 111 | extern struct platform_device s5pv210_device_ac97; |
116 | extern struct platform_device s5pv210_device_iis0; | 112 | extern struct platform_device s5pv210_device_iis0; |
@@ -120,8 +116,6 @@ extern struct platform_device s5pv210_device_pcm0; | |||
120 | extern struct platform_device s5pv210_device_pcm1; | 116 | extern struct platform_device s5pv210_device_pcm1; |
121 | extern struct platform_device s5pv210_device_pcm2; | 117 | extern struct platform_device s5pv210_device_pcm2; |
122 | extern struct platform_device s5pv210_device_spdif; | 118 | extern struct platform_device s5pv210_device_spdif; |
123 | extern struct platform_device s5pv210_device_spi0; | ||
124 | extern struct platform_device s5pv210_device_spi1; | ||
125 | 119 | ||
126 | extern struct platform_device exynos4_device_ac97; | 120 | extern struct platform_device exynos4_device_ac97; |
127 | extern struct platform_device exynos4_device_ahci; | 121 | extern struct platform_device exynos4_device_ahci; |
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h index c3d82a5f5630..effca5394d19 100644 --- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h +++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | |||
@@ -56,18 +56,19 @@ struct s3c64xx_spi_info { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * s3c64xx_spi_set_info - SPI Controller configure callback by the board | 59 | * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board |
60 | * initialization code. | 60 | * initialization code. |
61 | * @cntrlr: SPI controller number the configuration is for. | 61 | * @pd: SPI platform data to set. |
62 | * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. | 62 | * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. |
63 | * @num_cs: Number of elements in the 'cs' array. | 63 | * @num_cs: Number of elements in the 'cs' array. |
64 | * | 64 | * |
65 | * Call this from machine init code for each SPI Controller that | 65 | * Call this from machine init code for each SPI Controller that |
66 | * has some chips attached to it. | 66 | * has some chips attached to it. |
67 | */ | 67 | */ |
68 | extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 68 | extern void s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, |
69 | extern void s5pc100_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 69 | int src_clk_nr, int num_cs); |
70 | extern void s5pv210_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 70 | extern void s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, |
71 | extern void s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs); | 71 | int src_clk_nr, int num_cs); |
72 | 72 | extern void s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | |
73 | int src_clk_nr, int num_cs); | ||
73 | #endif /* __S3C64XX_PLAT_SPI_H */ | 74 | #endif /* __S3C64XX_PLAT_SPI_H */ |