aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJim Liu <jim.t90615@gmail.com>2024-04-23 14:38:42 +0800
committerTom Rini <trini@konsulko.com>2024-05-03 12:22:58 -0600
commit914b766a2a6b0f746b2e6fe3bf3d70881e6da610 (patch)
tree424ae8a64abcc03f39c878e4558bcc87c26b2560 /drivers
parent8024d577897d57d0b9ec2dd92449e06e7f74f0e0 (diff)
downloadu-boot-914b766a2a6b0f746b2e6fe3bf3d70881e6da610.zip
u-boot-914b766a2a6b0f746b2e6fe3bf3d70881e6da610.tar.gz
u-boot-914b766a2a6b0f746b2e6fe3bf3d70881e6da610.tar.bz2
spi: npcm_pspi: Reset HW in driver probe
Reset HW to clear old status and use default data mode(8-bit). Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/npcm_pspi.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/spi/npcm_pspi.c b/drivers/spi/npcm_pspi.c
index eb14185..c944130 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;
}