Skip to contentSkip to conversation

spi: Add support for Realtek RTL838x/RTL839x SoC SPI

PATCH Superseded Bert Vermeulen 2 participants 4 messages Jan 5, 2021 – Jan 6, 2021

Subsystems (2)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover spi: Add support for Realtek RTL838x/RTL839x SoC SPI

v4:
- Added SoC series-specific compatible matches.

v3:
- Added cpu_relax() to busy loop.
- Dropped .remove callback from driver struct.
- Use (variations of) realtek-rtl as prefix.
- Dropped Kconfig entry, and use MACH_REALTEK_RTL setting to build the driver, since there's no point booting without the SPI-connected flash.

v2:
- Rewrote from spi-nor driver to regular spi driver, implementing only set_cs() and transfer_one(). (Thanks Chuanhong Guo!)

Bert Vermeulen (2):
dt-bindings: spi: Realtek RTL838x/RTL839x SPI controller
spi: realtek-rtl: Add support for Realtek RTL838x/RTL839x SoC SPI
controllers

 .../bindings/spi/realtek,rtl-spi.yaml         |  38 ++++
 MAINTAINERS                                   |   6 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-realtek-rtl.c                 | 206 ++++++++++++++++++
 4 files changed, 251 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml
 create mode 100644 drivers/spi/spi-realtek-rtl.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/2 dt-bindings: spi: Realtek RTL838x/RTL839x SPI controller

---
 .../bindings/spi/realtek,rtl-spi.yaml         | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml
Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml new file +38 -0
new file mode 100644
index 000000000000..c600e85b819b
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/realtek,rtl-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek RTL838x/RTL839x SPI controller
+
+maintainers:
+  - Bert Vermeulen <[email protected]>
+  - Birger Koblitz <[email protected]>
+
+allOf:
+  - $ref: "spi-controller.yaml#"
+
+properties:
+  compatible:
+    oneOf:
+      - const: realtek,rtl838x-spi
+      - const: realtek,rtl839x-spi
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi: spi@1200 {
+        compatible = "realtek,rtl838x-spi";
+        reg = <0x1200 0x100>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH v4 1/2] dt-bindings: spi: Realtek RTL838x/RTL839x SPI controller

Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml line 20

Quoted 3 lines · Bert Vermeulen
Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml new file +3 -0
+    oneOf:
+      - const: realtek,rtl838x-spi
+      - const: realtek,rtl839x-spi

These should list exact models, not wildcards.

#3 lore raw

PATCH v4 2/2 spi: realtek-rtl: Add support for Realtek RTL838x/RTL839x SoC SPI controllers

In reply to Bert Vermeulen

This driver likely also supports earlier (RTL8196) and later (RTL93xx) SoCs.

The SPI hardware in these SoCs is specifically intended for connecting NOR bootflash chips, and only used for that in dozens of examined devices. However boiled down to basics, it's really just a half-duplex SPI controller.

The hardware appears to have a vestigial second chip-select control, but it hasn't been seen in the wild and is thus not supported.

---
 MAINTAINERS                   |   6 +
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-realtek-rtl.c | 206 ++++++++++++++++++++++++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 drivers/spi/spi-realtek-rtl.c
MAINTAINERS +6 -0
index ad0e34bf8453..c6cb954e5ecf 100644
@@ -15048,6 +15048,12 @@ F:	Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
 F:	drivers/net/dsa/realtek-smi*
 F:	drivers/net/dsa/rtl83*
 
+REALTEK RTL83XX SPI DRIVER
+M:	Bert Vermeulen <[email protected]>
+M:	Birger Koblitz <[email protected]>
+S:	Maintained
+F:	drivers/spi/spi-realtek-rtl.c
+
 REALTEK WIRELESS DRIVER (rtlwifi family)
 M:	Ping-Ke Shih <[email protected]>
 L:	[email protected]
drivers/spi/Makefile +1 -0
index 6fea5821662e..182adef17013 100644
@@ -94,6 +94,7 @@ obj-$(CONFIG_SPI_QCOM_QSPI)		+= spi-qcom-qspi.o
 obj-$(CONFIG_SPI_QUP)			+= spi-qup.o
 obj-$(CONFIG_SPI_ROCKCHIP)		+= spi-rockchip.o
 obj-$(CONFIG_SPI_RB4XX)			+= spi-rb4xx.o
+obj-$(CONFIG_MACH_REALTEK_RTL)		+= spi-realtek-rtl.o
 obj-$(CONFIG_SPI_RPCIF)			+= spi-rpc-if.o
 obj-$(CONFIG_SPI_RSPI)			+= spi-rspi.o
 obj-$(CONFIG_SPI_S3C24XX)		+= spi-s3c24xx-hw.o
drivers/spi/spi-realtek-rtl.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.25.1