netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
To: "Kweh, Hock Leong" <hock.leong.kweh@intel.com>,
	David Miller <davem@davemloft.net>
Cc: "rayagond@vayavyalabs.com" <rayagond@vayavyalabs.com>,
	"vbridgers2013@gmail.com" <vbridgers2013@gmail.com>,
	"wens@csie.org" <wens@csie.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Ong, Boon Leong" <boon.leong.ong@intel.com>,
	"tobias.johannes.klausmann@mni.thm.de"
	<tobias.johannes.klausmann@mni.thm.de>
Subject: Re: [PATCH] net: stmmac: fix stmmac_pci_probe failed when CONFIG_HAVE_CLK is selected
Date: Tue, 23 Sep 2014 08:10:09 +0200	[thread overview]
Message-ID: <54210EC1.9070507@st.com> (raw)
In-Reply-To: <F54AEECA5E2B9541821D670476DAE19C2B7EAE19@PGSMSX102.gar.corp.intel.com>

On 9/23/2014 3:16 AM, Kweh, Hock Leong wrote:
>> -----Original Message-----
>> From: David Miller [mailto:davem@davemloft.net]
>> Sent: Tuesday, September 23, 2014 2:19 AM
>> From: Kweh Hock Leong <hock.leong.kweh@intel.com>
>> Date: Thu, 18 Sep 2014 20:34:10 +0800
>>
>> Giuseppe, Kweh, where are we with this patch?
>
> We are discussing whether this is the correct fix to the issue. Below is the discussion log:
>
>>> Hmm I am not sure this is the right fix. The driver has to fail if the
>>> main clock is not found. Indeed dev_warn has to be changed in dev_err.
>>>
>>> Take a look at Documentation/networking/stmmac.txt but I will post
>>> some patch to improve the documentation adding further detail for clocks too.
>>>
>>> The the logic behind the code is that the CSR clock will be set at
>>> runtime if in case of priv->plat->clk_csr ==0 or it will be forced to
>>> a fixed value if passed from the platform instead of.
>>> IIRC This was required on some platforms time ago.
>>> For sure the driver is designed to fail in case of no main clock is found.
>>>
>>> Peppe
>>
>> Hi Peppe,
>>
>> I understand your point from the code below (at file stmmac_main.c line 2784):
>>
>> /* If a specific clk_csr value is passed from the platform
>>    * this means that the CSR Clock Range selection cannot be
>>    * changed at run-time and it is fixed. Viceversa the driver'll try to
>>    * set the MDC clock dynamically according to the csr actual
>>    * clock input.
>>    */
>> if (!priv->plat->clk_csr)
>>          stmmac_clk_csr_set(priv);
>> else
>>          priv->clk_csr = priv->plat->clk_csr;
>>
>>
>> I did search through the whole stmmac_main.c file and found that only stmmac_clk_csr_set()
>> function is leveraging the priv->stmmac_clk params for it calculation. By the logic point of view,
>> I do not need priv->stmmac_clk when I got priv->plat->clk_csr. With this thinking, I propose this
>> fix as when the probe get priv->plat->clk_csr, it shouldn't fail if priv->stmmac_clk has the error value.
>
> Hi Peppe,
>
> Are you trying to tell that if there is a fix CSR clock value, but driver cannot obtain the clk from devm_clk_get()
> (even it is not in use), the driver should fail the probe?
>
> You have a case with this condition:
> HW allow SW to discover the STMMAC controller but HW/SW configures not to supply the CLOCK to STMMAC controller?
>
> My understanding to these priv->plat->clk_csr and priv->stmmac_clk is that 1st one is fixed and 2nd one is dynamic.
> When fixed value occurs, dynamic one would not be use. Do I understand this correctly?

the logic is: the priv->stmmac_clk must be always provided from the
platform then we have two cases:

1) if priv->plat->clk_csr is also passed then it will be adopt in the
    mdio functions to program the Reg4[5:2]
    This was required in the past IIRC on SPEAr platforms.

2) if priv->plat->clk_csr is not passed from the platform then the
    priv->clk_csr will be set according to the priv->stmmac_clk
    and always used in the mdio part.

So IIUC now you are asking for not passing the priv->stmmac_clk
and warning this event w/o failing. Why you cannot pass this clock?

peppe


>
> Thanks.
>
>
> Regards,
> Wilson
>

  reply	other threads:[~2014-09-23  6:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 12:34 [PATCH] net: stmmac: fix stmmac_pci_probe failed when CONFIG_HAVE_CLK is selected Kweh Hock Leong
2014-09-18 14:49 ` Giuseppe CAVALLARO
2014-09-19  9:52   ` Kweh, Hock Leong
2014-09-22 18:19 ` David Miller
2014-09-23  1:16   ` Kweh, Hock Leong
2014-09-23  6:10     ` Giuseppe CAVALLARO [this message]
2014-09-23  7:03       ` Kweh, Hock Leong
2014-09-24  6:09         ` Giuseppe CAVALLARO
2014-09-24 10:48           ` Kweh, Hock Leong
2014-09-26 12:05             ` Giuseppe CAVALLARO
2014-09-26 12:12               ` Kweh, Hock Leong

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=54210EC1.9070507@st.com \
    --to=peppe.cavallaro@st.com \
    --cc=boon.leong.ong@intel.com \
    --cc=davem@davemloft.net \
    --cc=hock.leong.kweh@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rayagond@vayavyalabs.com \
    --cc=tobias.johannes.klausmann@mni.thm.de \
    --cc=vbridgers2013@gmail.com \
    --cc=wens@csie.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).