2020-04-24 10:46:35

by Dilip Kota

[permalink] [raw]
Subject: [PATCH 4/4] spi: lantiq: Add support to Lightning Mountain SoC

Add support to SPI controller on Intel Atom based Lightning Mountain
SoC which reuses Lantiq SPI controller IP.

Signed-off-by: Dilip Kota <[email protected]>
---
drivers/spi/Kconfig | 4 ++--
drivers/spi/spi-lantiq-ssc.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 4887be7f16de..089b0ba4afe3 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -495,11 +495,11 @@ config SPI_NPCM_PSPI

config SPI_LANTIQ_SSC
tristate "Lantiq SSC SPI controller"
- depends on LANTIQ || COMPILE_TEST
+ depends on (LANTIQ || X86) || COMPILE_TEST
help
This driver supports the Lantiq SSC SPI controller in master
mode. This controller is found on Intel (former Lantiq) SoCs like
- the Danube, Falcon, xRX200, xRX300.
+ the Danube, Falcon, xRX200, xRX300, Lightning Mountain.

config SPI_OC_TINY
tristate "OpenCores tiny SPI"
diff --git a/drivers/spi/spi-lantiq-ssc.c b/drivers/spi/spi-lantiq-ssc.c
index 74a5d36c5048..f07fa6fbadbe 100644
--- a/drivers/spi/spi-lantiq-ssc.c
+++ b/drivers/spi/spi-lantiq-ssc.c
@@ -789,6 +789,18 @@ static int lantiq_ssc_transfer_one(struct spi_master *master,
return transfer_start(spi, spidev, t);
}

+static int intel_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi)
+{
+ int irq;
+
+ irq = platform_get_irq(pdev, 0);
+ if (irq < 0)
+ return irq;
+
+ return devm_request_threaded_irq(&pdev->dev, irq, NULL, lantiq_ssc_isr,
+ IRQF_ONESHOT, "spi", spi);
+}
+
static int lantiq_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi)
{
int irq, err;
@@ -837,10 +849,18 @@ static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = {
.irq_ack = false,
};

+static const struct lantiq_ssc_hwcfg intel_ssc_lgm = {
+ .irnen_r = LTQ_SPI_IRNEN_R_XRX,
+ .irnen_t = LTQ_SPI_IRNEN_T_XRX,
+ .fifo_size_mask = GENMASK(7, 0),
+ .cfg_irq = intel_cfg_irq,
+};
+
static const struct of_device_id lantiq_ssc_match[] = {
{ .compatible = "lantiq,ase-spi", .data = &lantiq_ssc_xway, },
{ .compatible = "lantiq,falcon-spi", .data = &lantiq_ssc_xrx, },
{ .compatible = "lantiq,xrx100-spi", .data = &lantiq_ssc_xrx, },
+ { .compatible = "intel,lgm-spi", .data = &intel_ssc_lgm, },
{},
};
MODULE_DEVICE_TABLE(of, lantiq_ssc_match);
--
2.11.0