* [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC
@ 2025-05-21 14:09 Claudiu
2025-05-21 14:09 ` [PATCH v3 01/12] soc: renesas: rz-sysc: Add syscon/regmap support Claudiu
` (11 more replies)
0 siblings, 12 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Hi,
Series adds initial USB support for the Renesas RZ/G3S SoC.
Series is split as follows:
- patches 01-03/12 - add signal support on SYSC driver support; this is
necessary for USB PHY as the USB PHY driver needs to
touch a register in the SYSC address space, in the
initialization phase
- patches 04-05/12 - updates the USB PHY documentation
- patches 06-07/12 - updates the USB PHY driver with a fix and the
support for PWRRDY SYSC signal
- patches 08-10/12 - updates the rzg2l-usbphy-ctrl driver and documentation
with support for the USB PWRRDY signal
- patches 11-12/12 - add device tree support
Merge strategy, if any:
- patches 01-03/12,11-12/12 can go through Renesas tree
- patches 04-07/12 can go through the PHY tree
- patches 08-10/12 can go through the reset tree
Thank you,
Claudiu Beznea
Changes in v3:
- as the basics of the SYSC driver was integrated, only the signal support
was preserved in this series, in a separate patch; patch 01/12 was
adjusted (by addressing the review comments received at [1]) as it is
necessary to build the signal support on top of it
- after long discussions with the internal HW team it has been confirmed
that the relation b/w individual USB specific HW blocks and signals
is like:
┌──────────────────────────────┐
│ │◄── CPG_CLKON_USB.CLK0_ON
│ USB CH0 │
┌──────────────────────────┐ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK2_ON
│ ┌────────┐ ││host controller registers │ │
│ │ │ ││function controller registers│
│ │ PHY0 │◄──┤└───────────────────────────┘ │
│ USB PHY │ │ └────────────▲─────────────────┘
│ └────────┘ │
│ │ CPG_BUS_PERI_COM_MSTOP.MSTOP{6, 5}_ON
│┌──────────────┐ ┌────────┐
││USBPHY control│ │ │
││ registers │ │ PHY1 │ ┌──────────────────────────────┐
│└──────────────┘ │ │◄──┤ USB CH1 │
│ └────────┘ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK1_ON
└─▲───────▲─────────▲──────┘ ││ host controller registers │ │
│ │ │ │└───────────────────────────┘ │
│ │ │ └────────────▲─────────────────┘
│ │ │ │
│ │ │ CPG_BUS_PERI_COM_MSTOP.MSTOP7_ON
│PWRRDY │ │
│ │ CPG_CLK_ON_USB.CLK3_ON
│ │
│ CPG_BUS_PERI_COM_MSTOP.MSTOP4_ON
│
┌────┐
│SYSC│
└────┘
where:
- CPG_CLKON_USB.CLK.CLKX_ON is the register bit controlling the clock X
of different USB blocks, X in {0, 1, 2, 3}
- CPG_BUS_PERI_COM_MSTOP.MSTOPX_ON is the register bit controlling the
MSTOP of different USB blocks, X in {4, 5, 6, 7}
- USB PHY is the USB PHY block exposing 2 ports, port0 and port1, used
by the USB CH0, USB CH1
- SYSC is the system controller block controlling the PWRRDY signal
- USB CHx are individual USB block with host and function capabilities
(USB CH0 have both host and function capabilities, USB CH1 has only
host capabilities)
Due to this, the PWRRDY signal was also passed to the reset-rzg2l-usbphy-ctrl
reset driver (as it controls the USBPHY control registers) and these
are in the USB PHY block controlled by PWRRDY signal.
The PWRRDY signal need to be de-asserted on probe before enabling the module
clocks and the module MSTOP. To avoid any violation of this configuration
sequence, the PWRRDY signal is now controlled by USB PHY driver and the
reset-rzg2l-usbphy-ctrl driver.
As the PHYs gets reset signals from the USB reset controller driver, the
reset-rzg2l-usbphy-ctrl is probed before the USB PHY driver and thus,
in theory, we can drop the signal support (reference counting of the
USB PWRRDY) and configure the USB PWRRDY just in the reset-rzg2l-usbphy-ctrl.
However, to have a proper description of the diagram described above in
device tree and ensure the configuration sequence b/w PRWRDY, CLK and MSTOP
is preserved, the PWRRDY signal is controlled in this series in all the
drivers that work with registers from the USB PHY block.
Please provide your feedback on this solution.
Thank you,
Claudiu
[1] https://lore.kernel.org/all/20250330214945.185725-2-john.madieu.xa@bp.renesas.com/
Changes in v2:
- dropped v1 patches already applied
- added fixes patches (07/14 and 09/14)
- dropped the approach of handling the USB PWRRDY though a reset controller
driver and introduced the signal concept for the SYSC driver; because
of this, most of the work done in v1 was dropped
- per patch changes are listed in individual patches, if any
Christophe JAILLET (1):
phy: renesas: rcar-gen3-usb2: Fix an error handling path in
rcar_gen3_phy_usb2_probe()
Claudiu Beznea (10):
soc: renesas: rz-sysc: Add signal support
soc: renesas: r9a08g045-sysc: Add USB PWRRDY signal
dt-bindings: phy: renesas,usb2-phy: Mark resets as required for RZ/G3S
dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
phy: renesas: rcar-gen3-usb2: Add support for USB PWRRDY signal
reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY signal
dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support
reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC
arm64: dts: renesas: r9a08g045: Add USB support
arm64: dts: renesas: rzg3s-smarc: Enable USB support
John Madieu (1):
soc: renesas: rz-sysc: Add syscon/regmap support
.../bindings/phy/renesas,usb2-phy.yaml | 23 ++
.../reset/renesas,rzg2l-usbphy-ctrl.yaml | 38 +++-
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 120 +++++++++++
arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 57 +++++
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 51 ++++-
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 46 ++++
drivers/soc/renesas/Kconfig | 1 +
drivers/soc/renesas/r9a08g045-sysc.c | 25 +++
drivers/soc/renesas/r9a09g047-sys.c | 13 ++
drivers/soc/renesas/r9a09g057-sys.c | 13 ++
drivers/soc/renesas/rz-sysc.c | 200 +++++++++++++++++-
drivers/soc/renesas/rz-sysc.h | 38 ++++
include/linux/soc/renesas/rz-sysc.h | 30 +++
13 files changed, 646 insertions(+), 9 deletions(-)
create mode 100644 include/linux/soc/renesas/rz-sysc.h
--
2.43.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3 01/12] soc: renesas: rz-sysc: Add syscon/regmap support
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 02/12] soc: renesas: rz-sysc: Add signal support Claudiu
` (10 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: John Madieu <john.madieu.xa@bp.renesas.com>
The RZ/G3E system controller has various registers that control or report
some properties specific to individual IPs. The regmap is registered as a
syscon device to allow these IP drivers to access the registers through the
regmap API.
As other RZ SoCs might have custom read/write callbacks or max-offsets,
add register a custom regmap configuration.
Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
[claudiu.beznea:
- s/rzg3e_sysc_regmap/rzv2h_sysc_regmap in RZ/V2H sysc
file
- do not check the match->data validity in rz_sysc_probe() as it is
always valid
- register the regmap if data->regmap_cfg is valid]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- none, this patch is new, it was picked from John after he addressed
the review comments received at [1];
- I adjusted as specified in the SoB area, and included it here as it
is the base for the signal support presented in the next commits
[1] https://lore.kernel.org/all/20250330214945.185725-2-john.madieu.xa@bp.renesas.com/
drivers/soc/renesas/Kconfig | 1 +
drivers/soc/renesas/r9a08g045-sysc.c | 10 ++++++++++
drivers/soc/renesas/r9a09g047-sys.c | 10 ++++++++++
drivers/soc/renesas/r9a09g057-sys.c | 10 ++++++++++
drivers/soc/renesas/rz-sysc.c | 17 ++++++++++++++++-
drivers/soc/renesas/rz-sysc.h | 3 +++
6 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig
index fbc3b69d21a7..f3b7546092d6 100644
--- a/drivers/soc/renesas/Kconfig
+++ b/drivers/soc/renesas/Kconfig
@@ -437,6 +437,7 @@ config RST_RCAR
config SYSC_RZ
bool "System controller for RZ SoCs" if COMPILE_TEST
+ select MFD_SYSCON
config SYSC_R9A08G045
bool "Renesas RZ/G3S System controller support" if COMPILE_TEST
diff --git a/drivers/soc/renesas/r9a08g045-sysc.c b/drivers/soc/renesas/r9a08g045-sysc.c
index f4db1431e036..0ef6df77e25f 100644
--- a/drivers/soc/renesas/r9a08g045-sysc.c
+++ b/drivers/soc/renesas/r9a08g045-sysc.c
@@ -18,6 +18,16 @@ static const struct rz_sysc_soc_id_init_data rzg3s_sysc_soc_id_init_data __initc
.specific_id_mask = GENMASK(27, 0),
};
+static const struct regmap_config rzg3s_sysc_regmap __initconst = {
+ .name = "rzg3s_sysc_regs",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .fast_io = true,
+ .max_register = 0xe20,
+};
+
const struct rz_sysc_init_data rzg3s_sysc_init_data __initconst = {
.soc_id_init_data = &rzg3s_sysc_soc_id_init_data,
+ .regmap_cfg = &rzg3s_sysc_regmap,
};
diff --git a/drivers/soc/renesas/r9a09g047-sys.c b/drivers/soc/renesas/r9a09g047-sys.c
index cd2eb7782cfe..a3acf6dd2867 100644
--- a/drivers/soc/renesas/r9a09g047-sys.c
+++ b/drivers/soc/renesas/r9a09g047-sys.c
@@ -62,6 +62,16 @@ static const struct rz_sysc_soc_id_init_data rzg3e_sys_soc_id_init_data __initco
.print_id = rzg3e_sys_print_id,
};
+static const struct regmap_config rzg3e_sysc_regmap __initconst = {
+ .name = "rzg3e_sysc_regs",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .fast_io = true,
+ .max_register = 0x170c,
+};
+
const struct rz_sysc_init_data rzg3e_sys_init_data = {
.soc_id_init_data = &rzg3e_sys_soc_id_init_data,
+ .regmap_cfg = &rzg3e_sysc_regmap,
};
diff --git a/drivers/soc/renesas/r9a09g057-sys.c b/drivers/soc/renesas/r9a09g057-sys.c
index 4c21cc29edbc..c26821636dce 100644
--- a/drivers/soc/renesas/r9a09g057-sys.c
+++ b/drivers/soc/renesas/r9a09g057-sys.c
@@ -62,6 +62,16 @@ static const struct rz_sysc_soc_id_init_data rzv2h_sys_soc_id_init_data __initco
.print_id = rzv2h_sys_print_id,
};
+static const struct regmap_config rzv2h_sysc_regmap __initconst = {
+ .name = "rzv2h_sysc_regs",
+ .reg_bits = 32,
+ .reg_stride = 4,
+ .val_bits = 32,
+ .fast_io = true,
+ .max_register = 0x170c,
+};
+
const struct rz_sysc_init_data rzv2h_sys_init_data = {
.soc_id_init_data = &rzv2h_sys_soc_id_init_data,
+ .regmap_cfg = &rzv2h_sysc_regmap,
};
diff --git a/drivers/soc/renesas/rz-sysc.c b/drivers/soc/renesas/rz-sysc.c
index ffa65fb4dade..70556a2f55e6 100644
--- a/drivers/soc/renesas/rz-sysc.c
+++ b/drivers/soc/renesas/rz-sysc.c
@@ -6,8 +6,10 @@
*/
#include <linux/io.h>
+#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/sys_soc.h>
#include "rz-sysc.h"
@@ -100,14 +102,19 @@ MODULE_DEVICE_TABLE(of, rz_sysc_match);
static int rz_sysc_probe(struct platform_device *pdev)
{
+ const struct rz_sysc_init_data *data;
const struct of_device_id *match;
struct device *dev = &pdev->dev;
+ struct regmap *regmap;
struct rz_sysc *sysc;
+ int ret;
match = of_match_node(rz_sysc_match, dev->of_node);
if (!match)
return -ENODEV;
+ data = match->data;
+
sysc = devm_kzalloc(dev, sizeof(*sysc), GFP_KERNEL);
if (!sysc)
return -ENOMEM;
@@ -117,7 +124,15 @@ static int rz_sysc_probe(struct platform_device *pdev)
return PTR_ERR(sysc->base);
sysc->dev = dev;
- return rz_sysc_soc_init(sysc, match);
+ ret = rz_sysc_soc_init(sysc, match);
+ if (ret || !data->regmap_cfg)
+ return ret;
+
+ regmap = devm_regmap_init_mmio(dev, sysc->base, data->regmap_cfg);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
+ return of_syscon_register_regmap(dev->of_node, regmap);
}
static struct platform_driver rz_sysc_driver = {
diff --git a/drivers/soc/renesas/rz-sysc.h b/drivers/soc/renesas/rz-sysc.h
index 56bc047a1bff..447008140634 100644
--- a/drivers/soc/renesas/rz-sysc.h
+++ b/drivers/soc/renesas/rz-sysc.h
@@ -9,6 +9,7 @@
#define __SOC_RENESAS_RZ_SYSC_H__
#include <linux/device.h>
+#include <linux/regmap.h>
#include <linux/sys_soc.h>
#include <linux/types.h>
@@ -34,9 +35,11 @@ struct rz_sysc_soc_id_init_data {
/**
* struct rz_sysc_init_data - RZ SYSC initialization data
* @soc_id_init_data: RZ SYSC SoC ID initialization data
+ * @regmap_cfg: SoC-specific regmap config
*/
struct rz_sysc_init_data {
const struct rz_sysc_soc_id_init_data *soc_id_init_data;
+ const struct regmap_config *regmap_cfg;
};
extern const struct rz_sysc_init_data rzg3e_sys_init_data;
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 02/12] soc: renesas: rz-sysc: Add signal support
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
2025-05-21 14:09 ` [PATCH v3 01/12] soc: renesas: rz-sysc: Add syscon/regmap support Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 03/12] soc: renesas: r9a08g045-sysc: Add USB PWRRDY signal Claudiu
` (9 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The RZ/G3S system controller (SYSC) has various registers that control
signals specific to individual IPs. IP drivers must control these signals
at different configuration phases.
Update the SYSC driver to allows individual SYSC consumers to control these
signals. The SYSC driver exports a syscon regmap enabling IP drivers to
use a specific SYSC offset and mask from the device tree, which can then be
accessed through regmap_update_bits().
Currently, the SYSC driver provides control to the USB PWRRDY signal, which
is routed to the USB PHY. This signal needs to be managed before or after
powering the USB PHY off or on.
Other SYSC signals candidates (as exposed in the hardware manual of the
RZ/G3S SoC) include:
* PCIe:
- ALLOW_ENTER_L1 signal controlled through the SYS_PCIE_CFG register
- PCIE_RST_RSM_B signal controlled through the SYS_PCIE_RST_RSM_B
register
- MODE_RXTERMINATION signal controlled through SYS_PCIE_PHY register
* SPI:
- SEL_SPI_OCTA signal controlled through SYS_IPCONT_SEL_SPI_OCTA
register
* I2C/I3C:
- af_bypass I2C signals controlled through SYS_I2Cx_CFG registers
(x=0..3)
- af_bypass I3C signal controlled through SYS_I3C_CFG register
* Ethernet:
- FEC_GIGA_ENABLE Ethernet signals controlled through SYS_GETHx_CFG
registers (x=0..1)
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- this patch is new, however, most of its parts were picked from [1]
Compared with [1]:
- kept only the signals part
- droped double "the" in description
- mark init data with __initconst
- use flexible arrays to store the signals
- simplified the code in rz_sysc_off_to_signal() and
rz_sysc_reg_update_bits() as proposed in the review process
- dropped rz_sysc_writeable_reg(), rz_sysc_readable_reg()
- fixed rz_sysc_signals_init() as it didn't work with more than one
signal
- embedded rz_sysc_signal_init_data in rz_sysc_signal for simpler
memory allocation
- added rz_sysc_get_signal_map() and struct rz_sysc_signal_map as
a unified helper and data structure to handle a signal
- use rz_sysc_reg_read(), rz_sysc_reg_write(),
rz_sysc_reg_update_bits() in all the rz-sysc consummers
[1] https://lore.kernel.org/all/20241126092050.1825607-3-claudiu.beznea.uj@bp.renesas.com/
drivers/soc/renesas/r9a08g045-sysc.c | 3 +
drivers/soc/renesas/r9a09g047-sys.c | 3 +
drivers/soc/renesas/r9a09g057-sys.c | 3 +
drivers/soc/renesas/rz-sysc.c | 185 ++++++++++++++++++++++++++-
drivers/soc/renesas/rz-sysc.h | 35 +++++
include/linux/soc/renesas/rz-sysc.h | 30 +++++
6 files changed, 257 insertions(+), 2 deletions(-)
create mode 100644 include/linux/soc/renesas/rz-sysc.h
diff --git a/drivers/soc/renesas/r9a08g045-sysc.c b/drivers/soc/renesas/r9a08g045-sysc.c
index 0ef6df77e25f..d2c9e3b77f41 100644
--- a/drivers/soc/renesas/r9a08g045-sysc.c
+++ b/drivers/soc/renesas/r9a08g045-sysc.c
@@ -25,6 +25,9 @@ static const struct regmap_config rzg3s_sysc_regmap __initconst = {
.val_bits = 32,
.fast_io = true,
.max_register = 0xe20,
+ .reg_read = rz_sysc_reg_read,
+ .reg_write = rz_sysc_reg_write,
+ .reg_update_bits = rz_sysc_reg_update_bits,
};
const struct rz_sysc_init_data rzg3s_sysc_init_data __initconst = {
diff --git a/drivers/soc/renesas/r9a09g047-sys.c b/drivers/soc/renesas/r9a09g047-sys.c
index a3acf6dd2867..fd4018e0aca1 100644
--- a/drivers/soc/renesas/r9a09g047-sys.c
+++ b/drivers/soc/renesas/r9a09g047-sys.c
@@ -69,6 +69,9 @@ static const struct regmap_config rzg3e_sysc_regmap __initconst = {
.val_bits = 32,
.fast_io = true,
.max_register = 0x170c,
+ .reg_read = rz_sysc_reg_read,
+ .reg_write = rz_sysc_reg_write,
+ .reg_update_bits = rz_sysc_reg_update_bits,
};
const struct rz_sysc_init_data rzg3e_sys_init_data = {
diff --git a/drivers/soc/renesas/r9a09g057-sys.c b/drivers/soc/renesas/r9a09g057-sys.c
index c26821636dce..cfa5be48f049 100644
--- a/drivers/soc/renesas/r9a09g057-sys.c
+++ b/drivers/soc/renesas/r9a09g057-sys.c
@@ -69,6 +69,9 @@ static const struct regmap_config rzv2h_sysc_regmap __initconst = {
.val_bits = 32,
.fast_io = true,
.max_register = 0x170c,
+ .reg_read = rz_sysc_reg_read,
+ .reg_write = rz_sysc_reg_write,
+ .reg_update_bits = rz_sysc_reg_update_bits,
};
const struct rz_sysc_init_data rzv2h_sys_init_data = {
diff --git a/drivers/soc/renesas/rz-sysc.c b/drivers/soc/renesas/rz-sysc.c
index 70556a2f55e6..3dd5d444050b 100644
--- a/drivers/soc/renesas/rz-sysc.c
+++ b/drivers/soc/renesas/rz-sysc.c
@@ -5,11 +5,16 @@
* Copyright (C) 2024 Renesas Electronics Corp.
*/
+#include <linux/dcache.h>
+#include <linux/debugfs.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/platform_device.h>
+#include <linux/refcount.h>
#include <linux/regmap.h>
+#include <linux/seq_file.h>
+#include <linux/soc/renesas/rz-sysc.h>
#include <linux/sys_soc.h>
#include "rz-sysc.h"
@@ -20,12 +25,183 @@
* struct rz_sysc - RZ SYSC private data structure
* @base: SYSC base address
* @dev: SYSC device pointer
+ * @num_signals: number of SYSC signals
+ * @signals: SYSC signals
*/
struct rz_sysc {
void __iomem *base;
struct device *dev;
+ u8 num_signals;
+ struct rz_sysc_signal signals[] __counted_by(num_signals);
};
+struct rz_sysc_signal_map *rz_sysc_get_signal_map(struct device *dev)
+{
+ struct rz_sysc_signal_map *map;
+ struct of_phandle_args args;
+ struct regmap *regmap;
+ int ret;
+
+ if (!dev)
+ return ERR_PTR(-EINVAL);
+
+ ret = of_parse_phandle_with_fixed_args(dev->of_node, "renesas,sysc-signals", 2,
+ 0, &args);
+ if (ret)
+ return ERR_PTR(ret);
+
+ regmap = syscon_node_to_regmap(args.np);
+ of_node_put(args.np);
+ if (IS_ERR(regmap))
+ return ERR_CAST(regmap);
+
+ map = devm_kzalloc(dev, sizeof(*map), GFP_KERNEL);
+ if (!map)
+ return ERR_PTR(-ENOMEM);
+
+ map->regmap = regmap;
+ map->offset = args.args[0];
+ map->mask = args.args[1];
+
+ return map;
+}
+
+int rz_sysc_reg_read(void *context, unsigned int off, unsigned int *val)
+{
+ struct rz_sysc *sysc = context;
+
+ *val = readl(sysc->base + off);
+
+ return 0;
+}
+
+static struct rz_sysc_signal *rz_sysc_off_to_signal(struct rz_sysc *sysc, unsigned int offset,
+ unsigned int mask)
+{
+ struct rz_sysc_signal *signals = sysc->signals;
+
+ for (u32 i = 0; i < sysc->num_signals; i++) {
+ if (signals[i].init_data.offset != offset)
+ continue;
+
+ /*
+ * In case mask == 0 we just return the signal data w/o checking the mask.
+ * This is useful when calling through rz_sysc_reg_write() to check
+ * if the requested setting is for a mapped signal or not.
+ */
+ if (!mask || signals[i].init_data.mask == mask)
+ return &signals[i];
+ }
+
+ return NULL;
+}
+
+int rz_sysc_reg_update_bits(void *context, unsigned int off, unsigned int mask, unsigned int val)
+{
+ unsigned int shifted_val = field_get(mask, val);
+ struct rz_sysc *sysc = context;
+ struct rz_sysc_signal *signal;
+ bool update = false;
+
+ signal = rz_sysc_off_to_signal(sysc, off, mask);
+ if (!signal) {
+ update = true;
+ } else if (signal->init_data.refcnt_incr_val != shifted_val) {
+ update = refcount_dec_and_test(&signal->refcnt);
+ } else if (!refcount_read(&signal->refcnt)) {
+ refcount_set(&signal->refcnt, 1);
+ update = true;
+ } else {
+ refcount_inc(&signal->refcnt);
+ }
+
+ if (update) {
+ u32 tmp;
+
+ tmp = readl(sysc->base + off);
+ tmp &= ~mask;
+ tmp |= val & mask;
+ writel(tmp, sysc->base + off);
+ }
+
+ return 0;
+}
+
+int rz_sysc_reg_write(void *context, unsigned int off, unsigned int val)
+{
+ struct rz_sysc *sysc = context;
+ struct rz_sysc_signal *signal;
+
+ /*
+ * Force using regmap_update_bits() for signals to have reference counter
+ * per individual signal in case there are multiple signals controlled
+ * through the same register.
+ */
+ signal = rz_sysc_off_to_signal(sysc, off, 0);
+ if (signal) {
+ dev_err(sysc->dev,
+ "regmap_write() not allowed on register controlling a signal. Use regmap_update_bits()!");
+ return -EOPNOTSUPP;
+ }
+
+ writel(val, sysc->base + off);
+
+ return 0;
+}
+
+static int rz_sysc_signals_show(struct seq_file *s, void *what)
+{
+ struct rz_sysc *sysc = s->private;
+
+ seq_printf(s, "%-20s Enable count\n", "Signal");
+ seq_printf(s, "%-20s ------------\n", "--------------------");
+
+ for (u8 i = 0; i < sysc->num_signals; i++) {
+ seq_printf(s, "%-20s %d\n", sysc->signals[i].init_data.name,
+ refcount_read(&sysc->signals[i].refcnt));
+ }
+
+ return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(rz_sysc_signals);
+
+static void rz_sysc_debugfs_remove(void *data)
+{
+ debugfs_remove_recursive(data);
+}
+
+static int rz_sysc_signals_init(struct rz_sysc *sysc,
+ const struct rz_sysc_signal_init_data *init_data,
+ u32 num_signals)
+{
+ struct dentry *root;
+ int ret;
+
+ for (unsigned int i = 0; i < num_signals; i++) {
+ struct rz_sysc_signal_init_data *data = &sysc->signals[i].init_data;
+
+ data->name = devm_kstrdup(sysc->dev, init_data[i].name, GFP_KERNEL);
+ if (!data->name)
+ return -ENOMEM;
+
+ data->offset = init_data[i].offset;
+ data->mask = init_data[i].mask;
+ data->refcnt_incr_val = init_data[i].refcnt_incr_val;
+
+ refcount_set(&sysc->signals[i].refcnt, 0);
+ }
+
+ sysc->num_signals = num_signals;
+
+ root = debugfs_create_dir("renesas-rz-sysc", NULL);
+ ret = devm_add_action_or_reset(sysc->dev, rz_sysc_debugfs_remove, root);
+ if (ret)
+ return ret;
+ debugfs_create_file("signals", 0444, root, sysc, &rz_sysc_signals_fops);
+
+ return 0;
+}
+
static int rz_sysc_soc_init(struct rz_sysc *sysc, const struct of_device_id *match)
{
const struct rz_sysc_init_data *sysc_data = match->data;
@@ -115,7 +291,8 @@ static int rz_sysc_probe(struct platform_device *pdev)
data = match->data;
- sysc = devm_kzalloc(dev, sizeof(*sysc), GFP_KERNEL);
+ sysc = devm_kzalloc(dev, struct_size(sysc, signals, data->num_signals),
+ GFP_KERNEL);
if (!sysc)
return -ENOMEM;
@@ -128,7 +305,11 @@ static int rz_sysc_probe(struct platform_device *pdev)
if (ret || !data->regmap_cfg)
return ret;
- regmap = devm_regmap_init_mmio(dev, sysc->base, data->regmap_cfg);
+ ret = rz_sysc_signals_init(sysc, data->signals_init_data, data->num_signals);
+ if (ret)
+ return ret;
+
+ regmap = devm_regmap_init(dev, NULL, sysc, data->regmap_cfg);
if (IS_ERR(regmap))
return PTR_ERR(regmap);
diff --git a/drivers/soc/renesas/rz-sysc.h b/drivers/soc/renesas/rz-sysc.h
index 447008140634..111f79ef9573 100644
--- a/drivers/soc/renesas/rz-sysc.h
+++ b/drivers/soc/renesas/rz-sysc.h
@@ -9,10 +9,35 @@
#define __SOC_RENESAS_RZ_SYSC_H__
#include <linux/device.h>
+#include <linux/refcount.h>
#include <linux/regmap.h>
#include <linux/sys_soc.h>
#include <linux/types.h>
+/**
+ * struct rz_sysc_signal_init_data - RZ SYSC signals init data
+ * @name: signal name
+ * @offset: register offset controling this signal
+ * @mask: bitmask in register specific to this signal
+ * @refcnt_incr_val: increment refcnt when setting this value
+ */
+struct rz_sysc_signal_init_data {
+ const char *name;
+ u32 offset;
+ u32 mask;
+ u32 refcnt_incr_val;
+};
+
+/**
+ * struct rz_sysc_signal - RZ SYSC signals
+ * @init_data: signals initialization data
+ * @refcnt: reference counter
+ */
+struct rz_sysc_signal {
+ struct rz_sysc_signal_init_data init_data;
+ refcount_t refcnt;
+};
+
/**
* struct rz_syc_soc_id_init_data - RZ SYSC SoC identification initialization data
* @family: RZ SoC family
@@ -35,13 +60,23 @@ struct rz_sysc_soc_id_init_data {
/**
* struct rz_sysc_init_data - RZ SYSC initialization data
* @soc_id_init_data: RZ SYSC SoC ID initialization data
+ * @signals_init_data: RZ SYSC signals initialization data
* @regmap_cfg: SoC-specific regmap config
+ * @num_signals: number of SYSC signals
*/
struct rz_sysc_init_data {
const struct rz_sysc_soc_id_init_data *soc_id_init_data;
+ const struct rz_sysc_signal_init_data *signals_init_data;
const struct regmap_config *regmap_cfg;
+ u32 max_register_offset;
+ u32 num_signals;
};
+extern int rz_sysc_reg_read(void *context, unsigned int off, unsigned int *val);
+extern int rz_sysc_reg_write(void *context, unsigned int off, unsigned int val);
+extern int rz_sysc_reg_update_bits(void *context, unsigned int off,
+ unsigned int mask, unsigned int val);
+
extern const struct rz_sysc_init_data rzg3e_sys_init_data;
extern const struct rz_sysc_init_data rzg3s_sysc_init_data;
extern const struct rz_sysc_init_data rzv2h_sys_init_data;
diff --git a/include/linux/soc/renesas/rz-sysc.h b/include/linux/soc/renesas/rz-sysc.h
new file mode 100644
index 000000000000..e2864ebeadf7
--- /dev/null
+++ b/include/linux/soc/renesas/rz-sysc.h
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LINUX_SOC_RENESAS_RZ_SYSC_H__
+#define __LINUX_SOC_RENESAS_RZ_SYSC_H__
+
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/regmap.h>
+
+/**
+ * struct rz_sysc_signal_map - RZ SYSC signal mapping (to be used by consummers)
+ * @regmap: SYSC regmap
+ * @offset: offset into the SYSC address space for accessing the signal
+ * @mask: mask into the register at offset for accessing the signal
+ */
+struct rz_sysc_signal_map {
+ struct regmap *regmap;
+ u32 offset;
+ u32 mask;
+};
+
+#ifdef CONFIG_SYSC_RZ
+extern struct rz_sysc_signal_map *rz_sysc_get_signal_map(struct device *dev);
+#else
+static inline struct rz_sysc_signal_map *rz_sysc_get_signal_map(struct device *dev)
+{
+ return ERR_PTR(-EOPNOTSUPP);
+}
+#endif
+
+#endif /* __LINUX_SOC_RENESAS_RZ_SYSC_H__ */
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 03/12] soc: renesas: r9a08g045-sysc: Add USB PWRRDY signal
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
2025-05-21 14:09 ` [PATCH v3 01/12] soc: renesas: rz-sysc: Add syscon/regmap support Claudiu
2025-05-21 14:09 ` [PATCH v3 02/12] soc: renesas: rz-sysc: Add signal support Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 04/12] dt-bindings: phy: renesas,usb2-phy: Mark resets as required for RZ/G3S Claudiu
` (8 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The USB PWRRDY is a SYSC signal that need to be controlled, in case of
RZ/G3S SoC, before/after the power to the USB PHYs is turned on/off. Add
the USB PWRRDY signal.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- none, this patch is new and obtained from [1]
[1] https://lore.kernel.org/all/20241126092050.1825607-3-claudiu.beznea.uj@bp.renesas.com/
drivers/soc/renesas/r9a08g045-sysc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/soc/renesas/r9a08g045-sysc.c b/drivers/soc/renesas/r9a08g045-sysc.c
index d2c9e3b77f41..7e6b5edf9666 100644
--- a/drivers/soc/renesas/r9a08g045-sysc.c
+++ b/drivers/soc/renesas/r9a08g045-sysc.c
@@ -5,11 +5,21 @@
* Copyright (C) 2024 Renesas Electronics Corp.
*/
+#include <linux/array_size.h>
#include <linux/bits.h>
#include <linux/init.h>
#include "rz-sysc.h"
+static const struct rz_sysc_signal_init_data rzg3s_sysc_signals_init_data[] __initconst = {
+ {
+ .name = "usb-pwrrdy",
+ .offset = 0xd70,
+ .mask = BIT(0),
+ .refcnt_incr_val = 0
+ }
+};
+
static const struct rz_sysc_soc_id_init_data rzg3s_sysc_soc_id_init_data __initconst = {
.family = "RZ/G3S",
.id = 0x85e0447,
@@ -33,4 +43,6 @@ static const struct regmap_config rzg3s_sysc_regmap __initconst = {
const struct rz_sysc_init_data rzg3s_sysc_init_data __initconst = {
.soc_id_init_data = &rzg3s_sysc_soc_id_init_data,
.regmap_cfg = &rzg3s_sysc_regmap,
+ .signals_init_data = rzg3s_sysc_signals_init_data,
+ .num_signals = ARRAY_SIZE(rzg3s_sysc_signals_init_data),
};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 04/12] dt-bindings: phy: renesas,usb2-phy: Mark resets as required for RZ/G3S
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (2 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 03/12] soc: renesas: r9a08g045-sysc: Add USB PWRRDY signal Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals Claudiu
` (7 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea, Conor Dooley
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The reset lines are mandatory for the Renesas RZ/G3S platform and must be
explicitly defined in device tree.
Fixes: f3c849855114 ("dt-bindings: phy: renesas,usb2-phy: Document RZ/G3S phy bindings")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- collected tags
- rebased on top of latest version of renesas,usb2-phy.yaml;
Conor, Geert: I kept your tags; please let me know if you consider it
otherwise
Changes in v2:
- none; this patch is new
Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
index 2822dce8d9f4..12f8d5d8af55 100644
--- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
@@ -108,6 +108,7 @@ allOf:
contains:
enum:
- renesas,usb2-phy-r9a09g057
+ - renesas,usb2-phy-r9a08g045
- renesas,rzg2l-usb2-phy
then:
properties:
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (3 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 04/12] dt-bindings: phy: renesas,usb2-phy: Mark resets as required for RZ/G3S Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-22 7:03 ` Krzysztof Kozlowski
2025-05-21 14:09 ` [PATCH v3 06/12] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe() Claudiu
` (6 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
On the Renesas RZ/G3S SoC, the USB PHY receives a signal from the system
controller that need to be de-asserted/asserted when power is turned
on/off. This signal, called PWRRDY, is controlled through a specific
register in the system controller memory space.
Add the renesas,sysc-signals DT property to describe the relation b/w the
system controller and the USB PHY on the Renesas RZ/G3S. This property
provides a phandle to the system controller, along with the offset within
the system controller memory space that manages the signal and a bitmask
that indicates the specific bits required to control the signal.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- replace renesas,sysc-signal with renesas,sysc-signals for case where
more than 1 signal should be described with this property
- Geert: due to this I dropped you tag
Changes in v2:
- none; this patch is new
.../bindings/phy/renesas,usb2-phy.yaml | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
index 12f8d5d8af55..e1e773cba847 100644
--- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
@@ -86,6 +86,16 @@ properties:
dr_mode: true
+ renesas,sysc-signals:
+ description: System controller phandle, specifying the register
+ offset and bitmask associated with a specific system controller signal
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ items:
+ - items:
+ - description: system controller phandle
+ - description: register offset associated with a signal
+ - description: register bitmask associated with a signal
+
if:
properties:
compatible:
@@ -117,6 +127,18 @@ allOf:
required:
- resets
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: renesas,usb2-phy-r9a08g045
+ then:
+ required:
+ - renesas,sysc-signals
+ else:
+ properties:
+ renesas,sysc-signals: false
+
additionalProperties: false
examples:
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 06/12] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe()
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (4 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 07/12] phy: renesas: rcar-gen3-usb2: Add support for USB PWRRDY signal Claudiu
` (5 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Christophe JAILLET, Claudiu Beznea
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
If an error occurs after the reset_control_deassert(),
reset_control_assert() must be called, as already done in the remove
function.
Use devm_add_action_or_reset() to add the missing call and simplify the
.remove() function accordingly.
Fixes: 4eae16375357 ("phy: renesas: rcar-gen3-usb2: Add support to initialize the bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
[claudiu.beznea: removed "struct reset_control *rstc = data;" from
rcar_gen3_reset_assert()]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- collected tags
Changes in v2:
- none; this patch is new; re-spinned the Christophe's work at
https://lore.kernel.org/all/TYCPR01MB113329930BA5E2149C9BE2A1986672@TYCPR01MB11332.jpnprd01.prod.outlook.com/
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 47beb94cd424..d61c171d454f 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -699,6 +699,11 @@ static enum usb_dr_mode rcar_gen3_get_dr_mode(struct device_node *np)
return candidate;
}
+static void rcar_gen3_reset_assert(void *data)
+{
+ reset_control_assert(data);
+}
+
static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel)
{
struct device *dev = channel->dev;
@@ -717,6 +722,11 @@ static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel)
if (ret)
goto rpm_put;
+ ret = devm_add_action_or_reset(dev, rcar_gen3_reset_assert,
+ channel->rstc);
+ if (ret)
+ goto rpm_put;
+
val = readl(channel->base + USB2_AHB_BUS_CTR);
val &= ~USB2_AHB_BUS_CTR_MBL_MASK;
val |= USB2_AHB_BUS_CTR_MBL_INCR4;
@@ -860,7 +870,6 @@ static void rcar_gen3_phy_usb2_remove(struct platform_device *pdev)
if (channel->is_otg_channel)
device_remove_file(&pdev->dev, &dev_attr_role);
- reset_control_assert(channel->rstc);
pm_runtime_disable(&pdev->dev);
};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 07/12] phy: renesas: rcar-gen3-usb2: Add support for USB PWRRDY signal
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (5 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 06/12] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe() Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: " Claudiu
` (4 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
On the Renesas RZ/G3S SoC, the USB PHY block has an input signal called
PWRRDY. This signal is managed by the system controller and must be
de-asserted after powering on the area where USB PHY resides and asserted
before powering it off.
On power-on the USB PWRRDY signal need to be de-asserted before enabling
clock and switching the module to normal state (though MSTOP support). The
power-on configuration sequence must be:
1/ PWRRDY=0
2/ CLK_ON=1
3/ MSTOP=0
On power-off the configuration sequence should be:
1/ MSTOP=1
2/ CLK_ON=0
3/ PWRRDY=1
The CLK_ON and MSTOP functionalities are controlled by clock drivers.
After long discussions with the internal HW team, it has been confirmed
that the HW connection b/w USB PHY block, the USB channels, the system
controller, clock, MSTOP, PWRRDY signal is as follows:
┌──────────────────────────────┐
│ │◄── CPG_CLKON_USB.CLK0_ON
│ USB CH0 │
┌──────────────────────────┐ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK2_ON
│ ┌────────┐ ││host controller registers │ │
│ │ │ ││function controller registers│
│ │ PHY0 │◄──┤└───────────────────────────┘ │
│ USB PHY │ │ └────────────▲─────────────────┘
│ └────────┘ │
│ │ CPG_BUS_PERI_COM_MSTOP.MSTOP{6, 5}_ON
│┌──────────────┐ ┌────────┐
││USHPHY control│ │ │
││ registers │ │ PHY1 │ ┌──────────────────────────────┐
│└──────────────┘ │ │◄──┤ USB CH1 │
│ └────────┘ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK1_ON
└─▲───────▲─────────▲──────┘ ││ host controller registers │ │
│ │ │ │└───────────────────────────┘ │
│ │ │ └────────────▲─────────────────┘
│ │ │ │
│ │ │ CPG_BUS_PERI_COM_MSTOP.MSTOP7_ON
│PWRRDY │ │
│ │ CPG_CLK_ON_USB.CLK3_ON
│ │
│ CPG_BUS_PERI_COM_MSTOP.MSTOP4_ON
│
┌────┐
│SYSC│
└────┘
where:
- CPG_CLKON_USB.CLK.CLKX_ON is the register bit controlling the clock X
of different USB blocks, X in {0, 1, 2, 3}
- CPG_BUS_PERI_COM_MSTOP.MSTOPX_ON is the register bit controlling the
MSTOP of different USB blocks, X in {4, 5, 6, 7}
- USB PHY is the USB PHY block exposing 2 ports, port0 and port1, used
by the USB CH0, USB CH1
- SYSC is the system controller block controlling the PWRRDY signal
- USB CHx are individual USB block with host and function capabilities
(USB CH0 have both host and function capabilities, USB CH1 has only
host capabilities)
The USBPHY control registers are controlled though the
reset-rzg2l-usbphy-ctrl driver (drivers/reset/reset-rzg2l-usbphy-ctrl.c file).
The USB PHY ports are controlled by phy_rcar_gen3_usb2 driver. The
USB PHY ports requests resets from the reset-rzg2l-usbphy-ctrl driver.
The connection b/w the system controller and the USB PHY drivers is
implemented through the renesas,sysc-signals device tree property. This
property specifies the register offset and the bitmask required to control
the signal. The system controller exports the syscon regmap, and the
read/write access to the memory area of the PWRRDY signal is
reference-counted, as the same system controller signal is provided to
both phy_rcar_gen3_usb2 and reset-rzg2l-usbphy-ctrl drivers.
This approach was chosen to avoid any violation of the configuration
sequence b/w PWRRDY, CLK_ON and MSTOP bits specified above.
Add support for PWRRDY in phy_rcar_gen3_usb2 driver.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- uses struct rz_sysc_signal_map along with rz_sysc_get_signal_map()
to handle the USB PWRRDY signal
- dropped the check of pwrrdy in rcar_gen3_phy_usb2_set_pwrrdy()
- improved the patch description
Changes in v2:
- none; this patch is new
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 40 ++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index d61c171d454f..ca50db84a90b 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -19,8 +19,10 @@
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
+#include <linux/soc/renesas/rz-sysc.h>
#include <linux/string.h>
#include <linux/usb/of.h>
#include <linux/workqueue.h>
@@ -126,6 +128,7 @@ struct rcar_gen3_chan {
struct rcar_gen3_phy rphys[NUM_OF_PHYS];
struct regulator *vbus;
struct reset_control *rstc;
+ struct rz_sysc_signal_map *pwrrdy;
struct work_struct work;
spinlock_t lock; /* protects access to hardware and driver data structure. */
enum usb_dr_mode dr_mode;
@@ -142,6 +145,7 @@ struct rcar_gen3_phy_drv_data {
bool no_adp_ctrl;
bool init_bus;
bool utmi_ctrl;
+ bool pwrrdy;
};
/*
@@ -608,6 +612,7 @@ static const struct rcar_gen3_phy_drv_data rz_g3s_phy_usb2_data = {
.phy_usb2_ops = &rcar_gen3_phy_usb2_ops,
.no_adp_ctrl = true,
.init_bus = true,
+ .pwrrdy = true,
};
static const struct rcar_gen3_phy_drv_data rz_v2h_phy_usb2_data = {
@@ -738,6 +743,35 @@ static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel)
return ret;
}
+static void rcar_gen3_phy_usb2_set_pwrrdy(struct rcar_gen3_chan *channel, bool power_on)
+{
+ struct rz_sysc_signal_map *pwrrdy = channel->pwrrdy;
+
+ regmap_update_bits(pwrrdy->regmap, pwrrdy->offset, pwrrdy->mask, !power_on);
+}
+
+static void rcar_gen3_phy_usb2_pwrrdy_off(void *data)
+{
+ rcar_gen3_phy_usb2_set_pwrrdy(data, false);
+}
+
+static int rcar_gen3_phy_usb2_init_pwrrdy(struct rcar_gen3_chan *channel)
+{
+ struct device *dev = channel->dev;
+ struct rz_sysc_signal_map *pwrrdy;
+
+ pwrrdy = rz_sysc_get_signal_map(dev);
+ if (IS_ERR(pwrrdy))
+ return PTR_ERR(pwrrdy);
+
+ channel->pwrrdy = pwrrdy;
+
+ /* Power it ON. */
+ rcar_gen3_phy_usb2_set_pwrrdy(channel, true);
+
+ return devm_add_action_or_reset(dev, rcar_gen3_phy_usb2_pwrrdy_off, channel);
+}
+
static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
{
const struct rcar_gen3_phy_drv_data *phy_data;
@@ -792,6 +826,12 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, channel);
channel->dev = dev;
+ if (phy_data->pwrrdy) {
+ ret = rcar_gen3_phy_usb2_init_pwrrdy(channel);
+ if (ret)
+ goto error;
+ }
+
if (phy_data->init_bus) {
ret = rcar_gen3_phy_usb2_init_bus(channel);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY signal
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (6 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 07/12] phy: renesas: rcar-gen3-usb2: Add support for USB PWRRDY signal Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-22 11:29 ` kernel test robot
2025-05-21 14:09 ` [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support Claudiu
` (3 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
On the Renesas RZ/G3S SoC, the USB PHY block has an input signal called
PWRRDY. This signal is managed by the system controller and must be
de-asserted after powering on the area where USB PHY resides and asserted
before powering it off.
On power-on the USB PWRRDY signal need to be de-asserted before enabling
clock and switching the module to normal state (though MSTOP support). The
power-on configuration sequence must be:
1/ PWRRDY=0
2/ CLK_ON=1
3/ MSTOP=0
On power-off the configuration sequence should be:
1/ MSTOP=1
2/ CLK_ON=0
3/ PWRRDY=1
The CLK_ON and MSTOP functionalities are controlled by clock drivers.
After long discussions with the internal HW team, it has been confirmed
that the HW connection b/w USB PHY block, the USB channels, the system
controller, clock, MSTOP, PWRRDY signal is as follows:
┌──────────────────────────────┐
│ │◄── CPG_CLKON_USB.CLK0_ON
│ USB CH0 │
┌──────────────────────────┐ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK2_ON
│ ┌────────┐ ││host controller registers │ │
│ │ │ ││function controller registers│
│ │ PHY0 │◄──┤└───────────────────────────┘ │
│ USB PHY │ │ └────────────▲─────────────────┘
│ └────────┘ │
│ │ CPG_BUS_PERI_COM_MSTOP.MSTOP{6, 5}_ON
│┌──────────────┐ ┌────────┐
││USHPHY control│ │ │
││ registers │ │ PHY1 │ ┌──────────────────────────────┐
│└──────────────┘ │ │◄──┤ USB CH1 │
│ └────────┘ │┌───────────────────────────┐ │◄── CPG_CLKON_USB.CLK1_ON
└─▲───────▲─────────▲──────┘ ││ host controller registers │ │
│ │ │ │└───────────────────────────┘ │
│ │ │ └────────────▲─────────────────┘
│ │ │ │
│ │ │ CPG_BUS_PERI_COM_MSTOP.MSTOP7_ON
│PWRRDY │ │
│ │ CPG_CLK_ON_USB.CLK3_ON
│ │
│ CPG_BUS_PERI_COM_MSTOP.MSTOP4_ON
│
┌────┐
│SYSC│
└────┘
where:
- CPG_CLKON_USB.CLK.CLKX_ON is the register bit controlling the clock X
of different USB blocks, X in {0, 1, 2, 3}
- CPG_BUS_PERI_COM_MSTOP.MSTOPX_ON is the register bit controlling the
MSTOP of different USB blocks, X in {4, 5, 6, 7}
- USB PHY is the USB PHY block exposing 2 ports, port0 and port1, used
by the USB CH0, USB CH1
- SYSC is the system controller block controlling the PWRRDY signal
- USB CHx are individual USB block with host and function capabilities
(USB CH0 have both host and function capabilities, USB CH1 has only
host capabilities)
The USBPHY control registers are controlled though the
reset-rzg2l-usbphy-ctrl driver. The USB PHY ports are controlled by
phy_rcar_gen3_usb2 (drivers/phy/renesas/phy-rcar-gen3-usb2.c file). The
USB PHY ports requests resets from the reset-rzg2l-usbphy-ctrl driver.
The connection b/w the system controller and the USB PHY drivers is
implemented through the renesas,sysc-signals device tree property. This
property specifies the register offset and the bitmask required to control
the signal. The system controller exports the syscon regmap, and the
read/write access to the memory area of the PWRRDY signal is
reference-counted, as the same system controller signal is provided to
the PHY driver and the reset-rzg2l-usbphy-ctrl.
This approach was chosen to avoid any violation of the configuration
sequence b/w PWRRDY, CLK_ON and MSTOP bits specified above.
Add support for PWRRDY in reset-rzg2l-usbphy-ctrl driver.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- none; this patch is new
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 42 +++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 8a7f167e405e..016aae883b2e 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -13,6 +13,7 @@
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/reset-controller.h>
+#include <linux/soc/renesas/rz-sysc.h>
#define RESET 0x000
#define VBENCTL 0x03c
@@ -35,6 +36,7 @@ struct rzg2l_usbphy_ctrl_priv {
struct reset_control *rstc;
void __iomem *base;
struct platform_device *vdev;
+ struct rz_sysc_signal_map *pwrrdy;
spinlock_t lock;
};
@@ -91,6 +93,8 @@ static int rzg2l_usbphy_ctrl_status(struct reset_controller_dev *rcdev,
return !!(readl(priv->base + RESET) & port_mask);
}
+#define RZG2L_USBPHY_CTRL_PWRRDY 1
+
static const struct of_device_id rzg2l_usbphy_ctrl_match_table[] = {
{ .compatible = "renesas,rzg2l-usbphy-ctrl" },
{ /* Sentinel */ }
@@ -110,6 +114,40 @@ static const struct regmap_config rzg2l_usb_regconf = {
.max_register = 1,
};
+static void rzg2l_usbphy_ctrl_set_pwrrdy(struct rzg2l_usbphy_ctrl_priv *priv,
+ bool power_on)
+{
+ struct rz_sysc_signal_map *pwrrdy = priv->pwrrdy;
+
+ regmap_update_bits(pwrrdy->regmap, pwrrdy->offset, pwrrdy->mask, !power_on);
+}
+
+static void rzg2l_usbphy_ctrl_pwrrdy_off(void *data)
+{
+ rzg2l_usbphy_ctrl_set_pwrrdy(data, false);
+}
+
+static int rzg2l_usbphy_ctrl_pwrrdy_init(struct device *dev,
+ struct rzg2l_usbphy_ctrl_priv *priv)
+{
+ struct rz_sysc_signal_map *pwrrdy;
+ const int *data;
+
+ data = device_get_match_data(dev);
+ if (data != (int *)RZG2L_USBPHY_CTRL_PWRRDY)
+ return 0;
+
+ pwrrdy = rz_sysc_get_signal_map(dev);
+ if (IS_ERR(pwrrdy))
+ return PTR_ERR(pwrrdy);
+
+ priv->pwrrdy = pwrrdy;
+
+ rzg2l_usbphy_ctrl_set_pwrrdy(priv, true);
+
+ return devm_add_action_or_reset(dev, rzg2l_usbphy_ctrl_pwrrdy_off, priv);
+}
+
static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -132,6 +170,10 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
+ error = rzg2l_usbphy_ctrl_pwrrdy_init(dev, priv);
+ if (error)
+ return error;
+
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (IS_ERR(priv->rstc))
return dev_err_probe(dev, PTR_ERR(priv->rstc),
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (7 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: " Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-22 7:05 ` Krzysztof Kozlowski
2025-05-21 14:09 ` [PATCH v3 10/12] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC Claudiu
` (2 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The Renesas USB PHY hardware block receives an input signal from the system
controller. This signal must be controlled during power-on, power-off, and
system suspend/resume sequences as follows:
- during power-on/resume, it must be de-asserted before enabling clocks and
modules
- during power-off/suspend, it must be asserted after disabling clocks and
modules
Add the renesas,sysc-signals device tree property, which allows the
reset-rzg2l-usbphy-ctrl driver to parse, map, and control the system
controller signal at the appropriate time. Along with it add a new
compatible for the RZ/G3S SoC.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- none; this patch is new
.../reset/renesas,rzg2l-usbphy-ctrl.yaml | 38 ++++++++++++++++---
1 file changed, 32 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
index b0b20af15313..75134330f797 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
+++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
@@ -15,12 +15,15 @@ description:
properties:
compatible:
- items:
- - enum:
- - renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
- - renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
- - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
- - const: renesas,rzg2l-usbphy-ctrl
+ oneOf:
+ - items:
+ - enum:
+ - renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
+ - renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
+ - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
+ - const: renesas,rzg2l-usbphy-ctrl
+
+ - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
reg:
maxItems: 1
@@ -48,6 +51,16 @@ properties:
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
+ renesas,sysc-signals:
+ description: System controller phandle, specifying the register
+ offset and bitmask associated with a specific system controller signal
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ items:
+ - items:
+ - description: system controller phandle
+ - description: register offset associated with a signal
+ - description: register bitmask associated with a signal
+
required:
- compatible
- reg
@@ -57,6 +70,19 @@ required:
- '#reset-cells'
- regulator-vbus
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: renesas,r9a08g045-usbphy-ctrl
+ then:
+ required:
+ - renesas,sysc-signals
+ else:
+ properties:
+ renesas,sysc-signals: false
+
additionalProperties: false
examples:
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 10/12] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (8 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 11/12] arm64: dts: renesas: r9a08g045: Add USB support Claudiu
2025-05-21 14:09 ` [PATCH v3 12/12] arm64: dts: renesas: rzg3s-smarc: Enable " Claudiu
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The Renesas RZ/G3S SoC USB PHY HW block receives as input the USB PWRRDY
signal from the system controller. Add support for the Renesas RZ/G3S SoC.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- none; this patch is new
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 016aae883b2e..98d6323e9f56 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -97,6 +97,10 @@ static int rzg2l_usbphy_ctrl_status(struct reset_controller_dev *rcdev,
static const struct of_device_id rzg2l_usbphy_ctrl_match_table[] = {
{ .compatible = "renesas,rzg2l-usbphy-ctrl" },
+ {
+ .compatible = "renesas,r9a08g045-usbphy-ctrl",
+ .data = (void *)RZG2L_USBPHY_CTRL_PWRRDY
+ },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, rzg2l_usbphy_ctrl_match_table);
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 11/12] arm64: dts: renesas: r9a08g045: Add USB support
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (9 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 10/12] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC Claudiu
@ 2025-05-21 14:09 ` Claudiu
2025-05-21 14:09 ` [PATCH v3 12/12] arm64: dts: renesas: rzg3s-smarc: Enable " Claudiu
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Add USB nodes for the Renesas RZ/G3S SoC. This consists of PHY reset,
host and device support.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- changed the nodes order to keep similar nodes toghether
Changes in v2:
- this was patch 14/16 in v1
- added renesas,sysc-signal properties to USB PHYs
- collected tags
- Geert: I kept your tag; please let me know if you consider otherwise
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 120 +++++++++++++++++++++
1 file changed, 120 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
index 0364f89776e6..e329c55c3fad 100644
--- a/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a08g045.dtsi
@@ -681,6 +681,126 @@ eth1: ethernet@11c40000 {
status = "disabled";
};
+ phyrst: usbphy-ctrl@11e00000 {
+ compatible = "renesas,r9a08g045-usbphy-ctrl";
+ reg = <0 0x11e00000 0 0x10000>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>;
+ resets = <&cpg R9A08G045_USB_PRESETN>;
+ power-domains = <&cpg>;
+ #reset-cells = <1>;
+ renesas,sysc-signals = <&sysc 0xd70 0x1>;
+ status = "disabled";
+
+ usb0_vbus_otg: regulator-vbus {
+ regulator-name = "vbus";
+ };
+ };
+
+ ohci0: usb@11e10000 {
+ compatible = "generic-ohci";
+ reg = <0 0x11e10000 0 0x100>;
+ interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H0_HCLK>;
+ resets = <&phyrst 0>,
+ <&cpg R9A08G045_USB_U2H0_HRESETN>;
+ phys = <&usb2_phy0 1>;
+ phy-names = "usb";
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ ohci1: usb@11e30000 {
+ compatible = "generic-ohci";
+ reg = <0 0x11e30000 0 0x100>;
+ interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H1_HCLK>;
+ resets = <&phyrst 1>,
+ <&cpg R9A08G045_USB_U2H1_HRESETN>;
+ phys = <&usb2_phy1 1>;
+ phy-names = "usb";
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ ehci0: usb@11e10100 {
+ compatible = "generic-ehci";
+ reg = <0 0x11e10100 0 0x100>;
+ interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H0_HCLK>;
+ resets = <&phyrst 0>,
+ <&cpg R9A08G045_USB_U2H0_HRESETN>;
+ phys = <&usb2_phy0 2>;
+ phy-names = "usb";
+ companion = <&ohci0>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ ehci1: usb@11e30100 {
+ compatible = "generic-ehci";
+ reg = <0 0x11e30100 0 0x100>;
+ interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H1_HCLK>;
+ resets = <&phyrst 1>,
+ <&cpg R9A08G045_USB_U2H1_HRESETN>;
+ phys = <&usb2_phy1 2>;
+ phy-names = "usb";
+ companion = <&ohci1>;
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
+ usb2_phy0: usb-phy@11e10200 {
+ compatible = "renesas,usb2-phy-r9a08g045";
+ reg = <0 0x11e10200 0 0x700>;
+ interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H0_HCLK>;
+ resets = <&phyrst 0>,
+ <&cpg R9A08G045_USB_U2H0_HRESETN>;
+ #phy-cells = <1>;
+ power-domains = <&cpg>;
+ renesas,sysc-signals = <&sysc 0xd70 0x1>;
+ status = "disabled";
+ };
+
+ usb2_phy1: usb-phy@11e30200 {
+ compatible = "renesas,usb2-phy-r9a08g045";
+ reg = <0 0x11e30200 0 0x700>;
+ interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2H1_HCLK>;
+ resets = <&phyrst 1>,
+ <&cpg R9A08G045_USB_U2H1_HRESETN>;
+ #phy-cells = <1>;
+ power-domains = <&cpg>;
+ renesas,sysc-signals = <&sysc 0xd70 0x1>;
+ status = "disabled";
+ };
+
+ hsusb: usb@11e20000 {
+ compatible = "renesas,usbhs-r9a08g045",
+ "renesas,rzg2l-usbhs";
+ reg = <0 0x11e20000 0 0x10000>;
+ interrupts = <GIC_SPI 85 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&cpg CPG_MOD R9A08G045_USB_PCLK>,
+ <&cpg CPG_MOD R9A08G045_USB_U2P_EXR_CPUCLK>;
+ resets = <&phyrst 0>,
+ <&cpg R9A08G045_USB_U2P_EXL_SYSRST>;
+ renesas,buswait = <7>;
+ phys = <&usb2_phy0 3>;
+ phy-names = "usb";
+ power-domains = <&cpg>;
+ status = "disabled";
+ };
+
gic: interrupt-controller@12400000 {
compatible = "arm,gic-v3";
#interrupt-cells = <3>;
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v3 12/12] arm64: dts: renesas: rzg3s-smarc: Enable USB support
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
` (10 preceding siblings ...)
2025-05-21 14:09 ` [PATCH v3 11/12] arm64: dts: renesas: r9a08g045: Add USB support Claudiu
@ 2025-05-21 14:09 ` Claudiu
11 siblings, 0 replies; 22+ messages in thread
From: Claudiu @ 2025-05-21 14:09 UTC (permalink / raw)
To: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz
Cc: claudiu.beznea, linux-phy, devicetree, linux-kernel,
linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Enable USB support (host, device, USB PHYs).
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v3:
- collected tags
Changes in v2:
- this was patch 15/16 in v1:
- dropped sysc enablement as it is now done in SoC dtsi file
arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 57 ++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
index 5e044a4d0234..5586dd43c4d5 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
@@ -92,6 +92,20 @@ &audio_clk2 {
clock-frequency = <12288000>;
};
+&ehci0 {
+ dr_mode = "otg";
+ status = "okay";
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&hsusb {
+ dr_mode = "otg";
+ status = "okay";
+};
+
&i2c0 {
status = "okay";
@@ -132,6 +146,15 @@ power-monitor@44 {
};
};
+&ohci0 {
+ dr_mode = "otg";
+ status = "okay";
+};
+
+&ohci1 {
+ status = "okay";
+};
+
&pinctrl {
audio_clock_pins: audio-clock {
pins = "AUDIO_CLK1", "AUDIO_CLK2";
@@ -207,6 +230,27 @@ ssi3_pins: ssi3 {
<RZG2L_PORT_PINMUX(18, 4, 8)>, /* TXD */
<RZG2L_PORT_PINMUX(18, 5, 8)>; /* RXD */
};
+
+ usb0_pins: usb0 {
+ peri {
+ pinmux = <RZG2L_PORT_PINMUX(5, 0, 1)>, /* VBUS */
+ <RZG2L_PORT_PINMUX(5, 2, 1)>; /* OVC */
+ };
+
+ otg {
+ pinmux = <RZG2L_PORT_PINMUX(5, 3, 1)>; /* OTG_ID */
+ bias-pull-up;
+ };
+ };
+
+ usb1_pins: usb1 {
+ pinmux = <RZG2L_PORT_PINMUX(5, 4, 5)>, /* OVC */
+ <RZG2L_PORT_PINMUX(6, 0, 1)>; /* VBUS */
+ };
+};
+
+&phyrst {
+ status = "okay";
};
&scif0 {
@@ -242,3 +286,16 @@ &ssi3 {
pinctrl-0 = <&ssi3_pins>, <&audio_clock_pins>;
status = "okay";
};
+
+&usb2_phy0 {
+ pinctrl-0 = <&usb0_pins>;
+ pinctrl-names = "default";
+ vbus-supply = <&usb0_vbus_otg>;
+ status = "okay";
+};
+
+&usb2_phy1 {
+ pinctrl-0 = <&usb1_pins>;
+ pinctrl-names = "default";
+ status = "okay";
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-21 14:09 ` [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals Claudiu
@ 2025-05-22 7:03 ` Krzysztof Kozlowski
2025-05-22 10:26 ` Claudiu Beznea
0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 7:03 UTC (permalink / raw)
To: Claudiu
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On Wed, May 21, 2025 at 05:09:36PM GMT, Claudiu wrote:
> .../bindings/phy/renesas,usb2-phy.yaml | 22 +++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
> index 12f8d5d8af55..e1e773cba847 100644
> --- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
> @@ -86,6 +86,16 @@ properties:
>
> dr_mode: true
>
> + renesas,sysc-signals:
> + description: System controller phandle, specifying the register
> + offset and bitmask associated with a specific system controller signal
This is 100% redundant information. system controller specifying system
controller signal.
Drop.
> + $ref: /schemas/types.yaml#/definitions/phandle-array
> + items:
> + - items:
> + - description: system controller phandle
What for? Explain the usage. How is ut used by this hardware.
> + - description: register offset associated with a signal
What signal? That's a phy.
> + - description: register bitmask associated with a signal
> +
> if:
> properties:
> compatible:
> @@ -117,6 +127,18 @@ allOf:
> required:
> - resets
>
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: renesas,usb2-phy-r9a08g045
> + then:
> + required:
> + - renesas,sysc-signals
That's ABI break.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support
2025-05-21 14:09 ` [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support Claudiu
@ 2025-05-22 7:05 ` Krzysztof Kozlowski
0 siblings, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 7:05 UTC (permalink / raw)
To: Claudiu
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On Wed, May 21, 2025 at 05:09:40PM GMT, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> The Renesas USB PHY hardware block receives an input signal from the system
> controller. This signal must be controlled during power-on, power-off, and
> system suspend/resume sequences as follows:
> - during power-on/resume, it must be de-asserted before enabling clocks and
> modules
> - during power-off/suspend, it must be asserted after disabling clocks and
> modules
>
> Add the renesas,sysc-signals device tree property, which allows the
> reset-rzg2l-usbphy-ctrl driver to parse, map, and control the system
> controller signal at the appropriate time. Along with it add a new
> compatible for the RZ/G3S SoC.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
>
> Changes in v3:
> - none; this patch is new
>
> .../reset/renesas,rzg2l-usbphy-ctrl.yaml | 38 ++++++++++++++++---
> 1 file changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> index b0b20af15313..75134330f797 100644
> --- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> +++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
> @@ -15,12 +15,15 @@ description:
>
> properties:
> compatible:
> - items:
> - - enum:
> - - renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
> - - renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
> - - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
> - - const: renesas,rzg2l-usbphy-ctrl
> + oneOf:
> + - items:
> + - enum:
> + - renesas,r9a07g043-usbphy-ctrl # RZ/G2UL and RZ/Five
> + - renesas,r9a07g044-usbphy-ctrl # RZ/G2{L,LC}
> + - renesas,r9a07g054-usbphy-ctrl # RZ/V2L
> + - const: renesas,rzg2l-usbphy-ctrl
> +
Drop blank line
> + - const: renesas,r9a08g045-usbphy-ctrl # RZ/G3S
>
> reg:
> maxItems: 1
> @@ -48,6 +51,16 @@ properties:
> $ref: /schemas/regulator/regulator.yaml#
> unevaluatedProperties: false
>
> + renesas,sysc-signals:
> + description: System controller phandle, specifying the register
> + offset and bitmask associated with a specific system controller signal
Same comments.
> + $ref: /schemas/types.yaml#/definitions/phandle-array
> + items:
> + - items:
> + - description: system controller phandle
> + - description: register offset associated with a signal
> + - description: register bitmask associated with a signal
> +
> required:
> - compatible
> - reg
> @@ -57,6 +70,19 @@ required:
> - '#reset-cells'
> - regulator-vbus
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 7:03 ` Krzysztof Kozlowski
@ 2025-05-22 10:26 ` Claudiu Beznea
2025-05-22 12:46 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Claudiu Beznea @ 2025-05-22 10:26 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
Hi, Krzysztof,
On 22.05.2025 10:03, Krzysztof Kozlowski wrote:
> On Wed, May 21, 2025 at 05:09:36PM GMT, Claudiu wrote:
>> .../bindings/phy/renesas,usb2-phy.yaml | 22 +++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>> index 12f8d5d8af55..e1e773cba847 100644
>> --- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>> @@ -86,6 +86,16 @@ properties:
>>
>> dr_mode: true
>>
>> + renesas,sysc-signals:
>> + description: System controller phandle, specifying the register
>> + offset and bitmask associated with a specific system controller signal
>
> This is 100% redundant information. system controller specifying system
> controller signal.
>
> Drop.
>
>
>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>> + items:
>> + - items:
>> + - description: system controller phandle
>
> What for? Explain the usage. How is ut used by this hardware.
OK, I though I've explained in the renesas,sysc-signals description
section. I'll adjust it and move it here.
>
>> + - description: register offset associated with a signal
>
> What signal? That's a phy.
Would you like me to specify here exactly the signal name? I tried to made
it generic as the system controller provides other signals to other IPs,
the intention was to use the same property for other IPs, if any. And kept
it generic in the idea it could be used in future, if any, for other
signals provided by the system controller to the USB PHY.
As explained in the commit description, on the Renesas RZ/G3S SoC, the USB
PHY receives a signal from the system controller that need to be
de-asserted/asserted when power is turned on/off. This signal, called
PWRRDY, is controlled through a specific register in the system controller
memory space.
With this property the intention is to specify to the USB PHY driver the
phandle to the SYSC, register offset within SYSC address space in charge of
controlling the USB PWRRDY signal and the bitmask within this register.
The PHY driver parse this information and set the signal at proper moments.
>
>> + - description: register bitmask associated with a signal
>> +
>> if:
>> properties:
>> compatible:
>> @@ -117,6 +127,18 @@ allOf:
>> required:
>> - resets
>>
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + const: renesas,usb2-phy-r9a08g045
>> + then:
>> + required:
>> + - renesas,sysc-signals
>
> That's ABI break.
There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
compatible. It is introduced in patch 11/12 from this series. With this do
you still consider it ABI break?
Thank you for your review,
Claudiu
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY signal
2025-05-21 14:09 ` [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: " Claudiu
@ 2025-05-22 11:29 ` kernel test robot
0 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2025-05-22 11:29 UTC (permalink / raw)
To: Claudiu, vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel,
geert+renesas, magnus.damm, yoshihiro.shimoda.uh, kees,
gustavoars, biju.das.jz
Cc: oe-kbuild-all, claudiu.beznea, linux-phy, devicetree,
linux-kernel, linux-renesas-soc, linux-hardening, john.madieu.xa,
Claudiu Beznea
Hi Claudiu,
kernel test robot noticed the following build errors:
[auto build test ERROR on next-20250521]
[cannot apply to geert-renesas-devel/next pza/reset/next robh/for-next linus/master pza/imx-drm/next v6.15-rc7 v6.15-rc6 v6.15-rc5 v6.15-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Claudiu/soc-renesas-rz-sysc-Add-syscon-regmap-support/20250521-221703
base: next-20250521
patch link: https://lore.kernel.org/r/20250521140943.3830195-9-claudiu.beznea.uj%40bp.renesas.com
patch subject: [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: Add support for USB PWRRDY signal
config: sparc-randconfig-r111-20250522 (https://download.01.org/0day-ci/archive/20250522/202505221929.nUHscY04-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.4.0
reproduce: (https://download.01.org/0day-ci/archive/20250522/202505221929.nUHscY04-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505221929.nUHscY04-lkp@intel.com/
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "rz_sysc_get_signal_map" [drivers/reset/reset-rzg2l-usbphy-ctrl.ko] undefined!
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 10:26 ` Claudiu Beznea
@ 2025-05-22 12:46 ` Krzysztof Kozlowski
2025-05-22 12:48 ` Krzysztof Kozlowski
2025-05-22 14:38 ` Claudiu Beznea
0 siblings, 2 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 12:46 UTC (permalink / raw)
To: Claudiu Beznea
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On 22/05/2025 12:26, Claudiu Beznea wrote:
> Hi, Krzysztof,
>
> On 22.05.2025 10:03, Krzysztof Kozlowski wrote:
>> On Wed, May 21, 2025 at 05:09:36PM GMT, Claudiu wrote:
>>> .../bindings/phy/renesas,usb2-phy.yaml | 22 +++++++++++++++++++
>>> 1 file changed, 22 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>> index 12f8d5d8af55..e1e773cba847 100644
>>> --- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>> +++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>> @@ -86,6 +86,16 @@ properties:
>>>
>>> dr_mode: true
>>>
>>> + renesas,sysc-signals:
>>> + description: System controller phandle, specifying the register
>>> + offset and bitmask associated with a specific system controller signal
>>
>> This is 100% redundant information. system controller specifying system
>> controller signal.
>>
>> Drop.
>>
>>
>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>> + items:
>>> + - items:
>>> + - description: system controller phandle
>>
>> What for? Explain the usage. How is ut used by this hardware.
>
> OK, I though I've explained in the renesas,sysc-signals description
> section. I'll adjust it and move it here.
That description did not explain me at all. I mean really, which parts
explains the usage by hardware?
>
>>
>>> + - description: register offset associated with a signal
>>
>> What signal? That's a phy.
>
> Would you like me to specify here exactly the signal name? I tried to made
> it generic as the system controller provides other signals to other IPs,
> the intention was to use the same property for other IPs, if any. And kept
> it generic in the idea it could be used in future, if any, for other
> signals provided by the system controller to the USB PHY.
Bindings are not generic, so yes, you must explain here what hardware
aspect this is relevant to. What signal? Between whom?
>
> As explained in the commit description, on the Renesas RZ/G3S SoC, the USB
> PHY receives a signal from the system controller that need to be
Interrupt? Some pin changes state? What is a signal? This property is in
the USB PHY device, not system controller.
> de-asserted/asserted when power is turned on/off. This signal, called
> PWRRDY, is controlled through a specific register in the system controller
> memory space.
>
> With this property the intention is to specify to the USB PHY driver the
> phandle to the SYSC, register offset within SYSC address space in charge of
This is obvious from the schema and I asked to drop redundant parts.
> controlling the USB PWRRDY signal and the bitmask within this register.
So basically this last piece describes what this hardware needs to do
with system controller? Change some register?
>
> The PHY driver parse this information and set the signal at proper moments.
>
>
>>
>>> + - description: register bitmask associated with a signal
>>> +
>>> if:
>>> properties:
>>> compatible:
>>> @@ -117,6 +127,18 @@ allOf:
>>> required:
>>> - resets
>>>
>>> + - if:
>>> + properties:
>>> + compatible:
>>> + contains:
>>> + const: renesas,usb2-phy-r9a08g045
>>> + then:
>>> + required:
>>> + - renesas,sysc-signals
>>
>> That's ABI break.
>
> There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
> compatible. It is introduced in patch 11/12 from this series. With this do
> you still consider it ABI break?
Then this patch cannot be split from binding introducing the user. Don't
add unused/undocumented compatibles.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 12:46 ` Krzysztof Kozlowski
@ 2025-05-22 12:48 ` Krzysztof Kozlowski
2025-05-22 14:39 ` Claudiu Beznea
2025-05-22 14:38 ` Claudiu Beznea
1 sibling, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 12:48 UTC (permalink / raw)
To: Claudiu Beznea
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On 22/05/2025 14:46, Krzysztof Kozlowski wrote:
>>>>
>>>> + - if:
>>>> + properties:
>>>> + compatible:
>>>> + contains:
>>>> + const: renesas,usb2-phy-r9a08g045
>>>> + then:
>>>> + required:
>>>> + - renesas,sysc-signals
>>>
>>> That's ABI break.
>>
>> There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
>> compatible. It is introduced in patch 11/12 from this series. With this do
>> you still consider it ABI break?
>
> Then this patch cannot be split from binding introducing the user. Don't
> add unused/undocumented compatibles.
>
Or you meant DTS? I asked about ABI which is not about in-kernel users.
You can always change in-kernel users, so what would be any point of a
binding and its ABI?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 12:46 ` Krzysztof Kozlowski
2025-05-22 12:48 ` Krzysztof Kozlowski
@ 2025-05-22 14:38 ` Claudiu Beznea
1 sibling, 0 replies; 22+ messages in thread
From: Claudiu Beznea @ 2025-05-22 14:38 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On 22.05.2025 15:46, Krzysztof Kozlowski wrote:
> On 22/05/2025 12:26, Claudiu Beznea wrote:
>> Hi, Krzysztof,
>>
>> On 22.05.2025 10:03, Krzysztof Kozlowski wrote:
>>> On Wed, May 21, 2025 at 05:09:36PM GMT, Claudiu wrote:
>>>> .../bindings/phy/renesas,usb2-phy.yaml | 22 +++++++++++++++++++
>>>> 1 file changed, 22 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>>> index 12f8d5d8af55..e1e773cba847 100644
>>>> --- a/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>>> +++ b/Documentation/devicetree/bindings/phy/renesas,usb2-phy.yaml
>>>> @@ -86,6 +86,16 @@ properties:
>>>>
>>>> dr_mode: true
>>>>
>>>> + renesas,sysc-signals:
>>>> + description: System controller phandle, specifying the register
>>>> + offset and bitmask associated with a specific system controller signal
>>>
>>> This is 100% redundant information. system controller specifying system
>>> controller signal.
>>>
>>> Drop.
>>>
>>>
>>>> + $ref: /schemas/types.yaml#/definitions/phandle-array
>>>> + items:
>>>> + - items:
>>>> + - description: system controller phandle
>>>
>>> What for? Explain the usage. How is ut used by this hardware.
>>
>> OK, I though I've explained in the renesas,sysc-signals description
>> section. I'll adjust it and move it here.
>
> That description did not explain me at all. I mean really, which parts
> explains the usage by hardware?
OK, I'll detail it.
>
>
>>
>>>
>>>> + - description: register offset associated with a signal
>>>
>>> What signal? That's a phy.
>>
>> Would you like me to specify here exactly the signal name? I tried to made
>> it generic as the system controller provides other signals to other IPs,
>> the intention was to use the same property for other IPs, if any. And kept
>> it generic in the idea it could be used in future, if any, for other
>> signals provided by the system controller to the USB PHY.
>
> Bindings are not generic, so yes, you must explain here what hardware
> aspect this is relevant to. What signal? Between whom?
OK
>
>>
>> As explained in the commit description, on the Renesas RZ/G3S SoC, the USB
>> PHY receives a signal from the system controller that need to be
>
> Interrupt? Some pin changes state? What is a signal? This property is in
> the USB PHY device, not system controller.
It's just a generic signal (a line b/w 2 HW blocks, internal to the SoC)
that need to be controlled before/after power to the USB PHY block was
turned on/off.
The above schema is from cover letter a bit simplified. It details the
relation b/w USB blocks (USB CH0 uses PHY0 from USB PHY, USB CH1, uses PHY1
from USB PHY, SYSC controls and provides the PWRRDY signal that is
connected to the USB PHY):
┌──────────────────────────────┐
│ │
│ USB CH0 │
┌──────────────────────────┐ │┌───────────────────────────┐ │
│ ┌────────┐ ││host controller registers │ │
│ │ │ ││function controller registers│
│ │ PHY0 │◄──┤└───────────────────────────┘ │
│ USB PHY │ │ └──────────────────────────────┘
│ └────────┘
│ │
│┌──────────────┐ ┌────────┐
││USBPHY control│ │ │
││ registers │ │ PHY1 │ ┌──────────────────────────────┐
│└──────────────┘ │ │◄──┤ USB CH1 │
│ └────────┘ │┌───────────────────────────┐ │
└─▲────────────────────────┘ ││ host controller registers │ │
│ │└───────────────────────────┘ │
│ └──────────────────────────────┘
│
│
│PWRRDY
│
│
│
│
┌────┐
│SYSC│
└────┘
Setting the bits at address specified by the renesas,sysc-signals allows
the SYSC to assert/de-assert the PWRRDY signal. Any settings on USB PHY
need to be done after this signal was de-asserted. It's like a reset signal
(in previous versions it was modeled as such but it wasn't accepted:
https://lore.kernel.org/all/20240822152801.602318-5-claudiu.beznea.uj@bp.renesas.com/).
I'll detailed in the next version. Do you prefer to have the above diagram
in the schema itself? Or maybe in patch description?
>
>> de-asserted/asserted when power is turned on/off. This signal, called
>> PWRRDY, is controlled through a specific register in the system controller
>> memory space.
>>
>> With this property the intention is to specify to the USB PHY driver the
>> phandle to the SYSC, register offset within SYSC address space in charge of
>
> This is obvious from the schema and I asked to drop redundant parts.
>
>> controlling the USB PWRRDY signal and the bitmask within this register.
>
> So basically this last piece describes what this hardware needs to do
> with system controller? Change some register?
Yes
>
>>
>> The PHY driver parse this information and set the signal at proper moments.
>>
>>
>>>
>>>> + - description: register bitmask associated with a signal
>>>> +
>>>> if:
>>>> properties:
>>>> compatible:
>>>> @@ -117,6 +127,18 @@ allOf:
>>>> required:
>>>> - resets
>>>>
>>>> + - if:
>>>> + properties:
>>>> + compatible:
>>>> + contains:
>>>> + const: renesas,usb2-phy-r9a08g045
>>>> + then:
>>>> + required:
>>>> + - renesas,sysc-signals
>>>
>>> That's ABI break.
>>
>> There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
>> compatible. It is introduced in patch 11/12 from this series. With this do
>> you still consider it ABI break?
>
> Then this patch cannot be split from binding introducing the user. Don't
> add unused/undocumented compatibles.
The initial documentation patch was accepted from previous iterations (from
v1 [1]). At that time we didn't know the full picture above.
Thank you,
Claudiu
[1]
https://lore.kernel.org/all/20240822152801.602318-1-claudiu.beznea.uj@bp.renesas.com/
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 12:48 ` Krzysztof Kozlowski
@ 2025-05-22 14:39 ` Claudiu Beznea
2025-05-22 14:49 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Claudiu Beznea @ 2025-05-22 14:39 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On 22.05.2025 15:48, Krzysztof Kozlowski wrote:
> On 22/05/2025 14:46, Krzysztof Kozlowski wrote:
>>>>>
>>>>> + - if:
>>>>> + properties:
>>>>> + compatible:
>>>>> + contains:
>>>>> + const: renesas,usb2-phy-r9a08g045
>>>>> + then:
>>>>> + required:
>>>>> + - renesas,sysc-signals
>>>>
>>>> That's ABI break.
>>>
>>> There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
>>> compatible. It is introduced in patch 11/12 from this series. With this do
>>> you still consider it ABI break?
>>
>> Then this patch cannot be split from binding introducing the user. Don't
>> add unused/undocumented compatibles.
>>
> Or you meant DTS?
Yes, I meant in tree DTS.
> I asked about ABI which is not about in-kernel users.
> You can always change in-kernel users, so what would be any point of a
> binding and its ABI?
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals
2025-05-22 14:39 ` Claudiu Beznea
@ 2025-05-22 14:49 ` Krzysztof Kozlowski
0 siblings, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-05-22 14:49 UTC (permalink / raw)
To: Claudiu Beznea
Cc: vkoul, kishon, robh, krzk+dt, conor+dt, p.zabel, geert+renesas,
magnus.damm, yoshihiro.shimoda.uh, kees, gustavoars, biju.das.jz,
linux-phy, devicetree, linux-kernel, linux-renesas-soc,
linux-hardening, john.madieu.xa, Claudiu Beznea
On 22/05/2025 16:39, Claudiu Beznea wrote:
>
>
> On 22.05.2025 15:48, Krzysztof Kozlowski wrote:
>> On 22/05/2025 14:46, Krzysztof Kozlowski wrote:
>>>>>>
>>>>>> + - if:
>>>>>> + properties:
>>>>>> + compatible:
>>>>>> + contains:
>>>>>> + const: renesas,usb2-phy-r9a08g045
>>>>>> + then:
>>>>>> + required:
>>>>>> + - renesas,sysc-signals
>>>>>
>>>>> That's ABI break.
>>>>
>>>> There is no in kernel device tree users of "renesas,usb2-phy-r9a08g045"
>>>> compatible. It is introduced in patch 11/12 from this series. With this do
>>>> you still consider it ABI break?
>>>
>>> Then this patch cannot be split from binding introducing the user. Don't
>>> add unused/undocumented compatibles.
>>>
>> Or you meant DTS?
>
> Yes, I meant in tree DTS.
Rhetorical question (because we talked about this on mailing list many
times enough): what would be the point of any ABI if you can break it
and adjust in-tree DTS in the next patch?
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-05-22 14:50 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 14:09 [PATCH v3 00/12] Add initial USB support for the Renesas RZ/G3S SoC Claudiu
2025-05-21 14:09 ` [PATCH v3 01/12] soc: renesas: rz-sysc: Add syscon/regmap support Claudiu
2025-05-21 14:09 ` [PATCH v3 02/12] soc: renesas: rz-sysc: Add signal support Claudiu
2025-05-21 14:09 ` [PATCH v3 03/12] soc: renesas: r9a08g045-sysc: Add USB PWRRDY signal Claudiu
2025-05-21 14:09 ` [PATCH v3 04/12] dt-bindings: phy: renesas,usb2-phy: Mark resets as required for RZ/G3S Claudiu
2025-05-21 14:09 ` [PATCH v3 05/12] dt-bindings: phy: renesas,usb2-phy: Add renesas,sysc-signals Claudiu
2025-05-22 7:03 ` Krzysztof Kozlowski
2025-05-22 10:26 ` Claudiu Beznea
2025-05-22 12:46 ` Krzysztof Kozlowski
2025-05-22 12:48 ` Krzysztof Kozlowski
2025-05-22 14:39 ` Claudiu Beznea
2025-05-22 14:49 ` Krzysztof Kozlowski
2025-05-22 14:38 ` Claudiu Beznea
2025-05-21 14:09 ` [PATCH v3 06/12] phy: renesas: rcar-gen3-usb2: Fix an error handling path in rcar_gen3_phy_usb2_probe() Claudiu
2025-05-21 14:09 ` [PATCH v3 07/12] phy: renesas: rcar-gen3-usb2: Add support for USB PWRRDY signal Claudiu
2025-05-21 14:09 ` [PATCH v3 08/12] reset: rzg2l-usbphy-ctrl: " Claudiu
2025-05-22 11:29 ` kernel test robot
2025-05-21 14:09 ` [PATCH v3 09/12] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document RZ/G3S support Claudiu
2025-05-22 7:05 ` Krzysztof Kozlowski
2025-05-21 14:09 ` [PATCH v3 10/12] reset: rzg2l-usbphy-ctrl: Add support for RZ/G3S SoC Claudiu
2025-05-21 14:09 ` [PATCH v3 11/12] arm64: dts: renesas: r9a08g045: Add USB support Claudiu
2025-05-21 14:09 ` [PATCH v3 12/12] arm64: dts: renesas: rzg3s-smarc: Enable " Claudiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).