2020-06-15 08:05:35

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH 0/4] spi: bcm63xx: add BMIPS support

BCM63xx SPI and HSSPI controller are present on several BMIPS SoCs (BCM6318,
BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268).

Álvaro Fernández Rojas (4):
spi: bcm63xx-spi: add reset support
spi: bcm63xx-spi: allow building for BMIPS
spi: bcm63xx-hsspi: add reset support
spi: bcm63xx-hsspi: allow building for BMIPS

drivers/spi/Kconfig | 4 ++--
drivers/spi/spi-bcm63xx-hsspi.c | 17 +++++++++++++++++
drivers/spi/spi-bcm63xx.c | 17 +++++++++++++++++
3 files changed, 36 insertions(+), 2 deletions(-)

--
2.27.0


2020-06-15 08:05:41

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH 4/4] spi: bcm63xx-hsspi: allow building for BMIPS

bcm63xx-hsspi controller is present on several BMIPS SoCs (BCM6318, BCM6328,
BCM6362 and BCM63268).

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
---
drivers/spi/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index a9896e388355..500774fe1351 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -155,7 +155,7 @@ config SPI_BCM63XX

config SPI_BCM63XX_HSSPI
tristate "Broadcom BCM63XX HS SPI controller driver"
- depends on BCM63XX || ARCH_BCM_63XX || COMPILE_TEST
+ depends on BCM63XX || BMIPS_GENERIC || ARCH_BCM_63XX || COMPILE_TEST
help
This enables support for the High Speed SPI controller present on
newer Broadcom BCM63XX SoCs.
--
2.27.0

2020-06-15 08:08:14

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH 3/4] 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]>
---
drivers/spi/spi-bcm63xx-hsspi.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index 6c235306c0e4..a20a0b88c23a 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,25 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return PTR_ERR(clk);

+ reset = devm_reset_control_get(dev, NULL);
+ if (IS_ERR(reset)) {
+ ret = PTR_ERR(reset);
+ if (ret != -EPROBE_DEFER)
+ dev_err(dev,
+ "failed to get reset controller: %d\n", ret);
+ return ret;
+ }
+
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");
--
2.27.0

2020-06-15 08:08:46

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH 2/4] spi: bcm63xx-spi: allow building for BMIPS

bcm63xx-spi controller is present on several BMIPS SoCs (BCM6358, BCM6362,
BCM6368 and BCM63268).

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
---
drivers/spi/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 8f1f8fca79e3..a9896e388355 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -149,7 +149,7 @@ config SPI_BCM2835AUX

config SPI_BCM63XX
tristate "Broadcom BCM63xx SPI controller"
- depends on BCM63XX || COMPILE_TEST
+ depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST
help
Enable support for the SPI controller on the Broadcom BCM63xx SoCs.

--
2.27.0

2020-06-15 09:14:20

by Álvaro Fernández Rojas

[permalink] [raw]
Subject: [PATCH v2 0/4] spi: bcm63xx: add BMIPS support

BCM63xx SPI and HSSPI controller are present on several BMIPS SoCs (BCM6318,
BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268).

v2: use devm_reset_control_get_exclusive

Álvaro Fernández Rojas (4):
spi: bcm63xx-spi: add reset support
spi: bcm63xx-spi: allow building for BMIPS
spi: bcm63xx-hsspi: add reset support
spi: bcm63xx-hsspi: allow building for BMIPS

drivers/spi/Kconfig | 4 ++--
drivers/spi/spi-bcm63xx-hsspi.c | 17 +++++++++++++++++
drivers/spi/spi-bcm63xx.c | 17 +++++++++++++++++
3 files changed, 36 insertions(+), 2 deletions(-)

--
2.27.0

2020-06-15 11:30:00

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] spi: bcm63xx: add BMIPS support

On Mon, Jun 15, 2020 at 11:09:39AM +0200, ?lvaro Fern?ndez Rojas wrote:
> BCM63xx SPI and HSSPI controller are present on several BMIPS SoCs (BCM6318,
> BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268).

Please don't send new versions of patches in reply to old ones, it makes
it hard to keep track of what's going on and can bury things back in a
mailbox.


Attachments:
(No filename) (364.00 B)
signature.asc (499.00 B)
Download all attachments

2020-06-15 16:30:11

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] spi: bcm63xx: add BMIPS support

Hi Alvaro,

On 6/15/2020 2:09 AM, Álvaro Fernández Rojas wrote:
> BCM63xx SPI and HSSPI controller are present on several BMIPS SoCs (BCM6318,
> BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268).
>
> v2: use devm_reset_control_get_exclusive

We would also need to write a binding document for these two
controllers, as they appear to be missing, and this would document the
reset property.

I also believe that you should be making this property optional since
not all SoCs do have a dedicated reset controller line for SPI/HSSPI (if
at all).

Thank you!
--
Florian