spi: Add Renesas R-Car Gen3 RPC-IF SPI driver
Subsystems (2)
v16 cover spi: Add Renesas R-Car Gen3 RPC-IF SPI driver
Hi Mark,
v16 patch including:
1) fixed typo and spi-tx/rx-bus-width in DTS.
2) v14 dt-binding file has reviewed by Rob Herring.
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 | 45 ++ drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/spi-renesas-rpc.c | 754 +++++++++++++++++++++ 4 files changed, 806 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
PATCH v16 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
@@ -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
@@ -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
Re: [PATCH v16 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello!
Quoted 4 lines · Mason Yang
Add a driver for Renesas R-Car Gen3 RPC-IF SPI controller.
Signed-off-by Mason Yang <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>
[...]
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +0
-0@@ -0,0 +1,754 @@
[...]
Quoted 29 lines
drivers/spi/spi-renesas-rpc.c new file +29
-0+static void rpc_spi_hw_init (struct rpc_spi *rpc) +{ +// +// NOTE: The 0x260 are undocumented bits, but they must be set. +// RPC_PHYCNT_STRTIM is strobe timing adjustment bit, +// 0x0 : the delay is biggest, +// 0x1 : the delay is 2nd biggest, +// On H3 ES1.x, the value should be 0, while on others, +// the value should be 6. +// +regmap_write (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_CAL | +RPC_PHYCNT_STRTIM (6 ) |0x260 ); + +// +// NOTE: The 0x1511144 are undocumented bits, but they must be set +// for RPC_PHYOFFSET1. +// The 0x31 are undocumented bits, but they must be set +// for RPC_PHYOFFSET2. +// +regmap_write (rpc->regmap,RPC_PHYOFFSET1 ,RPC_PHYOFFSET1_DDRTMG (3 ) | +0x1511144 ); +regmap_write (rpc->regmap,RPC_PHYOFFSET2 ,0x31 | +RPC_PHYOFFSET2_OCTTMG (4 )); +regmap_write (rpc->regmap,RPC_SSLDR ,RPC_SSLDR_SPNDL (7 ) | +RPC_SSLDR_SLNDL (7 ) |RPC_SSLDR_SCKDL (7 )); +regmap_write (rpc->regmap,RPC_CMNCR ,RPC_CMNCR_MD |RPC_CMNCR_SFDE | +RPC_CMNCR_MOIIO_HIZ |RPC_CMNCR_IOFV_HIZ | +RPC_CMNCR_BSZ (0 )); +}
[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+static int rpc_spi_io_xfer (struct rpc_spi *rpc, +const void *tx_buf,void *rx_buf) +{
[...]
drivers/spi/spi-renesas-rpc.c line 312
Quoted 2 lines
drivers/spi/spi-renesas-rpc.c new file +2
-0+err_out: +return reset_control_reset (rpc->rstc);
Don't toy need to call rpc_spi_hw_init(( here? The reset would spoil
the PHY/etc register setup otherwise...
[...]
MBR, Sergei
Re: [PATCH v16 1/2] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 6 lines
Quoted 4 lines
Add a driver for Renesas R-Car Gen3 RPC-IF SPI controller.
Signed-off-by Mason Yang <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>[...]
Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/spi/spi-renesas-rpc.c
Quoted 18 lines
Quoted 5 lines
new file mode 100644
index 0000000..648d14edrivers/spi/spi-renesas-rpc.c new file +0
-0@@ -0,0 +1,754 @@[...]
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+static void rpc_spi_hw_init (struct rpc_spi *rpc) +{ +// +// NOTE: The 0x260 are undocumented bits, but they must be set. +// RPC_PHYCNT_STRTIM is strobe timing adjustment bit, +// 0x0 : the delay is biggest, +// 0x1 : the delay is 2nd biggest, +// On H3 ES1.x, the value should be 0, while on others, +// the value should be 6. +// +regmap_write (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_CAL | +RPC_PHYCNT_STRTIM (6 ) |0x260 );
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-0+ +// +// NOTE: The 0x1511144 are undocumented bits, but they must be set +// for RPC_PHYOFFSET1. +// The 0x31 are undocumented bits, but they must be set +// for RPC_PHYOFFSET2. +// + regmap_write(rpc->regmap, RPC_PHYOFFSET1, RPC_PHYOFFSET1_DDRTMG(3)
|
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+ 0x1511144); +regmap_write (rpc->regmap,RPC_PHYOFFSET2 ,0x31 | +RPC_PHYOFFSET2_OCTTMG (4 )); +regmap_write (rpc->regmap,RPC_SSLDR ,RPC_SSLDR_SPNDL (7 ) | +RPC_SSLDR_SLNDL (7 ) |RPC_SSLDR_SCKDL (7 )); + regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD | RPC_CMNCR_SFDE
|
Quoted 8 lines
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+RPC_CMNCR_MOIIO_HIZ |RPC_CMNCR_IOFV_HIZ | + RPC_CMNCR_BSZ(0)); +}[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+static int rpc_spi_io_xfer (struct rpc_spi *rpc, +const void *tx_buf,void *rx_buf) +{[...]
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c line 312
Quoted 2 lines
drivers/spi/spi-renesas-rpc.c new file +2
-0+err_out: +return reset_control_reset (rpc->rstc);Don't toy need to call rpc_spi_hw_init(( here? The reset would spoil
the PHY/etc register setup otherwise...
ummm, will fix to
-------------------------------------->
ret = reset_control_reset(rpc->rstc);rpc_spi_hw_init(rpc);
return ret;
--------------------------------------<
thanks for your review.
Quoted 4 lines
[...]
MBR, Sergei
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.
=====================================================================
PATCH v16 2/2 dt-bindings: spi: Document Renesas R-Car Gen3 RPC-IF controller bindings
In reply to Mason YangDocument the bindings used by the Renesas R-Car Gen3 RPC-IF controller.
--- .../devicetree/bindings/spi/spi-renesas-rpc.txt | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +45 -0
@@ -0,0 +1,45 @@ +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, + its "compatible" property contains "jedec,spi-nor" if 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 = <4>; + spi-rx-bus-width = <4>; + }; + };
Signature · 1 line
1.9.1