Patch "spi: fsl: Handle the single hardwired chipselect case" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    spi: fsl: Handle the single hardwired chipselect case

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     spi-fsl-handle-the-single-hardwired-chipselect-case.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f0858b4b54289e4053ec00dd47f5d2bd56fee0b2
Author: Linus Walleij <linus.walleij@xxxxxxxxxx>
Date:   Thu Nov 28 09:37:18 2019 +0100

    spi: fsl: Handle the single hardwired chipselect case
    
    [ Upstream commit 7251953d784baf7e5416afabe030a0e81de1a938 ]
    
    The Freescale MPC8xxx had a special quirk for handling a
    single hardwired chipselect, the case when we're using neither
    GPIO nor native chip select: when inspecting the device tree
    and finding zero "cs-gpios" on the device node the code would
    assume we have a single hardwired chipselect that leaves the
    device always selected.
    
    This quirk is not handled by the new core code, so we need
    to check the "cs-gpios" explicitly in the driver and set
    pdata->max_chipselect = 1 which will later fall through to
    the SPI master ->num_chipselect.
    
    Make sure not to assign the chip select handler in this
    case: there is no handling needed since the chip is always
    selected, and this is what the old code did as well.
    
    Cc: Christophe Leroy <christophe.leroy@xxxxxx>
    Reported-by: Christophe Leroy <christophe.leroy@xxxxxx>
    Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
    Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
    Tested-by: Christophe Leroy <christophe.leroy@xxxxxx> (No tested the
    Link: https://lore.kernel.org/r/20191128083718.39177-3-linus.walleij@xxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index ad1abea6e8b0..be7c6ba73072 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -729,8 +729,18 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
 			}
 		}
 #endif
-
-		pdata->cs_control = fsl_spi_cs_control;
+		/*
+		 * Handle the case where we have one hardwired (always selected)
+		 * device on the first "chipselect". Else we let the core code
+		 * handle any GPIOs or native chip selects and assign the
+		 * appropriate callback for dealing with the CS lines. This isn't
+		 * supported on the GRLIB variant.
+		 */
+		ret = gpiod_count(dev, "cs");
+		if (ret <= 0)
+			pdata->max_chipselect = 1;
+		else
+			pdata->cs_control = fsl_spi_cs_control;
 	}
 
 	ret = of_address_to_resource(np, 0, &mem);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux