Skip to contentSkip to conversation

spi: Add Renesas R-Car Gen3 RPC SPI driver

PATCH Superseded Mason Yang 3 participants 10 messages Dec 24, 2018 – Jan 4, 2019 2 messages not in the archive

Subsystems (2)

v4 of 17 Superseded Latest is v17 →

lore
Share & tools
lore

Mason Yang

author
#0 lore raw

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

Hi Mark,

This Renesas R-Car Gen3 RPC SPI driver is based on Boris's new spi-mem direct mapping read/write mode [1][2].

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

[1] https://patchwork.kernel.org/patch/10670753
[2] https://patchwork.kernel.org/patch/10670747

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

 .../devicetree/bindings/spi/spi-renesas-rpc.txt    |  37 +
 drivers/spi/Kconfig                                |   6 +
 drivers/spi/Makefile                               |   1 +
 drivers/spi/spi-renesas-rpc.c                      | 788 +++++++++++++++++++++
 4 files changed, 832 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 v4 1/2 spi: Add Renesas R-Car Gen3 RPC SPI controller driver

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

---
 drivers/spi/Kconfig           |   6 +
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-renesas-rpc.c | 788 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 795 insertions(+)
 create mode 100644 drivers/spi/spi-renesas-rpc.c
drivers/spi/Kconfig +6 -0
index 7d3a5c9..54b40f8 100644
@@ -528,6 +528,12 @@ config SPI_RSPI
 	help
 	  SPI driver for Renesas RSPI and QSPI blocks.
 
+config SPI_RENESAS_RPC
+	tristate "Renesas R-Car Gen3 RPC SPI controller"
+	depends on ARCH_RENESAS || COMPILE_TEST
+	help
+	  SPI driver for Renesas R-Car Gen3 RPC.
+
 config SPI_QCOM_QSPI
 	tristate "QTI QSPI controller"
 	depends on ARCH_QCOM
drivers/spi/Makefile +1 -0
index 3575205..5d5c523 100644
@@ -81,6 +81,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 +788 -0

788 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH v4 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver

Quoted 15 lines · Mason Yang

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

---
 drivers/spi/Kconfig           |   6 +
 drivers/spi/Makefile          |   1 +
 drivers/spi/spi-renesas-rpc.c | 788 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 795 insertions(+)
 create mode 100644 drivers/spi/spi-renesas-rpc.c
drivers/spi/Kconfig +0 -0
index 7d3a5c9..54b40f8 100644

drivers/spi/Kconfig config SPI_RSPI · line 532

Quoted 5 lines
drivers/spi/Kconfig +2 -0
@@ -528,6 +528,12 @@ config SPI_RSPI
 	help
 	  SPI driver for Renesas RSPI and QSPI blocks.
 
+config SPI_RENESAS_RPC
+	tristate "Renesas R-Car Gen3 RPC SPI controller"

Well, technically it's called RPC-IF in the manual, not just RPC...

Quoted 7 lines
drivers/spi/Kconfig +4 -0
+	depends on ARCH_RENESAS || COMPILE_TEST
+	help
+	  SPI driver for Renesas R-Car Gen3 RPC.
+
 config SPI_QCOM_QSPI
 	tristate "QTI QSPI controller"
 	depends on ARCH_QCOM

[...]

Quoted 33 lines
drivers/spi/spi-renesas-rpc.c new file +27 -0
new file mode 100644
index 0000000..6dd739a
@@ -0,0 +1,788 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp.
+// Copyright (C) 2018 Macronix International Co., Ltd.
+//
+// R-Car Gen3 RPC SPI/QSPI/Octa driver
+//
+// Authors:
+//	Mason Yang <[email protected]>
+//
+
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/log2.h>
+#include <linux/iopoll.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi-mem.h>
+
+#include <asm/unaligned.h>
+
+#define RPC_CMNCR		0x0000	/* R/W */

drivers/spi/spi-renesas-rpc.c line 37

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+#define RPC_CMNCR_MD		BIT(31)
+#define RPC_CMNCR_SFDE		BIT(24) /* undocumented bit but must be set */
+#define RPC_CMNCR_MOIIO3(val)	(((val) & 0x3) << 22)
+#define RPC_CMNCR_MOIIO2(val)	(((val) & 0x3) << 20)
+#define RPC_CMNCR_MOIIO1(val)	(((val) & 0x3) << 18)
+#define RPC_CMNCR_MOIIO0(val)	(((val) & 0x3) << 16)
+#define RPC_CMNCR_MOIIO_HIZ	(RPC_CMNCR_MOIIO0(3) | RPC_CMNCR_MOIIO1(3) | \
+				 RPC_CMNCR_MOIIO2(3) | RPC_CMNCR_MOIIO3(3))
+#define RPC_CMNCR_IO3FV(val)	(((val) & 0x3) << 14)
+#define RPC_CMNCR_IO2FV(val)	(((val) & 0x3) << 12)

Like I said, the above 2 aren't documented in the manual v1.00...

drivers/spi/spi-renesas-rpc.c line 38

