Commit 8605e7ae authored by Jisheng Zhang's avatar Jisheng Zhang Committed by Ulf Hansson

mmc: sdhci-of-esdhc: use sdhci_pltfm_init for private allocation

Commit 0e748234 ("mmc: sdhci: Add size for caller in init+register")
allows users of sdhci_pltfm to allocate private space in calls to
sdhci_pltfm_init+sdhci_pltfm_register. This patch migrates the
sdhci-of-esdhc driver to this allocation.
Signed-off-by: default avatarJisheng Zhang <jszhang@marvell.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 10f1c135
...@@ -49,7 +49,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host, ...@@ -49,7 +49,7 @@ static u32 esdhc_readl_fixup(struct sdhci_host *host,
int spec_reg, u32 value) int spec_reg, u32 value)
{ {
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_esdhc *esdhc = pltfm_host->priv; struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
u32 ret; u32 ret;
/* /*
...@@ -354,7 +354,7 @@ static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg) ...@@ -354,7 +354,7 @@ static void esdhc_le_writeb(struct sdhci_host *host, u8 val, int reg)
static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask) static void esdhc_of_adma_workaround(struct sdhci_host *host, u32 intmask)
{ {
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_esdhc *esdhc = pltfm_host->priv; struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
bool applicable; bool applicable;
dma_addr_t dmastart; dma_addr_t dmastart;
dma_addr_t dmanow; dma_addr_t dmanow;
...@@ -404,7 +404,7 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) ...@@ -404,7 +404,7 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock)
{ {
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_esdhc *esdhc = pltfm_host->priv; struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
int pre_div = 1; int pre_div = 1;
int div = 1; int div = 1;
u32 temp; u32 temp;
...@@ -569,15 +569,12 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host) ...@@ -569,15 +569,12 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
u16 host_ver; u16 host_ver;
pltfm_host = sdhci_priv(host); pltfm_host = sdhci_priv(host);
esdhc = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_esdhc), esdhc = sdhci_pltfm_priv(pltfm_host);
GFP_KERNEL);
host_ver = sdhci_readw(host, SDHCI_HOST_VERSION); host_ver = sdhci_readw(host, SDHCI_HOST_VERSION);
esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >> esdhc->vendor_ver = (host_ver & SDHCI_VENDOR_VER_MASK) >>
SDHCI_VENDOR_VER_SHIFT; SDHCI_VENDOR_VER_SHIFT;
esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK; esdhc->spec_ver = host_ver & SDHCI_SPEC_VER_MASK;
pltfm_host->priv = esdhc;
} }
static int sdhci_esdhc_probe(struct platform_device *pdev) static int sdhci_esdhc_probe(struct platform_device *pdev)
...@@ -591,9 +588,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) ...@@ -591,9 +588,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
np = pdev->dev.of_node; np = pdev->dev.of_node;
if (of_get_property(np, "little-endian", NULL)) if (of_get_property(np, "little-endian", NULL))
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata, 0); host = sdhci_pltfm_init(pdev, &sdhci_esdhc_le_pdata,
sizeof(struct sdhci_esdhc));
else else
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata, 0); host = sdhci_pltfm_init(pdev, &sdhci_esdhc_be_pdata,
sizeof(struct sdhci_esdhc));
if (IS_ERR(host)) if (IS_ERR(host))
return PTR_ERR(host); return PTR_ERR(host);
...@@ -603,7 +602,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) ...@@ -603,7 +602,7 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
sdhci_get_of_property(pdev); sdhci_get_of_property(pdev);
pltfm_host = sdhci_priv(host); pltfm_host = sdhci_priv(host);
esdhc = pltfm_host->priv; esdhc = sdhci_pltfm_priv(pltfm_host);
if (esdhc->vendor_ver == VENDOR_V_22) if (esdhc->vendor_ver == VENDOR_V_22)
host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23; host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment