[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <C246CAC1457055469EF09E3A7AC4E11A4A579A06@XAP-PVEXMBX01.xlnx.xilinx.com>
Date: Thu, 21 Apr 2016 17:13:18 +0000
From: Appana Durga Kedareswara Rao <appana.durga.rao@...inx.com>
To: Soren Brinkmann <sorenb@...inx.com>
CC: Soren Brinkmann <sorenb@...inx.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"pawel.moll@....com" <pawel.moll@....com>,
"mark.rutland@....com" <mark.rutland@....com>,
"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
"galak@...eaurora.org" <galak@...eaurora.org>,
Michal Simek <michals@...inx.com>,
"vinod.koul@...el.com" <vinod.koul@...el.com>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"moritz.fischer@...us.com" <moritz.fischer@...us.com>,
"laurent.pinchart@...asonboard.com"
<laurent.pinchart@...asonboard.com>,
"luis@...ethencourt.com" <luis@...ethencourt.com>,
Anirudha Sarangi <anirudh@...inx.com>,
Punnaiah Choudary Kalluri <punnaia@...inx.com>,
Shubhrajyoti Datta <shubhraj@...inx.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>
Subject: RE: [PATCH v3 3/3] dmaengine: vdma: Add clock support
Hi Soren,
> -----Original Message-----
> From: Sören Brinkmann [mailto:soren.brinkmann@...inx.com]
> Sent: Thursday, April 21, 2016 10:32 PM
> To: Appana Durga Kedareswara Rao <appanad@...inx.com>
> Cc: Soren Brinkmann <sorenb@...inx.com>; robh+dt@...nel.org;
> pawel.moll@....com; mark.rutland@....com; ijc+devicetree@...lion.org.uk;
> galak@...eaurora.org; Michal Simek <michals@...inx.com>;
> vinod.koul@...el.com; dan.j.williams@...el.com; moritz.fischer@...us.com;
> laurent.pinchart@...asonboard.com; luis@...ethencourt.com; Anirudha
> Sarangi <anirudh@...inx.com>; Punnaiah Choudary Kalluri
> <punnaia@...inx.com>; Shubhrajyoti Datta <shubhraj@...inx.com>;
> devicetree@...r.kernel.org; linux-arm-kernel@...ts.infradead.org; linux-
> kernel@...r.kernel.org; dmaengine@...r.kernel.org
> Subject: Re: [PATCH v3 3/3] dmaengine: vdma: Add clock support
>
> On Thu, 2016-04-21 at 09:32:44 -0700, Appana Durga Kedareswara Rao wrote:
> > Hi Soren,
> >
> > > -----Original Message-----
> > > From: Sören Brinkmann [mailto:soren.brinkmann@...inx.com]
> > > Sent: Thursday, April 21, 2016 9:52 PM
> > > To: Appana Durga Kedareswara Rao <appanad@...inx.com>
> > > Cc: robh+dt@...nel.org; pawel.moll@....com; mark.rutland@....com;
> > > ijc+devicetree@...lion.org.uk; galak@...eaurora.org; Michal Simek
> > > <michals@...inx.com>; vinod.koul@...el.com; dan.j.williams@...el.com;
> > > Appana Durga Kedareswara Rao <appanad@...inx.com>;
> > > moritz.fischer@...us.com; laurent.pinchart@...asonboard.com;
> > > luis@...ethencourt.com; Anirudha Sarangi <anirudh@...inx.com>; Punnaiah
> > > Choudary Kalluri <punnaia@...inx.com>; Shubhrajyoti Datta
> > > <shubhraj@...inx.com>; devicetree@...r.kernel.org; linux-arm-
> > > kernel@...ts.infradead.org; linux-kernel@...r.kernel.org;
> > > dmaengine@...r.kernel.org
> > > Subject: Re: [PATCH v3 3/3] dmaengine: vdma: Add clock support
> > >
> > > On Thu, 2016-04-21 at 16:08:38 +0530, Kedareswara rao Appana wrote:
> [...]
> > > > @@ -1757,6 +1767,200 @@ static void xilinx_dma_chan_remove(struct
> > > xilinx_dma_chan *chan)
> > > > list_del(&chan->common.device_node);
> > > > }
> > > >
> > > > +static int axidma_clk_init(struct platform_device *pdev, struct clk
> **axi_clk,
> > > > + struct clk **tx_clk, struct clk **rx_clk,
> > > > + struct clk **sg_clk, struct clk **tmp_clk) {
> > > > + int err;
> > > > +
> > > > + *tmp_clk = NULL;
> > > > +
> > > > + *axi_clk = devm_clk_get(&pdev->dev, "s_axi_lite_aclk");
> > > > + if (IS_ERR(*axi_clk)) {
> > > > + err = PTR_ERR(*axi_clk);
> > > > + dev_err(&pdev->dev, "failed to get axi_aclk (%u)\n", err);
> > > > + return err;
> > > > + }
> > > > +
> > > > + *tx_clk = devm_clk_get(&pdev->dev, "m_axi_mm2s_aclk");
> > > > + if (IS_ERR(*tx_clk))
> > > > + *tx_clk = NULL;
> > > > +
> > > > + *rx_clk = devm_clk_get(&pdev->dev, "m_axi_s2mm_aclk");
> > > > + if (IS_ERR(*rx_clk))
> > > > + *rx_clk = NULL;
> > > > +
> > > > + *sg_clk = devm_clk_get(&pdev->dev, "m_axi_sg_aclk");
> > > > + if (IS_ERR(*sg_clk))
> > > > + *sg_clk = NULL;
> > > > +
> > > > +
> > > > + err = clk_prepare_enable(*axi_clk);
> > >
> > > Should this be called if you know that the pointer might be NULL?
> >
> > It is a mandatory clock and if this clk is not there in DT I am already returning
> error...
> > I didn't get your question could you please elaborate???
>
> But for all the optional clocks. They could all be NULL and you're calling
> clk_prepare_enable with a NULL pointer. That function is nice enough to
> do a NULL check for you, but I wonder whether these calls should happen at
> all when you already know that the pointer is not a valid clock.
I referred macb driver http://lxr.free-electrons.com/source/drivers/net/ethernet/cadence/macb.c
There tx_clk is optional and in this driver they are calling clk_prepare_enable for the optional clocks.
Please let me know if you are ok to call the clk_prepare_enable() for optional clocks with a NULL pointer.
Will fix rest of the comments and will send next version of the patch...
Regards,
Kedar.
>
> Sören
Powered by blists - more mailing lists