Consolidate sdhci pltfm & OF drivers and get them self registered
Subsystems (5)
v3 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.
* 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.
Changes since v2:
* Drop imx mpc esdhc consolidation
* Fix checkpatch errors
* Add sdhci-of-core.c copyright into sdhci-pltfm.c
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 (4):
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
mmc: sdhci: merge two sdhci-pltfm.h into one
drivers/mmc/host/Kconfig | 47 +++---- drivers/mmc/host/Makefile | 18 +-- drivers/mmc/host/sdhci-cns3xxx.c | 43 ++++++- drivers/mmc/host/sdhci-dove.c | 42 ++++++- drivers/mmc/host/sdhci-esdhc-imx.c | 114 +++++++++++----- drivers/mmc/host/sdhci-of-core.c | 250 --------------------------------- drivers/mmc/host/sdhci-of-esdhc.c | 85 +++++++++--- drivers/mmc/host/sdhci-of-hlwd.c | 66 ++++++++-- drivers/mmc/host/sdhci-of.h | 42 ------ drivers/mmc/host/sdhci-pltfm.c | 266 ++++++++++++++++++++---------------- drivers/mmc/host/sdhci-pltfm.h | 39 +++++- drivers/mmc/host/sdhci-tegra.c | 116 +++++++++++----- include/linux/mmc/sdhci-pltfm.h | 35 ----- 13 files changed, 578 insertions(+), 585 deletions(-)
Regards,
Shawn
PATCH v3 1/4 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 | 113 +++++++++++++++++++------- drivers/mmc/host/sdhci-pltfm.c | 157 +++++++++--------------------------- drivers/mmc/host/sdhci-pltfm.h | 17 +++- drivers/mmc/host/sdhci-tegra.c | 116 ++++++++++++++++++-------- include/linux/mmc/sdhci-pltfm.h | 6 -- 9 files changed, 317 insertions(+), 219 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 +82 -31
173 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 +81 -35
196 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 v3 2/4 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 | 31 ++++++++++++++++--------------- 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, 53 insertions(+), 53 deletions(-)
drivers/mmc/host/sdhci-of-core.c +16 -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,11 @@ 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 +128,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 +137,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 +162,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 +179,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 +209,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 v3 3/4 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 | 251 ------------------------------------- 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 | 111 ++++++++++++++++- drivers/mmc/host/sdhci-pltfm.h | 12 ++ 8 files changed, 227 insertions(+), 305 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 -251
251 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 +110 -1
135 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 v3 4/4 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-imx.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-imx.c +0 -1
@@ -18,7 +18,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 <mach/hardware.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
v3 cover Consolidate sdhci pltfm & OF drivers and get them self registered
In reply to Shawn GuoQuoted 20 lines · Shawn Guo
Here are what the patch set does.
* Remove .probe and .remove hooks from
sdhci-pltfm.cand 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 ofsdhci_of_hostandsdhci_of_datatosdhci_pltfm_hostandsdhci_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 intosdhci-pltfm.c, and make OF version sdhci drivers sdhci-of-esdhc and sdhci-of-hlwd become self registered as well, so thatsdhci-of-core.candsdhci-of.hcan be removed.
* Eliminateinclude/linux/mmc/sdhci-pltfm.hwith moving stuff intodrivers/mmc/host/sdhci-pltfm.h.And the benefits we gain from the changes are:
Quoted 7 lines
* Get the sdhci device driver follow the Linux trend that driver makes the registration by its own.
*sdhci-pltfm.cbecomes 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.
Hey Chris,
Any chance we can get this series into $NEXT_KERNEL?
Thanks,
g.
Quoted 41 lines
Changes since v2:
* Drop imx mpc esdhc consolidation
* Fix checkpatch errors
* Addsdhci-of-core.ccopyright intosdhci-pltfm.cChanges since v1:
* Rebase on cjb's mmc-next tree
* Introduce helper function pairsdhci_pltfm_registerandsdhci_pltfm_unregister
* Eliminate variable 'scratch' in .remove hook to make the code look simple
* ReturnERR_PTRinsdhci_pltfm_initand use IS_ERR/PTR_ERR to check return value in .probe hooks
* CorrectMODULE_AUTHORstatement
* Split esdhc conlidation patch to ease reviewingShawn Guo (4):
mmc: sdhci: make sdhci-pltfm device drivers self registered
mmc: sdhci: eliminatesdhci_of_hostandsdhci_of_data
mmc: sdhci: make sdhci-of device drivers self registered
mmc: sdhci: merge twosdhci-pltfm.hinto onedrivers/mmc/host/Kconfig | 47 +++---- drivers/mmc/host/Makefile | 18 +-- drivers/mmc/host/sdhci-cns3xxx.c | 43 ++++++- drivers/mmc/host/sdhci-dove.c | 42 ++++++- drivers/mmc/host/sdhci-esdhc-imx.c | 114 +++++++++++----- drivers/mmc/host/sdhci-of-core.c | 250 --------------------------------- drivers/mmc/host/sdhci-of-esdhc.c | 85 +++++++++--- drivers/mmc/host/sdhci-of-hlwd.c | 66 ++++++++-- drivers/mmc/host/sdhci-of.h | 42 ------ drivers/mmc/host/sdhci-pltfm.c | 266 ++++++++++++++++++++---------------- drivers/mmc/host/sdhci-pltfm.h | 39 +++++- drivers/mmc/host/sdhci-tegra.c | 116 +++++++++++----- include/linux/mmc/sdhci-pltfm.h | 35 ----- 13 files changed, 578 insertions(+), 585 deletions(-)Regards,
Shawn
v3 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Quoted 4 lines
Any chance we can get this series into $NEXT_KERNEL?
From the looks, I think it still has problems being a module. Will try
to test it today.
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/20110527/7eced3cb/attachment.sig>
v3 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Quoted 6 lines · Wolfram Sang
Quoted 2 lines
Any chance we can get this series into $NEXT_KERNEL?
From the looks, I think it still has problems being a module. Will try to test it today.
Sorry. I forgot testing module build. I'm fixing it.
Signature · 2 lines
Regards, Shawn
v3 cover Consolidate sdhci pltfm & OF drivers and get them self registered
In reply to Grant LikelyHi Grant,
Quoted 1 line · Grant Likely
Any chance we can get this series into $NEXT_KERNEL?
I think I'd rather not in this case, hope that's okay. It hasn't seen testing in linux-next yet, there's a reasonable chance of it breaking sdhci-pltfm users in subtle ways -- we haven't had much testing from the individual -pltfm driver maintainers yet -- and the mmc merge was (relatively) huge already this cycle.
I'll certainly push it to linux-next as soon as -rc1 is released, though. Sound okay?
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
v3 cover Consolidate sdhci pltfm & OF drivers and get them self registered
Quoted 5 lines · Chris Ball
Hi Grant,
Quoted 1 line · Grant Likely
Any chance we can get this series into $NEXT_KERNEL?
Quoted 8 lines
I think I'd rather not in this case, hope that's okay. It hasn't seen testing in linux-next yet, there's a reasonable chance of it breaking sdhci-pltfm users in subtle ways -- we haven't had much testing from the individual -pltfm driver maintainers yet -- and the mmc merge was (relatively) huge already this cycle.
I'll certainly push it to linux-next as soon as -rc1 is released, though. Sound okay?
okay.
g.