* [PATCH 00/11] Add RZ/G3E USB3.2 Gen1 Host Controller support
@ 2025-08-20 17:17 Biju
2025-08-20 17:17 ` [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY Biju
2025-08-20 17:17 ` [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver Biju
0 siblings, 2 replies; 9+ messages in thread
From: Biju @ 2025-08-20 17:17 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, Vinod Koul,
Kishon Vijay Abraham I, Philipp Zabel, Mathias Nyman,
Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Geert Uytterhoeven, Magnus Damm
Cc: Biju Das, linux-clk, linux-phy, linux-usb, devicetree,
Wesley Cheng, linux-kernel, linux-renesas-soc,
Prabhakar Mahadev Lad, Biju Das
From: Biju Das <biju.das.jz@bp.renesas.com>
Add RZ/G3E USB3.2 Gen1 Host Controller and PHY support. The USB3HOST
is compliant with the Universal Serial Bus 3.2 Specification Revision 1.0.
- Supports 1 downstream USB receptacles
- Number of SSP Gen2 or SS ports: 1
- Number of HS or FS or LS ports: 1
- Supports Super Speed Plus Gen2x1 (10 Gbps), Super Speed (5 Gbps),
High Speed (480 Mbps), Full Speed (12Mbps), and Low Speed (1.5 Mbps).
- Supports all transfer-types: Control, Bulk, Interrupt, Isochronous, and
these split-transactions.
- Supports Power Control and Over Current Detection.
Biju Das (11):
dt-bindings: clock: renesas,r9a09g047-cpg: Add USB3.0 core clocks
clk: renesas: r9a09g047: Add USB3.0 clocks/resets
dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY
phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver
usb: host: xhci-rcar: Move R-Car reg definitions
dt-bindings: usb: Document Renesas RZ/G3E USB3HOST
usb: host: xhci-plat: Add .post_resume_quirk for struct xhci_plat_priv
usb: host: xhci-rcar: Add Renesas RZ/G3E USB3 Host driver support
arm64: dts: renesas: r9a09g047: Add USB3 PHY/Host nodes
arm64: dts: renesas: r9a09g047e57-smarc: Enable USB3HOST
arm64: defconfig: Enable RZ/G3E USB3 PHY driver
.../bindings/phy/renesas,rzg3e-usb3-phy.yaml | 63 +++++
.../bindings/usb/renesas,rzg3e-xhci.yaml | 84 ++++++
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 30 +++
.../boot/dts/renesas/r9a09g047e57-smarc.dts | 10 +
.../boot/dts/renesas/renesas-smarc2.dtsi | 8 +
arch/arm64/configs/defconfig | 1 +
drivers/clk/renesas/r9a09g047-cpg.c | 9 +-
drivers/phy/renesas/Kconfig | 7 +
drivers/phy/renesas/Makefile | 1 +
drivers/phy/renesas/phy-rzg3e-usb3.c | 249 ++++++++++++++++++
drivers/usb/host/Kconfig | 2 +-
drivers/usb/host/xhci-plat.c | 14 +
drivers/usb/host/xhci-plat.h | 1 +
drivers/usb/host/xhci-rcar-regs.h | 49 ++++
drivers/usb/host/xhci-rcar.c | 100 +++----
drivers/usb/host/xhci-rzg3e-regs.h | 12 +
.../dt-bindings/clock/renesas,r9a09g047-cpg.h | 2 +
17 files changed, 596 insertions(+), 46 deletions(-)
create mode 100644 Documentation/devicetree/bindings/phy/renesas,rzg3e-usb3-phy.yaml
create mode 100644 Documentation/devicetree/bindings/usb/renesas,rzg3e-xhci.yaml
create mode 100644 drivers/phy/renesas/phy-rzg3e-usb3.c
create mode 100644 drivers/usb/host/xhci-rcar-regs.h
create mode 100644 drivers/usb/host/xhci-rzg3e-regs.h
--
2.43.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY 2025-08-20 17:17 [PATCH 00/11] Add RZ/G3E USB3.2 Gen1 Host Controller support Biju @ 2025-08-20 17:17 ` Biju 2025-08-20 20:10 ` Conor Dooley 2025-08-20 17:17 ` [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver Biju 1 sibling, 1 reply; 9+ messages in thread From: Biju @ 2025-08-20 17:17 UTC (permalink / raw) To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm Cc: Biju Das, linux-phy, devicetree, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das From: Biju Das <biju.das.jz@bp.renesas.com> Document Renesas RZ/G3E USB3.0 PHY. This IP is connected between USB3HOST and PHY module. The main functions of the module are as follows: - Reset control - Control of PHY input pins - Monitoring of PHY output pins Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- .../bindings/phy/renesas,rzg3e-usb3-phy.yaml | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/renesas,rzg3e-usb3-phy.yaml diff --git a/Documentation/devicetree/bindings/phy/renesas,rzg3e-usb3-phy.yaml b/Documentation/devicetree/bindings/phy/renesas,rzg3e-usb3-phy.yaml new file mode 100644 index 000000000000..b86dc7a291a4 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/renesas,rzg3e-usb3-phy.yaml @@ -0,0 +1,63 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/renesas,rzg3e-usb3-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas RZ/G3E USB 3.0 PHY + +maintainers: + - Biju Das <biju.das.jz@bp.renesas.com> + +properties: + compatible: + const: renesas,r9a09g047-usb3-phy + + reg: + maxItems: 1 + + clocks: + items: + - description: APB bus clock + - description: USB 2.0 PHY reference clock + - description: USB 3.0 PHY reference clock + + clock-names: + items: + - const: pclk + - const: core + - const: ref_alt_clk_p + + power-domains: + maxItems: 1 + + resets: + maxItems: 1 + + '#phy-cells': + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - power-domains + - resets + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/renesas,r9a09g047-cpg.h> + + usb-phy@15870000 { + compatible = "renesas,r9a09g047-usb3-phy"; + reg = <0x15870000 0x10000>; + clocks = <&cpg CPG_MOD 0xb0>, <&cpg CPG_CORE 13>, <&cpg CPG_CORE 12>; + clock-names = "pclk", "core", "ref_alt_clk_p"; + power-domains = <&cpg>; + resets = <&cpg 0xaa>; + #phy-cells = <0>; + }; -- 2.43.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY 2025-08-20 17:17 ` [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY Biju @ 2025-08-20 20:10 ` Conor Dooley 2025-08-20 20:12 ` Conor Dooley 0 siblings, 1 reply; 9+ messages in thread From: Conor Dooley @ 2025-08-20 20:10 UTC (permalink / raw) To: Biju Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm, Biju Das, linux-phy, devicetree, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad [-- Attachment #1.1: Type: text/plain, Size: 52 bytes --] Acked-by: Conor Dooley <conor.dooley@microchip.com> [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 112 bytes --] -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY 2025-08-20 20:10 ` Conor Dooley @ 2025-08-20 20:12 ` Conor Dooley 2025-08-21 7:18 ` Biju Das 0 siblings, 1 reply; 9+ messages in thread From: Conor Dooley @ 2025-08-20 20:12 UTC (permalink / raw) To: Biju Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm, Biju Das, linux-phy, devicetree, linux-kernel, linux-renesas-soc, Prabhakar Mahadev Lad [-- Attachment #1.1: Type: text/plain, Size: 274 bytes --] On Wed, Aug 20, 2025 at 09:10:07PM +0100, Conor Dooley wrote: > Acked-by: Conor Dooley <conor.dooley@microchip.com> Now that I look again, same applies here with the different filename and compatible. Copypaste mistake? Or why does the compatible not match the filename? [-- Attachment #1.2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] [-- Attachment #2: Type: text/plain, Size: 112 bytes --] -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY 2025-08-20 20:12 ` Conor Dooley @ 2025-08-21 7:18 ` Biju Das 2025-08-22 16:18 ` Rob Herring 0 siblings, 1 reply; 9+ messages in thread From: Biju Das @ 2025-08-21 7:18 UTC (permalink / raw) To: Conor Dooley, biju.das.au Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, magnus.damm, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad Hi Conor, Thanks for the feedback. > -----Original Message----- > From: Conor Dooley <conor@kernel.org> > Sent: 20 August 2025 21:13 > Subject: Re: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY > > On Wed, Aug 20, 2025 at 09:10:07PM +0100, Conor Dooley wrote: > > Acked-by: Conor Dooley <conor.dooley@microchip.com> > > Now that I look again, same applies here with the different filename and compatible. Copypaste mistake? > Or why does the compatible not match the filename? > r9a09g047 is SoC part number which also known as RZ/G3E SoC. I just followed the convention used in [1] and [2]. Please let me know, should I change rzg3e-usb3-phy.yaml.yaml-> r9a09g047-usb3-phy.yaml ? [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/Documentation/devicetree/bindings?h=next-20250820&id=44b91d61c505863b8ae90b7094aee5ca0dce808f [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/Documentation/devicetree/bindings?h=next-20250820&id=b2d25905366b4e6791f60e6bc76a636d1b88e6f8 Cheers, Biju -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY 2025-08-21 7:18 ` Biju Das @ 2025-08-22 16:18 ` Rob Herring 0 siblings, 0 replies; 9+ messages in thread From: Rob Herring @ 2025-08-22 16:18 UTC (permalink / raw) To: Biju Das Cc: Conor Dooley, biju.das.au, Vinod Koul, Kishon Vijay Abraham I, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, magnus.damm, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad On Thu, Aug 21, 2025 at 07:18:59AM +0000, Biju Das wrote: > Hi Conor, > > Thanks for the feedback. > > > -----Original Message----- > > From: Conor Dooley <conor@kernel.org> > > Sent: 20 August 2025 21:13 > > Subject: Re: [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY > > > > On Wed, Aug 20, 2025 at 09:10:07PM +0100, Conor Dooley wrote: > > > Acked-by: Conor Dooley <conor.dooley@microchip.com> > > > > Now that I look again, same applies here with the different filename and compatible. Copypaste mistake? > > Or why does the compatible not match the filename? > > > > r9a09g047 is SoC part number which also known as RZ/G3E SoC. > > I just followed the convention used in [1] and [2]. > Please let me know, should I change rzg3e-usb3-phy.yaml.yaml-> r9a09g047-usb3-phy.yaml ? I think it is fine as-is. Rob -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver 2025-08-20 17:17 [PATCH 00/11] Add RZ/G3E USB3.2 Gen1 Host Controller support Biju 2025-08-20 17:17 ` [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY Biju @ 2025-08-20 17:17 ` Biju 2025-09-01 16:28 ` Vinod Koul 1 sibling, 1 reply; 9+ messages in thread From: Biju @ 2025-08-20 17:17 UTC (permalink / raw) To: Vinod Koul, Kishon Vijay Abraham I, Philipp Zabel, Geert Uytterhoeven, Magnus Damm Cc: Biju Das, linux-kernel, linux-phy, linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das From: Biju Das <biju.das.jz@bp.renesas.com> Add Renesas RZ/G3E USB3.0 PHY driver. This module is connected between USB3 Host and PHY module. The main functions of this module are: 1) Reset control 2) Control of PHY input pins 3) Monitoring of PHY output pins Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/phy/renesas/Kconfig | 7 + drivers/phy/renesas/Makefile | 1 + drivers/phy/renesas/phy-rzg3e-usb3.c | 249 +++++++++++++++++++++++++++ 3 files changed, 257 insertions(+) create mode 100644 drivers/phy/renesas/phy-rzg3e-usb3.c diff --git a/drivers/phy/renesas/Kconfig b/drivers/phy/renesas/Kconfig index e342eef0640b..16211072098e 100644 --- a/drivers/phy/renesas/Kconfig +++ b/drivers/phy/renesas/Kconfig @@ -40,3 +40,10 @@ config PHY_RCAR_GEN3_USB3 select GENERIC_PHY help Support for USB 3.0 PHY found on Renesas R-Car generation 3 SoCs. + +config PHY_RZ_G3E_USB3 + tristate "Renesas RZ/G3E USB 3.0 PHY driver" + depends on ARCH_RENESAS || COMPILE_TEST + select GENERIC_PHY + help + Support for USB 3.0 PHY found on Renesas RZ/G3E SoCs. diff --git a/drivers/phy/renesas/Makefile b/drivers/phy/renesas/Makefile index 8896d1919faa..0e98083f2f0c 100644 --- a/drivers/phy/renesas/Makefile +++ b/drivers/phy/renesas/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o obj-$(CONFIG_PHY_RCAR_GEN3_PCIE) += phy-rcar-gen3-pcie.o obj-$(CONFIG_PHY_RCAR_GEN3_USB2) += phy-rcar-gen3-usb2.o obj-$(CONFIG_PHY_RCAR_GEN3_USB3) += phy-rcar-gen3-usb3.o +obj-$(CONFIG_PHY_RZ_G3E_USB3) += phy-rzg3e-usb3.o diff --git a/drivers/phy/renesas/phy-rzg3e-usb3.c b/drivers/phy/renesas/phy-rzg3e-usb3.c new file mode 100644 index 000000000000..3ea521ed8f48 --- /dev/null +++ b/drivers/phy/renesas/phy-rzg3e-usb3.c @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Renesas RZ/G3E USB3.0 PHY driver + * + * Copyright (C) 2025 Renesas Electronics Corporation + */ + +#include <linux/bitfield.h> +#include <linux/delay.h> +#include <linux/io.h> +#include <linux/iopoll.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/phy/phy.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/reset.h> + +#define USB3_TEST_RESET 0x0000 +#define USB3_TEST_UTMICTRL2 0x0b04 +#define USB3_TEST_PRMCTRL5_R 0x0c10 +#define USB3_TEST_PRMCTRL6_R 0x0c14 + +#define USB3_TEST_RSTCTRL 0x1000 +#define USB3_TEST_CLKCTRL 0x1004 +#define USB3_TEST_RAMCTRL 0x100c +#define USB3_TEST_CREGCTRL 0x1010 +#define USB3_TEST_LANECONFIG0 0x1030 + +#define USB3_TEST_RESET_PORTRESET0_CTRL BIT(9) +#define USB3_TEST_RESET_SIDDQ BIT(3) +#define USB3_TEST_RESET_PHY_RESET BIT(2) +#define USB3_TEST_RESET_PORTRESET0 BIT(1) + +#define USB3_TEST_UTMICTRL2_CTRL_MASK GENMASK(9, 8) +#define USB3_TEST_UTMICTRL2_MODE_MASK GENMASK(1, 0) + +#define USB3_TEST_PRMCTRL5_R_TXPREEMPAMPTUNE0_MASK GENMASK(2, 1) + +#define USB3_TEST_PRMCTRL6_R_OTGTUNE0_MASK GENMASK(2, 0) + +#define USB3_TEST_RAMCTRL_SRAM_INIT_DONE BIT(2) + +struct rz_usb3 { + void __iomem *base; + struct reset_control *rstc; + bool skip_reinit; +}; + +static void rzg3e_phy_usb2test_phy_init(void __iomem *base) +{ + u32 val; + + val = readl(base + USB3_TEST_UTMICTRL2); + val |= USB3_TEST_UTMICTRL2_CTRL_MASK | USB3_TEST_UTMICTRL2_MODE_MASK; + writel(val, base + USB3_TEST_UTMICTRL2); + + val = readl(base + USB3_TEST_PRMCTRL5_R); + val &= ~USB3_TEST_PRMCTRL5_R_TXPREEMPAMPTUNE0_MASK; + val |= FIELD_PREP(USB3_TEST_PRMCTRL5_R_TXPREEMPAMPTUNE0_MASK, 2); + writel(val, base + USB3_TEST_PRMCTRL5_R); + + val = readl(base + USB3_TEST_PRMCTRL6_R); + val &= ~USB3_TEST_PRMCTRL6_R_OTGTUNE0_MASK; + val |= FIELD_PREP(USB3_TEST_PRMCTRL6_R_OTGTUNE0_MASK, 7); + writel(val, base + USB3_TEST_PRMCTRL6_R); + + val = readl(base + USB3_TEST_RESET); + val &= ~USB3_TEST_RESET_SIDDQ; + val |= USB3_TEST_RESET_PORTRESET0_CTRL | USB3_TEST_RESET_PHY_RESET | + USB3_TEST_RESET_PORTRESET0; + writel(val, base + USB3_TEST_RESET); + fsleep(10); + + val &= ~(USB3_TEST_RESET_PHY_RESET | USB3_TEST_RESET_PORTRESET0); + writel(val, base + USB3_TEST_RESET); + fsleep(10); + + val = readl(base + USB3_TEST_UTMICTRL2); + val &= ~USB3_TEST_UTMICTRL2_CTRL_MASK; + writel(val, base + USB3_TEST_UTMICTRL2); + + writel(0, base + USB3_TEST_RESET); +} + +static int rzg3e_phy_usb3test_phy_init(void __iomem *base) +{ + int ret; + u32 val; + + writel(0x00000100, base + USB3_TEST_CREGCTRL); + writel(0x00000303, base + USB3_TEST_RSTCTRL); + fsleep(20); + + writel(0x00000004, base + USB3_TEST_CLKCTRL); + writel(0x0000000d, base + USB3_TEST_LANECONFIG0); + writel(0x00000301, base + USB3_TEST_RSTCTRL); + + ret = readl_poll_timeout_atomic(base + USB3_TEST_RAMCTRL, val, + val & USB3_TEST_RAMCTRL_SRAM_INIT_DONE, 1, 10000); + if (ret) + return ret; + + writel(0x00000300, base + USB3_TEST_RSTCTRL); + writel(0x00000001, base + USB3_TEST_RAMCTRL); + writel(0x00000000, base + USB3_TEST_RSTCTRL); + + return 0; +} + +static int rzg3e_phy_usb3_init_helper(void __iomem *base) +{ + rzg3e_phy_usb2test_phy_init(base); + + return rzg3e_phy_usb3test_phy_init(base); +} + +static int rzg3e_phy_usb3_init(struct phy *p) +{ + struct rz_usb3 *r = phy_get_drvdata(p); + int ret = 0; + + if (!r->skip_reinit) + ret = rzg3e_phy_usb3_init_helper(r->base); + + return ret; +} + +static const struct phy_ops rzg3e_phy_usb3_ops = { + .init = rzg3e_phy_usb3_init, + .owner = THIS_MODULE, +}; + +static int rzg3e_phy_usb3_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct phy_provider *provider; + struct rz_usb3 *r; + struct phy *phy; + int ret; + + r = devm_kzalloc(dev, sizeof(*r), GFP_KERNEL); + if (!r) + return -ENOMEM; + + r->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(r->base)) + return PTR_ERR(r->base); + + r->rstc = devm_reset_control_get_shared(dev, NULL); + if (IS_ERR(r->rstc)) + return dev_err_probe(dev, PTR_ERR(r->rstc), "failed to get reset\n"); + + ret = reset_control_deassert(r->rstc); + if (ret) + return ret; + + /* + * devm_phy_create() will call pm_runtime_enable(&phy->dev); + * And then, phy-core will manage runtime pm for this device. + */ + ret = devm_pm_runtime_enable(dev); + if (ret < 0) + return ret; + + phy = devm_phy_create(dev, NULL, &rzg3e_phy_usb3_ops); + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), "failed to create USB3 PHY\n"); + + platform_set_drvdata(pdev, r); + phy_set_drvdata(phy, r); + + provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(provider)) + return dev_err_probe(dev, PTR_ERR(provider), "failed to register PHY provider\n"); + + return 0; +} + +static void rzg3e_phy_usb3_remove(struct platform_device *pdev) +{ + struct rz_usb3 *r = dev_get_drvdata(&pdev->dev); + + reset_control_assert(r->rstc); +}; + +static int rzg3e_phy_usb3_suspend(struct device *dev) +{ + struct rz_usb3 *r = dev_get_drvdata(dev); + + pm_runtime_put(dev); + reset_control_assert(r->rstc); + r->skip_reinit = false; + + return 0; +} + +static int rzg3e_phy_usb3_resume(struct device *dev) +{ + struct rz_usb3 *r = dev_get_drvdata(dev); + int ret; + + ret = reset_control_deassert(r->rstc); + if (ret) + return ret; + + ret = pm_runtime_resume_and_get(dev); + if (ret) + goto reset_assert; + + ret = rzg3e_phy_usb3_init_helper(r->base); + if (ret) + goto pm_put; + + r->skip_reinit = true; + + return 0; + +pm_put: + pm_runtime_put(dev); +reset_assert: + reset_control_assert(r->rstc); + return ret; +} + +static const struct dev_pm_ops rzg3e_phy_usb3_pm = { + NOIRQ_SYSTEM_SLEEP_PM_OPS(rzg3e_phy_usb3_suspend, rzg3e_phy_usb3_resume) +}; + +static const struct of_device_id rzg3e_phy_usb3_match_table[] = { + { .compatible = "renesas,r9a09g047-usb3-phy" }, + { /* Sentinel */ } +}; + +MODULE_DEVICE_TABLE(of, rzg3e_phy_usb3_match_table); +static struct platform_driver rzg3e_phy_usb3_driver = { + .driver = { + .name = "phy_rzg3e_usb3", + .of_match_table = rzg3e_phy_usb3_match_table, + .pm = pm_sleep_ptr(&rzg3e_phy_usb3_pm), + }, + .probe = rzg3e_phy_usb3_probe, + .remove = rzg3e_phy_usb3_remove, +}; +module_platform_driver(rzg3e_phy_usb3_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Renesas RZ/G3E USB3.0 PHY Driver"); +MODULE_AUTHOR("biju.das.jz@bp.renesas.com>"); -- 2.43.0 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver 2025-08-20 17:17 ` [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver Biju @ 2025-09-01 16:28 ` Vinod Koul 2025-09-09 11:52 ` Biju Das 0 siblings, 1 reply; 9+ messages in thread From: Vinod Koul @ 2025-09-01 16:28 UTC (permalink / raw) To: Biju Cc: Kishon Vijay Abraham I, Philipp Zabel, Geert Uytterhoeven, Magnus Damm, Biju Das, linux-kernel, linux-phy, linux-renesas-soc, Prabhakar Mahadev Lad On 20-08-25, 18:17, Biju wrote: > +static int rzg3e_phy_usb3test_phy_init(void __iomem *base) > +{ > + int ret; > + u32 val; > + > + writel(0x00000100, base + USB3_TEST_CREGCTRL); > + writel(0x00000303, base + USB3_TEST_RSTCTRL); > + fsleep(20); > + > + writel(0x00000004, base + USB3_TEST_CLKCTRL); > + writel(0x0000000d, base + USB3_TEST_LANECONFIG0); > + writel(0x00000301, base + USB3_TEST_RSTCTRL); Magic numbers...? -- ~Vinod -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver 2025-09-01 16:28 ` Vinod Koul @ 2025-09-09 11:52 ` Biju Das 0 siblings, 0 replies; 9+ messages in thread From: Biju Das @ 2025-09-09 11:52 UTC (permalink / raw) To: Vinod Koul, biju.das.au Cc: Kishon Vijay Abraham I, Philipp Zabel, Geert Uytterhoeven, magnus.damm, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad Hi Vinod, Thanks for the feedback. > -----Original Message----- > From: Vinod Koul <vkoul@kernel.org> > Sent: 01 September 2025 17:28 > Subject: Re: [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver > > On 20-08-25, 18:17, Biju wrote: > > > +static int rzg3e_phy_usb3test_phy_init(void __iomem *base) { > > + int ret; > > + u32 val; > > + > > + writel(0x00000100, base + USB3_TEST_CREGCTRL); > > + writel(0x00000303, base + USB3_TEST_RSTCTRL); > > + fsleep(20); > > + > > + writel(0x00000004, base + USB3_TEST_CLKCTRL); > > + writel(0x0000000d, base + USB3_TEST_LANECONFIG0); > > + writel(0x00000301, base + USB3_TEST_RSTCTRL); > > Magic numbers...? OK will add macros to make it meaningful. Cheers, Biju -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-09-09 15:48 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-08-20 17:17 [PATCH 00/11] Add RZ/G3E USB3.2 Gen1 Host Controller support Biju 2025-08-20 17:17 ` [PATCH 03/11] dt-bindings: phy: renesas: Document Renesas RZ/G3E USB3.0 PHY Biju 2025-08-20 20:10 ` Conor Dooley 2025-08-20 20:12 ` Conor Dooley 2025-08-21 7:18 ` Biju Das 2025-08-22 16:18 ` Rob Herring 2025-08-20 17:17 ` [PATCH 04/11] phy: renesas: Add Renesas RZ/G3E USB3.0 PHY driver Biju 2025-09-01 16:28 ` Vinod Koul 2025-09-09 11:52 ` Biju Das
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox