summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-bcm63xx-hsspi.c
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2020-06-16 19:32:35 +0200
committerMark Brown <broonie@kernel.org>2020-06-17 14:29:58 +0100
commit0eeadddbf09a7a36ef1bc8021df1a770dc4b5370 (patch)
treeb60b7e35110a3bd607df90f5860f4985afe5c8b2 /drivers/spi/spi-bcm63xx-hsspi.c
parent38807adeaf1ec0785b27dc18fe4562a375f80de7 (diff)
spi: bcm63xx-hsspi: add reset support
bcm63xx arch resets the HSSPI controller at early boot. However, bmips arch needs to perform a reset when probing the driver. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20200616173235.3473149-3-noltari@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-bcm63xx-hsspi.c')
-rw-r--r--drivers/spi/spi-bcm63xx-hsspi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index 6c235306c0e4..9909b18f3c5a 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -20,6 +20,7 @@
#include <linux/spi/spi.h>
#include <linux/mutex.h>
#include <linux/of.h>
+#include <linux/reset.h>
#define HSSPI_GLOBAL_CTRL_REG 0x0
#define GLOBAL_CTRL_CS_POLARITY_SHIFT 0
@@ -334,6 +335,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
struct clk *clk, *pll_clk = NULL;
int irq, ret;
u32 reg, rate, num_cs = HSSPI_SPI_MAX_CS;
+ struct reset_control *reset;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
@@ -348,10 +350,20 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return PTR_ERR(clk);
+ reset = devm_reset_control_get_optional_exclusive(dev, NULL);
+ if (IS_ERR(reset))
+ return PTR_ERR(reset);
+
ret = clk_prepare_enable(clk);
if (ret)
return ret;
+ ret = reset_control_reset(reset);
+ if (ret) {
+ dev_err(dev, "unable to reset device: %d\n", ret);
+ goto out_disable_clk;
+ }
+
rate = clk_get_rate(clk);
if (!rate) {
pll_clk = devm_clk_get(dev, "pll");