All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-phy@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/4] phy: samsung: add Exynos2200 usb phy controller
Date: Sun, 16 Feb 2025 10:36:24 +0100	[thread overview]
Message-ID: <32b67c56-9331-4391-90ad-031e0388434f@kernel.org> (raw)
In-Reply-To: <20250215122409.162810-5-ivo.ivanov.ivanov1@gmail.com>

On 15/02/2025 13:24, Ivaylo Ivanov wrote:
> The Exynos2200 SoC comes with 3 PHYs - snps eUSB2, snps USBDP combophy
> and a cut-off phy that origins from exynos5-usbdrd. The latter is used
> for link control, as well as pipe3 attachment and detachment.
> 
> Add a new driver for it.
> 
> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
> ---
>  drivers/phy/samsung/Kconfig                 |  13 ++
>  drivers/phy/samsung/Makefile                |   1 +
>  drivers/phy/samsung/phy-exynos2200-usbcon.c | 241 ++++++++++++++++++++
>  include/linux/soc/samsung/exynos-regs-pmu.h |   3 +
>  4 files changed, 258 insertions(+)
>  create mode 100644 drivers/phy/samsung/phy-exynos2200-usbcon.c
> 
> diff --git a/drivers/phy/samsung/Kconfig b/drivers/phy/samsung/Kconfig
> index f62285254..47e9b9926 100644
> --- a/drivers/phy/samsung/Kconfig
> +++ b/drivers/phy/samsung/Kconfig
> @@ -90,6 +90,19 @@ config PHY_EXYNOS2200_SNPS_EUSB2
>  	  This driver provides PHY interface for eUSB 2.0 controller
>  	  present on Exynos5 SoC series.
>  
> +config PHY_EXYNOS2200_USBCON
> +	tristate "Exynos2200 USBCON PHY driver"
> +	depends on (ARCH_EXYNOS && OF) || COMPILE_TEST
> +	depends on HAS_IOMEM
> +	depends on USB_DWC3_EXYNOS

How? What are you using from DWC3?

> +	select GENERIC_PHY
> +	select MFD_SYSCON
> +	default y
> +	help
> +	  Enable USBCON PHY support for Exynos2200 SoC.
> +	  This driver provides PHY interface for USB controller present
> +	  on Exynos2200 SoC.
> +
>  config PHY_EXYNOS5_USBDRD
>  	tristate "Exynos5 SoC series USB DRD PHY driver"
>  	depends on (ARCH_EXYNOS && OF) || COMPILE_TEST
> diff --git a/drivers/phy/samsung/Makefile b/drivers/phy/samsung/Makefile
> index 90b84c7fc..f70e12ddf 100644
> --- a/drivers/phy/samsung/Makefile
> +++ b/drivers/phy/samsung/Makefile
> @@ -15,5 +15,6 @@ phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
>  phy-exynos-usb2-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
>  phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)	+= phy-s5pv210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS2200_SNPS_EUSB2)	+= phy-exynos2200-snps-eusb2.o
> +obj-$(CONFIG_PHY_EXYNOS2200_USBCON)	+= phy-exynos2200-usbcon.o
>  obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
>  obj-$(CONFIG_PHY_EXYNOS5250_SATA)	+= phy-exynos5250-sata.o
> diff --git a/drivers/phy/samsung/phy-exynos2200-usbcon.c b/drivers/phy/samsung/phy-exynos2200-usbcon.c
> new file mode 100644
> index 000000000..7968c9792
> --- /dev/null
> +++ b/drivers/phy/samsung/phy-exynos2200-usbcon.c
> @@ -0,0 +1,241 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2025, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
> + */
> +
> +#include <linux/bitfield.h>

Are you using this header?

> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/iopoll.h>

And rhis?

> +#include <linux/mfd/syscon.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/phy/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/reset.h>

And this?

> +#include <linux/soc/samsung/exynos-regs-pmu.h>
> +
> +#define EXYNOS2200_USBCON_LINKCTRL		0x4
> +#define LINKCTRL_FORCE_QACT			BIT(8)
> +
> +#define EXYNOS2200_USBCON_UTMI_CTRL		0x10
> +#define UTMI_CTRL_FORCE_VBUSVALID		BIT(1)
> +#define UTMI_CTRL_FORCE_BVALID			BIT(0)
> +
> +#define EXYNOS2200_USBCON_LINK_CLKRST		0xc
> +#define LINK_CLKRST_SW_RST			BIT(0)
> +
> +struct exynos2200_usbcon_phy_drvdata {
> +	const char * const *clk_names;
> +	int n_clks;
> +	const char * const *regulator_names;
> +	int n_regulators;
> +	u32 pmu_offset_usbcon_phy;
> +};
> +
> +struct exynos2200_usbcon_phy {
> +	struct phy *phy;
> +	void __iomem *base;
> +	struct regmap *reg_pmu;
> +	struct clk_bulk_data *clks;
> +	const struct exynos2200_usbcon_phy_drvdata *drv_data;
> +	u32 pmu_offset;
> +	struct regulator_bulk_data *vregs;
> +};
> +
> +static void exynos2200_usbcon_phy_isol(struct exynos2200_usbcon_phy *inst,
> +				       bool isolate)
> +{
> +	unsigned int val;
> +
> +	if (!inst->reg_pmu)
> +		return;
> +
> +	val = isolate ? 0 : EXYNOS4_PHY_ENABLE;
> +
> +	regmap_update_bits(inst->reg_pmu, inst->pmu_offset,
> +			   EXYNOS4_PHY_ENABLE, val);
> +}
> +
> +static void exynos2200_usbcon_phy_write_mask(void __iomem *base, u32 offset,
> +					     u32 mask, u32 val)
> +{
> +	u32 reg;
> +
> +	reg = readl_relaxed(base + offset);
> +	reg &= ~mask;
> +	reg |= val & mask;
> +	writel_relaxed(reg, base + offset);
> +
> +	/* Ensure above write is completed */
> +	readl_relaxed(base + offset);

None of these should be relaxed.

> +}
> +
> +static int exynos2200_usbcon_phy_init(struct phy *p)
> +{
> +	struct exynos2200_usbcon_phy *phy = phy_get_drvdata(p);
> +	int ret;
> +
> +	ret = regulator_bulk_enable(phy->drv_data->n_regulators, phy->vregs);
> +	if (ret)
> +		return ret;
> +
> +	exynos2200_usbcon_phy_isol(phy, false);
> +
> +	/*
> +	 * Disable HWACG (hardware auto clock gating control). This will force
> +	 * QACTIVE signal in Q-Channel interface to HIGH level, to make sure
> +	 * the PHY clock is not gated by the hardware.
> +	 */
> +	exynos2200_usbcon_phy_write_mask(phy->base, EXYNOS2200_USBCON_LINKCTRL,
> +					 LINKCTRL_FORCE_QACT,
> +					 LINKCTRL_FORCE_QACT);
> +
> +	/* Reset Link */
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_LINK_CLKRST,
> +					 LINK_CLKRST_SW_RST,
> +					 LINK_CLKRST_SW_RST);
> +
> +	fsleep(10); /* required after POR high */
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_LINK_CLKRST,
> +					 LINK_CLKRST_SW_RST, 0);
> +
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_UTMI_CTRL,
> +					 UTMI_CTRL_FORCE_BVALID |
> +					 UTMI_CTRL_FORCE_VBUSVALID,
> +					 UTMI_CTRL_FORCE_BVALID |
> +					 UTMI_CTRL_FORCE_VBUSVALID);
> +
> +	return 0;
> +}
> +
> +static int exynos2200_usbcon_phy_exit(struct phy *p)
> +{
> +	struct exynos2200_usbcon_phy *phy = phy_get_drvdata(p);
> +
> +	exynos2200_usbcon_phy_isol(phy, true);
> +
> +	regulator_bulk_disable(phy->drv_data->n_regulators, phy->vregs);


This looks like power off callback, not exit.

> +
> +	return 0;
> +}
> +
> +static const struct phy_ops exynos2200_usbcon_phy_ops = {
> +	.init		= exynos2200_usbcon_phy_init,
> +	.exit		= exynos2200_usbcon_phy_exit,
> +	.owner		= THIS_MODULE,
> +};
> +
> +static int exynos2200_usbcon_phy_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct exynos2200_usbcon_phy *phy;
> +	const struct exynos2200_usbcon_phy_drvdata *drv_data;
> +	struct phy_provider *phy_provider;
> +	struct phy *generic_phy;
> +	int ret;
> +
> +	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
> +	if (!phy)
> +		return -ENOMEM;
> +
> +	drv_data = of_device_get_match_data(dev);
> +	if (!drv_data)
> +		return -EINVAL;
> +	phy->drv_data = drv_data;
> +
> +	phy->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(phy->base))
> +		return PTR_ERR(phy->base);
> +
> +	phy->clks = devm_kcalloc(dev, drv_data->n_clks,
> +				 sizeof(*phy->clks), GFP_KERNEL);
> +	if (!phy->clks)
> +		return -ENOMEM;
> +
> +	for (int i = 0; i < drv_data->n_clks; ++i)
> +		phy->clks[i].id = drv_data->clk_names[i];
> +
> +	ret = devm_clk_bulk_get(dev, phy->drv_data->n_clks,
> +				phy->clks);
> +	if (ret)
> +		return dev_err_probe(dev, ret,
> +				     "failed to get phy clock(s)\n");
> +
> +	phy->reg_pmu = syscon_regmap_lookup_by_phandle(dev->of_node,
> +						       "samsung,pmu-syscon");

syscon_regmap_lookup_by_phandle_args

> +	if (IS_ERR(phy->reg_pmu)) {
> +		dev_err(dev, "Failed to lookup PMU regmap\n");
> +		return PTR_ERR(phy->reg_pmu);
> +	}
> +
> +	phy->pmu_offset = drv_data->pmu_offset_usbcon_phy;
> +	phy->vregs = devm_kcalloc(dev, drv_data->n_regulators,
> +				  sizeof(*phy->vregs), GFP_KERNEL);
> +	if (!phy->vregs)
> +		return -ENOMEM;
> +	regulator_bulk_set_supply_names(phy->vregs,
> +					drv_data->regulator_names,
> +					drv_data->n_regulators);
> +	ret = devm_regulator_bulk_get(dev, drv_data->n_regulators,
> +				      phy->vregs);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to get regulators\n");
> +
> +	generic_phy = devm_phy_create(dev, NULL, &exynos2200_usbcon_phy_ops);
> +	if (IS_ERR(generic_phy)) {
> +		dev_err(dev, "failed to create phy %d\n", ret);
> +		return PTR_ERR(generic_phy);
> +	}
> +
> +	dev_set_drvdata(dev, phy);
> +	phy_set_drvdata(generic_phy, phy);
> +
> +	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> +	if (IS_ERR(phy_provider)) {
> +		dev_err(dev, "failed to register phy provider\n");
> +		return PTR_ERR(phy_provider);


Same comments as on previous patch.



Best regards,
Krzysztof


WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>,
	Vinod Koul <vkoul@kernel.org>,
	Kishon Vijay Abraham I <kishon@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-phy@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/4] phy: samsung: add Exynos2200 usb phy controller
Date: Sun, 16 Feb 2025 10:36:24 +0100	[thread overview]
Message-ID: <32b67c56-9331-4391-90ad-031e0388434f@kernel.org> (raw)
In-Reply-To: <20250215122409.162810-5-ivo.ivanov.ivanov1@gmail.com>

On 15/02/2025 13:24, Ivaylo Ivanov wrote:
> The Exynos2200 SoC comes with 3 PHYs - snps eUSB2, snps USBDP combophy
> and a cut-off phy that origins from exynos5-usbdrd. The latter is used
> for link control, as well as pipe3 attachment and detachment.
> 
> Add a new driver for it.
> 
> Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
> ---
>  drivers/phy/samsung/Kconfig                 |  13 ++
>  drivers/phy/samsung/Makefile                |   1 +
>  drivers/phy/samsung/phy-exynos2200-usbcon.c | 241 ++++++++++++++++++++
>  include/linux/soc/samsung/exynos-regs-pmu.h |   3 +
>  4 files changed, 258 insertions(+)
>  create mode 100644 drivers/phy/samsung/phy-exynos2200-usbcon.c
> 
> diff --git a/drivers/phy/samsung/Kconfig b/drivers/phy/samsung/Kconfig
> index f62285254..47e9b9926 100644
> --- a/drivers/phy/samsung/Kconfig
> +++ b/drivers/phy/samsung/Kconfig
> @@ -90,6 +90,19 @@ config PHY_EXYNOS2200_SNPS_EUSB2
>  	  This driver provides PHY interface for eUSB 2.0 controller
>  	  present on Exynos5 SoC series.
>  
> +config PHY_EXYNOS2200_USBCON
> +	tristate "Exynos2200 USBCON PHY driver"
> +	depends on (ARCH_EXYNOS && OF) || COMPILE_TEST
> +	depends on HAS_IOMEM
> +	depends on USB_DWC3_EXYNOS

How? What are you using from DWC3?

> +	select GENERIC_PHY
> +	select MFD_SYSCON
> +	default y
> +	help
> +	  Enable USBCON PHY support for Exynos2200 SoC.
> +	  This driver provides PHY interface for USB controller present
> +	  on Exynos2200 SoC.
> +
>  config PHY_EXYNOS5_USBDRD
>  	tristate "Exynos5 SoC series USB DRD PHY driver"
>  	depends on (ARCH_EXYNOS && OF) || COMPILE_TEST
> diff --git a/drivers/phy/samsung/Makefile b/drivers/phy/samsung/Makefile
> index 90b84c7fc..f70e12ddf 100644
> --- a/drivers/phy/samsung/Makefile
> +++ b/drivers/phy/samsung/Makefile
> @@ -15,5 +15,6 @@ phy-exynos-usb2-$(CONFIG_PHY_EXYNOS4X12_USB2)	+= phy-exynos4x12-usb2.o
>  phy-exynos-usb2-$(CONFIG_PHY_EXYNOS5250_USB2)	+= phy-exynos5250-usb2.o
>  phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)	+= phy-s5pv210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS2200_SNPS_EUSB2)	+= phy-exynos2200-snps-eusb2.o
> +obj-$(CONFIG_PHY_EXYNOS2200_USBCON)	+= phy-exynos2200-usbcon.o
>  obj-$(CONFIG_PHY_EXYNOS5_USBDRD)	+= phy-exynos5-usbdrd.o
>  obj-$(CONFIG_PHY_EXYNOS5250_SATA)	+= phy-exynos5250-sata.o
> diff --git a/drivers/phy/samsung/phy-exynos2200-usbcon.c b/drivers/phy/samsung/phy-exynos2200-usbcon.c
> new file mode 100644
> index 000000000..7968c9792
> --- /dev/null
> +++ b/drivers/phy/samsung/phy-exynos2200-usbcon.c
> @@ -0,0 +1,241 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2025, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
> + */
> +
> +#include <linux/bitfield.h>

Are you using this header?

> +#include <linux/clk.h>
> +#include <linux/delay.h>
> +#include <linux/iopoll.h>

And rhis?

> +#include <linux/mfd/syscon.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/phy/phy.h>
> +#include <linux/platform_device.h>
> +#include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
> +#include <linux/reset.h>

And this?

> +#include <linux/soc/samsung/exynos-regs-pmu.h>
> +
> +#define EXYNOS2200_USBCON_LINKCTRL		0x4
> +#define LINKCTRL_FORCE_QACT			BIT(8)
> +
> +#define EXYNOS2200_USBCON_UTMI_CTRL		0x10
> +#define UTMI_CTRL_FORCE_VBUSVALID		BIT(1)
> +#define UTMI_CTRL_FORCE_BVALID			BIT(0)
> +
> +#define EXYNOS2200_USBCON_LINK_CLKRST		0xc
> +#define LINK_CLKRST_SW_RST			BIT(0)
> +
> +struct exynos2200_usbcon_phy_drvdata {
> +	const char * const *clk_names;
> +	int n_clks;
> +	const char * const *regulator_names;
> +	int n_regulators;
> +	u32 pmu_offset_usbcon_phy;
> +};
> +
> +struct exynos2200_usbcon_phy {
> +	struct phy *phy;
> +	void __iomem *base;
> +	struct regmap *reg_pmu;
> +	struct clk_bulk_data *clks;
> +	const struct exynos2200_usbcon_phy_drvdata *drv_data;
> +	u32 pmu_offset;
> +	struct regulator_bulk_data *vregs;
> +};
> +
> +static void exynos2200_usbcon_phy_isol(struct exynos2200_usbcon_phy *inst,
> +				       bool isolate)
> +{
> +	unsigned int val;
> +
> +	if (!inst->reg_pmu)
> +		return;
> +
> +	val = isolate ? 0 : EXYNOS4_PHY_ENABLE;
> +
> +	regmap_update_bits(inst->reg_pmu, inst->pmu_offset,
> +			   EXYNOS4_PHY_ENABLE, val);
> +}
> +
> +static void exynos2200_usbcon_phy_write_mask(void __iomem *base, u32 offset,
> +					     u32 mask, u32 val)
> +{
> +	u32 reg;
> +
> +	reg = readl_relaxed(base + offset);
> +	reg &= ~mask;
> +	reg |= val & mask;
> +	writel_relaxed(reg, base + offset);
> +
> +	/* Ensure above write is completed */
> +	readl_relaxed(base + offset);

None of these should be relaxed.

> +}
> +
> +static int exynos2200_usbcon_phy_init(struct phy *p)
> +{
> +	struct exynos2200_usbcon_phy *phy = phy_get_drvdata(p);
> +	int ret;
> +
> +	ret = regulator_bulk_enable(phy->drv_data->n_regulators, phy->vregs);
> +	if (ret)
> +		return ret;
> +
> +	exynos2200_usbcon_phy_isol(phy, false);
> +
> +	/*
> +	 * Disable HWACG (hardware auto clock gating control). This will force
> +	 * QACTIVE signal in Q-Channel interface to HIGH level, to make sure
> +	 * the PHY clock is not gated by the hardware.
> +	 */
> +	exynos2200_usbcon_phy_write_mask(phy->base, EXYNOS2200_USBCON_LINKCTRL,
> +					 LINKCTRL_FORCE_QACT,
> +					 LINKCTRL_FORCE_QACT);
> +
> +	/* Reset Link */
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_LINK_CLKRST,
> +					 LINK_CLKRST_SW_RST,
> +					 LINK_CLKRST_SW_RST);
> +
> +	fsleep(10); /* required after POR high */
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_LINK_CLKRST,
> +					 LINK_CLKRST_SW_RST, 0);
> +
> +	exynos2200_usbcon_phy_write_mask(phy->base,
> +					 EXYNOS2200_USBCON_UTMI_CTRL,
> +					 UTMI_CTRL_FORCE_BVALID |
> +					 UTMI_CTRL_FORCE_VBUSVALID,
> +					 UTMI_CTRL_FORCE_BVALID |
> +					 UTMI_CTRL_FORCE_VBUSVALID);
> +
> +	return 0;
> +}
> +
> +static int exynos2200_usbcon_phy_exit(struct phy *p)
> +{
> +	struct exynos2200_usbcon_phy *phy = phy_get_drvdata(p);
> +
> +	exynos2200_usbcon_phy_isol(phy, true);
> +
> +	regulator_bulk_disable(phy->drv_data->n_regulators, phy->vregs);


This looks like power off callback, not exit.

> +
> +	return 0;
> +}
> +
> +static const struct phy_ops exynos2200_usbcon_phy_ops = {
> +	.init		= exynos2200_usbcon_phy_init,
> +	.exit		= exynos2200_usbcon_phy_exit,
> +	.owner		= THIS_MODULE,
> +};
> +
> +static int exynos2200_usbcon_phy_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct exynos2200_usbcon_phy *phy;
> +	const struct exynos2200_usbcon_phy_drvdata *drv_data;
> +	struct phy_provider *phy_provider;
> +	struct phy *generic_phy;
> +	int ret;
> +
> +	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
> +	if (!phy)
> +		return -ENOMEM;
> +
> +	drv_data = of_device_get_match_data(dev);
> +	if (!drv_data)
> +		return -EINVAL;
> +	phy->drv_data = drv_data;
> +
> +	phy->base = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(phy->base))
> +		return PTR_ERR(phy->base);
> +
> +	phy->clks = devm_kcalloc(dev, drv_data->n_clks,
> +				 sizeof(*phy->clks), GFP_KERNEL);
> +	if (!phy->clks)
> +		return -ENOMEM;
> +
> +	for (int i = 0; i < drv_data->n_clks; ++i)
> +		phy->clks[i].id = drv_data->clk_names[i];
> +
> +	ret = devm_clk_bulk_get(dev, phy->drv_data->n_clks,
> +				phy->clks);
> +	if (ret)
> +		return dev_err_probe(dev, ret,
> +				     "failed to get phy clock(s)\n");
> +
> +	phy->reg_pmu = syscon_regmap_lookup_by_phandle(dev->of_node,
> +						       "samsung,pmu-syscon");

syscon_regmap_lookup_by_phandle_args

> +	if (IS_ERR(phy->reg_pmu)) {
> +		dev_err(dev, "Failed to lookup PMU regmap\n");
> +		return PTR_ERR(phy->reg_pmu);
> +	}
> +
> +	phy->pmu_offset = drv_data->pmu_offset_usbcon_phy;
> +	phy->vregs = devm_kcalloc(dev, drv_data->n_regulators,
> +				  sizeof(*phy->vregs), GFP_KERNEL);
> +	if (!phy->vregs)
> +		return -ENOMEM;
> +	regulator_bulk_set_supply_names(phy->vregs,
> +					drv_data->regulator_names,
> +					drv_data->n_regulators);
> +	ret = devm_regulator_bulk_get(dev, drv_data->n_regulators,
> +				      phy->vregs);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to get regulators\n");
> +
> +	generic_phy = devm_phy_create(dev, NULL, &exynos2200_usbcon_phy_ops);
> +	if (IS_ERR(generic_phy)) {
> +		dev_err(dev, "failed to create phy %d\n", ret);
> +		return PTR_ERR(generic_phy);
> +	}
> +
> +	dev_set_drvdata(dev, phy);
> +	phy_set_drvdata(generic_phy, phy);
> +
> +	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> +	if (IS_ERR(phy_provider)) {
> +		dev_err(dev, "failed to register phy provider\n");
> +		return PTR_ERR(phy_provider);


Same comments as on previous patch.



Best regards,
Krzysztof

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

  reply	other threads:[~2025-02-16 10:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-15 12:24 [PATCH v1 0/4] phy: samsung: add Exynos2200 SNPS eUSB2 driver Ivaylo Ivanov
2025-02-15 12:24 ` Ivaylo Ivanov
2025-02-15 12:24 ` [PATCH v1 1/4] dt-bindings: phy: add samsung,exynos2200-snps-eusb2-phy schema file Ivaylo Ivanov
2025-02-15 12:24   ` Ivaylo Ivanov
2025-02-15 13:29   ` Rob Herring (Arm)
2025-02-15 13:29     ` Rob Herring (Arm)
2025-02-16  9:14   ` Diederik de Haas
2025-02-16  9:14     ` Diederik de Haas
2025-02-16  9:22     ` Krzysztof Kozlowski
2025-02-16  9:22       ` Krzysztof Kozlowski
2025-02-16  9:27       ` Ivaylo Ivanov
2025-02-16  9:27         ` Ivaylo Ivanov
2025-02-16  9:37         ` Krzysztof Kozlowski
2025-02-16  9:37           ` Krzysztof Kozlowski
2025-02-15 12:24 ` [PATCH v1 2/4] dt-bindings: phy: add samsung,exynos2200-usbcon-phy " Ivaylo Ivanov
2025-02-15 12:24   ` Ivaylo Ivanov
2025-02-15 13:29   ` Rob Herring (Arm)
2025-02-15 13:29     ` Rob Herring (Arm)
2025-02-15 12:24 ` [PATCH v1 3/4] phy: samsung: add Exynos2200 SNPS eUSB2 driver Ivaylo Ivanov
2025-02-15 12:24   ` Ivaylo Ivanov
2025-02-16  9:26   ` Krzysztof Kozlowski
2025-02-16  9:26     ` Krzysztof Kozlowski
2025-02-16  9:41     ` Ivaylo Ivanov
2025-02-16  9:41       ` Ivaylo Ivanov
2025-02-16  9:44       ` Krzysztof Kozlowski
2025-02-16  9:44         ` Krzysztof Kozlowski
2025-02-16  9:51         ` Ivaylo Ivanov
2025-02-16  9:51           ` Ivaylo Ivanov
2025-02-16 13:19           ` Krzysztof Kozlowski
2025-02-16 13:19             ` Krzysztof Kozlowski
2025-02-16 13:57             ` Ivaylo Ivanov
2025-02-16 13:57               ` Ivaylo Ivanov
2025-02-16 18:25               ` Ivaylo Ivanov
2025-02-16 18:25                 ` Ivaylo Ivanov
2025-02-17  9:05   ` Philipp Zabel
2025-02-17  9:05     ` Philipp Zabel
2025-02-15 12:24 ` [PATCH v1 4/4] phy: samsung: add Exynos2200 usb phy controller Ivaylo Ivanov
2025-02-15 12:24   ` Ivaylo Ivanov
2025-02-16  9:36   ` Krzysztof Kozlowski [this message]
2025-02-16  9:36     ` Krzysztof Kozlowski
2025-02-16  9:58     ` Ivaylo Ivanov
2025-02-16  9:58       ` Ivaylo Ivanov

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=32b67c56-9331-4391-90ad-031e0388434f@kernel.org \
    --to=krzk@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ivo.ivanov.ivanov1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=vkoul@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.