* [PATCH] mmc: zynq_sdhci: Reset the host controller
@ 2025-06-25 5:26 Venkatesh Yadav Abbarapu
2025-06-25 12:22 ` Michal Simek
0 siblings, 1 reply; 2+ messages in thread
From: Venkatesh Yadav Abbarapu @ 2025-06-25 5:26 UTC (permalink / raw)
To: u-boot; +Cc: peng.fan, jh80.chung, git
Reset the host controller at the early stage of probe so that the
configuration will be done properly for reboot cases.
Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
---
drivers/mmc/zynq_sdhci.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 0e2bdab4e7e..5d797dfd0c4 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -1127,6 +1127,27 @@ static int arasan_sdhci_probe(struct udevice *dev)
if (arasan_sdhci_is_compatible(dev, SDHCI_COMPATIBLE_VERSAL_NET_EMMC))
priv->internal_phy_reg = true;
+ ret = reset_get_bulk(dev, &priv->resets);
+ if (ret == -ENOTSUPP || ret == -ENOENT) {
+ dev_warn(dev, "Reset not found\n");
+ return 0;
+ } else if (ret) {
+ dev_err(dev, "Reset failed\n");
+ return ret;
+ }
+
+ ret = reset_assert_bulk(&priv->resets);
+ if (ret) {
+ dev_err(dev, "Reset assert failed\n");
+ return ret;
+ }
+
+ ret = reset_deassert_bulk(&priv->resets);
+ if (ret) {
+ dev_err(dev, "Reset release failed\n");
+ return ret;
+ }
+
ret = clk_get_by_index(dev, 0, &clk);
if (ret < 0) {
dev_err(dev, "failed to get clock\n");
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mmc: zynq_sdhci: Reset the host controller
2025-06-25 5:26 [PATCH] mmc: zynq_sdhci: Reset the host controller Venkatesh Yadav Abbarapu
@ 2025-06-25 12:22 ` Michal Simek
0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2025-06-25 12:22 UTC (permalink / raw)
To: Venkatesh Yadav Abbarapu, u-boot; +Cc: peng.fan, jh80.chung, git
On 6/25/25 07:26, Venkatesh Yadav Abbarapu wrote:
> Reset the host controller at the early stage of probe so that the
> configuration will be done properly for reboot cases.
>
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
> ---
> drivers/mmc/zynq_sdhci.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
> index 0e2bdab4e7e..5d797dfd0c4 100644
> --- a/drivers/mmc/zynq_sdhci.c
> +++ b/drivers/mmc/zynq_sdhci.c
> @@ -1127,6 +1127,27 @@ static int arasan_sdhci_probe(struct udevice *dev)
> if (arasan_sdhci_is_compatible(dev, SDHCI_COMPATIBLE_VERSAL_NET_EMMC))
> priv->internal_phy_reg = true;
>
> + ret = reset_get_bulk(dev, &priv->resets);
> + if (ret == -ENOTSUPP || ret == -ENOENT) {
> + dev_warn(dev, "Reset not found\n");
> + return 0;
> + } else if (ret) {
> + dev_err(dev, "Reset failed\n");
> + return ret;
> + }
> +
> + ret = reset_assert_bulk(&priv->resets);
> + if (ret) {
> + dev_err(dev, "Reset assert failed\n");
> + return ret;
> + }
> +
> + ret = reset_deassert_bulk(&priv->resets);
> + if (ret) {
> + dev_err(dev, "Reset release failed\n");
> + return ret;
> + }
reset can still be optional right?
It means if reset is found you should call assert/deassert.
Not sure if there is any need to keep reset for some time.
If reset is not preset it should pass.
If reset is present but error out because whatever reason you should return error.
M
> +
> ret = clk_get_by_index(dev, 0, &clk);
> if (ret < 0) {
> dev_err(dev, "failed to get clock\n");
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-25 12:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 5:26 [PATCH] mmc: zynq_sdhci: Reset the host controller Venkatesh Yadav Abbarapu
2025-06-25 12:22 ` Michal Simek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox