[PATCH 04/16] PCI: samsung: Use clock bulk API to get clocks

Shradha Todi shradha.t at samsung.com
Thu Mar 2 04:59:00 PST 2023



> -----Original Message-----
> From: Krzysztof Kozlowski [mailto:krzysztof.kozlowski at linaro.org]
> Sent: 16 February 2023 16:33
> To: Shradha Todi <shradha.t at samsung.com>; lpieralisi at kernel.org;
> kw at linux.com; robh at kernel.org; bhelgaas at google.com;
> krzysztof.kozlowski+dt at linaro.org; alim.akhtar at samsung.com;
> jingoohan1 at gmail.com; Sergey.Semin at baikalelectronics.ru;
> lukas.bulwahn at gmail.com; hongxing.zhu at nxp.com; tglx at linutronix.de;
> m.szyprowski at samsung.com; jh80.chung at samsung.co;
> pankaj.dubey at samsung.com
> Cc: linux-pci at vger.kernel.org; devicetree at vger.kernel.org; linux-arm-
> kernel at lists.infradead.org; linux-samsung-soc at vger.kernel.org; linux-
> kernel at vger.kernel.org
> Subject: Re: [PATCH 04/16] PCI: samsung: Use clock bulk API to get clocks
> 
> On 14/02/2023 13:13, Shradha Todi wrote:
> > Adopt to clock bulk API to handle clocks.
> >
> > Signed-off-by: Shradha Todi <shradha.t at samsung.com>
> > ---
> >  drivers/pci/controller/dwc/pci-samsung.c | 46 ++++++------------------
> >  1 file changed, 11 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/pci/controller/dwc/pci-samsung.c
> b/drivers/pci/controller/dwc/pci-samsung.c
> > index cfe384aee754..6c07d3f151be 100644
> > --- a/drivers/pci/controller/dwc/pci-samsung.c
> > +++ b/drivers/pci/controller/dwc/pci-samsung.c
> > @@ -54,8 +54,8 @@
> >  struct exynos_pcie {
> >  	struct dw_pcie			pci;
> >  	void __iomem			*elbi_base;
> > -	struct clk			*clk;
> > -	struct clk			*bus_clk;
> > +	struct clk_bulk_data		*clks;
> > +	int				clk_cnt;
> >  	struct phy			*phy;
> >  	struct regulator_bulk_data	supplies[2];
> >  };
> > @@ -65,30 +65,18 @@ static int exynos_pcie_init_clk_resources(struct
> exynos_pcie *ep)
> >  	struct device *dev = ep->pci.dev;
> >  	int ret;
> >
> > -	ret = clk_prepare_enable(ep->clk);
> > -	if (ret) {
> > -		dev_err(dev, "cannot enable pcie rc clock");
> > +	ret = devm_clk_bulk_get_all(dev, &ep->clks);
> > +	if (ret < 0)
> >  		return ret;
> > -	}
> >
> > -	ret = clk_prepare_enable(ep->bus_clk);
> > -	if (ret) {
> > -		dev_err(dev, "cannot enable pcie bus clock");
> > -		goto err_bus_clk;
> > -	}
> > +	ep->clk_cnt = ret;
> 
> I think this misses check if you got two clocks.
> 
> 

Got it! Thanks for pointing out. Will add the check in the next version

> Best regards,
> Krzysztof





More information about the linux-arm-kernel mailing list