All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wesley Cheng <quic_wcheng@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Melody Olvera <quic_molvera@quicinc.com>
Cc: 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>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-phy@lists.infradead.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 06/10] phy: qcom: Add M31 based eUSB2 PHY driver
Date: Mon, 7 Apr 2025 19:32:53 -0700	[thread overview]
Message-ID: <73499d82-e7e5-b88a-41a4-160529efc988@quicinc.com> (raw)
In-Reply-To: <kj5dyy7bclmkft7x4hdpzpo7n35cu5nkpksj47phb7jt5lceab@7fb5i6gluqwz>

Hi Dmitry,

On 3/26/2025 7:33 AM, Dmitry Baryshkov wrote:
> On Mon, Mar 24, 2025 at 01:18:34PM -0700, Melody Olvera wrote:
>> From: Wesley Cheng <quic_wcheng@quicinc.com>
>>
>> SM8750 utilizes an eUSB2 PHY from M31.  Add the initialization
>> sequences to bring it out of reset and into an operational state.  This
>> differs to the M31 USB driver, in that the M31 eUSB2 driver will
>> require a connection to an eUSB2 repeater.  This PHY driver will handle
>> the initialization of the associated eUSB2 repeater when required.
>>
>> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>> Signed-off-by: Melody Olvera <quic_molvera@quicinc.com>
>> ---
>>   drivers/phy/qualcomm/Kconfig              |  10 +
>>   drivers/phy/qualcomm/Makefile             |   1 +
>>   drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 297 ++++++++++++++++++++++++++++++
>>   3 files changed, 308 insertions(+)
>>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..b18aab968122683e2e87287a4b570321d376870a
>> --- /dev/null
>> +++ b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
>> @@ -0,0 +1,297 @@
>> +// SPDX-License-Identifier: GPL-2.0+
> 
> GPL-2.0-only
> 

Will fix.

