From: Chris Packham <chris.packham@alliedtelesis.co.nz>
To: broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com
Cc: Hamish Martin <hamish.martin@alliedtelesis.co.nz>,
linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Chris Packham <chris.packham@alliedtelesis.co.nz>
Subject: [PATCH 0/3] spi: SPI bus multiplexer
Date: Fri, 12 Apr 2019 17:02:10 +1200 [thread overview]
Message-ID: <20190412050213.17698-1-chris.packham@alliedtelesis.co.nz> (raw)
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
next reply other threads:[~2019-04-12 5:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 5:02 Chris Packham [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412050213.17698-1-chris.packham@alliedtelesis.co.nz \
--to=chris.packham@alliedtelesis.co.nz \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hamish.martin@alliedtelesis.co.nz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).