Consolidate sdhci pltfm & OF drivers and get them self registered
Subsystems (7)
v2 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Here are what the patch set does.
* Remove .probe and .remove hooks from sdhci-pltfm.c and make it be a pure common helper function providers.
* Add .probe and .remove hooks for sdhci pltfm drivers sdhci-cns3xxx, sdhci-dove, sdhci-tegra, and sdhci-esdhc-imx to make them self registered with calling helper functions created above.
* Migrate the use of sdhci_of_host and sdhci_of_data to sdhci_pltfm_host and sdhci_pltfm_data, so that OF version host and data structure works can be saved, and pltfm version works for both cases.
* Add OF common helper stuff into sdhci-pltfm.c, and make OF version sdhci drivers sdhci-of-esdhc and sdhci-of-hlwd become self registered as well, so that sdhci-of-core.c and sdhci-of.h can be removed.
* Consolidate the OF and pltfm esdhc drivers into one with sharing the same pair of .probe and .remove hooks.
* Eliminate include/linux/mmc/sdhci-pltfm.h with moving stuff into drivers/mmc/host/sdhci-pltfm.h.
And the benefits we gain from the changes are:
* Get the sdhci device driver follow the Linux trend that driver makes the registration by its own.
* sdhci-pltfm.c becomes simple and clean as it only has common helper stuff there now.
* All sdhci device specific things are going back its own driver.
* The dt and non-dt drivers are consolidated to use the same pair of .probe and .remove hooks.
* SDHCI driver for Freescale eSDHC controller found on both MPCxxx and i.MX platforms is consolidated to use the same one .probe function.
It was only tested on i.mx51 babbage board, all other targets were build tested. Tested-by, Reviwed-by, and Acked-by are much appreciated.
I attempt to get patch #1 ~ #6 go through Chris' tree, while the #7 through Sascha's tree.
Regards,
Shawn
Changes since v1:
* Rebase on cjb's mmc-next tree
* Introduce helper function pair sdhci_pltfm_register and sdhci_pltfm_unregister
* Eliminate variable 'scratch' in .remove hook to make the code look simple
* Return ERR_PTR in sdhci_pltfm_init and use IS_ERR/PTR_ERR to check return value in .probe hooks
* Correct MODULE_AUTHOR statement
* Split esdhc conlidation patch to ease reviewing
Shawn Guo (7):
mmc: sdhci: make sdhci-pltfm device drivers self registered
mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
mmc: sdhci: make sdhci-of device drivers self registered
sdhci: rename sdhci-esdhc-imx.c to sdhci-esdhc.c
mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
mmc: sdhci: merge two sdhci-pltfm.h into one
ARM: mxc: remove esdhc.h and use the public one
.../plat-mxc/devices/platform-sdhci-esdhc-imx.c | 1 - arch/arm/plat-mxc/include/mach/devices-common.h | 2 +- drivers/mmc/host/Kconfig | 77 ++-- drivers/mmc/host/Makefile | 17 +- drivers/mmc/host/sdhci-cns3xxx.c | 43 ++- drivers/mmc/host/sdhci-dove.c | 42 ++- drivers/mmc/host/sdhci-esdhc-imx.c | 331 ----------- drivers/mmc/host/sdhci-esdhc.c | 580 ++++++++++++++++++++ drivers/mmc/host/sdhci-esdhc.h | 81 --- drivers/mmc/host/sdhci-of-core.c | 250 --------- drivers/mmc/host/sdhci-of-esdhc.c | 91 --- drivers/mmc/host/sdhci-of-hlwd.c | 66 ++- drivers/mmc/host/sdhci-of.h | 42 -- drivers/mmc/host/sdhci-pltfm.c | 259 +++++---- drivers/mmc/host/sdhci-pltfm.h | 39 ++- drivers/mmc/host/sdhci-tegra.c | 118 +++-- include/linux/mmc/esdhc.h | 27 + include/linux/mmc/sdhci-pltfm.h | 35 -- 18 files changed, 1048 insertions(+), 1053 deletions(-)
PATCH v2 1/7 mmc: sdhci: make sdhci-pltfm device drivers self registered
The patch turns the common stuff in sdhci-pltfm.c into functions, and add device drivers their own .probe and .remove which in turn call into the common functions, so that those sdhci-pltfm device drivers register itself and keep all device specific things away from common sdhci-pltfm file.
--- drivers/mmc/host/Kconfig | 32 ++++---- drivers/mmc/host/Makefile | 11 +-- drivers/mmc/host/sdhci-cns3xxx.c | 42 +++++++++- drivers/mmc/host/sdhci-dove.c | 42 +++++++++- drivers/mmc/host/sdhci-esdhc-imx.c | 112 ++++++++++++++++++------- drivers/mmc/host/sdhci-pltfm.c | 157 +++++++++--------------------------- drivers/mmc/host/sdhci-pltfm.h | 17 +++- drivers/mmc/host/sdhci-tegra.c | 118 +++++++++++++++++++-------- include/linux/mmc/sdhci-pltfm.h | 6 -- 9 files changed, 317 insertions(+), 220 deletions(-)
drivers/mmc/host/Kconfig +17 -15
@@ -113,28 +113,27 @@ config MMC_SDHCI_OF_HLWD If unsure, say N. config MMC_SDHCI_PLTFM - tristate "SDHCI support on the platform specific bus" + bool depends on MMC_SDHCI help - This selects the platform specific bus support for Secure Digital Host - Controller Interface. - - If you have a controller with this interface, say Y or M here. - - If unsure, say N. + This selects the platform common function support for Secure Digital + Host Controller Interface. config MMC_SDHCI_CNS3XXX - bool "SDHCI support on the Cavium Networks CNS3xxx SoC" + tristate "SDHCI support on the Cavium Networks CNS3xxx SoC" depends on ARCH_CNS3XXX - depends on MMC_SDHCI_PLTFM + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM help This selects the SDHCI support for CNS3xxx System-on-Chip devices. If unsure, say N. config MMC_SDHCI_ESDHC_IMX - bool "SDHCI platform support for the Freescale eSDHC i.MX controller" - depends on MMC_SDHCI_PLTFM && (ARCH_MX25 || ARCH_MX35 || ARCH_MX5) + tristate "SDHCI platform support for the Freescale eSDHC i.MX controller" + depends on ARCH_MX25 || ARCH_MX35 || ARCH_MX5 + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS help This selects the Freescale eSDHC controller support on the platform
@@ -143,9 +142,10 @@ config MMC_SDHCI_ESDHC_IMX If unsure, say N. config MMC_SDHCI_DOVE - bool "SDHCI support on Marvell's Dove SoC" + tristate "SDHCI support on Marvell's Dove SoC" depends on ARCH_DOVE - depends on MMC_SDHCI_PLTFM + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS help This selects the Secure Digital Host Controller Interface in
@@ -154,8 +154,10 @@ config MMC_SDHCI_DOVE If unsure, say N. config MMC_SDHCI_TEGRA - bool "SDHCI platform support for the Tegra SD/MMC Controller" - depends on MMC_SDHCI_PLTFM && ARCH_TEGRA + tristate "SDHCI platform support for the Tegra SD/MMC Controller" + depends on ARCH_TEGRA + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM select MMC_SDHCI_IO_ACCESSORS help This selects the Tegra SD/MMC controller. If you have a Tegra
drivers/mmc/host/Makefile +5 -6
@@ -43,12 +43,11 @@ obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o obj-$(CONFIG_MMC_JZ4740) += jz4740_mmc.o obj-$(CONFIG_MMC_USHC) += ushc.o -obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-platform.o -sdhci-platform-y := sdhci-pltfm.o -sdhci-platform-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o -sdhci-platform-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o -sdhci-platform-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o -sdhci-platform-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o +obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o +obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o +obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o +obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o +obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o sdhci-of-y := sdhci-of-core.o
drivers/mmc/host/sdhci-cns3xxx.c +41 -1
51 lines not on this page · raw message
drivers/mmc/host/sdhci-dove.c +41 -1
51 lines not on this page · raw message
drivers/mmc/host/sdhci-esdhc-imx.c +81 -31
172 lines not on this page · raw message
drivers/mmc/host/sdhci-pltfm.c +37 -120
226 lines not on this page · raw message
drivers/mmc/host/sdhci-pltfm.h +13 -4
@@ -13,6 +13,7 @@#include <linux/clk.h> #include <linux/types.h> +#include <linux/platform_device.h> #include <linux/mmc/sdhci-pltfm.h> struct sdhci_pltfm_host {
@@ -20,9 +21,17 @@ struct sdhci_pltfm_host { void *priv; /* to handle quirks across io-accessor calls */ }; -extern struct sdhci_pltfm_data sdhci_cns3xxx_pdata; -extern struct sdhci_pltfm_data sdhci_esdhc_imx_pdata; -extern struct sdhci_pltfm_data sdhci_dove_pdata; -extern struct sdhci_pltfm_data sdhci_tegra_pdata; +extern struct sdhci_host *sdhci_pltfm_init (struct platform_device *pdev, +struct sdhci_pltfm_data *pdata); +extern void sdhci_pltfm_free (struct platform_device *pdev); + +extern int sdhci_pltfm_register (struct platform_device *pdev, +struct sdhci_pltfm_data *pdata); +extern int sdhci_pltfm_unregister (struct platform_device *pdev); + +#ifdef CONFIG_PM +extern int sdhci_pltfm_suspend (struct platform_device *dev,pm_message_t state); +extern int sdhci_pltfm_resume (struct platform_device *dev); +#endif #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */
drivers/mmc/host/sdhci-tegra.c +82 -36
197 lines not on this page · raw message
include/linux/mmc/sdhci-pltfm.h +0 -6
@@ -15,21 +15,15 @@#define _SDHCI_PLTFM_Hstruct sdhci_ops ; -struct sdhci_host ;/** * struct sdhci_pltfm_data - SDHCI platform-specific information & hooks * @ops: optional pointer to the platform-provided SDHCI ops * @quirks: optional SDHCI quirks -* @init: optional hook that is called during device probe, before the -* driver tries to access any SDHCI registers -* @exit: optional hook that is called during device removal */ struct sdhci_pltfm_data {struct sdhci_ops *ops;unsigned int quirks; -int (*init)(struct sdhci_host *host,struct sdhci_pltfm_data *pdata); -void (*exit)(struct sdhci_host *host); };#endif /* _SDHCI_PLTFM_H */
Signature · 1 line
1.7.4.1
PATCH v2 1/7 mmc: sdhci: make sdhci-pltfm device drivers self registered
On Thu, May 05, 2011 at 09:22:52PM +0800, Shawn Guo wrote:
[...]
Quoted 24 lines
drivers/mmc/host/sdhci-cns3xxx.c +24
-0+static int __devinit sdhci_cns3xxx_probe (struct platform_device *pdev) +{ +return sdhci_pltfm_register (pdev, &sdhci_cns3xxx_pdata); +} + +static int __devexit sdhci_cns3xxx_remove(struct platform_device *pdev) +{ +return sdhci_pltfm_unregister (pdev); +} + +static struct platform_driver sdhci_cns3xxx_driver = { + .driver = { + .name ="sdhci-cns3xxx" , + .owner =THIS_MODULE , + }, + .probe = sdhci_cns3xxx_probe, + .remove =__devexit_p (sdhci_cns3xxx_remove), +#ifdef CONFIG_PM + .suspend = sdhci_pltfm_suspend, + .resume = sdhci_pltfm_resume, +#endif +}; + +static int __init sdhci_cns3xxx_init (void )
drivers/mmc/host/sdhci-cns3xxx.c struct sdhci_pltfm_data sdhci_cns3xxx_pdata = { · line 132
Quoted 10 lines
drivers/mmc/host/sdhci-cns3xxx.c +10
-0+{ +return platform_driver_register (&sdhci_cns3xxx_driver); +} +module_init (sdhci_cns3xxx_init); + +static void __exit sdhci_cns3xxx_exit(void) +{ +platform_driver_unregister (&sdhci_cns3xxx_driver); +} +module_exit (sdhci_cns3xxx_exit);
I don't think I like this duplicate code for each platform sub- driver. It's repetitive and annoying. :-/
But considering that ARM will be multiplatform soon, we don't want to have every mach-* stuff in the single sdhci-pltfm.
So... OK. If that compiles, I'm fine with it. :-D
Thanks!
Signature · 2 lines
Anton Vorontsov Email: cbouatmailru at gmail.com
PATCH v2 2/7 mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
In reply to Shawn GuoThe patch migrates the use of sdhci_of_host and sdhci_of_data to sdhci_pltfm_host and sdhci_pltfm_data, so that the former pair can be eliminated.
--- drivers/mmc/host/sdhci-of-core.c | 30 +++++++++++++++--------------- drivers/mmc/host/sdhci-of-esdhc.c | 36 +++++++++++++++++++----------------- drivers/mmc/host/sdhci-of-hlwd.c | 20 +++++++++++--------- drivers/mmc/host/sdhci-of.h | 15 +++------------ drivers/mmc/host/sdhci-pltfm.h | 4 ++++ 5 files changed, 52 insertions(+), 53 deletions(-)
drivers/mmc/host/sdhci-of-core.c +15 -15
@@ -59,7 +59,7 @@ void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg)void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg) { -struct sdhci_of_host *of_host =sdhci_priv (host); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);int base = reg & ~0x3 ;int shift = (reg &0x2 ) *8 ;
@@ -69,10 +69,10 @@ void sdhci_be32bs_writew(struct sdhci_host *host, u16 val, int reg)* Postpone this write, we must do it together with a * command write that is down below. */ - of_host->xfer_mode_shadow = val; + pltfm_host->xfer_mode_shadow = val;return ;case SDHCI_COMMAND : -sdhci_be32bs_writel (host, val <<16 | of_host->xfer_mode_shadow, +sdhci_be32bs_writel (host, val <<16 | pltfm_host->xfer_mode_shadow,SDHCI_TRANSFER_MODE );return ; }
@@ -127,7 +127,7 @@ static bool __devinit sdhci_of_wp_inverted(struct device_node *np)static int __devinit sdhci_of_probe (struct platform_device *ofdev) {struct device_node *np = ofdev->dev.of_node; -struct sdhci_of_data *sdhci_of_data; +struct sdhci_pltfm_data *pdata;struct sdhci_host *host;struct sdhci_of_host *of_host;const __be32 *clk;
@@ -136,16 +136,16 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev)if (!ofdev->dev.of_match)return -EINVAL ; - sdhci_of_data = ofdev->dev.of_match->data; + pdata = ofdev->dev.of_match->data;if (!of_device_is_available (np))return -ENODEV ; - host =sdhci_alloc_host (&ofdev->dev,sizeof (*of_host)); + host =sdhci_alloc_host (&ofdev->dev,sizeof (*pltfm_host));if (IS_ERR (host))return -ENOMEM ; - of_host =sdhci_priv (host); + pltfm_host =sdhci_priv (host);dev_set_drvdata (&ofdev->dev, host); host->ioaddr =of_iomap (np,0 );
@@ -161,9 +161,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) } host->hw_name =dev_name (&ofdev->dev); -if (sdhci_of_data) { - host->quirks = sdhci_of_data->quirks; - host->ops = &sdhci_of_data->ops; +if (pdata) { + host->quirks = pdata->quirks; + host->ops = &pdata->ops; }if (of_get_property (np,"sdhci,auto-cmd12" ,NULL ))
@@ -178,7 +178,7 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev) clk =of_get_property (np,"clock-frequency" , &size);if (clk && size ==sizeof (*clk) && *clk) - of_host->clock =be32_to_cpup (clk); + pltfm_host->clock =be32_to_cpup (clk); ret =sdhci_add_host (host);if (ret)
@@ -208,12 +208,12 @@ static int __devexit sdhci_of_remove(struct platform_device *ofdev)static const struct of_device_id sdhci_of_match[] = { #ifdef CONFIG_MMC_SDHCI_OF_ESDHC - { .compatible ="fsl,mpc8379-esdhc" , .data = &sdhci_esdhc, }, - { .compatible ="fsl,mpc8536-esdhc" , .data = &sdhci_esdhc, }, - { .compatible ="fsl,esdhc" , .data = &sdhci_esdhc, }, + { .compatible ="fsl,mpc8379-esdhc" , .data = &sdhci_esdhc_pdata, }, + { .compatible ="fsl,mpc8536-esdhc" , .data = &sdhci_esdhc_pdata, }, + { .compatible ="fsl,esdhc" , .data = &sdhci_esdhc_pdata, }, #endif #ifdef CONFIG_MMC_SDHCI_OF_HLWD - { .compatible ="nintendo,hollywood-sdhci" , .data = &sdhci_hlwd, }, + { .compatible ="nintendo,hollywood-sdhci" , .data = &sdhci_hlwd_pdata, }, #endif { .compatible ="generic-sdhci" , }, {},
drivers/mmc/host/sdhci-of-esdhc.c +19 -17
@@ -60,32 +60,34 @@ static int esdhc_of_enable_dma(struct sdhci_host *host)static unsigned int esdhc_of_get_max_clock (struct sdhci_host *host) { -struct sdhci_of_host *of_host =sdhci_priv (host); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); -return of_host->clock; +return pltfm_host->clock; }static unsigned int esdhc_of_get_min_clock (struct sdhci_host *host) { -struct sdhci_of_host *of_host =sdhci_priv (host); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); -return of_host->clock /256 /16 ; +return pltfm_host->clock /256 /16 ; } -struct sdhci_of_data sdhci_esdhc = { +static struct sdhci_ops sdhci_esdhc_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = esdhc_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_be32bs_writel, + .write_w = esdhc_writew, + .write_b = esdhc_writeb, + .set_clock = esdhc_set_clock, + .enable_dma = esdhc_of_enable_dma, + .get_max_clock = esdhc_of_get_max_clock, + .get_min_clock = esdhc_of_get_min_clock, +}; + +struct sdhci_pltfm_data sdhci_esdhc_pdata = {/* card detection could be handled via GPIO */ .quirks =ESDHC_DEFAULT_QUIRKS |SDHCI_QUIRK_BROKEN_CARD_DETECTION |SDHCI_QUIRK_NO_CARD_NO_RESET , - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = esdhc_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_be32bs_writel, - .write_w = esdhc_writew, - .write_b = esdhc_writeb, - .set_clock = esdhc_set_clock, - .enable_dma = esdhc_of_enable_dma, - .get_max_clock = esdhc_of_get_max_clock, - .get_min_clock = esdhc_of_get_min_clock, - }, + .ops = &sdhci_esdhc_ops, };
drivers/mmc/host/sdhci-of-hlwd.c +11 -9
@@ -51,15 +51,17 @@ static void sdhci_hlwd_writeb(struct sdhci_host *host, u8 val, int reg)udelay (SDHCI_HLWD_WRITE_DELAY ); } -struct sdhci_of_data sdhci_hlwd = { +static struct sdhci_ops sdhci_hlwd_ops = { + .read_l = sdhci_be32bs_readl, + .read_w = sdhci_be32bs_readw, + .read_b = sdhci_be32bs_readb, + .write_l = sdhci_hlwd_writel, + .write_w = sdhci_hlwd_writew, + .write_b = sdhci_hlwd_writeb, +}; + +struct sdhci_pltfm_data sdhci_hlwd_pdata = { .quirks =SDHCI_QUIRK_32BIT_DMA_ADDR |SDHCI_QUIRK_32BIT_DMA_SIZE , - .ops = { - .read_l = sdhci_be32bs_readl, - .read_w = sdhci_be32bs_readw, - .read_b = sdhci_be32bs_readb, - .write_l = sdhci_hlwd_writel, - .write_w = sdhci_hlwd_writew, - .write_b = sdhci_hlwd_writeb, - }, + .ops = &sdhci_hlwd_ops, };
drivers/mmc/host/sdhci-of.h +3 -12
@@ -18,16 +18,7 @@#include <linux/types.h> #include "sdhci.h" - -struct sdhci_of_data { -unsigned int quirks; -struct sdhci_ops ops; -}; - -struct sdhci_of_host { -unsigned int clock; -u16 xfer_mode_shadow; -}; +#include "sdhci-pltfm.h" extern u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg);extern u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg);
@@ -36,7 +27,7 @@ extern void sdhci_be32bs_writel(struct sdhci_host *host, u32 val, int reg);extern void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg);extern void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg); -extern struct sdhci_of_data sdhci_esdhc; -extern struct sdhci_of_data sdhci_hlwd; +extern struct sdhci_pltfm_data sdhci_esdhc_pdata; +extern struct sdhci_pltfm_data sdhci_hlwd_pdata;#endif /* __SDHCI_OF_H */
drivers/mmc/host/sdhci-pltfm.h +4 -0
@@ -19,6 +19,10 @@struct sdhci_pltfm_host {struct clk *clk;void *priv;/* to handle quirks across io-accessor calls */ + +/* migrate from sdhci_of_host */ +unsigned int clock; +u16 xfer_mode_shadow; }; extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
Signature · 1 line
1.7.4.1
PATCH v2 2/7 mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
Quoted 6 lines · Shawn Guo
The patch migrates the use of
sdhci_of_hostandsdhci_of_datatosdhci_pltfm_hostandsdhci_pltfm_data, so that the former pair can be eliminated.Signed-off-by Shawn Guo <[email protected]>Reviewed-by Grant Likely <[email protected]>
Thanks!
Signature · 2 lines
Anton Vorontsov Email: cbouatmailru at gmail.com
PATCH v2 2/7 mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
In reply to Shawn GuoQuoted 6 lines · Shawn Guo
The patch migrates the use of
sdhci_of_hostandsdhci_of_datatosdhci_pltfm_hostandsdhci_pltfm_data, so that the former pair can be eliminated.Signed-off-by Shawn Guo <[email protected]>Reviewed-by Grant Likely <[email protected]>
We might be able to get rid of the migrated entries in sdhci-pltfm.h, but this is a task for later IMO.
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110524/8fee7548/attachment.sig>
PATCH v2 3/7 mmc: sdhci: make sdhci-of device drivers self registered
In reply to Shawn GuoThe patch turns the sdhci-of-core common stuff into helper functions added into sdhci-pltfm.c, and makes sdhci-of device drviers self registered using the same pair of .probe and .remove used by sdhci-pltfm device drivers.
As a result, sdhci-of-core.c and sdhci-of.h can be eliminated with those common things merged into sdhci-pltfm.c and sdhci-pltfm.h respectively.
--- drivers/mmc/host/Kconfig | 15 +-- drivers/mmc/host/Makefile | 7 +- drivers/mmc/host/sdhci-of-core.c | 250 ------------------------------------- drivers/mmc/host/sdhci-of-esdhc.c | 53 ++++++++- drivers/mmc/host/sdhci-of-hlwd.c | 50 +++++++- drivers/mmc/host/sdhci-of.h | 33 ----- drivers/mmc/host/sdhci-pltfm.c | 104 +++++++++++++++- drivers/mmc/host/sdhci-pltfm.h | 12 ++ 8 files changed, 220 insertions(+), 304 deletions(-) delete mode 100644 drivers/mmc/host/sdhci-of-core.c delete mode 100644 drivers/mmc/host/sdhci-of.h
drivers/mmc/host/Kconfig +4 -11
@@ -81,19 +81,11 @@ config MMC_RICOH_MMC If unsure, say Y. -config MMC_SDHCI_OF - tristate "SDHCI support on OpenFirmware platforms" - depends on MMC_SDHCI && OF - help - This selects the OF support for Secure Digital Host Controller - Interfaces. - - If unsure, say N. - config MMC_SDHCI_OF_ESDHC bool "SDHCI OF support for the Freescale eSDHC controller" - depends on MMC_SDHCI_OF + depends on MMC_SDHCI depends on PPC_OF + select MMC_SDHCI_PLTFM select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Freescale eSDHC controller support.
@@ -102,8 +94,9 @@ config MMC_SDHCI_OF_ESDHC config MMC_SDHCI_OF_HLWD bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" - depends on MMC_SDHCI_OF + depends on MMC_SDHCI depends on PPC_OF + select MMC_SDHCI_PLTFM select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER help This selects the Secure Digital Host Controller Interface (SDHCI)
drivers/mmc/host/Makefile +2 -5
@@ -48,11 +48,8 @@ obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o - -obj-$(CONFIG_MMC_SDHCI_OF) += sdhci-of.o -sdhci-of-y := sdhci-of-core.o -sdhci-of-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o -sdhci-of-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o +obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o +obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o ifeq ($(CONFIG_CB710_DEBUG),y) CFLAGS-cb710-mmc += -DDEBUG
drivers/mmc/host/sdhci-of-core.c deleted +0 -250
250 lines not on this page · raw message
drivers/mmc/host/sdhci-of-esdhc.c +51 -2
67 lines not on this page · raw message
drivers/mmc/host/sdhci-of-hlwd.c +48 -2
63 lines not on this page · raw message
drivers/mmc/host/sdhci-of.h deleted +0 -33
@@ -1,33 +0,0 @@ -/* -* OpenFirmware bindings for Secure Digital Host Controller Interface. -* -* Copyright (c) 2007 Freescale Semiconductor, Inc. -* Copyright (c) 2009 MontaVista Software, Inc. -* -* Authors: Xiaobo Xie <[email protected]> -* Anton Vorontsov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -*/ - -#ifndef __SDHCI_OF_H -#define __SDHCI_OF_H - -#include <linux/types.h> -#include "sdhci.h" -#include "sdhci-pltfm.h" - -extern u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg); -extern u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg); -extern u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg); -extern void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg); -extern void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg); -extern void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg); - -extern struct sdhci_pltfm_data sdhci_esdhc_pdata; -extern struct sdhci_pltfm_data sdhci_hlwd_pdata; - -#endif /* __SDHCI_OF_H */
drivers/mmc/host/sdhci-pltfm.c +103 -1
122 lines not on this page · raw message
drivers/mmc/host/sdhci-pltfm.h +12 -0
@@ -15,6 +15,7 @@#include <linux/types.h> #include <linux/platform_device.h> #include <linux/mmc/sdhci-pltfm.h> +#include <linux/mmc/sdhci.h> struct sdhci_pltfm_host {struct clk *clk;
@@ -25,6 +26,17 @@ struct sdhci_pltfm_host {u16 xfer_mode_shadow; }; +#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER +extern u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg); +extern u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg); +extern u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg); +extern void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg); +extern void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg); +extern void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg); +#endif + +extern void sdhci_get_of_property (struct platform_device *pdev); +extern struct sdhci_host *sdhci_pltfm_init (struct platform_device *pdev,struct sdhci_pltfm_data *pdata);extern void sdhci_pltfm_free (struct platform_device *pdev);
Signature · 1 line
1.7.4.1
PATCH v2 3/7 mmc: sdhci: make sdhci-of device drivers self registered
On Thu, May 05, 2011 at 09:22:54PM +0800, Shawn Guo wrote:
[...]
Quoted 5 lines
- * Copyright (c) 2007 Freescale Semiconductor, Inc.
- * Copyright (c) 2009 MontaVista Software, Inc.
- *
- * Authors: Xiaobo Xie <[email protected]>
- * Anton Vorontsov <[email protected]>
[...]
Quoted 57 lines
drivers/mmc/host/sdhci-of-core.c deleted +0
-57-#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER - -/* -* These accessors are designed for big endian hosts doing I/O to -* little endian controllers incorporating a 32-bit hardware byte swapper. -*/ - -u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg) -{ -return in_be32 (host->ioaddr + reg); -} - -u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg) -{ -return in_be16 (host->ioaddr + (reg ^0x2 )); -} - -u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg) -{ -return in_8 (host->ioaddr + (reg ^0x3 )); -} - -void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg) -{ -out_be32 (host->ioaddr + reg, val); -} - -void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg) -{ -struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); -int base = reg & ~0x3 ; -int shift = (reg &0x2 ) *8 ; - -switch (reg) { -case SDHCI_TRANSFER_MODE : -/* -* Postpone this write, we must do it together with a -* command write that is down below. -*/ - pltfm_host->xfer_mode_shadow = val; -return ; -case SDHCI_COMMAND : -sdhci_be32bs_writel (host, val <<16 | pltfm_host->xfer_mode_shadow, -SDHCI_TRANSFER_MODE ); -return ; - } -clrsetbits_be32 (host->ioaddr + base,0xffff << shift, val << shift); -} - -void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg) -{ -int base = reg & ~0x3 ; -int shift = (reg &0x3 ) *8 ; - -clrsetbits_be32 (host->ioaddr + base ,0xff << shift, val << shift); -} -#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
[...]
Quoted 45 lines
drivers/mmc/host/sdhci-pltfm.c +45
-0+#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER +/* +* These accessors are designed for big endian hosts doing I/O to +* little endian controllers incorporating a 32-bit hardware byte swapper. +*/ +u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg) +{ +return in_be32 (host->ioaddr + reg); +} + +u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg) +{ +return in_be16 (host->ioaddr + (reg ^0x2 )); +} + +u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg) +{ +return in_8 (host->ioaddr + (reg ^0x3 )); +} + +void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg) +{ +out_be32 (host->ioaddr + reg, val); +} + +void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +int base = reg & ~0x3 ; +int shift = (reg &0x2 ) *8 ; + +switch (reg) { +case SDHCI_TRANSFER_MODE : +/* +* Postpone this write, we must do it together with a +* command write that is down below. +*/ + pltfm_host->xfer_mode_shadow = val; +return ; +case SDHCI_COMMAND : +sdhci_be32bs_writel (host, val <<16 | pltfm_host->xfer_mode_shadow, +SDHCI_TRANSFER_MODE ); +return ; + } +clrsetbits_be32 (host->ioaddr + base,0xffff << shift, val << shift);
drivers/mmc/host/sdhci-pltfm.c line 90
Quoted 10 lines
drivers/mmc/host/sdhci-pltfm.c +10
-0+} + +void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg) +{ +int base = reg & ~0x3 ; +int shift = (reg &0x3 ) *8 ; + +clrsetbits_be32 (host->ioaddr + base ,0xff << shift, val << shift); +} +#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
I noticed you're very careful wrt copyright/authorship notices, except for this case. How about retaining copyright stuff when you merge these two files?
The patch itself looks great though.
PATCH v2 3/7 mmc: sdhci: make sdhci-of device drivers self registered
Quoted 117 lines · Anton Vorontsov
On Thu, May 05, 2011 at 09:22:54PM +0800, Shawn Guo wrote:
[...]Quoted 5 lines
- * Copyright (c) 2007 Freescale Semiconductor, Inc.
- * Copyright (c) 2009 MontaVista Software, Inc.
- *
- * Authors: Xiaobo Xie <[email protected]>
- * Anton Vorontsov <[email protected]>[...]
Quoted 57 lines
drivers/mmc/host/sdhci-of-core.c deleted +0
-57-#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER - -/* -* These accessors are designed for big endian hosts doing I/O to -* little endian controllers incorporating a 32-bit hardware byte swapper. -*/ - -u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg) -{ -return in_be32 (host->ioaddr + reg); -} - -u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg) -{ -return in_be16 (host->ioaddr + (reg ^0x2 )); -} - -u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg) -{ -return in_8 (host->ioaddr + (reg ^0x3 )); -} - -void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg) -{ -out_be32 (host->ioaddr + reg, val); -} - -void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg) -{ -struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); -int base = reg & ~0x3 ; -int shift = (reg &0x2 ) *8 ; - -switch (reg) { -case SDHCI_TRANSFER_MODE : -/* -* Postpone this write, we must do it together with a -* command write that is down below. -*/ - pltfm_host->xfer_mode_shadow = val; -return ; -case SDHCI_COMMAND : -sdhci_be32bs_writel (host, val <<16 | pltfm_host->xfer_mode_shadow, -SDHCI_TRANSFER_MODE ); -return ; - } -clrsetbits_be32 (host->ioaddr + base,0xffff << shift, val << shift); -} - -void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg) -{ -int base = reg & ~0x3 ; -int shift = (reg &0x3 ) *8 ; - -clrsetbits_be32 (host->ioaddr + base ,0xff << shift, val << shift); -} -#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */ [...]
Quoted 51 lines
drivers/mmc/host/sdhci-pltfm.c +51
-0+#ifdef CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER +/* +* These accessors are designed for big endian hosts doing I/O to +* little endian controllers incorporating a 32-bit hardware byte swapper. +*/ +u32 sdhci_be32bs_readl (struct sdhci_host *host,int reg) +{ +return in_be32 (host->ioaddr + reg); +} + +u16 sdhci_be32bs_readw (struct sdhci_host *host,int reg) +{ +return in_be16 (host->ioaddr + (reg ^0x2 )); +} + +u8 sdhci_be32bs_readb (struct sdhci_host *host,int reg) +{ +return in_8 (host->ioaddr + (reg ^0x3 )); +} + +void sdhci_be32bs_writel (struct sdhci_host *host,u32 val,int reg) +{ +out_be32 (host->ioaddr + reg, val); +} + +void sdhci_be32bs_writew (struct sdhci_host *host,u16 val,int reg) +{ +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +int base = reg & ~0x3 ; +int shift = (reg &0x2 ) *8 ; + +switch (reg) { +case SDHCI_TRANSFER_MODE : +/* +* Postpone this write, we must do it together with a +* command write that is down below. +*/ + pltfm_host->xfer_mode_shadow = val; +return ; +case SDHCI_COMMAND : +sdhci_be32bs_writel (host, val <<16 | pltfm_host->xfer_mode_shadow, +SDHCI_TRANSFER_MODE ); +return ; + } +clrsetbits_be32 (host->ioaddr + base,0xffff << shift, val << shift); +} + +void sdhci_be32bs_writeb (struct sdhci_host *host,u8 val,int reg) +{ +int base = reg & ~0x3 ; +int shift = (reg &0x3 ) *8 ;
Quoted 9 lines
drivers/mmc/host/sdhci-pltfm.c line 90
Quoted 4 lines
drivers/mmc/host/sdhci-pltfm.c +4
-0+ + clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift); +} +#endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */ I noticed you're very careful wrt copyright/authorship notices, except for this case. How about retaining copyright stuff when you merge these two files?
Obviously, need to be more careful. Will add. Thanks.
Signature · 2 lines
Regards, Shawn
PATCH v2 3/7 mmc: sdhci: make sdhci-of device drivers self registered
In reply to Shawn GuoQuoted 10 lines · Shawn Guo
The patch turns the sdhci-of-core common stuff into helper functions added into
sdhci-pltfm.c, and makes sdhci-of device drviers self registered using the same pair of .probe and .remove used by sdhci-pltfm device drivers.As a result,
sdhci-of-core.candsdhci-of.hcan be eliminated with those common things merged intosdhci-pltfm.candsdhci-pltfm.hrespectively.Signed-off-by Shawn Guo <[email protected]>
After taking care of Anton's comment and fixing this minor thingie...
drivers/mmc/host/sdhci-pltfm.c line 103
Quoted 12 lines
drivers/mmc/host/sdhci-pltfm.c +12
-0+#ifdef CONFIG_OF +static bool sdhci_of_wp_inverted (struct device_node *np) +{ +if (of_get_property (np,"sdhci,wp-inverted" ,NULL )) +return true; + +/* Old device trees don't have the wp-inverted property. */ +#ifdef CONFIG_PPC +return machine_is (mpc837x_rdb) ||machine_is (mpc837x_mds); +#else +return false; +#endif
/* CONFIG_PPC */ after #endif
Quoted 18 lines
drivers/mmc/host/sdhci-pltfm.c +18
-0+} + +void sdhci_get_of_property (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct sdhci_host *host =platform_get_drvdata (pdev); +struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host); +const __be32 *clk; +int size; + +if (of_device_is_available (np)) { +if (of_get_property (np,"sdhci,auto-cmd12" ,NULL )) + host->quirks |=SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 ; + +if (of_get_property (np,"sdhci,1-bit-only" ,NULL )) + host->quirks |=SDHCI_QUIRK_FORCE_1_BIT_DATA ; + +if (sdhci_of_wp_inverted (np))
drivers/mmc/host/sdhci-pltfm.c line 131
Quoted 10 lines
drivers/mmc/host/sdhci-pltfm.c +10
-0+ host->quirks |=SDHCI_QUIRK_INVERTED_WRITE_PROTECT ; + + clk =of_get_property (np,"clock-frequency" , &size); +if (clk && size ==sizeof (*clk) && *clk) + pltfm_host->clock = be32_to_cpup(clk); + } +} +#else +void sdhci_get_of_property (struct platform_device *pdev) {} +#endif
/* CONFIG_OF */
you can add
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110524/bd195ba8/attachment.sig>
PATCH v2 4/7 sdhci: rename sdhci-esdhc-imx.c to sdhci-esdhc.c
In reply to Shawn GuoThe patch renames the file to prepare for the consolidation sdhci-of-esdhc and sdhci-esdhc-imx.
--- drivers/mmc/host/Makefile | 2 +- drivers/mmc/host/sdhci-esdhc-imx.c | 381 ------------------------------------ drivers/mmc/host/sdhci-esdhc.c | 381 ++++++++++++++++++++++++++++++++++++ 3 files changed, 382 insertions(+), 382 deletions(-) delete mode 100644 drivers/mmc/host/sdhci-esdhc-imx.c create mode 100644 drivers/mmc/host/sdhci-esdhc.c
drivers/mmc/host/Makefile +1 -1
@@ -45,7 +45,7 @@ obj-$(CONFIG_MMC_USHC) += ushc.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o -obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o +obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc.o obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o
drivers/mmc/host/sdhci-esdhc-imx.c deleted +0 -381
381 lines not on this page · raw message
drivers/mmc/host/sdhci-esdhc.c new file +381 -0
381 lines not on this page · raw message
Signature · 1 line
1.7.4.1
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
In reply to Shawn GuoThis patch is to consolidate SDHCI driver for Freescale eSDHC controller found on both MPCxxx and i.MX platforms. It merges sdhci-of-esdhc.c into sdhci-esdhc.c, so that the same pair of .probe/.remove hook works with eSDHC for two platforms.
As the results, sdhci-of-esdhc.c and sdhci-esdhc.h are removed, and header esdhc.h containing the definition of esdhc_platform_data is put into the public folder.
--- drivers/mmc/host/Kconfig | 38 ++++--- drivers/mmc/host/Makefile | 3 +- drivers/mmc/host/sdhci-esdhc.c | 244 +++++++++++++++++++++++++++++++++---- drivers/mmc/host/sdhci-esdhc.h | 81 ------------ drivers/mmc/host/sdhci-of-esdhc.c | 142 --------------------- include/linux/mmc/esdhc.h | 27 ++++ 6 files changed, 273 insertions(+), 262 deletions(-) delete mode 100644 drivers/mmc/host/sdhci-esdhc.h delete mode 100644 drivers/mmc/host/sdhci-of-esdhc.c create mode 100644 include/linux/mmc/esdhc.h
drivers/mmc/host/Kconfig +23 -15
@@ -81,17 +81,6 @@ config MMC_RICOH_MMC If unsure, say Y. -config MMC_SDHCI_OF_ESDHC - bool "SDHCI OF support for the Freescale eSDHC controller" - depends on MMC_SDHCI - depends on PPC_OF - select MMC_SDHCI_PLTFM - select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER - help - This selects the Freescale eSDHC controller support. - - If unsure, say N. - config MMC_SDHCI_OF_HLWD bool "SDHCI OF support for the Nintendo Wii SDHCI controllers" depends on MMC_SDHCI
@@ -122,15 +111,34 @@ config MMC_SDHCI_CNS3XXX If unsure, say N. +config MMC_SDHCI_ESDHC + bool + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects SDHCI driver for Freescale eSDHC controller. + +config MMC_SDHCI_ESDHC_MPC + bool "SDHCI support for the Freescale eSDHC MPC controller" + depends on MMC_SDHCI + depends on PPC_OF && PPC_CLOCK + select MMC_SDHCI_ESDHC + select MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER + help + This selects the Freescale eSDHC controller support on the + MPC platforms. + + If unsure, say N. + config MMC_SDHCI_ESDHC_IMX - tristate "SDHCI platform support for the Freescale eSDHC i.MX controller" + tristate "SDHCI support for the Freescale eSDHC i.MX controller" depends on ARCH_MX25 || ARCH_MX35 || ARCH_MX5 depends on MMC_SDHCI - select MMC_SDHCI_PLTFM + select MMC_SDHCI_ESDHC select MMC_SDHCI_IO_ACCESSORS help - This selects the Freescale eSDHC controller support on the platform - bus, found on platforms like mx35/51. + This selects the Freescale eSDHC controller support on platforms + like mx25/mx35/mx5x. If unsure, say N.
drivers/mmc/host/Makefile +1 -2
@@ -45,10 +45,9 @@ obj-$(CONFIG_MMC_USHC) += ushc.o obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o -obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc.o +obj-$(CONFIG_MMC_SDHCI_ESDHC) += sdhci-esdhc.o obj-$(CONFIG_MMC_SDHCI_DOVE) += sdhci-dove.o obj-$(CONFIG_MMC_SDHCI_TEGRA) += sdhci-tegra.o -obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o ifeq ($(CONFIG_CB710_DEBUG),y)
drivers/mmc/host/sdhci-esdhc.c +222 -22
332 lines not on this page · raw message
drivers/mmc/host/sdhci-esdhc.h deleted +0 -81
81 lines not on this page · raw message
drivers/mmc/host/sdhci-of-esdhc.c deleted +0 -142
142 lines not on this page · raw message
include/linux/mmc/esdhc.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright 2010 Wolfram Sang <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; version 2 +* of the License. +*/ + +#ifndef __LINUX_MMC_ESDHC_H +#define __LINUX_MMC_ESDHC_H + +/** +* struct esdhc_platform_data - optional platform data for esdhc +* +* strongly recommended for i.MX25/35, not needed for other variants +* +* @wp_gpio: gpio for write_protect (-EINVAL if unused) +* @cd_gpio: gpio for card_detect interrupt (-EINVAL if unused) +*/ + +struct esdhc_platform_data { +unsigned int wp_gpio; +unsigned int cd_gpio; +}; + +#endif /* __LINUX_MMC_ESDHC_H */
Signature · 1 line
1.7.4.1
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
Quoted 10 lines · Shawn Guo
This patch is to consolidate SDHCI driver for Freescale eSDHC controller found on both MPCxxx and i.MX platforms. It merges
sdhci-of-esdhc.cintosdhci-esdhc.c, so that the same pair of .probe/.remove hook works with eSDHC for two platforms.As the results,
sdhci-of-esdhc.candsdhci-esdhc.hare removed, and headeresdhc.hcontaining the definition ofesdhc_platform_datais put into the public folder.Signed-off-by Shawn Guo <[email protected]>
I'm not sure if that makes sense to merge these two.
I'd rather vote for renaming sdhci-of-esdhc to sdhci-esdhc-mpc. :-)
Signature · 2 lines
Anton Vorontsov Email: cbouatmailru at gmail.com
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
In reply to Shawn Guodrivers/mmc/host/Kconfig config MMC_SDHCI_CNS3XXX · line 119
Quoted 7 lines
drivers/mmc/host/Kconfig +6
-0+config MMC_SDHCI_ESDHC + bool + depends on MMC_SDHCI + select MMC_SDHCI_PLTFM + help + This selects SDHCI driver for Freescale eSDHC controller.
bool is not a good choice here, because if ESDHC_IMX is selected as a module (-m), it will get converted here to built-in (-y). Same goes for MMC_SDHCI_PLTFM. If I change both into tristate and then compile, I get a build error:
ERROR: "sdhci_pltfm_suspend" [drivers/mmc/host/sdhci-esdhc.ko] undefined!
ERROR: "sdhci_get_of_property" [drivers/mmc/host/sdhci-esdhc.ko] undefined!
ERROR: "sdhci_pltfm_init" [drivers/mmc/host/sdhci-esdhc.ko] undefined!
ERROR: "sdhci_pltfm_free" [drivers/mmc/host/sdhci-esdhc.ko] undefined!
So, the module-support seems to be missing for the library.
Regards,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110519/988d1669/attachment-0001.sig>
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
In reply to Shawn GuoQuoted 10 lines · Shawn Guo
This patch is to consolidate SDHCI driver for Freescale eSDHC controller found on both MPCxxx and i.MX platforms. It merges
sdhci-of-esdhc.cintosdhci-esdhc.c, so that the same pair of .probe/.remove hook works with eSDHC for two platforms.As the results,
sdhci-of-esdhc.candsdhci-esdhc.hare removed, and headeresdhc.hcontaining the definition ofesdhc_platform_datais put into the public folder.Signed-off-by Shawn Guo <[email protected]>
I agree with Anton about not merging the two...
drivers/mmc/host/sdhci-esdhc.c static irqreturn_t cd_irq(int irq, void *data) · line 408
Quoted 8 lines
drivers/mmc/host/sdhci-esdhc.c +8
-0+#ifndef CONFIG_MMC_SDHCI_ESDHC_IMX +#define cpu_is_mx25 () (0) +#define cpu_is_mx35 () (0) +#define cpu_is_mx51 () (0) +#define cpu_is_imx () (0) +#else +#define cpu_is_imx () (1) +#endif
... e.g. that looks a bit frightening.
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110524/071987ae/attachment-0001.sig>
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
Quoted 14 lines · Wolfram Sang
Quoted 10 lines · Shawn Guo
This patch is to consolidate SDHCI driver for Freescale eSDHC controller found on both MPCxxx and i.MX platforms. It merges
sdhci-of-esdhc.cintosdhci-esdhc.c, so that the same pair of .probe/.remove hook works with eSDHC for two platforms.As the results,
sdhci-of-esdhc.candsdhci-esdhc.hare removed, and headeresdhc.hcontaining the definition ofesdhc_platform_datais put into the public folder.Signed-off-by Shawn Guo <[email protected]>I agree with Anton about not merging the two...
Quoted 11 lines
drivers/mmc/host/sdhci-esdhc.c static irqreturn_t cd_irq(int irq, void *data) · line 408
Quoted 8 lines
drivers/mmc/host/sdhci-esdhc.c +8
-0+#ifndef CONFIG_MMC_SDHCI_ESDHC_IMX +#define cpu_is_mx25 () (0) +#define cpu_is_mx35 () (0) +#define cpu_is_mx51 () (0) +#define cpu_is_imx () (0) +#else +#define cpu_is_imx () (1) +#endif ... e.g. that looks a bit frightening.
Agree.
The use of cpu_is_mx..() in the driver itself seems a churn to me even without this consolidation patch. Is it possible for us to eliminate them by using pdata, and eventually device tree? When we are there, I might want to revisit the consolidation again.
Signature · 2 lines
Regards, Shawn
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
Hello Shawn,
Quoted 11 lines
Quoted 11 lines
drivers/mmc/host/sdhci-esdhc.c static irqreturn_t cd_irq(int irq, void *data) · line 408
Quoted 8 lines
drivers/mmc/host/sdhci-esdhc.c +8
-0+#ifndef CONFIG_MMC_SDHCI_ESDHC_IMX +#define cpu_is_mx25 () (0) +#define cpu_is_mx35 () (0) +#define cpu_is_mx51 () (0) +#define cpu_is_imx () (0) +#else +#define cpu_is_imx () (1) +#endif ... e.g. that looks a bit frightening.
Quoted 6 lines
Agree.
The use of cpu_is_mx..() in the driver itself seems a churn to me even without this consolidation patch. Is it possible for us to eliminate them by using pdata, and eventually device tree? When we are there, I might want to revisit the consolidation again.
An alternative that allows letting the logic in the driver and still getting rid of the cpu_is_ stuff is using platform ids. See drivers/spi/spi_imx.c for an example. Instead of an index into an array (as it's for the imx-spi driver) driver_data can hold flags, too, which should be enough most of the time.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 5/7 mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx
Hi Uwe,
Quoted 19 lines · Uwe Kleine-König
Hello Shawn,
Quoted 11 lines
Quoted 11 lines
drivers/mmc/host/sdhci-esdhc.c static irqreturn_t cd_irq(int irq, void *data) · line 408
Quoted 8 lines
drivers/mmc/host/sdhci-esdhc.c +8
-0+#ifndef CONFIG_MMC_SDHCI_ESDHC_IMX +#define cpu_is_mx25 () (0) +#define cpu_is_mx35 () (0) +#define cpu_is_mx51 () (0) +#define cpu_is_imx () (0) +#else +#define cpu_is_imx () (1) +#endif ... e.g. that looks a bit frightening.
Quoted 6 lines
Agree.
The use of cpu_is_mx..() in the driver itself seems a churn to me even without this consolidation patch. Is it possible for us to eliminate them by using pdata, and eventually device tree? When we are there, I might want to revisit the consolidation again.
Quoted 6 lines
An alternative that allows letting the logic in the driver and still getting rid of the
cpu_is_stuff is using platform ids. Seedrivers/spi/spi_imx.cfor an example. Instead of an index into an array (as it's for the imx-spi driver)driver_datacan hold flags, too, which should be enough most of the time.
Yeah, this is definitely a solution I can try later. But for now, I would drop the esdhc consolidation patch.
Signature · 2 lines
Regards, Shawn
PATCH v2 6/7 mmc: sdhci: merge two sdhci-pltfm.h into one
In reply to Shawn GuoThe structure sdhci_pltfm_data is not necessarily to be in a public header like include/linux/mmc/sdhci-pltfm.h, so the patch moves it into drivers/mmc/host/sdhci-pltfm.h and eliminates the former one.
--- drivers/mmc/host/sdhci-cns3xxx.c | 1 - drivers/mmc/host/sdhci-esdhc.c | 1 - drivers/mmc/host/sdhci-pltfm.h | 6 +++++- include/linux/mmc/sdhci-pltfm.h | 29 ----------------------------- 4 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 include/linux/mmc/sdhci-pltfm.h
drivers/mmc/host/sdhci-cns3xxx.c +0 -1
@@ -15,7 +15,6 @@#include <linux/delay.h> #include <linux/device.h> #include <linux/mmc/host.h> -#include <linux/mmc/sdhci-pltfm.h> #include <mach/cns3xxx.h> #include "sdhci.h" #include "sdhci-pltfm.h"
drivers/mmc/host/sdhci-esdhc.c +0 -1
@@ -22,7 +22,6 @@#include <linux/gpio.h> #include <linux/slab.h> #include <linux/mmc/host.h> -#include <linux/mmc/sdhci-pltfm.h> #include <linux/mmc/mmc.h> #include <linux/mmc/sdio.h> #include <linux/mmc/esdhc.h>
drivers/mmc/host/sdhci-pltfm.h +5 -1
@@ -14,9 +14,13 @@#include <linux/clk.h> #include <linux/types.h> #include <linux/platform_device.h> -#include <linux/mmc/sdhci-pltfm.h> #include <linux/mmc/sdhci.h> +struct sdhci_pltfm_data { +struct sdhci_ops *ops; +unsigned int quirks; +}; +struct sdhci_pltfm_host {struct clk *clk;void *priv;/* to handle quirks across io-accessor calls */
include/linux/mmc/sdhci-pltfm.h deleted +0 -29
@@ -1,29 +0,0 @@ -/* -* Platform data declarations for the sdhci-pltfm driver. -* -* Copyright (c) 2010 MontaVista Software, LLC. -* -* Author: Anton Vorontsov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -*/ - -#ifndef _SDHCI_PLTFM_H -#define _SDHCI_PLTFM_H - -struct sdhci_ops ; - -/** -* struct sdhci_pltfm_data - SDHCI platform-specific information & hooks -* @ops: optional pointer to the platform-provided SDHCI ops -* @quirks: optional SDHCI quirks -*/ -struct sdhci_pltfm_data { -struct sdhci_ops *ops; -unsigned int quirks; -}; - -#endif /* _SDHCI_PLTFM_H */
Signature · 1 line
1.7.4.1
PATCH v2 6/7 mmc: sdhci: merge two sdhci-pltfm.h into one
Quoted 7 lines · Shawn Guo
The structure
sdhci_pltfm_datais not necessarily to be in a public header likeinclude/linux/mmc/sdhci-pltfm.h, so the patch moves it intodrivers/mmc/host/sdhci-pltfm.hand eliminates the former one.Signed-off-by Shawn Guo <[email protected]>Reviewed-by Grant Likely <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
PATCH v2 7/7 ARM: mxc: remove esdhc.h and use the public one
In reply to Shawn Guo--- .../plat-mxc/devices/platform-sdhci-esdhc-imx.c | 1 - arch/arm/plat-mxc/include/mach/devices-common.h | 2 +- 2 files changed, 1 insertions(+), 2 deletions(-)
arch/arm/plat-mxc/devices/platform-sdhci-esdhc-imx.c +0 -1
@@ -8,7 +8,6 @@#include <mach/hardware.h> #include <mach/devices-common.h> -#include <mach/esdhc.h> #define imx_sdhci_esdhc_imx_data_entry_single (soc, _id, hwid) \ { \
arch/arm/plat-mxc/include/mach/devices-common.h +1 -1
@@ -243,7 +243,7 @@ struct imx_mxc_w1_data {struct platform_device *__init imx_add_mxc_w1 (const struct imx_mxc_w1_data *data); -#include <mach/esdhc.h> +#include <linux/mmc/esdhc.h> struct imx_sdhci_esdhc_imx_data {int id;resource_size_t iobase;
Signature · 1 line
1.7.4.1
PATCH v2 7/7 ARM: mxc: remove esdhc.h and use the public one
Hello Shawn,
Quoted 4 lines · Shawn Guo
Signed-off-by Shawn Guo <[email protected]>--- .../plat-mxc/devices/platform-sdhci-esdhc-imx.c | 1 - arch/arm/plat-mxc/include/mach/devices-common.h | 2 +-
what about removing arch/arm/plat-mxc/include/mach/esdhc.h in this patch as advertised in the subject?
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 7/7 ARM: mxc: remove esdhc.h and use the public one
Hi Uwe,
Quoted 10 lines · Uwe Kleine-K?nig
Hello Shawn,
Quoted 4 lines · Shawn Guo
Signed-off-by Shawn Guo <[email protected]>--- .../plat-mxc/devices/platform-sdhci-esdhc-imx.c | 1 - arch/arm/plat-mxc/include/mach/devices-common.h | 2 +-what about removing
arch/arm/plat-mxc/include/mach/esdhc.hin this patch as advertised in the subject?
Yes, will do if the patch #4 will finally stands. People are voting for it. Let's see Wolfram's position.
Signature · 2 lines
Regards, Shawn
v2 cover Consolidate sdhci pltfm & OF drivers and get them self registered
In reply to Shawn GuoHi Shawn,
Quoted 2 lines
Changes since v1:
* Rebase on cjb's mmc-next tree
Is it maybe possible that you get access to
http://opensource.freescale.com/git or another machine? A branch to pull from would be more convenient, because the series does not apply to mmc-next anymore, so an extra step to go "back in time" is needed.
(minor) When applying I got:
Applying: mmc: sdhci: make sdhci-pltfm device drivers self registered /home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:384: trailing whitespace. /home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:817: space before tab in indent.
struct tegra_sdhci_platform_data *plat;/home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:867: trailing whitespace.
Applying: sdhci: rename sdhci-esdhc-imx.c to sdhci-esdhc.c /home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:780: trailing whitespace.
See later comments for further issues.
Thanks,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110519/0ecfafb4/attachment.sig>
v2 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Hi Wolfram,
Quoted 18 lines · Wolfram Sang
Hi Shawn,
Quoted 2 lines
Changes since v1:
* Rebase on cjb's mmc-next treeIs it maybe possible that you get access to
http://opensource.freescale.com/git or another machine? A branch to pull from would be more convenient, because the series does not apply to mmc-next anymore, so an extra step to go "back in time" is needed.(minor) When applying I got:
Applying: mmc: sdhci: make sdhci-pltfm device drivers self registered
/home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:384: trailing whitespace./home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:817: space before tab in indent.
structtegra_sdhci_platform_data*plat;/home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:867: trailing whitespace.
Quoted 5 lines
Applying: sdhci: rename
sdhci-esdhc-imx.ctosdhci-esdhc.c/home/wsa/Kernel/linux-2.6/.git/rebase-apply/patch:780: trailing whitespace.See later comments for further issues.
Should I go for v3 right now to address the patch applying problems and that ESDHC_IMX build issue, or hold for a while to see if you have more comments on v2?
And what is your position on patch #5 which merges esdhc imx and mpc support into one? As Anton has voted a NO there, I would probably drop the patch if there is another person has strong opinion to get imx and mpc stay separated.
Signature · 2 lines
Regards, Shawn
v2 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Hi Shawn,
Quoted 3 lines
Should I go for v3 right now to address the patch applying problems and that
ESDHC_IMXbuild issue, or hold for a while to see if you have more comments on v2?
Please wait a little bit more.
Quoted 4 lines
And what is your position on patch #5 which merges esdhc imx and mpc support into one? As Anton has voted a NO there, I would probably drop the patch if there is another person has strong opinion to get imx and mpc stay separated.
This was the other main issue I spotted so far. I wanted to have another look tomorrow, yet the tendency is that I agree with Anton.
Regards,
Wolfram
Signature · 9 lines
Pengutronix e.K. | Wolfram Sang | Industrial Linux Solutions | http://www.pengutronix.de/ | -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110519/06e7724f/attachment-0001.sig>