linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] spi: SPI bus multiplexer
@ 2019-04-12  5:02 Chris Packham
  2019-04-12  5:02 ` [PATCH 1/3] dt-bindings: spi: Add spi-mux-gpio Chris Packham
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Chris Packham @ 2019-04-12  5:02 UTC (permalink / raw)
  To: broonie, robh+dt, mark.rutland
  Cc: Hamish Martin, linux-spi, devicetree, linux-kernel, Chris Packham

Hi All,

I have a hardware design where a single SPI chip select is steered by a
GPIO being asserted or de-asserted. On older kernels I was able to
(ab)use a gpio-hog and cs-gpios to deal with this.

Unfortunately recent changes have stopped my hacks from working. I've
tried adapting cs-gpios to work with my particular hardware but I came
to the realisation that the current cs-gpios support assumes a 1:1
mapping of gpio to SPI device whereas my hardware used the state of the
gpio selecting the device i.e. a 1:2 mapping.

This is my attempt to implement a driver to deal with this. One nice
property is that it is pretty much self contained. The only change to
the core SPI infrastructure is exposing a function I needed to lookup
the spi_controller instance.

Chris Packham (3):
  dt-bindings: spi: Add spi-mux-gpio
  spi: Make of_find_spi_controller_by_node visible
  spi: Add SPI bus gpio multiplexer

 .../devicetree/bindings/spi/spi-mux-gpio.txt  |  46 +++++
 drivers/spi/Kconfig                           |   7 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-mux-gpio.c                    | 169 ++++++++++++++++++
 drivers/spi/spi.c                             |   7 +-
 include/linux/spi/spi.h                       |   7 +
 6 files changed, 234 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-mux-gpio.txt
 create mode 100644 drivers/spi/spi-mux-gpio.c

-- 
2.21.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-13  3:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-12  5:02 [PATCH 0/3] spi: SPI bus multiplexer Chris Packham
2019-04-12  5:02 ` [PATCH 1/3] dt-bindings: spi: Add spi-mux-gpio Chris Packham
2019-04-29 21:37   ` Rob Herring
2020-01-13  3:43     ` Chris Packham
2019-04-12  5:02 ` [PATCH 2/3] spi: Make of_find_spi_controller_by_node visible Chris Packham
2019-04-12  5:02 ` [PATCH 3/3] spi: Add SPI bus gpio multiplexer Chris Packham
2019-04-12  8:29 ` [PATCH 0/3] spi: SPI bus multiplexer Mark Brown
2019-04-28 22:28   ` Chris Packham
2019-05-02  2:45     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).