Quoted 1 line
drivers/spi/spi-renesas-rpc.c new file +1 -0
+#define RPC_CMNCR_IO0FV(val)	(((val) & 0x3) << 8)

Only this one is...

[...]

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -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.
+	 */

drivers/spi/spi-renesas-rpc.c line 196

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+	regmap_write(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_CAL |
+				  RPC_PHYCNT_STRTIM(6) | 0x260);
+
+	/*
+	 * NOTE: The 0x31511144 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, 0x31511144);

0x30000000 is documented, missed that last time...

[...]

drivers/spi/spi-renesas-rpc.c line 213

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+static int rpc_spi_do_reset(struct rpc_spi *rpc)
+{
+	int ret;
+
+	ret = reset_control_reset(rpc->rstc);
+	if (ret)
+		return ret;
+
+	return 0;
+}

Like I said, this function folds to a mere reset_control_reset() call...

[...]

drivers/spi/spi-renesas-rpc.c line 234

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+static int rpc_spi_io_xfer(struct rpc_spi *rpc,
+			   const void *tx_buf, void *rx_buf)
+{
+	u32 smenr, smcr, data, pos = 0;
+	int ret = 0;

Looks like we don't need this variable...

Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8 -0
+
+	regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD | RPC_CMNCR_SFDE |
+				  RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+				  RPC_CMNCR_BSZ(0));
+	regmap_write(rpc->regmap, RPC_SMDRENR, 0);
+	regmap_write(rpc->regmap, RPC_SMCMR, rpc->cmd);
+	regmap_write(rpc->regmap, RPC_SMDMCR, rpc->dummy);
+	regmap_write(rpc->regmap, RPC_SMADR, rpc->addr);

[...]

drivers/spi/spi-renesas-rpc.c line 271

Quoted 2 lines
drivers/spi/spi-renesas-rpc.c new file +2 -0
+	} else if (rx_buf) {
+		smenr = rpc->smenr;

Could be done before the *if*...

Quoted 13 lines
drivers/spi/spi-renesas-rpc.c new file +13 -0
+
+		while (pos < rpc->xferlen) {
+			u32 nbytes = rpc->xferlen - pos;
+
+			if (nbytes > 4)
+				nbytes = 4;
+
+			smcr = rpc->smcr | RPC_SMCR_SPIE;
+
+			if (rpc->xferlen > 4 && rpc->xferlen < 8 && pos == 0)
+				smcr |= RPC_SMCR_SSLKP;
+
+			regmap_write(rpc->regmap, RPC_SMENR, smenr);

drivers/spi/spi-renesas-rpc.c line 294

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+			regmap_write(rpc->regmap, RPC_SMCR, smcr);
+			ret = wait_msg_xfer_end(rpc);
+			if (ret)
+				goto out;
+
+			regmap_read(rpc->regmap, RPC_SMRDR0, &data);
+			memcpy(rx_buf + pos, &data, nbytes);
+			pos += nbytes;
+
+			if (rpc->xferlen > 4 && rpc->xferlen < 8 && pos == 4) {

This looks hackish. What I think matters is whether the address bits are set or not.
Anyway, maybe it works OK for you but not for me (on V3H), the 4th byte of the JEDEC ID is clobbered from 0 to 3... I've been working on a better workaround using Marek's approach (reading in extended memory mode) -- should port to v4 of your patch yet...

drivers/spi/spi-renesas-rpc.c line 300

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+				smenr = rpc->smenr & ~RPC_SMENR_CDE &
+					~RPC_SMENR_ADE(0xf);
+			} else {
+				regmap_write(rpc->regmap, RPC_SMCMR, rpc->cmd);
+				regmap_write(rpc->regmap, RPC_SMDMCR,
+					     rpc->dummy);

Not sure why you rewrite these regs again. Where do they change?

drivers/spi/spi-renesas-rpc.c line 313

Quoted 13 lines
drivers/spi/spi-renesas-rpc.c new file +13 -0
+				regmap_write(rpc->regmap, RPC_SMADR,
+					     rpc->addr + pos);
+			}
+		}
+	} else {
+		regmap_write(rpc->regmap, RPC_SMENR, rpc->smenr);
+		regmap_write(rpc->regmap, RPC_SMCR, rpc->smcr | RPC_SMCR_SPIE);
+		ret = wait_msg_xfer_end(rpc);
+		if (ret)
+			goto out;
+	}
+
+	return ret;

Could be *return* 0, we never get here from an error path...

Quoted 37 lines
drivers/spi/spi-renesas-rpc.c new file +37 -0
+
+out:
+	return rpc_spi_do_reset(rpc);
+}
+
+static void rpc_spi_mem_set_prep_op_cfg(struct spi_device *spi,
+					const struct spi_mem_op *op,
+					u64 *offs, size_t *len)
+{
+	struct rpc_spi *rpc = spi_master_get_devdata(spi->master);
+
+	rpc->cmd = RPC_SMCMR_CMD(op->cmd.opcode);
+	rpc->smenr = RPC_SMENR_CDE |
+		     RPC_SMENR_CDB(ilog2(op->cmd.buswidth));
+	rpc->totalxferlen = 1;
+	rpc->xfer_dir = SPI_MEM_NO_DATA;
+	rpc->xferlen = 0;
+	rpc->addr = 0;
+
+	if (op->addr.nbytes) {
+		rpc->smenr |= RPC_SMENR_ADB(ilog2(op->addr.buswidth));
+		if (op->addr.nbytes == 4)
+			rpc->smenr |= RPC_SMENR_ADE(0xf);
+		else
+			rpc->smenr |= RPC_SMENR_ADE(0x7);
+
+		if (offs && len)
+			rpc->addr = *offs;
+		else
+			rpc->addr = op->addr.val;
+		rpc->totalxferlen += op->addr.nbytes;
+	}
+
+	if (op->dummy.nbytes) {
+		rpc->smenr |= RPC_SMENR_DME;
+		rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes);
+		rpc->totalxferlen += op->dummy.nbytes;

drivers/spi/spi-renesas-rpc.c line 360

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+	}
+
+	if (op->data.nbytes || (offs && len)) {
+		if (op->data.dir == SPI_MEM_DATA_IN) {
+			rpc->smcr = RPC_SMCR_SPIRE;
+			rpc->xfer_dir = SPI_MEM_DATA_IN;
+		} else if (op->data.dir == SPI_MEM_DATA_OUT) {
+			rpc->smcr = RPC_SMCR_SPIWE;
+			rpc->xfer_dir = SPI_MEM_DATA_OUT;
+		}

Use *switch* instead, please.

[...]

drivers/spi/spi-renesas-rpc.c line 384

Quoted 7 lines
drivers/spi/spi-renesas-rpc.c new file +7 -0
+static bool rpc_spi_mem_supports_op(struct spi_mem *mem,
+				    const struct spi_mem_op *op)
+{
+	if (op->data.buswidth > 4 || op->addr.buswidth > 4 ||
+	    op->dummy.buswidth > 4 || op->cmd.buswidth > 4 ||
+	    op->addr.nbytes > 4)
+		return false;

So we support the dual mode, even though the manual doesn't say we do?

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+
+	return true;
+}
+
+static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,

drivers/spi/spi-renesas-rpc.c line 399

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+				       u64 offs, size_t len, void *buf)
+{
+	struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
+	int ret;
+
+	if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
+		return -EINVAL;
+
+	if (WARN_ON(len > 0x4000000))
+		return -EIO;

Why not read what can still be read and return 0x4000000?

drivers/spi/spi-renesas-rpc.c line 410

Quoted 11 lines
drivers/spi/spi-renesas-rpc.c new file +11 -0
+
+	ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+	if (ret)
+		return ret;
+
+	rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
+				    &desc->info.op_tmpl, &offs, &len);
+
+	regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_SFDE |
+		     RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+		     RPC_CMNCR_BSZ(0));

Why not set this in the probing time and only set/clear the MD bit?

[...]

Quoted 29 lines
drivers/spi/spi-renesas-rpc.c new file +29 -0
+static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
+					u64 offs, size_t len, const void *buf)
+{
+	struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
+	int ret;
+
+	if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
+		return -EINVAL;
+
+	if (WARN_ON(len > RPC_WBUF_SIZE))
+		len = RPC_WBUF_SIZE;
+
+	ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+	if (ret)
+		return ret;
+
+	rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
+				    &desc->info.op_tmpl, &offs, &len);
+
+	regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD | RPC_CMNCR_SFDE |
+				  RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+				  RPC_CMNCR_BSZ(0));
+	regmap_write(rpc->regmap, RPC_SMDRENR, 0);
+	regmap_write(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_CAL | 0x260 |
+				  RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF);
+
+	memcpy_toio(rpc->base + RPC_WBUF, buf, len);
+
+	regmap_write(rpc->regmap, RPC_SMCMR, rpc->cmd);

drivers/spi/spi-renesas-rpc.c line 463

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+	regmap_write(rpc->regmap, RPC_SMADR, offs);
+	regmap_write(rpc->regmap, RPC_SMENR, rpc->smenr);
+	regmap_write(rpc->regmap, RPC_SMCR, rpc->smcr | RPC_SMCR_SPIE);
+	ret = wait_msg_xfer_end(rpc);
+	if (ret)
+		goto out;
+
+	regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RCF);
+	regmap_write(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_CAL |
+				  RPC_PHYCNT_STRTIM(6) | 0x260);

Whe not do read-modify-write here and above?

[...]

Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3 -0
+static void rpc_spi_transfer_setup(struct rpc_spi *rpc,
+				   struct spi_message *msg)
+{

[...]

drivers/spi/spi-renesas-rpc.c line 585

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+	for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
+		if (xfer[i].rx_buf) {
+			rpc->smenr |=
+				RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+				RPC_SMENR_SPIDB
+				(ilog2((unsigned int)xfer[i].rx_nbits));

Mhm, I would indent this contination line by 1 extra tab...

drivers/spi/spi-renesas-rpc.c line 590

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+		} else if (xfer[i].tx_buf) {
+			rpc->smenr |=
+				RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+				RPC_SMENR_SPIDB
+				(ilog2((unsigned int)xfer[i].tx_nbits));

And this one...

[...]

drivers/spi/spi-renesas-rpc.c line 756

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+#ifdef CONFIG_PM_SLEEP
+static int rpc_spi_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct spi_master *master = platform_get_drvdata(pdev);

Ugh... not sure how i missed it the last time. :-/ Please, just do this:

	struct spi_master *master = dev_get_drvdata(dev);

drivers/spi/spi-renesas-rpc.c line 764

Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8 -0
+
+	return spi_master_suspend(master);
+}
+
+static int rpc_spi_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct spi_master *master = platform_get_drvdata(pdev);

Likewise...

[...]

MBR, Sergei

A message that is not in the archive (sent off-list or not yet received): OFC561D699.9746ACDB-ON4825836F.000CB709-4825836F.00184155@mxic.com.tw

#4 lore raw

Re: [PATCH v4 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver

Hello!

Quoted 7 lines · On 12/26/2018 07:24 AM, [email protected] wrote:
Quoted 7 lines

[...]

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +0 -0
new file mode 100644
index 0000000..6dd739a
@@ -0,0 +1,788 @@

[...]

Quoted 17 lines
Quoted 9 lines

drivers/spi/spi-renesas-rpc.c

Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8 -0
+#define RPC_CMNCR      0x0000   /* R/W */
+#define RPC_CMNCR_MD      BIT(31)
+#define RPC_CMNCR_SFDE      BIT(24) /* undocumented bit but must be set */
+#define RPC_CMNCR_MOIIO3(val)   (((val) & 0x3) << 22)
+#define RPC_CMNCR_MOIIO2(val)   (((val) & 0x3) << 20)
+#define RPC_CMNCR_MOIIO1(val)   (((val) & 0x3) << 18)
+#define RPC_CMNCR_MOIIO0(val)   (((val) & 0x3) << 16)
+#define RPC_CMNCR_MOIIO_HIZ   (RPC_CMNCR_MOIIO0(3) |

RPC_CMNCR_MOIIO1(3) | \

Quoted 5 lines

drivers/spi/spi-renesas-rpc.c line 37

Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3 -0
+             RPC_CMNCR_MOIIO2(3) | RPC_CMNCR_MOIIO3(3))
+#define RPC_CMNCR_IO3FV(val)   (((val) & 0x3) << 14)
+#define RPC_CMNCR_IO2FV(val)   (((val) & 0x3) << 12)

Like I said, the above 2 aren't documented in the manual v1.00...

okay, add a description as:
/* RPC_CMNCR_IO3FV/IO2FV are undocumented bit, but must be set */

Quoted 7 lines
#define RPC_CMNCR_IO3FV(val)    (((val) & 0x3) << 14)
#define RPC_CMNCR_IO2FV(val)    (((val) & 0x3) << 12)
#define RPC_CMNCR_IO0FV(val)    (((val) & 0x3) << 8)
#define RPC_CMNCR_IOFV_HIZ      (RPC_CMNCR_IO0FV(3) | RPC_CMNCR_IO2FV(3) | \
                                  RPC_CMNCR_IO3FV(3))

is it ok?

Yes. But would have been enough if you just commented with // on the same line --
it seems these are legal now...

Quoted 25 lines
Quoted 15 lines

[...]

