Skip to content

Commit 5ee67b5

Browse files
Yuan Yaobroonie
Yuan Yao
authored andcommitted
spi: dspi: clear SPI_SR before enable interrupt
Once dspi is used in uboot, the SPI_SR have been set by some value. At this time, if kernel enable the interrupt before clear the status flag, that will trigger the wrong interrupt. Signed-off-by: Yuan Yao <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 1001354 commit 5ee67b5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/spi/spi-fsl-dspi.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
#define SPI_SR 0x2c
7171
#define SPI_SR_EOQF 0x10000000
7272
#define SPI_SR_TCFQF 0x80000000
73+
#define SPI_SR_CLEAR 0xdaad0000
7374

7475
#define SPI_RSER 0x30
7576
#define SPI_RSER_EOQFE 0x10000000
@@ -646,6 +647,11 @@ static const struct regmap_config dspi_regmap_config = {
646647
.max_register = 0x88,
647648
};
648649

650+
static void dspi_init(struct fsl_dspi *dspi)
651+
{
652+
regmap_write(dspi->regmap, SPI_SR, SPI_SR_CLEAR);
653+
}
654+
649655
static int dspi_probe(struct platform_device *pdev)
650656
{
651657
struct device_node *np = pdev->dev.of_node;
@@ -709,6 +715,7 @@ static int dspi_probe(struct platform_device *pdev)
709715
return PTR_ERR(dspi->regmap);
710716
}
711717

718+
dspi_init(dspi);
712719
dspi->irq = platform_get_irq(pdev, 0);
713720
if (dspi->irq < 0) {
714721
dev_err(&pdev->dev, "can't get platform irq\n");

0 commit comments

Comments
 (0)