mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-05 05:41:43 +00:00
fix cs_gpio SPI support
This commit is contained in:
parent
45f58905d6
commit
9f68190d34
1 changed files with 24 additions and 0 deletions
24
patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch
Normal file
24
patch/kernel/sunxi-dev/general-fix-cs_gpio-spi-support.patch
Normal file
|
@ -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",
|
Loading…
Add table
Reference in a new issue