mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-03-09 15:40:20 +00:00
Add a directory by kernel instead of a common root, add qnap-301w and rpi4 kernel 6.1 suppport
This commit is contained in:
parent
e910436a7a
commit
46837ec4c0
9459 changed files with 362648 additions and 116345 deletions
|
|
@ -0,0 +1,62 @@
|
|||
From ed779f81991fd67ecd14a2fe7240269adf1410c1 Mon Sep 17 00:00:00 2001
|
||||
From: Phil Elwell <phil@raspberrypi.com>
|
||||
Date: Wed, 12 Jan 2022 08:23:28 +0000
|
||||
Subject: [PATCH 397/726] spi: gpio: Add sck-idle-input property
|
||||
|
||||
The sck-idle-input property indicates that the spi-gpio driver should
|
||||
return the SCK line to an input when the chip select signals are
|
||||
inactive.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
||||
---
|
||||
drivers/spi/spi-gpio.c | 13 +++++++++++--
|
||||
1 file changed, 11 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
|
||||
index 9c8c7948044e..5b52159e2dc0 100644
|
||||
--- a/drivers/spi/spi-gpio.c
|
||||
+++ b/drivers/spi/spi-gpio.c
|
||||
@@ -35,6 +35,7 @@ struct spi_gpio {
|
||||
struct gpio_desc *sck;
|
||||
struct gpio_desc *miso;
|
||||
struct gpio_desc *mosi;
|
||||
+ bool sck_idle_input;
|
||||
struct gpio_desc **cs_gpios;
|
||||
};
|
||||
|
||||
@@ -225,8 +226,12 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
|
||||
struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
|
||||
|
||||
/* set initial clock line level */
|
||||
- if (is_active)
|
||||
- gpiod_set_value_cansleep(spi_gpio->sck, spi->mode & SPI_CPOL);
|
||||
+ if (is_active) {
|
||||
+ if (spi_gpio->sck_idle_input)
|
||||
+ gpiod_direction_output(spi_gpio->sck, spi->mode & SPI_CPOL);
|
||||
+ else
|
||||
+ gpiod_set_value_cansleep(spi_gpio->sck, spi->mode & SPI_CPOL);
|
||||
+ }
|
||||
|
||||
/* Drive chip select line, if we have one */
|
||||
if (spi_gpio->cs_gpios) {
|
||||
@@ -235,6 +240,9 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
|
||||
/* SPI chip selects are normally active-low */
|
||||
gpiod_set_value_cansleep(cs, (spi->mode & SPI_CS_HIGH) ? is_active : !is_active);
|
||||
}
|
||||
+
|
||||
+ if (spi_gpio->sck_idle_input && !is_active)
|
||||
+ gpiod_direction_input(spi_gpio->sck);
|
||||
}
|
||||
|
||||
static int spi_gpio_setup(struct spi_device *spi)
|
||||
@@ -323,6 +331,7 @@ static int spi_gpio_request(struct device *dev, struct spi_gpio *spi_gpio)
|
||||
if (IS_ERR(spi_gpio->miso))
|
||||
return PTR_ERR(spi_gpio->miso);
|
||||
|
||||
+ spi_gpio->sck_idle_input = device_property_read_bool(dev, "sck-idle-input");
|
||||
spi_gpio->sck = devm_gpiod_get(dev, "sck", GPIOD_OUT_LOW);
|
||||
return PTR_ERR_OR_ZERO(spi_gpio->sck);
|
||||
}
|
||||
--
|
||||
2.33.1
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue