MMC: add support for the Marvell platform SDHCI controller
PATCH 1/1 MMC: add support for the Marvell platform SDHCI controller
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
--- drivers/mmc/host/Kconfig | 12 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-mv.c | 243 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/sdhci-mv.c
drivers/mmc/host/Kconfig +12 -0
@@ -121,6 +121,18 @@ config MMC_SDHCI_PLTFM If unsure, say N. +config MMC_SDHCI_MV + tristate "SDHCI support on Marvell's soc" + depends on MMC_SDHCI + select MMC_SDHCI_IO_ACCESSORS + help + This selects the Secure Digital Host Controller Interface in + Marvell's SoC controllers. + + If you have a controller with this interface, say Y or M here. + + If unsure, say N. + config MMC_SDHCI_S3C tristate "SDHCI support on Samsung S3C SoC" depends on MMC_SDHCI && (PLAT_S3C24XX || PLAT_S3C64XX)
drivers/mmc/host/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_MMC_MXC) += mxcmmc.o obj-$(CONFIG_MMC_SDHCI) += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o +obj-$(CONFIG_MMC_SDHCI_MV) += sdhci-mv.o obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o obj-$(CONFIG_MMC_WBSD) += wbsd.o
drivers/mmc/host/sdhci-mv.c new file +243 -0
243 lines not on this page · raw message
Signature · 1 line
1.6.0.4
Quoted 3 lines · Saeed Bishara
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
Signed-off-by Saeed Bishara <[email protected]>
That's a nice, small driver ;-)
[...]
Quoted 6 lines
drivers/mmc/host/sdhci-mv.c new file +6
-0+ +if (!devm_request_mem_region (&pdev->dev, iomem->start, +resource_size (iomem), +mmc_hostname (host->mmc))) { +dev_err (&pdev->dev,"cannot request region\n" ); + ret = -EBUSY ;
drivers/mmc/host/sdhci-mv.c line 137
Quoted 10 lines
drivers/mmc/host/sdhci-mv.c new file +10
-0+ goto err_request; + } + + host->ioaddr =devm_ioremap (&pdev->dev, iomem->start, +resource_size (iomem)); +if (!host->ioaddr) { +dev_err (&pdev->dev,"failed to remap registers\n" ); + ret = -ENOMEM ; + goto err_request; + }
If you fail to remap the registers shouldn't you release the mem_region you've allocated above?
drivers/mmc/host/sdhci-mv.c line 149
Quoted 12 lines
drivers/mmc/host/sdhci-mv.c new file +12
-0+ +#if defined(CONFIG_HAVE_CLK ) + mv_host->clk =clk_get (&pdev->dev,NULL ); +if (IS_ERR (mv_host->clk)) +dev_notice (&pdev->dev,"cannot get clkdev\n" ); +else +clk_enable (mv_host->clk); +#endif + + ret =sdhci_add_host (host); +if (ret) + goto err_request;
Likewise here, I think you should be iounmap()'ing the registers if this fails. Otherwise this looks good.
Quoted 20 lines · Matt Fleming
Quoted 3 lines · Saeed Bishara
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
Signed-off-by Saeed Bishara <[email protected]>That's a nice, small driver ;-)
[...]
Quoted 11 lines
drivers/mmc/host/sdhci-mv.c new file +11
-0+ + if (!devm_request_mem_region(&pdev->dev, iomem->start, + resource_size(iomem), + mmc_hostname(host->mmc))) { + dev_err(&pdev->dev, "cannot request region\n"); + ret = -EBUSY; + goto err_request; + } + + host->ioaddr = devm_ioremap(&pdev->dev, iomem->start, + resource_size(iomem));
Quoted 8 lines
Quoted 5 lines
+ if (!host->ioaddr) {
+dev_err(&pdev->dev, "failed to remap registers\n");
+ ret =-ENOMEM;
+ gotoerr_request;
+ }If you fail to remap the registers shouldn't you release the
mem_regionyou've allocated above?
the point behind the devm_ (device managed) resouce allocation is not to do the free explicitly, the kernel does that on behalf of the driver.
Quoted 16 lines
drivers/mmc/host/sdhci-mv.c line 149
Quoted 13 lines
drivers/mmc/host/sdhci-mv.c new file +12
-0+ +#if defined(CONFIG_HAVE_CLK ) + mv_host->clk = clk_get(&pdev->dev, NULL); + if (IS_ERR(mv_host->clk)) + dev_notice(&pdev->dev, "cannot get clkdev\n"); + else + clk_enable(mv_host->clk); +#endif + + ret = sdhci_add_host(host); + if (ret) + goto err_request;Likewise here, I think you should be iounmap()'ing the registers if this fails. Otherwise this looks good.
ditto
Quoted 1 line
Quoted 3 lines · saeed bishara
the point behind the
devm_(device managed) resouce allocation is not to do the free explicitly, the kernel does that on behalf of the driver.
Oops, sorry I missed that. I must have been hungry, it was near lunchtime.
Quoted 9 lines · On Tue, 22 Jun 2010 17:09:02 +0300 Saeed Bishara <[email protected]> wrote:
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
Signed-off-by Saeed Bishara <[email protected]>--- drivers/mmc/host/Kconfig | 12 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-mv.c | 243 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/sdhci-mv.c
Andrew, any reason this hasn't been picked up? (I noticed you weren't on the CC).
Quoted 13 lines · On Wed, 25 Aug 2010 23:39:58 +0100 Matt Fleming <[email protected]> wrote:
Quoted 9 lines · On Tue, 22 Jun 2010 17:09:02 +0300 Saeed Bishara <[email protected]> wrote:
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
Signed-off-by Saeed Bishara <[email protected]>--- drivers/mmc/host/Kconfig | 12 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-mv.c | 243 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 256 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/sdhci-mv.c
Quoted 1 line
Andrew, any reason this hasn't been picked up?
I must have been hungry, it was near lunchtime. :)
Quoted 1 line
(I noticed you weren't on the CC).
That too.
Chris Ball
AppliedHi Saeed,
Quoted 2 lines · Saeed Bishara
This patch implements the driver for the platfrom SDHCI controllers that found on some of Marvell's SoC's.
Applied to mmc-next with some minor language fixes, thanks.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child