Skip to contentSkip to conversation

spi: Add support for Realtek RTL838x/RTL839x SoC SPI

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

Subsystems (2)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

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

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         |  36 +++
 MAINTAINERS                                   |   6 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-realtek-rtl.c                 | 205 ++++++++++++++++++
 4 files changed, 248 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 v3 1/2 dt-bindings: spi: Realtek RTL838x/RTL839x SPI controller

---
 .../bindings/spi/realtek,rtl-spi.yaml         | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml
Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml new file +36 -0
new file mode 100644
index 000000000000..0d3f8448c9ab
@@ -0,0 +1,36 @@
+# 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:
+    const: realtek,rtl-spi
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    spi: spi@1200 {
+        compatible = "realtek,rtl-spi";
+        reg = <0x1200 0x100>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
Signature · 1 line
2.25.1
maintainer
#2 lore raw

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

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

Quoted 2 lines · Bert Vermeulen
Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml new file +2 -0
+  compatible:
+    const: realtek,rtl-spi

This is still just using rtl-spi as the compatible string, please address the feedback on the previous version.

Please submit patches using subject lines reflecting the style for the subsystem, this makes it easier for people to identify relevant patches. Look at what existing commits in the area you're changing are doing and make sure your subject lines visually resemble what they're doing. There's no need to resubmit to fix this alone.

#3 lore raw

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

Quoted 7 lines · Mark Brown

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

Quoted 2 lines · Bert Vermeulen
Documentation/devicetree/bindings/spi/realtek,rtl-spi.yaml new file +2 -0
+  compatible:
+    const: realtek,rtl-spi

This is still just using rtl-spi as the compatible string, please address the feedback on the previous version.

Mark,

The rtl prefix really is as close as it gets. This is being developed on RTL838x and RTL839x, but the driver very likely also works on RTL8196C and RTL93xx series. There's no difference to the SPI block in those SoCs.

Do you really want a different per-series compatible when the "IP block" was just copy-pasted between series in hardware?

Signature · 2 lines
Bert Vermeulen
[email protected]
maintainer
#4 lore raw

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

Quoted 11 lines · Bert Vermeulen
Quoted 2 lines · Mark Brown

This is still just using rtl-spi as the compatible string, please address the feedback on the previous version.

The rtl prefix really is as close as it gets. This is being developed on RTL838x and RTL839x, but the driver very likely also works on RTL8196C and RTL93xx series. There's no difference to the SPI block in those SoCs.

Do you really want a different per-series compatible when the "IP block" was just copy-pasted between series in hardware?

Yes.

#5 lore raw

PATCH v3 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 | 205 ++++++++++++++++++++++++++++++++++
 3 files changed, 212 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 +205 -0

205 lines not on this page · raw message

Signature · 1 line
2.25.1