Skip to content

Commit

Permalink
mmc: sdhci: eliminate sdhci_of_host and sdhci_of_data
Browse files Browse the repository at this point in the history
The 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.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
  • Loading branch information
Shawn Guo authored and Chris Ball committed Jul 20, 2011
1 parent 85d6509 commit e307148
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 291 deletions.
253 changes: 0 additions & 253 deletions drivers/mmc/host/sdhci-of-core.c

This file was deleted.

36 changes: 19 additions & 17 deletions drivers/mmc/host/sdhci-of-esdhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
20 changes: 11 additions & 9 deletions drivers/mmc/host/sdhci-of-hlwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
15 changes: 3 additions & 12 deletions drivers/mmc/host/sdhci-of.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
4 changes: 4 additions & 0 deletions drivers/mmc/host/sdhci-pltfm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e307148

Please sign in to comment.