2021-11-18 03:10:59

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v2 0/3] RSPI driver support for RZ/G2L

Hi All,

This patch series adds RSPI driver and dt binding support to RZ/G2L SoC.

Cheers,
Prabhakar

Changes for v2:
* Fixed review comments pointed by Geert.

v1: https://patchwork.kernel.org/project/linux-renesas-soc/
cover/[email protected]/

Lad Prabhakar (3):
spi: dt-bindings: renesas,rspi: Document RZ/G2L SoC
spi: spi-rspi: Add support to deassert/assert reset line
spi: spi-rspi: Drop redeclaring ret variable in qspi_transfer_in()

.../devicetree/bindings/spi/renesas,rspi.yaml | 4 ++-
drivers/spi/spi-rspi.c | 27 ++++++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)

--
2.17.1



2021-11-18 03:11:01

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v2 1/3] spi: dt-bindings: renesas,rspi: Document RZ/G2L SoC

Add RSPI binding documentation for Renesas RZ/G2L SoC.

RSPI block is identical to one found on RZ/A, so no driver changes are
required. The fallback compatible string "renesas,rspi-rz" will be used
on RZ/G2L.

Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Biju Das <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
v1->v2
* Updated commit description
* Folded resets property check along with renesas,qspi
---
Documentation/devicetree/bindings/spi/renesas,rspi.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/renesas,rspi.yaml b/Documentation/devicetree/bindings/spi/renesas,rspi.yaml
index 8397f60d80a2..76e6d9e52fc7 100644
--- a/Documentation/devicetree/bindings/spi/renesas,rspi.yaml
+++ b/Documentation/devicetree/bindings/spi/renesas,rspi.yaml
@@ -21,7 +21,8 @@ properties:
- enum:
- renesas,rspi-r7s72100 # RZ/A1H
- renesas,rspi-r7s9210 # RZ/A2
- - const: renesas,rspi-rz # RZ/A
+ - renesas,r9a07g044-rspi # RZ/G2{L,LC}
+ - const: renesas,rspi-rz # RZ/A and RZ/G2{L,LC}

- items:
- enum:
@@ -122,6 +123,7 @@ allOf:
contains:
enum:
- renesas,qspi
+ - renesas,r9a07g044-rspi
then:
required:
- resets
--
2.17.1


2021-11-18 03:11:10

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v2 2/3] spi: spi-rspi: Add support to deassert/assert reset line

On RZ/G2L SoC we need to explicitly deassert the reset line
for the device to work, use this opportunity to deassert/assert
reset line in spi-rspi driver.

This patch adds support to read the "resets" property (if available)
from DT and perform deassert/assert when required.

Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Biju Das <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
v1->v2
* Included RB tag
---
drivers/spi/spi-rspi.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index d16ed88802d3..592682d96562 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -21,6 +21,7 @@
#include <linux/dma-mapping.h>
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/sh_dma.h>
#include <linux/spi/spi.h>
#include <linux/spi/rspi.h>
@@ -1225,8 +1226,14 @@ static const struct of_device_id rspi_of_match[] = {

MODULE_DEVICE_TABLE(of, rspi_of_match);

+static void rspi_reset_control_assert(void *data)
+{
+ reset_control_assert(data);
+}
+
static int rspi_parse_dt(struct device *dev, struct spi_controller *ctlr)
{
+ struct reset_control *rstc;
u32 num_cs;
int error;

@@ -1238,6 +1245,24 @@ static int rspi_parse_dt(struct device *dev, struct spi_controller *ctlr)
}

ctlr->num_chipselect = num_cs;
+
+ rstc = devm_reset_control_get_optional_exclusive(dev, NULL);
+ if (IS_ERR(rstc))
+ return dev_err_probe(dev, PTR_ERR(rstc),
+ "failed to get reset ctrl\n");
+
+ error = reset_control_deassert(rstc);
+ if (error) {
+ dev_err(dev, "failed to deassert reset %d\n", error);
+ return error;
+ }
+
+ error = devm_add_action_or_reset(dev, rspi_reset_control_assert, rstc);
+ if (error) {
+ dev_err(dev, "failed to register assert devm action, %d\n", error);
+ return error;
+ }
+
return 0;
}
#else
--
2.17.1


2021-11-18 03:11:11

by Prabhakar Mahadev Lad

[permalink] [raw]
Subject: [PATCH v2 3/3] spi: spi-rspi: Drop redeclaring ret variable in qspi_transfer_in()

"ret" variable is already declared in qspi_transfer_in() at the
beginning of function, drop redeclaring ret in the if block, fixing
below:

spi-rspi.c: In function ‘qspi_transfer_in’:
spi-rspi.c:838:7: warning: declaration of ‘ret’ shadows a previous local
838 | int ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
| ^~~
spi-rspi.c:835:6: note: shadowed declaration is here
835 | int ret;

Fixes: db30083813b55 ("spi: rspi: avoid uninitialized variable access")
Signed-off-by: Lad Prabhakar <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
---
v1->v2
* Included RB tag
---
drivers/spi/spi-rspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 592682d96562..815698366412 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -835,7 +835,7 @@ static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer)
int ret;

if (rspi->ctlr->can_dma && __rspi_can_dma(rspi, xfer)) {
- int ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
+ ret = rspi_dma_transfer(rspi, NULL, &xfer->rx_sg);
if (ret != -EAGAIN)
return ret;
}
--
2.17.1


2021-11-18 19:19:03

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] RSPI driver support for RZ/G2L

On Thu, 18 Nov 2021 03:10:38 +0000, Lad Prabhakar wrote:
> This patch series adds RSPI driver and dt binding support to RZ/G2L SoC.
>
> Cheers,
> Prabhakar
>
> Changes for v2:
> * Fixed review comments pointed by Geert.
>
> [...]

Applied to

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

Thanks!

[1/3] spi: dt-bindings: renesas,rspi: Document RZ/G2L SoC
commit: 5a8f8542e34b6469cd5c5a3d075fa5977d90775e
[2/3] spi: spi-rspi: Add support to deassert/assert reset line
commit: aadbff4af5c90919cbe67e2c4d77c68cdefa454e
[3/3] spi: spi-rspi: Drop redeclaring ret variable in qspi_transfer_in()
commit: 1d734f592e1a1d41af80e90001d109cec1c98fb4

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

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

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

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

Thanks,
Mark