linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] spi: bcm63xx: add BMIPS support
@ 2020-06-16 17:32 Álvaro Fernández Rojas
  2020-06-16 17:32 ` [PATCH v4 1/2] spi: bcm63xx-spi: add reset support Álvaro Fernández Rojas
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Álvaro Fernández Rojas @ 2020-06-16 17:32 UTC (permalink / raw)
  To: broonie, f.fainelli, bcm-kernel-feedback-list, p.zabel,
	linux-spi, linux-kernel, linux-arm-kernel
  Cc: Álvaro Fernández Rojas

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

v4: simplify devm_reset_control_get_optional_exclusive return handling
v3: use devm_reset_control_get_optional_exclusive
v2: use devm_reset_control_get_exclusive

Álvaro Fernández Rojas (2):
  spi: bcm63xx-spi: add reset support
  spi: bcm63xx-hsspi: add reset support

 drivers/spi/spi-bcm63xx-hsspi.c | 12 ++++++++++++
 drivers/spi/spi-bcm63xx.c       | 12 ++++++++++++
 2 files changed, 24 insertions(+)

-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v4 1/2] spi: bcm63xx-spi: add reset support
  2020-06-16 17:32 [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Álvaro Fernández Rojas
@ 2020-06-16 17:32 ` Álvaro Fernández Rojas
  2020-06-16 17:32 ` [PATCH v4 2/2] spi: bcm63xx-hsspi: " Álvaro Fernández Rojas
  2020-06-17 16:36 ` [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Álvaro Fernández Rojas @ 2020-06-16 17:32 UTC (permalink / raw)
  To: broonie, f.fainelli, bcm-kernel-feedback-list, p.zabel,
	linux-spi, linux-kernel, linux-arm-kernel
  Cc: Álvaro Fernández Rojas

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 <noltari@gmail.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
 v4: simplify devm_reset_control_get_optional_exclusive return handling
 v3: use devm_reset_control_get_optional_exclusive
 v2: use devm_reset_control_get_exclusive

 drivers/spi/spi-bcm63xx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index 0f1b10a4ef0c..96d075e633f4 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -18,6 +18,7 @@
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
 #include <linux/of.h>
+#include <linux/reset.h>
 
 /* BCM 6338/6348 SPI core */
 #define SPI_6348_RSET_SIZE		64
@@ -493,6 +494,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
 	struct bcm63xx_spi *bs;
 	int ret;
 	u32 num_cs = BCM63XX_SPI_MAX_CS;
+	struct reset_control *reset;
 
 	if (dev->of_node) {
 		const struct of_device_id *match;
@@ -529,6 +531,10 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
 		return PTR_ERR(clk);
 	}
 
+	reset = devm_reset_control_get_optional_exclusive(dev, NULL);
+	if (IS_ERR(reset))
+		return PTR_ERR(reset);
+
 	master = spi_alloc_master(dev, sizeof(*bs));
 	if (!master) {
 		dev_err(dev, "out of memory\n");
@@ -579,6 +585,12 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_err;
 
+	ret = reset_control_reset(reset);
+	if (ret) {
+		dev_err(dev, "unable to reset device: %d\n", ret);
+		goto out_clk_disable;
+	}
+
 	bcm_spi_writeb(bs, SPI_INTR_CLEAR_ALL, SPI_INT_STATUS);
 
 	/* register and we are done */
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v4 2/2] spi: bcm63xx-hsspi: add reset support
  2020-06-16 17:32 [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Álvaro Fernández Rojas
  2020-06-16 17:32 ` [PATCH v4 1/2] spi: bcm63xx-spi: add reset support Álvaro Fernández Rojas
@ 2020-06-16 17:32 ` Álvaro Fernández Rojas
  2020-06-17 16:36 ` [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Álvaro Fernández Rojas @ 2020-06-16 17:32 UTC (permalink / raw)
  To: broonie, f.fainelli, bcm-kernel-feedback-list, p.zabel,
	linux-spi, linux-kernel, linux-arm-kernel
  Cc: Álvaro Fernández Rojas

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>
---
 v4: simplify devm_reset_control_get_optional_exclusive return handling
 v3: use devm_reset_control_get_optional_exclusive
 v2: use devm_reset_control_get_exclusive

 drivers/spi/spi-bcm63xx-hsspi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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");
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v4 0/2] spi: bcm63xx: add BMIPS support
  2020-06-16 17:32 [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Álvaro Fernández Rojas
  2020-06-16 17:32 ` [PATCH v4 1/2] spi: bcm63xx-spi: add reset support Álvaro Fernández Rojas
  2020-06-16 17:32 ` [PATCH v4 2/2] spi: bcm63xx-hsspi: " Álvaro Fernández Rojas
@ 2020-06-17 16:36 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-06-17 16:36 UTC (permalink / raw)
  To: linux-spi, f.fainelli, linux-arm-kernel,
	Álvaro Fernández Rojas, bcm-kernel-feedback-list,
	linux-kernel, p.zabel

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

On Tue, 16 Jun 2020 19:32:33 +0200, Álvaro Fernández Rojas wrote:
> BCM63xx SPI and HSSPI controller are present on several BMIPS SoCs (BCM6318,
> BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268).
> 
> v4: simplify devm_reset_control_get_optional_exclusive return handling
> v3: use devm_reset_control_get_optional_exclusive
> v2: use devm_reset_control_get_exclusive
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/2] spi: bcm63xx-spi: add reset support
      commit: 38807adeaf1ec0785b27dc18fe4562a375f80de7
[2/2] spi: bcm63xx-hsspi: add reset support
      commit: 0eeadddbf09a7a36ef1bc8021df1a770dc4b5370

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-17 16:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-16 17:32 [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Álvaro Fernández Rojas
2020-06-16 17:32 ` [PATCH v4 1/2] spi: bcm63xx-spi: add reset support Álvaro Fernández Rojas
2020-06-16 17:32 ` [PATCH v4 2/2] spi: bcm63xx-hsspi: " Álvaro Fernández Rojas
2020-06-17 16:36 ` [PATCH v4 0/2] spi: bcm63xx: add BMIPS support Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).