u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: cadence-qspi: Make reset control optinal
@ 2022-02-22 16:23 Christian Gmeiner
  2022-02-24  8:09 ` Jagan Teki
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Gmeiner @ 2022-02-22 16:23 UTC (permalink / raw)
  To: u-boot; +Cc: p.yadav, Christian Gmeiner, Jagan Teki

In the TI am65 device tree files there is no reset defined. Also
the Linux kernel driver uses devm_reset_control_get_optional_exclusive(..)
to get the reset.

Lets do the same as the kernel does and make thr reset optinal.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
 drivers/spi/cadence_qspi.c | 14 ++++++++------
 drivers/spi/cadence_qspi.h |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index d1b3808c4d..db680618ee 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -201,11 +201,9 @@ static int cadence_spi_probe(struct udevice *bus)
 		}
 	}
 
-	ret = reset_get_bulk(bus, &priv->resets);
-	if (ret)
-		dev_warn(bus, "Can't get reset: %d\n", ret);
-	else
-		reset_deassert_bulk(&priv->resets);
+	priv->resets = devm_reset_bulk_get_optional(bus);
+	if (priv->resets)
+		reset_deassert_bulk(priv->resets);
 
 	if (!priv->qspi_is_init) {
 		cadence_qspi_apb_controller_init(plat);
@@ -220,8 +218,12 @@ static int cadence_spi_probe(struct udevice *bus)
 static int cadence_spi_remove(struct udevice *dev)
 {
 	struct cadence_spi_priv *priv = dev_get_priv(dev);
+	int ret = 0;
+
+	if (priv->resets)
+		ret = reset_release_bulk(priv->resets);
 
-	return reset_release_bulk(&priv->resets);
+	return ret;
 }
 
 static int cadence_spi_set_mode(struct udevice *bus, uint mode)
diff --git a/drivers/spi/cadence_qspi.h b/drivers/spi/cadence_qspi.h
index 49b401168f..19345cac5a 100644
--- a/drivers/spi/cadence_qspi.h
+++ b/drivers/spi/cadence_qspi.h
@@ -56,7 +56,7 @@ struct cadence_spi_priv {
 	unsigned int	qspi_calibrated_cs;
 	unsigned int	previous_hz;
 
-	struct reset_ctl_bulk resets;
+	struct reset_ctl_bulk *resets;
 };
 
 /* Functions call declaration */
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: cadence-qspi: Make reset control optinal
  2022-02-22 16:23 [PATCH] spi: cadence-qspi: Make reset control optinal Christian Gmeiner
@ 2022-02-24  8:09 ` Jagan Teki
  0 siblings, 0 replies; 2+ messages in thread
From: Jagan Teki @ 2022-02-24  8:09 UTC (permalink / raw)
  To: Christian Gmeiner; +Cc: u-boot, p.yadav

On Tue, Feb 22, 2022 at 9:53 PM Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
>
> In the TI am65 device tree files there is no reset defined. Also
> the Linux kernel driver uses devm_reset_control_get_optional_exclusive(..)
> to get the reset.
>
> Lets do the same as the kernel does and make thr reset optinal.
>
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---

Applied to u-boot-spi/master

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-24  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 16:23 [PATCH] spi: cadence-qspi: Make reset control optinal Christian Gmeiner
2022-02-24  8:09 ` Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).