spi: Add a driver for the RPI RP2040 GPIO bridge

The Raspberry Pi RP2040 GPIO bridge is an I2C-attached device exposing
both a Tx-only SPI controller, and a GPIO controller.

Due to the relative difference in transfer rates between standard-mode
I2C and SPI, the GPIO bridge makes use of 12 MiB of non-volatile storage
to cache repeated transfers. This cache is arranged in ~8 KiB blocks and
is addressed by the MD5 digest of the data contained therein.

Optionally, this driver is able to take advantage of Raspberry Pi RP1
GPIOs to achieve faster than I2C data transfer rates.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>

spi: rp2040-gpio-bridge: Add debugfs progress indicator

Useful for tracking upload progress via userspace.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

spi: rp2040-gpio-bridge: add missing MD5 dependency

rp2040-gpio-bridge relies on the md5 crypto driver. This dependency
cannot be determined automatically as rp2040-gpio-bridge does not
use any of md5's symbols directly.

Declare a soft 'pre' dependency on md5 to ensure that it is included and
loaded before rp2040-gpio-bridge.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>

spi: rp2040-gpio-bridge: fix gpiod error handling

In some circumstances, devm_gpiod_get_array_optional() can return
PTR_ERR rather than NULL to indicate failure. Handle these cases.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>

spi: rp2040-gpio-bridge: probe: Cfg fast_xfer clk

Fast transfer mode requires that the first bit of data is clocked with a
rising edge. This can cause extra bits of data to be clocked on hardware
where the clock signal uses a pull-up. This change ensures that clk is
driven low before fast data transfer mode is entered.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
This commit is contained in:
Richard Oliver
2024-05-21 13:47:23 +01:00
committed by Dom Cobley
parent 59de9f6a2a
commit aed745565f
4 changed files with 1264 additions and 0 deletions

View File

@@ -21100,6 +21100,7 @@ RASPBERRY PI RP2040 GPIO BRIDGE DRIVER
M: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com> M: Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml F: Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml
F: drivers/spi/spi-rp2040-gpio-bridge.c
RASPBERRY PI PISP BACK END RASPBERRY PI PISP BACK END
M: Jacopo Mondi <jacopo.mondi@ideasonboard.com> M: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

View File

@@ -920,6 +920,18 @@ config SPI_RB4XX
help help
SPI controller driver for the Mikrotik RB4xx series boards. SPI controller driver for the Mikrotik RB4xx series boards.
config SPI_RP2040_GPIO_BRIDGE
tristate "Raspberry Pi RP2040 GPIO Bridge"
depends on I2C && SPI && GPIOLIB
help
Support for the Raspberry Pi RP2040 GPIO bridge.
This driver provides support for the Raspberry Pi PR2040 GPIO bridge.
It can be used as a GPIO expander and a Tx-only SPI master.
Optionally, this driver is able to take advantage of Raspberry Pi RP1
GPIOs to achieve faster than I2C data transfer rates.
config SPI_RPCIF config SPI_RPCIF
tristate "Renesas RPC-IF SPI driver" tristate "Renesas RPC-IF SPI driver"
depends on RENESAS_RPCIF depends on RENESAS_RPCIF

View File

@@ -125,6 +125,7 @@ obj-$(CONFIG_SPI_ROCKCHIP_SFC) += spi-rockchip-sfc.o
obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o
obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o
obj-$(CONFIG_SPI_REALTEK_SNAND) += spi-realtek-rtl-snand.o obj-$(CONFIG_SPI_REALTEK_SNAND) += spi-realtek-rtl-snand.o
obj-$(CONFIG_SPI_RP2040_GPIO_BRIDGE) += spi-rp2040-gpio-bridge.o
obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o
obj-$(CONFIG_SPI_RSPI) += spi-rspi.o obj-$(CONFIG_SPI_RSPI) += spi-rspi.o
obj-$(CONFIG_SPI_RZV2H_RSPI) += spi-rzv2h-rspi.o obj-$(CONFIG_SPI_RZV2H_RSPI) += spi-rzv2h-rspi.o

File diff suppressed because it is too large Load Diff