Commit 7d72a1d4 authored by Ulf Hansson's avatar Ulf Hansson Committed by Russell King

ARM: 7217/1: mmc: mmci: Put power register deviations in variant data

Use variant data to store hardware controller deviations concerning
power registers to improve readability of the code.
Signed-off-by: default avatarSebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Tested-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 5074d25d
...@@ -53,6 +53,7 @@ static unsigned int fmax = 515633; ...@@ -53,6 +53,7 @@ static unsigned int fmax = 515633;
* @sdio: variant supports SDIO * @sdio: variant supports SDIO
* @st_clkdiv: true if using a ST-specific clock divider algorithm * @st_clkdiv: true if using a ST-specific clock divider algorithm
* @blksz_datactrl16: true if Block size is at b16..b30 position in datactrl register * @blksz_datactrl16: true if Block size is at b16..b30 position in datactrl register
* @pwrreg_powerup: power up value for MMCIPOWER register
*/ */
struct variant_data { struct variant_data {
unsigned int clkreg; unsigned int clkreg;
...@@ -63,18 +64,21 @@ struct variant_data { ...@@ -63,18 +64,21 @@ struct variant_data {
bool sdio; bool sdio;
bool st_clkdiv; bool st_clkdiv;
bool blksz_datactrl16; bool blksz_datactrl16;
u32 pwrreg_powerup;
}; };
static struct variant_data variant_arm = { static struct variant_data variant_arm = {
.fifosize = 16 * 4, .fifosize = 16 * 4,
.fifohalfsize = 8 * 4, .fifohalfsize = 8 * 4,
.datalength_bits = 16, .datalength_bits = 16,
.pwrreg_powerup = MCI_PWR_UP,
}; };
static struct variant_data variant_arm_extended_fifo = { static struct variant_data variant_arm_extended_fifo = {
.fifosize = 128 * 4, .fifosize = 128 * 4,
.fifohalfsize = 64 * 4, .fifohalfsize = 64 * 4,
.datalength_bits = 16, .datalength_bits = 16,
.pwrreg_powerup = MCI_PWR_UP,
}; };
static struct variant_data variant_u300 = { static struct variant_data variant_u300 = {
...@@ -83,6 +87,7 @@ static struct variant_data variant_u300 = { ...@@ -83,6 +87,7 @@ static struct variant_data variant_u300 = {
.clkreg_enable = MCI_ST_U300_HWFCEN, .clkreg_enable = MCI_ST_U300_HWFCEN,
.datalength_bits = 16, .datalength_bits = 16,
.sdio = true, .sdio = true,
.pwrreg_powerup = MCI_PWR_ON,
}; };
static struct variant_data variant_ux500 = { static struct variant_data variant_ux500 = {
...@@ -93,6 +98,7 @@ static struct variant_data variant_ux500 = { ...@@ -93,6 +98,7 @@ static struct variant_data variant_ux500 = {
.datalength_bits = 24, .datalength_bits = 24,
.sdio = true, .sdio = true,
.st_clkdiv = true, .st_clkdiv = true,
.pwrreg_powerup = MCI_PWR_ON,
}; };
static struct variant_data variant_ux500v2 = { static struct variant_data variant_ux500v2 = {
...@@ -104,6 +110,7 @@ static struct variant_data variant_ux500v2 = { ...@@ -104,6 +110,7 @@ static struct variant_data variant_ux500v2 = {
.sdio = true, .sdio = true,
.st_clkdiv = true, .st_clkdiv = true,
.blksz_datactrl16 = true, .blksz_datactrl16 = true,
.pwrreg_powerup = MCI_PWR_ON,
}; };
/* /*
...@@ -1009,6 +1016,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq) ...@@ -1009,6 +1016,7 @@ static void mmci_request(struct mmc_host *mmc, struct mmc_request *mrq)
static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{ {
struct mmci_host *host = mmc_priv(mmc); struct mmci_host *host = mmc_priv(mmc);
struct variant_data *variant = host->variant;
u32 pwr = 0; u32 pwr = 0;
unsigned long flags; unsigned long flags;
int ret; int ret;
...@@ -1035,11 +1043,15 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -1035,11 +1043,15 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
if (host->plat->vdd_handler) if (host->plat->vdd_handler)
pwr |= host->plat->vdd_handler(mmc_dev(mmc), ios->vdd, pwr |= host->plat->vdd_handler(mmc_dev(mmc), ios->vdd,
ios->power_mode); ios->power_mode);
/* The ST version does not have this, fall through to POWER_ON */
if (host->hw_designer != AMBA_VENDOR_ST) { /*
pwr |= MCI_PWR_UP; * The ST Micro variant doesn't have the PL180s MCI_PWR_UP
break; * and instead uses MCI_PWR_ON so apply whatever value is
} * configured in the variant data.
*/
pwr |= variant->pwrreg_powerup;
break;
case MMC_POWER_ON: case MMC_POWER_ON:
pwr |= MCI_PWR_ON; pwr |= MCI_PWR_ON;
break; break;
......
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