From efccf28e481f39bb3e0ddadbe80c13822ebe64f7 Mon Sep 17 00:00:00 2001
From: Richard Oliver <richard.oliver@raspberrypi.com>
Date: Fri, 24 May 2024 10:34:45 +0100
Subject: [PATCH] spi: dt-bindings: Add RPI RP2040 GPIO Bridge

Add YAML device tree bindings for the Raspberry Pi RP2040 GPIO Bridge.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
---
 .../spi/raspberrypi,rp2040-gpio-bridge.yaml   | 77 +++++++++++++++++++
 MAINTAINERS                                   |  5 ++
 2 files changed, 82 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml

--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/raspberrypi,rp2040-gpio-bridge.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Raspberry Pi RP2040 GPIO Bridge
+
+maintainers:
+  - Raspberry Pi <kernel-list@raspberrypi.com>
+
+description: |-
+  The Raspberry Pi PR2040 GPIO bridge can be used as a GPIO expander and
+  Tx-only SPI master.
+
+properties:
+  reg:
+    description: I2C slave address
+    const: 0x40
+
+  compatible:
+    const: raspberrypi,rp2040-gpio-bridge
+
+  power-supply:
+    description: Phandle to the regulator that powers the RP2040.
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  '#gpio-cells':
+    const: 2
+
+  gpio-controller: true
+
+  fast_xfer_requires_i2c_lock:
+    description: Set if I2C bus should be locked during fast transfer.
+
+  fast_xfer_recv_gpio_base:
+    description: RP2040 GPIO base for fast transfer pair.
+
+  fast_xfer-gpios:
+    description: RP1 GPIOs to use for fast transfer clock and data.
+
+required:
+  - reg
+  - compatible
+  - power-supply
+  - '#gpio-cells'
+  - gpio-controller
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      spi@40 {
+        reg = <0x40>;
+        compatible = "raspberrypi,rp2040-gpio-bridge";
+        status = "disabled";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        power-supply = <&cam_dummy_reg>;
+
+        #gpio-cells = <2>;
+        gpio-controller;
+      };
+    };
+
+...
+
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19355,6 +19355,11 @@ L:	linux-edac@vger.kernel.org
 S:	Maintained
 F:	drivers/ras/amd/fmpm.c
 
+RASPBERRY PI RP2040 GPIO BRIDGE DRIVER
+M:	Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/spi/raspberrypi,rp2040-gpio-bridge.yaml
+
 RASPBERRY PI PISP BACK END
 M:	Jacopo Mondi <jacopo.mondi@ideasonboard.com>
 L:	Raspberry Pi Kernel Maintenance <kernel-list@raspberrypi.com>
