Skip to contentSkip to conversation

spi: Add Renesas R-Car Gen3 RPC-IF SPI driver

PATCH Superseded Mason Yang 2 participants 7 messages Jul 26, 2019 – Jul 29, 2019

Subsystems (2)

v15 of 17 Superseded Latest is v17 →

lore
Share & tools
lore

Mason Yang

author
#0 lore raw

v15 cover spi: Add Renesas R-Car Gen3 RPC-IF SPI driver

Hi Mark,

v15 patch including:
1) A typo in dt-bindings and add flash subnode description
2) v14 dt-binding file has reviewed by Rob Herring.

v14 patch including:
1) Patch RPC-IF back to SPI mode only instead of MFD & SPI by MFD maintainer, Lee Jones comments.
2) Patch pm_runtime control in spi transfer.

v13 patch including:
1) rename mfd to ddata for SPI driver.
2) Patch RPC-IF devicetree for SPI and HyperFlash.

v12 patch including:
1) add back "wbuf" in dts example.
2) RPC-IF replace rpc-if in dts.

v11 patch including:
1) Patch mfd include header file.
2) mfd coding style.
3) add back wbuf description in dts.

v10 patch including:
1) Address range for > 64M byte flash.
2) Removed dirmap_write due to WBUF 256 bytes transfer issue.
3) Dummy bytes setting according to spi-nor.c layer.

v9 patch is for RPC MFD driver and RPC SPI driver.

v8 patch including:
1) Supported SoC-specific values in DTS.
2) Rename device node name as flash.

v7 patch is according to Geert and Sergei's comments:
1) Add all R-Car Gen3 model in dts.
2) patch rpc-if child node search.
3) minror coding style.

v6 patch is accroding to Geert, Marek and Sergei's comments:
1) spi_controller for new code.
2) "renesas,rcar-gen3-rpc" instead of "renesas,r8a77995-rpc."
3) patch external address read mode w/o u64 readq().
4) patch dts for write buffer & drop "renesas,rpc-mode".
5) coding style and so on.

v5 patch is accroding to Sergei's comments:
1) Read 6 bytes ID from Sergei's patch.
2) regmap_update_bits().
3) C++ style comment.

v4 patch is according to Sergei's comments including:
1) Drop soc_device_match().
2) Drop unused RPC registers.
3) Use ilog2() instead of fls().
4) Patch read 6 bytes ID w/ one command.
5) Coding style and so on.

v3 patch is according to Marek and Geert's comments including:
1) soc_device_mach() to set up RPC_PHYCNT_STRTIM.
2) get_unaligned().
3) rpc-mode for rpi-spi-flash or rpc-hyperflash.
4) coding style and so on.

v2 patch including:
1) remove RPC clock enable/dis-able control,
2) patch run time PM.
3) add RPC module software reset,
4) add regmap.
5) other coding style and so on.

thanks for your review.

best regards,
Mason

Mason Yang (2):
spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller
bindings

 .../devicetree/bindings/spi/spi-renesas-rpc.txt    |  46 ++
 drivers/spi/Kconfig                                |   6 +
 drivers/spi/Makefile                               |   1 +
 drivers/spi/spi-renesas-rpc.c                      | 754 +++++++++++++++++++++
 4 files changed, 807 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt
 create mode 100644 drivers/spi/spi-renesas-rpc.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v15 1/2 spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver

Add a driver for Renesas R-Car Gen3 RPC-IF SPI controller.

---
 drivers/spi/Kconfig           |   6 +
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-renesas-rpc.c | 754 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 761 insertions(+)
 create mode 100644 drivers/spi/spi-renesas-rpc.c
drivers/spi/Kconfig +6 -0
index 3a1d8f1..88e28de 100644
@@ -571,6 +571,12 @@ config SPI_RSPI
 	help
 	  SPI driver for Renesas RSPI and QSPI blocks.
 
+config SPI_RENESAS_RPC
+	tristate "Renesas R-Car Gen3 RPC-IF SPI controller"
+	depends on ARCH_RENESAS || COMPILE_TEST
+	help
+	  SPI driver for Renesas R-Car Gen3 RPC-IF.
+
 config SPI_QCOM_QSPI
 	tristate "QTI QSPI controller"
 	depends on ARCH_QCOM
drivers/spi/Makefile +1 -0
index 63dcab5..d858e4c 100644
@@ -87,6 +87,7 @@ obj-$(CONFIG_SPI_QUP)			+= spi-qup.o
 obj-$(CONFIG_SPI_ROCKCHIP)		+= spi-rockchip.o
 obj-$(CONFIG_SPI_RB4XX)			+= spi-rb4xx.o
 obj-$(CONFIG_SPI_RSPI)			+= spi-rspi.o
+obj-$(CONFIG_SPI_RENESAS_RPC)		+= spi-renesas-rpc.o
 obj-$(CONFIG_SPI_S3C24XX)		+= spi-s3c24xx-hw.o
 spi-s3c24xx-hw-y			:= spi-s3c24xx.o
 spi-s3c24xx-hw-$(CONFIG_SPI_S3C24XX_FIQ) += spi-s3c24xx-fiq.o
drivers/spi/spi-renesas-rpc.c new file +754 -0

754 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#2 lore raw

PATCH v15 2/2 dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings

In reply to Mason Yang

Dcument the bindings used by the Renesas R-Car Gen3 RPC-IF controller.

---
 .../devicetree/bindings/spi/spi-renesas-rpc.txt    | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +46 -0
new file mode 100644
index 0000000..d929850
@@ -0,0 +1,46 @@
+Renesas R-Car Gen3 RPC-IF controller Device Tree Bindings
+---------------------------------------------------------
+
+Required properties:
+- compatible: should be an SoC-specific compatible value, followed by
+		"renesas,rcar-gen3-rpc" as a fallback.
+		supported SoC-specific values are:
+		"renesas,r8a77980-rpc"	(R-Car V3H)
+		"renesas,r8a77995-rpc"	(R-Car D3)
+- reg: should contain three register areas:
+       first for the base address of RPC-IF registers,
+       second for the direct mapping read mode and
+       third for the write buffer area.
+- reg-names: should contain "regs", "dirmap" and "wbuf"
+- clocks: should contain the clock phandle/specifier pair for the module clock.
+- clock-names: should contain "rpc"
+- power-domains: should contain the power domain phandle/secifier pair.
+- resets: should contain the reset controller phandle/specifier pair.
+- #address-cells: should be 1
+- #size-cells: should be 0
+- flash: should be represented by a subnode of the RPC-IF node,
+	 which "compatible" property contains "jedec,spi-nor", it presents
+	 SPI is used.
+
+Example:
+
+	rpc: spi@ee200000 {
+		compatible = "renesas,r8a77995-rpc", "renesas,rcar-gen3-rpc";
+		reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x4000000>,
+		      <0 0xee208000 0 0x100>;
+		reg-names = "regs", "dirmap", "wbuf";
+		clocks = <&cpg CPG_MOD 917>;
+		clock-names = "rpc";
+		power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
+		resets = <&cpg 917>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		flash@0 {
+			compatible = "jedec,spi-nor";
+			reg = <0>;
+			spi-max-frequency = <40000000>;
+			spi-tx-bus-width = <1>;
+			spi-rx-bus-width = <1>;
+		};
+	};
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH v15 2/2] dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings

Hi Mason,

Thanks for the update!

Quoted 1 line · Mason Yang

Dcument the bindings used by the Renesas R-Car Gen3 RPC-IF controller.

Document

Quoted 7 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +0 -0
@@ -0,0 +1,46 @@

[...]

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt line 23

Quoted 3 lines

+- flash: should be represented by a subnode of the RPC-IF node,

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +2 -0
+        which "compatible" property contains "jedec,spi-nor", it presents
+        SPI is used.

Sorry, I failed to parse the last subsentence.

Quoted 11 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +11 -0
+
+Example:
+
+       rpc: spi@ee200000 {
+               compatible = "renesas,r8a77995-rpc", "renesas,rcar-gen3-rpc";
+               reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x4000000>,
+                     <0 0xee208000 0 0x100>;
+               reg-names = "regs", "dirmap", "wbuf";
+               clocks = <&cpg CPG_MOD 917>;
+               clock-names = "rpc";
+               power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt line 44

Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +10 -0
+               resets = <&cpg 917>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               flash@0 {
+                       compatible = "jedec,spi-nor";
+                       reg = <0>;
+                       spi-max-frequency = <40000000>;
+                       spi-tx-bus-width = <1>;
+                       spi-rx-bus-width = <1>;

Shouldn't those <1> be <4>, as this is QSPI?

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt line 46

Quoted 2 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +2 -0
+               };
+       };

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw

Re: [PATCH v15 2/2] dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings

Hi Geert,

Quoted 1 line

On Fri, Jul 26, 2019 at 4:19 AM Mason Yang <[email protected]>

Quoted 3 lines · wrote:
Quoted 1 line

Dcument the bindings used by the Renesas R-Car Gen3 RPC-IF controller.

Document

Oops, sorry !

Quoted 5 lines
Quoted 4 lines
Quoted 8 lines
Quoted 3 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +0 -0
@@ -0,0 +1,46 @@

[...]

Quoted 2 lines
+- flash: should be represented by a subnode of the RPC-IF node,
+        which "compatible" property contains "jedec,spi-nor", it 

presents

Quoted 3 lines
Quoted 1 line

+ SPI is used.

Sorry, I failed to parse the last subsentence.

Fix it to:
- flash: should be represented by a subnode of the RPC-IF node, its "compatible" property contains "jedec,spi-nor" presents SPI is used.

OK?

Quoted 6 lines

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt

Quoted 6 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +5 -0
+
+Example:
+
+       rpc: spi@ee200000 {
+               compatible = "renesas,r8a77995-rpc", 

"renesas,rcar-gen3-rpc";

Quoted 1 line
Quoted 1 line

+ reg = <0 0xee200000 0 0x200>, <0 0x08000000 0

0x4000000>,

Quoted 16 lines
Quoted 5 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +5 -0
+                     <0 0xee208000 0 0x100>;
+               reg-names = "regs", "dirmap", "wbuf";
+               clocks = <&cpg CPG_MOD 917>;
+               clock-names = "rpc";
+               power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt line 44

Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +10 -0
+               resets = <&cpg 917>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               flash@0 {
+                       compatible = "jedec,spi-nor";
+                       reg = <0>;
+                       spi-max-frequency = <40000000>;
+                       spi-tx-bus-width = <1>;
+                       spi-rx-bus-width = <1>;
Quoted 1 line

Shouldn't those <1> be <4>, as this is QSPI?

okay, fix them to <4>

thanks for your time & review.

best regards,
Mason

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================

============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================

#5 lore raw

Re: [PATCH v15 2/2] dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings

Hi Mason,

Quoted 16 lines · On Mon, Jul 29, 2019 at 11:34 AM <[email protected]> wrote:
Quoted 1 line

On Fri, Jul 26, 2019 at 4:19 AM Mason Yang <[email protected]>

Quoted 8 lines · wrote:
Quoted 3 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +0 -0
@@ -0,0 +1,46 @@

[...]

Quoted 2 lines
+- flash: should be represented by a subnode of the RPC-IF node,
+        which "compatible" property contains "jedec,spi-nor", it

presents

Quoted 3 lines
Quoted 1 line

+ SPI is used.

Sorry, I failed to parse the last subsentence.

Quoted 6 lines

Fix it to:
- flash: should be represented by a subnode of the RPC-IF node, its "compatible" property contains "jedec,spi-nor" presents SPI is used.

OK?

s/presents/if/?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw

Re: [PATCH v15 2/2] dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings

Hi Geert,

Quoted 17 lines · On Mon, Jul 29, 2019 at 11:34 AM <[email protected]> wrote:
Quoted 16 lines
Quoted 1 line

On Fri, Jul 26, 2019 at 4:19 AM Mason Yang <[email protected]>

Quoted 8 lines · wrote:
Quoted 3 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +0 -0
@@ -0,0 +1,46 @@

[...]

Quoted 2 lines
+- flash: should be represented by a subnode of the RPC-IF node,
+        which "compatible" property contains "jedec,spi-nor", it

presents

Quoted 3 lines
Quoted 1 line

+ SPI is used.

Sorry, I failed to parse the last subsentence.

Quoted 9 lines
Quoted 6 lines

Fix it to:
- flash: should be represented by a subnode of the RPC-IF node, its "compatible" property contains "jedec,spi-nor" presents SPI is used.

OK?

s/presents/if/?

Got it, thanks for your correction.

- flash: should be represented by a subnode of the RPC-IF node, its "compatible" property contains "jedec,spi-nor" if SPI is
used.

best regards,
Mason

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================

============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================