From: "Pritam Manohar Sutar" <pritam.sutar@samsung.com>
To: "'Vinod Koul'" <vkoul@kernel.org>
Cc: <kishon@kernel.org>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <alim.akhtar@samsung.com>,
<andre.draszik@linaro.org>, <peter.griffin@linaro.org>,
<kauschluss@disroot.org>, <ivo.ivanov.ivanov1@gmail.com>,
<igor.belwon@mentallysanemainliners.org>,
<m.szyprowski@samsung.com>, <s.nawrocki@samsung.com>,
<linux-phy@lists.infradead.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-samsung-soc@vger.kernel.org>, <rosa.pila@samsung.com>,
<dev.tailor@samsung.com>, <faraz.ata@samsung.com>,
<muhammed.ali@samsung.com>, <selvarasu.g@samsung.com>
Subject: RE: [PATCH v5 6/6] phy: exynos5-usbdrd: support SS combo phy for ExynosAutov920
Date: Mon, 18 Aug 2025 13:11:48 +0530 [thread overview]
Message-ID: <038a01dc1013$900a2800$b01e7800$@samsung.com> (raw)
In-Reply-To: <aJtN7uVUV3YhfY5-@vaman>
Hi Vinod,
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: 12 August 2025 07:52 PM
> To: Pritam Manohar Sutar <pritam.sutar@samsung.com>
> Cc: kishon@kernel.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; alim.akhtar@samsung.com; andre.draszik@linaro.org;
> peter.griffin@linaro.org; kauschluss@disroot.org;
> ivo.ivanov.ivanov1@gmail.com; igor.belwon@mentallysanemainliners.org;
> m.szyprowski@samsung.com; s.nawrocki@samsung.com; linux-
> phy@lists.infradead.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-
> samsung-soc@vger.kernel.org; rosa.pila@samsung.com;
> dev.tailor@samsung.com; faraz.ata@samsung.com;
> muhammed.ali@samsung.com; selvarasu.g@samsung.com
> Subject: Re: [PATCH v5 6/6] phy: exynos5-usbdrd: support SS combo phy for
> ExynosAutov920
>
> On 05-08-25, 17:22, Pritam Manohar Sutar wrote:
> > Add required change in phy driver to support combo SS phy for this SoC.
> >
> > Signed-off-by: Pritam Manohar Sutar <pritam.sutar@samsung.com>
> > ---
> > drivers/phy/samsung/phy-exynos5-usbdrd.c | 327
> +++++++++++++++++++-
> > include/linux/soc/samsung/exynos-regs-pmu.h | 1 +
> > 2 files changed, 324 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/phy/samsung/phy-exynos5-usbdrd.c
> > b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> > index c22f4de7d094..1108f0c07755 100644
> > --- a/drivers/phy/samsung/phy-exynos5-usbdrd.c
> > +++ b/drivers/phy/samsung/phy-exynos5-usbdrd.c
> > @@ -273,6 +273,36 @@
> > #define EXYNOSAUTOV920_DRD_HSPPLLTUNE 0x110
> > #define HSPPLLTUNE_FSEL GENMASK(18, 16)
> >
> > +/* ExynosAutov920 phy usb31drd port reg */
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_RST_CTRL 0x000
> > +#define PHY_RST_CTRL_PIPE_LANE0_RESET_N_OVRD_EN BIT(5)
> > +#define PHY_RST_CTRL_PIPE_LANE0_RESET_N BIT(4)
> > +#define PHY_RST_CTRL_PHY_RESET_OVRD_EN BIT(1)
> > +#define PHY_RST_CTRL_PHY_RESET BIT(0)
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0
> 0x0004
> > +#define PHY_CR_PARA_CON0_PHY0_CR_PARA_ADDR
> GENMASK(31, 16)
> > +#define PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK BIT(8)
> > +#define PHY_CR_PARA_CON0_PHY0_CR_PARA_ACK BIT(4)
> > +#define PHY_CR_PARA_CON0_PHY0_CR_PARA_SEL BIT(0)
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON1
> 0x0008
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON2
> 0x000c
> > +#define PHY_CR_PARA_CON2_PHY0_CR_PARA_WR_EN BIT(0)
> > +#define PHY_CR_PARA_CON2_PHY0_CR_PARA_WR_DATA
> GENMASK(31, 16)
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CONFIG0 0x100
> > +#define PHY_CONFIG0_PHY0_PMA_PWR_STABLE BIT(14)
> > +#define PHY_CONFIG0_PHY0_PCS_PWR_STABLE BIT(13)
> > +#define PHY_CONFIG0_PHY0_ANA_PWR_EN BIT(1)
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CONFIG7 0x11c
> > +#define PHY_CONFIG7_PHY_TEST_POWERDOWN BIT(24)
> > +
> > +#define EXYNOSAUTOV920_USB31DRD_PHY_CONFIG4 0x110
> > +#define PHY_CONFIG4_PIPE_RX0_SRIS_MODE_EN BIT(2)
> > +
> > /* Exynos9 - GS101 */
> > #define EXYNOS850_DRD_SECPMACTL 0x48
> > #define SECPMACTL_PMA_ROPLL_REF_CLK_SEL
> GENMASK(13, 12)
> > @@ -2077,6 +2107,253 @@ static const struct
> exynos5_usbdrd_phy_drvdata exynos990_usbdrd_phy = {
> > .n_regulators = ARRAY_SIZE(exynos5_regulator_names),
> > };
> >
> > +static void
> > +exynosautov920_usb31drd_cr_clk(struct exynos5_usbdrd_phy *phy_drd,
> > +bool high) {
> > + void __iomem *reg_phy = phy_drd->reg_phy;
> > + u32 reg = 0;
>
> again..
>
> > +
> > + reg = readl(reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + if (high)
> > + reg |= PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK;
> > + else
> > + reg &= ~PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK;
> > +
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + fsleep(1);
> > +}
> > +
> > +static void
> > +exynosautov920_usb31drd_port_phy_ready(struct exynos5_usbdrd_phy
> > +*phy_drd) {
> > + struct device *dev = phy_drd->dev;
> > + void __iomem *reg_phy = phy_drd->reg_phy;
> > + static const unsigned int timeout_us = 20000;
> > + static const unsigned int sleep_us = 40;
> > + u32 reg = 0;
>
> here too
>
> > + int err;
> > +
> > + /* Clear cr_para_con */
> > + reg &= ~(PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK |
> > + PHY_CR_PARA_CON0_PHY0_CR_PARA_ADDR);
> > + reg |= PHY_CR_PARA_CON0_PHY0_CR_PARA_SEL;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + writel(0x0, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON1);
> > + writel(0x0, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON2);
> > +
> > + exynosautov920_usb31drd_cr_clk(phy_drd, true);
> > + exynosautov920_usb31drd_cr_clk(phy_drd, false);
> > +
> > + /*
> > + * The maximum time from phy reset de-assertion to de-assertion of
> > + * tx/rx_ack can be as high as 5ms in fast simulation mode.
> > + * Time to phy ready is < 20ms
> > + */
> > + err = readl_poll_timeout(reg_phy +
> > +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0,
> > + reg, !(reg &
> PHY_CR_PARA_CON0_PHY0_CR_PARA_ACK),
> > + sleep_us, timeout_us);
> > + if (err)
> > + dev_err(dev, "timed out waiting for rx/tx_ack: %#.8x\n",
> reg);
> > +
> > + reg &= ~PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > +}
> > +
> > +static void
> > +exynosautov920_usb31drd_cr_write(struct exynos5_usbdrd_phy
> *phy_drd,
> > + u16 addr, u16 data)
> > +{
> > + struct device *dev = phy_drd->dev;
> > + void __iomem *reg_phy = phy_drd->reg_phy;
> > + u32 cnt = 0;
> > + u32 reg = 0;
>
> this one, former is okay
>
> > +
> > + /* Pre Clocking */
> > + reg = readl(reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + reg |= PHY_CR_PARA_CON0_PHY0_CR_PARA_SEL;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > +
> > + /*
> > + * tx clks must be available prior to assertion of tx req.
> > + * tx pstate p2 to p0 transition directly is not permitted.
> > + * tx clk ready must be asserted synchronously on tx clk prior
> > + * to internal transmit clk alignment sequence in the phy
> > + * when entering from p2 to p1 to p0.
> > + */
> > + do {
> > + exynosautov920_usb31drd_cr_clk(phy_drd, true);
> > + exynosautov920_usb31drd_cr_clk(phy_drd, false);
> > + cnt++;
> > + } while (cnt < 15);
> > +
> > + reg &= ~PHY_CR_PARA_CON0_PHY0_CR_PARA_SEL;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > +
> > + /*
> > + * tx data path is active when tx lane is in p0 state
> > + * and tx data en asserted. enable cr_para_wr_en.
> > + */
> > + reg = readl(reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON2);
> > + reg &= ~PHY_CR_PARA_CON2_PHY0_CR_PARA_WR_DATA;
> > + reg |=
> FIELD_PREP(PHY_CR_PARA_CON2_PHY0_CR_PARA_WR_DATA, data) |
> > + PHY_CR_PARA_CON2_PHY0_CR_PARA_WR_EN;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON2);
> > +
> > + /* write addr */
> > + reg = readl(reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + reg &= ~PHY_CR_PARA_CON0_PHY0_CR_PARA_ADDR;
> > + reg |= FIELD_PREP(PHY_CR_PARA_CON0_PHY0_CR_PARA_ADDR,
> addr) |
> > + PHY_CR_PARA_CON0_PHY0_CR_PARA_CLK |
> > + PHY_CR_PARA_CON0_PHY0_CR_PARA_SEL;
> > + writel(reg, reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > +
> > + /* check cr_para_ack*/
> > + cnt = 0;
> > + do {
> > + /*
> > + * data symbols are captured by phy on rising edge of the
> > + * tx_clk when tx data enabled.
> > + * completion of the write cycle is acknowledged by
assertion
> > + * of the cr_para_ack.
> > + */
> > + exynosautov920_usb31drd_cr_clk(phy_drd, true);
> > + reg = readl(reg_phy +
> EXYNOSAUTOV920_USB31DRD_PHY_CR_PARA_CON0);
> > + if ((reg & PHY_CR_PARA_CON0_PHY0_CR_PARA_ACK))
> > + break;
> > +
> > + exynosautov920_usb31drd_cr_clk(phy_drd, false);
> > +
> > + /*
> > + * wait for minimum of 10 cr_para_clk cycles after phy reset
> > + * is negated, before accessing control regs to allow for
> > + * internal resets.
> > + */
> > + cnt++;
> > + } while (cnt < 10);
> > +
> > + if (cnt == 10)
> > + dev_dbg(dev, "CR write failed to 0x%04x\n", addr);
>
> Not error?
This is only for debugging purpose. It is not considered as error.
> --
> ~Vinod
Will address other comments in next version of the patch-set (v6).
Thank you.
Regards,
Pritam
next prev parent reply other threads:[~2025-08-19 5:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250805114303epcas5p4c88843b7e38d86b722e60e386c637160@epcas5p4.samsung.com>
2025-08-05 11:52 ` [PATCH v5 0/6] initial usbdrd phy support for Exynosautov920 soc Pritam Manohar Sutar
[not found] ` <CGME20250805114306epcas5p37782c02ae0ddc6b77094786c90af247a@epcas5p3.samsung.com>
2025-08-05 11:52 ` [PATCH v5 1/6] dt-bindings: phy: samsung,usb3-drd-phy: add ExynosAutov920 HS phy compatible Pritam Manohar Sutar
2025-08-06 23:42 ` Rob Herring
2025-08-07 12:21 ` Pritam Manohar Sutar
[not found] ` <CGME20250805114310epcas5p459aa232884d22501f5fefe42f239fecc@epcas5p4.samsung.com>
2025-08-05 11:52 ` [PATCH v5 2/6] phy: exynos5-usbdrd: support HS phy for ExynosAutov920 Pritam Manohar Sutar
2025-08-12 14:15 ` Vinod Koul
2025-08-14 13:26 ` Pritam Manohar Sutar
[not found] ` <CGME20250805114313epcas5p15b843d7fe692feb20828a789cef49dc0@epcas5p1.samsung.com>
2025-08-05 11:52 ` [PATCH v5 3/6] dt-bindings: phy: samsung,usb3-drd-phy: add ExynosAutov920 combo hsphy Pritam Manohar Sutar
[not found] ` <CGME20250805114316epcas5p49b78db499c2e37a1fe68f4b2f0be62a7@epcas5p4.samsung.com>
2025-08-05 11:52 ` [PATCH v5 4/6] phy: exynos5-usbdrd: support HS combo phy for ExynosAutov920 Pritam Manohar Sutar
2025-08-12 14:18 ` Vinod Koul
2025-08-19 5:40 ` Pritam Manohar Sutar
[not found] ` <CGME20250805114320epcas5p3968288f8d01944d3d730b3094a7befe4@epcas5p3.samsung.com>
2025-08-05 11:52 ` [PATCH v5 5/6] dt-bindings: phy: samsung,usb3-drd-phy: add ExynosAutov920 combo ssphy Pritam Manohar Sutar
2025-08-06 23:43 ` Rob Herring
2025-08-07 12:32 ` Pritam Manohar Sutar
[not found] ` <CGME20250805114323epcas5p39bf73c5e0a9382ff54b1832724804cc9@epcas5p3.samsung.com>
2025-08-05 11:52 ` [PATCH v5 6/6] phy: exynos5-usbdrd: support SS combo phy for ExynosAutov920 Pritam Manohar Sutar
2025-08-12 14:21 ` Vinod Koul
2025-08-18 7:41 ` Pritam Manohar Sutar [this message]
2025-08-19 6:54 ` Vinod Koul
2025-08-19 7:44 ` Pritam Manohar Sutar
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='038a01dc1013$900a2800$b01e7800$@samsung.com' \
--to=pritam.sutar@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=andre.draszik@linaro.org \
--cc=conor+dt@kernel.org \
--cc=dev.tailor@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=faraz.ata@samsung.com \
--cc=igor.belwon@mentallysanemainliners.org \
--cc=ivo.ivanov.ivanov1@gmail.com \
--cc=kauschluss@disroot.org \
--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=m.szyprowski@samsung.com \
--cc=muhammed.ali@samsung.com \
--cc=peter.griffin@linaro.org \
--cc=robh@kernel.org \
--cc=rosa.pila@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=selvarasu.g@samsung.com \
--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 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).