From: Yangbo Lu <yangbo.lu@nxp.com>
To: u-boot@lists.denx.de
Subject: [v4, 01/11] mmc: add a reinit() API
Date: Tue, 1 Sep 2020 16:57:59 +0800 [thread overview]
Message-ID: <20200901085809.48660-2-yangbo.lu@nxp.com> (raw)
In-Reply-To: <20200901085809.48660-1-yangbo.lu@nxp.com>
For DM_MMC, the controller re-initialization is needed to
clear old configuration for mmc rescan.
Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
---
Changes for v2:
- None.
Changes for v3:
- None.
Changes for v4:
- Added Reviewed-by.
---
drivers/mmc/mmc-uclass.c | 15 +++++++++++++++
drivers/mmc/mmc.c | 8 ++++++--
include/mmc.h | 10 ++++++++++
3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 90690c8..b90e1ee 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -171,6 +171,21 @@ int mmc_deferred_probe(struct mmc *mmc)
return dm_mmc_deferred_probe(mmc->dev);
}
+int dm_mmc_reinit(struct udevice *dev)
+{
+ struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+ if (ops->reinit)
+ return ops->reinit(dev);
+
+ return 0;
+}
+
+int mmc_reinit(struct mmc *mmc)
+{
+ return dm_mmc_reinit(mmc->dev);
+}
+
int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)
{
int val;
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d79cdef..0727505 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -2816,13 +2816,17 @@ int mmc_get_op_cond(struct mmc *mmc)
return err;
#if CONFIG_IS_ENABLED(DM_MMC)
- /* The device has already been probed ready for use */
+ /*
+ * Re-initialization is needed to clear old configuration for
+ * mmc rescan.
+ */
+ err = mmc_reinit(mmc);
#else
/* made sure it's not NULL earlier */
err = mmc->cfg->ops->init(mmc);
+#endif
if (err)
return err;
-#endif
mmc->ddr_mode = 0;
retry:
diff --git a/include/mmc.h b/include/mmc.h
index 8256219..161b8bc 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -422,6 +422,14 @@ struct dm_mmc_ops {
*/
int (*deferred_probe)(struct udevice *dev);
/**
+ * reinit() - Re-initialization to clear old configuration for
+ * mmc rescan.
+ *
+ * @dev: Device to reinit
+ * @return 0 if Ok, -ve if error
+ */
+ int (*reinit)(struct udevice *dev);
+ /**
* send_cmd() - Send a command to the MMC device
*
* @dev: Device to receive the command
@@ -518,6 +526,7 @@ int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
int dm_mmc_wait_dat0(struct udevice *dev, int state, int timeout_us);
int dm_mmc_host_power_cycle(struct udevice *dev);
int dm_mmc_deferred_probe(struct udevice *dev);
+int dm_mmc_reinit(struct udevice *dev);
int dm_mmc_get_b_max(struct udevice *dev, void *dst, lbaint_t blkcnt);
/* Transition functions for compatibility */
@@ -529,6 +538,7 @@ int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us);
int mmc_set_enhanced_strobe(struct mmc *mmc);
int mmc_host_power_cycle(struct mmc *mmc);
int mmc_deferred_probe(struct mmc *mmc);
+int mmc_reinit(struct mmc *mmc);
int mmc_get_b_max(struct mmc *mmc, void *dst, lbaint_t blkcnt);
#else
--
2.7.4
next prev parent reply other threads:[~2020-09-01 8:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200901090556epcas1p46358a60233c9465e6900ffb0819c9e62@epcas1p4.samsung.com>
2020-09-01 8:57 ` [v4, 00/11] mmc: fsl_esdhc: support eMMC HS200/HS400 modes Yangbo Lu
2020-09-01 8:57 ` Yangbo Lu [this message]
2020-09-01 8:58 ` [v4, 02/11] mmc: fsl_esdhc: add a reinit() callback Yangbo Lu
2020-09-01 8:58 ` [v4, 03/11] mmc: fsl_esdhc: support tuning for eMMC HS200 Yangbo Lu
2020-09-01 8:58 ` [v4, 04/11] mmc: fsl_esdhc: clean TBCTL[TB_EN] manually during init Yangbo Lu
2020-09-01 8:58 ` [v4, 05/11] mmc: add a hs400_tuning flag Yangbo Lu
2020-09-01 8:58 ` [v4, 06/11] mmc: add a mmc_hs400_prepare_ddr() interface Yangbo Lu
2020-09-01 8:58 ` [v4, 07/11] mmc: fsl_esdhc: support eMMC HS400 mode Yangbo Lu
2020-09-01 8:58 ` [v4, 08/11] mmc: fsl_esdhc: fix mmc->clock with actual clock Yangbo Lu
2020-09-01 8:58 ` [v4, 09/11] mmc: fsl_esdhc: fix eMMC HS400 stability issue Yangbo Lu
2020-09-01 8:58 ` [v4, 10/11] arm: dts: lx2160ardb: support eMMC HS400 mode Yangbo Lu
2020-09-01 8:58 ` [v4, 11/11] configs: lx2160ardb: enable eMMC HS400 mode support Yangbo Lu
2020-09-07 3:19 ` [v4, 00/11] mmc: fsl_esdhc: support eMMC HS200/HS400 modes Y.b. Lu
2020-09-07 7:21 ` Jaehoon Chung
2020-09-08 1:08 ` Peng Fan
2020-09-08 7:17 ` Stefan Roese
2020-09-10 5:50 ` Jaehoon Chung
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200901085809.48660-2-yangbo.lu@nxp.com \
--to=yangbo.lu@nxp.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox