Skip to content

Commit 040f7f9

Browse files
Dilip Kotabroonie
authored andcommitted
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]> Link: https://lore.kernel.org/r/4d61a75381aca9479f9fc15d07a7b05534da6bb3.1594957019.git.eswara.kota@linux.intel.com Signed-off-by: Mark Brown <[email protected]>
1 parent 744cd0f commit 040f7f9

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

drivers/spi/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,11 @@ config SPI_NPCM_PSPI
501501

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

510510
config SPI_OC_TINY
511511
tristate "OpenCores tiny SPI"

drivers/spi/spi-lantiq-ssc.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,24 @@ static irqreturn_t lantiq_ssc_err_interrupt(int irq, void *data)
702702
return IRQ_HANDLED;
703703
}
704704

705+
static irqreturn_t intel_lgm_ssc_isr(int irq, void *data)
706+
{
707+
struct lantiq_ssc_spi *spi = data;
708+
const struct lantiq_ssc_hwcfg *hwcfg = spi->hwcfg;
709+
u32 val = lantiq_ssc_readl(spi, hwcfg->irncr);
710+
711+
if (!(val & LTQ_SPI_IRNEN_ALL))
712+
return IRQ_NONE;
713+
714+
if (val & LTQ_SPI_IRNEN_E)
715+
return lantiq_ssc_err_interrupt(irq, data);
716+
717+
if ((val & hwcfg->irnen_t) || (val & hwcfg->irnen_r))
718+
return lantiq_ssc_xmit_interrupt(irq, data);
719+
720+
return IRQ_HANDLED;
721+
}
722+
705723
static int transfer_start(struct lantiq_ssc_spi *spi, struct spi_device *spidev,
706724
struct spi_transfer *t)
707725
{
@@ -802,6 +820,17 @@ static int lantiq_ssc_transfer_one(struct spi_master *master,
802820
return transfer_start(spi, spidev, t);
803821
}
804822

823+
static int intel_lgm_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi)
824+
{
825+
int irq;
826+
827+
irq = platform_get_irq(pdev, 0);
828+
if (irq < 0)
829+
return irq;
830+
831+
return devm_request_irq(&pdev->dev, irq, intel_lgm_ssc_isr, 0, "spi", spi);
832+
}
833+
805834
static int lantiq_cfg_irq(struct platform_device *pdev, struct lantiq_ssc_spi *spi)
806835
{
807836
int irq, err;
@@ -854,10 +883,21 @@ static const struct lantiq_ssc_hwcfg lantiq_ssc_xrx = {
854883
.irq_ack = false,
855884
};
856885

886+
static const struct lantiq_ssc_hwcfg intel_ssc_lgm = {
887+
.cfg_irq = intel_lgm_cfg_irq,
888+
.irnen_r = LTQ_SPI_IRNEN_R_XRX,
889+
.irnen_t = LTQ_SPI_IRNEN_T_XRX,
890+
.irnicr = 0xFC,
891+
.irncr = 0xF8,
892+
.fifo_size_mask = GENMASK(7, 0),
893+
.irq_ack = true,
894+
};
895+
857896
static const struct of_device_id lantiq_ssc_match[] = {
858897
{ .compatible = "lantiq,ase-spi", .data = &lantiq_ssc_xway, },
859898
{ .compatible = "lantiq,falcon-spi", .data = &lantiq_ssc_xrx, },
860899
{ .compatible = "lantiq,xrx100-spi", .data = &lantiq_ssc_xrx, },
900+
{ .compatible = "intel,lgm-spi", .data = &intel_ssc_lgm, },
861901
{},
862902
};
863903
MODULE_DEVICE_TABLE(of, lantiq_ssc_match);

0 commit comments

Comments
 (0)