Skip to contentSkip to conversation

reset: Introduce reset_reset.*() API

PATCH Superseded Michal Simek 2 participants 13 messages Apr 30 – May 4

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Michal Simek

author maintainer
#0 lore raw

cover reset: Introduce reset_reset.*() API

Hi,

the patchset is adding reset_reset.*() interface which is common in Linux. And implement it for ZynqMP.

Thanks,
Michal

Michal Simek (4):
reset: Add reset_reset() and reset_reset_bulk() API
reset: Add sandbox tests for reset_reset() and reset_reset_bulk()
spi: cadence: Use reset_reset_bulk() for proper reset cycling
reset: zynqmp: Implement rst_reset using PM_RESET_ACTION_PULSE

 arch/sandbox/include/asm/reset.h   |  2 ++
 drivers/reset/reset-uclass.c       | 30 +++++++++++++++++
 drivers/reset/reset-zynqmp.c       | 11 +++++++
 drivers/reset/sandbox-reset-test.c | 14 ++++++++
 drivers/spi/cadence_qspi.c         | 19 ++---------
 include/reset-uclass.h             | 11 +++++++
 include/reset.h                    | 35 ++++++++++++++++++++
 test/dm/reset.c                    | 53 ++++++++++++++++++++++++++++++
 8 files changed, 158 insertions(+), 17 deletions(-)
Signature · 3 lines
2.43.0

base-commit: 4885b1983ec158ed98e727091be38f7de104108e
author maintainer
#1 lore raw

PATCH 1/4 reset: Add reset_reset() and reset_reset_bulk() API

Add reset_reset() and reset_reset_bulk() functions to the reset controller API. These functions assert and then deassert reset signals in a single call, providing a convenient way to pulse/toggle a reset line.

This mirrors the Linux kernel's reset_control_reset() and reset_control_bulk_reset() APIs. The new functions are useful for drivers that need to cycle a reset line during initialization or error recovery.

---

 drivers/reset/reset-uclass.c | 30 ++++++++++++++++++++++++++++++
 include/reset-uclass.h       | 11 +++++++++++
 include/reset.h              | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
drivers/reset/reset-uclass.c +30 -0
index fe4cebf54f15..b26712abc366 100644
@@ -225,6 +225,36 @@ int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
 	return 0;
 }
 
