gpio: sn54hc595: new driver for GPIO shift registers chipsets
Subsystems (2)
PATCH 1/1 gpio: sn54hc595: new driver for GPIO shift registers chipsets
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++ 4 files changed, 266 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-sn54hc595.txt create mode 100644 drivers/gpio/gpio-sn54hc595.c
Documentation/devicetree/bindings/gpio/gpio-sn54hc595.txt new file +35 -0
@@ -0,0 +1,35 @@ +GPIO controller based on SN54HC595 / SN74HC595 shift registers +============================================================== + +Required properties: + +- compatible : ti,sn54hc595 + +- ser-gpios : GPIO connected to the serial (SER) input + +- srclk-gpios : GPIO connected to the shift register clock (SRCLK) input + +- srclr-gpios : GPIO connected to the overriding clear (SRCLR) input + +- rclk-gpios : GPIO connected to the register clock (RCLK) input + +- oe-gpios : GPIO connected to the output-enable (OE) input + +- gpio-controller: Marks the device node as a GPIO controller. + +- #gpio-cells : Should be two. Pin number and the optional parameters. + +Example: + + sn54hc595 { + compatible = "ti,sn54hc595"; + + ser-gpios = <&gpio0 3 0>; + srclk-gpios = <&gpio0 4 0>; + srclr-gpios = <&gpio0 5 0>; + rclk-gpios = <&gpio0 6 0>; + oe-gpios = <&gpio0 7 0>; + + gpio-controller; + #gpio-cells = <2>; + };
drivers/gpio/Kconfig +11 -0
@@ -457,6 +457,17 @@ config GPIO_TB10X select GENERIC_IRQ_CHIP select OF_GPIO +comment "GPIO to GPIO expanders:" + +config GPIO_SN54HC595 + tristate "SN54HC595 / SN74HC595 SIPO shift register" + depends on OF + help + The 'HC595 devices contain 8 shift registers and are controlled using + 5 input signals. + This driver controls inputs with 5 GPIOs and registers GPIO chip with + 8 outputs. + comment "I2C GPIO expanders:" config GPIO_ARIZONA
drivers/gpio/Makefile +1 -0
@@ -74,6 +74,7 @@ obj-$(CONFIG_GPIO_SAMSUNG) += gpio-samsung.o obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o obj-$(CONFIG_GPIO_SCH) += gpio-sch.o obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o +obj-$(CONFIG_GPIO_SN54HC595) += gpio-sn54hc595.o obj-$(CONFIG_GPIO_SODAVILLE) += gpio-sodaville.o obj-$(CONFIG_GPIO_SPEAR_SPICS) += gpio-spear-spics.o obj-$(CONFIG_GPIO_STA2X11) += gpio-sta2x11.o
drivers/gpio/gpio-sn54hc595.c new file +219 -0
219 lines not on this page · raw message
Signature · 6 lines
1.8.4.5 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Rafał,
Quoted 12 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Quoted 6 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++
The '595 is already handled by drivers/gpio/gpio-74x164.c.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Geert Uytterhoeven
Hi Rafał,
Quoted 12 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Quoted 8 lines
Quoted 6 lines
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.c seems to be tight closely to the SPI. In my case it's GPIO-controller '595.
Do you have any other idea how we could handle this?
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Rafał,
Quoted 21 lines · Rafał Miłecki
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++
Quoted 4 lines
Quoted 1 line
The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.
Right. gpio-74x164.c uses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) of spi-gpio.c, and is limited to connecting to GPIO pins.
Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 29 lines · Geert Uytterhoeven
Hi Rafał,
Quoted 21 lines · Rafał Miłecki
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++Quoted 4 lines
Quoted 1 line
The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.
Quoted 8 lines
Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't take spi_device parameter and doesn't do spi setup
3) Extend struct gen_74x164_chip to include GPIOs
4) Use totally different __gen_74x164_write_config
Amount of shared code would be so small I doubt it's worth it. Both driver are quite trivial (200 or less LOC). Sharing:
1) ~5 lines long __gen_74x164_write_config
2) ~5 lines long gen_74x164_set_value
3) 1 line long gen_74x164_direction_output
makes me feel it's not really worth combining these two drivers into a one. --
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 42 lines · On Monday 08 December 2014 16:23:01 Rafał Miłecki wrote:
Quoted 29 lines · Geert Uytterhoeven
Hi Rafał,
Quoted 21 lines · Rafał Miłecki
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++Quoted 4 lines
Quoted 1 line
The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.Quoted 8 lines
Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
Quoted 6 lines
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't takespi_deviceparameter and doesn't do spi setup
3) Extend structgen_74x164_chipto include GPIOs
4) Use totally different__gen_74x164_write_config
I think the suggestion was to use the spi-gpio driver in combination with gpio-74x164.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 50 lines · Arnd Bergmann
Quoted 42 lines · On Monday 08 December 2014 16:23:01 Rafał Miłecki wrote:
Quoted 29 lines · Geert Uytterhoeven
Hi Rafał,
Quoted 21 lines · Rafał Miłecki
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++Quoted 4 lines
Quoted 1 line
The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.Quoted 8 lines
Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
Quoted 6 lines
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't takespi_deviceparameter and doesn't do spi setup
3) Extend structgen_74x164_chipto include GPIOs
4) Use totally different__gen_74x164_write_config
Quoted 2 lines
I think the suggestion was to use the spi-gpio driver in combination with gpio-74x164.
Oh, OK, I've obviously missed that.
I don't know... I'm somehow not really convinced to that, because AFAIK there isn't any SPI master device between GPIOs and 'HC595. I don't know if pretending there is some extra hardware (just to use another Linux driver/layer) is a good idea. This would:
1) Not match hardware design
2) Involve some extra code.
I'm not even sure if this would work out-of-the box (without some extra changes) at all. From early look at spi-gpio.c I can't see it implementing everything I need for GPIO-connected 'HC595. I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 37 lines · On Monday 08 December 2014 17:31:45 Rafał Miłecki wrote:
Quoted 24 lines · Arnd Bergmann
Quoted 16 lines · On Monday 08 December 2014 16:23:01 Rafał Miłecki wrote:
Quoted 11 lines · Geert Uytterhoeven
Quoted 2 lines
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
Quoted 6 lines
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't takespi_deviceparameter and doesn't do spi setup
3) Extend structgen_74x164_chipto include GPIOs
4) Use totally different__gen_74x164_write_configQuoted 2 lines
I think the suggestion was to use the spi-gpio driver in combination with gpio-74x164.
Oh, OK, I've obviously missed that.
I don't know... I'm somehow not really convinced to that, because AFAIK there isn't any SPI master device between GPIOs and 'HC595. I don't know if pretending there is some extra hardware (just to use another Linux driver/layer) is a good idea. This would:
1) Not match hardware design
2) Involve some extra code.
Quoted 5 lines
I'm not even sure if this would work out-of-the box (without some extra changes) at all. From early look at
spi-gpio.cI can't see it implementing everything I need for GPIO-connected 'HC595. I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
The purpose of the spi-gpio driver is to avoid having to write two drivers for every spi slave device if someone wants to drive it using bit-banged gpios.
The existing users of the driver are in fact all using spi-gpio, see:arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts arch/arm/boot/dts/imx28-cfa10049.dts
and in openwrt:target/linux/brcm63xx/patches-3.14/501-board-NB4.patch target/linux/brcm63xx/patches-3.14/526-board_CT6373-1.patch
so there shouldn't be too much missing, and extending spi-gpio for any missing features would help other people trying to attach random spi devices using gpio as well.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Rafał,
Quoted 49 lines · Rafał Miłecki
Quoted 48 lines · Arnd Bergmann
Quoted 46 lines · On Monday 08 December 2014 16:23:01 Rafał Miłecki wrote:
Quoted 27 lines · Geert Uytterhoeven
Quoted 21 lines · Rafał Miłecki
Quoted 20 lines · Geert Uytterhoeven
Quoted 18 lines · Rafał Miłecki
SN54HC595 and SN74HC595 are devices based on shift registers controlled with 5 input signals (serial-in) and providing 8 outputs (parallel-out).
They are present on some Broadcom home router boards where manufacturer needed few extra GPIOs.
This driver simply uses specified GPIOs to control shift registers and registers another GPIO chip. So you can call it a GPIO extender.
Due to the hardware design only output direction is supported. Reading values is handled using tiny internal cache.
Signed-off-by Rafał Miłecki <[email protected]>--- .../devicetree/bindings/gpio/gpio-sn54hc595.txt | 35 ++++ drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-sn54hc595.c | 219 +++++++++++++++++++++Quoted 4 lines
Quoted 1 line
The '595 is already handled by
drivers/gpio/gpio-74x164.c.
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.Quoted 8 lines
Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't takespi_deviceparameter and doesn't do spi setup
3) Extend structgen_74x164_chipto include GPIOs
4) Use totally different__gen_74x164_write_config
Quoted 7 lines
Quoted 2 lines
I think the suggestion was to use the spi-gpio driver in combination with gpio-74x164.
Oh, OK, I've obviously missed that.
I don't know... I'm somehow not really convinced to that, because AFAIK there isn't any SPI master device between GPIOs and 'HC595. I
There is: you implement SPI using bitbang on GPIOs.
Quoted 8 lines
don't know if pretending there is some extra hardware (just to use another Linux driver/layer) is a good idea. This would:
1) Not match hardware design
2) Involve some extra code.I'm not even sure if this would work out-of-the box (without some extra changes) at all. From early look at
spi-gpio.cI can't see it implementing everything I need for GPIO-connected 'HC595.
It should. Plenty of people have connected '595s to SPI buses (I did so myself, too). Hint: connect chip select to the register clock.
Quoted 2 lines
I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Yes, it will require more code, as spi-gpio is more generic than your simple implementation. But the end result is more flexible and reusable.
The only thing missing is the programmable OE and reset pins, which are assumed hardwired by the gpio-74x164 driver. These could be implemented using new gpio-oe and gpio-reset properties.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 44 lines · Arnd Bergmann
Quoted 37 lines · On Monday 08 December 2014 17:31:45 Rafał Miłecki wrote:
Quoted 24 lines · Arnd Bergmann
Quoted 16 lines · On Monday 08 December 2014 16:23:01 Rafał Miłecki wrote:
Quoted 11 lines · Geert Uytterhoeven
Quoted 2 lines
gpio-74x164.cseems to be tight closely to the SPI. In my case it's GPIO-controller '595.Right.
gpio-74x164.cuses the SPI framework, so it will work with any SPI master controller, while your driver contains a very simple variant (without any timing constraints) ofspi-gpio.c, and is limited to connecting to GPIO pins.Quoted 1 line
Do you have any other idea how we could handle this?
Your driver does provide OE support, which gpio-74x164 doesn't support. Perhaps that can be added to gpio-74x164 instead?
It's not the missing OE support in gpio-74x164 that worries me, but the whole rest.
Quoted 6 lines
I would need to modify gpio-74x164 to:
1) Use another OF table with different entry
2) Use different probe function that doesn't takespi_deviceparameter and doesn't do spi setup
3) Extend structgen_74x164_chipto include GPIOs
4) Use totally different__gen_74x164_write_configQuoted 2 lines
I think the suggestion was to use the spi-gpio driver in combination with gpio-74x164.
Oh, OK, I've obviously missed that.
I don't know... I'm somehow not really convinced to that, because AFAIK there isn't any SPI master device between GPIOs and 'HC595. I don't know if pretending there is some extra hardware (just to use another Linux driver/layer) is a good idea. This would:
1) Not match hardware design
2) Involve some extra code.Quoted 5 lines
I'm not even sure if this would work out-of-the box (without some extra changes) at all. From early look at
spi-gpio.cI can't see it implementing everything I need for GPIO-connected 'HC595. I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Quoted 8 lines
The purpose of the spi-gpio driver is to avoid having to write two drivers for every spi slave device if someone wants to drive it using bit-banged gpios.
The existing users of the driver are in fact all using spi-gpio, see:
arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dtsarch/arm/boot/dts/imx28-cfa10049.dts
I'm the one who worked on the cfa10049, and yeah, it worked pretty well at the time using spi-gpio.
We couldn't really do it any other way though, since we had another SPI device tied to the same bus, so it really felt like this was the right thing to do.
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Quoted 10 lines · Geert Uytterhoeven
Quoted 2 lines
I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Yes, it will require more code, as spi-gpio is more generic than your simple implementation. But the end result is more flexible and reusable.
The only thing missing is the programmable OE and reset pins, which are assumed hardwired by the gpio-74x164 driver. These could be implemented using new gpio-oe and gpio-reset properties.
From my (very) vague memories of it, OE was actually supported by using it as spi-gpio's chip select.
So I'd say that only the gpio-reset should be implemented.
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Quoted 12 lines · Maxime Ripard
Quoted 10 lines · Geert Uytterhoeven
Quoted 2 lines
I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Yes, it will require more code, as spi-gpio is more generic than your simple implementation. But the end result is more flexible and reusable.
The only thing missing is the programmable OE and reset pins, which are assumed hardwired by the gpio-74x164 driver. These could be implemented using new gpio-oe and gpio-reset properties.
Quoted 4 lines
From my (very) vague memories of it, OE was actually supported by using it as spi-gpio's chip select.
So I'd say that only the gpio-reset should be implemented.
I've tracked how spi_bitbang_transfer_one does work. Long story short it does:bitbang->chipselect(spi, BITBANG_CS_ACTIVE); bitbang->txrx_bufs(spi, t);bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
txrx_bufs is a pointer to one of:bitbang_txrx_be_cpha0bitbang_txrx_be_cpha1
Now, in cpha[01] for every register bit we call:
1) setmosi - to set data, so it's serial (SER)
2) setsck - to shift bits, so it's shift register clock (SRCLK)
Then in spi_gpio_chipselect we call:
1) cs_gpios[chip], so it's register clock (RCLK)
As you can see, we don't call OE in spi_gpio_chipselect. So currently both input signals and unhandled: OE and SRCLR. Luckily for me, it appears my bootloader puts them in a wanted state, but this still should be handled somehow.
Signature · 5 lines
Rafał -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Rafał Miłecki
Quoted 12 lines · Maxime Ripard
Quoted 10 lines · Geert Uytterhoeven
Quoted 2 lines
I think that implementing support for this extra SPI layer will actually require more code/tricks than a separated driver.
Yes, it will require more code, as spi-gpio is more generic than your simple implementation. But the end result is more flexible and reusable.
The only thing missing is the programmable OE and reset pins, which are assumed hardwired by the gpio-74x164 driver. These could be implemented using new gpio-oe and gpio-reset properties.
Quoted 6 lines
Quoted 4 lines
From my (very) vague memories of it, OE was actually supported by using it as spi-gpio's chip select.
So I'd say that only the gpio-reset should be implemented.
I've tracked how
spi_bitbang_transfer_onedoes work. Long story short it does:
[deleted standard SPI protocol]
Quoted 4 lines
As you can see, we don't call OE in
spi_gpio_chipselect. So currently both input signals and unhandled: OE and SRCLR. Luckily for me, it appears my bootloader puts them in a wanted state, but this still should be handled somehow.
I think you can just add two properties (one array for OE, one for SRCLR) to the bindings for the gpio-74x164 driver, so it can set those GPIO pins, if present. Note that they should be arrays, as gpio-74x164 supports\
daisy-chaining chips.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html