diff options
author | Marek Vasut <marex@denx.de> | 2013-01-22 15:01:03 +0000 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2013-01-28 11:43:01 +0100 |
commit | 90bc2bf29780c2d238bb0c898d3a6cc6ec73922a (patch) | |
tree | 4d15ab680f5e6e0ac05862921a4000b78d10783f /drivers | |
parent | 8000d8a8260c95727b6357a638a5e80625d7a899 (diff) | |
download | u-boot-imx-90bc2bf29780c2d238bb0c898d3a6cc6ec73922a.zip u-boot-imx-90bc2bf29780c2d238bb0c898d3a6cc6ec73922a.tar.gz u-boot-imx-90bc2bf29780c2d238bb0c898d3a6cc6ec73922a.tar.bz2 |
mxs: mmc: Allow overriding default card detect implementation
Some MXS based boards do not implement the card-detect signal. Allow
user to specify alternate card-detect implementation.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/mxsmmc.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c index 9d71202..023dbd5 100644 --- a/drivers/mmc/mxsmmc.c +++ b/drivers/mmc/mxsmmc.c @@ -49,12 +49,23 @@ struct mxsmmc_priv { struct mxs_ssp_regs *regs; uint32_t buswidth; int (*mmc_is_wp)(int); + int (*mmc_cd)(int); struct mxs_dma_desc *desc; }; #define MXSMMC_MAX_TIMEOUT 10000 #define MXSMMC_SMALL_TRANSFER 512 +static int mxsmmc_cd(struct mxsmmc_priv *priv) +{ + struct mxs_ssp_regs *ssp_regs = priv->regs; + + if (priv->mmc_cd) + return priv->mmc_cd(priv->id); + + return !(readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_CARD_DETECT); +} + static int mxsmmc_send_cmd_pio(struct mxsmmc_priv *priv, struct mmc_data *data) { struct mxs_ssp_regs *ssp_regs = priv->regs; @@ -166,7 +177,7 @@ mxsmmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } /* See if card is present */ - if (readl(&ssp_regs->hw_ssp_status) & SSP_STATUS_CARD_DETECT) { + if (!mxsmmc_cd(priv)) { printf("MMC%d: No card detected!\n", mmc->block_dev.dev); return NO_CARD_ERR; } @@ -357,7 +368,7 @@ static int mxsmmc_init(struct mmc *mmc) return 0; } -int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int)) +int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int), int (*cd)(int)) { struct mmc *mmc = NULL; struct mxsmmc_priv *priv = NULL; @@ -395,6 +406,7 @@ int mxsmmc_initialize(bd_t *bis, int id, int (*wp)(int)) return ret; priv->mmc_is_wp = wp; + priv->mmc_cd = cd; priv->id = id; priv->regs = mxs_ssp_regs_by_bus(id); |