Netdev List
 help / color / mirror / Atom feed
From: "Mario Hüttel" <mario.huettel@gmx.net>
To: Franklin S Cooper Jr <fcooper@ti.com>,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	netdev@vger.kernel.org, linux-can@vger.kernel.org,
	wg@grandegger.com, mkl@pengutronix.de, robh+dt@kernel.org,
	quentin.schulz@free-electrons.com
Subject: Re: [PATCH v2 1/3] can: m_can: Make hclk optional
Date: Thu, 21 Sep 2017 00:00:01 +0200	[thread overview]
Message-ID: <096c73b1-eaa5-8c40-4486-e08a784c0897@gmx.net> (raw)
In-Reply-To: <20170724225142.19975-2-fcooper@ti.com>


[-- Attachment #1.1: Type: text/plain, Size: 2347 bytes --]

> Hclk is the MCAN's interface clock. However, for OMAP based devices such as
> DRA7 SoC family the interface clock is handled by hwmod. Therefore, this
> interface clock is managed by hwmod driver via pm_runtime_get and
> pm_runtime_put calls. Therefore, this interface clock isn't defined in DT
> and thus the driver shouldn't fail if this clock isn't found.
I also agree in this point.
However, there's a problem I want to point out:

The M_CAN can only function correctly, if the condition
'hclk >= cclk' holds true.

The internal clock domain crossing can fail if this condition
is violated.

I thought about adding the condition to the driver to ensure
correct operation. But I had some problems:

1. Determine the clock rates:
    The devices you've mentioned above don't have an assigned
    hclk. Is there still a possibility to get the clock frequency?

2. What to do if 'hclk < cclk'?
    Is there a general way to process such an error? - I think not.
    Is a simple warning in case of an error enough?

Is there a way of ensuring that the condition is always met at all?

I think it is quite unlikely that the condition is violated, because
devices that actually run Linux usually have (bus) clock rates that
are high enough to ensure the correct operation.

Would it be safe to just ignore this possible fault?

Regards

Mario
   
>
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
> Version 2 changes:
> Used NULL instead of 0 for unused hclk handle
>
>  drivers/net/can/m_can/m_can.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index f4947a7..ea48e59 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1568,8 +1568,13 @@ static int m_can_plat_probe(struct platform_device *pdev)
>  	hclk = devm_clk_get(&pdev->dev, "hclk");
>  	cclk = devm_clk_get(&pdev->dev, "cclk");
>  
> -	if (IS_ERR(hclk) || IS_ERR(cclk)) {
> -		dev_err(&pdev->dev, "no clock found\n");
> +	if (IS_ERR(hclk)) {
> +		dev_warn(&pdev->dev, "hclk could not be found\n");
> +		hclk = NULL;
> +	}
> +
> +	if (IS_ERR(cclk)) {
> +		dev_err(&pdev->dev, "cclk could not be found\n");
>  		ret = -ENODEV;
>  		goto failed_ret;
>  	}



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-09-20 22:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-24 22:51 [PATCH v2 0/3] can: m_can: Add PM Runtime Support Franklin S Cooper Jr
     [not found] ` <20170724225142.19975-1-fcooper-l0cyMroinI0@public.gmane.org>
2017-07-24 22:51   ` [PATCH v2 1/3] can: m_can: Make hclk optional Franklin S Cooper Jr
2017-08-24  8:00     ` [v2,1/3] " Sekhar Nori
     [not found]       ` <6f574628-51cd-0db8-e5aa-e7ae4a9cf79a-l0cyMroinI0@public.gmane.org>
2017-09-21  0:31         ` Franklin S Cooper Jr
2017-09-21 14:08           ` Sekhar Nori
2017-09-21 19:35             ` Franklin S Cooper Jr
2017-09-20 22:00     ` Mario Hüttel [this message]
2017-09-20 23:29       ` [PATCH v2 1/3] " Franklin S Cooper Jr
2017-07-24 22:51 ` [PATCH v2 2/3] can: m_can: Update documentation to indicate that hclk may be optional Franklin S Cooper Jr
2017-07-24 22:51 ` [PATCH v2 3/3] can: m_can: Add PM Runtime Franklin S Cooper Jr
2017-08-24  8:30   ` [v2,3/3] " Sekhar Nori
     [not found]     ` <8037f5f9-d51f-99c3-f2e8-62c90e56a6fa-l0cyMroinI0@public.gmane.org>
2017-09-21  0:36       ` Franklin S Cooper Jr
2017-09-22  1:54         ` Yang, Wenyou

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=096c73b1-eaa5-8c40-4486-e08a784c0897@gmx.net \
    --to=mario.huettel@gmx.net \
    --cc=devicetree@vger.kernel.org \
    --cc=fcooper@ti.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.schulz@free-electrons.com \
    --cc=robh+dt@kernel.org \
    --cc=wg@grandegger.com \
    /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