summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2022-02-22 17:23:25 +0100
committerJagan Teki <jagan@amarulasolutions.com>2022-02-24 13:38:25 +0530
commite145606ff29364e948c05d492732f623674d6010 (patch)
tree9f6b032b5e206fcdf242db57e2b7fc7dc645a2f7 /drivers/spi
parent90de95f7443cb06f014824976251f126ac6f71c0 (diff)
downloadu-boot-e145606ff29364e948c05d492732f623674d6010.tar.gz
u-boot-e145606ff29364e948c05d492732f623674d6010.tar.bz2
u-boot-e145606ff29364e948c05d492732f623674d6010.zip
spi: cadence-qspi: Make reset control optional
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> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/cadence_qspi.c14
-rw-r--r--drivers/spi/cadence_qspi.h2
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 */