mmc: support sdhci-pxav2.c
PATCH v3 2/4 mmc: support sdhci-pxav2.c
SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
--- drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-pxav2.c | 261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/sdhci-pxav2.c
drivers/mmc/host/Kconfig +11 -0
@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3 If unsure, say N. +config MMC_SDHCI_PXAV2 + tristate "Marvell PXAV2 SD Host Controller support" + select MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects the Marvell(R) PXAV2 SD Host Controller. + If you have a PXAV2 platform (such as pxa910) with SD Host Controller + and a card slot, say Y or M here. + + If unsure, say N. + config MMC_SDHCI_SPEAR tristate "SDHCI support on ST SPEAr platform" depends on MMC_SDHCI && PLAT_SPEAR
drivers/mmc/host/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) += mxs-mmc.o obj-$(CONFIG_MMC_SDHCI) += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o +obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.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-pxav2.c new file +261 -0
261 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 5 lines · Zhangfei Gao
SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>
Quoted 7 lines
--- drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-pxav2.c | 261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/host/sdhci-pxav2.c
PATCH v3 2/4 mmc: support sdhci-pxav2.c
In reply to Zhangfei GaoQuoted 242 lines · Zhangfei Gao
SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>---
drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-pxav2.c | 261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-)create mode 100644
drivers/mmc/host/sdhci-pxav2.cdrivers/mmc/host/Kconfig +11
-0@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3 If unsure, say N. +config MMC_SDHCI_PXAV2 + tristate "Marvell PXAV2 SD Host Controller support" + select MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects the Marvell(R) PXAV2 SD Host Controller. + If you have a PXAV2 platform (such as pxa910) with SD Host Controller + and a card slot, say Y or M here. + + If unsure, say N. +config
MMC_SDHCI_SPEARtristate "SDHCI support on ST SPEAr platform" depends on MMC_SDHCI && PLAT_SPEARdrivers/mmc/host/Makefile +0
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) += mxs-mmc.oobj-$(CONFIG_MMC_SDHCI) += sdhci.o
obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o
obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o
+obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o
obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
obj-$(CONFIG_MMC_WBSD) += wbsd.odrivers/mmc/host/sdhci-pxav2.c new file +190
-0@@ -0,0 +1,261 @@ +/* +* Copyright (C) 2010 Marvell International Ltd. +* Zhangfei Gao <[email protected]> +* Kevin Wang <[email protected]> +* Jun Nie <[email protected]> +* Qiming Wu <[email protected]> +* Philip Rakity <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> +#include <plat/sdhci.h> +#include <linux/slab.h> +#include "sdhci.h" +#include "sdhci-pltfm.h" + +#define SD_FIFO_PARAM 0xe0 +#define DIS_PAD_SD_CLK_GATE 0x0400/* Turn on/off Dynamic SD Clock Gating */ +#define CLK_GATE_ON 0x0200/* Disable/enable Clock Gate */ +#define CLK_GATE_CTL 0x0100/* Clock Gate Control */ +#define CLK_GATE_SETTING_BITS (DIS_PAD_SD_CLK_GATE | \ + CLK_GATE_ON | CLK_GATE_CTL) + +#define SD_CLOCK_BURST_SIZE_SETUP 0xe6 +#define SDCLK_SEL_SHIFT 8 +#define SDCLK_SEL_MASK 0x3 +#define SDCLK_DELAY_SHIFT 10 +#define SDCLK_DELAY_MASK 0x3c + +#define SDHCI_HOST_CONTROL 0x28 +#define SDHCI_CTRL_4BITBUS 0x02 + +#define SD_CE_ATA_2 0xea +#define MMC_CARD 0x1000 +#define MMC_WIDTH 0x0100 + +static void pxav2_set_private_registers (struct sdhci_host *host,u8 mask) +{ +struct platform_device *pdev =to_platform_device (mmc_dev (host->mmc)); +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + +if (mask ==SDHCI_RESET_ALL ) { +u16 tmp =0 ; + +/* +* tune timing of read data/command when crc error happen +* no performance impact +*/ +if (pdata->clk_delay_sel ==1 ) { + tmp =readw (host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + + tmp &= ~(SDCLK_DELAY_MASK <<SDCLK_DELAY_SHIFT ); + tmp |= (pdata->clk_delay_cycles &SDCLK_DELAY_MASK ) + <<SDCLK_DELAY_SHIFT ; + tmp &= ~(SDCLK_SEL_MASK <<SDCLK_SEL_SHIFT ); + tmp |= (1 &SDCLK_SEL_MASK ) <<SDCLK_SEL_SHIFT ; + +writew (tmp, host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + } + +if (pdata->flags &PXA_FLAG_ENABLE_CLOCK_GATING ) { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + }else { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; + tmp |=CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + } + } +} + +static int pxav2_mmc_set_width (struct sdhci_host *host,int width) +{ +u8 ctrl; +u16 tmp; + + ctrl =readb (host->ioaddr +SDHCI_HOST_CONTROL ); + tmp =readw (host->ioaddr +SD_CE_ATA_2 ); +if (width ==MMC_BUS_WIDTH_8 ) { + ctrl &= ~SDHCI_CTRL_4BITBUS ; + tmp |=MMC_CARD |MMC_WIDTH ; + }else { + tmp &= ~(MMC_CARD |MMC_WIDTH ); +if (width ==MMC_BUS_WIDTH_4 ) + ctrl |=SDHCI_CTRL_4BITBUS ; +else + ctrl &= ~SDHCI_CTRL_4BITBUS ; + } +writew (tmp, host->ioaddr +SD_CE_ATA_2 ); +writeb (ctrl, host->ioaddr +SDHCI_HOST_CONTROL ); + +return 0 ; +} + +static unsigned int pxav2_get_ro (struct sdhci_host *host) +{ +/* Micro SD does not support write-protect feature */ +return 0 ; +} + +static u32 pxav2_get_max_clock (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); + +return clk_get_rate (pltfm_host->clk); +} + +static struct sdhci_ops pxav2_sdhci_ops = { + .get_ro = pxav2_get_ro, + .get_max_clock = pxav2_get_max_clock, + .platform_reset_exit = pxav2_set_private_registers, + .platform_8bit_width = pxav2_mmc_set_width, +}; + +static int __devinit sdhci_pxav2_probe (struct platform_device *pdev) +{ +struct sdhci_pltfm_host *pltfm_host; +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; +struct device *dev = &pdev->dev; +struct sdhci_host *host =NULL ; +struct sdhci_pxa *pxa =NULL ; +int ret; +struct clk *clk; + + pxa =kzalloc (sizeof (struct sdhci_pxa ),GFP_KERNEL ); +if (!pxa) +return -ENOMEM ; + + host =sdhci_pltfm_init (pdev,NULL ); +if (IS_ERR (host)) { +kfree (pxa); +return PTR_ERR (host); + } + pltfm_host =sdhci_priv (host); + pltfm_host->priv = pxa; + + clk =clk_get (dev,"PXA-SDHCLK" ); +if (IS_ERR (clk)) { +dev_err (dev,"failed to get io clock\n" ); + ret =PTR_ERR (clk); + goto err_clk_get; + } + pltfm_host->clk = clk; +clk_enable (clk); + + host->quirks =SDHCI_QUIRK_BROKEN_ADMA + |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL + |SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN ; + +if (pdata) { +if (pdata->flags &PXA_FLAG_CARD_PERMANENT ) { +/* on-chip device */ + host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + host->mmc->caps |=MMC_CAP_NONREMOVABLE ; + } + +/* If slot design supports 8 bit data, indicate this to MMC. */ +if (pdata->flags &PXA_FLAG_SD_8_BIT_CAPABLE_SLOT ) + host->mmc->caps |=MMC_CAP_8_BIT_DATA ; + +if (pdata->quirks) + host->quirks |= pdata->quirks; +if (pdata->host_caps) + host->mmc->caps |= pdata->host_caps; +if (pdata->pm_caps) + host->mmc->pm_caps |= pdata->pm_caps; + } + + host->ops = &pxav2_sdhci_ops; + + ret =sdhci_add_host (host); +if (ret) {
drivers/mmc/host/sdhci-pxav2.c line 200
Quoted 10 lines
drivers/mmc/host/sdhci-pxav2.c new file +10
-0+dev_err (&pdev->dev,"failed to add host\n" ); + goto err_add_host; + } + +if (pdata && pdata->max_speed) { + host->mmc->f_max = pdata->max_speed; +if (!(host->mmc->f_max >25000000 )) + host->mmc->caps &= ~(MMC_CAP_SD_HIGHSPEED | +MMC_CAP_MMC_HIGHSPEED ); + }
This should be done before calling add_host. Add the callback to set f_max()
Quoted 33 lines
drivers/mmc/host/sdhci-pxav2.c new file +32
-0+ +platform_set_drvdata (pdev, host); + +return 0 ; + +err_add_host: +clk_disable (clk); +clk_put (clk); +err_clk_get: +sdhci_pltfm_free (pdev);+kfree (pxa); +return ret; +} + +static int __devexit sdhci_pxav2_remove(struct platform_device *pdev) +{ +struct sdhci_host *host =platform_get_drvdata (pdev); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_pxa *pxa = pltfm_host->priv; + +sdhci_remove_host (host,1 ); + +clk_disable (pltfm_host->clk); +clk_put (pltfm_host->clk); +sdhci_pltfm_free (pdev); +kfree (pxa); + +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static struct platform_driver sdhci_pxav2_driver = {
drivers/mmc/host/sdhci-pxav2.c line 243
Quoted 10 lines
drivers/mmc/host/sdhci-pxav2.c new file +10
-0+ .driver = { + .name = "sdhci-pxav2", + .owner = THIS_MODULE, + }, + .probe = sdhci_pxav2_probe, + .remove =__devexit_p (sdhci_pxav2_remove), +#ifdef CONFIG_PM + .suspend = sdhci_pltfm_suspend, + .resume = sdhci_pltfm_resume, +#endif
could you please post to mmc mailing list code that sets up sdhci-pxav2.
Quoted 21 lines
drivers/mmc/host/sdhci-pxav2.c new file +18
-0+}; +static int __init sdhci_pxav2_init (void ) +{ +return platform_driver_register (&sdhci_pxav2_driver); +} + +static void __exit sdhci_pxav2_exit(void) +{ +platform_driver_unregister (&sdhci_pxav2_driver); +} + +module_init (sdhci_pxav2_init); +module_exit (sdhci_pxav2_exit); + +MODULE_DESCRIPTION ("SDHCI driver for pxav2" ); +MODULE_AUTHOR ("Marvell International Ltd." ); +MODULE_LICENSE ("GPL v2" ); +Signature · 1 line
1.7.0.4
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 98 lines · Philip Rakity
Quoted 94 lines · Zhangfei Gao
Quoted 91 lines
SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>---
drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-pxav2.c | 261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-)create mode 100644
drivers/mmc/host/sdhci-pxav2.cdrivers/mmc/host/Kconfig +11
-0@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3 If unsure, say N. +config MMC_SDHCI_PXAV2 + tristate "Marvell PXAV2 SD Host Controller support" + select MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects the Marvell(R) PXAV2 SD Host Controller. + If you have a PXAV2 platform (such as pxa910) with SD Host Controller + and a card slot, say Y or M here. + + If unsure, say N. +config
MMC_SDHCI_SPEARtristate "SDHCI support on ST SPEAr platform" depends on MMC_SDHCI && PLAT_SPEARdrivers/mmc/host/Makefile +0
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) += mxs-mmc.oobj-$(CONFIG_MMC_SDHCI) += sdhci.o
obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o
obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o
+obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o
obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
obj-$(CONFIG_MMC_WBSD) += wbsd.odrivers/mmc/host/sdhci-pxav2.c new file +38
-0@@ -0,0 +1,261 @@ +/* +* Copyright (C) 2010 Marvell International Ltd. +* Zhangfei Gao <[email protected]> +* Kevin Wang <[email protected]> +* Jun Nie <[email protected]> +* Qiming Wu <[email protected]> +* Philip Rakity <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> +#include <plat/sdhci.h> +#include <linux/slab.h> +#include "sdhci.h" +#include "sdhci-pltfm.h" + +#define SD_FIFO_PARAM 0xe0 +#define DIS_PAD_SD_CLK_GATE 0x0400/* Turn on/off Dynamic SD Clock Gating */ +#define CLK_GATE_ON 0x0200/* Disable/enable Clock Gate */ +#define CLK_GATE_CTL 0x0100/* Clock Gate Control */ +#define CLK_GATE_SETTING_BITS (DIS_PAD_SD_CLK_GATE | \ + CLK_GATE_ON | CLK_GATE_CTL)
Quoted 9 lines
Quoted 8 lines
drivers/mmc/host/sdhci-pxav2.c line 46
Quoted 8 lines
drivers/mmc/host/sdhci-pxav2.c new file +8
-0+ +#define SD_CLOCK_BURST_SIZE_SETUP 0xe6 +#define SDCLK_SEL_SHIFT 8 +#define SDCLK_SEL_MASK 0x3 +#define SDCLK_DELAY_SHIFT 10 +#define SDCLK_DELAY_MASK 0x3c + +#define SDHCI_HOST_CONTROL 0x28
This definition should come from the sdhci.h include file since it is part of the sd host controller spec.
Quoted 233 lines
.
Quoted 230 lines
Quoted 144 lines
drivers/mmc/host/sdhci-pxav2.c new file +144
-0+#define SDHCI_CTRL_4BITBUS 0x02 + +#define SD_CE_ATA_2 0xea +#define MMC_CARD 0x1000 +#define MMC_WIDTH 0x0100 + +static void pxav2_set_private_registers (struct sdhci_host *host,u8 mask) +{ +struct platform_device *pdev =to_platform_device (mmc_dev (host->mmc)); +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + +if (mask ==SDHCI_RESET_ALL ) { +u16 tmp =0 ; + +/* +* tune timing of read data/command when crc error happen +* no performance impact +*/ +if (pdata->clk_delay_sel ==1 ) { + tmp =readw (host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + + tmp &= ~(SDCLK_DELAY_MASK <<SDCLK_DELAY_SHIFT ); + tmp |= (pdata->clk_delay_cycles &SDCLK_DELAY_MASK ) + <<SDCLK_DELAY_SHIFT ; + tmp &= ~(SDCLK_SEL_MASK <<SDCLK_SEL_SHIFT ); + tmp |= (1 &SDCLK_SEL_MASK ) <<SDCLK_SEL_SHIFT ; + +writew (tmp, host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + } + +if (pdata->flags &PXA_FLAG_ENABLE_CLOCK_GATING ) { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + }else { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; + tmp |=CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + } + } +} + +static int pxav2_mmc_set_width (struct sdhci_host *host,int width) +{ +u8 ctrl; +u16 tmp; + + ctrl =readb (host->ioaddr +SDHCI_HOST_CONTROL ); + tmp =readw (host->ioaddr +SD_CE_ATA_2 ); +if (width ==MMC_BUS_WIDTH_8 ) { + ctrl &= ~SDHCI_CTRL_4BITBUS ; + tmp |=MMC_CARD |MMC_WIDTH ; + }else { + tmp &= ~(MMC_CARD |MMC_WIDTH ); +if (width ==MMC_BUS_WIDTH_4 ) + ctrl |=SDHCI_CTRL_4BITBUS ; +else + ctrl &= ~SDHCI_CTRL_4BITBUS ; + } +writew (tmp, host->ioaddr +SD_CE_ATA_2 ); +writeb (ctrl, host->ioaddr +SDHCI_HOST_CONTROL ); + +return 0 ; +} + +static unsigned int pxav2_get_ro (struct sdhci_host *host) +{ +/* Micro SD does not support write-protect feature */ +return 0 ; +} + +static u32 pxav2_get_max_clock (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); + +return clk_get_rate (pltfm_host->clk); +} + +static struct sdhci_ops pxav2_sdhci_ops = { + .get_ro = pxav2_get_ro, + .get_max_clock = pxav2_get_max_clock, + .platform_reset_exit = pxav2_set_private_registers, + .platform_8bit_width = pxav2_mmc_set_width, +}; + +static int __devinit sdhci_pxav2_probe (struct platform_device *pdev) +{ +struct sdhci_pltfm_host *pltfm_host; +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; +struct device *dev = &pdev->dev; +struct sdhci_host *host =NULL ; +struct sdhci_pxa *pxa =NULL ; +int ret; +struct clk *clk; + + pxa =kzalloc (sizeof (struct sdhci_pxa ),GFP_KERNEL ); +if (!pxa) +return -ENOMEM ; + + host =sdhci_pltfm_init (pdev,NULL ); +if (IS_ERR (host)) { +kfree (pxa); +return PTR_ERR (host); + } + pltfm_host =sdhci_priv (host); + pltfm_host->priv = pxa; + + clk =clk_get (dev,"PXA-SDHCLK" ); +if (IS_ERR (clk)) { +dev_err (dev,"failed to get io clock\n" ); + ret =PTR_ERR (clk); + goto err_clk_get; + } + pltfm_host->clk = clk; +clk_enable (clk); + + host->quirks =SDHCI_QUIRK_BROKEN_ADMA + |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL + |SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN ; + +if (pdata) { +if (pdata->flags &PXA_FLAG_CARD_PERMANENT ) { +/* on-chip device */ + host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + host->mmc->caps |=MMC_CAP_NONREMOVABLE ; + } + +/* If slot design supports 8 bit data, indicate this to MMC. */ +if (pdata->flags &PXA_FLAG_SD_8_BIT_CAPABLE_SLOT ) + host->mmc->caps |=MMC_CAP_8_BIT_DATA ; + +if (pdata->quirks) + host->quirks |= pdata->quirks; +if (pdata->host_caps) + host->mmc->caps |= pdata->host_caps; +if (pdata->pm_caps) + host->mmc->pm_caps |= pdata->pm_caps; + } + + host->ops = &pxav2_sdhci_ops; + + ret =sdhci_add_host (host); +if (ret) {drivers/mmc/host/sdhci-pxav2.c line 200
Quoted 10 lines
drivers/mmc/host/sdhci-pxav2.c new file +10
-0+dev_err (&pdev->dev,"failed to add host\n" ); + goto err_add_host; + } + +if (pdata && pdata->max_speed) { + host->mmc->f_max = pdata->max_speed; +if (!(host->mmc->f_max >25000000 )) + host->mmc->caps &= ~(MMC_CAP_SD_HIGHSPEED | +MMC_CAP_MMC_HIGHSPEED ); + }This should be done before calling
add_host. Add the callback to setf_max()Quoted 33 lines
drivers/mmc/host/sdhci-pxav2.c new file +32
-0+ +platform_set_drvdata (pdev, host); + +return 0 ; + +err_add_host: +clk_disable (clk); +clk_put (clk); +err_clk_get: +sdhci_pltfm_free (pdev);+kfree (pxa); +return ret; +} + +static int __devexit sdhci_pxav2_remove(struct platform_device *pdev) +{ +struct sdhci_host *host =platform_get_drvdata (pdev); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_pxa *pxa = pltfm_host->priv; + +sdhci_remove_host (host,1 ); + +clk_disable (pltfm_host->clk); +clk_put (pltfm_host->clk); +sdhci_pltfm_free (pdev); +kfree (pxa); + +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static struct platform_driver sdhci_pxav2_driver = {drivers/mmc/host/sdhci-pxav2.c line 243
Quoted 10 lines
drivers/mmc/host/sdhci-pxav2.c new file +10
-0+ .driver = { + .name = "sdhci-pxav2", + .owner = THIS_MODULE, + }, + .probe = sdhci_pxav2_probe, + .remove =__devexit_p (sdhci_pxav2_remove), +#ifdef CONFIG_PM + .suspend = sdhci_pltfm_suspend, + .resume = sdhci_pltfm_resume, +#endifcould you please post to mmc mailing list code that sets up sdhci-pxav2.
Quoted 21 lines
drivers/mmc/host/sdhci-pxav2.c new file +18
-0+}; +static int __init sdhci_pxav2_init (void ) +{ +return platform_driver_register (&sdhci_pxav2_driver); +} + +static void __exit sdhci_pxav2_exit(void) +{ +platform_driver_unregister (&sdhci_pxav2_driver); +} + +module_init (sdhci_pxav2_init); +module_exit (sdhci_pxav2_exit); + +MODULE_DESCRIPTION ("SDHCI driver for pxav2" ); +MODULE_AUTHOR ("Marvell International Ltd." ); +MODULE_LICENSE ("GPL v2" ); +Signature · 1 line
1.7.0.4
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 109 lines · Philip Rakity
Quoted 98 lines · Philip Rakity
Quoted 94 lines · Zhangfei Gao
Quoted 91 lines
? ? SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>---
drivers/mmc/host/Kconfig ? ? ? | ? 11 ++ drivers/mmc/host/Makefile ? ? ?| ? ?1 + drivers/mmc/host/sdhci-pxav2.c | ?261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-)create mode 100644
drivers/mmc/host/sdhci-pxav2.cdrivers/mmc/host/Kconfig +0
-0@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3? ? ? If unsure, say N.
drivers/mmc/host/Kconfig +11
-0+config MMC_SDHCI_PXAV2 + ? tristate "Marvell PXAV2 SD Host Controller support" + ? select MMC_SDHCI + ? select MMC_SDHCI_PLTFM + ? help + ? ? This selects the Marvell(R) PXAV2 SD Host Controller. + ? ? If you have a PXAV2 platform (such as pxa910) with SD Host Controller + ? ? and a card slot, say Y or M here. + + ? ? If unsure, say N. +config
MMC_SDHCI_SPEAR
? ? tristate "SDHCI support on ST SPEAr platform"
? ? depends onMMC_SDHCI&&PLAT_SPEARdrivers/mmc/host/Makefile +0
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) ? ? ? ? ? ? += mxs-mmc.oobj-$(CONFIG_MMC_SDHCI) ? ? ? ? ? ? += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o obj-$(CONFIG_MMC_SDHCI_PXAV3) ? ? ? += sdhci-pxav3.o +obj-$(CONFIG_MMC_SDHCI_PXAV2) ? ? ?+= sdhci-pxav2.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-pxav2.c new file +38
-0@@ -0,0 +1,261 @@ +/* +* Copyright (C) 2010 Marvell International Ltd. +* ? ? ? ? Zhangfei Gao <[email protected]> +* ? ? ? ? Kevin Wang <[email protected]> +* ? ? ? ? Jun Nie <[email protected]> +* ? ? ? ? Qiming Wu <[email protected]> +* ? ? ? ? Philip Rakity <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the +* GNU General Public License for more details. +* +*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> +#include <plat/sdhci.h> +#include <linux/slab.h> +#include "sdhci.h" +#include "sdhci-pltfm.h" + +#define SD_FIFO_PARAM ? ? ? ? ? ? ?0xe0 +#define DIS_PAD_SD_CLK_GATE ? ? ? ?0x0400/* Turn on/off Dynamic SD Clock Gating */ +#define CLK_GATE_ON ? ? ? ? ? ? ? ?0x0200/* Disable/enable Clock Gate */ +#define CLK_GATE_CTL ? ? ? ? ? ? ? 0x0100/* Clock Gate Control */ +#define CLK_GATE_SETTING_BITS ? ? ?(DIS_PAD_SD_CLK_GATE | \ + ? ? ? ? ? CLK_GATE_ON | CLK_GATE_CTL)Quoted 9 lines
Quoted 8 lines
drivers/mmc/host/sdhci-pxav2.c line 46
Quoted 8 lines
drivers/mmc/host/sdhci-pxav2.c new file +8
-0+ +#define SD_CLOCK_BURST_SIZE_SETUP ?0xe6 +#define SDCLK_SEL_SHIFT ? ? ? ? ? ?8 +#define SDCLK_SEL_MASK ? ? ? ? ? ? 0x3 +#define SDCLK_DELAY_SHIFT ?10 +#define SDCLK_DELAY_MASK ? 0x3c + +#define SDHCI_HOST_CONTROL 0x28
Quoted 1 line
This definition should come from the
sdhci.hinclude file since it is part of the sd host controller spec.
Thanks, will remove.
Quoted 160 lines
Quoted 160 lines
.
Quoted 157 lines
Quoted 144 lines
drivers/mmc/host/sdhci-pxav2.c new file +144
-0+#define ?SDHCI_CTRL_4BITBUS ? ? ? ?0x02 + +#define SD_CE_ATA_2 ? ? ? ? ? ? ? ?0xea +#define MMC_CARD ? ? ? ? ? 0x1000 +#define MMC_WIDTH ? ? ? ? ?0x0100 + +static void pxav2_set_private_registers(struct sdhci_host *host, u8 mask) +{ + ? struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); + ? struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + + ? if (mask == SDHCI_RESET_ALL) { + ? ? ? ? ? u16 tmp = 0; + + ? ? ? ? ? /* + ? ? ? ? ? ?* tune timing of read data/command when crc error happen + ? ? ? ? ? ?* no performance impact + ? ? ? ? ? ?*/ + ? ? ? ? ? if (pdata->clk_delay_sel == 1) { + ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); + + ? ? ? ? ? ? ? ? ? tmp &= ~(SDCLK_DELAY_MASK << SDCLK_DELAY_SHIFT); + ? ? ? ? ? ? ? ? ? tmp |= (pdata->clk_delay_cycles & SDCLK_DELAY_MASK) + ? ? ? ? ? ? ? ? ? ? ? ? ? << SDCLK_DELAY_SHIFT; + ? ? ? ? ? ? ? ? ? tmp &= ~(SDCLK_SEL_MASK << SDCLK_SEL_SHIFT); + ? ? ? ? ? ? ? ? ? tmp |= (1 & SDCLK_SEL_MASK) << SDCLK_SEL_SHIFT; + + ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); + ? ? ? ? ? } + + ? ? ? ? ? if (pdata->flags & PXA_FLAG_ENABLE_CLOCK_GATING) { + ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? ? ? ? tmp &= ~CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? } else { + ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? ? ? ? tmp &= ~CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? tmp |= CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? } + ? } +} + +static int pxav2_mmc_set_width(struct sdhci_host *host, int width) +{ + ? u8 ctrl; + ? u16 tmp; + + ? ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); + ? tmp = readw(host->ioaddr + SD_CE_ATA_2); + ? if (width == MMC_BUS_WIDTH_8) { + ? ? ? ? ? ctrl &= ~SDHCI_CTRL_4BITBUS; + ? ? ? ? ? tmp |= MMC_CARD | MMC_WIDTH; + ? } else { + ? ? ? ? ? tmp &= ~(MMC_CARD | MMC_WIDTH); + ? ? ? ? ? if (width == MMC_BUS_WIDTH_4) + ? ? ? ? ? ? ? ? ? ctrl |= SDHCI_CTRL_4BITBUS; + ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ctrl &= ~SDHCI_CTRL_4BITBUS; + ? } + ? writew(tmp, host->ioaddr + SD_CE_ATA_2); + ? writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); + + ? return 0; +} + +static unsigned int pxav2_get_ro(struct sdhci_host *host) +{ + ? /* Micro SD does not support write-protect feature */ + ? return 0; +} + +static u32 pxav2_get_max_clock(struct sdhci_host *host) +{ + ? struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + + ? return clk_get_rate(pltfm_host->clk); +} + +static struct sdhci_ops pxav2_sdhci_ops = { + ? .get_ro = pxav2_get_ro, + ? .get_max_clock = pxav2_get_max_clock, + ? .platform_reset_exit = pxav2_set_private_registers, + ? .platform_8bit_width = pxav2_mmc_set_width, +}; + +static int __devinit sdhci_pxav2_probe(struct platform_device *pdev) +{ + ? struct sdhci_pltfm_host *pltfm_host; + ? struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + ? struct device *dev = &pdev->dev; + ? struct sdhci_host *host = NULL; + ? struct sdhci_pxa *pxa = NULL; + ? int ret; + ? struct clk *clk; + + ? pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL); + ? if (!pxa) + ? ? ? ? ? return -ENOMEM; + + ? host = sdhci_pltfm_init(pdev, NULL); + ? if (IS_ERR(host)) { + ? ? ? ? ? kfree(pxa); + ? ? ? ? ? return PTR_ERR(host); + ? } + ? pltfm_host = sdhci_priv(host); + ? pltfm_host->priv = pxa; + + ? clk = clk_get(dev, "PXA-SDHCLK"); + ? if (IS_ERR(clk)) { + ? ? ? ? ? dev_err(dev, "failed to get io clock\n"); + ? ? ? ? ? ret = PTR_ERR(clk); + ? ? ? ? ? goto err_clk_get; + ? } + ? pltfm_host->clk = clk; + ? clk_enable(clk); + + ? host->quirks = SDHCI_QUIRK_BROKEN_ADMA + ? ? ? ? ? | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL + ? ? ? ? ? | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; + + ? if (pdata) { + ? ? ? ? ? if (pdata->flags & PXA_FLAG_CARD_PERMANENT) { + ? ? ? ? ? ? ? ? ? /* on-chip device */ + ? ? ? ? ? ? ? ? ? host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; + ? ? ? ? ? ? ? ? ? host->mmc->caps |= MMC_CAP_NONREMOVABLE; + ? ? ? ? ? } + + ? ? ? ? ? /* If slot design supports 8 bit data, indicate this to MMC. */ + ? ? ? ? ? if (pdata->flags & PXA_FLAG_SD_8_BIT_CAPABLE_SLOT) + ? ? ? ? ? ? ? ? ? host->mmc->caps |= MMC_CAP_8_BIT_DATA; + + ? ? ? ? ? if (pdata->quirks) + ? ? ? ? ? ? ? ? ? host->quirks |= pdata->quirks; + ? ? ? ? ? if (pdata->host_caps) + ? ? ? ? ? ? ? ? ? host->mmc->caps |= pdata->host_caps; + ? ? ? ? ? if (pdata->pm_caps) + ? ? ? ? ? ? ? ? ? host->mmc->pm_caps |= pdata->pm_caps; + ? } + + ? host->ops = &pxav2_sdhci_ops; + + ? ret = sdhci_add_host(host); + ? if (ret) {drivers/mmc/host/sdhci-pxav2.c line 200
Quoted 10 lines
drivers/mmc/host/sdhci-pxav2.c new file +10
-0+ ? ? ? ? ? dev_err(&pdev->dev, "failed to add host\n"); + ? ? ? ? ? goto err_add_host; + ? } + + ? if (pdata && pdata->max_speed) { + ? ? ? ? ? host->mmc->f_max = pdata->max_speed; + ? ? ? ? ? if (!(host->mmc->f_max > 25000000)) + ? ? ? ? ? ? ? ? ? host->mmc->caps &= ~(MMC_CAP_SD_HIGHSPEED | + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_CAP_MMC_HIGHSPEED); + ? }This should be done before calling
add_host. ?Add the callback to setf_max()
Quoted 1 line
Quoted 1 line
Quoted 1 line
This section is only for debug purpose, will be deleted as well as max_speed, which are not must.
It may be confused to provide both get_f_max_clock and get_max_clock.
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
drivers/mmc/host/sdhci-pxav2.c new file +36
-0+ + ? platform_set_drvdata(pdev, host); + + ? return 0; + +err_add_host: + ? clk_disable(clk); + ? clk_put(clk); +err_clk_get: + ? sdhci_pltfm_free(pdev);+ ? ? ? ?kfree(pxa); + ? return ret; +} + +static int __devexit sdhci_pxav2_remove(struct platform_device *pdev) +{ + ? struct sdhci_host *host = platform_get_drvdata(pdev); + ? struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + ? struct sdhci_pxa *pxa = pltfm_host->priv; + + ? sdhci_remove_host(host, 1); + + ? clk_disable(pltfm_host->clk); + ? clk_put(pltfm_host->clk); + ? sdhci_pltfm_free(pdev); + ? kfree(pxa); + + ? platform_set_drvdata(pdev, NULL); + + ? return 0; +} + +static struct platform_driver sdhci_pxav2_driver = { + ? .driver ? ? ? ? = { + ? ? ? ? ? .name ? = "sdhci-pxav2", + ? ? ? ? ? .owner ?= THIS_MODULE, + ? },
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/mmc/host/sdhci-pxav2.c line 243
Quoted 6 lines
+ ? .probe ? ? ? ? ?=
sdhci_pxav2_probe,
+ ? .remove ? ? ? ? =__devexit_p(sdhci_pxav2_remove),drivers/mmc/host/sdhci-pxav2.c new file +4
-0+#ifdef CONFIG_PM + ? .suspend ? ? ? ?= sdhci_pltfm_suspend, + ? .resume ? ? ? ? = sdhci_pltfm_resume, +#endif could you please post to mmc mailing list code that sets up sdhci-pxav2.
The test code on pxa910 and pxa921 are reusing Jun's patch. Jun will update the resource name accordingly.
Quoted 31 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/mmc/host/sdhci-pxav2.c new file +14
-0+}; +static int __init sdhci_pxav2_init (void ) +{ + ? return platform_driver_register(&sdhci_pxav2_driver); +} + +static void __exit sdhci_pxav2_exit(void) +{ + ? platform_driver_unregister(&sdhci_pxav2_driver); +} + +module_init (sdhci_pxav2_init); +module_exit (sdhci_pxav2_exit); +Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
drivers/mmc/host/sdhci-pxav2.c new file +4
-1+MODULE_DESCRIPTION ("SDHCI driver for pxav2" ); +MODULE_AUTHOR ("Marvell International Ltd." ); +MODULE_LICENSE ("GPL v2" ); + --1.7.0.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 2/4 mmc: support sdhci-pxav2.c
In reply to Zhangfei GaoQuoted 21 lines · Zhangfei Gao
SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>---
drivers/mmc/host/Kconfig | 11 ++ drivers/mmc/host/Makefile | 1 + drivers/mmc/host/sdhci-pxav2.c | 261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-)create mode 100644
drivers/mmc/host/sdhci-pxav2.cdrivers/mmc/host/Kconfig +1
-0@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3 If unsure, say N. +config MMC_SDHCI_PXAV2
drivers/mmc/host/Kconfig config MMC_SDHCI_PXAV3 · line 205
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ tristate "Marvell PXAV2 SD Host Controller support" + select MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects the Marvell(R) PXAV2 SD Host Controller. + If you have a PXAV2 platform (such as pxa910) with SD Host Controller + and a card slot, say Y or M here. + + If unsure, say N. +
The following might be a better approach. This way we preserve the existing SDHCI_PXA definition and allow users to see what CPU's are supported.
config MMC_SDHCI_PXA
Quoted 15 lines
drivers/mmc/host/Kconfig +0
-0tristate "Marvell MMP SD Host Controller support" depends on ARCH_MMP2 select MMC_SDHCI_PXAV3config
MMC_SDHCI_PXA168
tristate "Marvell PXA168 SD Host Controller support" depends onARCH_PXA
selectMMC_SDHCI_PXAV2config
MMC_SDHCI_PXA9XX
tristate "Marvell PXA910 SD Host Controller support" depends onARCH_PXA
selectMMC_SDHCI_PXAV3
Quoted 4 lines
config
MMC_SDHCI_MMP2
tristate "Marvell MMP SD Host Controller support" depends onARCH_MMP2
selectMMC_SDHCI_PXAV3
====
Quoted 285 lines
3config
MMC_SDHCI_SPEARtristate "SDHCI support on ST SPEAr platform" depends on MMC_SDHCI && PLAT_SPEARdrivers/mmc/host/Makefile +0
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) += mxs-mmc.oobj-$(CONFIG_MMC_SDHCI) += sdhci.o
obj-$(CONFIG_MMC_SDHCI_PCI) += sdhci-pci.o
obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o
+obj-$(CONFIG_MMC_SDHCI_PXAV2) += sdhci-pxav2.o
obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o
obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o
obj-$(CONFIG_MMC_WBSD) += wbsd.odrivers/mmc/host/sdhci-pxav2.c new file +261
-0@@ -0,0 +1,261 @@ +/* +* Copyright (C) 2010 Marvell International Ltd. +* Zhangfei Gao <[email protected]> +* Kevin Wang <[email protected]> +* Jun Nie <[email protected]> +* Qiming Wu <[email protected]> +* Philip Rakity <[email protected]> +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> +#include <plat/sdhci.h> +#include <linux/slab.h> +#include "sdhci.h" +#include "sdhci-pltfm.h" + +#define SD_FIFO_PARAM 0xe0 +#define DIS_PAD_SD_CLK_GATE 0x0400/* Turn on/off Dynamic SD Clock Gating */ +#define CLK_GATE_ON 0x0200/* Disable/enable Clock Gate */ +#define CLK_GATE_CTL 0x0100/* Clock Gate Control */ +#define CLK_GATE_SETTING_BITS (DIS_PAD_SD_CLK_GATE | \ + CLK_GATE_ON | CLK_GATE_CTL) + +#define SD_CLOCK_BURST_SIZE_SETUP 0xe6 +#define SDCLK_SEL_SHIFT 8 +#define SDCLK_SEL_MASK 0x3 +#define SDCLK_DELAY_SHIFT 10 +#define SDCLK_DELAY_MASK 0x3c + +#define SDHCI_HOST_CONTROL 0x28 +#define SDHCI_CTRL_4BITBUS 0x02 + +#define SD_CE_ATA_2 0xea +#define MMC_CARD 0x1000 +#define MMC_WIDTH 0x0100 + +static void pxav2_set_private_registers (struct sdhci_host *host,u8 mask) +{ +struct platform_device *pdev =to_platform_device (mmc_dev (host->mmc)); +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + +if (mask ==SDHCI_RESET_ALL ) { +u16 tmp =0 ; + +/* +* tune timing of read data/command when crc error happen +* no performance impact +*/ +if (pdata->clk_delay_sel ==1 ) { + tmp =readw (host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + + tmp &= ~(SDCLK_DELAY_MASK <<SDCLK_DELAY_SHIFT ); + tmp |= (pdata->clk_delay_cycles &SDCLK_DELAY_MASK ) + <<SDCLK_DELAY_SHIFT ; + tmp &= ~(SDCLK_SEL_MASK <<SDCLK_SEL_SHIFT ); + tmp |= (1 &SDCLK_SEL_MASK ) <<SDCLK_SEL_SHIFT ; + +writew (tmp, host->ioaddr +SD_CLOCK_BURST_SIZE_SETUP ); + } + +if (pdata->flags &PXA_FLAG_ENABLE_CLOCK_GATING ) { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + }else { + tmp =readw (host->ioaddr +SD_FIFO_PARAM ); + tmp &= ~CLK_GATE_SETTING_BITS ; + tmp |=CLK_GATE_SETTING_BITS ; +writew (tmp, host->ioaddr +SD_FIFO_PARAM ); + } + } +} + +static int pxav2_mmc_set_width (struct sdhci_host *host,int width) +{ +u8 ctrl; +u16 tmp; + + ctrl =readb (host->ioaddr +SDHCI_HOST_CONTROL ); + tmp =readw (host->ioaddr +SD_CE_ATA_2 ); +if (width ==MMC_BUS_WIDTH_8 ) { + ctrl &= ~SDHCI_CTRL_4BITBUS ; + tmp |=MMC_CARD |MMC_WIDTH ; + }else { + tmp &= ~(MMC_CARD |MMC_WIDTH ); +if (width ==MMC_BUS_WIDTH_4 ) + ctrl |=SDHCI_CTRL_4BITBUS ; +else + ctrl &= ~SDHCI_CTRL_4BITBUS ; + } +writew (tmp, host->ioaddr +SD_CE_ATA_2 ); +writeb (ctrl, host->ioaddr +SDHCI_HOST_CONTROL ); + +return 0 ; +} + +static unsigned int pxav2_get_ro (struct sdhci_host *host) +{ +/* Micro SD does not support write-protect feature */ +return 0 ; +} + +static u32 pxav2_get_max_clock (struct sdhci_host *host) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); + +return clk_get_rate (pltfm_host->clk); +} + +static struct sdhci_ops pxav2_sdhci_ops = { + .get_ro = pxav2_get_ro, + .get_max_clock = pxav2_get_max_clock, + .platform_reset_exit = pxav2_set_private_registers, + .platform_8bit_width = pxav2_mmc_set_width, +}; + +static int __devinit sdhci_pxav2_probe (struct platform_device *pdev) +{ +struct sdhci_pltfm_host *pltfm_host; +struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; +struct device *dev = &pdev->dev; +struct sdhci_host *host =NULL ; +struct sdhci_pxa *pxa =NULL ; +int ret; +struct clk *clk; + + pxa =kzalloc (sizeof (struct sdhci_pxa ),GFP_KERNEL ); +if (!pxa) +return -ENOMEM ; + + host =sdhci_pltfm_init (pdev,NULL ); +if (IS_ERR (host)) { +kfree (pxa); +return PTR_ERR (host); + } + pltfm_host =sdhci_priv (host); + pltfm_host->priv = pxa; + + clk =clk_get (dev,"PXA-SDHCLK" ); +if (IS_ERR (clk)) { +dev_err (dev,"failed to get io clock\n" ); + ret =PTR_ERR (clk); + goto err_clk_get; + } + pltfm_host->clk = clk; +clk_enable (clk); + + host->quirks =SDHCI_QUIRK_BROKEN_ADMA + |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL + |SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN ; + +if (pdata) { +if (pdata->flags &PXA_FLAG_CARD_PERMANENT ) { +/* on-chip device */ + host->quirks |=SDHCI_QUIRK_BROKEN_CARD_DETECTION ; + host->mmc->caps |=MMC_CAP_NONREMOVABLE ; + } + +/* If slot design supports 8 bit data, indicate this to MMC. */ +if (pdata->flags &PXA_FLAG_SD_8_BIT_CAPABLE_SLOT ) + host->mmc->caps |=MMC_CAP_8_BIT_DATA ; + +if (pdata->quirks) + host->quirks |= pdata->quirks; +if (pdata->host_caps) + host->mmc->caps |= pdata->host_caps; +if (pdata->pm_caps) + host->mmc->pm_caps |= pdata->pm_caps; + } + + host->ops = &pxav2_sdhci_ops; + + ret =sdhci_add_host (host); +if (ret) { +dev_err (&pdev->dev,"failed to add host\n" ); + goto err_add_host; + } + +if (pdata && pdata->max_speed) { + host->mmc->f_max = pdata->max_speed; +if (!(host->mmc->f_max >25000000 )) + host->mmc->caps &= ~(MMC_CAP_SD_HIGHSPEED | +MMC_CAP_MMC_HIGHSPEED ); + } + +platform_set_drvdata (pdev, host); + +return 0 ; + +err_add_host: +clk_disable (clk); +clk_put (clk); +err_clk_get: +sdhci_pltfm_free (pdev); +kfree (pxa); +return ret; +} + +static int __devexit sdhci_pxav2_remove(struct platform_device *pdev) +{ +struct sdhci_host *host =platform_get_drvdata (pdev); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +struct sdhci_pxa *pxa = pltfm_host->priv; + +sdhci_remove_host (host,1 ); + +clk_disable (pltfm_host->clk); +clk_put (pltfm_host->clk); +sdhci_pltfm_free (pdev); +kfree (pxa); + +platform_set_drvdata (pdev,NULL ); + +return 0 ; +} + +static struct platform_driver sdhci_pxav2_driver = { + .driver = { + .name ="sdhci-pxav2" , + .owner =THIS_MODULE , + }, + .probe = sdhci_pxav2_probe, + .remove =__devexit_p (sdhci_pxav2_remove), +#ifdef CONFIG_PM + .suspend = sdhci_pltfm_suspend, + .resume = sdhci_pltfm_resume, +#endif +}; +static int __init sdhci_pxav2_init (void ) +{ +return platform_driver_register (&sdhci_pxav2_driver); +} + +static void __exit sdhci_pxav2_exit(void) +{ +platform_driver_unregister (&sdhci_pxav2_driver); +} + +module_init (sdhci_pxav2_init); +module_exit (sdhci_pxav2_exit); + +MODULE_DESCRIPTION ("SDHCI driver for pxav2" ); +MODULE_AUTHOR ("Marvell International Ltd." ); +MODULE_LICENSE ("GPL v2" ); +Signature · 1 line
1.7.0.4
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 38 lines · Philip Rakity
Quoted 21 lines · Zhangfei Gao
? ? ? SDHCI driver for pxav2 SoCs, such as pxa910, the driver based on sdhci-pltfm to handle resource etc.
Signed-off-by Zhangfei Gao <[email protected]>Signed-off-by Jun Nie <[email protected]>Signed-off-by Qiming Wu <[email protected]>---
drivers/mmc/host/Kconfig ? ? ? | ? 11 ++ drivers/mmc/host/Makefile ? ? ?| ? ?1 + drivers/mmc/host/sdhci-pxav2.c | ?261 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 273 insertions(+), 0 deletions(-)create mode 100644
drivers/mmc/host/sdhci-pxav2.cdrivers/mmc/host/Kconfig +0
-0@@ -192,6 +192,17 @@ config MMC_SDHCI_PXAV3? ? ? ? If unsure, say N.
drivers/mmc/host/Kconfig +1
-0+config MMC_SDHCI_PXAV2drivers/mmc/host/Kconfig
Quoted 10 lines
drivers/mmc/host/Kconfig +10
-0+ ? ? tristate "Marvell PXAV2 SD Host Controller support" + ? ? select MMC_SDHCI + ? ? select MMC_SDHCI_PLTFM + ? ? help + ? ? ? This selects the Marvell(R) PXAV2 SD Host Controller. + ? ? ? If you have a PXAV2 platform (such as pxa910) with SD Host Controller + ? ? ? and a card slot, say Y or M here. + + ? ? ? If unsure, say N. +The following might be a better approach. ?This way we preserve the existing
SDHCI_PXAdefinition and allow users to see what CPU's are supported.
Quoted 21 lines
config
MMC_SDHCI_PXAQuoted 19 lines
? ? ? tristate "Marvell MMP SD Host Controller support" ? ? ? depends on
ARCH_MMP2
? ? ?selectMMC_SDHCI_PXAV3config
MMC_SDHCI_PXA168
? ? ? tristate "Marvell PXA168 SD Host Controller support" ? ? ? depends onARCH_PXA
? ? ?selectMMC_SDHCI_PXAV2config
MMC_SDHCI_PXA9XX
? ? ? tristate "Marvell PXA910 SD Host Controller support" ? ? ? depends onARCH_PXA
? ? ?selectMMC_SDHCI_PXAV3config
MMC_SDHCI_MMP2
? ? ? tristate "Marvell MMP SD Host Controller support" ? ? ? depends onARCH_MMP2
? ? ?selectMMC_SDHCI_PXAV3
Still prefer the original method, it is simple and no dependence.
Quoted 295 lines
====
Quoted 283 lines
3config
MMC_SDHCI_SPEAR
? ? ? tristate "SDHCI support on ST SPEAr platform" ? ? ? depends onMMC_SDHCI&&PLAT_SPEARdrivers/mmc/host/Makefile +0
-0@@ -10,6 +10,7 @@ obj-$(CONFIG_MMC_MXS) ? ? ? ? ? ? ? += mxs-mmc.oobj-$(CONFIG_MMC_SDHCI) ? ? ? ? ? ? ? += sdhci.o obj-$(CONFIG_MMC_SDHCI_PCI) ? += sdhci-pci.o obj-$(CONFIG_MMC_SDHCI_PXAV3) += sdhci-pxav3.o +obj-$(CONFIG_MMC_SDHCI_PXAV2) ? ? ? ?+= sdhci-pxav2.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-pxav2.c new file +261
-1@@ -0,0 +1,261 @@ +/* + * Copyright (C) 2010 Marvell International Ltd. + * ? ? ? ? ? Zhangfei Gao <[email protected]> + * ? ? ? ? ? Kevin Wang <[email protected]> + * ? ? ? ? ? Jun Nie <[email protected]> + * ? ? ? ? ? Qiming Wu <[email protected]> + * ? ? ? ? ? Philip Rakity <[email protected]> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the + * GNU General Public License for more details. + * + */ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/gpio.h> +#include <linux/mmc/card.h> +#include <linux/mmc/host.h> +#include <plat/sdhci.h> +#include <linux/slab.h> +#include "sdhci.h" +#include "sdhci-pltfm.h" + +#define SD_FIFO_PARAM ? ? ? ? ? ? ? ?0xe0 +#define DIS_PAD_SD_CLK_GATE ?0x0400 /* Turn on/off Dynamic SD Clock Gating */ +#define CLK_GATE_ON ? ? ? ? ?0x0200 /* Disable/enable Clock Gate */ +#define CLK_GATE_CTL ? ? ? ? 0x0100 /* Clock Gate Control */ +#define CLK_GATE_SETTING_BITS ? ? ? ?(DIS_PAD_SD_CLK_GATE | \ + ? ? ? ? ? ? CLK_GATE_ON | CLK_GATE_CTL) + +#define SD_CLOCK_BURST_SIZE_SETUP ? ?0xe6 +#define SDCLK_SEL_SHIFT ? ? ? ? ? ? ?8 +#define SDCLK_SEL_MASK ? ? ? ? ? ? ? 0x3 +#define SDCLK_DELAY_SHIFT ? ?10 +#define SDCLK_DELAY_MASK ? ? 0x3c + +#define SDHCI_HOST_CONTROL ? 0x28 +#define ?SDHCI_CTRL_4BITBUS ?0x02 + +#define SD_CE_ATA_2 ? ? ? ? ?0xea +#define MMC_CARD ? ? ? ? ? ? 0x1000 +#define MMC_WIDTH ? ? ? ? ? ?0x0100 + +static void pxav2_set_private_registers(struct sdhci_host *host, u8 mask) +{ + ? ? struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc)); + ? ? struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + + ? ? if (mask == SDHCI_RESET_ALL) { + ? ? ? ? ? ? u16 tmp = 0; + + ? ? ? ? ? ? /* + ? ? ? ? ? ? ?* tune timing of read data/command when crc error happen + ? ? ? ? ? ? ?* no performance impact + ? ? ? ? ? ? ?*/ + ? ? ? ? ? ? if (pdata->clk_delay_sel == 1) { + ? ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); + + ? ? ? ? ? ? ? ? ? ? tmp &= ~(SDCLK_DELAY_MASK << SDCLK_DELAY_SHIFT); + ? ? ? ? ? ? ? ? ? ? tmp |= (pdata->clk_delay_cycles & SDCLK_DELAY_MASK) + ? ? ? ? ? ? ? ? ? ? ? ? ? ? << SDCLK_DELAY_SHIFT; + ? ? ? ? ? ? ? ? ? ? tmp &= ~(SDCLK_SEL_MASK << SDCLK_SEL_SHIFT); + ? ? ? ? ? ? ? ? ? ? tmp |= (1 & SDCLK_SEL_MASK) << SDCLK_SEL_SHIFT; + + ? ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_CLOCK_BURST_SIZE_SETUP); + ? ? ? ? ? ? } + + ? ? ? ? ? ? if (pdata->flags & PXA_FLAG_ENABLE_CLOCK_GATING) { + ? ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? ? ? ? ? tmp &= ~CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? } else { + ? ? ? ? ? ? ? ? ? ? tmp = readw(host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? ? ? ? ? tmp &= ~CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? ? tmp |= CLK_GATE_SETTING_BITS; + ? ? ? ? ? ? ? ? ? ? writew(tmp, host->ioaddr + SD_FIFO_PARAM); + ? ? ? ? ? ? } + ? ? } +} + +static int pxav2_mmc_set_width(struct sdhci_host *host, int width) +{ + ? ? u8 ctrl; + ? ? u16 tmp; + + ? ? ctrl = readb(host->ioaddr + SDHCI_HOST_CONTROL); + ? ? tmp = readw(host->ioaddr + SD_CE_ATA_2); + ? ? if (width == MMC_BUS_WIDTH_8) { + ? ? ? ? ? ? ctrl &= ~SDHCI_CTRL_4BITBUS; + ? ? ? ? ? ? tmp |= MMC_CARD | MMC_WIDTH; + ? ? } else { + ? ? ? ? ? ? tmp &= ~(MMC_CARD | MMC_WIDTH); + ? ? ? ? ? ? if (width == MMC_BUS_WIDTH_4) + ? ? ? ? ? ? ? ? ? ? ctrl |= SDHCI_CTRL_4BITBUS; + ? ? ? ? ? ? else + ? ? ? ? ? ? ? ? ? ? ctrl &= ~SDHCI_CTRL_4BITBUS; + ? ? } + ? ? writew(tmp, host->ioaddr + SD_CE_ATA_2); + ? ? writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); + + ? ? return 0; +} + +static unsigned int pxav2_get_ro(struct sdhci_host *host) +{ + ? ? /* Micro SD does not support write-protect feature */ + ? ? return 0; +} + +static u32 pxav2_get_max_clock(struct sdhci_host *host) +{ + ? ? struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + + ? ? return clk_get_rate(pltfm_host->clk); +} + +static struct sdhci_ops pxav2_sdhci_ops = { + ? ? .get_ro = pxav2_get_ro, + ? ? .get_max_clock = pxav2_get_max_clock, + ? ? .platform_reset_exit = pxav2_set_private_registers, + ? ? .platform_8bit_width = pxav2_mmc_set_width, +}; + +static int __devinit sdhci_pxav2_probe(struct platform_device *pdev) +{ + ? ? struct sdhci_pltfm_host *pltfm_host; + ? ? struct sdhci_pxa_platdata *pdata = pdev->dev.platform_data; + ? ? struct device *dev = &pdev->dev; + ? ? struct sdhci_host *host = NULL; + ? ? struct sdhci_pxa *pxa = NULL; + ? ? int ret; + ? ? struct clk *clk; + + ? ? pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL); + ? ? if (!pxa) + ? ? ? ? ? ? return -ENOMEM; + + ? ? host = sdhci_pltfm_init(pdev, NULL); + ? ? if (IS_ERR(host)) { + ? ? ? ? ? ? kfree(pxa); + ? ? ? ? ? ? return PTR_ERR(host); + ? ? } + ? ? pltfm_host = sdhci_priv(host); + ? ? pltfm_host->priv = pxa; + + ? ? clk = clk_get(dev, "PXA-SDHCLK"); + ? ? if (IS_ERR(clk)) { + ? ? ? ? ? ? dev_err(dev, "failed to get io clock\n"); + ? ? ? ? ? ? ret = PTR_ERR(clk); + ? ? ? ? ? ? goto err_clk_get; + ? ? } + ? ? pltfm_host->clk = clk; + ? ? clk_enable(clk); + + ? ? host->quirks = SDHCI_QUIRK_BROKEN_ADMA + ? ? ? ? ? ? | SDHCI_QUIRK_BROKEN_TIMEOUT_VAL + ? ? ? ? ? ? | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN; + + ? ? if (pdata) { + ? ? ? ? ? ? if (pdata->flags & PXA_FLAG_CARD_PERMANENT) { + ? ? ? ? ? ? ? ? ? ? /* on-chip device */ + ? ? ? ? ? ? ? ? ? ? host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION; + ? ? ? ? ? ? ? ? ? ? host->mmc->caps |= MMC_CAP_NONREMOVABLE; + ? ? ? ? ? ? } + + ? ? ? ? ? ? /* If slot design supports 8 bit data, indicate this to MMC. */ + ? ? ? ? ? ? if (pdata->flags & PXA_FLAG_SD_8_BIT_CAPABLE_SLOT) + ? ? ? ? ? ? ? ? ? ? host->mmc->caps |= MMC_CAP_8_BIT_DATA; + + ? ? ? ? ? ? if (pdata->quirks) + ? ? ? ? ? ? ? ? ? ? host->quirks |= pdata->quirks; + ? ? ? ? ? ? if (pdata->host_caps) + ? ? ? ? ? ? ? ? ? ? host->mmc->caps |= pdata->host_caps; + ? ? ? ? ? ? if (pdata->pm_caps) + ? ? ? ? ? ? ? ? ? ? host->mmc->pm_caps |= pdata->pm_caps; + ? ? } + + ? ? host->ops = &pxav2_sdhci_ops; + + ? ? ret = sdhci_add_host(host); + ? ? if (ret) { + ? ? ? ? ? ? dev_err(&pdev->dev, "failed to add host\n"); + ? ? ? ? ? ? goto err_add_host; + ? ? } + + ? ? if (pdata && pdata->max_speed) { + ? ? ? ? ? ? host->mmc->f_max = pdata->max_speed; + ? ? ? ? ? ? if (!(host->mmc->f_max > 25000000)) + ? ? ? ? ? ? ? ? ? ? host->mmc->caps &= ~(MMC_CAP_SD_HIGHSPEED | + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MMC_CAP_MMC_HIGHSPEED); + ? ? } + + ? ? platform_set_drvdata(pdev, host); + + ? ? return 0; + +err_add_host: + ? ? clk_disable(clk); + ? ? clk_put(clk); +err_clk_get: + ? ? sdhci_pltfm_free(pdev); + ? ? kfree(pxa); + ? ? return ret; +} + +static int __devexit sdhci_pxav2_remove(struct platform_device *pdev) +{ + ? ? struct sdhci_host *host = platform_get_drvdata(pdev); + ? ? struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + ? ? struct sdhci_pxa *pxa = pltfm_host->priv; + + ? ? sdhci_remove_host(host, 1); + + ? ? clk_disable(pltfm_host->clk); + ? ? clk_put(pltfm_host->clk); + ? ? sdhci_pltfm_free(pdev); + ? ? kfree(pxa); + + ? ? platform_set_drvdata(pdev, NULL); + + ? ? return 0; +} + +static struct platform_driver sdhci_pxav2_driver = { + ? ? .driver ? ? ? ? = { + ? ? ? ? ? ? .name ? = "sdhci-pxav2", + ? ? ? ? ? ? .owner ?= THIS_MODULE, + ? ? }, + ? ? .probe ? ? ? ? ?= sdhci_pxav2_probe, + ? ? .remove ? ? ? ? = __devexit_p(sdhci_pxav2_remove), +#ifdef CONFIG_PM + ? ? .suspend ? ? ? ?= sdhci_pltfm_suspend, + ? ? .resume ? ? ? ? = sdhci_pltfm_resume, +#endif +}; +static int __init sdhci_pxav2_init(void) +{ + ? ? return platform_driver_register(&sdhci_pxav2_driver); +} + +static void __exit sdhci_pxav2_exit(void) +{ + ? ? platform_driver_unregister(&sdhci_pxav2_driver); +} + +module_init(sdhci_pxav2_init); +module_exit(sdhci_pxav2_exit); + +MODULE_DESCRIPTION("SDHCI driver for pxav2"); +MODULE_AUTHOR("Marvell International Ltd."); +MODULE_LICENSE("GPL v2"); + --Quoted 2 lines
1.7.0.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 31 lines · On Tuesday 07 June 2011 08:08:27 zhangfei gao wrote:
Quoted 31 lines
drivers/mmc/host/Kconfig config MMC_SDHCI_PXAV3 · line 205
Quoted 11 lines
drivers/mmc/host/Kconfig +11
-0+config MMC_SDHCI_PXAV2 + tristate "Marvell PXAV2 SD Host Controller support" + select MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects the Marvell(R) PXAV2 SD Host Controller. + If you have a PXAV2 platform (such as pxa910) with SD Host Controller + and a card slot, say Y or M here. + + If unsure, say N. +The following might be a better approach. This way we preserve the existing
SDHCI_PXAdefinition and allow users to see what CPU's are supported.config
MMC_SDHCI_PXAQuoted 15 lines
tristate "Marvell MMP SD Host Controller support" depends on
ARCH_MMP2
selectMMC_SDHCI_PXAV3config
MMC_SDHCI_PXA168
tristate "Marvell PXA168 SD Host Controller support" depends onARCH_PXA
selectMMC_SDHCI_PXAV2config
MMC_SDHCI_PXA9XX
tristate "Marvell PXA910 SD Host Controller support" depends onARCH_PXA
selectMMC_SDHCI_PXAV3
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
config
MMC_SDHCI_MMP2
tristate "Marvell MMP SD Host Controller support" depends onARCH_MMP2
selectMMC_SDHCI_PXAV3Still prefer the original method, it is simple and no dependence.
Quoted 1 line
How about changing the title of the option though? A user will usually not know if he is using the v2 or v3 controller without reading the help text. If you change it to
config MMC_SDHCI_PXAV2
tristate "Marvell PXA168 SD Host Controller support (PXAV2)" default CPU_PXA168
config MMC_SDHCI_PXAV3
tristate "Marvell MMP2/PX9XX SD Host Controller support (PXAV3)" default CPU_MMP2 || CPU_PXA910
you increase the chances of users getting the configuration right.
Arnd
BTW, both of you: Please always remove the lines that you don't refer to when you reply to an email. It's very annoying having to scroll through dozens of lines of citations to see what you are actually writing.
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 4 lines
How about changing the title of the option though? A user will usually not know if he is using the v2 or v3 controller without reading the help text. If you change it to
Quoted 8 lines
config
MMC_SDHCI_PXAV2
? ? ? ?tristate "Marvell PXA168 SD Host Controller support (PXAV2)" ? ? ? ?defaultCPU_PXA168config
MMC_SDHCI_PXAV3
? ? ? ?tristate "Marvell MMP2/PX9XX SD Host Controller support (PXAV3)" ? ? ? ?defaultCPU_MMP2||CPU_PXA910
Yeah, the above is much cleaner/simpler.
Quoted 8 lines
you increase the chances of users getting the configuration right.
? ? ? ?Arnd
BTW, both of you: Please always remove the lines that you don't refer to when you reply to an email. It's very annoying having to scroll through dozens of lines of citations to see what you are actually writing.
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 7 lines · Eric Miao
Quoted 7 lines
How about changing the title of the option though? A user will usually not know if he is using the v2 or v3 controller without reading the help text. If you change it to
config
MMC_SDHCI_PXAV2
tristate "Marvell PXA168 SD Host Controller support (PXAV2)" defaultCPU_PXA168
change to
Quoted 1 line
Quoted 1 line
tristate "Marvell PXA9xx SD Host Controller support (PXAV2)"
the pxa168 will not work in all cases with the V2 code. It needs IO_ACCESSORS for readw and a callback to sdhci.c to delay then time between transfers. Once V2 code is mainline I will resubmit the pxa168 code.
Quoted 16 lines
Quoted 5 lines
config
MMC_SDHCI_PXAV3
tristate "Marvell MMP2/PX9XX SD Host Controller support (PXAV3)" defaultCPU_MMP2||CPU_PXA910Yeah, the above is much cleaner/simpler.
Quoted 8 lines
you increase the chances of users getting the configuration right.
Arnd
BTW, both of you: Please always remove the lines that you don't refer to when you reply to an email. It's very annoying having to scroll through dozens of lines of citations to see what you are actually writing.
PATCH v3 2/4 mmc: support sdhci-pxav2.c
Quoted 11 lines · Philip Rakity
Quoted 7 lines · Eric Miao
Quoted 7 lines
How about changing the title of the option though? A user will usually not know if he is using the v2 or v3 controller without reading the help text. If you change it to
config
MMC_SDHCI_PXAV2
? ? ? ?tristate "Marvell PXA168 SD Host Controller support (PXAV2)" ? ? ? ?defaultCPU_PXA168
Quoted 20 lines
change to
Quoted 1 line
Quoted 1 line
? ? ? ?tristate "Marvell PXA9xx SD Host Controller support (PXAV2)"
the pxa168 will not work in all cases with the V2 code. ?It needs
IO_ACCESSORSfor readw and a callback tosdhci.cto delay then time between transfers. ?Once V2 code is mainline I will resubmit the pxa168 code.Quoted 12 lines
Quoted 5 lines
config
MMC_SDHCI_PXAV3
? ? ? ?tristate "Marvell MMP2/PX9XX SD Host Controller support (PXAV3)" ? ? ? ?defaultCPU_MMP2||CPU_PXA910Yeah, the above is much cleaner/simpler.
Quoted 4 lines
you increase the chances of users getting the configuration right.
? ? ? ?Arnd
Thanks for good suggestion. Will update to v4.