Skip to content

Commit 0eeaddd

Browse files
Noltaribroonie
authored andcommitted
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 <[email protected]> Reviewed-by: Philipp Zabel <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 38807ad commit 0eeaddd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/spi/spi-bcm63xx-hsspi.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/spi/spi.h>
2121
#include <linux/mutex.h>
2222
#include <linux/of.h>
23+
#include <linux/reset.h>
2324

2425
#define HSSPI_GLOBAL_CTRL_REG 0x0
2526
#define GLOBAL_CTRL_CS_POLARITY_SHIFT 0
@@ -334,6 +335,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
334335
struct clk *clk, *pll_clk = NULL;
335336
int irq, ret;
336337
u32 reg, rate, num_cs = HSSPI_SPI_MAX_CS;
338+
struct reset_control *reset;
337339

338340
irq = platform_get_irq(pdev, 0);
339341
if (irq < 0)
@@ -348,10 +350,20 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
348350
if (IS_ERR(clk))
349351
return PTR_ERR(clk);
350352

353+
reset = devm_reset_control_get_optional_exclusive(dev, NULL);
354+
if (IS_ERR(reset))
355+
return PTR_ERR(reset);
356+
351357
ret = clk_prepare_enable(clk);
352358
if (ret)
353359
return ret;
354360

361+
ret = reset_control_reset(reset);
362+
if (ret) {
363+
dev_err(dev, "unable to reset device: %d\n", ret);
364+
goto out_disable_clk;
365+
}
366+
355367
rate = clk_get_rate(clk);
356368
if (!rate) {
357369
pll_clk = devm_clk_get(dev, "pll");

0 commit comments

Comments
 (0)