Commit 4956e109 authored by Rabin Vincent's avatar Rabin Vincent Committed by Russell King

ARM: 6244/1: mmci: add variant data and default MCICLOCK support

Add a variant_data structure to handle the differences between the
various variants of this peripheral.  Add a first quirk for a default
MCICLOCK value, required on the Ux500 variant where the enable bit needs
to be always set, since it controls access to some registers.
Acked-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarRabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent bb8f563c
...@@ -36,12 +36,30 @@ ...@@ -36,12 +36,30 @@
static unsigned int fmax = 515633; static unsigned int fmax = 515633;
/**
* struct variant_data - MMCI variant-specific quirks
* @clkreg: default value for MCICLOCK register
*/
struct variant_data {
unsigned int clkreg;
};
static struct variant_data variant_arm = {
};
static struct variant_data variant_u300 = {
};
static struct variant_data variant_ux500 = {
.clkreg = MCI_CLK_ENABLE,
};
/* /*
* This must be called with host->lock held * This must be called with host->lock held
*/ */
static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired) static void mmci_set_clkreg(struct mmci_host *host, unsigned int desired)
{ {
u32 clk = 0; struct variant_data *variant = host->variant;
u32 clk = variant->clkreg;
if (desired) { if (desired) {
if (desired >= host->mclk) { if (desired >= host->mclk) {
...@@ -563,6 +581,7 @@ static const struct mmc_host_ops mmci_ops = { ...@@ -563,6 +581,7 @@ static const struct mmc_host_ops mmci_ops = {
static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
{ {
struct mmci_platform_data *plat = dev->dev.platform_data; struct mmci_platform_data *plat = dev->dev.platform_data;
struct variant_data *variant = id->data;
struct mmci_host *host; struct mmci_host *host;
struct mmc_host *mmc; struct mmc_host *mmc;
int ret; int ret;
...@@ -606,6 +625,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) ...@@ -606,6 +625,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id)
goto clk_free; goto clk_free;
host->plat = plat; host->plat = plat;
host->variant = variant;
host->mclk = clk_get_rate(host->clk); host->mclk = clk_get_rate(host->clk);
/* /*
* According to the spec, mclk is max 100 MHz, * According to the spec, mclk is max 100 MHz,
...@@ -845,19 +865,28 @@ static struct amba_id mmci_ids[] = { ...@@ -845,19 +865,28 @@ static struct amba_id mmci_ids[] = {
{ {
.id = 0x00041180, .id = 0x00041180,
.mask = 0x000fffff, .mask = 0x000fffff,
.data = &variant_arm,
}, },
{ {
.id = 0x00041181, .id = 0x00041181,
.mask = 0x000fffff, .mask = 0x000fffff,
.data = &variant_arm,
}, },
/* ST Micro variants */ /* ST Micro variants */
{ {
.id = 0x00180180, .id = 0x00180180,
.mask = 0x00ffffff, .mask = 0x00ffffff,
.data = &variant_u300,
}, },
{ {
.id = 0x00280180, .id = 0x00280180,
.mask = 0x00ffffff, .mask = 0x00ffffff,
.data = &variant_u300,
},
{
.id = 0x00480180,
.mask = 0x00ffffff,
.data = &variant_ux500,
}, },
{ 0, 0 }, { 0, 0 },
}; };
......
...@@ -145,6 +145,7 @@ ...@@ -145,6 +145,7 @@
#define NR_SG 16 #define NR_SG 16
struct clk; struct clk;
struct variant_data;
struct mmci_host { struct mmci_host {
void __iomem *base; void __iomem *base;
...@@ -164,6 +165,7 @@ struct mmci_host { ...@@ -164,6 +165,7 @@ struct mmci_host {
unsigned int cclk; unsigned int cclk;
u32 pwr; u32 pwr;
struct mmci_platform_data *plat; struct mmci_platform_data *plat;
struct variant_data *variant;
u8 hw_designer; u8 hw_designer;
u8 hw_revision:4; u8 hw_revision:4;
......
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