linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org,
	patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/5] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
Date: Thu, 31 Mar 2011 09:34:33 -0600	[thread overview]
Message-ID: <20110331153433.GA26709@ponder.secretlab.ca> (raw)
In-Reply-To: <1301042931-4869-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On Fri, Mar 25, 2011 at 04:48:48PM +0800, Shawn Guo wrote:
> The patch is to migrate 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.
> 
> Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

Reviewed-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>

> ---
>  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(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
> index dd84124..a6c0132 100644
> --- a/drivers/mmc/host/sdhci-of-core.c
> +++ b/drivers/mmc/host/sdhci-of-core.c
> @@ -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;
>  	}
> @@ -128,9 +128,9 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
>  				 const struct of_device_id *match)
>  {
>  	struct device_node *np = ofdev->dev.of_node;
> -	struct sdhci_of_data *sdhci_of_data = match->data;
> +	struct sdhci_pltfm_data *pdata = match->data;
>  	struct sdhci_host *host;
> -	struct sdhci_of_host *of_host;
> +	struct sdhci_pltfm_host *pltfm_host;
>  	const __be32 *clk;
>  	int size;
>  	int ret;
> @@ -138,11 +138,11 @@ static int __devinit sdhci_of_probe(struct platform_device *ofdev,
>  	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);
> @@ -158,9 +158,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))
> @@ -175,7 +175,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)
> @@ -205,12 +205,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", },
>  	{},
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index fcd0e1f..702a98b 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -60,30 +60,32 @@ 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 = {
>  	.quirks = ESDHC_DEFAULT_QUIRKS,
> -	.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,
>  };
> diff --git a/drivers/mmc/host/sdhci-of-hlwd.c b/drivers/mmc/host/sdhci-of-hlwd.c
> index 68ddb75..380e896 100644
> --- a/drivers/mmc/host/sdhci-of-hlwd.c
> +++ b/drivers/mmc/host/sdhci-of-hlwd.c
> @@ -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,
>  };
> diff --git a/drivers/mmc/host/sdhci-of.h b/drivers/mmc/host/sdhci-of.h
> index ad09ad9..5bdb5e7 100644
> --- a/drivers/mmc/host/sdhci-of.h
> +++ b/drivers/mmc/host/sdhci-of.h
> @@ -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 */
> diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
> index a3e4be0..12afe86 100644
> --- a/drivers/mmc/host/sdhci-pltfm.h
> +++ b/drivers/mmc/host/sdhci-pltfm.h
> @@ -19,6 +19,10 @@
>  struct sdhci_pltfm_host {
>  	struct clk *clk;
>  	u32 scratchpad; /* 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,
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> linaro-dev mailing list
> linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org
> http://lists.linaro.org/mailman/listinfo/linaro-dev

  parent reply	other threads:[~2011-03-31 15:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25  8:48 [PATCH 0/5] consolidate sdhci pltfm & OF drivers and get them self registered Shawn Guo
     [not found] ` <1301042931-4869-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-25  8:48   ` [PATCH 1/5] mmc: sdhci: make sdhci-pltfm device drivers " Shawn Guo
     [not found]     ` <1301042931-4869-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-31 15:33       ` Grant Likely
     [not found]         ` <20110331153322.GA26612-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2011-04-01  6:10           ` Shawn Guo
2011-04-19 10:20       ` Wolfram Sang
2011-04-21  8:03         ` Shawn Guo
2011-04-21  9:57           ` Wolfram Sang
2011-03-25  8:48   ` [PATCH 2/5] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data Shawn Guo
     [not found]     ` <1301042931-4869-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-31 15:34       ` Grant Likely [this message]
2011-04-19 10:20       ` Wolfram Sang
     [not found]         ` <20110419102053.GC4164-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-04-21  8:10           ` Shawn Guo
2011-03-25  8:48   ` [PATCH 3/5] mmc: sdhci: make sdhci-of device drivers self registered Shawn Guo
     [not found]     ` <1301042931-4869-4-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-03-31 15:38       ` Grant Likely
2011-04-19 10:21     ` Wolfram Sang
2011-04-21  8:17       ` Shawn Guo
2011-03-25  8:48   ` [PATCH 4/5] mmc: sdhci: consolidate sdhci-of-esdhc and sdhci-esdhc-imx Shawn Guo
2011-03-31 15:53     ` Grant Likely
2011-04-01  6:18       ` Shawn Guo
     [not found]     ` <1301042931-4869-5-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-04-19 10:21       ` Wolfram Sang
2011-04-21  8:53         ` Shawn Guo
2011-03-25  8:48   ` [PATCH 5/5] mmc: sdhci: merge two sdhci-pltfm.h into one Shawn Guo
2011-03-31 15:54     ` Grant Likely
2011-04-19 10:21     ` Wolfram Sang
2011-03-31  4:25 ` [PATCH 0/5] consolidate sdhci pltfm & OF drivers and get them self registered Shawn Guo
     [not found]   ` <20110331042507.GA21846-+NayF8gZjK2ctlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2011-03-31  4:56     ` Grant Likely
2011-03-31 16:36 ` Chris Ball
2011-04-13  6:26   ` Shawn Guo
2011-04-19 10:20 ` Wolfram Sang
2011-04-19 12:47   ` Kyungmin Park
2011-04-19 17:47     ` Wolfram Sang
     [not found]       ` <20110419174712.GA29314-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2011-04-20  4:23         ` Kyungmin Park
2011-04-21  7:48   ` Shawn Guo
2011-04-26 13:20     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110331153433.GA26709@ponder.secretlab.ca \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).