Quoted 14 lines
drivers/spi/spi-renesas-rpc.c new file +14 -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 9 lines

drivers/spi/spi-renesas-rpc.c line 196

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+    * NOTE: The 0x31511144 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, 0x31511144);

0x30000000 is documented, missed that last time...

Quoted 7 lines

okay,patch it to:

#define RPC_PHYOFFSET1_DDRTMG(v) (((v) & 0x3) << 28)

regmap_write(rpc->regmap, RPC_PHYOFFSET1,

                          RPC_PHYOFFSET1_DDRTMG(3) | 0x1511144);

OK, thanx.

Quoted 15 lines
Quoted 14 lines

[...]

drivers/spi/spi-renesas-rpc.c line 213

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+static int rpc_spi_do_reset(struct rpc_spi *rpc)
+{
+   int ret;
+
+   ret = reset_control_reset(rpc->rstc);
+   if (ret)
+      return ret;
+
+   return 0;
+}

Like I said, this function folds to a mere reset_control_reset() call...

Quoted 1 line

Do you mean just drop this rpc_spi_do_reset( )

I mean we don't need this wrapper, we can call reset_contreol_reset() directly.

Quoted 2 lines

because driver is never
come here from an error path ?

You are mixing things up -- of course we call it from the error path.

Quoted 34 lines
Quoted 25 lines

[...]

