armbian_build/patch/kernel/archive/sunxi-5.12/general-fix-cs_gpio-spi-support.patch
Igor Pečovnik 3b3d85e25c
Upgrade EDGE to 5.12.y (#2825)
* Bump imx6 edge to 5.12.y

* Bump odroid xu4 edge to 5.12.y

* Bump Jetson nano edge to 5.12.y

* WIP: Bump sunxi to 5.12.y

- create a copy of patches and make a new link
- wireless patches needs adjutement to 5.12
- some patches are still failing

* Adjust wireless patches to build on 5.12.y

* Remove template wireless patch

* Move Espressobin edge to 5.12.y

* Bump mvebu to 5.12

- patch 92-mvebu-gpio-remove-hardcoded-timer-assignment.patch was disabled @heisath
- adjusted wireless driver for 8723ds

* Adjust sunxi / sunxi64 edge to compile

* Fix kernel config for Jetson nano edge

* bump meson64 to 5.12.y

* bump rockchip edge to 5.12.y

* Bump rockchip64 to 5.12.y

* Bump rk322x edge to 5.12.y

@paolosabatino

* Cleanup im6, re-add 5.10.y patches since one is missing in 5.12.y

* Update odroidxu4 edge links

* rk322x: moved rk322x-edge to kernel 5.12, fix overlay compilation, retouched included kernel modules

* Cleanup: remove deprecated config

Co-authored-by: Paolo Sabatino <paolo.sabatino@gmail.com>
2021-05-22 17:08:44 +02:00

25 lines
870 B
Diff

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 5e4c453..028ef66 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3262,6 +3262,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);
+ }
+ }
+
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
status = pm_runtime_get_sync(spi->controller->dev.parent);
if (status < 0) {