From 9f68190d348b24fcc3b47cee0d4d18f1b3cbef85 Mon Sep 17 00:00:00 2001 From: Martin Ayotte Date: Wed, 10 Apr 2019 17:38:57 -0400 Subject: [PATCH] fix cs_gpio SPI support --- .../general-fix-cs_gpio-spi-support.patch | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch diff --git a/patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch b/patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch new file mode 100644 index 000000000..4588287dc --- /dev/null +++ b/patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch @@ -0,0 +1,24 @@ +diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c +index 9a7def7..08c6a05 100644 +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -2884,6 +2884,19 @@ int spi_setup(struct spi_device *spi) + if (spi->controller->setup) + status = spi->controller->setup(spi); + ++ if (gpio_is_valid(spi->cs_gpio)) { ++ dev_info(&spi->dev, "spi_setup / gpio_is_valid(%d) ... doing gpio_request ...\n", spi->cs_gpio); ++ int ret = gpio_request(spi->cs_gpio, dev_name(&spi->dev)); ++ if (ret) { ++ dev_err(&spi->dev, "failed to request gpio\n"); ++ } ++ else { ++ gpio_direction_output(spi->cs_gpio, ++ !(spi->mode & SPI_CS_HIGH)); ++ dev_info(&spi->dev, "spi_setup / gpio_direction_output(%d) done !\n", spi->cs_gpio); ++ } ++ } ++ + spi_set_cs(spi, false); + + dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",