Skip to contentSkip to conversation

spi: Add support for Realtek RTL838x/RTL839x SoC SPI

PATCH In review Bert Vermeulen 2 participants 4 messages Jan 20, 2021 – Feb 4, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

v5:
- Changed SoC compatible to list exact models

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 SPI
controllers

 .../bindings/spi/realtek,rtl-spi.yaml         |  41 ++++
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-realtek-rtl.c                 | 209 ++++++++++++++++++
 3 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 v5 1/2 dt-bindings: spi: Realtek RTL838x/RTL839x SPI controller

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

PATCH v5 2/2 spi: realtek-rtl: Add support for Realtek RTL838x/RTL839x 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.

---
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-realtek-rtl.c | 209 ++++++++++++++++++++++++++++++++++
 2 files changed, 210 insertions(+)
 create mode 100644 drivers/spi/spi-realtek-rtl.c
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 +209 -0

209 lines not on this page · raw message

Signature · 1 line
2.25.1
maintainer
#3 lore raw
In reply to Bert Vermeulen
Quoted 6 lines · Bert Vermeulen

v5:
- Changed SoC compatible to list exact models

v4:
- Added SoC series-specific compatible matches.

Quoted 8 lines

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.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

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

      commit: 6acbd614c2c8d3b8de5fb7605d6e24b9b3a8a17b
[2/2] spi: realtek-rtl: Add support for Realtek RTL838x/RTL839x SPI controllers
      commit: a8af5cc2ff1e804694629a8ef320935629dd15ba

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark