aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-ecovec24
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2013-08-08 06:38:34 -0400
committerChris Ball <cjb@laptop.org>2013-08-24 23:45:30 -0400
commitafa2c9407f8908e2269b243773cbb0997c553804 (patch)
tree2dbc3e526ac7f447b270309e541c220efa2efac9 /arch/sh/boards/mach-ecovec24
parent2a4f6b1daf552e6b2be83c381166b98f6deaa21a (diff)
sh: ecovec24: Use MMC/SDHI CD and RO GPIO
Pass the CD and RO GPIO numbers to the MMC SPI and SDHI drivers and remove the custom .get_cd() and .get_ro() callback functions. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'arch/sh/boards/mach-ecovec24')
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 61fade0ffa96..a1557ec4833f 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -617,18 +617,14 @@ static void sdhi0_set_pwr(struct platform_device *pdev, int state)
617 gpio_set_value(GPIO_PTB6, state); 617 gpio_set_value(GPIO_PTB6, state);
618} 618}
619 619
620static int sdhi0_get_cd(struct platform_device *pdev)
621{
622 return !gpio_get_value(GPIO_PTY7);
623}
624
625static struct sh_mobile_sdhi_info sdhi0_info = { 620static struct sh_mobile_sdhi_info sdhi0_info = {
626 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 621 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
627 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 622 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
628 .set_pwr = sdhi0_set_pwr, 623 .set_pwr = sdhi0_set_pwr,
629 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 624 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
630 MMC_CAP_NEEDS_POLL, 625 MMC_CAP_NEEDS_POLL,
631 .get_cd = sdhi0_get_cd, 626 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
627 .cd_gpio = GPIO_PTY7,
632}; 628};
633 629
634static struct resource sdhi0_resources[] = { 630static struct resource sdhi0_resources[] = {
@@ -675,18 +671,14 @@ static void cn12_set_pwr(struct platform_device *pdev, int state)
675 671
676#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 672#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
677/* SDHI1 */ 673/* SDHI1 */
678static int sdhi1_get_cd(struct platform_device *pdev)
679{
680 return !gpio_get_value(GPIO_PTW7);
681}
682
683static struct sh_mobile_sdhi_info sdhi1_info = { 674static struct sh_mobile_sdhi_info sdhi1_info = {
684 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 675 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
685 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 676 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
686 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 677 .tmio_caps = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD |
687 MMC_CAP_NEEDS_POLL, 678 MMC_CAP_NEEDS_POLL,
679 .tmio_flags = TMIO_MMC_USE_GPIO_CD,
680 .cd_gpio = GPIO_PTW7,
688 .set_pwr = cn12_set_pwr, 681 .set_pwr = cn12_set_pwr,
689 .get_cd = sdhi1_get_cd,
690}; 682};
691 683
692static struct resource sdhi1_resources[] = { 684static struct resource sdhi1_resources[] = {
@@ -716,27 +708,19 @@ static struct platform_device sdhi1_device = {
716#else 708#else
717 709
718/* MMC SPI */ 710/* MMC SPI */
719static int mmc_spi_get_ro(struct device *dev)
720{
721 return gpio_get_value(GPIO_PTY6);
722}
723
724static int mmc_spi_get_cd(struct device *dev)
725{
726 return !gpio_get_value(GPIO_PTY7);
727}
728
729static void mmc_spi_setpower(struct device *dev, unsigned int maskval) 711static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
730{ 712{
731 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0); 713 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
732} 714}
733 715
734static struct mmc_spi_platform_data mmc_spi_info = { 716static struct mmc_spi_platform_data mmc_spi_info = {
735 .get_ro = mmc_spi_get_ro,
736 .get_cd = mmc_spi_get_cd,
737 .caps = MMC_CAP_NEEDS_POLL, 717 .caps = MMC_CAP_NEEDS_POLL,
718 .caps2 = MMC_CAP2_RO_ACTIVE_HIGH,
738 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */ 719 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
739 .setpower = mmc_spi_setpower, 720 .setpower = mmc_spi_setpower,
721 .flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO,
722 .cd_gpio = GPIO_PTY7,
723 .ro_gpio = GPIO_PTY6,
740}; 724};
741 725
742static struct spi_board_info spi_bus[] = { 726static struct spi_board_info spi_bus[] = {
@@ -1339,10 +1323,6 @@ static int __init arch_setup(void)
1339 gpio_direction_input(GPIO_PTR6); 1323 gpio_direction_input(GPIO_PTR6);
1340 1324
1341 /* SD-card slot CN11 */ 1325 /* SD-card slot CN11 */
1342 /* Card-detect, used on CN11, either with SDHI0 or with SPI */
1343 gpio_request(GPIO_PTY7, NULL);
1344 gpio_direction_input(GPIO_PTY7);
1345
1346#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 1326#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE)
1347 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ 1327 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
1348 gpio_request(GPIO_FN_SDHI0WP, NULL); 1328 gpio_request(GPIO_FN_SDHI0WP, NULL);
@@ -1361,8 +1341,6 @@ static int __init arch_setup(void)
1361 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */ 1341 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
1362 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */ 1342 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
1363 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ 1343 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
1364 gpio_request(GPIO_PTY6, NULL); /* write protect */
1365 gpio_direction_input(GPIO_PTY6);
1366 1344
1367 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); 1345 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
1368#endif 1346#endif
@@ -1392,10 +1370,6 @@ static int __init arch_setup(void)
1392 gpio_request(GPIO_FN_SDHI1D1, NULL); 1370 gpio_request(GPIO_FN_SDHI1D1, NULL);
1393 gpio_request(GPIO_FN_SDHI1D0, NULL); 1371 gpio_request(GPIO_FN_SDHI1D0, NULL);
1394 1372
1395 /* Card-detect, used on CN12 with SDHI1 */
1396 gpio_request(GPIO_PTW7, NULL);
1397 gpio_direction_input(GPIO_PTW7);
1398
1399 cn12_enabled = true; 1373 cn12_enabled = true;
1400#endif 1374#endif
1401 1375