>> +/*
>> + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/delay.h>
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/phy/phy.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset.h>
>> +#include <linux/slab.h>
>> +
>> +#include <linux/regulator/consumer.h>
>> +
>> +#define USB_PHY_UTMI_CTRL0		(0x3c)
>> +
>> +#define USB_PHY_UTMI_CTRL5		(0x50)
>> +
>> +#define USB_PHY_HS_PHY_CTRL_COMMON0	(0x54)
>> +#define FSEL				GENMASK(6, 4)
>> +#define FSEL_38_4_MHZ_VAL		(0x6)
>> +
>> +#define USB_PHY_HS_PHY_CTRL2		(0x64)
>> +
>> +#define USB_PHY_CFG0			(0x94)
>> +#define USB_PHY_CFG1			(0x154)
>> +
>> +#define USB_PHY_FSEL_SEL		(0xb8)
>> +
>> +#define USB_PHY_XCFGI_39_32		(0x16c)
>> +#define USB_PHY_XCFGI_71_64		(0x17c)
>> +#define USB_PHY_XCFGI_31_24		(0x168)
>> +#define USB_PHY_XCFGI_7_0		(0x15c)
>> +
>> +#define M31_EUSB_PHY_INIT_CFG(o, b, v)	\
>> +{				\
>> +	.off = o,		\
>> +	.mask = b,		\
>> +	.val = v,		\
>> +}
>> +
>> +struct m31_phy_tbl_entry {
>> +	u32 off;
>> +	u32 mask;
>> +	u32 val;
>> +};
>> +
>> +struct m31_eusb2_priv_data {
>> +	const struct m31_phy_tbl_entry	*setup_seq;
>> +	unsigned int			setup_seq_nregs;
>> +	const struct m31_phy_tbl_entry	*override_seq;
>> +	unsigned int			override_seq_nregs;
>> +	const struct m31_phy_tbl_entry	*reset_seq;
>> +	unsigned int			reset_seq_nregs;
>> +	unsigned int			fsel;
>> +};
>> +
>> +static const struct m31_phy_tbl_entry m31_eusb2_setup_tbl[] = {
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_CFG0, BIT(1), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_UTMI_CTRL5, BIT(1), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_CFG1, BIT(0), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_FSEL_SEL, BIT(0), 1),
> 
> I suppose, we can not expect to have #defines for all used bitfields?
> 

Added the bitfields as requested.

>> +};
>> +
> 
> [...]
> 
>> +
>> +static const struct phy_ops m31eusb2_phy_gen_ops = {
>> +	.init	= m31eusb2_phy_init,
>> +	.exit	= m31eusb2_phy_exit,
> 
> I think, you have a missing .set_mode callback here.
> 

Added this to properly set the mode on the repeater as well.

>> +	.owner	= THIS_MODULE,
>> +};
>> +
>> +static int m31eusb2_phy_probe(struct platform_device *pdev)
>> +{
>> +	struct phy_provider *phy_provider;
>> +	const struct m31_eusb2_priv_data *data;
>> +	struct device *dev = &pdev->dev;
>> +	struct m31eusb2_phy *phy;
>> +	int ret;
>> +
>> +	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
>> +	if (!phy)
>> +		return -ENOMEM;
>> +
>> +	data = of_device_get_match_data(dev);
> 
> device_get_match_data()
> 

Done.

Thanks
Wesley Cheng


WARNING: multiple messages have this Message-ID (diff)
From: Wesley Cheng <quic_wcheng@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Melody Olvera <quic_molvera@quicinc.com>
Cc: 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>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>, <linux-arm-msm@vger.kernel.org>,
	<linux-phy@lists.infradead.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3 06/10] phy: qcom: Add M31 based eUSB2 PHY driver
Date: Mon, 7 Apr 2025 19:32:53 -0700	[thread overview]
Message-ID: <73499d82-e7e5-b88a-41a4-160529efc988@quicinc.com> (raw)
In-Reply-To: <kj5dyy7bclmkft7x4hdpzpo7n35cu5nkpksj47phb7jt5lceab@7fb5i6gluqwz>

Hi Dmitry,

On 3/26/2025 7:33 AM, Dmitry Baryshkov wrote:
> On Mon, Mar 24, 2025 at 01:18:34PM -0700, Melody Olvera wrote:
>> From: Wesley Cheng <quic_wcheng@quicinc.com>
>>
>> SM8750 utilizes an eUSB2 PHY from M31.  Add the initialization
>> sequences to bring it out of reset and into an operational state.  This
>> differs to the M31 USB driver, in that the M31 eUSB2 driver will
>> require a connection to an eUSB2 repeater.  This PHY driver will handle
>> the initialization of the associated eUSB2 repeater when required.
>>
>> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>> Signed-off-by: Melody Olvera <quic_molvera@quicinc.com>
>> ---
>>   drivers/phy/qualcomm/Kconfig              |  10 +
>>   drivers/phy/qualcomm/Makefile             |   1 +
>>   drivers/phy/qualcomm/phy-qcom-m31-eusb2.c | 297 ++++++++++++++++++++++++++++++
>>   3 files changed, 308 insertions(+)
>>
>> diff --git a/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..b18aab968122683e2e87287a4b570321d376870a
>> --- /dev/null
>> +++ b/drivers/phy/qualcomm/phy-qcom-m31-eusb2.c
>> @@ -0,0 +1,297 @@
>> +// SPDX-License-Identifier: GPL-2.0+
> 
> GPL-2.0-only
> 

Will fix.

>> +/*
>> + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved.
>> + */
>> +
>> +#include <linux/clk.h>
>> +#include <linux/delay.h>
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/phy/phy.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reset.h>
>> +#include <linux/slab.h>
>> +
>> +#include <linux/regulator/consumer.h>
>> +
>> +#define USB_PHY_UTMI_CTRL0		(0x3c)
>> +
>> +#define USB_PHY_UTMI_CTRL5		(0x50)
>> +
>> +#define USB_PHY_HS_PHY_CTRL_COMMON0	(0x54)
>> +#define FSEL				GENMASK(6, 4)
>> +#define FSEL_38_4_MHZ_VAL		(0x6)
>> +
>> +#define USB_PHY_HS_PHY_CTRL2		(0x64)
>> +
>> +#define USB_PHY_CFG0			(0x94)
>> +#define USB_PHY_CFG1			(0x154)
>> +
>> +#define USB_PHY_FSEL_SEL		(0xb8)
>> +
>> +#define USB_PHY_XCFGI_39_32		(0x16c)
>> +#define USB_PHY_XCFGI_71_64		(0x17c)
>> +#define USB_PHY_XCFGI_31_24		(0x168)
>> +#define USB_PHY_XCFGI_7_0		(0x15c)
>> +
>> +#define M31_EUSB_PHY_INIT_CFG(o, b, v)	\
>> +{				\
>> +	.off = o,		\
>> +	.mask = b,		\
>> +	.val = v,		\
>> +}
>> +
>> +struct m31_phy_tbl_entry {
>> +	u32 off;
>> +	u32 mask;
>> +	u32 val;
>> +};
>> +
>> +struct m31_eusb2_priv_data {
>> +	const struct m31_phy_tbl_entry	*setup_seq;
>> +	unsigned int			setup_seq_nregs;
>> +	const struct m31_phy_tbl_entry	*override_seq;
>> +	unsigned int			override_seq_nregs;
>> +	const struct m31_phy_tbl_entry	*reset_seq;
>> +	unsigned int			reset_seq_nregs;
>> +	unsigned int			fsel;
>> +};
>> +
>> +static const struct m31_phy_tbl_entry m31_eusb2_setup_tbl[] = {
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_CFG0, BIT(1), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_UTMI_CTRL5, BIT(1), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_CFG1, BIT(0), 1),
>> +	M31_EUSB_PHY_INIT_CFG(USB_PHY_FSEL_SEL, BIT(0), 1),
> 
> I suppose, we can not expect to have #defines for all used bitfields?
> 

Added the bitfields as requested.

>> +};
>> +
> 
> [...]
> 
>> +
>> +static const struct phy_ops m31eusb2_phy_gen_ops = {
>> +	.init	= m31eusb2_phy_init,
>> +	.exit	= m31eusb2_phy_exit,
> 
> I think, you have a missing .set_mode callback here.
> 

Added this to properly set the mode on the repeater as well.

>> +	.owner	= THIS_MODULE,
>> +};
>> +
>> +static int m31eusb2_phy_probe(struct platform_device *pdev)
>> +{
>> +	struct phy_provider *phy_provider;
>> +	const struct m31_eusb2_priv_data *data;
>> +	struct device *dev = &pdev->dev;
>> +	struct m31eusb2_phy *phy;
>> +	int ret;
>> +
>> +	phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
>> +	if (!phy)
>> +		return -ENOMEM;
>> +
>> +	data = of_device_get_match_data(dev);
> 
> device_get_match_data()
> 

Done.

Thanks
Wesley Cheng

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

  reply	other threads:[~2025-04-08  2:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 20:18 [PATCH v3 00/10] phy: qcom: Introduce USB support for SM8750 Melody Olvera
2025-03-24 20:18 ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 01/10] dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp-phy: Add SM8750 to QMP PHY Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 02/10] dt-bindings: phy: Add the M31 based eUSB2 PHY bindings Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 03/10] dt-bindings: usb: qcom,dwc3: Add SM8750 compatible Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 04/10] phy: qcom: qmp-combo: Add new PHY sequences for SM8750 Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 05/10] phy: qcom: Update description for QCOM based eUSB2 repeater Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 06/10] phy: qcom: Add M31 based eUSB2 PHY driver Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-26 14:33   ` Dmitry Baryshkov
2025-03-26 14:33     ` Dmitry Baryshkov
2025-04-08  2:32     ` Wesley Cheng [this message]
2025-04-08  2:32       ` Wesley Cheng
2025-03-24 20:18 ` [PATCH v3 07/10] arm64: dts: qcom: sm8750: Add USB support to SM8750 SoCs Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-26 13:47   ` Konrad Dybcio
2025-03-26 13:47     ` Konrad Dybcio
2025-03-24 20:18 ` [PATCH v3 08/10] arm64: dts: qcom: sm8750: Add USB support for SM8750 MTP platform Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 09/10] arm64: dts: qcom: sm8750: Add USB support for SM8750 QRD platform Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-24 20:18 ` [PATCH v3 10/10] arm64: defconfig: Add M31 eUSB2 PHY config for SM8750 Melody Olvera
2025-03-24 20:18   ` Melody Olvera
2025-03-26 14:34   ` Dmitry Baryshkov
2025-03-26 14:34     ` Dmitry Baryshkov

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=73499d82-e7e5-b88a-41a4-160529efc988@quicinc.com \
    --to=quic_wcheng@quicinc.com \
    --cc=andersson@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=quic_molvera@quicinc.com \
    --cc=robh@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=will@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.