[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4d10e375-7342-6c1b-9886-e49974b1620b@birger-koblitz.de>
Date: Mon, 1 Aug 2022 08:18:09 +0200
From: Birger Koblitz <mail@...ger-koblitz.de>
To: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
bert@...t.com, sander@...nheule.net
Subject: [PATCH 2/7] spi: realtek-rtl: set device capability flags
Read out the number of chip selects supported by the SoC and
whether the device supports Quad-IO and set the spi_controller
flags accordingly.
Signed-off-by: Birger Koblitz <mail@...ger-koblitz.de>
---
drivers/spi/spi-realtek-rtl.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/spi/spi-realtek-rtl.c b/drivers/spi/spi-realtek-rtl.c
index 927bd44744a8..287ecc34e1cc 100644
--- a/drivers/spi/spi-realtek-rtl.c
+++ b/drivers/spi/spi-realtek-rtl.c
@@ -4,9 +4,11 @@
#include <linux/platform_device.h>
#include <linux/mod_devicetable.h>
#include <linux/spi/spi.h>
+#include <linux/property.h>
struct rtspi {
void __iomem *base;
+ u32 dev_flags;
};
/* SPI Flash Configuration Register */
@@ -163,6 +165,7 @@ static int realtek_rtl_spi_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, ctrl);
rtspi = spi_controller_get_devdata(ctrl);
+ rtspi->dev_flags = (u32) device_get_match_data(&pdev->dev);
rtspi->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(rtspi->base)) {
@@ -174,8 +177,12 @@ static int realtek_rtl_spi_probe(struct platform_device *pdev)
ctrl->dev.of_node = pdev->dev.of_node;
ctrl->flags = SPI_CONTROLLER_HALF_DUPLEX;
+ ctrl->flags |= SPI_TX_DUAL | SPI_RX_DUAL;
+ if (rtspi->dev_flags & SPI_QUAD_SUPPORTED)
+ ctrl->flags |= SPI_TX_QUAD | SPI_RX_QUAD;
ctrl->set_cs = rt_set_cs;
ctrl->transfer_one = transfer_one;
+ ctrl->num_chipselect = rtspi->dev_flags & SPI_CSMAX_3?4:2;
err = devm_spi_register_controller(&pdev->dev, ctrl);
if (err) {
--
2.25.1
Powered by blists - more mailing lists