diff options
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-crag6410.c | 2 | ||||
-rw-r--r-- | arch/arm/plat-samsung/devs.c | 60 | ||||
-rw-r--r-- | arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | 14 |
3 files changed, 31 insertions, 45 deletions
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index d0c352d861f8..6dd4fae33a82 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c | |||
@@ -799,7 +799,7 @@ static void __init crag6410_machine_init(void) | |||
799 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | 799 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); |
800 | 800 | ||
801 | samsung_keypad_set_platdata(&crag6410_keypad_data); | 801 | samsung_keypad_set_platdata(&crag6410_keypad_data); |
802 | s3c64xx_spi0_set_platdata(&s3c64xx_spi0_pdata, 0, 1); | 802 | s3c64xx_spi0_set_platdata(NULL, 0, 1); |
803 | 803 | ||
804 | platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); | 804 | platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices)); |
805 | 805 | ||
diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 1d214cb9d770..86d075870a52 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c | |||
@@ -1512,7 +1512,7 @@ static struct resource s3c64xx_spi0_resource[] = { | |||
1512 | }; | 1512 | }; |
1513 | 1513 | ||
1514 | struct platform_device s3c64xx_device_spi0 = { | 1514 | struct platform_device s3c64xx_device_spi0 = { |
1515 | .name = "s3c64xx-spi", | 1515 | .name = "s3c6410-spi", |
1516 | .id = 0, | 1516 | .id = 0, |
1517 | .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), | 1517 | .num_resources = ARRAY_SIZE(s3c64xx_spi0_resource), |
1518 | .resource = s3c64xx_spi0_resource, | 1518 | .resource = s3c64xx_spi0_resource, |
@@ -1522,13 +1522,10 @@ struct platform_device s3c64xx_device_spi0 = { | |||
1522 | }, | 1522 | }, |
1523 | }; | 1523 | }; |
1524 | 1524 | ||
1525 | void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, | 1525 | void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
1526 | int src_clk_nr, int num_cs) | 1526 | int num_cs) |
1527 | { | 1527 | { |
1528 | if (!pd) { | 1528 | struct s3c64xx_spi_info pd; |
1529 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1530 | return; | ||
1531 | } | ||
1532 | 1529 | ||
1533 | /* Reject invalid configuration */ | 1530 | /* Reject invalid configuration */ |
1534 | if (!num_cs || src_clk_nr < 0) { | 1531 | if (!num_cs || src_clk_nr < 0) { |
@@ -1536,12 +1533,11 @@ void __init s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, | |||
1536 | return; | 1533 | return; |
1537 | } | 1534 | } |
1538 | 1535 | ||
1539 | pd->num_cs = num_cs; | 1536 | pd.num_cs = num_cs; |
1540 | pd->src_clk_nr = src_clk_nr; | 1537 | pd.src_clk_nr = src_clk_nr; |
1541 | if (!pd->cfg_gpio) | 1538 | pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; |
1542 | pd->cfg_gpio = s3c64xx_spi0_cfg_gpio; | ||
1543 | 1539 | ||
1544 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi0); | 1540 | s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi0); |
1545 | } | 1541 | } |
1546 | #endif /* CONFIG_S3C64XX_DEV_SPI0 */ | 1542 | #endif /* CONFIG_S3C64XX_DEV_SPI0 */ |
1547 | 1543 | ||
@@ -1554,7 +1550,7 @@ static struct resource s3c64xx_spi1_resource[] = { | |||
1554 | }; | 1550 | }; |
1555 | 1551 | ||
1556 | struct platform_device s3c64xx_device_spi1 = { | 1552 | struct platform_device s3c64xx_device_spi1 = { |
1557 | .name = "s3c64xx-spi", | 1553 | .name = "s3c6410-spi", |
1558 | .id = 1, | 1554 | .id = 1, |
1559 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), | 1555 | .num_resources = ARRAY_SIZE(s3c64xx_spi1_resource), |
1560 | .resource = s3c64xx_spi1_resource, | 1556 | .resource = s3c64xx_spi1_resource, |
@@ -1564,26 +1560,20 @@ struct platform_device s3c64xx_device_spi1 = { | |||
1564 | }, | 1560 | }, |
1565 | }; | 1561 | }; |
1566 | 1562 | ||
1567 | void __init s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, | 1563 | void __init s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
1568 | int src_clk_nr, int num_cs) | 1564 | int num_cs) |
1569 | { | 1565 | { |
1570 | if (!pd) { | ||
1571 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1572 | return; | ||
1573 | } | ||
1574 | |||
1575 | /* Reject invalid configuration */ | 1566 | /* Reject invalid configuration */ |
1576 | if (!num_cs || src_clk_nr < 0) { | 1567 | if (!num_cs || src_clk_nr < 0) { |
1577 | pr_err("%s: Invalid SPI configuration\n", __func__); | 1568 | pr_err("%s: Invalid SPI configuration\n", __func__); |
1578 | return; | 1569 | return; |
1579 | } | 1570 | } |
1580 | 1571 | ||
1581 | pd->num_cs = num_cs; | 1572 | pd.num_cs = num_cs; |
1582 | pd->src_clk_nr = src_clk_nr; | 1573 | pd.src_clk_nr = src_clk_nr; |
1583 | if (!pd->cfg_gpio) | 1574 | pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi1_cfg_gpio; |
1584 | pd->cfg_gpio = s3c64xx_spi1_cfg_gpio; | ||
1585 | 1575 | ||
1586 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi1); | 1576 | s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi1); |
1587 | } | 1577 | } |
1588 | #endif /* CONFIG_S3C64XX_DEV_SPI1 */ | 1578 | #endif /* CONFIG_S3C64XX_DEV_SPI1 */ |
1589 | 1579 | ||
@@ -1596,7 +1586,7 @@ static struct resource s3c64xx_spi2_resource[] = { | |||
1596 | }; | 1586 | }; |
1597 | 1587 | ||
1598 | struct platform_device s3c64xx_device_spi2 = { | 1588 | struct platform_device s3c64xx_device_spi2 = { |
1599 | .name = "s3c64xx-spi", | 1589 | .name = "s3c6410-spi", |
1600 | .id = 2, | 1590 | .id = 2, |
1601 | .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), | 1591 | .num_resources = ARRAY_SIZE(s3c64xx_spi2_resource), |
1602 | .resource = s3c64xx_spi2_resource, | 1592 | .resource = s3c64xx_spi2_resource, |
@@ -1606,13 +1596,10 @@ struct platform_device s3c64xx_device_spi2 = { | |||
1606 | }, | 1596 | }, |
1607 | }; | 1597 | }; |
1608 | 1598 | ||
1609 | void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | 1599 | void __init s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
1610 | int src_clk_nr, int num_cs) | 1600 | int num_cs) |
1611 | { | 1601 | { |
1612 | if (!pd) { | 1602 | struct s3c64xx_spi_info pd; |
1613 | pr_err("%s:Need to pass platform data\n", __func__); | ||
1614 | return; | ||
1615 | } | ||
1616 | 1603 | ||
1617 | /* Reject invalid configuration */ | 1604 | /* Reject invalid configuration */ |
1618 | if (!num_cs || src_clk_nr < 0) { | 1605 | if (!num_cs || src_clk_nr < 0) { |
@@ -1620,11 +1607,10 @@ void __init s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | |||
1620 | return; | 1607 | return; |
1621 | } | 1608 | } |
1622 | 1609 | ||
1623 | pd->num_cs = num_cs; | 1610 | pd.num_cs = num_cs; |
1624 | pd->src_clk_nr = src_clk_nr; | 1611 | pd.src_clk_nr = src_clk_nr; |
1625 | if (!pd->cfg_gpio) | 1612 | pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi2_cfg_gpio; |
1626 | pd->cfg_gpio = s3c64xx_spi2_cfg_gpio; | ||
1627 | 1613 | ||
1628 | s3c_set_platdata(pd, sizeof(*pd), &s3c64xx_device_spi2); | 1614 | s3c_set_platdata(&pd, sizeof(pd), &s3c64xx_device_spi2); |
1629 | } | 1615 | } |
1630 | #endif /* CONFIG_S3C64XX_DEV_SPI2 */ | 1616 | #endif /* CONFIG_S3C64XX_DEV_SPI2 */ |
diff --git a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h index 89dbaee43800..c818a7c18929 100644 --- a/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h +++ b/arch/arm/plat-samsung/include/plat/s3c64xx-spi.h | |||
@@ -45,19 +45,19 @@ struct s3c64xx_spi_info { | |||
45 | /** | 45 | /** |
46 | * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board | 46 | * s3c64xx_spi_set_platdata - SPI Controller configure callback by the board |
47 | * initialization code. | 47 | * initialization code. |
48 | * @pd: SPI platform data to set. | 48 | * @cfg_gpio: Pointer to gpio setup function. |
49 | * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. | 49 | * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks. |
50 | * @num_cs: Number of elements in the 'cs' array. | 50 | * @num_cs: Number of elements in the 'cs' array. |
51 | * | 51 | * |
52 | * Call this from machine init code for each SPI Controller that | 52 | * Call this from machine init code for each SPI Controller that |
53 | * has some chips attached to it. | 53 | * has some chips attached to it. |
54 | */ | 54 | */ |
55 | extern void s3c64xx_spi0_set_platdata(struct s3c64xx_spi_info *pd, | 55 | extern void s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
56 | int src_clk_nr, int num_cs); | 56 | int num_cs); |
57 | extern void s3c64xx_spi1_set_platdata(struct s3c64xx_spi_info *pd, | 57 | extern void s3c64xx_spi1_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
58 | int src_clk_nr, int num_cs); | 58 | int num_cs); |
59 | extern void s3c64xx_spi2_set_platdata(struct s3c64xx_spi_info *pd, | 59 | extern void s3c64xx_spi2_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, |
60 | int src_clk_nr, int num_cs); | 60 | int num_cs); |
61 | 61 | ||
62 | /* defined by architecture to configure gpio */ | 62 | /* defined by architecture to configure gpio */ |
63 | extern int s3c64xx_spi0_cfg_gpio(void); | 63 | extern int s3c64xx_spi0_cfg_gpio(void); |