diff options
Diffstat (limited to 'arch/arm/plat-samsung/devs.c')
-rw-r--r-- | arch/arm/plat-samsung/devs.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 4ca8b571f971..de0d88d6a0f1 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,129 @@ 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 | if (!pd->cfg_gpio) | ||
1502 | pd->cfg_gpio = s3c64xx_spi0_cfg_gpio; | ||
1503 | |||
1504 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0); | ||
1505 | } | ||
1506 | #endif /* CONFIG_S3C64XX_DEV_SPI0 */ | ||
1507 | |||
1508 | #ifdef CONFIG_S3C64XX_DEV_SPI1 | ||
1509 | static struct resource s3c64xx_spi1_resource[] = { | ||
1510 | [0] = DEFINE_RES_MEM(S3C_PA_SPI1, SZ_256), | ||
1511 | [1] = DEFINE_RES_DMA(DMACH_SPI1_TX), | ||
1512 | [2] = DEFINE_RES_DMA(DMACH_SPI1_RX), | ||
1513 | [3] = DEFINE_RES_IRQ(IRQ_SPI1), | ||
1514 | }; | ||
1515 | |||
1516 | struct platform_device s3c64xx_device_spi1 = { | ||
1517 | .name = "s3c64xx-spi", | ||
1518 | .id = 1, | ||
1519 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), | ||
1520 | .resource = s3c64xx_spi1_resource, | ||
1521 | .dev = { | ||
1522 | .dma_mask = &samsung_device_dma_mask, | ||
1523 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1524 | }, | ||
1525 | }; | ||
1526 | |||
1527 | void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, | ||
1528 | int src_clk_nr, int num_cs) | ||
1529 | { | ||
1530 | if (!pd) { | ||
1531 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1532 | return; | ||
1533 | } | ||
1534 | |||
1535 | /* Reject invalid configuration */ | ||
1536 | if (!num_cs || src_clk_nr < 0) { | ||
1537 | pr_err("%s: Invalid SPI configuration\n", __func__); | ||
1538 | return; | ||
1539 | } | ||
1540 | |||
1541 | pd->num_cs = num_cs; | ||
1542 | pd->src_clk_nr = src_clk_nr; | ||
1543 | if (!pd->cfg_gpio) | ||
1544 | pd->cfg_gpio = s3c64xx_spi1_cfg_gpio; | ||
1545 | |||
1546 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1); | ||
1547 | } | ||
1548 | #endif /* CONFIG_S3C64XX_DEV_SPI1 */ | ||
1549 | |||
1550 | #ifdef CONFIG_S3C64XX_DEV_SPI2 | ||
1551 | static struct resource s3c64xx_spi2_resource[] = { | ||
1552 | [0] = DEFINE_RES_MEM(S3C_PA_SPI2, SZ_256), | ||
1553 | [1] = DEFINE_RES_DMA(DMACH_SPI2_TX), | ||
1554 | [2] = DEFINE_RES_DMA(DMACH_SPI2_RX), | ||
1555 | [3] = DEFINE_RES_IRQ(IRQ_SPI2), | ||
1556 | }; | ||
1557 | |||
1558 | struct platform_device s3c64xx_device_spi2 = { | ||
1559 | .name = "s3c64xx-spi", | ||
1560 | .id = 2, | ||
1561 | .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), | ||
1562 | .resource = s3c64xx_spi2_resource, | ||
1563 | .dev = { | ||
1564 | .dma_mask = &samsung_device_dma_mask, | ||
1565 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1566 | }, | ||
1567 | }; | ||
1568 | |||
1569 | void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | ||
1570 | int src_clk_nr, int num_cs) | ||
1571 | { | ||
1572 | if (!pd) { | ||
1573 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1574 | return; | ||
1575 | } | ||
1576 | |||
1577 | /* Reject invalid configuration */ | ||
1578 | if (!num_cs || src_clk_nr < 0) { | ||
1579 | pr_err("%s: Invalid SPI configuration\n", __func__); | ||
1580 | return; | ||
1581 | } | ||
1582 | |||
1583 | pd->num_cs = num_cs; | ||
1584 | pd->src_clk_nr = src_clk_nr; | ||
1585 | if (!pd->cfg_gpio) | ||
1586 | pd->cfg_gpio = s3c64xx_spi2_cfg_gpio; | ||
1587 | |||
1588 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2); | ||
1589 | } | ||
1590 | #endif /* CONFIG_S3C64XX_DEV_SPI2 */ | ||