Quoted 13 lines
drivers/spi/spi-renesas-rpc.c new file +13 -0
+
+      while (pos < rpc->xferlen) {
+         u32 nbytes = rpc->xferlen - pos;
+
+         if (nbytes > 4)
+            nbytes = 4;
+
+         smcr = rpc->smcr | RPC_SMCR_SPIE;
+
+         if (rpc->xferlen > 4 && rpc->xferlen < 8 && pos == 0)
+            smcr |= RPC_SMCR_SSLKP;
+
+         regmap_write(rpc->regmap, RPC_SMENR, smenr);

drivers/spi/spi-renesas-rpc.c line 294

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+         regmap_write(rpc->regmap, RPC_SMCR, smcr);
+         ret = wait_msg_xfer_end(rpc);
+         if (ret)
+            goto out;
+
+         regmap_read(rpc->regmap, RPC_SMRDR0, &data);
+         memcpy(rx_buf + pos, &data, nbytes);
+         pos += nbytes;
+
+         if (rpc->xferlen > 4 && rpc->xferlen < 8 && pos == 4) {
Quoted 8 lines

This looks hackish. What I think matters is whether the address
bits are set or not.
Anyway, maybe it works OK for you but not for me (on V3H), the 4th byte of the JEDEC ID
is clobbered from 0 to 3... I've been working on a better workaround using Marek's
approach (reading in extended memory mode) -- should port to v4 of your patch yet...

Quoted 2 lines

Do you mean I also patch external address space read mode for RPC to read ID and data ?

No, I meant using the dirmap read mode for RDID and company. I have the patch
almost ready now and I hope you'll merge it with yours... either that or add it to your series atop of this patch.

[...]

Quoted 1 line

I also think this is kind of RPC HW bug in manual I/O mode.

Yes.

Quoted 3 lines

Renesas FAE@Taiwan has replied me that their the last bare-metal code, mini-monitor v5.x still use one command to read 4 bytes data each time and I think RPC HW designer should have known this HW bug already.

Have they tried it on V3H?

Quoted 11 lines
Quoted 8 lines

drivers/spi/spi-renesas-rpc.c line 300

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+            smenr = rpc->smenr & ~RPC_SMENR_CDE &
+               ~RPC_SMENR_ADE(0xf);
+         } else {
+            regmap_write(rpc->regmap, RPC_SMCMR, rpc->cmd);
+            regmap_write(rpc->regmap, RPC_SMDMCR,
+                    rpc->dummy);

Not sure why you rewrite these regs again. Where do they change?

Make sure the value in these register are setting correctly before RPC starting a SPI transfer.

The are -- ath the start of this function.

Quoted 1 line

Not sure RPC HW behavior will change these registers after a transfer.

I doubt it.

Quoted 1 line

In RPC bare-metal code mini-monitor v4.01 also do this way.

Well, we shouldn't blindly copy wgat they did, I think.

Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
drivers/spi/spi-renesas-rpc.c new file +13 -0
+            regmap_write(rpc->regmap, RPC_SMADR,
+                    rpc->addr + pos);
+         }
+      }
+   } else {
+      regmap_write(rpc->regmap, RPC_SMENR, rpc->smenr);
+      regmap_write(rpc->regmap, RPC_SMCR, rpc->smcr | RPC_SMCR_SPIE);
+      ret = wait_msg_xfer_end(rpc);
+      if (ret)
+         goto out;
+   }
+
+   return ret;
Quoted 3 lines
Quoted 1 line

Could be *return* 0, we never get here from an error path...

see above!

You've mixed things up. We always come here with ret == 0.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8 -0
+
+out:
+   return rpc_spi_do_reset(rpc);
+}
+
+static void rpc_spi_mem_set_prep_op_cfg(struct spi_device *spi,
+               const struct spi_mem_op *op,
+               u64 *offs, size_t *len)

[...]

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8 -0
+   if (op->data.nbytes || (offs && len)) {
+      if (op->data.dir == SPI_MEM_DATA_IN) {
+         rpc->smcr = RPC_SMCR_SPIRE;
+         rpc->xfer_dir = SPI_MEM_DATA_IN;
+      } else if (op->data.dir == SPI_MEM_DATA_OUT) {
+         rpc->smcr = RPC_SMCR_SPIWE;
+         rpc->xfer_dir = SPI_MEM_DATA_OUT;
+      }
Quoted 5 lines
Quoted 2 lines

Use *switch* instead, please.

why ?
only two condition here!

Oh, so you have some "threshold" on when to use *switch*? :-) I think each time we compare the same varible with a constant 2+
times, we need to use *switch*.

Quoted 11 lines
Quoted 10 lines

[...]

drivers/spi/spi-renesas-rpc.c line 384

