linux-phy.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Vinod Koul <vkoul@kernel.org>
Cc: "Marek Szyprowski" <m.szyprowski@samsung.com>,
	linux-pci@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-phy@lists.infradead.org,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>
Subject: Re: [PATCH 1/2] phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks
Date: Tue, 12 Jul 2022 15:12:27 -0500	[thread overview]
Message-ID: <20220712201227.GA791612@bhelgaas> (raw)
In-Reply-To: <YsPZU83Jl/kcqR8h@matsya>

On Tue, Jul 05, 2022 at 11:55:23AM +0530, Vinod Koul wrote:
> On 29-06-22, 00:04, Marek Szyprowski wrote:
> > The exynos-pcie driver called phy_power_on() and then phy_init() for some
> > historical reasons. However the generic PHY framework assumes that the
> > proper sequence is to call phy_init() first, then phy_power_on(). The
> > operations done by both functions should be considered as one action and
> > as such they are called by the exynos-pcie driver (without doing anything
> > between them). The initialization is just a sequence of register writes,
> > which cannot be altered, without breaking the hardware operation.
> > 
> > To match the generic PHY framework requirement, simply move all register
> > writes to the phy_init()/phy_exit() and drop power_on()/power_off()
> > callbacks. This way the driver will also work with the old (incorrect)
> > PHY initialization call sequence.
> 
> Is the plan to merge thru pcie tree?

I guess these patches should go together.  I don't see any major
exynos series pending, but I do have two minor pci-exynos.c patches in
the queue.

If you ack it (after resolution of your question below) I'd be happy
to take both if it doesn't cause trouble for you.

> > Reported-by: Bjorn Helgaas <helgaas@kernel.org>
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > ---
> >  drivers/phy/samsung/phy-exynos-pcie.c | 25 +++++++++----------------
> >  1 file changed, 9 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/phy/samsung/phy-exynos-pcie.c b/drivers/phy/samsung/phy-exynos-pcie.c
> > index 578cfe07d07a..53c9230c2907 100644
> > --- a/drivers/phy/samsung/phy-exynos-pcie.c
> > +++ b/drivers/phy/samsung/phy-exynos-pcie.c
> > @@ -51,6 +51,13 @@ static int exynos5433_pcie_phy_init(struct phy *phy)
> >  {
> >  	struct exynos_pcie_phy *ep = phy_get_drvdata(phy);
> >  
> > +	regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET,
> > +			   BIT(0), 1);
> > +	regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET,
> > +			   PCIE_APP_REQ_EXIT_L1_MODE, 0);
> > +	regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON,
> > +			   PCIE_REFCLK_GATING_EN, 0);
> > +
> 
> why not retain exynos5433_pcie_phy_power_on() and call it from here and
> drop in ops. It would be clear to reader that these are for turning on
> the phy...
> 
> >  	regmap_update_bits(ep->fsysreg,	PCIE_EXYNOS5433_PHY_COMMON_RESET,
> >  			   PCIE_PHY_RESET, 1);
> >  	regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_MAC_RESET,
> > @@ -109,20 +116,7 @@ static int exynos5433_pcie_phy_init(struct phy *phy)
> >  	return 0;
> >  }
> >  
> > -static int exynos5433_pcie_phy_power_on(struct phy *phy)
> > -{
> > -	struct exynos_pcie_phy *ep = phy_get_drvdata(phy);
> > -
> > -	regmap_update_bits(ep->pmureg, EXYNOS5433_PMU_PCIE_PHY_OFFSET,
> > -			   BIT(0), 1);
> > -	regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_GLOBAL_RESET,
> > -			   PCIE_APP_REQ_EXIT_L1_MODE, 0);
> > -	regmap_update_bits(ep->fsysreg, PCIE_EXYNOS5433_PHY_L1SUB_CM_CON,
> > -			   PCIE_REFCLK_GATING_EN, 0);
> > -	return 0;
> > -}
> > -
> > -static int exynos5433_pcie_phy_power_off(struct phy *phy)
> > +static int exynos5433_pcie_phy_exit(struct phy *phy)
> >  {
> >  	struct exynos_pcie_phy *ep = phy_get_drvdata(phy);
> >  
> > @@ -135,8 +129,7 @@ static int exynos5433_pcie_phy_power_off(struct phy *phy)
> >  
> >  static const struct phy_ops exynos5433_phy_ops = {
> >  	.init		= exynos5433_pcie_phy_init,
> > -	.power_on	= exynos5433_pcie_phy_power_on,
> > -	.power_off	= exynos5433_pcie_phy_power_off,
> > +	.exit		= exynos5433_pcie_phy_exit,
> >  	.owner		= THIS_MODULE,
> >  };
> >  
> > -- 
> > 2.17.1
> 
> -- 
> ~Vinod
> 
> -- 
> linux-phy mailing list
> linux-phy@lists.infradead.org
> https://lists.infradead.org/mailman/listinfo/linux-phy

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

  reply	other threads:[~2022-07-12 20:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220628220437eucas1p2c478751458323f93a71050c4a949f12e@eucas1p2.samsung.com>
2022-06-28 22:04 ` [PATCH 1/2] phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks Marek Szyprowski
     [not found]   ` <CGME20220628220441eucas1p2098d46abc47ec1888781fdc5319dec67@eucas1p2.samsung.com>
2022-06-28 22:04     ` [PATCH 2/2] PCI: dwc: exynos: Correct generic PHY usage Marek Szyprowski
2022-06-29  2:57       ` Chanho Park
2022-06-29  6:05       ` Krzysztof Kozlowski
2022-06-29  2:57   ` [PATCH 1/2] phy: samsung: phy-exynos-pcie: sanitize init/power_on callbacks Chanho Park
2022-06-29  6:04   ` Krzysztof Kozlowski
2022-07-05  6:25   ` Vinod Koul
2022-07-12 20:12     ` Bjorn Helgaas [this message]
2022-07-15 11:35       ` Vinod Koul
2022-07-15 22:43         ` Bjorn Helgaas
2022-07-15 23:12           ` Bjorn Helgaas
2022-07-15 11:35   ` Vinod Koul
2022-07-15 23:21   ` Bjorn Helgaas

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=20220712201227.GA791612@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=bhelgaas@google.com \
    --cc=jingoohan1@gmail.com \
    --cc=kishon@ti.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=kw@linux.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=m.szyprowski@samsung.com \
    --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 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).