From: Peter Korsgaard <peter@korsgaard.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Max Filippov <jcmvbkbc@gmail.com>,
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 16:21:27 +0100 [thread overview]
Message-ID: <871tmm96yw.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20150122144522.GF3413@katana> (Wolfram Sang's message of "Thu, 22 Jan 2015 15:45:22 +0100")
>>>>> "Wolfram" == Wolfram Sang <wsa@the-dreams.de> writes:
>> @@ -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.
The confusion comes from the fact that the device tree bindings uses
clock-frequency for the clock frequency of the IP core and NOT for the
i2c bus frequency. This dates back to when the bindings where added
(049bb69d82e5f7f356) :/
The driver is currently hardcoded to use a 100KHz i2c bus clock (see
ocoores_init()).
--
Bye, Peter Korsgaard
prev parent reply other threads:[~2015-01-22 15:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 10:21 Max Filippov
2015-01-16 22:36 ` Peter Korsgaard
2015-01-22 14:45 ` Wolfram Sang
2015-01-22 15:01 ` Max Filippov
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
2015-01-22 19:26 ` Wolfram Sang
2015-01-22 20:53 ` Max Filippov
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 [this message]
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=871tmm96yw.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=jacmet@sunsite.dk \
--cc=jcmvbkbc@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa@the-dreams.de \
/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
all inboxes | Powered by JetHome®