Quoted 7 lines
drivers/spi/spi-renesas-rpc.c new file +7 -0
+static bool rpc_spi_mem_supports_op(struct spi_mem *mem,
+                const struct spi_mem_op *op)
+{
+   if (op->data.buswidth > 4 || op->addr.buswidth > 4 ||
+       op->dummy.buswidth > 4 || op->cmd.buswidth > 4 ||
+       op->addr.nbytes > 4)
+      return false;

So we support the dual mode, even though the manual doesn't say we do?

Quoted 1 line

I think driver would never go to dual mode by setting SPI master->mode_bits.

Maybe. BTW, when I test the driver in the renesas.git devel branch, I get:

spi spi0.0: setup: ignoring unsupported mode bits 800

[...]

Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4 -0
+   ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+   if (ret)
+      return ret;
+
Quoted 9 lines

drivers/spi/spi-renesas-rpc.c line 410

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+   rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
+                &desc->info.op_tmpl, &offs, &len);
+
+   regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_SFDE |
+           RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+           RPC_CMNCR_BSZ(0));

Why not set this in the probing time and only set/clear the MD bit?

Quoted 3 lines

same above!
Make sure the value in these register are setting correctly before RPC starting a SPI transfer.

You can set it once and only change the bits you need to change afterwards.
What's wrong with it?

Quoted 43 lines
Quoted 34 lines

[...]

Quoted 33 lines
drivers/spi/spi-renesas-rpc.c new file +33 -0
+static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
+               u64 offs, size_t len, const void *buf)
+{
+   struct rpc_spi *rpc = spi_master_get_devdata(desc->mem->spi->master);
+   int ret;
+
+   if (WARN_ON(offs + desc->info.offset + len > U32_MAX))
+      return -EINVAL;
+
+   if (WARN_ON(len > RPC_WBUF_SIZE))
+      len = RPC_WBUF_SIZE;
+
+   ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+   if (ret)
+      return ret;
+
+   rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
+                &desc->info.op_tmpl, &offs, &len);
+
+   regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD | RPC_CMNCR_SFDE |
+              RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+              RPC_CMNCR_BSZ(0));
+   regmap_write(rpc->regmap, RPC_SMDRENR, 0);
+   regmap_write(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_CAL | 0x260 |
+              RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF);
+
+   memcpy_toio(rpc->base + RPC_WBUF, buf, len);
+
+   regmap_write(rpc->regmap, RPC_SMCMR, rpc->cmd);
+   regmap_write(rpc->regmap, RPC_SMADR, offs);
+   regmap_write(rpc->regmap, RPC_SMENR, rpc->smenr);
+   regmap_write(rpc->regmap, RPC_SMCR, rpc->smcr | RPC_SMCR_SPIE);
+   ret = wait_msg_xfer_end(rpc);
Quoted 8 lines

drivers/spi/spi-renesas-rpc.c line 463

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+   if (ret)
+      goto out;
+
+   regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RCF);
+   regmap_write(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_CAL |
+              RPC_PHYCNT_STRTIM(6) | 0x260);

Whe not do read-modify-write here and above?

Quoted 3 lines

same above!
Make sure the value in these register are setting correctly before RPC starting a SPI transfer.

Nobody can spoil the register values with yours being a single driver controlling
it, no?

Quoted 24 lines
Quoted 14 lines

[...]

Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3 -0
+static void rpc_spi_transfer_setup(struct rpc_spi *rpc,
+               struct spi_message *msg)
+{

[...]

drivers/spi/spi-renesas-rpc.c line 585

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+   for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
+      if (xfer[i].rx_buf) {
+         rpc->smenr |=
+            RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+            RPC_SMENR_SPIDB
+            (ilog2((unsigned int)xfer[i].rx_nbits));

Mhm, I would indent this contination line by 1 extra tab...

Quoted 7 lines

drivers/spi/spi-renesas-rpc.c line 590

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+      } else if (xfer[i].tx_buf) {
+         rpc->smenr |=
+            RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+            RPC_SMENR_SPIDB
+            (ilog2((unsigned int)xfer[i].tx_nbits));

And this one...

like this ?
--------------------------------------------------------------------

Quoted 11 lines
         for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
                 if (xfer[i].rx_buf) {
                         rpc->smenr |=
                                 RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
                                 RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer[i].rx_nbits));
                 } else if (xfer[i].tx_buf) {
                         rpc->smenr |=
                                 RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
                                 RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer[i].tx_nbits));

I didn't mean you need to leave ( on the first line, can be left on the new
line, as before.

Quoted 5 lines
Quoted 1 line

[...]

thanks for your review.
best regards,
Mason

[...]

MBR, Sergei

A message that is not in the archive (sent off-list or not yet received): OFE79BC6CE.BE217C13-ON48258377.001FBC09-48258377.00243859@mxic.com.tw

#6 lore raw

Re: [PATCH v4 1/2] spi: Add Renesas R-Car Gen3 RPC SPI controller driver

Hello!

On 01/03/2019 09:35 AM, [email protected] wrote:

[...]

Quoted 26 lines
Quoted 20 lines
Quoted 20 lines
Quoted 11 lines

drivers/spi/spi-renesas-rpc.c

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+#define RPC_CMNCR_MOIIO3(val)   (((val) & 0x3) << 22)
+#define RPC_CMNCR_MOIIO2(val)   (((val) & 0x3) << 20)
+#define RPC_CMNCR_MOIIO1(val)   (((val) & 0x3) << 18)
+#define RPC_CMNCR_MOIIO0(val)   (((val) & 0x3) << 16)
+#define RPC_CMNCR_MOIIO_HIZ   (RPC_CMNCR_MOIIO0(3) |

