Global variables are bad. Get rid of this particular one, so we can
correctly instantiate multiple atmel mci interfaces, without having
them interfere with one another.
Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
struct atmel_mci_priv {
struct mmc_config cfg;
struct atmel_mci *mci;
+ unsigned int initialized:1;
};
-static int initialized = 0;
-
/* Read Atmel MCI IP version */
static unsigned int atmel_mci_get_version(struct atmel_mci *mci)
{
udelay(50);
- initialized = 1;
+ priv->initialized = 1;
}
/* Return the CMDR with flags for a given command and data packet */
u32 error_flags = 0;
u32 status;
- if (!initialized) {
+ if (!priv->initialized) {
puts ("MCI not initialized!\n");
return COMM_ERR;
}
cfg->ops = &atmel_mci_ops;
priv->mci = (struct atmel_mci *)regs;
+ priv->initialized = 0;
/* need to be able to pass these in on a board by board basis */
cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;