+int reset_reset(struct reset_ctl *reset_ctl)
+{
+	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+	int ret;
+
+	debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
+
+	if (ops->rst_reset)
+		return ops->rst_reset(reset_ctl);
+
+	ret = reset_assert(reset_ctl);
+	if (ret < 0)
+		return ret;
+
+	return reset_deassert(reset_ctl);
+}
+
+int reset_reset_bulk(struct reset_ctl_bulk *bulk)
+{
+	int i, ret;
+
+	for (i = 0; i < bulk->count; i++) {
+		ret = reset_reset(&bulk->resets[i]);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
 int reset_status(struct reset_ctl *reset_ctl)
 {
 	struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
include/reset-uclass.h +11 -0
index 9a0696dd1e3b..3ff665c947ea 100644
@@ -76,6 +76,17 @@ struct reset_ops {
 	 * @return 0 if OK, or a negative error code.
 	 */
 	int (*rst_deassert)(struct reset_ctl *reset_ctl);
+	/**
+	 * rst_reset - Reset a HW module.
+	 *
+	 * This optional function triggers a reset pulse on the reset line,
+	 * asserting and then deasserting the reset signal. If not implemented,
+	 * the reset core will use rst_assert followed by rst_deassert.
+	 *
+	 * @reset_ctl:	The reset signal to pulse.
+	 * @return 0 if OK, or a negative error code.
+	 */
+	int (*rst_reset)(struct reset_ctl *reset_ctl);
 	/**
 	 * rst_status - Check reset signal status.
 	 *
include/reset.h +35 -0
index 036a786d2ace..cd10596825a3 100644
@@ -320,6 +320,31 @@ int reset_deassert(struct reset_ctl *reset_ctl);
  */
 int reset_deassert_bulk(struct reset_ctl_bulk *bulk);
 
+/**
+ * reset_reset - Reset a HW module by asserting and deasserting a reset signal.
+ *
+ * This function will assert and then deassert the specified reset signal,
+ * thus resetting the affected HW module. This is a convenience function
+ * that combines reset_assert() and reset_deassert().
+ *
+ * @reset_ctl:	A reset control struct that was previously successfully
+ *		requested by reset_get_by_*().
+ * Return: 0 if OK, or a negative error code.
+ */
+int reset_reset(struct reset_ctl *reset_ctl);
+
+/**
+ * reset_reset_bulk - Reset all HW modules in a reset control bulk struct.
+ *
+ * This function will assert and then deassert all reset signals in the
+ * specified reset control bulk struct, thus resetting all affected HW modules.
+ *
+ * @bulk:	A reset control bulk struct that was previously successfully
+ *		requested by reset_get_bulk().
+ * Return: 0 if OK, or a negative error code.
+ */
+int reset_reset_bulk(struct reset_ctl_bulk *bulk);
+
 /**
  * rst_status - Check reset signal status.
  *
@@ -443,6 +468,16 @@ static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
 	return 0;
 }
 
+static inline int reset_reset(struct reset_ctl *reset_ctl)
+{
+	return 0;
+}
+
+static inline int reset_reset_bulk(struct reset_ctl_bulk *bulk)
+{
+	return 0;
+}
+
 static inline int reset_status(struct reset_ctl *reset_ctl)
 {
 	return -ENOTSUPP;
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 1/4] reset: Add reset_reset() and reset_reset_bulk() API

Hi Michal,

Quoted 27 lines · Michal Simek

reset: Add reset_reset() and reset_reset_bulk() API

Add reset_reset() and reset_reset_bulk() functions to the reset controller API. These functions assert and then deassert reset signals in a single call, providing a convenient way to pulse/toggle a reset line.

This mirrors the Linux kernel's reset_control_reset() and reset_control_bulk_reset() APIs. The new functions are useful for drivers that need to cycle a reset line during initialization or error recovery.

drivers/reset/reset-uclass.c | 30 ++++++++++++++++++++++++++++++

 include/reset-uclass.h       | 11 +++++++++++
 include/reset.h              | 35 +++++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)
drivers/reset/reset-uclass.c +6 -0
@@ -225,6 +225,36 @@ int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+int reset_reset(struct reset_ctl *reset_ctl)
+{
+     struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+     int ret;
+
+     debug('%s(reset_ctl=%p)\n', __func__, reset_ctl);

drivers/reset/reset-uclass.c int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 240

Quoted 10 lines
drivers/reset/reset-uclass.c +10 -0
+
+     if (ops->rst_reset)
+             return ops->rst_reset(reset_ctl);
+
+     ret = reset_assert(reset_ctl);
+     if (ret < 0)
+             return ret;
+
+     return reset_deassert(reset_ctl);
+}

Will this provide a long-enough pulse on real hardware?

include/reset.h static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 471

Quoted 6 lines
include/reset.h +4 -0
@@ -443,6 +468,16 @@ static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+static inline int reset_reset(struct reset_ctl *reset_ctl)
+{
+     return 0;
+}

Just to check - this matches the existing assert/deassert stubs, silently succeeding with !CONFIG_DM_RESET: is that intended? Should we return -NOSYS here?

Regards,
Simon

author maintainer
#3 lore raw

Re: [PATCH 1/4] reset: Add reset_reset() and reset_reset_bulk() API

Quoted 34 lines · Simon Glass

Hi Michal,

Quoted 31 lines · Michal Simek

reset: Add reset_reset() and reset_reset_bulk() API

Add reset_reset() and reset_reset_bulk() functions to the reset controller API. These functions assert and then deassert reset signals in a single call, providing a convenient way to pulse/toggle a reset line.

This mirrors the Linux kernel's reset_control_reset() and reset_control_bulk_reset() APIs. The new functions are useful for drivers that need to cycle a reset line during initialization or error recovery.

drivers/reset/reset-uclass.c | 30 ++++++++++++++++++++++++++++++

  include/reset-uclass.h       | 11 +++++++++++
  include/reset.h              | 35 +++++++++++++++++++++++++++++++++++
  3 files changed, 76 insertions(+)
drivers/reset/reset-uclass.c +10 -0
@@ -225,6 +225,36 @@ int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+int reset_reset(struct reset_ctl *reset_ctl)
+{
+     struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+     int ret;
+
+     debug('%s(reset_ctl=%p)\n', __func__, reset_ctl);
+
+     if (ops->rst_reset)
+             return ops->rst_reset(reset_ctl);
+
Quoted 8 lines

drivers/reset/reset-uclass.c int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 243

Quoted 6 lines
drivers/reset/reset-uclass.c +6 -0
+     ret = reset_assert(reset_ctl);
+     if (ret < 0)
+             return ret;
+
+     return reset_deassert(reset_ctl);
+}

Will this provide a long-enough pulse on real hardware?

In our case delays are handled by firmware itself because we are asking firmware to do it. It means no issue on our platform.

GPIO based reset can be also handled via gpio delay driver.
But I can add there one more parameter to also pass waiting delay. What do you think?

Quoted 11 lines

include/reset.h static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 471

Quoted 7 lines
include/reset.h +4 -0
@@ -443,6 +468,16 @@ static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+static inline int reset_reset(struct reset_ctl *reset_ctl)
+{
+     return 0;
+}

Just to check - this matches the existing assert/deassert stubs, silently succeeding with !CONFIG_DM_RESET: is that intended? Should we return -NOSYS here?

Will look at this one.

M

#4 lore raw

Re: [PATCH 1/4] reset: Add reset_reset() and reset_reset_bulk() API

Hi Michal,

Quoted 47 lines · Michal Simek
Quoted 34 lines · Simon Glass

Hi Michal,

Quoted 31 lines · Michal Simek

reset: Add reset_reset() and reset_reset_bulk() API

Add reset_reset() and reset_reset_bulk() functions to the reset controller API. These functions assert and then deassert reset signals in a single call, providing a convenient way to pulse/toggle a reset line.

This mirrors the Linux kernel's reset_control_reset() and reset_control_bulk_reset() APIs. The new functions are useful for drivers that need to cycle a reset line during initialization or error recovery.

drivers/reset/reset-uclass.c | 30 ++++++++++++++++++++++++++++++

  include/reset-uclass.h       | 11 +++++++++++
  include/reset.h              | 35 +++++++++++++++++++++++++++++++++++
  3 files changed, 76 insertions(+)
drivers/reset/reset-uclass.c +10 -0
@@ -225,6 +225,36 @@ int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+int reset_reset(struct reset_ctl *reset_ctl)
+{
+     struct reset_ops *ops = reset_dev_ops(reset_ctl->dev);
+     int ret;
+
+     debug('%s(reset_ctl=%p)\n', __func__, reset_ctl);
+
+     if (ops->rst_reset)
+             return ops->rst_reset(reset_ctl);
+
Quoted 8 lines

drivers/reset/reset-uclass.c int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 243

Quoted 6 lines
drivers/reset/reset-uclass.c +6 -0
+     ret = reset_assert(reset_ctl);
+     if (ret < 0)
+             return ret;
+
+     return reset_deassert(reset_ctl);
+}

Will this provide a long-enough pulse on real hardware?

Quoted 6 lines

In our case delays are handled by firmware itself because we are asking firmware to do it. It means no issue on our platform.

GPIO based reset can be also handled via gpio delay driver.
But I can add there one more parameter to also pass waiting delay. What do you think?

Seems like a good idea to me.

Quoted 14 lines
Quoted 13 lines

include/reset.h static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk) · line 471

Quoted 9 lines
include/reset.h +4 -0
@@ -443,6 +468,16 @@ static inline int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
+static inline int reset_reset(struct reset_ctl *reset_ctl)
+{
+     return 0;
+}

Just to check - this matches the existing assert/deassert stubs, silently succeeding with !CONFIG_DM_RESET: is that intended? Should we return -NOSYS here?

Quoted 2 lines

Will look at this one.

I meant -ENOSYS of course. We have that in clk.h for example.

Regards,
Simon

author maintainer
#5 lore raw

PATCH 2/4 reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

In reply to Michal Simek

Add DM test coverage for the new reset_reset() and reset_reset_bulk() API functions. The tests exercise the assert + deassert fallback path since the sandbox reset driver does not implement the rst_reset op.

---

 arch/sandbox/include/asm/reset.h   |  2 ++
 drivers/reset/sandbox-reset-test.c | 14 ++++++++
 test/dm/reset.c                    | 53 ++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)
arch/sandbox/include/asm/reset.h +2 -0
index f0709b41c09f..5b48c2fe7bbf 100644
@@ -19,6 +19,8 @@ int sandbox_reset_test_assert(struct udevice *dev);
 int sandbox_reset_test_assert_bulk(struct udevice *dev);
 int sandbox_reset_test_deassert(struct udevice *dev);
 int sandbox_reset_test_deassert_bulk(struct udevice *dev);
+int sandbox_reset_test_reset(struct udevice *dev);
+int sandbox_reset_test_reset_bulk(struct udevice *dev);
 int sandbox_reset_test_free(struct udevice *dev);
 int sandbox_reset_test_release_bulk(struct udevice *dev);
 
drivers/reset/sandbox-reset-test.c +14 -0
index dfacb764bc77..1f599d629eb9 100644
@@ -96,6 +96,20 @@ int sandbox_reset_test_deassert_bulk(struct udevice *dev)
 	return reset_deassert_bulk(sbrt->bulkp);
 }
 
+int sandbox_reset_test_reset(struct udevice *dev)
+{
+	struct sandbox_reset_test *sbrt = dev_get_priv(dev);
+
+	return reset_reset(sbrt->ctlp);
+}
+
+int sandbox_reset_test_reset_bulk(struct udevice *dev)
+{
+	struct sandbox_reset_test *sbrt = dev_get_priv(dev);
+
+	return reset_reset_bulk(sbrt->bulkp);
+}
+
 int sandbox_reset_test_free(struct udevice *dev)
 {
 	struct sandbox_reset_test *sbrt = dev_get_priv(dev);
test/dm/reset.c +53 -0

59 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on v1 2/4
#6 lore raw

Re: [PATCH 2/4] reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

Hi Michal,

Quoted 15 lines · Michal Simek

reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

Add DM test coverage for the new reset_reset() and reset_reset_bulk() API functions. The tests exercise the assert + deassert fallback path since the sandbox reset driver does not implement the rst_reset op.

arch/sandbox/include/asm/reset.h | 2 ++

 drivers/reset/sandbox-reset-test.c | 14 ++++++++++
 test/dm/reset.c                    | 53 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)

test/dm/reset.c static int dm_test_reset_devm(struct unit_test_state *uts) · line 124

Quoted 5 lines
test/dm/reset.c +5 -0
@@ -120,6 +120,59 @@ static int dm_test_reset_devm(struct unit_test_state *uts)
+     ut_assertok(sandbox_reset_test_assert(dev_test));
+     ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID));
+
+     ut_assertok(sandbox_reset_test_reset(dev_test));
+     ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));

This only checks the final state, i.e. a broken reset_reset() that skips the assert step would still pass, since the line was already asserted manually before the call. Please can you extend the sandbox driver to track the assert phase (a sticky 'was_asserted' flag or a transition counter) so the test confirms both halves of the pulse actually happen? Same for dm_test_reset_reset_bulk()

drivers/reset/sandbox-reset-test.c int sandbox_reset_test_deassert_bulk(struct udevice *dev) · line 101

Quoted 8 lines
drivers/reset/sandbox-reset-test.c +6 -0
@@ -96,6 +96,20 @@ int sandbox_reset_test_deassert_bulk(struct udevice *dev)
+int sandbox_reset_test_reset(struct udevice *dev)
+{
+     struct sandbox_reset_test *sbrt = dev_get_priv(dev);
+
+     return reset_reset(sbrt->ctlp);
+}

Re your commit message, better to implement rst_reset for sandbox, so that we keep the coverage up.

Regards,
Simon

author maintainer
#7 lore raw

Re: [PATCH 2/4] reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

Quoted 31 lines · Simon Glass

Hi Michal,

Quoted 15 lines · Michal Simek

reset: Add sandbox tests for reset_reset() and reset_reset_bulk()

Add DM test coverage for the new reset_reset() and reset_reset_bulk() API functions. The tests exercise the assert + deassert fallback path since the sandbox reset driver does not implement the rst_reset op.

arch/sandbox/include/asm/reset.h | 2 ++

  drivers/reset/sandbox-reset-test.c | 14 ++++++++++
  test/dm/reset.c                    | 53 ++++++++++++++++++++++++++++++++++++++
  3 files changed, 69 insertions(+)

test/dm/reset.c static int dm_test_reset_devm(struct unit_test_state *uts) · line 124

Quoted 5 lines
test/dm/reset.c +5 -0
@@ -120,6 +120,59 @@ static int dm_test_reset_devm(struct unit_test_state *uts)
+     ut_assertok(sandbox_reset_test_assert(dev_test));
+     ut_asserteq(1, sandbox_reset_query(dev_reset, TEST_RESET_ID));
+
+     ut_assertok(sandbox_reset_test_reset(dev_test));
+     ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));

This only checks the final state, i.e. a broken reset_reset() that skips the assert step would still pass, since the line was already asserted manually before the call. Please can you extend the sandbox driver to track the assert phase (a sticky 'was_asserted' flag or a transition counter) so the test confirms both halves of the pulse actually happen? Same for dm_test_reset_reset_bulk()

Quoted 11 lines

drivers/reset/sandbox-reset-test.c int sandbox_reset_test_deassert_bulk(struct udevice *dev) · line 101

Quoted 8 lines
drivers/reset/sandbox-reset-test.c +6 -0
@@ -96,6 +96,20 @@ int sandbox_reset_test_deassert_bulk(struct udevice *dev)
+int sandbox_reset_test_reset(struct udevice *dev)
+{
+     struct sandbox_reset_test *sbrt = dev_get_priv(dev);
+
+     return reset_reset(sbrt->ctlp);
+}

Re your commit message, better to implement rst_reset for sandbox, so that we keep the coverage up.

Will look.

M

author maintainer
#8 lore raw

PATCH 3/4 spi: cadence: Use reset_reset_bulk() for proper reset cycling

In reply to Michal Simek

Use the new reset_reset_bulk() API to properly cycle reset signals during probe instead of just deasserting them. This ensures the controller is properly reset before initialization.

---

 drivers/spi/cadence_qspi.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/spi/cadence_qspi.c +2 -17
index 2a4a49c5f1cf..b9f2481b9cd3 100644
@@ -255,23 +255,8 @@ static int cadence_spi_probe(struct udevice *bus)
 	}
 
 	priv->resets = devm_reset_bulk_get_optional(bus);
-	if (priv->resets) {
-		/* Assert all OSPI reset lines */
-		ret = reset_assert_bulk(priv->resets);
-		if (ret) {
-			dev_err(bus, "Failed to assert OSPI reset: %d\n", ret);
-			return ret;
-		}
-
-		udelay(10);
-
-		/* Deassert all OSPI reset lines */
-		ret = reset_deassert_bulk(priv->resets);
-		if (ret) {
-			dev_err(bus, "Failed to deassert OSPI reset: %d\n", ret);
-			return ret;
-		}
-	}
+	if (priv->resets)
+		reset_reset_bulk(priv->resets);
 
 	if (!priv->qspi_is_init) {
 		cadence_qspi_apb_controller_init(priv);
Signature · 1 line
2.43.0
Reviewed-by on v1 3/4
#9 lore raw

Re: [PATCH 3/4] spi: cadence: Use reset_reset_bulk() for proper reset cycling

Hi Michal,

Quoted 14 lines · Michal Simek

spi: cadence: Use reset_reset_bulk() for proper reset cycling

Use the new reset_reset_bulk() API to properly cycle reset signals during probe instead of just deasserting them. This ensures the controller is properly reset before initialization.

drivers/spi/cadence_qspi.c | 19 ++-----------------

 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/spi/cadence_qspi.c +0 -1
@@ -255,23 +255,8 @@ static int cadence_spi_probe(struct udevice *bus)
-             udelay(10);

drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 256

Quoted 10 lines
drivers/spi/cadence_qspi.c +2 -8
-
-             /* Deassert all OSPI reset lines */
-             ret = reset_deassert_bulk(priv->resets);
-             if (ret) {
-                     dev_err(bus, "Failed to deassert OSPI reset: %d\n", ret);
-                     return ret;
-             }
-     }
+     if (priv->resets)
+             reset_reset_bulk(priv->resets);

This silently drops the 10us delay that commit 834d589b8f1 ('spi:
cadence_qspi: pulse controller reset at probe') deliberately added between assert and deassert. Is that intended?

drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 256

Quoted 4 lines
drivers/spi/cadence_qspi.c +2 -0
@@ -255,23 +255,8 @@ static int cadence_spi_probe(struct udevice *bus)
+     if (priv->resets)
+             reset_reset_bulk(priv->resets);

The return value is now discarded - is that intended?

Regards,
Simon

author maintainer
#10 lore raw

Re: [PATCH 3/4] spi: cadence: Use reset_reset_bulk() for proper reset cycling

Quoted 32 lines · Simon Glass

Hi Michal,

Quoted 14 lines · Michal Simek

spi: cadence: Use reset_reset_bulk() for proper reset cycling

Use the new reset_reset_bulk() API to properly cycle reset signals during probe instead of just deasserting them. This ensures the controller is properly reset before initialization.

drivers/spi/cadence_qspi.c | 19 ++-----------------

  1 file changed, 2 insertions(+), 17 deletions(-)
drivers/spi/cadence_qspi.c +0 -1
@@ -255,23 +255,8 @@ static int cadence_spi_probe(struct udevice *bus)
-             udelay(10);

drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 256

Quoted 10 lines
drivers/spi/cadence_qspi.c +2 -8
-
-             /* Deassert all OSPI reset lines */
-             ret = reset_deassert_bulk(priv->resets);
-             if (ret) {
-                     dev_err(bus, "Failed to deassert OSPI reset: %d\n", ret);
-                     return ret;
-             }
-     }
+     if (priv->resets)
+             reset_reset_bulk(priv->resets);

This silently drops the 10us delay that commit 834d589b8f1 ('spi:
cadence_qspi: pulse controller reset at probe') deliberately added between assert and deassert. Is that intended?

Quoted 6 lines

drivers/spi/cadence_qspi.c static int cadence_spi_probe(struct udevice *bus) · line 256

Quoted 4 lines
drivers/spi/cadence_qspi.c +2 -0
@@ -255,23 +255,8 @@ static int cadence_spi_probe(struct udevice *bus)
+     if (priv->resets)
+             reset_reset_bulk(priv->resets);

The return value is now discarded - is that intended?

Not really. It should be also checked.

M

author maintainer
#11 lore raw

PATCH 4/4 reset: zynqmp: Implement rst_reset using PM_RESET_ACTION_PULSE

In reply to Michal Simek

Implement the rst_reset operation in the ZynqMP reset driver to use PM_RESET_ACTION_PULSE. This allows the reset controller to perform a reset pulse in a single firmware call instead of separate assert and deassert calls.

This matches the Linux kernel implementation of zynqmp_reset_reset().

---

 drivers/reset/reset-zynqmp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/reset/reset-zynqmp.c +11 -0
index d04e8eef3bb4..b87085b6c5e1 100644
@@ -45,6 +45,16 @@ static int zynqmp_reset_deassert(struct reset_ctl *rst)
 				      PM_RESET_ACTION_RELEASE);
 }
 
+static int zynqmp_reset_reset(struct reset_ctl *rst)
+{
+	struct zynqmp_reset_priv *priv = dev_get_priv(rst->dev);
+
+	dev_dbg(rst->dev, "%s(rst=%p) (id=%lu)\n", __func__, rst, rst->id);
+
+	return zynqmp_pm_reset_assert(priv->reset_id + rst->id,
+				      PM_RESET_ACTION_PULSE);
+}
+
 static int zynqmp_reset_request(struct reset_ctl *rst)
 {
 	struct zynqmp_reset_priv *priv = dev_get_priv(rst->dev);
@@ -74,6 +84,7 @@ const struct reset_ops zynqmp_reset_ops = {
 	.request = zynqmp_reset_request,
 	.rst_assert = zynqmp_reset_assert,
 	.rst_deassert = zynqmp_reset_deassert,
+	.rst_reset = zynqmp_reset_reset,
 };
 
 static const struct udevice_id zynqmp_reset_ids[] = {
Signature · 1 line
2.43.0
Reviewed-by on v1 4/4
#12 lore raw

Re: [PATCH 4/4] reset: zynqmp: Implement rst_reset using PM_RESET_ACTION_PULSE

Quoted 7 lines · Michal Simek

reset: zynqmp: Implement rst_reset using PM_RESET_ACTION_PULSE

Implement the rst_reset operation in the ZynqMP reset driver to use PM_RESET_ACTION_PULSE. This allows the reset controller to perform a reset pulse in a single firmware call instead of separate assert and deassert calls.

Quoted 6 lines

This matches the Linux kernel implementation of zynqmp_reset_reset().

drivers/reset/reset-zynqmp.c | 11 +++++++++++

 1 file changed, 11 insertions(+)