RPC_CMNCR_MOIIO1(3) | \

drivers/spi/spi-renesas-rpc.c line 37

Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3 -0
+             RPC_CMNCR_MOIIO2(3) | RPC_CMNCR_MOIIO3(3))
+#define RPC_CMNCR_IO3FV(val)   (((val) & 0x3) << 14)
+#define RPC_CMNCR_IO2FV(val)   (((val) & 0x3) << 12)

Like I said, the above 2 aren't documented in the manual v1.00...

okay, add a description as:
/* RPC_CMNCR_IO3FV/IO2FV are undocumented bit, but must be set */

#define RPC_CMNCR_IO3FV(val)    (((val) & 0x3) << 14)
#define RPC_CMNCR_IO2FV(val)    (((val) & 0x3) << 12)
#define RPC_CMNCR_IO0FV(val)    (((val) & 0x3) << 8)
#define RPC_CMNCR_IOFV_HIZ      (RPC_CMNCR_IO0FV(3) | RPC_CMNCR_IO2FV(3) | \
                                  RPC_CMNCR_IO3FV(3))
Quoted 5 lines
Quoted 1 line

is it ok?

Yes. But would have been enough if you just commented with // on
the same line --
it seems these are legal now...

Quoted 8 lines

on the same line is over 80 char,
#define RPC_CMNCR_IO3FV(val) (((val) & 0x3) << 14) // undocumented bit, but must be set
#define RPC_CMNCR_IO2FV(val) (((val) & 0x3) << 12) // undocumented bit, but must be set

or just
#define RPC_CMNCR_IO3FV(val) (((val) & 0x3) << 14) // undocumented bit
#define RPC_CMNCR_IO2FV(val) (((val) & 0x3) << 12) // undocumented bit
is it ok ?

The second variant would be enough.

[...]

Quoted 22 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines

drivers/spi/spi-renesas-rpc.c line 410

Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10 -0
+   ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+   if (ret)
+      return ret;
+
+   rpc_spi_mem_set_prep_op_cfg(desc->mem->spi,
+                &desc->info.op_tmpl, &offs, &len);
+
+   regmap_write(rpc->regmap, RPC_CMNCR, RPC_CMNCR_SFDE |
+           RPC_CMNCR_MOIIO_HIZ | RPC_CMNCR_IOFV_HIZ |
+           RPC_CMNCR_BSZ(0));

Why not set this in the probing time and only set/clear the MD bit?

Quoted 7 lines
Quoted 3 lines

same above!
Make sure the value in these register are setting correctly before RPC starting a SPI transfer.

You can set it once and only change the bits you need to change afterwards.
What's wrong with it?

Quoted 7 lines

if so, it will patch to:
------------------------------------------------------
regmap_read(rpc->regmap, RPC_CMNCR, &data);
data &= ~RPC_CMNCR_MD;
regmap_write(rpc->regmap, RPC_CMNCR, data);
------------------------------------------------------
Do you think this way is better ?

No, this one is better:

regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0);

Quoted 3 lines

maybe this is better,
write(read(rpc->regs + RPC_CMNCR) & ~RPC_CMNCR_MD,

        rpc->regs + RPC_CMNCR);

It's effectively the same code as your 1st variant...

[...]

Quoted 46 lines
Quoted 34 lines
Quoted 19 lines
Quoted 19 lines
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3 -0
+static void rpc_spi_transfer_setup(struct rpc_spi *rpc,
+               struct spi_message *msg)
+{

[...]

drivers/spi/spi-renesas-rpc.c line 585

Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6 -0
+   for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
+      if (xfer[i].rx_buf) {
+         rpc->smenr |=
+            RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+            RPC_SMENR_SPIDB
+            (ilog2((unsigned int)xfer[i].rx_nbits));

Mhm, I would indent this contination line by 1 extra tab...

Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5 -0
+      } else if (xfer[i].tx_buf) {
+         rpc->smenr |=
+            RPC_SMENR_SPIDE(rpc_bits_set(xfer[i].len)) |
+            RPC_SMENR_SPIDB
+            (ilog2((unsigned int)xfer[i].tx_nbits));
Quoted 8 lines
Quoted 1 line

And this one...

like this ?
--------------------------------------------------------------------

         for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
                 if (xfer[i].rx_buf) {
                         rpc->smenr |=
                                 RPC_SMENR_SPIDE(rpc_bits_set(xfer

[i].len)) |

Quoted 2 lines
                                 RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer

[i].rx_nbits));

Quoted 3 lines
                 } else if (xfer[i].tx_buf) {
                         rpc->smenr |=
                                 RPC_SMENR_SPIDE(rpc_bits_set(xfer
Quoted 9 lines

[i].len)) |

Quoted 2 lines
                                 RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer

[i].tx_nbits));

