From: Philipp Zabel <p.zabel@pengutronix.de>
To: iuncuim <iuncuim@gmail.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Andre Przywara <andre.przywara@arm.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-phy@lists.infradead.org, linux-clk@vger.kernel.org,
linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 4/7] phy: allwinner: a523: add USB3/PCIe PHY driver
Date: Mon, 25 Aug 2025 11:42:16 +0200 [thread overview]
Message-ID: <0501e21d1b6c99d18fe7e660f38b9bfafc76de53.camel@pengutronix.de> (raw)
In-Reply-To: <20250816084700.569524-5-iuncuim@gmail.com>
On Sa, 2025-08-16 at 16:46 +0800, iuncuim wrote:
> From: Mikhail Kalashnikov <iuncuim@gmail.com>
>
> The A523 family of processors features a combophy for USB 3.0 and PCIe,
> developed by Innosilicon. Simultaneous operation of both interfaces is
> not supported by design.
> Currently, the driver only adds support for USB 3.0. PCIe support is
> currently unavailable and will be added later.
> All data on phy configuration is taken from the manufacturer's BSP driver.
>
> Signed-off-by: Mikhail Kalashnikov <iuncuim@gmail.com>
> ---
> drivers/phy/allwinner/Kconfig | 9 +
> drivers/phy/allwinner/Makefile | 1 +
> drivers/phy/allwinner/phy-sun55i-usb3-pcie.c | 267 +++++++++++++++++++
> 3 files changed, 277 insertions(+)
> create mode 100644 drivers/phy/allwinner/phy-sun55i-usb3-pcie.c
>
> diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig
> index fb584518b..af2a82e51 100644
> --- a/drivers/phy/allwinner/Kconfig
> +++ b/drivers/phy/allwinner/Kconfig
> @@ -57,3 +57,12 @@ config PHY_SUN50I_USB3
> part of Allwinner H6 SoC.
>
> This driver controls each individual USB 2+3 host PHY combo.
> +
> +config PHY_SUN55I_USB3_PCIE
> + tristate "Allwinner A523 Innosilicon USB3/PCIe Combophy Driver"
> + depends on ARCH_SUNXI || COMPILE_TEST
> + depends on RESET_CONTROLLER
This dependency is not necessary. The reset controller API is stubbed
out in case RESET_CONTROLLER is disabled.
ARCH_SUNXI selects ARCH_HAS_RESET_CONTROLLER, which default-enables
RESET_CONTROLLER.
> + select GENERIC_PHY
> + help
> + Enable this to support the Allwinner PCIe/USB3.0 combo PHY
> + with Innosilicon IP block founded in A523/A527/H728/T527 SOC
> diff --git a/drivers/phy/allwinner/Makefile b/drivers/phy/allwinner/Makefile
> index bd74901a1..5948a27ef 100644
> --- a/drivers/phy/allwinner/Makefile
> +++ b/drivers/phy/allwinner/Makefile
> @@ -3,3 +3,4 @@ obj-$(CONFIG_PHY_SUN4I_USB) += phy-sun4i-usb.o
> obj-$(CONFIG_PHY_SUN6I_MIPI_DPHY) += phy-sun6i-mipi-dphy.o
> obj-$(CONFIG_PHY_SUN9I_USB) += phy-sun9i-usb.o
> obj-$(CONFIG_PHY_SUN50I_USB3) += phy-sun50i-usb3.o
> +obj-$(CONFIG_PHY_SUN55I_USB3_PCIE) += phy-sun55i-usb3-pcie.o
> diff --git a/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c b/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c
> new file mode 100644
> index 000000000..905c54a67
> --- /dev/null
> +++ b/drivers/phy/allwinner/phy-sun55i-usb3-pcie.c
> @@ -0,0 +1,267 @@
[...]
> +static int sun55i_usb3_pcie_phy_init(struct phy *_phy)
> +{
> + struct sun55i_usb3_pcie_phy *phy = phy_get_drvdata(_phy);
> +
> + sun55i_usb3_phy_open(phy);
Given that sun55i_usb3_pcie_phy_exit() asserts the reset and disables
the clock, why isn't the clock enabled and the reset deasserted here?
As is, it looks like the code in sun55i_usb3_phy_open() could be just
folded into sun55i_usb3_pcie_phy_init().
> + return 0;
> +}
[...]
> +static int sun55i_usb3_pcie_phy_probe(struct platform_device *pdev)
> +{
> + struct sun55i_usb3_pcie_phy *phy;
> + struct device *dev = &pdev->dev;
> + struct phy_provider *phy_provider;
> + int ret;
> +
> + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
> + if (!phy)
> + return -ENOMEM;
> +
> + phy->dev = dev;
> + phy->clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(phy->clk)) {
> + if (PTR_ERR(phy->clk) != -EPROBE_DEFER)
> + dev_err(dev, "failed to get phy clock\n");
> + return PTR_ERR(phy->clk);
> + }
> +
> + phy->reset = devm_reset_control_get(dev, NULL);
Please use devm_reset_control_get_exclusive() directly.
> + if (IS_ERR(phy->reset)) {
> + dev_err(dev, "failed to get reset control\n");
Consider using dev_err_probe().
regards
Philipp
next prev parent reply other threads:[~2025-08-25 9:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 8:46 [PATCH 0/7] arm64: allwinner: a523: add USB3.0 support iuncuim
2025-08-16 8:46 ` [PATCH 1/7] clk: sunxi-ng: a523: add missing usb related clocks iuncuim
2025-08-16 9:30 ` Krzysztof Kozlowski
2025-08-16 8:46 ` [PATCH 2/7] arm64: dts: allwinner: a523: add third usb2 phy iuncuim
2025-08-16 9:31 ` Krzysztof Kozlowski
2025-08-16 13:38 ` Andre Przywara
2025-08-16 8:46 ` [PATCH 3/7] phy: sun4i-usb: a523: add support for the USB2 PHY iuncuim
2025-08-16 13:31 ` Andre Przywara
2025-08-16 8:46 ` [PATCH 4/7] phy: allwinner: a523: add USB3/PCIe PHY driver iuncuim
2025-08-16 9:33 ` Krzysztof Kozlowski
2025-08-25 9:42 ` Philipp Zabel [this message]
2025-08-27 6:40 ` Chukun Pan
2025-08-16 8:46 ` [PATCH 5/7] arm64: dts: allwinner: a523: add USB3.0 phy node iuncuim
2025-08-16 9:32 ` Krzysztof Kozlowski
2025-08-16 13:49 ` Andre Przywara
2025-08-25 15:41 ` Chen-Yu Tsai
2025-08-16 8:46 ` [PATCH 6/7] arm64: dts: allwinner: a523: add DWC3 USB3.0 node iuncuim
2025-08-16 14:10 ` Andre Przywara
2025-08-16 8:47 ` [PATCH 7/7] arm64: dts: allwinner: a523: activate USB3 for all boards iuncuim
2025-08-18 18:24 ` [PATCH 0/7] arm64: allwinner: a523: add USB3.0 support Rob Herring (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0501e21d1b6c99d18fe7e660f38b9bfafc76de53.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=andre.przywara@arm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iuncuim@gmail.com \
--cc=jernej.skrabec@gmail.com \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=vkoul@kernel.org \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).