U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] spi: npcm_pspi: Reset HW in driver probe
@ 2024-04-23  6:38 Jim Liu
  2024-05-03 22:21 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Liu @ 2024-04-23  6:38 UTC (permalink / raw)
  To: KWLIU, jim.t90615, trini, YSCHU, jagan, JJLIU0; +Cc: u-boot

Reset HW to clear old status and use default data mode(8-bit).

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
---
 drivers/spi/npcm_pspi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/spi/npcm_pspi.c b/drivers/spi/npcm_pspi.c
index eb14185273..c9441304f5 100644
--- a/drivers/spi/npcm_pspi.c
+++ b/drivers/spi/npcm_pspi.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <spi.h>
 #include <clk.h>
+#include <reset.h>
 #include <asm/gpio.h>
 #include <linux/iopoll.h>
 
@@ -194,6 +195,7 @@ static int npcm_pspi_probe(struct udevice *bus)
 {
 	struct npcm_pspi_priv *priv = dev_get_priv(bus);
 	int node = dev_of_offset(bus);
+	struct reset_ctl reset;
 	int ret;
 
 	ret = clk_get_by_index(bus, 0, &priv->clk);
@@ -205,6 +207,14 @@ static int npcm_pspi_probe(struct udevice *bus)
 	gpio_request_by_name_nodev(offset_to_ofnode(node), "cs-gpios", 0,
 				   &priv->cs_gpio, GPIOD_IS_OUT| GPIOD_ACTIVE_LOW);
 
+	/* Reset HW */
+	ret = reset_get_by_index(bus, 0, &reset);
+	if (!ret) {
+		reset_assert(&reset);
+		udelay(5);
+		reset_deassert(&reset);
+	}
+
 	return 0;
 }
 
-- 
2.25.1


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

* Re: [PATCH v1] spi: npcm_pspi: Reset HW in driver probe
  2024-04-23  6:38 [PATCH v1] spi: npcm_pspi: Reset HW in driver probe Jim Liu
@ 2024-05-03 22:21 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2024-05-03 22:21 UTC (permalink / raw)
  To: Jim Liu; +Cc: KWLIU, YSCHU, jagan, JJLIU0, u-boot

[-- Attachment #1: Type: text/plain, Size: 226 bytes --]

On Tue, Apr 23, 2024 at 02:38:42PM +0800, Jim Liu wrote:

> Reset HW to clear old status and use default data mode(8-bit).
> 
> Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2024-05-03 22:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23  6:38 [PATCH v1] spi: npcm_pspi: Reset HW in driver probe Jim Liu
2024-05-03 22:21 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox