diff options
| author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-03-14 04:52:33 -0400 |
|---|---|---|
| committer | Chris Ball <cjb@laptop.org> | 2011-03-25 10:39:23 -0400 |
| commit | 42051e8a7bce76ebd3cd201704ee2427120636e1 (patch) | |
| tree | f62527fca5ea9d247faffa9bda2539d996b18068 | |
| parent | 4fbc5ece430bc2890edc90a112c742844130f943 (diff) | |
mmc: tmio: convert the SDHI MMC driver from MFD to a platform driver
On sh-mobile platforms the SDHI driver was using the tmio_mmc SD/SDIO
MFD cell driver. Now that the tmio_mmc driver has been split into a
core and a separate MFD glue, we can support SDHI natively without the
need to emulate an MFD controller. This also allows to support systems
with an on-SoC SDHI controller and a separate MFD with a TMIO core.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
| -rw-r--r-- | drivers/mfd/Kconfig | 14 | ||||
| -rw-r--r-- | drivers/mfd/Makefile | 1 | ||||
| -rw-r--r-- | drivers/mmc/host/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/mmc/host/Makefile | 7 | ||||
| -rw-r--r-- | drivers/mmc/host/sh_mobile_sdhi.c (renamed from drivers/mfd/sh_mobile_sdhi.c) | 95 | ||||
| -rw-r--r-- | drivers/mmc/host/tmio_mmc.h | 2 | ||||
| -rw-r--r-- | include/linux/mfd/sh_mobile_sdhi.h | 19 | ||||
| -rw-r--r-- | include/linux/mmc/sh_mobile_sdhi.h | 16 |
8 files changed, 68 insertions, 95 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index a9a1af49281e..38cb1d4d6843 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -60,15 +60,6 @@ config MFD_ASIC3 | |||
| 60 | This driver supports the ASIC3 multifunction chip found on many | 60 | This driver supports the ASIC3 multifunction chip found on many |
| 61 | PDAs (mainly iPAQ and HTC based ones) | 61 | PDAs (mainly iPAQ and HTC based ones) |
| 62 | 62 | ||
| 63 | config MFD_SH_MOBILE_SDHI | ||
| 64 | bool "Support for SuperH Mobile SDHI" | ||
| 65 | depends on SUPERH || ARCH_SHMOBILE | ||
| 66 | select MFD_CORE | ||
| 67 | select TMIO_MMC_DMA | ||
| 68 | ---help--- | ||
| 69 | This driver supports the SDHI hardware block found in many | ||
| 70 | SuperH Mobile SoCs. | ||
| 71 | |||
| 72 | config MFD_DAVINCI_VOICECODEC | 63 | config MFD_DAVINCI_VOICECODEC |
| 73 | tristate | 64 | tristate |
| 74 | select MFD_CORE | 65 | select MFD_CORE |
| @@ -265,11 +256,6 @@ config MFD_TMIO | |||
| 265 | bool | 256 | bool |
| 266 | default n | 257 | default n |
| 267 | 258 | ||
| 268 | config TMIO_MMC_DMA | ||
| 269 | bool | ||
| 270 | select DMA_ENGINE | ||
| 271 | select DMADEVICES | ||
| 272 | |||
| 273 | config MFD_T7L66XB | 259 | config MFD_T7L66XB |
| 274 | bool "Support Toshiba T7L66XB" | 260 | bool "Support Toshiba T7L66XB" |
| 275 | depends on ARM && HAVE_CLK | 261 | depends on ARM && HAVE_CLK |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 47f5709f3828..ad6c44321873 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o | 6 | obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o |
| 7 | obj-$(CONFIG_MFD_SM501) += sm501.o | 7 | obj-$(CONFIG_MFD_SM501) += sm501.o |
| 8 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o | 8 | obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o |
| 9 | obj-$(CONFIG_MFD_SH_MOBILE_SDHI) += sh_mobile_sdhi.o | ||
| 10 | 9 | ||
| 11 | obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o | 10 | obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o |
| 12 | obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o | 11 | obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o |
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 4d16166386ca..0b03cee91451 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig | |||
| @@ -444,12 +444,19 @@ config MMC_TMIO_CORE | |||
| 444 | 444 | ||
| 445 | config MMC_TMIO | 445 | config MMC_TMIO |
| 446 | tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support" | 446 | tristate "Toshiba Mobile IO Controller (TMIO) MMC/SD function support" |
| 447 | depends on MFD_TMIO || MFD_ASIC3 || MFD_SH_MOBILE_SDHI | 447 | depends on MFD_TMIO || MFD_ASIC3 |
| 448 | select MMC_TMIO_CORE | 448 | select MMC_TMIO_CORE |
| 449 | help | 449 | help |
| 450 | This provides support for the SD/MMC cell found in TC6393XB, | 450 | This provides support for the SD/MMC cell found in TC6393XB, |
| 451 | T7L66XB and also HTC ASIC3 | 451 | T7L66XB and also HTC ASIC3 |
| 452 | 452 | ||
| 453 | config MMC_SDHI | ||
| 454 | tristate "SH-Mobile SDHI SD/SDIO controller support" | ||
| 455 | select MMC_TMIO_CORE | ||
| 456 | help | ||
| 457 | This provides support for the SDHI SD/SDIO controller found in | ||
| 458 | SuperH and ARM SH-Mobile SoCs | ||
| 459 | |||
| 453 | config MMC_CB710 | 460 | config MMC_CB710 |
| 454 | tristate "ENE CB710 MMC/SD Interface support" | 461 | tristate "ENE CB710 MMC/SD Interface support" |
| 455 | depends on PCI | 462 | depends on PCI |
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 79c42dd23c0e..4f1df0aae574 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile | |||
| @@ -31,8 +31,11 @@ obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o | |||
| 31 | obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o | 31 | obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o |
| 32 | obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o | 32 | obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o |
| 33 | tmio_mmc_core-y := tmio_mmc_pio.o | 33 | tmio_mmc_core-y := tmio_mmc_pio.o |
| 34 | tmio_mmc_core-$(CONFIG_TMIO_MMC_DMA) += tmio_mmc_dma.o | 34 | ifneq ($(CONFIG_MMC_SDHI),n) |
| 35 | obj-$(CONFIG_MMC_CB710) += cb710-mmc.o | 35 | tmio_mmc_core-y += tmio_mmc_dma.o |
| 36 | endif | ||
| 37 | obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o | ||
| 38 | obj-$(CONFIG_MMC_CB710) += cb710-mmc.o | ||
| 36 | obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o | 39 | obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o |
| 37 | obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o | 40 | obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o |
| 38 | obj-$(CONFIG_MMC_DW) += dw_mmc.o | 41 | obj-$(CONFIG_MMC_DW) += dw_mmc.o |
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c index 53a63024bf11..cc701236d16f 100644 --- a/drivers/mfd/sh_mobile_sdhi.c +++ b/drivers/mmc/host/sh_mobile_sdhi.c | |||
| @@ -23,51 +23,30 @@ | |||
| 23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
| 24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/mmc/host.h> | 25 | #include <linux/mmc/host.h> |
| 26 | #include <linux/mfd/core.h> | 26 | #include <linux/mmc/sh_mobile_sdhi.h> |
| 27 | #include <linux/mfd/tmio.h> | 27 | #include <linux/mfd/tmio.h> |
| 28 | #include <linux/mfd/sh_mobile_sdhi.h> | ||
| 29 | #include <linux/sh_dma.h> | 28 | #include <linux/sh_dma.h> |
| 30 | 29 | ||
| 30 | #include "tmio_mmc.h" | ||
| 31 | |||
| 31 | struct sh_mobile_sdhi { | 32 | struct sh_mobile_sdhi { |
| 32 | struct clk *clk; | 33 | struct clk *clk; |
| 33 | struct tmio_mmc_data mmc_data; | 34 | struct tmio_mmc_data mmc_data; |
| 34 | struct mfd_cell cell_mmc; | ||
| 35 | struct sh_dmae_slave param_tx; | 35 | struct sh_dmae_slave param_tx; |
| 36 | struct sh_dmae_slave param_rx; | 36 | struct sh_dmae_slave param_rx; |
| 37 | struct tmio_mmc_dma dma_priv; | 37 | struct tmio_mmc_dma dma_priv; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | static struct resource sh_mobile_sdhi_resources[] = { | 40 | static void sh_mobile_sdhi_set_pwr(struct platform_device *pdev, int state) |
| 41 | { | ||
| 42 | .start = 0x000, | ||
| 43 | .end = 0x1ff, | ||
| 44 | .flags = IORESOURCE_MEM, | ||
| 45 | }, | ||
| 46 | { | ||
| 47 | .start = 0, | ||
| 48 | .end = 0, | ||
| 49 | .flags = IORESOURCE_IRQ, | ||
| 50 | }, | ||
| 51 | }; | ||
| 52 | |||
| 53 | static struct mfd_cell sh_mobile_sdhi_cell = { | ||
| 54 | .name = "tmio-mmc", | ||
| 55 | .num_resources = ARRAY_SIZE(sh_mobile_sdhi_resources), | ||
| 56 | .resources = sh_mobile_sdhi_resources, | ||
| 57 | }; | ||
| 58 | |||
| 59 | static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state) | ||
| 60 | { | 41 | { |
| 61 | struct platform_device *pdev = to_platform_device(tmio->dev.parent); | ||
| 62 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | 42 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; |
| 63 | 43 | ||
| 64 | if (p && p->set_pwr) | 44 | if (p && p->set_pwr) |
| 65 | p->set_pwr(pdev, state); | 45 | p->set_pwr(pdev, state); |
| 66 | } | 46 | } |
| 67 | 47 | ||
| 68 | static int sh_mobile_sdhi_get_cd(struct platform_device *tmio) | 48 | static int sh_mobile_sdhi_get_cd(struct platform_device *pdev) |
| 69 | { | 49 | { |
| 70 | struct platform_device *pdev = to_platform_device(tmio->dev.parent); | ||
| 71 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | 50 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; |
| 72 | 51 | ||
| 73 | if (p && p->get_cd) | 52 | if (p && p->get_cd) |
| @@ -81,20 +60,9 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
| 81 | struct sh_mobile_sdhi *priv; | 60 | struct sh_mobile_sdhi *priv; |
| 82 | struct tmio_mmc_data *mmc_data; | 61 | struct tmio_mmc_data *mmc_data; |
| 83 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; | 62 | struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; |
| 84 | struct resource *mem; | 63 | struct tmio_mmc_host *host; |
| 85 | char clk_name[8]; | 64 | char clk_name[8]; |
| 86 | int ret, irq; | 65 | int ret; |
| 87 | |||
| 88 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 89 | if (!mem) | ||
| 90 | dev_err(&pdev->dev, "missing MEM resource\n"); | ||
| 91 | |||
| 92 | irq = platform_get_irq(pdev, 0); | ||
| 93 | if (irq < 0) | ||
| 94 | dev_err(&pdev->dev, "missing IRQ resource\n"); | ||
| 95 | |||
| 96 | if (!mem || (irq < 0)) | ||
