Skip to content

Commit 38807ad

Browse files
Noltaribroonie
authored andcommitted
spi: bcm63xx-spi: add reset support
bcm63xx arch resets the SPI 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 42fd4f2 commit 38807ad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/spi/spi-bcm63xx.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/err.h>
1919
#include <linux/pm_runtime.h>
2020
#include <linux/of.h>
21+
#include <linux/reset.h>
2122

2223
/* BCM 6338/6348 SPI core */
2324
#define SPI_6348_RSET_SIZE 64
@@ -493,6 +494,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
493494
struct bcm63xx_spi *bs;
494495
int ret;
495496
u32 num_cs = BCM63XX_SPI_MAX_CS;
497+
struct reset_control *reset;
496498

497499
if (dev->of_node) {
498500
const struct of_device_id *match;
@@ -529,6 +531,10 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
529531
return PTR_ERR(clk);
530532
}
531533

534+
reset = devm_reset_control_get_optional_exclusive(dev, NULL);
535+
if (IS_ERR(reset))
536+
return PTR_ERR(reset);
537+
532538
master = spi_alloc_master(dev, sizeof(*bs));
533539
if (!master) {
534540
dev_err(dev, "out of memory\n");
@@ -579,6 +585,12 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
579585
if (ret)
580586
goto out_err;
581587

588+
ret = reset_control_reset(reset);
589+
if (ret) {
590+
dev_err(dev, "unable to reset device: %d\n", ret);
591+
goto out_clk_disable;
592+
}
593+
582594
bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);
583595

584596
/* register and we are done */

0 commit comments

Comments
 (0)