mfd: Add Renesas R-Car Gen3 RPC-IF MFD driver
Subsystems (3)
v9 cover mfd: Add Renesas R-Car Gen3 RPC-IF MFD driver
Hi,
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 (3):
mfd: Add Renesas R-Car Gen3 RPC-IF MFD controller driver
spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
dt-bindings: mfd: Document Renesas R-Car Gen3 RPC-IF controller
bindings
.../devicetree/bindings/mfd/mfd-renesas-rpc.txt | 57 ++ drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 1 + drivers/mfd/renesas-rpc.c | 140 +++++ drivers/spi/Kconfig | 6 + drivers/spi/Makefile | 1 + drivers/spi/spi-renesas-rpc.c | 640 +++++++++++++++++++++ include/linux/mfd/renesas-rpc.h | 154 +++++ 8 files changed, 1008 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt create mode 100644 drivers/mfd/renesas-rpc.c create mode 100644 drivers/spi/spi-renesas-rpc.c create mode 100644 include/linux/mfd/renesas-rpc.h
Signature · 1 line
1.9.1
PATCH v9 1/3 mfd: Add Renesas R-Car Gen3 RPC-IF MFD controller driver
Add a driver for Renesas R-Car Gen3 RPC-IF MFD controller.
--- drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile | 1 + drivers/mfd/renesas-rpc.c | 140 ++++++++++++++++++++++++++++++++++++ include/linux/mfd/renesas-rpc.h | 154 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 drivers/mfd/renesas-rpc.c create mode 100644 include/linux/mfd/renesas-rpc.h
drivers/mfd/Kconfig +9 -0
@@ -978,6 +978,15 @@ config MFD_RDC321X southbridge which provides access to GPIOs and Watchdog using the southbridge PCI device configuration space. +config MFD_RENESAS_RPC + tristate "Renesas R-Car Gen3 RPC-IF MFD driver" + select MFD_CORE + depends on ARCH_RENESAS + help + This supports for Renesas R-Car Gen3 RPC-IF multifunction device + controller which provides either SPI host controller or HyperFlash. + You have to select individual components under the corresponding menu. + config MFD_RT5033 tristate "Richtek RT5033 Power Management IC" depends on I2C
drivers/mfd/Makefile +1 -0
@@ -183,6 +183,7 @@ obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO) += intel_quark_i2c_gpio.o obj-$(CONFIG_LPC_SCH) += lpc_sch.o obj-$(CONFIG_LPC_ICH) += lpc_ich.o obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o +obj-$(CONFIG_MFD_RENESAS_RPC) += renesas-rpc.o obj-$(CONFIG_MFD_JANZ_CMODIO) += janz-cmodio.o obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o obj-$(CONFIG_MFD_TPS6586X) += tps6586x.o
drivers/mfd/renesas-rpc.c new file +140 -0
140 lines not on this page · raw message
include/linux/mfd/renesas-rpc.h new file +154 -0
154 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v9 1/3] mfd: Add Renesas R-Car Gen3 RPC-IF MFD controller driver
Quoted 69 lines · Mason Yang
Add a driver for Renesas R-Car Gen3 RPC-IF MFD controller.
Signed-off-by Mason Yang <[email protected]>--- drivers/mfd/Kconfig | 9 +++ drivers/mfd/Makefile | 1 + drivers/mfd/renesas-rpc.c | 140 ++++++++++++++++++++++++++++++++++++ include/linux/mfd/renesas-rpc.h | 154 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 304 insertions(+) create mode 100644 drivers/mfd/renesas-rpc.c create mode 100644 include/linux/mfd/renesas-rpc.hdrivers/mfd/Kconfig +9
-0@@ -978,6 +978,15 @@ config MFD_RDC321X southbridge which provides access to GPIOs and Watchdog using the southbridge PCI device configuration space. +config MFD_RENESAS_RPC + tristate "Renesas R-Car Gen3 RPC-IF MFD driver" + select MFD_CORE + depends on ARCH_RENESAS + help + This supports for Renesas R-Car Gen3 RPC-IF multifunction device + controller which provides either SPI host controller or HyperFlash. + You have to select individual components under the corresponding menu. + config MFD_RT5033 tristate "Richtek RT5033 Power Management IC" depends on I2Cdrivers/mfd/Makefile +1
-0@@ -183,6 +183,7 @@ obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO) += intel_quark_i2c_gpio.o obj-$(CONFIG_LPC_SCH) += lpc_sch.o obj-$(CONFIG_LPC_ICH) += lpc_ich.o obj-$(CONFIG_MFD_RDC321X) += rdc321x-southbridge.o +obj-$(CONFIG_MFD_RENESAS_RPC) += renesas-rpc.o obj-$(CONFIG_MFD_JANZ_CMODIO) += janz-cmodio.o obj-$(CONFIG_MFD_JZ4740_ADC) += jz4740-adc.o obj-$(CONFIG_MFD_TPS6586X) += tps6586x.odrivers/mfd/renesas-rpc.c new file +19
-0@@ -0,0 +1,140 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp. +// Copyright (C) 2019 Macronix International Co., Ltd. +// +// R-Car Gen3 RPC-IF MFD driver +// +// Author: +// Mason Yang <[email protected]> +// + +#include <linux/mfd/renesas-rpc.h> +#include <linux/mfd/core.h> + +static const struct mfd_cell rpc_hf_ctlr = { + .name ="rpc-hf" , + .of_compatible ="renesas,rcar-rpc-hf" , +}; +
drivers/mfd/renesas-rpc.c line 29
Quoted 10 lines
drivers/mfd/renesas-rpc.c new file +10
-0+static const struct mfd_cell rpc_spi_ctlr = { + .name ="rpc-spi" , + .of_compatible ="renesas,rcar-rpc-spi" , +}; + +static const struct regmap_range rpc_mfd_volatile_ranges[] = { +regmap_reg_range (RPC_SMRDR0 ,RPC_SMRDR0 ), +regmap_reg_range (RPC_SMWDR0 ,RPC_SMWDR0 ), +regmap_reg_range (RPC_CMNSR ,RPC_CMNSR ), +};
Isn't SMWDR1 volatile too ? And SMRDR1 too ?
[...]
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH v9 1/3] mfd: Add Renesas R-Car Gen3 RPC-IF MFD controller driver
In reply to Mason YangQuoted 3 lines · Mason Yang
Add a driver for Renesas R-Car Gen3 RPC-IF MFD controller.
Signed-off-by Mason Yang <[email protected]>
[...]
Quoted 22 lines
drivers/mfd/renesas-rpc.c new file +16
-0@@ -0,0 +1,140 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp. +// Copyright (C) 2019 Macronix International Co., Ltd. +// +// R-Car Gen3 RPC-IF MFD driver +// +// Author: +// Mason Yang <[email protected]> +// + +#include <linux/mfd/renesas-rpc.h> +#include <linux/mfd/core.h> + +static const struct mfd_cell rpc_hf_ctlr = { + .name ="rpc-hf" ,
drivers/mfd/renesas-rpc.c line 26
Quoted 10 lines
drivers/mfd/renesas-rpc.c new file +10
-0+ .of_compatible = "renesas,rcar-rpc-hf", +}; + +static const struct mfd_cell rpc_spi_ctlr = { + .name ="rpc-spi" , + .of_compatible ="renesas,rcar-rpc-spi" , +}; + +static const struct regmap_range rpc_mfd_volatile_ranges[] = { +regmap_reg_range (RPC_SMRDR0 ,RPC_SMRDR0 ),
regmap_reg_range((RPC_SMRDR0, RPC_SMRDR1), like Marek noted?
drivers/mfd/renesas-rpc.c line 27
Quoted 1 line
drivers/mfd/renesas-rpc.c new file +1
-0+ regmap_reg_range(RPC_SMWDR0, RPC_SMWDR0),
regmap_reg_range((RPC_SMWDR0, RPC_SMWDR1)?
drivers/mfd/renesas-rpc.c line 53
Quoted 9 lines
drivers/mfd/renesas-rpc.c new file +9
-0+static int rpc_mfd_probe (struct platform_device *pdev) +{ +struct device_node *ctlr; +const struct mfd_cell *cell; +struct resource *res; +struct rpc_mfd *rpc; +int ret; + + ctlr =of_get_next_child (pdev->dev.of_node,NULL );
The child should be a CFI or JEDEC flash device, no virtual devices,
please.
[...]
drivers/mfd/renesas-rpc.c line 113
Quoted 9 lines
drivers/mfd/renesas-rpc.c new file +9
-0+ rpc->rstc =devm_reset_control_get_exclusive (&pdev->dev,NULL ); +if (IS_ERR (rpc->rstc)) +return PTR_ERR (rpc->rstc); + +platform_set_drvdata (pdev, rpc); + + ret =devm_mfd_add_devices (&pdev->dev,-1 , cell,1 ,NULL ,0 ,NULL ); + +return ret;
return devm_mfd_add_devices(&pdev->dev, -1, cell, 1, NULL, 0, NULL);
drivers/mfd/renesas-rpc.c line 118
Quoted 5 lines
drivers/mfd/renesas-rpc.c new file +5
-0+} + +static int rpc_mfd_remove (struct platform_device *pdev) +{ +mfd_remove_devices (&pdev->dev);
Why, if you used devm_mfd_add_devices() in the probe method?
Quoted 2 lines
drivers/mfd/renesas-rpc.c new file +2
-0+return 0 ; +}
[...]
Quoted 21 lines
include/linux/mfd/renesas-rpc.h new file +15
-0@@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp. +// Copyright (C) 2019 Macronix International Co., Ltd. +// +// R-Car Gen3 RPC-IF MFD driver +// +// Author: +// Mason Yang <[email protected]> +// + +#ifndef __MFD_RENESAS_RPC_H +#define __MFD_RENESAS_RPC_H + +#include <linux/clk.h>
include/linux/mfd/renesas-rpc.h line 25
Quoted 10 lines
include/linux/mfd/renesas-rpc.h new file +10
-0+#include <linux/io.h> +#include <linux/log2.h> +#include <linux/iopoll.h> +#include <linux/module.h> +#include <linux/mtd/mtd.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/of.h> +#include <linux/regmap.h> +#include <linux/reset.h>
Is any of these #include's used by the header itself? I don't think so...
include/linux/mfd/renesas-rpc.h line 27
Quoted 2 lines
include/linux/mfd/renesas-rpc.h new file +2
-0+ +#define RPC_CMNCR 0x0000 // R/W
Not sure we'd need the registers described in the public header after
we place the common RPC-IF code into the MFD driver. We'll see though...
[...]
MBR, Sergei
PATCH v9 2/3 spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to Mason YangAdd 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 | 640 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 647 insertions(+) create mode 100644 drivers/spi/spi-renesas-rpc.c
drivers/spi/Kconfig +6 -0
@@ -564,6 +564,12 @@ config SPI_RSPI help SPI driver for Renesas RSPI and QSPI blocks. +config SPI_RENESAS_RPC + tristate "Renesas R-Car Gen3 RPC-IF 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
@@ -86,6 +86,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 +640 -0
640 lines not on this page · raw message
Signature · 1 line
1.9.1
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
On 3/29/19 9:20 AM, Mason Yang wrote:
[...]
drivers/spi/spi-renesas-rpc.c line 22
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5
-0+struct rpc_spi { +struct clk *clk_rpc; +void __iomem *base; +void __iomem *dirmap; +void __iomem *wbuf;
Shouldn't all this stuff somehow come from the MFD driver ?
Quoted 13 lines
drivers/spi/spi-renesas-rpc.c new file +13
-0+struct regmap *regmap; +u32 cur_speed_hz; +u32 cmd; +u32 addr; +u32 dummy; +u32 smcr; +u32 smenr; +u32 xferlen; +u32 totalxferlen; +enum spi_mem_data_dir xfer_dir; +struct reset_control *rstc; +}; +
[...]
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to Mason YangQuoted 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 19 lines
drivers/spi/spi-renesas-rpc.c new file +13
-0@@ -0,0 +1,640 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2018 ~ 2019 Renesas Solutions Corp. +// Copyright (C) 2019 Macronix International Co., Ltd. +// +// R-Car Gen3 RPC-IF SPI/QSPI/Octa driver +// +// Author: +// Mason Yang <[email protected]> +// + +#include <linux/mfd/renesas-rpc.h> +#include <linux/spi/spi.h>
drivers/spi/spi-renesas-rpc.c line 23
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+#include <linux/spi/spi-mem.h> + +#include <asm/unaligned.h> + +struct rpc_spi { +struct clk *clk_rpc; +void __iomem *base; +void __iomem *dirmap; +void __iomem *wbuf; +struct regmap *regmap;
Why copy struct rpc_mfd's fields?
drivers/spi/spi-renesas-rpc.c line 29
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+u32 cur_speed_hz; +u32 cmd; +u32 addr; +u32 dummy; +u32 smcr; +u32 smenr;
I suggest renaming this field to 'enable'.
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5
-0+u32 xferlen; +u32 totalxferlen; +enum spi_mem_data_dir xfer_dir; +struct reset_control *rstc; +};
[...]
Quoted 19 lines
drivers/spi/spi-renesas-rpc.c new file +19
-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. +//
drivers/spi/spi-renesas-rpc.c line 79
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+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 )); +}
This function looks like a candidate to moving to the common (MFD) driver.
drivers/spi/spi-renesas-rpc.c line 87
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-0+ +static int wait_msg_xfer_end (struct rpc_spi *rpc) +{ +u32 sts; + +return regmap_read_poll_timeout (rpc->regmap,RPC_CMNSR , sts, + sts &RPC_CMNSR_TEND ,0 ,USEC_PER_SEC ); +}
This as well.
Quoted 21 lines
drivers/spi/spi-renesas-rpc.c new file +21
-0+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_controller_get_devdata (spi->controller); + + 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 ); +
drivers/spi/spi-renesas-rpc.c line 218
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+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);
So you haven't fixed this bug? I repeat, the driver doesn't work right
w/o this fixed!
[...]
drivers/spi/spi-renesas-rpc.c line 273
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+static ssize_t rpc_spi_mem_dirmap_read (struct spi_mem_dirmap_desc *desc, +u64 offs,size_t len,void *buf) +{ +struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >0x4000000 ) + len =0x4000000 ;
Ugh...
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;
drivers/spi/spi-renesas-rpc.c line 287
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +rpc_spi_mem_set_prep_op_cfg (desc->mem->spi, + &desc->info.op_tmpl, &offs, &len); + +regmap_update_bits (rpc->regmap,RPC_CMNCR ,RPC_CMNCR_MD ,0 ); +regmap_write (rpc->regmap,RPC_DRCR ,RPC_DRCR_RBURST (32 ) | +RPC_DRCR_RBE ); + +regmap_write (rpc->regmap,RPC_DRCMR , rpc->cmd); +regmap_write (rpc->regmap,RPC_DREAR ,RPC_DREAR_EAC (1 ));
So you're not even trying to support flashes larger than the read dirmap?
Now I don't think it's acceptable (and I have rewritten this code internally).
[...]
drivers/spi/spi-renesas-rpc.c line 309
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-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_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ;
Ugh! Again, I no longer think this is acceptable... Maybe we just need
to drop the support of the write buffer...
[...]
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) +{
[...]
Quoted 7 lines
drivers/spi/spi-renesas-rpc.c new file +7
-0+if (xfercnt >2 && xfer[1 ].len && xfer[1 ].tx_buf) { + rpc->smenr |= +RPC_SMENR_ADB (ilog2 ((unsigned int )xfer[1 ].tx_nbits)); + +for (i =0 ; i < xfer[1 ].len; i++) + rpc->addr |= ((u8 *)xfer[1 ].tx_buf)[i] << + (8 * (xfer[1 ].len - i -1 ));
drivers/spi/spi-renesas-rpc.c line 460
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +if (xfer[1 ].len ==4 ) + rpc->smenr |=RPC_SMENR_ADE (0xf ); +else + rpc->smenr |=RPC_SMENR_ADE (0x7 ); + } + +if (xfercnt >3 && xfer[2 ].len && xfer[2 ].tx_buf) { + rpc->smenr |=RPC_SMENR_DME ; + rpc->dummy =RPC_SMDMCR_DMCYC (xfer[2 ].len);
Needs to be multiplied by 8 (or other value) as well...
[...]
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret;
[...]
Quoted 17 lines
drivers/spi/spi-renesas-rpc.c new file +17
-0+ rpc->clk_rpc = rpc_mfd->clk_rpc; +if (IS_ERR (rpc->clk_rpc)) +return PTR_ERR (rpc->clk_rpc); + + rpc->base = rpc_mfd->base; +if (IS_ERR (rpc->base)) +return PTR_ERR (rpc->base); + + rpc->regmap = rpc_mfd->regmap; +if (IS_ERR (rpc->regmap)) { +dev_err (&pdev->dev, +"failed to regmap for rpc-spi, error %ld\n" , +PTR_ERR (rpc->regmap)); +return PTR_ERR (rpc->regmap); + } + + rpc->dirmap = rpc_mfd->dirmap;
drivers/spi/spi-renesas-rpc.c line 562
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+if (IS_ERR (rpc->dirmap)) + rpc->dirmap =NULL ; + + rpc->wbuf = rpc_mfd->wbuf; +if (IS_ERR (rpc->wbuf)) + rpc->wbuf =NULL ; + + rpc->rstc = rpc_mfd->rstc; +if (IS_ERR (rpc->rstc)) +return PTR_ERR (rpc->rstc);
Why do we need all this copying?
drivers/spi/spi-renesas-rpc.c line 573
Quoted 11 lines
drivers/spi/spi-renesas-rpc.c new file +11
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true; + + ctlr->num_chipselect =1 ; + ctlr->mem_ops = &rpc_spi_mem_ops; + ctlr->transfer_one_message = rpc_spi_transfer_one_message; + + ctlr->bits_per_word_mask =SPI_BPW_MASK (8 ); + ctlr->mode_bits =SPI_CPOL |SPI_CPHA |SPI_TX_QUAD |SPI_RX_QUAD ; +
We do need pm_runtime_get_sync() here!
drivers/spi/spi-renesas-rpc.c line 574
Quoted 1 line
drivers/spi/spi-renesas-rpc.c new file +1
-0+rpc_spi_hw_init (rpc);
And pm_runtime_put() here...
[...]
drivers/spi/spi-renesas-rpc.c line 604
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5
-0+static const struct of_device_id rpc_spi_of_ids[] = { + { .compatible ="renesas,rcar-rpc-spi" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, rpc_spi_of_ids);
Not needed at all...
[...]
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 25 lines
Quoted 25 lines
drivers/spi/spi-renesas-rpc.c new file +25
-0+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_controller_get_devdata (spi->controller); + + 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;
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c line 218
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+ rpc->totalxferlen += op->addr.nbytes; + } + +if (op->dummy.nbytes) { + rpc->smenr |=RPC_SMENR_DME ; + rpc->dummy =RPC_SMDMCR_DMCYC (op->dummy.nbytes);So you haven't fixed this bug? I repeat, the driver doesn't work
right
Quoted 1 line
w/o this fixed!
Do you mean
rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes) * 8; ?
What is your flash part number?
The problem you found is in 1 bit or 4 bits width ?
Quoted 3 lines
[...]
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_read(structspi_mem_dirmap_desc
*desc,
Quoted 5 lines
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5
-0+ u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret;
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c line 273
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+ +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >0x4000000 ) + len =0x4000000 ;Ugh...
by mtd->size ?
Quoted 17 lines
Quoted 5 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;drivers/spi/spi-renesas-rpc.c line 287
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +rpc_spi_mem_set_prep_op_cfg (desc->mem->spi, + &desc->info.op_tmpl, &offs, &len); + +regmap_update_bits (rpc->regmap,RPC_CMNCR ,RPC_CMNCR_MD ,0 ); +regmap_write (rpc->regmap,RPC_DRCR ,RPC_DRCR_RBURST (32 ) | +RPC_DRCR_RBE ); + +regmap_write (rpc->regmap,RPC_DRCMR , rpc->cmd); +regmap_write (rpc->regmap,RPC_DREAR ,RPC_DREAR_EAC (1 ));So you're not even trying to support flashes larger than the read
dirmap?
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
what about the size comes form mtd->size ?
Quoted 3 lines
[...]
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc
*desc,
Quoted 5 lines
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +5
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret;
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c line 309
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+ +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ;Ugh! Again, I no longer think this is acceptable... Maybe we just
need
Quoted 2 lines
to drop the support of the write buffer...
why ?
Using write buffer got the much better write performance.
Quoted 16 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) +{[...]
Quoted 11 lines
drivers/spi/spi-renesas-rpc.c new file +11
-0+if (xfercnt >2 && xfer[1 ].len && xfer[1 ].tx_buf) { + rpc->smenr |= +RPC_SMENR_ADB (ilog2 ((unsigned int )xfer[1 ].tx_nbits)); + +for (i =0 ; i < xfer[1 ].len; i++) + rpc->addr |= ((u8 *)xfer[1 ].tx_buf)[i] << + (8 * (xfer[1 ].len - i -1 )); + +if (xfer[1 ].len ==4 ) + rpc->smenr |=RPC_SMENR_ADE (0xf ); +else
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c line 460
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c new file +6
-0+ rpc->smenr |=RPC_SMENR_ADE (0x7 ); + } + +if (xfercnt >3 && xfer[2 ].len && xfer[2 ].tx_buf) { + rpc->smenr |=RPC_SMENR_DME ; + rpc->dummy =RPC_SMDMCR_DMCYC (xfer[2 ].len);Needs to be multiplied by 8 (or other value) as well...
Same above you mentioned:
rpc->dummy = RPC_SMDMCR_DMCYC(xfer[2].len) * 8;
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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello!
Quoted 35 lines · On 04/02/2019 08:48 AM, [email protected] wrote:
Quoted 26 lines
Quoted 26 lines
(quoted diff) +26
-0+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_controller_get_devdata(spi->controller); + + 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;Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ } + + if (op->dummy.nbytes) { + rpc->smenr |= RPC_SMENR_DME; + rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes);So you haven't fixed this bug? I repeat, the driver doesn't work right
w/o this fixed!
Quoted 3 lines
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?
Yes. Or some other code that amounts to it.
Quoted 1 line
What is your flash part number?
Spansion/Cypress S25FS512S. The datasheet says there must be 8 dummy cycles
for the RSFDP command...
Quoted 1 line
The problem you found is in 1 bit or 4 bits width ?
1-bit, I think.
Quoted 17 lines
Quoted 16 lines
[...]
Review
Quoted 12 lines
(quoted diff) +12
-0+static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, + u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > 0x4000000) + len = 0x4000000;Ugh...
Quoted 1 line
by
mtd->size?
That'd be better, yes.
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
(quoted diff) +9
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0);Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the read dirmap?
Now I don't think it's acceptable (and I have rewritten this code internally).
Quoted 1 line
what about the size comes form
mtd->size?
I'm not talking about size here; we should use the full address. I'm attaching
my patch...
Quoted 18 lines
Quoted 17 lines
[...]
Review
Quoted 12 lines
(quoted diff) +12
-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_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > RPC_WBUF_SIZE) + len = RPC_WBUF_SIZE;Ugh! Again, I no longer think this is acceptable... Maybe we just need
to drop the support of the write buffer...
Quoted 2 lines
why ?
Using write buffer got the much better write performance.
OK, let's keep it then.
[...]
MBR, Sergei
From: Sergei Shtylyov <[email protected]>
Subject: spi: renesas-rpc: allow reading from large flashes
--- drivers/spi/spi-renesas-rpc.c | 26 ++++++++++++++++++++------ include/linux/mfd/renesas-rpc.h | 2 ++ 2 files changed, 22 insertions(+), 6 deletions(-)
drivers/spi/spi-renesas-rpc.c +20 -6
@@ -264,14 +264,12 @@ static ssize_t rpc_spi_mem_dirmap_read(s {struct rpc_spi *rpc =spi_controller_get_devdata (desc->mem->spi->controller); +size_t _len = len;int ret;if (offs + desc->info.offset + len >U32_MAX )return -EINVAL ; -if (len >0x4000000 ) - len =0x4000000 ; - ret =rpc_spi_set_freq (rpc, desc->mem->spi->max_speed_hz);if (ret)return ret;
@@ -284,15 +282,31 @@ static ssize_t rpc_spi_mem_dirmap_read(s RPC_DRCR_RBE);regmap_write (rpc->regmap,RPC_DRCMR , rpc->cmd); -regmap_write (rpc->regmap,RPC_DREAR ,RPC_DREAR_EAC (1 ));regmap_write (rpc->regmap,RPC_DROPR ,0 );regmap_write (rpc->regmap,RPC_DRENR , rpc->smenr);regmap_write (rpc->regmap,RPC_DRDMCR , rpc->dummy);regmap_write (rpc->regmap,RPC_DRDRENR ,0 ); -memcpy_fromio (buf, rpc->dirmap + desc->info.offset + offs, len); +while (len) { +loff_t from = offs & (RPC_DIRMAP_SIZE -1 ); +size_t size =RPC_DIRMAP_SIZE - from; +u32 val =RPC_DREAR_EAC (1 ); + +if (rpc->smenr &RPC_DRENR_ADE (8 )) + val |=RPC_DREAR_EAV (offs >>25 ); +regmap_write (rpc->regmap,RPC_DREAR , val); + +if (size > len) + size = len; + +memcpy_fromio (buf, rpc->dirmap + desc->info.offset + from, + size); + buf += size; + offs += size; + len -= size; + } -return len; +return _len; } static ssize_t rpc_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
include/linux/mfd/renesas-rpc.h +2 -0
@@ -57,6 +57,7 @@#define RPC_DRCMR_OCMD (c) (((c) & 0xFF) << 0)#define RPC_DREAR 0x0014 // R/W +#define RPC_DREAR_EAV (v) (((v) & 0xff) << 16)#define RPC_DREAR_EAC (c) (((c) & 0x7) << 0)#define RPC_DROPR 0x0018 // R/W
@@ -140,6 +141,7 @@#define RPC_PHYOFFSET2 0x0084 // R/W#define RPC_PHYOFFSET2_OCTTMG (v) (((v) & 0x7) << 8) +#define RPC_DIRMAP_SIZE 0x4000000#define RPC_WBUF_SIZE 256 // Write Buffer sizestruct rpc_mfd {
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review
Quoted 6 lines
(quoted diff) +5
-0+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_controller_get_devdata(spi->controller);
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +20
-0+ + 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;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ rpc->totalxferlen += op->addr.nbytes; + } + + if (op->dummy.nbytes) { + rpc->smenr |= RPC_SMENR_DME; + rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes);So you haven't fixed this bug? I repeat, the driver doesn't work
right
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
w/o this fixed!
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?Yes. Or some other code that amounts to it.
why not setting "op->dummy.nbytes = 7" from spi-nor.c protocol layer ? driver may check device ID or something else to setup op->dummy.nbytes.
I think it is not a good idea to *8 in spi host driver.
Quoted 4 lines
Quoted 2 lines
What is your flash part number?
Spansion/Cypress S25FS512S. The datasheet says there must be 8 dummy
cycles
Quoted 9 lines
for the RSFDP command...
Quoted 1 line
The problem you found is in 1 bit or 4 bits width ?
1-bit, I think.Quoted 3 lines
Quoted 3 lines
[...]
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_read(structspi_mem_dirmap_desc
*desc,
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Review
Quoted 11 lines
(quoted diff) +11
-0+ u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > 0x4000000) + len = 0x4000000;Ugh...
Quoted 4 lines
Quoted 1 line
by
mtd->size?That'd be better, yes.
Oops, it seems hard to get mtd->size info. from spi_mem_dirmap, I would like to keep 0x4000000.
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-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); +Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...
okay,got it!
what about just
- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1));
+ regmap_write(rpc->mfd->regmap, RPC_DREAR,
+ RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
because only > 64MByte size make RPC_DREAR_EAV() work.
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello!
Quoted 35 lines · On 04/03/2019 12:20 PM, [email protected] wrote:
Quoted 35 lines
Quoted 35 lines
Quoted 34 lines
Quoted 21 lines
(quoted diff) +21
-0+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_controller_get_devdata(spi->controller); + + 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); +Review
Quoted 10 lines
(quoted diff) +10
-0+ 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);So you haven't fixed this bug? I repeat, the driver doesn't work right
w/o this fixed!
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?Yes. Or some other code that amounts to it.
Oops, I wasn't attentive enough, I was proposing:
rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes * 8);
Quoted 1 line
why not setting "
op->dummy.nbytes= 7" fromspi-nor.cprotocol layer ?
We want 8 dummy clocks, not 8 dummy bytes. And if you'd looked intospi_nor_read_sfdp(), you'd have seen that it requests 8 dummy clocks already.
Quoted 1 line
driver may check device ID or something else to setup
op->dummy.nbytes.
The RDSFDP command is not chip specific.
Quoted 28 lines
I think it is not a good idea to *8 in spi host driver.
Quoted 26 lines
Quoted 1 line
What is your flash part number?
Spansion/Cypress S25FS512S. The datasheet says there must be 8 dummy cycles
for the RSFDP command...Quoted 1 line
The problem you found is in 1 bit or 4 bits width ?
1-bit, I think.Quoted 17 lines
Quoted 16 lines
[...]
Review
Quoted 12 lines
(quoted diff) +12
-0+static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, + u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > 0x4000000) + len = 0x4000000;Ugh...
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
by
mtd->size?That'd be better, yes.
Oops, it seems hard to get
mtd->sizeinfo. fromspi_mem_dirmap,
It's in desc->info.length, no?
Quoted 1 line
I would like to keep
0x4000000.
I'm seeing Boris in the CC's... Boris, is it legitimate to limit
a single dirmap read by the memory "window" size? Or should we try to serve any valid transfer length?
Quoted 32 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-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); +Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...okay,got it!
what about just(quoted diff) +2
-1- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); + regmap_write(rpc->mfd->regmap, RPC_DREAR, + RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
Quoted 1 line
because only > 64MByte size make
RPC_DREAR_EAV()work.
Boris, what's your opinion on this?
Note that for the write dirmap we have just 256-byte buffer (reusing
the read cache). Is it legitimate to limit the served length to 256 bytes?
Quoted 2 lines
thanks & best regards,
Mason
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 86 lines · On Thu, 4 Apr 2019 21:56:19 +0300 Sergei Shtylyov…
Hello!
Quoted 35 lines · On 04/03/2019 12:20 PM, [email protected] wrote:
Quoted 35 lines
Quoted 35 lines
Quoted 34 lines
Quoted 21 lines
(quoted diff) +21
-0+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_controller_get_devdata(spi->controller); + + 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); +Review
Quoted 10 lines
(quoted diff) +10
-0+ 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);So you haven't fixed this bug? I repeat, the driver doesn't work right
w/o this fixed!Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?Yes. Or some other code that amounts to it.
Oops, I wasn't attentive enough, I was proposing:
rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes * 8);Quoted 1 line
why not setting "
op->dummy.nbytes= 7" fromspi-nor.cprotocol layer ?We want 8 dummy clocks, not 8 dummy bytes. And if you'd looked into
spi_nor_read_sfdp(), you'd have seen that it requests 8 dummy clocks already.Quoted 1 line
driver may check device ID or something else to setup
op->dummy.nbytes.The RDSFDP command is not chip specific.
Quoted 28 lines
I think it is not a good idea to *8 in spi host driver.
Quoted 26 lines
Quoted 1 line
What is your flash part number?
Spansion/Cypress S25FS512S. The datasheet says there must be 8 dummy cycles
for the RSFDP command...Quoted 1 line
The problem you found is in 1 bit or 4 bits width ?
1-bit, I think.Quoted 17 lines
Quoted 16 lines
[...]
Review
Quoted 12 lines
(quoted diff) +12
-0+static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, + u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > 0x4000000) + len = 0x4000000;Ugh...
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
by
mtd->size?That'd be better, yes.
Oops, it seems hard to get
mtd->sizeinfo. fromspi_mem_dirmap,It's in desc->info.length, no?
It's the lengths of the mapping which not necessarily mtd->size, but in the SPI NOR case it is :-). Anyway, you should not assume dirmapdesc->info.length == memory_device->size.
Quoted 6 lines
Quoted 2 lines
I would like to keep
0x4000000.I'm seeing Boris in the CC's... Boris, is it legitimate to limit
a single dirmap read by the memory "window" size? Or should we try to serve any valid transfer length?
If by memory window you're talking about the memory region reserved in the CPU address space, then no. It should not be limited to this size if possible. Most HW have a way to configure an offset to apply to the spi-mem operation, and in that case, the driver should change this offset on the fly when one tries to access a region that's outside of the currently configured window.
Quoted 33 lines
Quoted 33 lines
Quoted 18 lines
Quoted 17 lines
Quoted 17 lines
Quoted 5 lines
(quoted diff) +4
-0+ + ret = rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz); + if (ret) + return ret;Review
Quoted 10 lines
(quoted diff) +10
-0+ + rpc_spi_mem_set_prep_op_cfg(desc->mem->spi, + &desc->info.op_tmpl, &offs, &len); + + regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...okay,got it!
what about just(quoted diff) +2
-1- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); + regmap_write(rpc->mfd->regmap, RPC_DREAR, + RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
Quoted 5 lines
Quoted 1 line
because only > 64MByte size make
RPC_DREAR_EAV()work.Boris, what's your opinion on this?
Note that for the write dirmap we have just 256-byte buffer (reusing
the read cache). Is it legitimate to limit the served length to 256 bytes?
I don't know what the HW is capable of, but drivers should use any try they have to dynamically move the memory map window (make it point at a different spi-mem offset on demand). Note that dirmap_read/write() are allowed to return less than the amount of data requested, in that case the caller should continue reading at the offset where things stopped. This avoids having to implement a loop that splits things in several accesses when the access cannot be done in one step.
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
On 04/04/2019 10:12 PM, Boris Brezillon wrote:
[...]
Quoted 29 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Review
Quoted 12 lines
(quoted diff) +12
-0+static ssize_t rpc_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc, + u64 offs, size_t len, void *buf) +{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > 0x4000000) + len = 0x4000000;Ugh...Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
by
mtd->size?That'd be better, yes.
Oops, it seems hard to get
mtd->sizeinfo. fromspi_mem_dirmap,It's in desc->info.length, no?It's the lengths of the mapping which not necessarily
mtd->size, but in the SPI NOR case it is :-). Anyway, you should not assumedirmapdesc->info.length==memory_device->size.Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I would like to keep
0x4000000.I'm seeing Boris in the CC's... Boris, is it legitimate to limit
a single dirmap read by the memory "window" size? Or should we try to serve any valid transfer length?If by memory window you're talking about the memory region reserved in
Yes, we have 64 MiB window thru which we can "look into" the large MTD chips.
Quoted 2 lines
the CPU address space, then no. It should not be limited to this size if possible.
Mhm, so we're expected to loop incrementing the window address register
in order to serve the full xfer request?
Quoted 4 lines
Most HW have a way to configure an offset to apply to the spi-mem operation, and in that case, the driver should change this
offset on the fly when one tries to access a region that's outside of the currently configured window.
Well, my question wasn't about that actually -- that seemed quite obvious.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +8
-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); +Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...okay,got it!
what about just(quoted diff) +2
-1- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); + regmap_write(rpc->mfd->regmap, RPC_DREAR, + RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
because only > 64MByte size make
RPC_DREAR_EAV()work.Boris, what's your opinion on this?
Note that for the write dirmap we have just 256-byte buffer (reusing
the read cache). Is it legitimate to limit the served length to 256 bytes?I don't know what the HW is capable of,
As I said, there's 64 MiB read window, and for the writes we can re-use the
read cache to write (exactly) 256 bytes at a time...
Quoted 7 lines
but drivers should use any try
they have to dynamically move the memory map window (make it point at a different spi-mem offset on demand). Note that dirmap_read/write() are allowed to return less than the amount of data requested, in that case the caller should continue reading at the offset where things stopped. This avoids having to implement a loop that splits things in several accesses when the access cannot be done in one step.
Ah, this somewhat contradicts what you said earlier but seems clear now.
I'll go remove the loops. :-)
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to Sergei ShtylyovHi Sergei,
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+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_controller_get_devdata(spi->controller);
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +20
-0+ + 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;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ rpc->totalxferlen += op->addr.nbytes; + } + + if (op->dummy.nbytes) { + rpc->smenr |= RPC_SMENR_DME; + rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes);So you haven't fixed this bug? I repeat, the driver doesn'twork
right
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
w/o this fixed!
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?Yes. Or some other code that amounts to it.
Oops, I wasn't attentive enough, I was proposing:
rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes * 8);
If so, RPC make 9 dummy cycles not 8 dummy cycle due to setting 0 is 1 dummy cycle,
1 is 2 dummy cycles and 0x13 is 20 dummy cycles(max value).
I think it should set a correct dummy cycle/dummy bytes from spi-nor/spi-mem layer,
not in spi host driver.
Maybe Boris could comment on this !
thanks & 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.
=====================================================================
A message that is not in the archive (sent off-list or not yet received): OF2404F267.07FEB6C8-ON482583D6.000A8180-482583D6.000CC92F@LocalDomain
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+static void rpc_spi_mem_set_prep_op_cfg(struct
spi_device
*spi,
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+ const struct spi_mem_op *op, + u64 *offs, size_t *len) +{ + struct rpc_spi *rpc = spi_controller_get_devdata(
spi->controller);Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
(quoted diff) +20
-0+ + 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;Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ rpc->totalxferlen += op->addr.nbytes; + } + + if (op->dummy.nbytes) { + rpc->smenr |= RPC_SMENR_DME; + rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes);So you haven't fixed this bug? I repeat, the driver
Quoted 13 lines
doesn'twork right
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
w/o this fixed!
Do you mean
rpc->dummy=RPC_SMDMCR_DMCYC(op->dummy.nbytes)* 8; ?Yes. Or some other code that amounts to it.
Oops, I wasn't attentive enough, I was proposing:
rpc->dummy = RPC_SMDMCR_DMCYC(op->dummy.nbytes * 8);
ah, I missed the macro RPC_SMDMCR_DMCYC() minus 1.
Quoted 1 line
From
m25p80_read()
137 /* convert the dummy cycles to the number of bytes */
138 op.dummy.nbytes = (nor->read_dummy * op.dummy.buswidth) / 8;
for spi 1-1-1 mode, should it patch ?
For Spansion/Cypress S25FS512S to read RSFDP in QPI mode also needs 8 dummy cycle and seems got problem!
Quoted 4 lines
If so, RPC make 9 dummy cycles not 8 dummy cycle due to setting 0 is 1 dummy cycle,
1 is 2 dummy cycles and0x13is 20 dummy cycles(max value).
Quoted 8 lines
I think it should set a correct dummy cycle/dummy bytes from spi- nor/spi-mem layer,
not in spi host driver.Maybe Boris could comment on this !
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to [email protected]On 04/03/2019 12:20 PM, [email protected] wrote:
[...]
Quoted 31 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +7
-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); +Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...okay,got it!
what about just(quoted diff) +2
-1- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); + regmap_write(rpc->mfd->regmap, RPC_DREAR, + RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
Quoted 1 line
because only > 64MByte size make
RPC_DREAR_EAV()work.
Seems OK now, after Boris' reply.
Quoted 2 lines
thanks & best regards,
Mason
[...]
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 32 lines · Sergei Shtylyov
[...]
Quoted 31 lines
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +7
-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); +Quoted 8 lines
Quoted 8 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD, 0); + regmap_write(rpc->regmap, RPC_DRCR, RPC_DRCR_RBURST(32) | + RPC_DRCR_RBE); + + regmap_write(rpc->regmap, RPC_DRCMR, rpc->cmd); + regmap_write(rpc->regmap, RPC_DREAR, RPC_DREAR_EAC(1));So you're not even trying to support flashes larger than the
read dirmap?
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Now I don't think it's acceptable (and I have rewritten this code
internally).
Quoted 2 lines
what about the size comes form
mtd->size?I'm not talking about size here; we should use the full address.
I'm attaching
my patch...okay,got it!
what about just(quoted diff) +2
-1- regmap_write(rpc->mfd->regmap, RPC_DREAR, RPC_DREAR_EAC(1)); + regmap_write(rpc->mfd->regmap, RPC_DREAR, + RPC_DREAR_EAV(offs >> 25) | RPC_DREAR_EAC(1));
Quoted 3 lines
Quoted 1 line
because only > 64MByte size make
RPC_DREAR_EAV()work.Seems OK now, after Boris' reply.
Well, actually not. The 'len' check in the beginning is oversimplified.
Attached is the patch fixing up the dirmap read path (and making it handle flashes > 64 MiB as well)...
Quoted 4 lines
Quoted 2 lines
thanks & best regards,
Mason[...]
MBR, Sergei
From: Sergei Shtylyov <[email protected]>
Subject: spi: renesas-rpc: fix dirmap read
allow reading from large flashes.
--- drivers/spi/spi-renesas-rpc.c | 11 +++++++---- include/linux/mfd/renesas-rpc.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/spi/spi-renesas-rpc.c +7 -4
@@ -264,13 +264,15 @@ static ssize_t rpc_spi_mem_dirmap_read(s {struct rpc_spi *rpc =spi_controller_get_devdata (desc->mem->spi->controller); +loff_t from = offs & (RPC_DIRMAP_SIZE -1 ); +size_t size =RPC_DIRMAP_SIZE - from;int ret;if (offs + desc->info.offset + len >U32_MAX )return -EINVAL ; -if (len >0x4000000 ) - len =0x4000000 ; +if (len > size) + len = size; ret =rpc_spi_set_freq (rpc, desc->mem->spi->max_speed_hz);if (ret)
@@ -284,13 +286,14 @@ static ssize_t rpc_spi_mem_dirmap_read(s RPC_DRCR_RBE);regmap_write (rpc->regmap,RPC_DRCMR , rpc->cmd); -regmap_write (rpc->regmap,RPC_DREAR ,RPC_DREAR_EAC (1 )); +regmap_write (rpc->regmap,RPC_DREAR , +RPC_DREAR_EAV (offs >>25 ) |RPC_DREAR_EAC (1 ));regmap_write (rpc->regmap,RPC_DROPR ,0 );regmap_write (rpc->regmap,RPC_DRENR , rpc->smenr);regmap_write (rpc->regmap,RPC_DRDMCR , rpc->dummy);regmap_write (rpc->regmap,RPC_DRDRENR ,0 ); -memcpy_fromio (buf, rpc->dirmap + desc->info.offset + offs, len); +memcpy_fromio (buf, rpc->dirmap + desc->info.offset + from, len);return len; }
include/linux/mfd/renesas-rpc.h +2 -0
@@ -57,6 +57,7 @@#define RPC_DRCMR_OCMD (c) (((c) & 0xFF) << 0)#define RPC_DREAR 0x0014 // R/W +#define RPC_DREAR_EAV (v) (((v) & 0xff) << 16)#define RPC_DREAR_EAC (c) (((c) & 0x7) << 0)#define RPC_DROPR 0x0018 // R/W
@@ -140,6 +141,7 @@#define RPC_PHYOFFSET2 0x0084 // R/W#define RPC_PHYOFFSET2_OCTTMG (v) (((v) & 0x7) << 8) +#define RPC_DIRMAP_SIZE 0x4000000#define RPC_WBUF_SIZE 256 // Write Buffer sizestruct rpc {
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to Mason YangHello!
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 5 lines
drivers/spi/spi-renesas-rpc.c new file +0
-0
[...]
[...]
Quoted 19 lines
drivers/spi/spi-renesas-rpc.c new file +19
-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_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (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);
drivers/spi/spi-renesas-rpc.c line 326
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +regmap_update_bits (rpc->regmap,RPC_CMNCR ,RPC_CMNCR_MD ,RPC_CMNCR_MD ); + +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + +regmap_update_bits (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_STRTIM (7 ) | +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF ); + +memcpy_toio (rpc->wbuf, buf, len);
Wait, doesn't the manual say that the whole 256-byte buffer should be
filled? I think that short chunks have to be written w/o WBUF (done, in fact, by the HF driver).
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +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); +if (ret) + goto err_out; + +regmap_write (rpc->regmap,RPC_DRCR ,RPC_DRCR_RCF );
drivers/spi/spi-renesas-rpc.c line 346
Quoted 10 lines
drivers/spi/spi-renesas-rpc.c new file +10
-0+ +regmap_update_bits (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_STRTIM (7 ) | +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , +RPC_PHYCNT_STRTIM (6 )); + +return len; + +err_out: +return reset_control_reset (rpc->rstc); +}
[...]
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc
*desc,
Quoted 12 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ; +
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);
Quoted 11 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-0+ +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + +regmap_update_bits (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_STRTIM (7 ) | +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF ); + +memcpy_toio (rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer should be
filled? I think that short chunks have to be written w/o WBUF (done, in
fact,
Quoted 4 lines
by the HF driver).
From
spi-nor.clayer always transfer 256 bytes data with page program
command.
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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 36 lines · On 4/10/19 3:33 AM, [email protected] wrote:
Hi Sergei,
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc*desc,
Quoted 12 lines
Quoted 12 lines
+ u64 offs,
size_tlen, const void *buf)drivers/spi/spi-renesas-rpc.c new file +11
-0+{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > RPC_WBUF_SIZE) + len = RPC_WBUF_SIZE; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
+ ret =
rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+ if (ret)
+ return ret;drivers/spi/spi-renesas-rpc.c new file +5
-0+ + rpc_spi_mem_set_prep_op_cfg(desc->mem->spi, + &desc->info.op_tmpl, &offs, &len); + + regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);Quoted 11 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-0+ + regmap_write(rpc->regmap, RPC_SMDRENR, 0); + + regmap_update_bits(rpc->regmap, RPC_PHYCNT, RPC_PHYCNT_STRTIM(7) | + RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF, + RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF); + + memcpy_toio(rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer should be filled? I think that short chunks have to be written w/o WBUF (done,
Quoted 6 lines
in fact,
Quoted 2 lines
by the HF driver).
From
spi-nor.clayer always transfer 256 bytes data with page program command.
Does that apply even for flashes with not-256-byte pages ?
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi,
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 27 lines · On 4/10/19 3:33 AM, [email protected] wrote:
Quoted 25 lines
Hi Sergei,
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc*desc,
Quoted 12 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+ +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + + regmap_update_bits(rpc->regmap, RPC_PHYCNT,
RPC_PHYCNT_STRTIM(7) |
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , + RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF); + +memcpy_toio (rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer should
be
Quoted 1 line
Quoted 1 line
Quoted 1 line
filled?
it could be less than 256 bytes, i.e., 128 bytes to rpc->wbuf !
I think that short chunks have to be written w/o WBUF (done,
Quoted 9 lines
Quoted 6 lines
in fact,
Quoted 2 lines
by the HF driver).
From
spi-nor.clayer always transfer 256 bytes data with page program command.Does that apply even for flashes with not-256-byte pages ?
I think it needs to patch in case of nor->page_size = 512 bytes.
Quoted 3 lines
Signature · 2 lines
Best regards, Marek Vasut
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 52 lines · On 4/10/19 10:01 AM, [email protected] wrote:
Hi,
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 27 lines · On 4/10/19 3:33 AM, [email protected] wrote:
Quoted 25 lines
Hi Sergei,
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc*desc,
Quoted 12 lines
Quoted 12 lines
+ u64 offs,
size_tlen, const void *buf)drivers/spi/spi-renesas-rpc.c new file +11
-0+{ + struct rpc_spi *rpc = + spi_controller_get_devdata(desc->mem->spi->controller); + int ret; + + if (offs + desc->info.offset + len > U32_MAX) + return -EINVAL; + + if (len > RPC_WBUF_SIZE) + len = RPC_WBUF_SIZE; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
+ ret =
rpc_spi_set_freq(rpc, desc->mem->spi->max_speed_hz);
+ if (ret)
+ return ret;drivers/spi/spi-renesas-rpc.c new file +5
-0+ + rpc_spi_mem_set_prep_op_cfg(desc->mem->spi, + &desc->info.op_tmpl, &offs, &len); + + regmap_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+ + regmap_write(rpc->regmap, RPC_SMDRENR, 0); + + regmap_update_bits(rpc->regmap, RPC_PHYCNT,
RPC_PHYCNT_STRTIM(7)|Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
+ RPC_PHYCNT_WBUF2 |
RPC_PHYCNT_WBUF,
+ RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF);
+
+memcpy_toio(rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer
should be
Quoted 1 line
Quoted 1 line
Quoted 1 line
filled?
it could be less than 256 bytes, i.e., 128 bytes to
rpc->wbuf!I think that short chunks have to be written w/o WBUF (done,
Quoted 4 lines
Quoted 4 lines
in fact,
Quoted 2 lines
by the HF driver).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
From
spi-nor.clayer always transfer 256 bytes data with page program command.Does that apply even for flashes with not-256-byte pages ?
I think it needs to patch in case of
nor->page_size= 512 bytes.
There are also flashes with page size < 256 bytes :)
Signature · 2 lines
Best regards, Marek Vasut
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to [email protected]Quoted 52 lines · On Wed, 10 Apr 2019 16:01:02 +0800 [email protected] wrote:
Hi,
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 27 lines · On 4/10/19 3:33 AM, [email protected] wrote:
Quoted 25 lines
Hi Sergei,
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc*desc,
Quoted 12 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+ +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + + regmap_update_bits(rpc->regmap, RPC_PHYCNT,
RPC_PHYCNT_STRTIM(7)|Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , + RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF); + +memcpy_toio (rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer should
be
Quoted 1 line
Quoted 1 line
Quoted 1 line
filled?
it could be less than 256 bytes, i.e., 128 bytes to
rpc->wbuf!I think that short chunks have to be written w/o WBUF (done,
Quoted 4 lines
Quoted 4 lines
in fact,
Quoted 2 lines
by the HF driver).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
From
spi-nor.clayer always transfer 256 bytes data with page program command.Does that apply even for flashes with not-256-byte pages ?
I think it needs to patch in case of
nor->page_size= 512 bytes.
I think the main problem here is that you assume the memory is a NOR :-). Just do what the spi-mem user asks: if he asks you to write X bytes, then write no more than X bytes. Use whatever trick you have to make sure this is always true, and if this requires using a slow path for non-aligned accesses, then do it, because it's better to have a slow+working memory than a fast+non-working one :P.
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to [email protected]Hello!
Quoted 35 lines · On 04/10/2019 11:01 AM, [email protected] wrote:
Quoted 23 lines
Quoted 23 lines
Quoted 1 line
Quoted 1 line
+static
ssize_trpc_spi_mem_dirmap_write(structspi_mem_dirmap_desc*desc,
Quoted 12 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-0+ +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + +regmap_update_bits (rpc->regmap,RPC_PHYCNT ,RPC_PHYCNT_STRTIM (7 ) | +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , +RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF ); + +memcpy_toio (rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte buffer should be
filled?
Quoted 1 line
it could be less than 256 bytes, i.e., 128 bytes to
rpc->wbuf!
The gen3 manual 1.50 contradicts:
Note: This area should be accessed sequentially from the start address and transfer size to the device is 256-byte unit. All Write Buffer area should be filled with transfer data in every transfer. When accessing non-sequentially or at random, the operation is not guaranteed. After Write Buffer Operation, this cache area must be cleared by DRCR.RCF bit.
Quoted 5 lines
I think that short chunks have to be written w/o WBUF (done,
Quoted 4 lines
Quoted 4 lines
in fact,
Quoted 2 lines
by the HF driver).
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
From
spi-nor.clayer always transfer 256 bytes data with page program command.Does that apply even for flashes with not-256-byte pages ?
I think it needs to patch in case of
nor->page_size= 512 bytes.
What needs to patch what? :-)
Quoted 2 lines
thanks & best regards,
Mason
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Sergei,
Quoted 3 lines · On 04/10/2019 11:01 AM, [email protected] wrote:
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+static
ssize_trpc_spi_mem_dirmap_write(struct
spi_mem_dirmap_desc
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
*desc,
Quoted 12 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+ u64 offs, size_t len, const void *buf) +{ + struct rpc_spi *rpc = +spi_controller_get_devdata (desc->mem->spi->controller); +int ret; + +if (offs + desc->info.offset + len >U32_MAX ) +return -EINVAL ; + +if (len >RPC_WBUF_SIZE ) + len =RPC_WBUF_SIZE ; +Quoted 8 lines
drivers/spi/spi-renesas-rpc.c
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c new file +8
-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_update_bits(rpc->regmap, RPC_CMNCR, RPC_CMNCR_MD,
RPC_CMNCR_MD);
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+ +regmap_write (rpc->regmap,RPC_SMDRENR ,0 ); + + regmap_update_bits(rpc->regmap, RPC_PHYCNT,
RPC_PHYCNT_STRTIM(7) |
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-renesas-rpc.c line 326
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+RPC_PHYCNT_WBUF2 |RPC_PHYCNT_WBUF , + RPC_PHYCNT_WBUF2 | RPC_PHYCNT_WBUF); + +memcpy_toio (rpc->wbuf, buf, len);Wait, doesn't the manual say that the whole 256-byte
buffershould be
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
filled?
it could be less than 256 bytes, i.e., 128 bytes to
rpc->wbuf!The gen3 manual 1.50 contradicts:
Quoted 8 lines
Note: This area should be accessed sequentially from the start address and transfer size
to the device is 256-byte unit. All Write Buffer area should be filled with transfer data
in every transfer. When accessing non-sequentially or at random, the operation is not
guaranteed. After Write Buffer Operation, this cache area must be cleared by DRCR.RCF bit.
I have tried it ok but I am still waiting for a confirm answer from Renesas FAE.
I may drop rpc_spi_mem_dirmap_write() due to WBUF issue.
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to Mason YangHello!
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 5 lines
drivers/spi/spi-renesas-rpc.c new file +0
-0
[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;
[...]
drivers/spi/spi-renesas-rpc.c line 565
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;
I think this line no longer works as expected with the new probing scheme.
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...
[...]
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 28 lines · Sergei Shtylyov
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]>[...]
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 8 lines
drivers/spi/spi-renesas-rpc.c line 565
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;I think this line no longer works as expected with the new probing scheme.
Have you tested reading? v8 patch still works while v9 patches hang on doing:$ cat /dev/mtd<n>...
Sorry, 'od -x', not 'cat'.
WBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello,
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 9 lines · Sergei Shtylyov
Quoted 7 lines
Quoted 5 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 26 lines
Quoted 26 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;
Quoted 9 lines
Quoted 1 line
I think this line no longer works as expected with the new
probing scheme.
Quoted 1 line
Have you tested reading? v8 patch still works while v9 patches
hang on doing:
Quoted 2 lines
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.
root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280 0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005
fyi~
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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 28 lines · On 04/15/2019 05:36 AM, [email protected] wrote:
Quoted 28 lines
Quoted 28 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]>[...]
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c line 565
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;I think this line no longer works as expected with the new
probing scheme.
That's because we added another (SPI) device under our MFD.
Quoted 20 lines
Quoted 6 lines
Quoted 4 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280
Quoted 8 lines
0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005
Still hangs for me. After I patches spi-mem.c and the driver to
call RPM for the MFD, it started working again. Perhaps, that clock is still enabled on your target. What does the following print (for the RPC clocks)?
$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summary
Quoted 4 lines
fyi~
best regards,
Mason
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello,
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 7 lines · On 04/15/2019 05:36 AM, [email protected] wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 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
Quoted 25 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c line 565
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;I think this line no longer works as expected with the new
probing scheme.
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one linectlr->auto_runtime_pm = true;
?
Quoted 30 lines
Quoted 21 lines
Quoted 7 lines
Quoted 5 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280Quoted 8 lines
0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005
Quoted 8 lines
Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock is still enabled on your target. What does the following print (for the RPC clocks)?$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summary
root@draak:/# cat /sys/kernel/debug/clk/clk_summary
enable prepare protect duty
clock count count count rate
accuracy phase cycle
---------------------------------------------------------------------------------------------
audio_clkout1 0 0 0 11289600 0
0 50000
x19_clk 0 0 0 24576000 0
0 50000
dclkin-0 0 0 0 0 0
0 50000
scif 1 1 0 0 0
0 50000
audio_clkb 0 0 0 22579200 0
0 50000
msiof-ref-clock 0 0 0 66666666 0
0 50000
extal 2 3 0 48000000 0
0 50000
r 0 2 0 31250 0
0 50000
rpc-if 0 1 0 31250 0
0 50000
rwdt 0 1 0 31250 0
0 50000
cmt0 0 0 0 31250 0
0 50000
cmt1 0 0 0 31250 0
0 50000
cmt2 0 0 0 31250 0
0 50000
cmt3 0 0 0 31250 0
0 50000
osc 0 0 0 125000 0
0 50000thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 33 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 33 lines
Quoted 6 lines
Quoted 6 lines
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]>[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
I think this line no longer works as expected with the new
probing scheme.
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one line
ctlr->auto_runtime_pm= true;
?
No, you should explicitly call RPM for the MFD (not the SPI device).
Quoted 38 lines
Quoted 29 lines
Quoted 20 lines
Quoted 6 lines
Quoted 4 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280Quoted 8 lines
0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005Quoted 8 lines
Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock is still enabled on your target. What does the following print (for the RPC clocks)?$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summary
Quoted 13 lines
root@draak:/# cat /sys/kernel/debug/clk/clk_summary
enable prepare protect duty
clock count count count rate accuracy phase cycle
---------------------------------------------------------------------------------------------
audio_clkout1 0 0 0 11289600 0 0 50000
x19_clk 0 0 0 24576000 0 0 50000
dclkin-0 0 0 0 0 0 0 50000
scif 1 1 0 0 0 0 50000
audio_clkb 0 0 0 22579200 0 0 50000
msiof-ref-clock 0 0 0 66666666 0 0 50000
extal 2 3 0 48000000 0 0 50000
r 0 2 0 31250 0 0 50000
rpc-if 0 1 0 31250 0 0 50000 This looks wrong, the RPC-IF module clock should have RPC or RPCD2 (where ae they?)
as a source, not RLCK...
Quoted 10 lines
rwdt 0 1 0 31250 0 0 50000 cmt0 0 0 0 31250 0 0 50000 cmt1 0 0 0 31250 0 0 50000 cmt2 0 0 0 31250 0 0 50000 cmt3 0 0 0 31250 0 0 50000 osc 0 0 0 125000 0 0 50000thanks & best regards,
Mason
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello,
Quoted 2 lines
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 7 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 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
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; + struct rpc_mfd *rpc_mfd =
dev_get_drvdata(pdev->dev.parent);
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
I think this line no longer works as expected with the new
probing scheme.
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one line
ctlr->auto_runtime_pm= true;
?
how did you test it ?
what is your testing flow ?
Quoted 1 line
No, you should explicitly call RPM for the MFD (not the SPI device).
okay, patch RPM to RPC MFD and will remove SPI RPM enable part.
Quoted 35 lines
Quoted 35 lines
Quoted 35 lines
Quoted 21 lines
Quoted 7 lines
Quoted 5 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280Quoted 8 lines
0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock is still enabled on your target. What does the following print (for the RPC clocks)?
Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summaryroot@draak:/# cat /sys/kernel/debug/clk/clk_summary enable prepare protect duty clock count count countrate accuracy phase cycle
Quoted 1 line
---------------------------------------------------------------------------------------------
Quoted 14 lines
Quoted 1 line
audio_clkout10 0 011289600 0 0 50000
Quoted 1 line
x19_clk0 0 024576000 0 0 50000
Quoted 1 line
dclkin-0 0 0 0
0 0 0 50000
Quoted 1 line
scif 1 1 0
0 0 0 50000
Quoted 1 line
audio_clkb0 0 022579200 0 0 50000
Quoted 1 line
msiof-ref-clock 0 0 0
66666666 0 0 50000
Quoted 1 line
extal 2 3 0
48000000 0 0 50000
Quoted 8 lines
Quoted 1 line
r 0 2 0
31250 0 0 50000
Quoted 1 line
rpc-if 0 1 0
31250 0 0 50000
This looks wrong, the RPC-IF module clock should have RPC or
RPCD2 (where ae they?)
as a source, not RLCK...
I check the Ch8 CPG of R-Car datasheet, figure 8.1f(R-Car D3), the RPC/RPCD2 is derived from PLL1 -> PLL1CK
I didn't patch it and it should be exposed afrer the .sdsrc
.main 2 2 48000000 0
0
.pll3 0 0 928000000 0
0
.pll1 4 4 1600000000 0
0
lv1 0 0 1600000000 0
0
lv0 1 1 1600000000 0
0
lvds 1 1 1600000000 0
0
cl 0 0 33333333 0
0
zx 0 0 533333333 0
0
zt 0 0 400000000 0
0
ztr 0 0 266666666 0
0
.sdsrc 1 1 800000000 0
0
sd0 1 1 200000000 0
0
emmc0
---> here !
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Mason,
Quoted 48 lines · On Fri, Apr 19, 2019 at 7:39 AM <[email protected]> wrote:
Quoted 27 lines
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 5 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 5 lines
Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock is still enabled on your target. What does the following print (for the RPC clocks)?Quoted 7 lines
Quoted 3 lines
$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summaryroot@draak:/# cat /sys/kernel/debug/clk/clk_summary enable prepare protect duty clock count count countrate accuracy phase cycle
Quoted 1 line
---------------------------------------------------------------------------------------------
Quoted 9 lines
audio_clkout1 0 0 0 11289600 0 0 50000 x19_clk 0 0 0 24576000 0 0 50000 dclkin-0 0 0 0 0 0 0 50000 scif 1 1 0 0 0 0 50000 audio_clkb 0 0 0 22579200 0 0 50000 msiof-ref-clock 0 0 0 66666666 0 0 50000 extal 2 3 0 48000000 0 0 50000 r 0 2 0 31250 0 0 50000 rpc-if 0 1 0 31250 0 0 50000Quoted 3 lines
This looks wrong, the RPC-IF module clock should have RPC or
RPCD2 (where ae they?)
as a source, not RLCK...I check the Ch8 CPG of R-Car datasheet, figure 8.1f(R-Car D3), the RPC/RPCD2 is derived from PLL1 -> PLL1CK
I didn't patch it and it should be exposed afrer the .sdsrc
.main 2 2 48000000 0 0 .pll3 0 0 928000000 0 0 .pll1 4 4 1600000000 0 0 lv1 0 0 1600000000 0 0 lv0 1 1 1600000000 0 0 lvds 1 1 1600000000 0 0 cl 0 0 33333333 0 0 zx 0 0 533333333 0 0 zt 0 0 400000000 0 0 ztr 0 0 266666666 0 0 .sdsrc 1 1 800000000 0 0 sd0 1 1 200000000 0 0
Quoted 2 lines
emmc0
---> here !
Upstream drivers/clk/renesas/r8a77995-cpg-mssr.c does not have the "rpc-if" clock, and we have not yet seen the patch to add it that you must be using to make your driver work. If the clock is defined wrongly, that might explain why your driver is working for you, but not for Sergei.
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
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hi Geert,
Quoted 5 lines · On Fri, Apr 19, 2019 at 7:39 AM <[email protected]> wrote:
Quoted 1 line
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI
controller driver
Quoted 2 lines
Quoted 2 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 1 line
Quoted 1 line
Still hangs for me. After I patches
spi-mem.cand the driver
to
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
call RPM for the MFD, it started working again. Perhaps, that
clock
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
is still enabled on your target. What does the following print
(for
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
the RPC clocks)?
$ mount none -t debugfs /sys/kernel/debug/ $ cat /sys/kernel/debug/clk/clk_summary
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
root@draak:/# cat /sys/kernel/debug/clk/clk_summary enable prepare protect duty clock count count countrate accuracy phase cycle
Quoted 1 line
---------------------------------------------------------------------------------------------
Quoted 48 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
audio_clkout10 0 011289600 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
x19_clk0 0 024576000 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
dclkin-0 0 0 0
0 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
scif 1 1 0
0 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
audio_clkb0 0 022579200 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
msiof-ref-clock 0 0 0
66666666 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
extal 2 3 0
48000000 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
r 0 2 0
31250 0 0 50000
Quoted 1 line
Quoted 1 line
Quoted 1 line
rpc-if 0 1 0
31250 0 0 50000
Quoted 11 lines
Quoted 4 lines
This looks wrong, the RPC-IF module clock should have RPC or
RPCD2 (where ae they?)
as a source, not RLCK...I check the Ch8 CPG of R-Car datasheet, figure 8.1f(R-Car D3), the RPC/RPCD2 is derived from PLL1 -> PLL1CK
I didn't patch it and it should be exposed afrer the .sdsrc
.main 2 2
48000000 0 0
Quoted 1 line
.pll3 0 0
928000000 0 0
Quoted 1 line
.pll1 4 4
1600000000 0 0
Quoted 1 line
lv1 0 0
1600000000 0 0
Quoted 1 line
lv0 1 1
1600000000 0 0
Quoted 1 line
lvds 1 1
1600000000 0 0
Quoted 1 line
cl 0 0
33333333 0 0
Quoted 1 line
zx 0 0
533333333 0 0
Quoted 1 line
zt 0 0
400000000 0 0
Quoted 1 line
ztr 0 0
266666666 0 0
Quoted 8 lines
Quoted 1 line
.sdsrc 1 1
800000000 0 0
Quoted 1 line
sd0 1 1
200000000 0 0
Quoted 2 lines
emmc0
---> here !Upstream
drivers/clk/renesas/r8a77995-cpg-mssr.cdoes not have the
"rpc-if"
Quoted 1 line
clock, and we have not yet seen the patch to add it that you must be
using
Quoted 2 lines
to make your driver work. If the clock is defined wrongly, that might explain why your driver is working for you, but not for Sergei.
yes, I think so.
Before I have test "CPG_MOD 917" bit for RPC-IF CLK ON/OFF.
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
In reply to [email protected]Hello!
Quoted 42 lines · On 04/19/2019 08:38 AM, [email protected] wrote:
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 6 lines
Quoted 6 lines
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]>[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
I think this line no longer works as expected with the new
probing scheme.
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one line
ctlr->auto_runtime_pm= true;
?
Quoted 39 lines
how did you test it ?
what is your testing flow ?Quoted 1 line
No, you should explicitly call RPM for the MFD (not the SPI device).
okay, patch RPM to RPC MFD and will remove SPI RPM enable part.
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 21 lines
Quoted 7 lines
Quoted 5 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280Quoted 8 lines
0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock>> >> is still enabled on your target. What does the following print (for
Even with these issues worked around, I still see strange behavior on
writes, e.g. after I mount JFFS2 partition, remove 1 file, unmount, re-mount, and mount again, the removed file is back! :-/
[...]
Quoted 2 lines
thanks & best regards,
Mason
MBR, Sergei
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
On 05/14/2019 10:06 PM, Sergei Shtylyov wrote:
[...]
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 29 lines
Quoted 28 lines
Quoted 6 lines
Quoted 4 lines
Have you tested reading? v8 patch still works while v9 patches hang on doing:
$ cat /dev/mtd<n>...Sorry, 'od -x', not 'cat'.root@draak:/# cat /proc/mtd dev: size erasesize name mtd0: 00040000 00001000 "Bank 1 - Boot parameter" mtd1: 00140000 00001000 "Bank 1 - Loader-BL2" mtd2: 00040000 00001000 "Bank 1 - Certification" mtd3: 00080000 00001000 "Bank 1 - ARM Trusted FW" mtd4: 00400000 00001000 "Bank 1 - Reserved-1" mtd5: 00300000 00001000 "Bank 1 - U-Boot" mtd6: 00200000 00001000 "Bank 1 - Reserved-2" mtd7: 00480000 00001000 "Bank 1 - Splash" mtd8: 00040000 00001000 "Bank 1 - Device Tree" root@draak:/# od -x /dev/mtd1 0000000 0000 d280 0001 d280 0002 d280 0003 d280 0000020 0004 d280 0005 d280 0006 d280 0007 d280 0000040 0008 d280 0009 d280 000a d280 000b d280 0000060 000c d280 000d d280 000e d280 000f d280 0000100 0010 d280 0011 d280 0012 d280 0013 d280 0000120 0014 d280 0015 d280 0016 d280 0017 d280 0000140 0018 d280 0019 d280 001a d280 001b d280 0000160 001c d280 001d d280 001e d280 1000 d53e 0000200 f800 9266 1000 d51e 3fdf d503 3ba0 1005
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Still hangs for me. After I patches
spi-mem.cand the driver to
call RPM for the MFD, it started working again. Perhaps, that clock>> >> is still enabled on your target. What does the following print (forEven with these issues worked around, I still see strange behavior on
writes, e.g. after I mount JFFS2 partition, remove 1 file, unmount, re-mount, and mount again, the removed file is back! :-/
Too many re-mounts, one was enough. :-)
Quoted 4 lines
[...]
Quoted 2 lines
thanks & best regards,
Mason
MBR, Sergei
A message that is not in the archive (sent off-list or not yet received): OF58AAFF49.C4593DEB-ON482583E1.001D551E-482583E1.001F089D@LocalDomain
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Hello,
Quoted 1 line
Quoted 1 line
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller
driver
Quoted 7 lines
Quoted 7 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 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
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c
Quoted 4 lines
drivers/spi/spi-renesas-rpc.c new file +4
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; + struct rpc_mfd *rpc_mfd =
dev_get_drvdata(pdev->dev.parent);
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Quoted 19 lines
Quoted 13 lines
Quoted 12 lines
drivers/spi/spi-renesas-rpc.c new file +12
-0+struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;I think this line no longer works as expected with the new
probing scheme.
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one line
ctlr->auto_runtime_pm= true;
?how did you test it ?
what is your testing flow ?Quoted 1 line
No, you should explicitly call RPM for the MFD (not the SPI
device).
Quoted 2 lines
okay, patch RPM to RPC MFD and will remove SPI RPM enable part.
wait! I test it ok.
Don't need to patch RPM to RPC MFD, just keep RPM in SPI.
root@draak:/sys/power# echo mem > state [ 135.848711] PM: suspend entry (s2idle) [ 135.852777] PM: Syncing filesystems ... done. [ 135.869468] Freezing user space processes ... (elapsed 0.002 seconds) done. [ 135.879962] OOM killer disabled. [ 135.883257] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. [ 135.893474] Suspending console(s) (use no_console_suspend to debug) [ 135.910946] [Mason] rpc_spi_suspend [ 135.986022] PM: suspend devices took 0.084 seconds [ 135.986047] PM: suspend debug: Waiting for 5 second(s). [ 141.142024] [Mason] rpc_spi_resume [ 141.220859] PM: resume devices took 0.116 seconds [ 141.243179] OOM killer enabled. [ 141.246417] Restarting tasks ... done. [ 141.266579] PM: suspend exit root@draak:/sys/power#
thanks & 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.
=====================================================================
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 40 lines · On 04/19/2019 12:31 PM, [email protected] wrote:
Quoted 40 lines
Quoted 40 lines
Re: [PATCH v9 2/3] spi: Add Renesas R-Car Gen3 RPC-IF SPI controller driver
Quoted 36 lines · On 04/18/2019 05:51 AM, [email protected] wrote:
Quoted 36 lines
Quoted 6 lines
Quoted 6 lines
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]>[...]
drivers/spi/spi-
Quoted 1 line
drivers/spi/spi- renamed from drivers/spi/spi-renesas-rpc.c +0
-0
renesas-rpc.cQuoted 28 lines
Quoted 28 lines
Quoted 22 lines
Quoted 4 lines
new file mode 100644
index 0000000..037f273drivers/spi/spi-renesas-rpc.c new file +0
-0[...]
Quoted 16 lines
drivers/spi/spi-renesas-rpc.c new file +16
-0+static int rpc_spi_probe (struct platform_device *pdev) +{ +struct spi_controller *ctlr; +struct rpc_mfd *rpc_mfd =dev_get_drvdata (pdev->dev.parent); +struct rpc_spi *rpc; +int ret; + + ctlr =spi_alloc_master (&pdev->dev,sizeof (*rpc)); +if (!ctlr) +return -ENOMEM ; + +platform_set_drvdata (pdev, ctlr); + + rpc =spi_controller_get_devdata (ctlr); + + ctlr->dev.of_node = pdev->dev.of_node;[...]
Quoted 5 lines
drivers/spi/spi-renesas-rpc.c
Quoted 3 lines
drivers/spi/spi-renesas-rpc.c new file +3
-0+ +pm_runtime_enable (&pdev->dev); + ctlr->auto_runtime_pm = true;I think this line no longer works as expected with the new
probing scheme.
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
That's because we added another (SPI) device under our MFD.
Do you mean just to remove one line
ctlr->auto_runtime_pm= true;
?how did you test it ?
what is your testing flow ?
I think I've patched drivers/spi/spi-mem.c to get spi_mem_access_{start|end}()
to be called with ctlr->dev.parent->parent as an arg...
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
No, you should explicitly call RPM for the MFD (not the SPI device).
okay, patch RPM to RPC MFD and will remove SPI RPM enable part.
wait! I test it ok.
Don't need to patch RPM to RPC MFD, just keep RPM in SPI.
Quoted 16 lines
root@draak:/sys/power# echo mem > state [ 135.848711] PM: suspend entry (s2idle) [ 135.852777] PM: Syncing filesystems ... done. [ 135.869468] Freezing user space processes ... (elapsed 0.002 seconds) done. [ 135.879962] OOM killer disabled. [ 135.883257] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. [ 135.893474] Suspending console(s) (use no_console_suspend to debug) [ 135.910946] [Mason] rpc_spi_suspend [ 135.986022] PM: suspend devices took 0.084 seconds [ 135.986047] PM: suspend debug: Waiting for 5 second(s). [ 141.142024] [Mason] rpc_spi_resume [ 141.220859] PM: resume devices took 0.116 seconds [ 141.243179] OOM killer enabled. [ 141.246417] Restarting tasks ... done. [ 141.266579] PM: suspend exit root@draak:/sys/power#
That's not *runtime* PM, it's the *plain* PM you're testing here...
Quoted 2 lines
thanks & best regards,
Mason
MBR, Sergei
PATCH v9 3/3 dt-bindings: mfd: 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 MFD controller.
--- .../devicetree/bindings/mfd/mfd-renesas-rpc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +57 -0
@@ -0,0 +1,57 @@ +Renesas R-Car Gen3 RPC-IF MFD 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,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 1 entries for the module's clock +- clock-names: should contain "rpc" +- #address-cells: should be 1 +- #size-cells: should be 0 + +Required nodes: + spi: + Node for configuring the SPI controller driver. + Required properties: + compatible = "renesas,rcar-rpc-spi"; + + hf: + Node for configuring the hyperflash controller driver. + Required properties: + compatible = "renesas,rcar-rpc-hf"; + +Example: + + rpc_mfd: rpc-mfd@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>; + + spi { + compatible = "renesas,rcar-rpc-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
Re: [PATCH v9 3/3] dt-bindings: mfd: Document Renesas R-Car Gen3 RPC-IF controller bindings
Quoted 48 lines · Mason Yang
Document the bindings used by the Renesas R-Car Gen3 RPC-IF MFD controller.
Signed-off-by Mason Yang <[email protected]>--- .../devicetree/bindings/mfd/mfd-renesas-rpc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txtDocumentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +34
-0@@ -0,0 +1,57 @@ +Renesas R-Car Gen3 RPC-IF MFD 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,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 1 entries for the module's clock +- clock-names: should contain "rpc" +- #address-cells: should be 1 +- #size-cells: should be 0 + +Required nodes: + spi: + Node for configuring the SPI controller driver. + Required properties: + compatible = "renesas,rcar-rpc-spi"; + + hf: + Node for configuring the hyperflash controller driver. + Required properties: + compatible = "renesas,rcar-rpc-hf"; + +Example: + + rpc_mfd: rpc-mfd@ee200000 { + compatible = "renesas,r8a77995-rpc", "renesas,rcar-gen3-rpc"; + reg = <0 0xee200000 0 0x200>, <0 0x08000000 0 0x4000000>,
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 44
Quoted 10 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +10
-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>; + resets = <&cpg 917>; + #address-cells = <1>; + #size-cells = <0>; + + spi {
Why is this subnode needed ?
The MFD driver core can just check whether the flash@0 is jedec,spi-nor or cfi-flash and select mode of operation based on that.
Quoted 14 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +13
-0+ compatible = "renesas,rcar-rpc-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 · 2 lines
Best regards, Marek Vasut
Re: [PATCH v9 3/3] dt-bindings: mfd: Document Renesas R-Car Gen3 RPC-IF controller bindings
Hi Marek,
Quoted 12 lines
Quoted 12 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +12
-0+ +Example: + + rpc_mfd: rpc-mfd@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>;
Quoted 9 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 44
Quoted 4 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + + spi {Why is this subnode needed ?
The MFD driver core can just check whether the flash@0 is jedec,spi-nor or cfi-flash and select mode of operation based on that.
okay, I will remove this virtual node and patch code based on your comments.
thanks & 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.
=====================================================================
Re: [PATCH v9 3/3] dt-bindings: mfd: Document Renesas R-Car Gen3 RPC-IF controller bindings
In reply to Mason YangHello!
Quoted 14 lines · Mason Yang
Document the bindings used by the Renesas R-Car Gen3 RPC-IF MFD controller.
Signed-off-by Mason Yang <[email protected]>--- .../devicetree/bindings/mfd/mfd-renesas-rpc.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txtDocumentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +0
-0
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 2
Quoted 2 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +2
-0@@ -0,0 +1,57 @@ +Renesas R-Car Gen3 RPC-IF MFD controller Device Tree Bindings +---------------------------------------------------------------------
Too many dashes. :-)
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 15
Quoted 13 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +13
-0+ +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,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 1 entries for the module's clock +- clock-names: should contain "rpc"
What about the "power-domains" and "resets" props?
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 17
Quoted 2 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +2
-0+- #address-cells: should be 1 +- #size-cells: should be 0
Why? You don't have the "reg" props in the sub-devices...
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 23
Quoted 6 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +6
-0+ +Required nodes: + spi: + Node for configuring the SPI controller driver. + Required properties: + compatible = "renesas,rcar-rpc-spi";
Sigh... you were supposed to only place the flash device sub-nodes
under the "main" device node, we don't add the virtual devices to DT, there's no matching sub-device in the hardware. You don't have to describe these sub-devices in DT, you can register the simple platform devices.
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt line 32
Quoted 9 lines
Documentation/devicetree/bindings/mfd/mfd-renesas-rpc.txt new file +9
-0+ + hf: + Node for configuring the hyperflash controller driver. + Required properties: + compatible = "renesas,rcar-rpc-hf"; + +Example: + + rpc_mfd: rpc-mfd@ee200000 {
Just "rpc: rpc-if@ee200000, please.
[...]
MBR, Sergei