* [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support
@ 2025-08-20 8:38 Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 01/22] clk: renesas: Use str_on_off() helper Biju Das
` (23 more replies)
0 siblings, 24 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
Add RZ/G3E XSPI support to cip-6.1. Also backported
clk and irq patches.
All the patches in the series are cherry-picked from mainline.
Biju Das (15):
dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core
clocks
clk: renesas: r9a09g047: Add support for xspi mux and divider
clk: renesas: r9a09g047: Add XSPI clock/reset
memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error
memory: renesas-rpc-if: Move rpcif_info definitions near to the user
dt-bindings: memory: Document RZ/G3E support
memory: renesas-rpc-if: Move rpc-if reg definitions
memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive()
memory: renesas-rpc-if: Add regmap to struct rpcif_info
memory: renesas-rpc-if: Add wrapper functions
memory: renesas-rpc-if: Add RZ/G3E xSPI support
spi: rpc-if: Add write support for memory-mapped area
irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
arm64: dts: renesas: r9a09g047: Add XSPI node
arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH
Fabrizio Castro (1):
clk: renesas: rzv2h: Add missing include file
Geert Uytterhoeven (1):
clk: renesas: Use str_on_off() helper
John Madieu (1):
arm64: dts: renesas: r9a09g047: Add SYS node
Lad Prabhakar (4):
clk: renesas: rzv2h: Skip monitor checks for external clocks
clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv
clocks
clk: renesas: rzv2h: Drop redundant base pointer from pll_clk
clk: renesas: rzv2h: Add fixed-factor module clocks with status
reporting
.../renesas,rzg3e-xspi.yaml | 135 ++++
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 28 +
.../boot/dts/renesas/rzg3e-smarc-som.dtsi | 46 ++
drivers/clk/renesas/r9a09g047-cpg.c | 39 +-
drivers/clk/renesas/renesas-cpg-mssr.c | 3 +-
drivers/clk/renesas/rzg2l-cpg.c | 5 +-
drivers/clk/renesas/rzv2h-cpg.c | 126 +++-
drivers/clk/renesas/rzv2h-cpg.h | 47 +-
drivers/irqchip/irq-renesas-rzv2h.c | 4 +-
drivers/memory/renesas-rpc-if-regs.h | 146 ++++
drivers/memory/renesas-rpc-if.c | 689 +++++++++++++-----
drivers/memory/renesas-xspi-if-regs.h | 105 +++
drivers/spi/spi-rpc-if.c | 16 +-
.../dt-bindings/clock/renesas,r9a09g047-cpg.h | 3 +
include/memory/renesas-rpc-if.h | 4 +
15 files changed, 1201 insertions(+), 195 deletions(-)
create mode 100644 Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.yaml
create mode 100644 drivers/memory/renesas-rpc-if-regs.h
create mode 100644 drivers/memory/renesas-xspi-if-regs.h
--
2.43.0
^ permalink raw reply [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 01/22] clk: renesas: Use str_on_off() helper
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 02/22] dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core clocks Biju Das
` (22 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Geert Uytterhoeven <geert+renesas@glider.be>
commit aff664cc8cbc5c28e5aa57dc4201c34497f3c871 upstream.
Use the str_on_off() helper instead of open-coding the same operation.
Note that this does change the case of the flags, which doesn't matter
much for debug messages.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/622f8554dcb815c8fc73511a1a118c1724570fa9.1745840497.git.geert+renesas@glider.be
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/renesas-cpg-mssr.c | 3 ++-
drivers/clk/renesas/rzg2l-cpg.c | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 523fd4523157..e2772d8411d7 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -27,6 +27,7 @@
#include <linux/psci.h>
#include <linux/reset-controller.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <dt-bindings/clock/renesas-cpg-mssr.h>
@@ -200,7 +201,7 @@ static int cpg_mstp_clock_endisable(struct clk_hw *hw, bool enable)
u32 value;
dev_dbg(dev, "MSTP %u%02u/%pC %s\n", reg, bit, hw->clk,
- enable ? "ON" : "OFF");
+ str_on_off(enable));
spin_lock_irqsave(&priv->rmw_lock, flags);
if (priv->reg_layout == CLK_REG_LAYOUT_RZ_A) {
diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c
index 4df873fd5604..0d7e0fa73fff 100644
--- a/drivers/clk/renesas/rzg2l-cpg.c
+++ b/drivers/clk/renesas/rzg2l-cpg.c
@@ -28,6 +28,7 @@
#include <linux/pm_domain.h>
#include <linux/reset-controller.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/units.h>
#include <dt-bindings/clock/renesas-cpg-mssr.h>
@@ -1215,8 +1216,8 @@ static int rzg2l_mod_clock_endisable(struct clk_hw *hw, bool enable)
return 0;
}
- dev_dbg(dev, "CLK_ON %u/%pC %s\n", CLK_ON_R(reg), hw->clk,
- enable ? "ON" : "OFF");
+ dev_dbg(dev, "CLK_ON 0x%x/%pC %s\n", CLK_ON_R(reg), hw->clk,
+ str_on_off(enable));
value = bitmask << 16;
if (enable)
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 02/22] dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core clocks
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 01/22] clk: renesas: Use str_on_off() helper Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 03/22] clk: renesas: r9a09g047: Add support for xspi mux and divider Biju Das
` (21 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit f21923f3f410f84528b5e7bdcbe4afdc6f07010c upstream.
Add definitions for XSPI core clock and Gigabit Ethernet PTP reference
core clocks in the R9A09G047 CPG DT bindings header file.
The clk_spi is modelled as a fixed divider clock with parent clk_spix2 and
factor two as both parent and child share same gating bit.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250424081400.135028-2-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
include/dt-bindings/clock/renesas,r9a09g047-cpg.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/dt-bindings/clock/renesas,r9a09g047-cpg.h b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h
index 1d031bf6bf03..a27132f9a6c8 100644
--- a/include/dt-bindings/clock/renesas,r9a09g047-cpg.h
+++ b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h
@@ -17,5 +17,8 @@
#define R9A09G047_CM33_CLK0 6
#define R9A09G047_CST_0_SWCLKTCK 7
#define R9A09G047_IOTOP_0_SHCLK 8
+#define R9A09G047_SPI_CLK_SPI 9
+#define R9A09G047_GBETH_0_CLK_PTP_REF_I 10
+#define R9A09G047_GBETH_1_CLK_PTP_REF_I 11
#endif /* __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ */
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 03/22] clk: renesas: r9a09g047: Add support for xspi mux and divider
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 01/22] clk: renesas: Use str_on_off() helper Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 02/22] dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core clocks Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 04/22] clk: renesas: r9a09g047: Add XSPI clock/reset Biju Das
` (20 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 38a7eb91195befc30e31bbc09a89e1f4e4a25fbf upstream.
The mux smux2_xspi_clk{0,1} used for selecting spi and spix2 clocks and
pllcm33_xspi divider to select different clock rates. Add support for
both.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250424081400.135028-3-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/r9a09g047-cpg.c | 27 ++++++++++++++++++++++++++-
drivers/clk/renesas/rzv2h-cpg.h | 7 +++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c
index 88a5a1c24ade..be387548664a 100644
--- a/drivers/clk/renesas/r9a09g047-cpg.c
+++ b/drivers/clk/renesas/r9a09g047-cpg.c
@@ -16,7 +16,7 @@
enum clk_ids {
/* Core Clock Outputs exported to DT */
- LAST_DT_CORE_CLK = R9A09G047_IOTOP_0_SHCLK,
+ LAST_DT_CORE_CLK = R9A09G047_GBETH_1_CLK_PTP_REF_I,
/* External Input Clocks */
CLK_AUDIO_EXTAL,
@@ -31,7 +31,13 @@ enum clk_ids {
CLK_PLLVDO,
/* Internal Core Clocks */
+ CLK_PLLCM33_DIV3,
+ CLK_PLLCM33_DIV4,
+ CLK_PLLCM33_DIV5,
CLK_PLLCM33_DIV16,
+ CLK_SMUX2_XSPI_CLK0,
+ CLK_SMUX2_XSPI_CLK1,
+ CLK_PLLCM33_XSPI,
CLK_PLLCLN_DIV2,
CLK_PLLCLN_DIV8,
CLK_PLLCLN_DIV16,
@@ -61,6 +67,14 @@ static const struct clk_div_table dtable_2_4[] = {
{0, 0},
};
+static const struct clk_div_table dtable_2_16[] = {
+ {0, 2},
+ {1, 4},
+ {2, 8},
+ {3, 16},
+ {0, 0},
+};
+
static const struct clk_div_table dtable_2_64[] = {
{0, 2},
{1, 4},
@@ -70,6 +84,10 @@ static const struct clk_div_table dtable_2_64[] = {
{0, 0},
};
+/* Mux clock tables */
+static const char * const smux2_xspi_clk0[] = { ".pllcm33_div3", ".pllcm33_div4" };
+static const char * const smux2_xspi_clk1[] = { ".smux2_xspi_clk0", ".pllcm33_div5" };
+
static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
/* External Clock Inputs */
DEF_INPUT("audio_extal", CLK_AUDIO_EXTAL),
@@ -84,8 +102,15 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
DEF_FIXED(".pllvdo", CLK_PLLVDO, CLK_QEXTAL, 105, 2),
/* Internal Core Clocks */
+ DEF_FIXED(".pllcm33_div3", CLK_PLLCM33_DIV3, CLK_PLLCM33, 1, 3),
+ DEF_FIXED(".pllcm33_div4", CLK_PLLCM33_DIV4, CLK_PLLCM33, 1, 4),
+ DEF_FIXED(".pllcm33_div5", CLK_PLLCM33_DIV5, CLK_PLLCM33, 1, 5),
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
+ DEF_SMUX(".smux2_xspi_clk0", CLK_SMUX2_XSPI_CLK0, SSEL1_SELCTL2, smux2_xspi_clk0),
+ DEF_SMUX(".smux2_xspi_clk1", CLK_SMUX2_XSPI_CLK1, SSEL1_SELCTL3, smux2_xspi_clk1),
+ DEF_CSDIV(".pllcm33_xspi", CLK_PLLCM33_XSPI, CLK_SMUX2_XSPI_CLK1, CSDIV0_DIVCTL3,
+ dtable_2_16),
DEF_FIXED(".pllcln_div2", CLK_PLLCLN_DIV2, CLK_PLLCLN, 1, 2),
DEF_FIXED(".pllcln_div8", CLK_PLLCLN_DIV8, CLK_PLLCLN, 1, 8),
DEF_FIXED(".pllcln_div16", CLK_PLLCLN_DIV16, CLK_PLLCLN, 1, 16),
diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h
index 97054f207113..27d160c74232 100644
--- a/drivers/clk/renesas/rzv2h-cpg.h
+++ b/drivers/clk/renesas/rzv2h-cpg.h
@@ -93,10 +93,12 @@ struct smuxed {
.width = (_width), \
})
+#define CPG_SSEL1 (0x304)
#define CPG_CDDIV0 (0x400)
#define CPG_CDDIV1 (0x404)
#define CPG_CDDIV3 (0x40C)
#define CPG_CDDIV4 (0x410)
+#define CPG_CSDIV0 (0x500)
#define CDDIV0_DIVCTL1 DDIV_PACK(CPG_CDDIV0, 4, 3, 1)
#define CDDIV0_DIVCTL2 DDIV_PACK(CPG_CDDIV0, 8, 3, 2)
@@ -111,6 +113,11 @@ struct smuxed {
#define CDDIV4_DIVCTL1 DDIV_PACK(CPG_CDDIV4, 4, 1, 17)
#define CDDIV4_DIVCTL2 DDIV_PACK(CPG_CDDIV4, 8, 1, 18)
+#define CSDIV0_DIVCTL3 DDIV_PACK_NO_RMW(CPG_CSDIV0, 12, 2, CSDIV_NO_MON)
+
+#define SSEL1_SELCTL2 SMUX_PACK(CPG_SSEL1, 8, 1)
+#define SSEL1_SELCTL3 SMUX_PACK(CPG_SSEL1, 12, 1)
+
#define BUS_MSTOP_IDX_MASK GENMASK(31, 16)
#define BUS_MSTOP_BITS_MASK GENMASK(15, 0)
#define BUS_MSTOP(idx, mask) (FIELD_PREP_CONST(BUS_MSTOP_IDX_MASK, (idx)) | \
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 04/22] clk: renesas: r9a09g047: Add XSPI clock/reset
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (2 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 03/22] clk: renesas: r9a09g047: Add support for xspi mux and divider Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 05/22] clk: renesas: rzv2h: Skip monitor checks for external clocks Biju Das
` (19 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 28548f3f7994dd214ad4f4ba5763cd06333404a upstream.
Add XSPI clock and reset entries.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250424081400.135028-4-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/r9a09g047-cpg.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c
index be387548664a..21699999cedd 100644
--- a/drivers/clk/renesas/r9a09g047-cpg.c
+++ b/drivers/clk/renesas/r9a09g047-cpg.c
@@ -35,6 +35,7 @@ enum clk_ids {
CLK_PLLCM33_DIV4,
CLK_PLLCM33_DIV5,
CLK_PLLCM33_DIV16,
+ CLK_PLLCM33_GEAR,
CLK_SMUX2_XSPI_CLK0,
CLK_SMUX2_XSPI_CLK1,
CLK_PLLCM33_XSPI,
@@ -107,6 +108,8 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
DEF_FIXED(".pllcm33_div5", CLK_PLLCM33_DIV5, CLK_PLLCM33, 1, 5),
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
+ DEF_DDIV(".pllcm33_gear", CLK_PLLCM33_GEAR, CLK_PLLCM33_DIV4, CDDIV0_DIVCTL1, dtable_2_64),
+
DEF_SMUX(".smux2_xspi_clk0", CLK_SMUX2_XSPI_CLK0, SSEL1_SELCTL2, smux2_xspi_clk0),
DEF_SMUX(".smux2_xspi_clk1", CLK_SMUX2_XSPI_CLK1, SSEL1_SELCTL3, smux2_xspi_clk1),
DEF_CSDIV(".pllcm33_xspi", CLK_PLLCM33_XSPI, CLK_SMUX2_XSPI_CLK1, CSDIV0_DIVCTL3,
@@ -135,6 +138,7 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
DEF_DDIV("ca55_0_coreclk3", R9A09G047_CA55_0_CORECLK3, CLK_PLLCA55,
CDDIV1_DIVCTL3, dtable_1_8),
DEF_FIXED("iotop_0_shclk", R9A09G047_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1),
+ DEF_FIXED("spi_clk_spi", R9A09G047_SPI_CLK_SPI, CLK_PLLCM33_XSPI, 1, 2),
};
static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
@@ -180,6 +184,12 @@ static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
BUS_MSTOP(10, BIT(14))),
DEF_MOD("canfd_0_clkc", CLK_PLLCLN_DIV20, 9, 14, 4, 30,
BUS_MSTOP(10, BIT(14))),
+ DEF_MOD("spi_hclk", CLK_PLLCM33_GEAR, 9, 15, 4, 31,
+ BUS_MSTOP(4, BIT(5))),
+ DEF_MOD("spi_aclk", CLK_PLLCM33_GEAR, 10, 0, 5, 0,
+ BUS_MSTOP(4, BIT(5))),
+ DEF_MOD_NO_PM("spi_clk_spix2", CLK_PLLCM33_XSPI, 10, 1, 5, 2,
+ BUS_MSTOP(4, BIT(5))),
DEF_MOD("sdhi_0_imclk", CLK_PLLCLN_DIV8, 10, 3, 5, 3,
BUS_MSTOP(8, BIT(2))),
DEF_MOD("sdhi_0_imclk2", CLK_PLLCLN_DIV8, 10, 4, 5, 4,
@@ -240,6 +250,8 @@ static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
DEF_RST(10, 0, 4, 17), /* RIIC_8_MRST */
DEF_RST(10, 1, 4, 18), /* CANFD_0_RSTP_N */
DEF_RST(10, 2, 4, 19), /* CANFD_0_RSTC_N */
+ DEF_RST(10, 3, 4, 20), /* SPI_HRESETN */
+ DEF_RST(10, 4, 4, 21), /* SPI_ARESETN */
DEF_RST(10, 7, 4, 24), /* SDHI_0_IXRST */
DEF_RST(10, 8, 4, 25), /* SDHI_1_IXRST */
DEF_RST(10, 9, 4, 26), /* SDHI_2_IXRST */
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 05/22] clk: renesas: rzv2h: Skip monitor checks for external clocks
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (3 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 04/22] clk: renesas: r9a09g047: Add XSPI clock/reset Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 06/22] clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv clocks Biju Das
` (18 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 899e7ede4c19c6778873ddeca312509fa5778f2c upstream.
For module clocks whose parent mux may select an external source, bypass
the normal monitor (CLK_MON) register check when the external clock is
active. Introduce a new `ext_clk_mux_index` in `struct rzv2h_mod_clk` and
`struct mod_clock`, and detect the current mux index in
`rzv2h_mod_clock_is_enabled()` to disable monitoring if it matches the
external source index.
Provide the `DEF_MOD_MUX_EXTERNAL()` macro for declaring external-source
module clocks, and populate the `ext_clk_mux_index` field in
`rzv2h_cpg_register_mod_clk()`.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250509160121.331073-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/rzv2h-cpg.c | 30 ++++++++++++++++++++++++++++--
drivers/clk/renesas/rzv2h-cpg.h | 17 +++++++++++++----
2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c
index a3d680ab89b6..ac6b025911c5 100644
--- a/drivers/clk/renesas/rzv2h-cpg.c
+++ b/drivers/clk/renesas/rzv2h-cpg.c
@@ -119,6 +119,7 @@ struct pll_clk {
* @on_bit: ON/MON bit
* @mon_index: monitor register offset
* @mon_bit: monitor bit
+ * @ext_clk_mux_index: mux index for external clock source, or -1 if internal
*/
struct mod_clock {
struct rzv2h_cpg_priv *priv;
@@ -129,6 +130,7 @@ struct mod_clock {
u8 on_bit;
s8 mon_index;
u8 mon_bit;
+ s8 ext_clk_mux_index;
};
#define to_mod_clock(_hw) container_of(_hw, struct mod_clock, hw)
@@ -563,15 +565,38 @@ static void rzv2h_mod_clock_mstop_disable(struct rzv2h_cpg_priv *priv,
spin_unlock_irqrestore(&priv->rmw_lock, flags);
}
+static int rzv2h_parent_clk_mux_to_index(struct clk_hw *hw)
+{
+ struct clk_hw *parent_hw;
+ struct clk *parent_clk;
+ struct clk_mux *mux;
+ u32 val;
+
+ /* This will always succeed, so no need to check for IS_ERR() */
+ parent_clk = clk_get_parent(hw->clk);
+
+ parent_hw = __clk_get_hw(parent_clk);
+ mux = to_clk_mux(parent_hw);
+
+ val = readl(mux->reg) >> mux->shift;
+ val &= mux->mask;
+ return clk_mux_val_to_index(parent_hw, mux->table, 0, val);
+}
+
static int rzv2h_mod_clock_is_enabled(struct clk_hw *hw)
{
struct mod_clock *clock = to_mod_clock(hw);
struct rzv2h_cpg_priv *priv = clock->priv;
+ int mon_index = clock->mon_index;
u32 bitmask;
u32 offset;
- if (clock->mon_index >= 0) {
- offset = GET_CLK_MON_OFFSET(clock->mon_index);
+ if (clock->ext_clk_mux_index >= 0 &&
+ rzv2h_parent_clk_mux_to_index(hw) == clock->ext_clk_mux_index)
+ mon_index = -1;
+
+ if (mon_index >= 0) {
+ offset = GET_CLK_MON_OFFSET(mon_index);
bitmask = BIT(clock->mon_bit);
if (!(readl(priv->base + offset) & bitmask))
@@ -687,6 +712,7 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod,
clock->mon_index = mod->mon_index;
clock->mon_bit = mod->mon_bit;
clock->no_pm = mod->no_pm;
+ clock->ext_clk_mux_index = mod->ext_clk_mux_index;
clock->priv = priv;
clock->hw.init = &init;
clock->mstop_data = mod->mstop_data;
diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h
index 27d160c74232..540f2f3d8a01 100644
--- a/drivers/clk/renesas/rzv2h-cpg.h
+++ b/drivers/clk/renesas/rzv2h-cpg.h
@@ -199,6 +199,7 @@ enum clk_types {
* @on_bit: ON bit
* @mon_index: monitor register index
* @mon_bit: monitor bit
+ * @ext_clk_mux_index: mux index for external clock source, or -1 if internal
*/
struct rzv2h_mod_clk {
const char *name;
@@ -210,9 +211,11 @@ struct rzv2h_mod_clk {
u8 on_bit;
s8 mon_index;
u8 mon_bit;
+ s8 ext_clk_mux_index;
};
-#define DEF_MOD_BASE(_name, _mstop, _parent, _critical, _no_pm, _onindex, _onbit, _monindex, _monbit) \
+#define DEF_MOD_BASE(_name, _mstop, _parent, _critical, _no_pm, _onindex, \
+ _onbit, _monindex, _monbit, _ext_clk_mux_index) \
{ \
.name = (_name), \
.mstop_data = (_mstop), \
@@ -223,16 +226,22 @@ struct rzv2h_mod_clk {
.on_bit = (_onbit), \
.mon_index = (_monindex), \
.mon_bit = (_monbit), \
+ .ext_clk_mux_index = (_ext_clk_mux_index), \
}
#define DEF_MOD(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop) \
- DEF_MOD_BASE(_name, _mstop, _parent, false, false, _onindex, _onbit, _monindex, _monbit)
+ DEF_MOD_BASE(_name, _mstop, _parent, false, false, _onindex, _onbit, _monindex, _monbit, -1)
#define DEF_MOD_CRITICAL(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop) \
- DEF_MOD_BASE(_name, _mstop, _parent, true, false, _onindex, _onbit, _monindex, _monbit)
+ DEF_MOD_BASE(_name, _mstop, _parent, true, false, _onindex, _onbit, _monindex, _monbit, -1)
#define DEF_MOD_NO_PM(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop) \
- DEF_MOD_BASE(_name, _mstop, _parent, false, true, _onindex, _onbit, _monindex, _monbit)
+ DEF_MOD_BASE(_name, _mstop, _parent, false, true, _onindex, _onbit, _monindex, _monbit, -1)
+
+#define DEF_MOD_MUX_EXTERNAL(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop, \
+ _ext_clk_mux_index) \
+ DEF_MOD_BASE(_name, _mstop, _parent, false, false, _onindex, _onbit, _monindex, _monbit, \
+ _ext_clk_mux_index)
/**
* struct rzv2h_reset - Reset definitions
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 06/22] clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv clocks
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (4 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 05/22] clk: renesas: rzv2h: Skip monitor checks for external clocks Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 07/22] clk: renesas: rzv2h: Add missing include file Biju Das
` (17 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 715676d8418062f54d746451294ccce9786c1734 upstream.
Commit bc4d25fdfadf ("clk: renesas: rzv2h: Add support for dynamic
switching divider clocks") missed setting the `CLK_SET_RATE_PARENT`
flag when registering ddiv clocks.
Without this flag, rate changes to the divider clock do not propagate
to its parent, potentially resulting in incorrect clock configurations.
Fix this by setting `CLK_SET_RATE_PARENT` in the clock init data.
Fixes: bc4d25fdfadfa ("clk: renesas: rzv2h: Add support for dynamic switching divider clocks")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250609140341.235919-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/rzv2h-cpg.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c
index ac6b025911c5..482e8e40d46c 100644
--- a/drivers/clk/renesas/rzv2h-cpg.c
+++ b/drivers/clk/renesas/rzv2h-cpg.c
@@ -383,6 +383,7 @@ rzv2h_cpg_ddiv_clk_register(const struct cpg_core_clk *core,
init.ops = &rzv2h_ddiv_clk_divider_ops;
init.parent_names = &parent_name;
init.num_parents = 1;
+ init.flags = CLK_SET_RATE_PARENT;
ddiv->priv = priv;
ddiv->mon = cfg_ddiv.monbit;
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 07/22] clk: renesas: rzv2h: Add missing include file
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (5 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 06/22] clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv clocks Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 08/22] clk: renesas: rzv2h: Drop redundant base pointer from pll_clk Biju Das
` (16 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
commit b7c26cbd5b704a350b3176669f47047153903bc9 upstream.
File `rzv2h-cpg.h' makes use of data types defined in `linux/types.h',
but it does not include the latter, which could lead to build errors.
Include `linux/types.h' to fix this problem.
Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250624192748.340196-1-fabrizio.castro.jz@renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/rzv2h-cpg.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h
index 540f2f3d8a01..bf543e13eb1a 100644
--- a/drivers/clk/renesas/rzv2h-cpg.h
+++ b/drivers/clk/renesas/rzv2h-cpg.h
@@ -9,6 +9,7 @@
#define __RENESAS_RZV2H_CPG_H__
#include <linux/bitfield.h>
+#include <linux/types.h>
/**
* struct pll - Structure for PLL configuration
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 08/22] clk: renesas: rzv2h: Drop redundant base pointer from pll_clk
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (6 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 07/22] clk: renesas: rzv2h: Add missing include file Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 09/22] clk: renesas: rzv2h: Add fixed-factor module clocks with status reporting Biju Das
` (15 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 8250a8a9b10f459a40460104e6d6064c98283d1e upstream.
The base address can be accessed via the priv pointer already present in
struct pll_clk, making the separate base field redundant. Remove the base
member and its assignment.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250624153049.462535-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/rzv2h-cpg.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c
index 482e8e40d46c..29a345430157 100644
--- a/drivers/clk/renesas/rzv2h-cpg.c
+++ b/drivers/clk/renesas/rzv2h-cpg.c
@@ -101,7 +101,6 @@ struct rzv2h_cpg_priv {
struct pll_clk {
struct rzv2h_cpg_priv *priv;
- void __iomem *base;
struct clk_hw hw;
struct pll pll;
};
@@ -230,7 +229,6 @@ rzv2h_cpg_pll_clk_register(const struct cpg_core_clk *core,
struct rzv2h_cpg_priv *priv,
const struct clk_ops *ops)
{
- void __iomem *base = priv->base;
struct device *dev = priv->dev;
struct clk_init_data init;
const struct clk *parent;
@@ -255,7 +253,6 @@ rzv2h_cpg_pll_clk_register(const struct cpg_core_clk *core,
pll_clk->hw.init = &init;
pll_clk->pll = core->cfg.pll;
- pll_clk->base = base;
pll_clk->priv = priv;
ret = devm_clk_hw_register(dev, &pll_clk->hw);
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 09/22] clk: renesas: rzv2h: Add fixed-factor module clocks with status reporting
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (7 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 08/22] clk: renesas: rzv2h: Drop redundant base pointer from pll_clk Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 10/22] memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error Biju Das
` (14 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 87239caea4dfbe69b34ddb6dd35fc58f2d395257 upstream.
Add support for fixed-factor module clocks that can report their enable
status through the module status monitor. Introduce a new clock type,
CLK_TYPE_FF_MOD_STATUS, and define the associated structure,
rzv2h_ff_mod_status_clk, to manage these clocks.
Implement the .is_enabled callback by reading the module status register
using monitor index and bit definitions. Provide a helper macro,
DEF_FIXED_MOD_STATUS, to simplify the definition of such clocks.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250627204237.214635-5-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/clk/renesas/rzv2h-cpg.c | 92 +++++++++++++++++++++++++++++++++
drivers/clk/renesas/rzv2h-cpg.h | 22 ++++++++
2 files changed, 114 insertions(+)
diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c
index 29a345430157..bc4bf816b571 100644
--- a/drivers/clk/renesas/rzv2h-cpg.c
+++ b/drivers/clk/renesas/rzv2h-cpg.c
@@ -77,6 +77,7 @@
* @resets: Array of resets
* @num_resets: Number of Module Resets in info->resets[]
* @last_dt_core_clk: ID of the last Core Clock exported to DT
+ * @ff_mod_status_ops: Fixed Factor Module Status Clock operations
* @mstop_count: Array of mstop values
* @rcdev: Reset controller entity
*/
@@ -92,6 +93,8 @@ struct rzv2h_cpg_priv {
unsigned int num_resets;
unsigned int last_dt_core_clk;
+ struct clk_ops *ff_mod_status_ops;
+
atomic_t *mstop_count;
struct reset_controller_dev rcdev;
@@ -149,6 +152,22 @@ struct ddiv_clk {
#define to_ddiv_clock(_div) container_of(_div, struct ddiv_clk, div)
+/**
+ * struct rzv2h_ff_mod_status_clk - Fixed Factor Module Status Clock
+ *
+ * @priv: CPG private data
+ * @conf: fixed mod configuration
+ * @fix: fixed factor clock
+ */
+struct rzv2h_ff_mod_status_clk {
+ struct rzv2h_cpg_priv *priv;
+ struct fixed_mod_conf conf;
+ struct clk_fixed_factor fix;
+};
+
+#define to_rzv2h_ff_mod_status_clk(_hw) \
+ container_of(_hw, struct rzv2h_ff_mod_status_clk, fix.hw)
+
static int rzv2h_cpg_pll_clk_is_enabled(struct clk_hw *hw)
{
struct pll_clk *pll_clk = to_pll(hw);
@@ -418,6 +437,65 @@ rzv2h_cpg_mux_clk_register(const struct cpg_core_clk *core,
return clk_hw->clk;
}
+static int
+rzv2h_clk_ff_mod_status_is_enabled(struct clk_hw *hw)
+{
+ struct rzv2h_ff_mod_status_clk *fix = to_rzv2h_ff_mod_status_clk(hw);
+ struct rzv2h_cpg_priv *priv = fix->priv;
+ u32 offset = GET_CLK_MON_OFFSET(fix->conf.mon_index);
+ u32 bitmask = BIT(fix->conf.mon_bit);
+ u32 val;
+
+ val = readl(priv->base + offset);
+ return !!(val & bitmask);
+}
+
+static struct clk * __init
+rzv2h_cpg_fixed_mod_status_clk_register(const struct cpg_core_clk *core,
+ struct rzv2h_cpg_priv *priv)
+{
+ struct rzv2h_ff_mod_status_clk *clk_hw_data;
+ struct clk_init_data init = { };
+ struct clk_fixed_factor *fix;
+ const struct clk *parent;
+ const char *parent_name;
+ int ret;
+
+ WARN_DEBUG(core->parent >= priv->num_core_clks);
+ parent = priv->clks[core->parent];
+ if (IS_ERR(parent))
+ return ERR_CAST(parent);
+
+ parent_name = __clk_get_name(parent);
+ parent = priv->clks[core->parent];
+ if (IS_ERR(parent))
+ return ERR_CAST(parent);
+
+ clk_hw_data = devm_kzalloc(priv->dev, sizeof(*clk_hw_data), GFP_KERNEL);
+ if (!clk_hw_data)
+ return ERR_PTR(-ENOMEM);
+
+ clk_hw_data->priv = priv;
+ clk_hw_data->conf = core->cfg.fixed_mod;
+
+ init.name = core->name;
+ init.ops = priv->ff_mod_status_ops;
+ init.flags = CLK_SET_RATE_PARENT;
+ init.parent_names = &parent_name;
+ init.num_parents = 1;
+
+ fix = &clk_hw_data->fix;
+ fix->hw.init = &init;
+ fix->mult = core->mult;
+ fix->div = core->div;
+
+ ret = devm_clk_hw_register(priv->dev, &clk_hw_data->fix.hw);
+ if (ret)
+ return ERR_PTR(ret);
+
+ return clk_hw_data->fix.hw.clk;
+}
+
static struct clk
*rzv2h_cpg_clk_src_twocell_get(struct of_phandle_args *clkspec,
void *data)
@@ -496,6 +574,20 @@ rzv2h_cpg_register_core_clk(const struct cpg_core_clk *core,
else
clk = clk_hw->clk;
break;
+ case CLK_TYPE_FF_MOD_STATUS:
+ if (!priv->ff_mod_status_ops) {
+ priv->ff_mod_status_ops =
+ devm_kzalloc(dev, sizeof(*priv->ff_mod_status_ops), GFP_KERNEL);
+ if (!priv->ff_mod_status_ops) {
+ clk = ERR_PTR(-ENOMEM);
+ goto fail;
+ }
+ memcpy(priv->ff_mod_status_ops, &clk_fixed_factor_ops,
+ sizeof(const struct clk_ops));
+ priv->ff_mod_status_ops->is_enabled = rzv2h_clk_ff_mod_status_is_enabled;
+ }
+ clk = rzv2h_cpg_fixed_mod_status_clk_register(core, priv);
+ break;
case CLK_TYPE_PLL:
clk = rzv2h_cpg_pll_clk_register(core, priv, &rzv2h_cpg_pll_ops);
break;
diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h
index bf543e13eb1a..543e44904bba 100644
--- a/drivers/clk/renesas/rzv2h-cpg.h
+++ b/drivers/clk/renesas/rzv2h-cpg.h
@@ -94,6 +94,23 @@ struct smuxed {
.width = (_width), \
})
+/**
+ * struct fixed_mod_conf - Structure for fixed module configuration
+ *
+ * @mon_index: monitor index
+ * @mon_bit: monitor bit
+ */
+struct fixed_mod_conf {
+ u8 mon_index;
+ u8 mon_bit;
+};
+
+#define FIXED_MOD_CONF_PACK(_index, _bit) \
+ ((struct fixed_mod_conf){ \
+ .mon_index = (_index), \
+ .mon_bit = (_bit), \
+ })
+
#define CPG_SSEL1 (0x304)
#define CPG_CDDIV0 (0x400)
#define CPG_CDDIV1 (0x404)
@@ -145,6 +162,7 @@ struct cpg_core_clk {
struct ddiv ddiv;
struct pll pll;
struct smuxed smux;
+ struct fixed_mod_conf fixed_mod;
} cfg;
const struct clk_div_table *dtable;
const char * const *parent_names;
@@ -157,6 +175,7 @@ enum clk_types {
/* Generic */
CLK_TYPE_IN, /* External Clock Input */
CLK_TYPE_FF, /* Fixed Factor Clock */
+ CLK_TYPE_FF_MOD_STATUS, /* Fixed Factor Clock which can report the status of module clock */
CLK_TYPE_PLL,
CLK_TYPE_DDIV, /* Dynamic Switching Divider */
CLK_TYPE_SMUX, /* Static Mux */
@@ -172,6 +191,9 @@ enum clk_types {
DEF_TYPE(_name, _id, CLK_TYPE_IN)
#define DEF_FIXED(_name, _id, _parent, _mult, _div) \
DEF_BASE(_name, _id, CLK_TYPE_FF, _parent, .div = _div, .mult = _mult)
+#define DEF_FIXED_MOD_STATUS(_name, _id, _parent, _mult, _div, _gate) \
+ DEF_BASE(_name, _id, CLK_TYPE_FF_MOD_STATUS, _parent, .div = _div, \
+ .mult = _mult, .cfg.fixed_mod = _gate)
#define DEF_DDIV(_name, _id, _parent, _ddiv_packed, _dtable) \
DEF_TYPE(_name, _id, CLK_TYPE_DDIV, \
.cfg.ddiv = _ddiv_packed, \
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 10/22] memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (8 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 09/22] clk: renesas: rzv2h: Add fixed-factor module clocks with status reporting Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 11/22] memory: renesas-rpc-if: Move rpcif_info definitions near to the user Biju Das
` (13 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit bf657e234ac12923b579b13d8b9f1b5ca0519697 upstream.
Fix the below macro error found while moving the reg definitions
to renesas-rpc-if-regs.h in the later patch.
ERROR: Macros with complex values should be enclosed in parentheses
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250401143537.224047-3-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 23f7f3a08886..200b8a5c2bef 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -57,7 +57,7 @@
#define RPCIF_DROPR 0x0018 /* R/W */
#define RPCIF_DRENR 0x001C /* R/W */
-#define RPCIF_DRENR_CDB(o) (u32)((((o) & 0x3) << 30))
+#define RPCIF_DRENR_CDB(o) (((u32)((o) & 0x3)) << 30)
#define RPCIF_DRENR_OCDB(o) (((o) & 0x3) << 28)
#define RPCIF_DRENR_ADB(o) (((o) & 0x3) << 24)
#define RPCIF_DRENR_OPDB(o) (((o) & 0x3) << 20)
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 11/22] memory: renesas-rpc-if: Move rpcif_info definitions near to the user
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (9 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 10/22] memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 12/22] dt-bindings: memory: Document RZ/G3E support Biju Das
` (12 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 74c35c84f2ba942e7a7744658a8257d0b3188ac2 upstream.
Move rpcif_info definitions near to the user.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250401143537.224047-6-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 200b8a5c2bef..771a18b7ff30 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -191,16 +191,6 @@ struct rpcif_priv {
u32 ddr; /* DRDRENR or SMDRENR */
};
-static const struct rpcif_info rpcif_info_gen3 = {
- .type = RPCIF_RCAR_GEN3,
- .strtim = 7,
-};
-
-static const struct rpcif_info rpcif_info_rz_g2l = {
- .type = RPCIF_RZ_G2L,
- .strtim = 7,
-};
-
/*
* Custom accessor functions to ensure SM[RW]DR[01] are always accessed with
* proper width. Requires rpcif_priv.xfer_size to be correctly set before!
@@ -776,6 +766,16 @@ static int rpcif_remove(struct platform_device *pdev)
return 0;
}
+static const struct rpcif_info rpcif_info_gen3 = {
+ .type = RPCIF_RCAR_GEN3,
+ .strtim = 7,
+};
+
+static const struct rpcif_info rpcif_info_rz_g2l = {
+ .type = RPCIF_RZ_G2L,
+ .strtim = 7,
+};
+
static const struct of_device_id rpcif_of_match[] = {
{ .compatible = "renesas,rcar-gen3-rpc-if", .data = &rpcif_info_gen3 },
{ .compatible = "renesas,rzg2l-rpc-if", .data = &rpcif_info_rz_g2l },
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 12/22] dt-bindings: memory: Document RZ/G3E support
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (10 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 11/22] memory: renesas-rpc-if: Move rpcif_info definitions near to the user Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 13/22] memory: renesas-rpc-if: Move rpc-if reg definitions Biju Das
` (11 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit b2d25905366b4e6791f60e6bc76a636d1b88e6f8 upstream.
Document support for the Expanded Serial Peripheral Interface (xSPI)
Controller in the Renesas RZ/G3E (R9A09G047) SoC.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-2-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../renesas,rzg3e-xspi.yaml | 135 ++++++++++++++++++
1 file changed, 135 insertions(+)
create mode 100644 Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.yaml
diff --git a/Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.yaml b/Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.yaml
new file mode 100644
index 000000000000..2bfe63ec62dc
--- /dev/null
+++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.yaml
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/renesas,rzg3e-xspi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas Expanded Serial Peripheral Interface (xSPI)
+
+maintainers:
+ - Biju Das <biju.das.jz@bp.renesas.com>
+
+description: |
+ Renesas xSPI allows a SPI flash connected to the SoC to be accessed via
+ the memory-mapping or the manual command mode.
+
+ The flash chip itself should be represented by a subnode of the XSPI node.
+ The flash interface is selected based on the "compatible" property of this
+ subnode:
+ - "jedec,spi-nor";
+
+allOf:
+ - $ref: /schemas/spi/spi-controller.yaml#
+
+properties:
+ compatible:
+ const: renesas,r9a09g047-xspi # RZ/G3E
+
+ reg:
+ items:
+ - description: xSPI registers
+ - description: direct mapping area
+
+ reg-names:
+ items:
+ - const: regs
+ - const: dirmap
+
+ interrupts:
+ items:
+ - description: Interrupt pulse signal by factors excluding errors
+ - description: Interrupt pulse signal by error factors
+
+ interrupt-names:
+ items:
+ - const: pulse
+ - const: err_pulse
+
+ clocks:
+ items:
+ - description: AHB clock
+ - description: AXI clock
+ - description: SPI clock
+ - description: Double speed SPI clock
+
+ clock-names:
+ items:
+ - const: ahb
+ - const: axi
+ - const: spi
+ - const: spix2
+
+ power-domains:
+ maxItems: 1
+
+ resets:
+ items:
+ - description: Hardware reset
+ - description: AXI reset
+
+ reset-names:
+ items:
+ - const: hresetn
+ - const: aresetn
+
+ renesas,xspi-cs-addr-sys:
+ $ref: /schemas/types.yaml#/definitions/phandle
+ description: |
+ Phandle to the system controller (sys) that allows to configure
+ xSPI CS0 and CS1 addresses.
+
+patternProperties:
+ "flash@[0-9a-f]+$":
+ type: object
+ additionalProperties: true
+
+ properties:
+ compatible:
+ contains:
+ const: jedec,spi-nor
+
+required:
+ - compatible
+ - reg
+ - reg-names
+ - interrupts
+ - interrupt-names
+ - clocks
+ - clock-names
+ - power-domains
+ - resets
+ - reset-names
+ - '#address-cells'
+ - '#size-cells'
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/renesas,r9a09g047-cpg.h>
+
+ spi@11030000 {
+ compatible = "renesas,r9a09g047-xspi";
+ reg = <0x11030000 0x10000>, <0x20000000 0x10000000>;
+ reg-names = "regs", "dirmap";
+ interrupts = <GIC_SPI 228 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 229 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "pulse", "err_pulse";
+ clocks = <&cpg CPG_MOD 0x9f>, <&cpg CPG_MOD 0xa0>,
+ <&cpg CPG_CORE 9>, <&cpg CPG_MOD 0xa1>;
+ clock-names = "ahb", "axi", "spi", "spix2";
+ power-domains = <&cpg>;
+ resets = <&cpg 0xa3>, <&cpg 0xa4>;
+ reset-names = "hresetn", "aresetn";
+ #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>;
+ };
+ };
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 13/22] memory: renesas-rpc-if: Move rpc-if reg definitions
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (11 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 12/22] dt-bindings: memory: Document RZ/G3E support Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 14/22] memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive() Biju Das
` (10 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 228e72bf943687d04bf06a98722ab6cf9d4b8ba6 upstream.
Move rpc-if reg definitions to a header file for the preparation of adding
support for RZ/G3E XSPI that has different register definitions.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-3-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if-regs.h | 146 +++++++++++++++++++++++++++
drivers/memory/renesas-rpc-if.c | 133 +-----------------------
2 files changed, 147 insertions(+), 132 deletions(-)
create mode 100644 drivers/memory/renesas-rpc-if-regs.h
diff --git a/drivers/memory/renesas-rpc-if-regs.h b/drivers/memory/renesas-rpc-if-regs.h
new file mode 100644
index 000000000000..75ae2b3fa856
--- /dev/null
+++ b/drivers/memory/renesas-rpc-if-regs.h
@@ -0,0 +1,146 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * R-Car RPC Interface Registers Definitions
+ *
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#ifndef __RENESAS_RPC_IF_REGS_H__
+#define __RENESAS_RPC_IF_REGS_H__
+
+#include <linux/bits.h>
+
+#define RPCIF_CMNCR 0x0000 /* R/W */
+#define RPCIF_CMNCR_MD BIT(31)
+#define RPCIF_CMNCR_MOIIO3(val) (((val) & 0x3) << 22)
+#define RPCIF_CMNCR_MOIIO2(val) (((val) & 0x3) << 20)
+#define RPCIF_CMNCR_MOIIO1(val) (((val) & 0x3) << 18)
+#define RPCIF_CMNCR_MOIIO0(val) (((val) & 0x3) << 16)
+#define RPCIF_CMNCR_MOIIO(val) (RPCIF_CMNCR_MOIIO0(val) | RPCIF_CMNCR_MOIIO1(val) | \
+ RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))
+#define RPCIF_CMNCR_IO3FV(val) (((val) & 0x3) << 14) /* documented for RZ/G2L */
+#define RPCIF_CMNCR_IO2FV(val) (((val) & 0x3) << 12) /* documented for RZ/G2L */
+#define RPCIF_CMNCR_IO0FV(val) (((val) & 0x3) << 8)
+#define RPCIF_CMNCR_IOFV(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
+ RPCIF_CMNCR_IO3FV(val))
+#define RPCIF_CMNCR_BSZ(val) (((val) & 0x3) << 0)
+
+#define RPCIF_SSLDR 0x0004 /* R/W */
+#define RPCIF_SSLDR_SPNDL(d) (((d) & 0x7) << 16)
+#define RPCIF_SSLDR_SLNDL(d) (((d) & 0x7) << 8)
+#define RPCIF_SSLDR_SCKDL(d) (((d) & 0x7) << 0)
+
+#define RPCIF_DRCR 0x000C /* R/W */
+#define RPCIF_DRCR_SSLN BIT(24)
+#define RPCIF_DRCR_RBURST(v) ((((v) - 1) & 0x1F) << 16)
+#define RPCIF_DRCR_RCF BIT(9)
+#define RPCIF_DRCR_RBE BIT(8)
+#define RPCIF_DRCR_SSLE BIT(0)
+
+#define RPCIF_DRCMR 0x0010 /* R/W */
+#define RPCIF_DRCMR_CMD(c) (((c) & 0xFF) << 16)
+#define RPCIF_DRCMR_OCMD(c) (((c) & 0xFF) << 0)
+
+#define RPCIF_DREAR 0x0014 /* R/W */
+#define RPCIF_DREAR_EAV(c) (((c) & 0xF) << 16)
+#define RPCIF_DREAR_EAC(c) (((c) & 0x7) << 0)
+
+#define RPCIF_DROPR 0x0018 /* R/W */
+
+#define RPCIF_DRENR 0x001C /* R/W */
+#define RPCIF_DRENR_CDB(o) (((u32)((o) & 0x3)) << 30)
+#define RPCIF_DRENR_OCDB(o) (((o) & 0x3) << 28)
+#define RPCIF_DRENR_ADB(o) (((o) & 0x3) << 24)
+#define RPCIF_DRENR_OPDB(o) (((o) & 0x3) << 20)
+#define RPCIF_DRENR_DRDB(o) (((o) & 0x3) << 16)
+#define RPCIF_DRENR_DME BIT(15)
+#define RPCIF_DRENR_CDE BIT(14)
+#define RPCIF_DRENR_OCDE BIT(12)
+#define RPCIF_DRENR_ADE(v) (((v) & 0xF) << 8)
+#define RPCIF_DRENR_OPDE(v) (((v) & 0xF) << 4)
+
+#define RPCIF_SMCR 0x0020 /* R/W */
+#define RPCIF_SMCR_SSLKP BIT(8)
+#define RPCIF_SMCR_SPIRE BIT(2)
+#define RPCIF_SMCR_SPIWE BIT(1)
+#define RPCIF_SMCR_SPIE BIT(0)
+
+#define RPCIF_SMCMR 0x0024 /* R/W */
+#define RPCIF_SMCMR_CMD(c) (((c) & 0xFF) << 16)
+#define RPCIF_SMCMR_OCMD(c) (((c) & 0xFF) << 0)
+
+#define RPCIF_SMADR 0x0028 /* R/W */
+
+#define RPCIF_SMOPR 0x002C /* R/W */
+#define RPCIF_SMOPR_OPD3(o) (((o) & 0xFF) << 24)
+#define RPCIF_SMOPR_OPD2(o) (((o) & 0xFF) << 16)
+#define RPCIF_SMOPR_OPD1(o) (((o) & 0xFF) << 8)
+#define RPCIF_SMOPR_OPD0(o) (((o) & 0xFF) << 0)
+
+#define RPCIF_SMENR 0x0030 /* R/W */
+#define RPCIF_SMENR_CDB(o) (((o) & 0x3) << 30)
+#define RPCIF_SMENR_OCDB(o) (((o) & 0x3) << 28)
+#define RPCIF_SMENR_ADB(o) (((o) & 0x3) << 24)
+#define RPCIF_SMENR_OPDB(o) (((o) & 0x3) << 20)
+#define RPCIF_SMENR_SPIDB(o) (((o) & 0x3) << 16)
+#define RPCIF_SMENR_DME BIT(15)
+#define RPCIF_SMENR_CDE BIT(14)
+#define RPCIF_SMENR_OCDE BIT(12)
+#define RPCIF_SMENR_ADE(v) (((v) & 0xF) << 8)
+#define RPCIF_SMENR_OPDE(v) (((v) & 0xF) << 4)
+#define RPCIF_SMENR_SPIDE(v) (((v) & 0xF) << 0)
+
+#define RPCIF_SMRDR0 0x0038 /* R */
+#define RPCIF_SMRDR1 0x003C /* R */
+#define RPCIF_SMWDR0 0x0040 /* W */
+#define RPCIF_SMWDR1 0x0044 /* W */
+
+#define RPCIF_CMNSR 0x0048 /* R */
+#define RPCIF_CMNSR_SSLF BIT(1)
+#define RPCIF_CMNSR_TEND BIT(0)
+
+#define RPCIF_DRDMCR 0x0058 /* R/W */
+#define RPCIF_DMDMCR_DMCYC(v) ((((v) - 1) & 0x1F) << 0)
+
+#define RPCIF_DRDRENR 0x005C /* R/W */
+#define RPCIF_DRDRENR_HYPE(v) (((v) & 0x7) << 12)
+#define RPCIF_DRDRENR_ADDRE BIT(8)
+#define RPCIF_DRDRENR_OPDRE BIT(4)
+#define RPCIF_DRDRENR_DRDRE BIT(0)
+
+#define RPCIF_SMDMCR 0x0060 /* R/W */
+#define RPCIF_SMDMCR_DMCYC(v) ((((v) - 1) & 0x1F) << 0)
+
+#define RPCIF_SMDRENR 0x0064 /* R/W */
+#define RPCIF_SMDRENR_HYPE(v) (((v) & 0x7) << 12)
+#define RPCIF_SMDRENR_ADDRE BIT(8)
+#define RPCIF_SMDRENR_OPDRE BIT(4)
+#define RPCIF_SMDRENR_SPIDRE BIT(0)
+
+#define RPCIF_PHYADD 0x0070 /* R/W available on R-Car E3/D3/V3M and RZ/G2{E,L} */
+#define RPCIF_PHYWR 0x0074 /* R/W available on R-Car E3/D3/V3M and RZ/G2{E,L} */
+
+#define RPCIF_PHYCNT 0x007C /* R/W */
+#define RPCIF_PHYCNT_CAL BIT(31)
+#define RPCIF_PHYCNT_OCTA(v) (((v) & 0x3) << 22)
+#define RPCIF_PHYCNT_EXDS BIT(21)
+#define RPCIF_PHYCNT_OCT BIT(20)
+#define RPCIF_PHYCNT_DDRCAL BIT(19)
+#define RPCIF_PHYCNT_HS BIT(18)
+#define RPCIF_PHYCNT_CKSEL(v) (((v) & 0x3) << 16) /* valid only for RZ/G2L */
+#define RPCIF_PHYCNT_STRTIM(v) (((v) & 0x7) << 15) /* valid for R-Car and RZ/G2{E,H,M,N} */
+#define RPCIF_PHYCNT_WBUF2 BIT(4)
+#define RPCIF_PHYCNT_WBUF BIT(2)
+#define RPCIF_PHYCNT_PHYMEM(v) (((v) & 0x3) << 0)
+#define RPCIF_PHYCNT_PHYMEM_MASK GENMASK(1, 0)
+
+#define RPCIF_PHYOFFSET1 0x0080 /* R/W */
+#define RPCIF_PHYOFFSET1_DDRTMG(v) (((v) & 0x3) << 28)
+
+#define RPCIF_PHYOFFSET2 0x0084 /* R/W */
+#define RPCIF_PHYOFFSET2_OCTTMG(v) (((v) & 0x7) << 8)
+
+#define RPCIF_PHYINT 0x0088 /* R/W */
+#define RPCIF_PHYINT_WPVAL BIT(1)
+
+#endif /* __RENESAS_RPC_IF_REGS_H__ */
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 771a18b7ff30..000d2367eefc 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -19,138 +19,7 @@
#include <memory/renesas-rpc-if.h>
-#define RPCIF_CMNCR 0x0000 /* R/W */
-#define RPCIF_CMNCR_MD BIT(31)
-#define RPCIF_CMNCR_MOIIO3(val) (((val) & 0x3) << 22)
-#define RPCIF_CMNCR_MOIIO2(val) (((val) & 0x3) << 20)
-#define RPCIF_CMNCR_MOIIO1(val) (((val) & 0x3) << 18)
-#define RPCIF_CMNCR_MOIIO0(val) (((val) & 0x3) << 16)
-#define RPCIF_CMNCR_MOIIO(val) (RPCIF_CMNCR_MOIIO0(val) | RPCIF_CMNCR_MOIIO1(val) | \
- RPCIF_CMNCR_MOIIO2(val) | RPCIF_CMNCR_MOIIO3(val))
-#define RPCIF_CMNCR_IO3FV(val) (((val) & 0x3) << 14) /* documented for RZ/G2L */
-#define RPCIF_CMNCR_IO2FV(val) (((val) & 0x3) << 12) /* documented for RZ/G2L */
-#define RPCIF_CMNCR_IO0FV(val) (((val) & 0x3) << 8)
-#define RPCIF_CMNCR_IOFV(val) (RPCIF_CMNCR_IO0FV(val) | RPCIF_CMNCR_IO2FV(val) | \
- RPCIF_CMNCR_IO3FV(val))
-#define RPCIF_CMNCR_BSZ(val) (((val) & 0x3) << 0)
-
-#define RPCIF_SSLDR 0x0004 /* R/W */
-#define RPCIF_SSLDR_SPNDL(d) (((d) & 0x7) << 16)
-#define RPCIF_SSLDR_SLNDL(d) (((d) & 0x7) << 8)
-#define RPCIF_SSLDR_SCKDL(d) (((d) & 0x7) << 0)
-
-#define RPCIF_DRCR 0x000C /* R/W */
-#define RPCIF_DRCR_SSLN BIT(24)
-#define RPCIF_DRCR_RBURST(v) ((((v) - 1) & 0x1F) << 16)
-#define RPCIF_DRCR_RCF BIT(9)
-#define RPCIF_DRCR_RBE BIT(8)
-#define RPCIF_DRCR_SSLE BIT(0)
-
-#define RPCIF_DRCMR 0x0010 /* R/W */
-#define RPCIF_DRCMR_CMD(c) (((c) & 0xFF) << 16)
-#define RPCIF_DRCMR_OCMD(c) (((c) & 0xFF) << 0)
-
-#define RPCIF_DREAR 0x0014 /* R/W */
-#define RPCIF_DREAR_EAV(c) (((c) & 0xF) << 16)
-#define RPCIF_DREAR_EAC(c) (((c) & 0x7) << 0)
-
-#define RPCIF_DROPR 0x0018 /* R/W */
-
-#define RPCIF_DRENR 0x001C /* R/W */
-#define RPCIF_DRENR_CDB(o) (((u32)((o) & 0x3)) << 30)
-#define RPCIF_DRENR_OCDB(o) (((o) & 0x3) << 28)
-#define RPCIF_DRENR_ADB(o) (((o) & 0x3) << 24)
-#define RPCIF_DRENR_OPDB(o) (((o) & 0x3) << 20)
-#define RPCIF_DRENR_DRDB(o) (((o) & 0x3) << 16)
-#define RPCIF_DRENR_DME BIT(15)
-#define RPCIF_DRENR_CDE BIT(14)
-#define RPCIF_DRENR_OCDE BIT(12)
-#define RPCIF_DRENR_ADE(v) (((v) & 0xF) << 8)
-#define RPCIF_DRENR_OPDE(v) (((v) & 0xF) << 4)
-
-#define RPCIF_SMCR 0x0020 /* R/W */
-#define RPCIF_SMCR_SSLKP BIT(8)
-#define RPCIF_SMCR_SPIRE BIT(2)
-#define RPCIF_SMCR_SPIWE BIT(1)
-#define RPCIF_SMCR_SPIE BIT(0)
-
-#define RPCIF_SMCMR 0x0024 /* R/W */
-#define RPCIF_SMCMR_CMD(c) (((c) & 0xFF) << 16)
-#define RPCIF_SMCMR_OCMD(c) (((c) & 0xFF) << 0)
-
-#define RPCIF_SMADR 0x0028 /* R/W */
-
-#define RPCIF_SMOPR 0x002C /* R/W */
-#define RPCIF_SMOPR_OPD3(o) (((o) & 0xFF) << 24)
-#define RPCIF_SMOPR_OPD2(o) (((o) & 0xFF) << 16)
-#define RPCIF_SMOPR_OPD1(o) (((o) & 0xFF) << 8)
-#define RPCIF_SMOPR_OPD0(o) (((o) & 0xFF) << 0)
-
-#define RPCIF_SMENR 0x0030 /* R/W */
-#define RPCIF_SMENR_CDB(o) (((o) & 0x3) << 30)
-#define RPCIF_SMENR_OCDB(o) (((o) & 0x3) << 28)
-#define RPCIF_SMENR_ADB(o) (((o) & 0x3) << 24)
-#define RPCIF_SMENR_OPDB(o) (((o) & 0x3) << 20)
-#define RPCIF_SMENR_SPIDB(o) (((o) & 0x3) << 16)
-#define RPCIF_SMENR_DME BIT(15)
-#define RPCIF_SMENR_CDE BIT(14)
-#define RPCIF_SMENR_OCDE BIT(12)
-#define RPCIF_SMENR_ADE(v) (((v) & 0xF) << 8)
-#define RPCIF_SMENR_OPDE(v) (((v) & 0xF) << 4)
-#define RPCIF_SMENR_SPIDE(v) (((v) & 0xF) << 0)
-
-#define RPCIF_SMRDR0 0x0038 /* R */
-#define RPCIF_SMRDR1 0x003C /* R */
-#define RPCIF_SMWDR0 0x0040 /* W */
-#define RPCIF_SMWDR1 0x0044 /* W */
-
-#define RPCIF_CMNSR 0x0048 /* R */
-#define RPCIF_CMNSR_SSLF BIT(1)
-#define RPCIF_CMNSR_TEND BIT(0)
-
-#define RPCIF_DRDMCR 0x0058 /* R/W */
-#define RPCIF_DMDMCR_DMCYC(v) ((((v) - 1) & 0x1F) << 0)
-
-#define RPCIF_DRDRENR 0x005C /* R/W */
-#define RPCIF_DRDRENR_HYPE(v) (((v) & 0x7) << 12)
-#define RPCIF_DRDRENR_ADDRE BIT(8)
-#define RPCIF_DRDRENR_OPDRE BIT(4)
-#define RPCIF_DRDRENR_DRDRE BIT(0)
-
-#define RPCIF_SMDMCR 0x0060 /* R/W */
-#define RPCIF_SMDMCR_DMCYC(v) ((((v) - 1) & 0x1F) << 0)
-
-#define RPCIF_SMDRENR 0x0064 /* R/W */
-#define RPCIF_SMDRENR_HYPE(v) (((v) & 0x7) << 12)
-#define RPCIF_SMDRENR_ADDRE BIT(8)
-#define RPCIF_SMDRENR_OPDRE BIT(4)
-#define RPCIF_SMDRENR_SPIDRE BIT(0)
-
-#define RPCIF_PHYADD 0x0070 /* R/W available on R-Car E3/D3/V3M and RZ/G2{E,L} */
-#define RPCIF_PHYWR 0x0074 /* R/W available on R-Car E3/D3/V3M and RZ/G2{E,L} */
-
-#define RPCIF_PHYCNT 0x007C /* R/W */
-#define RPCIF_PHYCNT_CAL BIT(31)
-#define RPCIF_PHYCNT_OCTA(v) (((v) & 0x3) << 22)
-#define RPCIF_PHYCNT_EXDS BIT(21)
-#define RPCIF_PHYCNT_OCT BIT(20)
-#define RPCIF_PHYCNT_DDRCAL BIT(19)
-#define RPCIF_PHYCNT_HS BIT(18)
-#define RPCIF_PHYCNT_CKSEL(v) (((v) & 0x3) << 16) /* valid only for RZ/G2L */
-#define RPCIF_PHYCNT_STRTIM(v) (((v) & 0x7) << 15) /* valid for R-Car and RZ/G2{E,H,M,N} */
-#define RPCIF_PHYCNT_WBUF2 BIT(4)
-#define RPCIF_PHYCNT_WBUF BIT(2)
-#define RPCIF_PHYCNT_PHYMEM(v) (((v) & 0x3) << 0)
-#define RPCIF_PHYCNT_PHYMEM_MASK GENMASK(1, 0)
-
-#define RPCIF_PHYOFFSET1 0x0080 /* R/W */
-#define RPCIF_PHYOFFSET1_DDRTMG(v) (((v) & 0x3) << 28)
-
-#define RPCIF_PHYOFFSET2 0x0084 /* R/W */
-#define RPCIF_PHYOFFSET2_OCTTMG(v) (((v) & 0x7) << 8)
-
-#define RPCIF_PHYINT 0x0088 /* R/W */
-#define RPCIF_PHYINT_WPVAL BIT(1)
+#include "renesas-rpc-if-regs.h"
static const struct regmap_range rpcif_volatile_ranges[] = {
regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 14/22] memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive()
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (12 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 13/22] memory: renesas-rpc-if: Move rpc-if reg definitions Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 15/22] memory: renesas-rpc-if: Add regmap to struct rpcif_info Biju Das
` (9 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit c66fce831d0669dc809f90bcefd80ae979e35431 upstream.
Replace devm_*_get_exclusive()->devm_*_array_get_exclusive() to support
existing SoCs along with RZ/G3E as RZ/G3E has 2 resets.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-4-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 000d2367eefc..bc4270768856 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -604,7 +604,7 @@ static int rpcif_probe(struct platform_device *pdev)
rpc->size = resource_size(res);
rpc->info = of_device_get_match_data(dev);
- rpc->rstc = devm_reset_control_get_exclusive(dev, NULL);
+ rpc->rstc = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(rpc->rstc))
return PTR_ERR(rpc->rstc);
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 15/22] memory: renesas-rpc-if: Add regmap to struct rpcif_info
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (13 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 14/22] memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive() Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 16/22] memory: renesas-rpc-if: Add wrapper functions Biju Das
` (8 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 198158a8f64cf150325f68044274e21ab0aa69c8 upstream.
The RZ/G3E XSPI has different regmap compared to RPC-IF. Add regmap to
struct rpcif_info in order to support RZ/G3E XSPI.
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-5-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index bc4270768856..1e449766f160 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -33,6 +33,7 @@ static const struct regmap_access_table rpcif_volatile_table = {
};
struct rpcif_info {
+ const struct regmap_config *regmap_config;
enum rpcif_type type;
u8 strtim;
};
@@ -589,8 +590,8 @@ static int rpcif_probe(struct platform_device *pdev)
rpc->base = devm_platform_ioremap_resource_byname(pdev, "regs");
if (IS_ERR(rpc->base))
return PTR_ERR(rpc->base);
-
- rpc->regmap = devm_regmap_init(dev, NULL, rpc, &rpcif_regmap_config);
+ rpc->info = of_device_get_match_data(dev);
+ rpc->regmap = devm_regmap_init(dev, NULL, rpc, rpc->info->regmap_config);
if (IS_ERR(rpc->regmap)) {
dev_err(dev, "failed to init regmap for rpcif, error %ld\n",
PTR_ERR(rpc->regmap));
@@ -603,7 +604,6 @@ static int rpcif_probe(struct platform_device *pdev)
return PTR_ERR(rpc->dirmap);
rpc->size = resource_size(res);
- rpc->info = of_device_get_match_data(dev);
rpc->rstc = devm_reset_control_array_get_exclusive(dev);
if (IS_ERR(rpc->rstc))
return PTR_ERR(rpc->rstc);
@@ -636,11 +636,13 @@ static int rpcif_remove(struct platform_device *pdev)
}
static const struct rpcif_info rpcif_info_gen3 = {
+ .regmap_config = &rpcif_regmap_config,
.type = RPCIF_RCAR_GEN3,
.strtim = 7,
};
static const struct rpcif_info rpcif_info_rz_g2l = {
+ .regmap_config = &rpcif_regmap_config,
.type = RPCIF_RZ_G2L,
.strtim = 7,
};
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 16/22] memory: renesas-rpc-if: Add wrapper functions
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (14 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 15/22] memory: renesas-rpc-if: Add regmap to struct rpcif_info Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 17/22] memory: renesas-rpc-if: Add RZ/G3E xSPI support Biju Das
` (7 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit e1c200a4c7f0e8b842a9a5b7f38fa7036c0df417 upstream.
Even though XSPI and RPCIF has different register layout, reuse the code
by adding wrapper functions to support both XSPI and RPC-IF.
While at it, replace error check for pm_runtime_resume_and_get().
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-6-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/memory/renesas-rpc-if.c | 96 ++++++++++++++++++++++-----------
1 file changed, 65 insertions(+), 31 deletions(-)
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 1e449766f160..09c617a217d0 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -175,16 +175,11 @@ static void rpcif_rzg2l_timing_adjust_sdr(struct rpcif_priv *rpc)
regmap_write(rpc->regmap, RPCIF_PHYADD, 0x80000032);
}
-int rpcif_hw_init(struct device *dev, bool hyperflash)
+static int rpcif_hw_init_impl(struct rpcif_priv *rpc, bool hyperflash)
{
- struct rpcif_priv *rpc = dev_get_drvdata(dev);
u32 dummy;
int ret;
- ret = pm_runtime_resume_and_get(dev);
- if (ret)
- return ret;
-
if (rpc->info->type == RPCIF_RZ_G2L) {
ret = reset_control_reset(rpc->rstc);
if (ret)
@@ -232,12 +227,26 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
regmap_write(rpc->regmap, RPCIF_SSLDR, RPCIF_SSLDR_SPNDL(7) |
RPCIF_SSLDR_SLNDL(7) | RPCIF_SSLDR_SCKDL(7));
- pm_runtime_put(dev);
-
rpc->bus_size = hyperflash ? 2 : 1;
return 0;
}
+
+int rpcif_hw_init(struct device *dev, bool hyperflash)
+{
+ struct rpcif_priv *rpc = dev_get_drvdata(dev);
+ int ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return ret;
+
+ ret = rpcif_hw_init_impl(rpc, hyperflash);
+
+ pm_runtime_put(dev);
+
+ return ret;
+}
EXPORT_SYMBOL(rpcif_hw_init);
static int wait_msg_xfer_end(struct rpcif_priv *rpc)
@@ -262,11 +271,9 @@ static u8 rpcif_bit_size(u8 buswidth)
return buswidth > 4 ? 2 : ilog2(buswidth);
}
-void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
- size_t *len)
+static void rpcif_prepare_impl(struct rpcif_priv *rpc, const struct rpcif_op *op,
+ u64 *offs, size_t *len)
{
- struct rpcif_priv *rpc = dev_get_drvdata(dev);
-
rpc->smcr = 0;
rpc->smadr = 0;
rpc->enable = 0;
@@ -347,18 +354,21 @@ void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
rpc->enable |= RPCIF_SMENR_SPIDB(rpcif_bit_size(op->data.buswidth));
}
}
-EXPORT_SYMBOL(rpcif_prepare);
-int rpcif_manual_xfer(struct device *dev)
+void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
+ size_t *len)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
+
+ rpcif_prepare_impl(rpc, op, offs, len);
+}
+EXPORT_SYMBOL(rpcif_prepare);
+
+static int rpcif_manual_xfer_impl(struct rpcif_priv *rpc)
+{
u32 smenr, smcr, pos = 0, max = rpc->bus_size == 2 ? 8 : 4;
int ret = 0;
- ret = pm_runtime_resume_and_get(dev);
- if (ret < 0)
- return ret;
-
regmap_update_bits(rpc->regmap, RPCIF_PHYCNT,
RPCIF_PHYCNT_CAL, RPCIF_PHYCNT_CAL);
regmap_update_bits(rpc->regmap, RPCIF_CMNCR,
@@ -466,15 +476,29 @@ int rpcif_manual_xfer(struct device *dev)
goto err_out;
}
-exit:
- pm_runtime_put(dev);
return ret;
err_out:
if (reset_control_reset(rpc->rstc))
- dev_err(dev, "Failed to reset HW\n");
- rpcif_hw_init(dev, rpc->bus_size == 2);
- goto exit;
+ dev_err(rpc->dev, "Failed to reset HW\n");
+ rpcif_hw_init_impl(rpc, rpc->bus_size == 2);
+ return ret;
+}
+
+int rpcif_manual_xfer(struct device *dev)
+{
+ struct rpcif_priv *rpc = dev_get_drvdata(dev);
+ int ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return ret;
+
+ ret = rpcif_manual_xfer_impl(rpc);
+
+ pm_runtime_put(dev);
+
+ return ret;
}
EXPORT_SYMBOL(rpcif_manual_xfer);
@@ -520,20 +544,15 @@ static void memcpy_fromio_readw(void *to,
}
}
-ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
+static size_t rpcif_dirmap_read_impl(struct rpcif_priv *rpc, u64 offs,
+ size_t len, void *buf)
{
- struct rpcif_priv *rpc = dev_get_drvdata(dev);
loff_t from = offs & (rpc->size - 1);
size_t size = rpc->size - from;
- int ret;
if (len > size)
len = size;
- ret = pm_runtime_resume_and_get(dev);
- if (ret < 0)
- return ret;
-
regmap_update_bits(rpc->regmap, RPCIF_CMNCR, RPCIF_CMNCR_MD, 0);
regmap_write(rpc->regmap, RPCIF_DRCR, 0);
regmap_write(rpc->regmap, RPCIF_DRCMR, rpc->command);
@@ -550,9 +569,24 @@ ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
else
memcpy_fromio(buf, rpc->dirmap + from, len);
+ return len;
+}
+
+ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
+{
+ struct rpcif_priv *rpc = dev_get_drvdata(dev);
+ size_t read;
+ int ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return ret;
+
+ read = rpcif_dirmap_read_impl(rpc, offs, len, buf);
+
pm_runtime_put(dev);
- return len;
+ return read;
}
EXPORT_SYMBOL(rpcif_dirmap_read);
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 17/22] memory: renesas-rpc-if: Add RZ/G3E xSPI support
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (15 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 16/22] memory: renesas-rpc-if: Add wrapper functions Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 18/22] spi: rpc-if: Add write support for memory-mapped area Biju Das
` (6 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 687cac9559d8e9277830bdfb68b57d7403695b1d upstream.
Add support for RZ/G3E xSPI. Compared to RPC-IF, it can support writes on
memory-mapped area. Introduce struct rpcif_impl for holding the function
pointers and data to handle the differences between xspi and rpc-if
interface.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250424090000.136804-7-biju.das.jz@bp.renesas.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
[Biju: Squashed the commit 798dc3f19c9e
("memory: renesas-rpc-if: Add missing static keyword")]
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
#symbol 'rpcif_impl' was not declared. Should it be static?
#symbol 'xspi_impl' was not declared. Should it be static?
---
drivers/memory/renesas-rpc-if.c | 438 +++++++++++++++++++++++++-
drivers/memory/renesas-xspi-if-regs.h | 105 ++++++
include/memory/renesas-rpc-if.h | 4 +
3 files changed, 540 insertions(+), 7 deletions(-)
create mode 100644 drivers/memory/renesas-xspi-if-regs.h
diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 09c617a217d0..cbbf677e31a7 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -20,6 +20,7 @@
#include <memory/renesas-rpc-if.h>
#include "renesas-rpc-if-regs.h"
+#include "renesas-xspi-if-regs.h"
static const struct regmap_range rpcif_volatile_ranges[] = {
regmap_reg_range(RPCIF_SMRDR0, RPCIF_SMRDR1),
@@ -32,8 +33,31 @@ static const struct regmap_access_table rpcif_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(rpcif_volatile_ranges),
};
+static const struct regmap_range xspi_volatile_ranges[] = {
+ regmap_reg_range(XSPI_CDD0BUF0, XSPI_CDD0BUF0),
+};
+
+static const struct regmap_access_table xspi_volatile_table = {
+ .yes_ranges = xspi_volatile_ranges,
+ .n_yes_ranges = ARRAY_SIZE(xspi_volatile_ranges),
+};
+
+struct rpcif_priv;
+
+struct rpcif_impl {
+ int (*hw_init)(struct rpcif_priv *rpc, bool hyperflash);
+ void (*prepare)(struct rpcif_priv *rpc, const struct rpcif_op *op,
+ u64 *offs, size_t *len);
+ int (*manual_xfer)(struct rpcif_priv *rpc);
+ size_t (*dirmap_read)(struct rpcif_priv *rpc, u64 offs, size_t len,
+ void *buf);
+ u32 status_reg;
+ u32 status_mask;
+};
+
struct rpcif_info {
const struct regmap_config *regmap_config;
+ const struct rpcif_impl *impl;
enum rpcif_type type;
u8 strtim;
};
@@ -50,6 +74,8 @@ struct rpcif_priv {
enum rpcif_data_dir dir;
u8 bus_size;
u8 xfer_size;
+ u8 addr_nbytes; /* Specified for xSPI */
+ u32 proto; /* Specified for xSPI */
void *buffer;
u32 xferlen;
u32 smcr;
@@ -150,6 +176,33 @@ static const struct regmap_config rpcif_regmap_config = {
.volatile_table = &rpcif_volatile_table,
};
+static int xspi_reg_read(void *context, unsigned int reg, unsigned int *val)
+{
+ struct rpcif_priv *xspi = context;
+
+ *val = readl(xspi->base + reg);
+ return 0;
+}
+
+static int xspi_reg_write(void *context, unsigned int reg, unsigned int val)
+{
+ struct rpcif_priv *xspi = context;
+
+ writel(val, xspi->base + reg);
+ return 0;
+}
+
+static const struct regmap_config xspi_regmap_config = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .reg_read = xspi_reg_read,
+ .reg_write = xspi_reg_write,
+ .fast_io = true,
+ .max_register = XSPI_INTE,
+ .volatile_table = &xspi_volatile_table,
+};
+
int rpcif_sw_init(struct rpcif *rpcif, struct device *dev)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
@@ -157,6 +210,7 @@ int rpcif_sw_init(struct rpcif *rpcif, struct device *dev)
rpcif->dev = dev;
rpcif->dirmap = rpc->dirmap;
rpcif->size = rpc->size;
+ rpcif->xspi = rpc->info->type == XSPI_RZ_G3E;
return 0;
}
EXPORT_SYMBOL(rpcif_sw_init);
@@ -232,6 +286,33 @@ static int rpcif_hw_init_impl(struct rpcif_priv *rpc, bool hyperflash)
return 0;
}
+static int xspi_hw_init_impl(struct rpcif_priv *xspi, bool hyperflash)
+{
+ int ret;
+
+ ret = reset_control_reset(xspi->rstc);
+ if (ret)
+ return ret;
+
+ regmap_write(xspi->regmap, XSPI_WRAPCFG, 0x0);
+
+ regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0,
+ XSPI_LIOCFG_PRTMD(0x3ff) | XSPI_LIOCFG_CSMIN(0xf) |
+ XSPI_LIOCFG_CSASTEX | XSPI_LIOCFG_CSNEGEX,
+ XSPI_LIOCFG_PRTMD(0) | XSPI_LIOCFG_CSMIN(0) |
+ XSPI_LIOCFG_CSASTEX | XSPI_LIOCFG_CSNEGEX);
+
+ regmap_update_bits(xspi->regmap, XSPI_CCCTL0CS0, XSPI_CCCTL0_CAEN, 0);
+
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+ XSPI_CDCTL0_TRREQ | XSPI_CDCTL0_CSSEL, 0);
+
+ regmap_update_bits(xspi->regmap, XSPI_INTE, XSPI_INTE_CMDCMPE,
+ XSPI_INTE_CMDCMPE);
+
+ return 0;
+}
+
int rpcif_hw_init(struct device *dev, bool hyperflash)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
@@ -241,7 +322,7 @@ int rpcif_hw_init(struct device *dev, bool hyperflash)
if (ret)
return ret;
- ret = rpcif_hw_init_impl(rpc, hyperflash);
+ ret = rpc->info->impl->hw_init(rpc, hyperflash);
pm_runtime_put(dev);
@@ -253,9 +334,9 @@ static int wait_msg_xfer_end(struct rpcif_priv *rpc)
{
u32 sts;
- return regmap_read_poll_timeout(rpc->regmap, RPCIF_CMNSR, sts,
- sts & RPCIF_CMNSR_TEND, 0,
- USEC_PER_SEC);
+ return regmap_read_poll_timeout(rpc->regmap, rpc->info->impl->status_reg,
+ sts, sts & rpc->info->impl->status_mask,
+ 0, USEC_PER_SEC);
}
static u8 rpcif_bits_set(struct rpcif_priv *rpc, u32 nbytes)
@@ -355,12 +436,67 @@ static void rpcif_prepare_impl(struct rpcif_priv *rpc, const struct rpcif_op *op
}
}
+static void xspi_prepare_impl(struct rpcif_priv *xspi, const struct rpcif_op *op,
+ u64 *offs, size_t *len)
+{
+ xspi->smadr = 0;
+ xspi->addr_nbytes = 0;
+ xspi->command = 0;
+ xspi->option = 0;
+ xspi->dummy = 0;
+ xspi->xferlen = 0;
+ xspi->proto = 0;
+
+ if (op->cmd.buswidth)
+ xspi->command = op->cmd.opcode;
+
+ if (op->ocmd.buswidth)
+ xspi->command = (xspi->command << 8) | op->ocmd.opcode;
+
+ if (op->addr.buswidth) {
+ xspi->addr_nbytes = op->addr.nbytes;
+ if (offs && len)
+ xspi->smadr = *offs;
+ else
+ xspi->smadr = op->addr.val;
+ }
+
+ if (op->dummy.buswidth)
+ xspi->dummy = op->dummy.ncycles;
+
+ xspi->dir = op->data.dir;
+ if (op->data.buswidth) {
+ u32 nbytes;
+
+ xspi->buffer = op->data.buf.in;
+
+ if (offs && len)
+ nbytes = *len;
+ else
+ nbytes = op->data.nbytes;
+ xspi->xferlen = nbytes;
+ }
+
+ if (op->cmd.buswidth == 1) {
+ if (op->addr.buswidth == 2 || op->data.buswidth == 2)
+ xspi->proto = PROTO_1S_2S_2S;
+ else if (op->addr.buswidth == 4 || op->data.buswidth == 4)
+ xspi->proto = PROTO_1S_4S_4S;
+ } else if (op->cmd.buswidth == 2 &&
+ (op->addr.buswidth == 2 || op->data.buswidth == 2)) {
+ xspi->proto = PROTO_2S_2S_2S;
+ } else if (op->cmd.buswidth == 4 &&
+ (op->addr.buswidth == 4 || op->data.buswidth == 4)) {
+ xspi->proto = PROTO_4S_4S_4S;
+ }
+}
+
void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
size_t *len)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
- rpcif_prepare_impl(rpc, op, offs, len);
+ rpc->info->impl->prepare(rpc, op, offs, len);
}
EXPORT_SYMBOL(rpcif_prepare);
@@ -485,6 +621,146 @@ static int rpcif_manual_xfer_impl(struct rpcif_priv *rpc)
return ret;
}
+static int xspi_manual_xfer_impl(struct rpcif_priv *xspi)
+{
+ u32 pos = 0, max = 8;
+ int ret = 0;
+
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0, XSPI_CDCTL0_TRNUM(0x3),
+ XSPI_CDCTL0_TRNUM(0));
+
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0, XSPI_CDCTL0_TRREQ, 0);
+
+ regmap_write(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_CMDSIZE(0x1) | XSPI_CDTBUF_CMD_FIELD(xspi->command));
+
+ regmap_write(xspi->regmap, XSPI_CDABUF0, 0);
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0, XSPI_CDTBUF_ADDSIZE(0x7),
+ XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
+
+ regmap_write(xspi->regmap, XSPI_CDABUF0, xspi->smadr);
+
+ regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0, XSPI_LIOCFG_PRTMD(0x3ff),
+ XSPI_LIOCFG_PRTMD(xspi->proto));
+
+ switch (xspi->dir) {
+ case RPCIF_DATA_OUT:
+ while (pos < xspi->xferlen) {
+ u32 bytes_left = xspi->xferlen - pos;
+ u32 nbytes, data[2], *p = data;
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_TRTYPE, XSPI_CDTBUF_TRTYPE);
+
+ nbytes = bytes_left >= max ? max : bytes_left;
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_DATASIZE(0xf),
+ XSPI_CDTBUF_DATASIZE(nbytes));
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_ADDSIZE(0x7),
+ XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
+
+ memcpy(data, xspi->buffer + pos, nbytes);
+
+ if (nbytes > 4) {
+ regmap_write(xspi->regmap, XSPI_CDD0BUF0, *p++);
+ regmap_write(xspi->regmap, XSPI_CDD1BUF0, *p);
+ } else {
+ regmap_write(xspi->regmap, XSPI_CDD0BUF0, *p);
+ }
+
+ regmap_write(xspi->regmap, XSPI_CDABUF0, xspi->smadr + pos);
+
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+ XSPI_CDCTL0_TRREQ, XSPI_CDCTL0_TRREQ);
+
+ ret = wait_msg_xfer_end(xspi);
+ if (ret)
+ goto err_out;
+
+ regmap_update_bits(xspi->regmap, XSPI_INTC,
+ XSPI_INTC_CMDCMPC, XSPI_INTC_CMDCMPC);
+
+ pos += nbytes;
+ }
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0, XSPI_CDCTL0_TRREQ, 0);
+ break;
+ case RPCIF_DATA_IN:
+ while (pos < xspi->xferlen) {
+ u32 bytes_left = xspi->xferlen - pos;
+ u32 nbytes, data[2], *p = data;
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_TRTYPE,
+ ~(u32)XSPI_CDTBUF_TRTYPE);
+
+ /* nbytes can be up to 8 bytes */
+ nbytes = bytes_left >= max ? max : bytes_left;
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_DATASIZE(0xf),
+ XSPI_CDTBUF_DATASIZE(nbytes));
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_ADDSIZE(0x7),
+ XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
+
+ if (xspi->addr_nbytes)
+ regmap_write(xspi->regmap, XSPI_CDABUF0,
+ xspi->smadr + pos);
+
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_LATE(0x1f),
+ XSPI_CDTBUF_LATE(xspi->dummy));
+
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+ XSPI_CDCTL0_TRREQ, XSPI_CDCTL0_TRREQ);
+
+ ret = wait_msg_xfer_end(xspi);
+ if (ret)
+ goto err_out;
+
+ if (nbytes > 4) {
+ regmap_read(xspi->regmap, XSPI_CDD0BUF0, p++);
+ regmap_read(xspi->regmap, XSPI_CDD1BUF0, p);
+ } else {
+ regmap_read(xspi->regmap, XSPI_CDD0BUF0, p);
+ }
+
+ memcpy(xspi->buffer + pos, data, nbytes);
+
+ regmap_update_bits(xspi->regmap, XSPI_INTC,
+ XSPI_INTC_CMDCMPC, XSPI_INTC_CMDCMPC);
+
+ pos += nbytes;
+ }
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+ XSPI_CDCTL0_TRREQ, 0);
+ break;
+ default:
+ regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+ XSPI_CDTBUF_TRTYPE, XSPI_CDTBUF_TRTYPE);
+ regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+ XSPI_CDCTL0_TRREQ, XSPI_CDCTL0_TRREQ);
+
+ ret = wait_msg_xfer_end(xspi);
+ if (ret)
+ goto err_out;
+
+ regmap_update_bits(xspi->regmap, XSPI_INTC,
+ XSPI_INTC_CMDCMPC, XSPI_INTC_CMDCMPC);
+ }
+
+ return ret;
+
+err_out:
+ xspi_hw_init_impl(xspi, false);
+ return ret;
+}
+
int rpcif_manual_xfer(struct device *dev)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
@@ -494,7 +770,7 @@ int rpcif_manual_xfer(struct device *dev)
if (ret)
return ret;
- ret = rpcif_manual_xfer_impl(rpc);
+ ret = rpc->info->impl->manual_xfer(rpc);
pm_runtime_put(dev);
@@ -572,6 +848,42 @@ static size_t rpcif_dirmap_read_impl(struct rpcif_priv *rpc, u64 offs,
return len;
}
+static size_t xspi_dirmap_read_impl(struct rpcif_priv *xspi, u64 offs,
+ size_t len, void *buf)
+{
+ loff_t from = offs & (xspi->size - 1);
+ size_t size = xspi->size - from;
+ u8 addsize = xspi->addr_nbytes - 1;
+
+ if (len > size)
+ len = size;
+
+ regmap_update_bits(xspi->regmap, XSPI_CMCFG0CS0,
+ XSPI_CMCFG0_FFMT(0x3) | XSPI_CMCFG0_ADDSIZE(0x3),
+ XSPI_CMCFG0_FFMT(0) | XSPI_CMCFG0_ADDSIZE(addsize));
+
+ regmap_update_bits(xspi->regmap, XSPI_CMCFG1CS0,
+ XSPI_CMCFG1_RDCMD(0xffff) | XSPI_CMCFG1_RDLATE(0x1f),
+ XSPI_CMCFG1_RDCMD_UPPER_BYTE(xspi->command) |
+ XSPI_CMCFG1_RDLATE(xspi->dummy));
+
+ regmap_update_bits(xspi->regmap, XSPI_BMCTL0, XSPI_BMCTL0_CS0ACC(0xff),
+ XSPI_BMCTL0_CS0ACC(0x01));
+
+ regmap_update_bits(xspi->regmap, XSPI_BMCFG,
+ XSPI_BMCFG_WRMD | XSPI_BMCFG_MWRCOMB |
+ XSPI_BMCFG_MWRSIZE(0xff) | XSPI_BMCFG_PREEN,
+ 0 | XSPI_BMCFG_MWRCOMB | XSPI_BMCFG_MWRSIZE(0x0f) |
+ XSPI_BMCFG_PREEN);
+
+ regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0, XSPI_LIOCFG_PRTMD(0x3ff),
+ XSPI_LIOCFG_PRTMD(xspi->proto));
+
+ memcpy_fromio(buf, xspi->dirmap + from, len);
+
+ return len;
+}
+
ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
{
struct rpcif_priv *rpc = dev_get_drvdata(dev);
@@ -582,7 +894,7 @@ ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
if (ret)
return ret;
- read = rpcif_dirmap_read_impl(rpc, offs, len, buf);
+ read = rpc->info->impl->dirmap_read(rpc, offs, len, buf);
pm_runtime_put(dev);
@@ -590,6 +902,72 @@ ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
}
EXPORT_SYMBOL(rpcif_dirmap_read);
+/**
+ * xspi_dirmap_write - Write data to xspi memory.
+ * @dev: xspi device
+ * @offs: offset
+ * @len: Number of bytes to be written.
+ * @buf: Buffer holding write data.
+ *
+ * This function writes data into xspi memory.
+ *
+ * Returns number of bytes written on success, else negative errno.
+ */
+ssize_t xspi_dirmap_write(struct device *dev, u64 offs, size_t len, const void *buf)
+{
+ struct rpcif_priv *xspi = dev_get_drvdata(dev);
+ loff_t from = offs & (xspi->size - 1);
+ u8 addsize = xspi->addr_nbytes - 1;
+ size_t size = xspi->size - from;
+ ssize_t writebytes;
+ int ret;
+
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret)
+ return ret;
+
+ if (len > size)
+ len = size;
+
+ if (len > MWRSIZE_MAX)
+ writebytes = MWRSIZE_MAX;
+ else
+ writebytes = len;
+
+ regmap_update_bits(xspi->regmap, XSPI_CMCFG0CS0,
+ XSPI_CMCFG0_FFMT(0x3) | XSPI_CMCFG0_ADDSIZE(0x3),
+ XSPI_CMCFG0_FFMT(0) | XSPI_CMCFG0_ADDSIZE(addsize));
+
+ regmap_update_bits(xspi->regmap, XSPI_CMCFG2CS0,
+ XSPI_CMCFG2_WRCMD_UPPER(0xff) | XSPI_CMCFG2_WRLATE(0x1f),
+ XSPI_CMCFG2_WRCMD_UPPER(xspi->command) |
+ XSPI_CMCFG2_WRLATE(xspi->dummy));
+
+ regmap_update_bits(xspi->regmap, XSPI_BMCTL0,
+ XSPI_BMCTL0_CS0ACC(0xff), XSPI_BMCTL0_CS0ACC(0x03));
+
+ regmap_update_bits(xspi->regmap, XSPI_BMCFG,
+ XSPI_BMCFG_WRMD | XSPI_BMCFG_MWRCOMB |
+ XSPI_BMCFG_MWRSIZE(0xff) | XSPI_BMCFG_PREEN,
+ 0 | XSPI_BMCFG_MWRCOMB | XSPI_BMCFG_MWRSIZE(0x0f) |
+ XSPI_BMCFG_PREEN);
+
+ regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0, XSPI_LIOCFG_PRTMD(0x3ff),
+ XSPI_LIOCFG_PRTMD(xspi->proto));
+
+ memcpy_toio(xspi->dirmap + from, buf, writebytes);
+
+ /* Request to push the pending data */
+ if (writebytes < MWRSIZE_MAX)
+ regmap_update_bits(xspi->regmap, XSPI_BMCTL1,
+ XSPI_BMCTL1_MWRPUSH, XSPI_BMCTL1_MWRPUSH);
+
+ pm_runtime_put(dev);
+
+ return writebytes;
+}
+EXPORT_SYMBOL_GPL(xspi_dirmap_write);
+
static int rpcif_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -642,6 +1020,25 @@ static int rpcif_probe(struct platform_device *pdev)
if (IS_ERR(rpc->rstc))
return PTR_ERR(rpc->rstc);
+ /*
+ * The enabling/disabling of spi/spix2 clocks at runtime leading to
+ * flash write failure. So, enable these clocks during probe() and
+ * disable it in remove().
+ */
+ if (rpc->info->type == XSPI_RZ_G3E) {
+ struct clk *spi_clk;
+
+ spi_clk = devm_clk_get_enabled(dev, "spix2");
+ if (IS_ERR(spi_clk))
+ return dev_err_probe(dev, PTR_ERR(spi_clk),
+ "cannot get enabled spix2 clk\n");
+
+ spi_clk = devm_clk_get_enabled(dev, "spi");
+ if (IS_ERR(spi_clk))
+ return dev_err_probe(dev, PTR_ERR(spi_clk),
+ "cannot get enabled spi clk\n");
+ }
+
vdev = platform_device_alloc(name, pdev->id);
if (!vdev)
return -ENOMEM;
@@ -669,19 +1066,46 @@ static int rpcif_remove(struct platform_device *pdev)
return 0;
}
+static const struct rpcif_impl rpcif_impl = {
+ .hw_init = rpcif_hw_init_impl,
+ .prepare = rpcif_prepare_impl,
+ .manual_xfer = rpcif_manual_xfer_impl,
+ .dirmap_read = rpcif_dirmap_read_impl,
+ .status_reg = RPCIF_CMNSR,
+ .status_mask = RPCIF_CMNSR_TEND,
+};
+
+static const struct rpcif_impl xspi_impl = {
+ .hw_init = xspi_hw_init_impl,
+ .prepare = xspi_prepare_impl,
+ .manual_xfer = xspi_manual_xfer_impl,
+ .dirmap_read = xspi_dirmap_read_impl,
+ .status_reg = XSPI_INTS,
+ .status_mask = XSPI_INTS_CMDCMP,
+};
+
static const struct rpcif_info rpcif_info_gen3 = {
.regmap_config = &rpcif_regmap_config,
+ .impl = &rpcif_impl,
.type = RPCIF_RCAR_GEN3,
.strtim = 7,
};
static const struct rpcif_info rpcif_info_rz_g2l = {
.regmap_config = &rpcif_regmap_config,
+ .impl = &rpcif_impl,
.type = RPCIF_RZ_G2L,
.strtim = 7,
};
+static const struct rpcif_info xspi_info_r9a09g047 = {
+ .regmap_config = &xspi_regmap_config,
+ .impl = &xspi_impl,
+ .type = XSPI_RZ_G3E,
+};
+
static const struct of_device_id rpcif_of_match[] = {
+ { .compatible = "renesas,r9a09g047-xspi", .data = &xspi_info_r9a09g047 },
{ .compatible = "renesas,rcar-gen3-rpc-if", .data = &rpcif_info_gen3 },
{ .compatible = "renesas,rzg2l-rpc-if", .data = &rpcif_info_rz_g2l },
{},
diff --git a/drivers/memory/renesas-xspi-if-regs.h b/drivers/memory/renesas-xspi-if-regs.h
new file mode 100644
index 000000000000..53f801d591f2
--- /dev/null
+++ b/drivers/memory/renesas-xspi-if-regs.h
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * RZ xSPI Interface Registers Definitions
+ *
+ * Copyright (C) 2025 Renesas Electronics Corporation
+ */
+
+#ifndef __RENESAS_XSPI_IF_REGS_H__
+#define __RENESAS_XSPI_IF_REGS_H__
+
+#include <linux/bits.h>
+
+/* xSPI Wrapper Configuration Register */
+#define XSPI_WRAPCFG 0x0000
+
+/* xSPI Bridge Configuration Register */
+#define XSPI_BMCFG 0x0008
+#define XSPI_BMCFG_WRMD BIT(0)
+#define XSPI_BMCFG_MWRCOMB BIT(7)
+#define XSPI_BMCFG_MWRSIZE(val) (((val) & 0xff) << 8)
+#define XSPI_BMCFG_PREEN BIT(16)
+
+/* xSPI Command Map Configuration Register 0 CS0 */
+#define XSPI_CMCFG0CS0 0x0010
+#define XSPI_CMCFG0_FFMT(val) (((val) & 0x03) << 0)
+#define XSPI_CMCFG0_ADDSIZE(val) (((val) & 0x03) << 2)
+
+/* xSPI Command Map Configuration Register 1 CS0 */
+#define XSPI_CMCFG1CS0 0x0014
+#define XSPI_CMCFG1_RDCMD(val) (((val) & 0xffff) << 0)
+#define XSPI_CMCFG1_RDCMD_UPPER_BYTE(val) (((val) & 0xff) << 8)
+#define XSPI_CMCFG1_RDLATE(val) (((val) & 0x1f) << 16)
+
+/* xSPI Command Map Configuration Register 2 CS0 */
+#define XSPI_CMCFG2CS0 0x0018
+#define XSPI_CMCFG2_WRCMD(val) (((val) & 0xffff) << 0)
+#define XSPI_CMCFG2_WRCMD_UPPER(val) (((val) & 0xff) << 8)
+#define XSPI_CMCFG2_WRLATE(val) (((val) & 0x1f) << 16)
+
+/* xSPI Link I/O Configuration Register CS0 */
+#define XSPI_LIOCFGCS0 0x0050
+#define XSPI_LIOCFG_PRTMD(val) (((val) & 0x3ff) << 0)
+#define XSPI_LIOCFG_CSMIN(val) (((val) & 0x0f) << 16)
+#define XSPI_LIOCFG_CSASTEX BIT(20)
+#define XSPI_LIOCFG_CSNEGEX BIT(21)
+
+/* xSPI Bridge Map Control Register 0 */
+#define XSPI_BMCTL0 0x0060
+#define XSPI_BMCTL0_CS0ACC(val) (((val) & 0x03) << 0)
+
+/* xSPI Bridge Map Control Register 1 */
+#define XSPI_BMCTL1 0x0064
+#define XSPI_BMCTL1_MWRPUSH BIT(8)
+
+/* xSPI Command Manual Control Register 0 */
+#define XSPI_CDCTL0 0x0070
+#define XSPI_CDCTL0_TRREQ BIT(0)
+#define XSPI_CDCTL0_CSSEL BIT(3)
+#define XSPI_CDCTL0_TRNUM(val) (((val) & 0x03) << 4)
+
+/* xSPI Command Manual Type Buf */
+#define XSPI_CDTBUF0 0x0080
+#define XSPI_CDTBUF_CMDSIZE(val) (((val) & 0x03) << 0)
+#define XSPI_CDTBUF_ADDSIZE(val) (((val) & 0x07) << 2)
+#define XSPI_CDTBUF_DATASIZE(val) (((val) & 0x0f) << 5)
+#define XSPI_CDTBUF_LATE(val) (((val) & 0x1f) << 9)
+#define XSPI_CDTBUF_TRTYPE BIT(15)
+#define XSPI_CDTBUF_CMD(val) (((val) & 0xffff) << 16)
+#define XSPI_CDTBUF_CMD_FIELD(val) (((val) & 0xff) << 24)
+
+/* xSPI Command Manual Address Buff */
+#define XSPI_CDABUF0 0x0084
+
+/* xSPI Command Manual Data 0 Buf */
+#define XSPI_CDD0BUF0 0x0088
+
+/* xSPI Command Manual Data 1 Buf */
+#define XSPI_CDD1BUF0 0x008c
+
+/* xSPI Command Calibration Control Register 0 CS0 */
+#define XSPI_CCCTL0CS0 0x0130
+#define XSPI_CCCTL0_CAEN BIT(0)
+
+/* xSPI Interrupt Status Register */
+#define XSPI_INTS 0x0190
+#define XSPI_INTS_CMDCMP BIT(0)
+
+/* xSPI Interrupt Clear Register */
+#define XSPI_INTC 0x0194
+#define XSPI_INTC_CMDCMPC BIT(0)
+
+/* xSPI Interrupt Enable Register */
+#define XSPI_INTE 0x0198
+#define XSPI_INTE_CMDCMPE BIT(0)
+
+/* Maximum data size of MWRSIZE*/
+#define MWRSIZE_MAX 64
+
+/* xSPI Protocol mode */
+#define PROTO_1S_2S_2S 0x48
+#define PROTO_2S_2S_2S 0x49
+#define PROTO_1S_4S_4S 0x090
+#define PROTO_4S_4S_4S 0x092
+
+#endif /* __RENESAS_XSPI_IF_REGS_H__ */
diff --git a/include/memory/renesas-rpc-if.h b/include/memory/renesas-rpc-if.h
index b1b6d9126b03..49f11bb184c4 100644
--- a/include/memory/renesas-rpc-if.h
+++ b/include/memory/renesas-rpc-if.h
@@ -60,12 +60,14 @@ struct rpcif_op {
enum rpcif_type {
RPCIF_RCAR_GEN3,
RPCIF_RZ_G2L,
+ XSPI_RZ_G3E,
};
struct rpcif {
struct device *dev;
void __iomem *dirmap;
size_t size;
+ bool xspi;
};
int rpcif_sw_init(struct rpcif *rpc, struct device *dev);
@@ -74,5 +76,7 @@ void rpcif_prepare(struct device *dev, const struct rpcif_op *op, u64 *offs,
size_t *len);
int rpcif_manual_xfer(struct device *dev);
ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf);
+ssize_t xspi_dirmap_write(struct device *dev, u64 offs, size_t len,
+ const void *buf);
#endif // __RENESAS_RPC_IF_H
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 18/22] spi: rpc-if: Add write support for memory-mapped area
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (16 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 17/22] memory: renesas-rpc-if: Add RZ/G3E xSPI support Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 19/22] irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND Biju Das
` (5 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit b0b8d3aeadb5c49bf78305a1bc844e5a9378257c upstream.
Add write support for memory-mapped area as xSPI interface require
it.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://patch.msgid.link/20250424090000.136804-8-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/spi/spi-rpc-if.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index 401fed458d66..d51691e44673 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -75,6 +75,19 @@ static bool rpcif_spi_mem_supports_op(struct spi_mem *mem,
return true;
}
+static ssize_t xspi_spi_mem_dirmap_write(struct spi_mem_dirmap_desc *desc,
+ u64 offs, size_t len, const void *buf)
+{
+ struct rpcif *rpc = spi_controller_get_devdata(desc->mem->spi->controller);
+
+ if (offs + desc->info.offset + len > U32_MAX)
+ return -EINVAL;
+
+ rpcif_spi_mem_prepare(desc->mem->spi, &desc->info.op_tmpl, &offs, &len);
+
+ return xspi_dirmap_write(rpc->dev, offs, len, buf);
+}
+
static ssize_t rpcif_spi_mem_dirmap_read(struct spi_mem_dirmap_desc *desc,
u64 offs, size_t len, void *buf)
{
@@ -103,7 +116,7 @@ static int rpcif_spi_mem_dirmap_create(struct spi_mem_dirmap_desc *desc)
if (!rpc->dirmap)
return -EOPNOTSUPP;
- if (desc->info.op_tmpl.data.dir != SPI_MEM_DATA_IN)
+ if (!rpc->xspi && desc->info.op_tmpl.data.dir != SPI_MEM_DATA_IN)
return -EOPNOTSUPP;
return 0;
@@ -125,6 +138,7 @@ static const struct spi_controller_mem_ops rpcif_spi_mem_ops = {
.exec_op = rpcif_spi_mem_exec_op,
.dirmap_create = rpcif_spi_mem_dirmap_create,
.dirmap_read = rpcif_spi_mem_dirmap_read,
+ .dirmap_write = xspi_spi_mem_dirmap_write,
};
static int rpcif_spi_probe(struct platform_device *pdev)
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 19/22] irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (17 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 18/22] spi: rpc-if: Add write support for memory-mapped area Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 20/22] arm64: dts: renesas: r9a09g047: Add SYS node Biju Das
` (4 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit de2942828e7670526289f098df7e50b112e8ff1e upstream.
The interrupt controller found on RZ/G3E doesn't provide any facility to
configure the wakeup sources. That's the reason why the driver lacks the
irq_set_wake() callback for the interrupt chip.
But this prevent to properly enter power management states like "suspend to
idle".
Enable the flags IRQCHIP_SKIP_SET_WAKE and IRQCHIP_MASK_ON_SUSPEND so the
interrupt suspend logic can handle the chip correctly.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/all/20250701105923.52151-1-biju.das.jz@bp.renesas.com
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/irqchip/irq-renesas-rzv2h.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-renesas-rzv2h.c b/drivers/irqchip/irq-renesas-rzv2h.c
index 8cccebaae111..194c94dafff8 100644
--- a/drivers/irqchip/irq-renesas-rzv2h.c
+++ b/drivers/irqchip/irq-renesas-rzv2h.c
@@ -394,7 +394,9 @@ static const struct irq_chip rzv2h_icu_chip = {
.irq_retrigger = irq_chip_retrigger_hierarchy,
.irq_set_type = rzv2h_icu_set_type,
.irq_set_affinity = irq_chip_set_affinity_parent,
- .flags = IRQCHIP_SET_TYPE_MASKED,
+ .flags = IRQCHIP_MASK_ON_SUSPEND |
+ IRQCHIP_SET_TYPE_MASKED |
+ IRQCHIP_SKIP_SET_WAKE,
};
static int rzv2h_icu_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs,
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 20/22] arm64: dts: renesas: r9a09g047: Add SYS node
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (18 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 19/22] irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 21/22] arm64: dts: renesas: r9a09g047: Add XSPI node Biju Das
` (3 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: John Madieu <john.madieu.xa@bp.renesas.com>
commit 13e9b03263dcdc760aa65c4298271746b180f113 upstream.
Add a node for the System Controller to the RZ/G3E (R9A09G047) SoC DTSI,
as it is also required for SoC identification.
Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250123170508.13578-9-john.madieu.xa@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
index bfdb03e69540..876f70fed433 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
@@ -273,6 +273,13 @@ cpg: clock-controller@10420000 {
#power-domain-cells = <0>;
};
+ sys: system-controller@10430000 {
+ compatible = "renesas,r9a09g047-sys";
+ reg = <0 0x10430000 0 0x10000>;
+ clocks = <&cpg CPG_CORE R9A09G047_SYS_0_PCLK>;
+ resets = <&cpg 0x30>;
+ };
+
scif0: serial@11c01400 {
compatible = "renesas,scif-r9a09g047", "renesas,scif-r9a09g057";
reg = <0 0x11c01400 0 0x400>;
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 21/22] arm64: dts: renesas: r9a09g047: Add XSPI node
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (19 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 20/22] arm64: dts: renesas: r9a09g047: Add SYS node Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 22/22] arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH Biju Das
` (2 subsequent siblings)
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 348da7b1cf0c5a7f2081ff42e969baf0c84da4e7 upstream.
Add XSPI node to RZ/G3E ("R9A09G047") SoC DTSI.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250508183109.137721-2-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
index 876f70fed433..3d3aa371dad8 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
@@ -280,6 +280,27 @@ sys: system-controller@10430000 {
resets = <&cpg 0x30>;
};
+ xspi: spi@11030000 {
+ compatible = "renesas,r9a09g047-xspi";
+ reg = <0 0x11030000 0 0x10000>,
+ <0 0x20000000 0 0x10000000>;
+ reg-names = "regs", "dirmap";
+ interrupts = <GIC_SPI 228 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 229 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "pulse", "err_pulse";
+ clocks = <&cpg CPG_MOD 0x9f>,
+ <&cpg CPG_MOD 0xa0>,
+ <&cpg CPG_CORE R9A09G047_SPI_CLK_SPI>,
+ <&cpg CPG_MOD 0xa1>;
+ clock-names = "ahb", "axi", "spi", "spix2";
+ resets = <&cpg 0xa3>, <&cpg 0xa4>;
+ reset-names = "hresetn", "aresetn";
+ power-domains = <&cpg>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
scif0: serial@11c01400 {
compatible = "renesas,scif-r9a09g047", "renesas,scif-r9a09g057";
reg = <0 0x11c01400 0 0x400>;
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH 6.1.y-cip 22/22] arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (20 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 21/22] arm64: dts: renesas: r9a09g047: Add XSPI node Biju Das
@ 2025-08-20 8:38 ` Biju Das
2025-08-21 11:14 ` [cip-dev] [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Pavel Machek
2025-08-22 4:37 ` nobuhiro.iwamatsu.x90
23 siblings, 0 replies; 26+ messages in thread
From: Biju Das @ 2025-08-20 8:38 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 0712fcaebd76a74a022e5ce105ebe96fa8627961 upstream.
Enable Renesas AT25QL128A FLASH connected to XSPI.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250508183109.137721-3-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../boot/dts/renesas/rzg3e-smarc-som.dtsi | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
index ecea29a76b14..f99a09d04ddd 100644
--- a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
@@ -182,6 +182,15 @@ sd2-pwen {
pinmux = <RZG3E_PORT_PINMUX(K, 2, 1)>; /* SD2PWEN */
};
};
+
+ xspi_pins: xspi0 {
+ pinmux = <RZG3E_PORT_PINMUX(M, 0, 0)>, /* XSPI0_IO0 */
+ <RZG3E_PORT_PINMUX(M, 1, 0)>, /* XSPI0_IO1 */
+ <RZG3E_PORT_PINMUX(M, 2, 0)>, /* XSPI0_IO2 */
+ <RZG3E_PORT_PINMUX(M, 3, 0)>, /* XSPI0_IO3 */
+ <RZG3E_PORT_PINMUX(L, 0, 0)>, /* XSPI0_CKP */
+ <RZG3E_PORT_PINMUX(L, 1, 0)>; /* XSPI0_CS0 */
+ };
};
&qextal_clk {
@@ -245,3 +254,40 @@ &sdhi2_vqmmc {
&wdt1 {
status = "okay";
};
+
+&xspi {
+ pinctrl-0 = <&xspi_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ vcc-supply = <®_1p8v>;
+ m25p,fast-read;
+ spi-max-frequency = <50000000>;
+ spi-tx-bus-width = <4>;
+ spi-rx-bus-width = <4>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "bl2";
+ reg = <0x00000000 0x00060000>;
+ };
+
+ partition@60000 {
+ label = "fip";
+ reg = <0x00060000 0x007a0000>;
+ };
+
+ partition@800000 {
+ label = "user";
+ reg = <0x800000 0x800000>;
+ };
+ };
+ };
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [cip-dev] [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (21 preceding siblings ...)
2025-08-20 8:38 ` [PATCH 6.1.y-cip 22/22] arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH Biju Das
@ 2025-08-21 11:14 ` Pavel Machek
2025-08-22 4:37 ` nobuhiro.iwamatsu.x90
23 siblings, 0 replies; 26+ messages in thread
From: Pavel Machek @ 2025-08-21 11:14 UTC (permalink / raw)
To: biju.das.jz; +Cc: cip-dev, Nobuhiro Iwamatsu, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
Hi!
> Add RZ/G3E XSPI support to cip-6.1. Also backported
> clk and irq patches.
Thank you, series looks ok to me, and I can apply it provided it
passes testing and there are no other comments.
Reviewed-by: Pavel Machek <pavel@denx.de>
Best regards,
Pavel
--
In cooperation with DENX Software Engineering GmbH, HRB 165235 Munich,
Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* RE: [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
` (22 preceding siblings ...)
2025-08-21 11:14 ` [cip-dev] [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Pavel Machek
@ 2025-08-22 4:37 ` nobuhiro.iwamatsu.x90
2025-08-23 6:45 ` Pavel Machek
23 siblings, 1 reply; 26+ messages in thread
From: nobuhiro.iwamatsu.x90 @ 2025-08-22 4:37 UTC (permalink / raw)
To: biju.das.jz, cip-dev, pavel; +Cc: prabhakar.mahadev-lad.rj
Hi all,
> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: Wednesday, August 20, 2025 5:38 PM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □DITC○
> CPT) <nobuhiro.iwamatsu.x90@mail.toshiba>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support
>
> Add RZ/G3E XSPI support to cip-6.1. Also backported clk and irq patches.
>
> All the patches in the series are cherry-picked from mainline.
>
> Biju Das (15):
> dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core
> clocks
> clk: renesas: r9a09g047: Add support for xspi mux and divider
> clk: renesas: r9a09g047: Add XSPI clock/reset
> memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error
> memory: renesas-rpc-if: Move rpcif_info definitions near to the user
> dt-bindings: memory: Document RZ/G3E support
> memory: renesas-rpc-if: Move rpc-if reg definitions
> memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive()
> memory: renesas-rpc-if: Add regmap to struct rpcif_info
> memory: renesas-rpc-if: Add wrapper functions
> memory: renesas-rpc-if: Add RZ/G3E xSPI support
> spi: rpc-if: Add write support for memory-mapped area
> irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND
> arm64: dts: renesas: r9a09g047: Add XSPI node
> arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH
>
> Fabrizio Castro (1):
> clk: renesas: rzv2h: Add missing include file
>
> Geert Uytterhoeven (1):
> clk: renesas: Use str_on_off() helper
>
> John Madieu (1):
> arm64: dts: renesas: r9a09g047: Add SYS node
>
> Lad Prabhakar (4):
> clk: renesas: rzv2h: Skip monitor checks for external clocks
> clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv
> clocks
> clk: renesas: rzv2h: Drop redundant base pointer from pll_clk
> clk: renesas: rzv2h: Add fixed-factor module clocks with status
> reporting
>
> .../renesas,rzg3e-xspi.yaml | 135 ++++
> arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 28 +
> .../boot/dts/renesas/rzg3e-smarc-som.dtsi | 46 ++
> drivers/clk/renesas/r9a09g047-cpg.c | 39 +-
> drivers/clk/renesas/renesas-cpg-mssr.c | 3 +-
> drivers/clk/renesas/rzg2l-cpg.c | 5 +-
> drivers/clk/renesas/rzv2h-cpg.c | 126 +++-
> drivers/clk/renesas/rzv2h-cpg.h | 47 +-
> drivers/irqchip/irq-renesas-rzv2h.c | 4 +-
> drivers/memory/renesas-rpc-if-regs.h | 146 ++++
> drivers/memory/renesas-rpc-if.c | 689
> +++++++++++++-----
> drivers/memory/renesas-xspi-if-regs.h | 105 +++
> drivers/spi/spi-rpc-if.c | 16 +-
> .../dt-bindings/clock/renesas,r9a09g047-cpg.h | 3 +
> include/memory/renesas-rpc-if.h | 4 +
> 15 files changed, 1201 insertions(+), 195 deletions(-) create mode 100644
> Documentation/devicetree/bindings/memory-controllers/renesas,rzg3e-xspi.
> yaml
> create mode 100644 drivers/memory/renesas-rpc-if-regs.h
> create mode 100644 drivers/memory/renesas-xspi-if-regs.h
>
I reviewed this series, LGTM.
I can apply, if there are no other comments and test was OK.
https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/1997742532
Reviewed-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
Best regards,
Nobuhiro
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support
2025-08-22 4:37 ` nobuhiro.iwamatsu.x90
@ 2025-08-23 6:45 ` Pavel Machek
0 siblings, 0 replies; 26+ messages in thread
From: Pavel Machek @ 2025-08-23 6:45 UTC (permalink / raw)
To: nobuhiro.iwamatsu.x90; +Cc: biju.das.jz, cip-dev, prabhakar.mahadev-lad.rj
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
Hi!
> I reviewed this series, LGTM.
> I can apply, if there are no other comments and test was OK.
> https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/1997742532
>
> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba>
Thank you, applied and pushed out.
Best regards,
Pavel
--
In cooperation with DENX Software Engineering GmbH, HRB 165235 Munich,
Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2025-08-23 6:46 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-20 8:38 [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 01/22] clk: renesas: Use str_on_off() helper Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 02/22] dt-bindings: clock: renesas,r9a09g047-cpg: Add XSPI and GBETH PTP core clocks Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 03/22] clk: renesas: r9a09g047: Add support for xspi mux and divider Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 04/22] clk: renesas: r9a09g047: Add XSPI clock/reset Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 05/22] clk: renesas: rzv2h: Skip monitor checks for external clocks Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 06/22] clk: renesas: rzv2h: Fix missing CLK_SET_RATE_PARENT flag for ddiv clocks Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 07/22] clk: renesas: rzv2h: Add missing include file Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 08/22] clk: renesas: rzv2h: Drop redundant base pointer from pll_clk Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 09/22] clk: renesas: rzv2h: Add fixed-factor module clocks with status reporting Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 10/22] memory: renesas-rpc-if: Fix RPCIF_DRENR_CDB macro error Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 11/22] memory: renesas-rpc-if: Move rpcif_info definitions near to the user Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 12/22] dt-bindings: memory: Document RZ/G3E support Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 13/22] memory: renesas-rpc-if: Move rpc-if reg definitions Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 14/22] memory: renesas-rpc-if: Use devm_reset_control_array_get_exclusive() Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 15/22] memory: renesas-rpc-if: Add regmap to struct rpcif_info Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 16/22] memory: renesas-rpc-if: Add wrapper functions Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 17/22] memory: renesas-rpc-if: Add RZ/G3E xSPI support Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 18/22] spi: rpc-if: Add write support for memory-mapped area Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 19/22] irqchip/renesas-rzv2h: Enable SKIP_SET_WAKE and MASK_ON_SUSPEND Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 20/22] arm64: dts: renesas: r9a09g047: Add SYS node Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 21/22] arm64: dts: renesas: r9a09g047: Add XSPI node Biju Das
2025-08-20 8:38 ` [PATCH 6.1.y-cip 22/22] arm64: dts: renesas: rzg3e-smarc-som: Enable serial NOR FLASH Biju Das
2025-08-21 11:14 ` [cip-dev] [PATCH 6.1.y-cip 00/22] Add RZ/G3E XSPI support Pavel Machek
2025-08-22 4:37 ` nobuhiro.iwamatsu.x90
2025-08-23 6:45 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox