linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: Peter Korsgaard <jacmet@sunsite.dk>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c-ocores: add common clock support
Date: Thu, 22 Jan 2015 15:45:22 +0100	[thread overview]
Message-ID: <20150122144522.GF3413@katana> (raw)
In-Reply-To: <1421230899-7843-1-git-send-email-jcmvbkbc@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

> @@ -320,9 +322,23 @@ static int ocores_i2c_of_probe(struct platform_device *pdev,
>  	}
>  
>  	if (of_property_read_u32(np, "clock-frequency", &val)) {
> -		dev_err(&pdev->dev,
> -			"Missing required parameter 'clock-frequency'\n");
> -		return -ENODEV;
> +		struct clk *clk = devm_clk_get(&pdev->dev, NULL);
> +
> +		if (!IS_ERR(clk)) {
> +			int ret = clk_prepare_enable(clk);
> +
> +			if (ret) {
> +				dev_err(&pdev->dev,
> +					"clk_prepare_enable failed: %d\n", ret);
> +				return ret;
> +			}
> +			i2c->clk = clk;
> +			val = clk_get_rate(clk);
> +		} else {
> +			dev_err(&pdev->dev,
> +				"Missing required parameter 'clock-frequency'\n");
> +			return -ENODEV;
> +		}

Either NAK or I don't understand the logic here :) If a dts does NOT
have the bus-speed set by 'clock-frequency', then we take the value of
the clock assigned to this platform_device?

The usual thing to do when 'clock-frequency' is not set is to default to
100kHz.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-01-22 14:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 10:21 [PATCH] i2c-ocores: add common clock support Max Filippov
     [not found] ` <1421230899-7843-1-git-send-email-jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-01-16 22:36   ` Peter Korsgaard
2015-01-22 14:45 ` Wolfram Sang [this message]
2015-01-22 15:01   ` Max Filippov
     [not found]     ` <CAMo8Bf+XJY_bY+OB2i_SZQmAavwERG39BR8FVj202V-E3UidPg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-22 15:07       ` Wolfram Sang
2015-01-22 18:28         ` Peter Korsgaard
2015-01-22 18:57           ` Wolfram Sang
2015-01-22 19:15             ` Max Filippov
     [not found]               ` <CAMo8BfJdmB-=i4bJypHzGvegxgBPafpiT_hyQXLhvzBUmE+u_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-22 19:26                 ` Wolfram Sang
2015-01-22 20:53                   ` Max Filippov
     [not found]                     ` <CAMo8BfJqS1O=ZiVs89wsuNuQ_Qt=2BJtcens=09POucM_OjXrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-22 23:21                       ` Wolfram Sang
2015-01-22 20:36             ` Max Filippov
2015-01-22 20:41               ` Wolfram Sang
2015-01-22 15:21   ` Peter Korsgaard

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=20150122144522.GF3413@katana \
    --to=wsa@the-dreams.de \
    --cc=jacmet@sunsite.dk \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.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).