linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 0/3] add COMPILE_TEST support
@ 2025-08-26 21:24 Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 1/3] spi: rb4xx: depend on OF Rosen Penev
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Rosen Penev @ 2025-08-26 21:24 UTC (permalink / raw)
  To: linux-spi; +Cc: Mark Brown, j4g8y7, open list

Allows the buildbots to test compilation. The driver has nothing
architecture specific.

v2: change to patch series and add extra patches

Rosen Penev (3):
  spi: rb4xx: depend on OF
  spi: rb4xx: add COMPILE_TEST support
  spi: rb4xx: use devm for clk_prepare_enable

 drivers/spi/Kconfig     |  3 ++-
 drivers/spi/spi-rb4xx.c | 36 ++++++++++++++++--------------------
 2 files changed, 18 insertions(+), 21 deletions(-)

-- 
2.50.1


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

* [PATCHv2 1/3] spi: rb4xx: depend on OF
  2025-08-26 21:24 [PATCHv2 0/3] add COMPILE_TEST support Rosen Penev
@ 2025-08-26 21:24 ` Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 2/3] spi: rb4xx: add COMPILE_TEST support Rosen Penev
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2025-08-26 21:24 UTC (permalink / raw)
  To: linux-spi; +Cc: Mark Brown, j4g8y7, open list

There's no support for non OF platforms. Better to depend on OF
explicitly.

Also fixes a warning/error about the dt table being unused because of
of_match_ptr on non OF platforms.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/spi/Kconfig     | 1 +
 drivers/spi/spi-rb4xx.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 891729c9c564..cdeaa8e711fd 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -917,6 +917,7 @@ config SPI_ROCKCHIP_SFC
 config SPI_RB4XX
 	tristate "Mikrotik RB4XX SPI master"
 	depends on SPI_MASTER && ATH79
+	depends on OF
 	help
 	  SPI controller driver for the Mikrotik RB4xx series boards.
 
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index e71d3805b150..a795e263299e 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -199,7 +199,7 @@ static struct platform_driver rb4xx_spi_drv = {
 	.remove = rb4xx_spi_remove,
 	.driver = {
 		.name = "rb4xx-spi",
-		.of_match_table = of_match_ptr(rb4xx_spi_dt_match),
+		.of_match_table = rb4xx_spi_dt_match,
 	},
 };
 
-- 
2.50.1


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

* [PATCHv2 2/3] spi: rb4xx: add COMPILE_TEST support
  2025-08-26 21:24 [PATCHv2 0/3] add COMPILE_TEST support Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 1/3] spi: rb4xx: depend on OF Rosen Penev
@ 2025-08-26 21:24 ` Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 3/3] spi: rb4xx: use devm for clk_prepare_enable Rosen Penev
  2025-08-28 21:00 ` [PATCHv2 0/3] add COMPILE_TEST support Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2025-08-26 21:24 UTC (permalink / raw)
  To: linux-spi; +Cc: Mark Brown, j4g8y7, open list

Copy macros from ath79 SPI driver to allow compilation on all platforms
and remove ath79 specific header.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/spi/Kconfig     |  2 +-
 drivers/spi/spi-rb4xx.c | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index cdeaa8e711fd..f7020d35b3a5 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -916,7 +916,7 @@ config SPI_ROCKCHIP_SFC
 
 config SPI_RB4XX
 	tristate "Mikrotik RB4XX SPI master"
-	depends on SPI_MASTER && ATH79
+	depends on SPI_MASTER && (ATH79 || COMPILE_TEST)
 	depends on OF
 	help
 	  SPI controller driver for the Mikrotik RB4xx series boards.
diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index a795e263299e..bae802e94226 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -16,7 +16,16 @@
 #include <linux/spi/spi.h>
 #include <linux/of.h>
 
-#include <asm/mach-ath79/ar71xx_regs.h>
+#define AR71XX_SPI_REG_FS		0x00	/* Function Select */
+#define AR71XX_SPI_REG_CTRL		0x04	/* SPI Control */
+#define AR71XX_SPI_REG_IOC		0x08	/* SPI I/O Control */
+#define AR71XX_SPI_REG_RDS		0x0c	/* Read Data Shift */
+
+#define AR71XX_SPI_FS_GPIO		BIT(0)	/* Enable GPIO mode */
+
+#define AR71XX_SPI_IOC_DO		BIT(0)	/* Data Out pin */
+#define AR71XX_SPI_IOC_CLK		BIT(8)	/* CLK pin */
+#define AR71XX_SPI_IOC_CS(n)		BIT(16 + (n))
 
 struct rb4xx_spi {
 	void __iomem *base;
@@ -63,7 +72,7 @@ static inline void do_spi_clk_two(struct rb4xx_spi *rbspi, u32 spi_ioc,
 	if (value & BIT(1))
 		regval |= AR71XX_SPI_IOC_DO;
 	if (value & BIT(0))
-		regval |= AR71XX_SPI_IOC_CS2;
+		regval |= AR71XX_SPI_IOC_CS(2);
 
 	rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval);
 	rb4xx_write(rbspi, AR71XX_SPI_REG_IOC, regval | AR71XX_SPI_IOC_CLK);
@@ -89,7 +98,7 @@ static void rb4xx_set_cs(struct spi_device *spi, bool enable)
 	 */
 	if (enable)
 		rb4xx_write(rbspi, AR71XX_SPI_REG_IOC,
-			    AR71XX_SPI_IOC_CS0 | AR71XX_SPI_IOC_CS1);
+			    AR71XX_SPI_IOC_CS(0) | AR71XX_SPI_IOC_CS(1));
 }
 
 static int rb4xx_transfer_one(struct spi_controller *host,
@@ -109,10 +118,10 @@ static int rb4xx_transfer_one(struct spi_controller *host,
 	 */
 	if (spi_get_chipselect(spi, 0) == 2)
 		/* MMC */
-		spi_ioc = AR71XX_SPI_IOC_CS0;
+		spi_ioc = AR71XX_SPI_IOC_CS(0);
 	else
 		/* Boot flash and CPLD */
-		spi_ioc = AR71XX_SPI_IOC_CS1;
+		spi_ioc = AR71XX_SPI_IOC_CS(1);
 
 	tx_buf = t->tx_buf;
 	rx_buf = t->rx_buf;
-- 
2.50.1


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

* [PATCHv2 3/3] spi: rb4xx: use devm for clk_prepare_enable
  2025-08-26 21:24 [PATCHv2 0/3] add COMPILE_TEST support Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 1/3] spi: rb4xx: depend on OF Rosen Penev
  2025-08-26 21:24 ` [PATCHv2 2/3] spi: rb4xx: add COMPILE_TEST support Rosen Penev
@ 2025-08-26 21:24 ` Rosen Penev
  2025-08-28 21:00 ` [PATCHv2 0/3] add COMPILE_TEST support Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Rosen Penev @ 2025-08-26 21:24 UTC (permalink / raw)
  To: linux-spi; +Cc: Mark Brown, j4g8y7, open list

Remove the remove function as it no longer does anything useful.

Also remove platform_set_drvdata as get becomes completely unused.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/spi/spi-rb4xx.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index bae802e94226..22b86fc89132 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -156,7 +156,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 	if (!host)
 		return -ENOMEM;
 
-	ahb_clk = devm_clk_get(&pdev->dev, "ahb");
+	ahb_clk = devm_clk_get_enabled(&pdev->dev, "ahb");
 	if (IS_ERR(ahb_clk))
 		return PTR_ERR(ahb_clk);
 
@@ -172,7 +172,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 	rbspi = spi_controller_get_devdata(host);
 	rbspi->base = spi_base;
 	rbspi->clk = ahb_clk;
-	platform_set_drvdata(pdev, rbspi);
 
 	err = devm_spi_register_controller(&pdev->dev, host);
 	if (err) {
@@ -180,23 +179,12 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	err = clk_prepare_enable(ahb_clk);
-	if (err)
-		return err;
-
 	/* Enable SPI */
 	rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
 
 	return 0;
 }
 
-static void rb4xx_spi_remove(struct platform_device *pdev)
-{
-	struct rb4xx_spi *rbspi = platform_get_drvdata(pdev);
-
-	clk_disable_unprepare(rbspi->clk);
-}
-
 static const struct of_device_id rb4xx_spi_dt_match[] = {
 	{ .compatible = "mikrotik,rb4xx-spi" },
 	{ },
@@ -205,7 +193,6 @@ MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
 
 static struct platform_driver rb4xx_spi_drv = {
 	.probe = rb4xx_spi_probe,
-	.remove = rb4xx_spi_remove,
 	.driver = {
 		.name = "rb4xx-spi",
 		.of_match_table = rb4xx_spi_dt_match,
-- 
2.50.1


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

* Re: [PATCHv2 0/3] add COMPILE_TEST support
  2025-08-26 21:24 [PATCHv2 0/3] add COMPILE_TEST support Rosen Penev
                   ` (2 preceding siblings ...)
  2025-08-26 21:24 ` [PATCHv2 3/3] spi: rb4xx: use devm for clk_prepare_enable Rosen Penev
@ 2025-08-28 21:00 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-08-28 21:00 UTC (permalink / raw)
  To: linux-spi, Rosen Penev; +Cc: j4g8y7, linux-kernel

On Tue, 26 Aug 2025 14:24:10 -0700, Rosen Penev wrote:
> Allows the buildbots to test compilation. The driver has nothing
> architecture specific.
> 
> v2: change to patch series and add extra patches
> 
> Rosen Penev (3):
>   spi: rb4xx: depend on OF
>   spi: rb4xx: add COMPILE_TEST support
>   spi: rb4xx: use devm for clk_prepare_enable
> 
> [...]

Applied to

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

Thanks!

[1/3] spi: rb4xx: depend on OF
      commit: c73c378dc05ba8060558b9b50e37f3afa4763ea1
[2/3] spi: rb4xx: add COMPILE_TEST support
      commit: f18f0ac5331f8f13737e87cc1416837fb5b27b0a
[3/3] spi: rb4xx: use devm for clk_prepare_enable
      commit: ff9a7857b7848227788f113d6dc6a72e989084e0

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


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

end of thread, other threads:[~2025-08-28 21:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 21:24 [PATCHv2 0/3] add COMPILE_TEST support Rosen Penev
2025-08-26 21:24 ` [PATCHv2 1/3] spi: rb4xx: depend on OF Rosen Penev
2025-08-26 21:24 ` [PATCHv2 2/3] spi: rb4xx: add COMPILE_TEST support Rosen Penev
2025-08-26 21:24 ` [PATCHv2 3/3] spi: rb4xx: use devm for clk_prepare_enable Rosen Penev
2025-08-28 21:00 ` [PATCHv2 0/3] add COMPILE_TEST 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).