I didn't mean you need to leave ( on the first line, can be left
on the new
line, as before.

how about this style ?
-------------------------------------------------------------------------------------

Quoted 13 lines
         for (i = xfercnt - 1; i < xfercnt && xfercnt > 1; i++) {
                 if (xfer[i].rx_buf) {
                         rpc->smenr |= RPC_SMENR_SPIDE(
                                         rpc_bits_set(xfer[i].len)) |
                                       RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer[i].rx_nbits));
                 } else if (xfer[i].tx_buf) {
                         rpc->smenr |= RPC_SMENR_SPIDE(
                                         rpc_bits_set(xfer[i].len)) |
                                       RPC_SMENR_SPIDB(
                                         ilog2((unsigned int)xfer[i].tx_nbits));
                 }
         }

Looks even worse...

Quoted 4 lines

------------------------------------------------------------------------------------------

best regards,
Mason

[...]

MBR, Sergei

author
#7 lore raw

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

In reply to Mason Yang

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

---
 .../devicetree/bindings/spi/spi-renesas-rpc.txt    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +37 -0
new file mode 100644
index 0000000..ba863d7
@@ -0,0 +1,37 @@
+Renesas R-Car Gen3 RPC controller Device Tree Bindings
+------------------------------------------------------
+
+Required properties:
+- compatible: should be "renesas,r8a77995-rpc"
+- #address-cells: should be 1
+- #size-cells: should be 0
+- reg: should contain 2 entries, one for the registers and one for the direct
+       mapping area
+- reg-names: should contain "regs" and "dirmap"
+- clock-names: should contain "rpc"
+- clocks: should contain 1 entries for the module's clock
+- renesas,rpc-mode: should contain "spi" for rpc spi mode or
+			   	   "hyperflash" for rpc hyerflash mode.
+
+Example:
+
+	rpc: rpc@ee200000 {
+		compatible = "renesas,r8a77995-rpc";
+		reg = <0 0xee200000 0 0x8100>, <0 0x08000000 0 0x4000000>;
+		reg-names = "regs", "dirmap";
+		clocks = <&cpg CPG_MOD 917>;
+		power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
+		resets = <&cpg 917>;
+		clock-names = "rpc";
+		renesas,rpc-mode = "spi";
+		#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
#8 lore raw

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

Hello!

Quoted 18 lines · Mason Yang

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

---
  .../devicetree/bindings/spi/spi-renesas-rpc.txt    | 37 ++++++++++++++++++++++
  1 file changed, 37 insertions(+)

create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt

Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +4 -0
new file mode 100644
index 0000000..ba863d7
@@ -0,0 +1,37 @@
+Renesas R-Car Gen3 RPC controller Device Tree Bindings
+------------------------------------------------------
+
+Required properties:

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

Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +10 -0
+- compatible: should be "renesas,r8a77995-rpc"
+- #address-cells: should be 1
+- #size-cells: should be 0
+- reg: should contain 2 entries, one for the registers and one for the direct
+       mapping area
+- reg-names: should contain "regs" and "dirmap"
+- clock-names: should contain "rpc"
+- clocks: should contain 1 entries for the module's clock
+- renesas,rpc-mode: should contain "spi" for rpc spi mode or
+			   	   "hyperflash" for rpc hyerflash mode.
                                                          ^ p

[...]

MBR, Sergei

#9 lore raw

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

In reply to Mason Yang
Quoted 18 lines · Mason Yang

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

---
 .../devicetree/bindings/spi/spi-renesas-rpc.txt    | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +4 -0
new file mode 100644
index 0000000..ba863d7
@@ -0,0 +1,37 @@
+Renesas R-Car Gen3 RPC controller Device Tree Bindings
+------------------------------------------------------
+
+Required properties:

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

Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-renesas-rpc.txt new file +10 -0
+- compatible: should be "renesas,r8a77995-rpc"
+- #address-cells: should be 1
+- #size-cells: should be 0
+- reg: should contain 2 entries, one for the registers and one for the direct
+       mapping area
+- reg-names: should contain "regs" and "dirmap"
+- clock-names: should contain "rpc"
+- clocks: should contain 1 entries for the module's clock
+- renesas,rpc-mode: should contain "spi" for rpc spi mode or
+			   	   "hyperflash" for rpc hyerflash mode.

We do not need special property to identify that the controller is in HF mode, just attach CFI NOR node or JEDEC SPI NOR underneath it.

Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw
In reply to Mason Yang
Quoted 4 lines · Mason Yang

Hi Mark,

This Renesas R-Car Gen3 RPC SPI driver is based on Boris's new spi-mem direct mapping read/write mode [1][2].

Again, the RPC is NOT a SPI controller, it is dual SPI/HF controller.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw
In reply to Mason Yang
Quoted 3 lines · Mason Yang

Hi Mark,
This Renesas R-Car Gen3 RPC SPI driver is based on Boris's new spi-mem direct mapping read/write mode [1][2].

Against which repo/branch these pathes were generated?

MBR, Sergei