diff mbox series

[1/7] spi: realteak-rtl: Add support for RTL93xx SoCs

Message ID a436b3f9-8bdd-8999-b033-9b25c9b67d98@birger-koblitz.de
State New
Headers show
Series [1/7] spi: realteak-rtl: Add support for RTL93xx SoCs | expand

Commit Message

Birger Koblitz Aug. 1, 2022, 6:17 a.m. UTC
The Realtek RTL930x and RTL931x SoCs are new generations of the
RTL838x and RTL839x Ethernet Router SoCs, providing only 2 instead
of 4 CS lines for SPI, however with quad IO capabilities instead of
merely dual IO.

We introduce device capability flags for the various SoCs stating
their number of CS lines and their multi-IO capabilities and add
compatibles for the RTL9300 and RTL9310 SoC families.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
---
  drivers/spi/spi-realtek-rtl.c | 16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi-realtek-rtl.c b/drivers/spi/spi-realtek-rtl.c
index 866b0477dbd7..927bd44744a8 100644
--- a/drivers/spi/spi-realtek-rtl.c
+++ b/drivers/spi/spi-realtek-rtl.c
@@ -29,6 +29,9 @@  struct rtspi {

  #define REG(x)		(rtspi->base + x)

+/* SoC-specific features */
+#define SPI_CSMAX_3			0x1
+#define SPI_QUAD_SUPPORTED		0x2

  static void rt_set_cs(struct spi_device *spi, bool active)
  {
@@ -185,13 +188,16 @@  static int realtek_rtl_spi_probe(struct platform_device *pdev)


  static const struct of_device_id realtek_rtl_spi_of_ids[] = {
-	{ .compatible = "realtek,rtl8380-spi" },
-	{ .compatible = "realtek,rtl8382-spi" },
-	{ .compatible = "realtek,rtl8391-spi" },
-	{ .compatible = "realtek,rtl8392-spi" },
-	{ .compatible = "realtek,rtl8393-spi" },
+	{ .compatible = "realtek,rtl8380-spi", .data = (void *)SPI_CSMAX_3, },
+	{ .compatible = "realtek,rtl8382-spi", .data = (void *)SPI_CSMAX_3, },
+	{ .compatible = "realtek,rtl8391-spi", .data = (void *)SPI_CSMAX_3, },
+	{ .compatible = "realtek,rtl8392-spi", .data = (void *)SPI_CSMAX_3, },
+	{ .compatible = "realtek,rtl8393-spi", .data = (void *)SPI_CSMAX_3, },
+	{ .compatible = "realtek,rtl9300-spi", .data = (void *)SPI_QUAD_SUPPORTED, },
+	{ .compatible = "realtek,rtl9310-spi", .data = (void *)SPI_QUAD_SUPPORTED, },
  	{ /* sentinel */ }
  };
+
  MODULE_DEVICE_TABLE(of, realtek_rtl_spi_of_ids);

  static struct platform_driver realtek_rtl_spi_driver = {