summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2020-11-27 16:29:47 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-30 11:51:41 +0100
commitee1d2aef1c134f77c5c1d1bf24ae01d17b308e93 (patch)
treedf6864d4fb3da96a80ab1d983be64f3e12d435c3 /drivers/spi
parent614f2529c8ea96a41c677c576491594ffc620ce6 (diff)
downloadlinux-stable-ee1d2aef1c134f77c5c1d1bf24ae01d17b308e93.tar.gz
linux-stable-ee1d2aef1c134f77c5c1d1bf24ae01d17b308e93.tar.bz2
linux-stable-ee1d2aef1c134f77c5c1d1bf24ae01d17b308e93.zip
spi: fsl: fix use of spisel_boot signal on MPC8309
commit 122541f2b10897b08f7f7e6db5f1eb693e51f0a1 upstream. Commit 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") broke the use of the SPISEL_BOOT signal as a chip select on the MPC8309. pdata->max_chipselect, which becomes master->num_chipselect, must be initialized to take into account the possibility that there's one more chip select in use than the number of GPIO chip selects. Cc: stable@vger.kernel.org # v5.4+ Cc: Christophe Leroy <christophe.leroy@c-s.fr> Cc: Linus Walleij <linus.walleij@linaro.org> Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors") Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Link: https://lore.kernel.org/r/20201127152947.376-1-rasmus.villemoes@prevas.dk Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-fsl-spi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
index be7c6ba73072..18a93a2854d8 100644
--- a/drivers/spi/spi-fsl-spi.c
+++ b/drivers/spi/spi-fsl-spi.c
@@ -717,10 +717,11 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
type = fsl_spi_get_type(&ofdev->dev);
if (type == TYPE_FSL) {
struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
+ bool spisel_boot = false;
#if IS_ENABLED(CONFIG_FSL_SOC)
struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
- bool spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
+ spisel_boot = of_property_read_bool(np, "fsl,spisel_boot");
if (spisel_boot) {
pinfo->immr_spi_cs = ioremap(get_immrbase() + IMMR_SPI_CS_OFFSET, 4);
if (!pinfo->immr_spi_cs) {
@@ -737,10 +738,14 @@ static int of_fsl_spi_probe(struct platform_device *ofdev)
* supported on the GRLIB variant.
*/
ret = gpiod_count(dev, "cs");
- if (ret <= 0)
+ if (ret < 0)
+ ret = 0;
+ if (ret == 0 && !spisel_boot) {
pdata->max_chipselect = 1;
- else
+ } else {
+ pdata->max_chipselect = ret + spisel_boot;
pdata->cs_control = fsl_spi_cs_control;
+ }
}
ret = of_address_to_resource(np, 0, &mem);