Re: [PATCH 2/5] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data

2011-04-21 Thread Shawn Guo
On Tue, Apr 19, 2011 at 12:20:53PM +0200, Wolfram Sang wrote:
 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@linaro.org
  ---
 
 [...]
 
  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;
 
 xfer_mode_shadow can be merged into scratchpad. They both fix the same
 issue.
 
Yeah.

-- 
Regards,
Shawn

--
To unsubscribe from this list: send the line unsubscribe linux-mmc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/5] mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data

2011-03-31 Thread Grant Likely
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@linaro.org

Reviewed-by: Grant Likely grant.lik...@secretlab.ca

 ---
  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