From: "Cousson, Benoit" <b-cousson-l0cyMroinI0@public.gmane.org>
To: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Kevin Hilman <khilman-l0cyMroinI0@public.gmane.org>,
tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v3 02/11] i2c: OMAP: Add DT support for i2c controller
Date: Thu, 22 Dec 2011 09:55:39 +0100 [thread overview]
Message-ID: <4EF2F08B.4070907@ti.com> (raw)
In-Reply-To: <4EF0BB03.6040906-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Hi Rob,
On 12/20/2011 5:42 PM, Rob Herring wrote:
> On 12/20/2011 10:27 AM, Benoit Cousson wrote:
>> Add initial DT support to retrieve the frequency using a
>> DT attribute instead of the pdata pointer if of_node exist.
>>
>> Add documentation for omap i2c controller binding.
>>
>> Based on original patches from Manju and Grant.
>>
>> Signed-off-by: Benoit Cousson<b-cousson-l0cyMroinI0@public.gmane.org>
>> Cc: Ben Dooks<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>
>> Cc: Kevin Hilman<khilman-l0cyMroinI0@public.gmane.org>
>
> One issue below, otherwise:
>
> Reviewed-by: Rob Herring<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>
>
>
>> @@ -1001,15 +1019,24 @@ omap_i2c_probe(struct platform_device *pdev)
>> goto err_release_region;
>> }
>>
>> - if (pdata != NULL) {
>> - speed = pdata->clkrate;
>> + match = of_match_device(omap_i2c_of_match,&pdev->dev);
>> + if (match) {
>> + u32 freq = 100000; /* default to 100000 Hz */
>> +
>> + pdata = match->data;
>> + dev->dtrev = pdata->rev;
>> + dev->flags = pdata->flags;
>> +
>> + of_property_read_u32(node, "clock-frequency",&freq);
>> + /* convert DT freq value in Hz into kHz for speed */
>> + dev->speed = freq / 1000;
>> + } else if (pdata != NULL) {
>> + dev->speed = pdata->clkrate;
>> + dev->flags = pdata->flags;
>> dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
>> - } else {
>> - speed = 100; /* Default speed */
>> - dev->set_mpu_wkup_lat = NULL;
>> + dev->dtrev = pdata->rev;
>
> If you get here, pdata is NULL.
Mmm, it should not. It's true that the patch is not super readable, but
here is the result:
if (match) {
u32 freq = 100000; /* default to 100000 Hz */
pdata = match->data;
dev->dtrev = pdata->rev;
dev->flags = pdata->flags;
of_property_read_u32(node, "clock-frequency", &freq);
/* convert DT freq value in Hz into kHz for speed */
dev->speed = freq / 1000;
} else if (pdata != NULL) {
dev->speed = pdata->clkrate;
dev->flags = pdata->flags;
dev->set_mpu_wkup_lat = pdata->set_mpu_wkup_lat;
dev->dtrev = pdata->rev;
}
I removed every other pdata reference after this point.
Regards,
Benoit
next prev parent reply other threads:[~2011-12-22 8:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-20 16:27 [PATCH v3 00/11] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 01/11] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 02/11] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
2011-12-20 16:42 ` Rob Herring
[not found] ` <4EF0BB03.6040906-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-22 8:55 ` Cousson, Benoit [this message]
2011-12-20 21:24 ` Olof Johansson
[not found] ` <CAOesGMiwg9gVDDwCjuCcAPX6hc2E6OgH-c_nAqhCHmj7y5oCeQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-12-22 14:01 ` Cousson, Benoit
[not found] ` <1324398444-23296-1-git-send-email-b-cousson-l0cyMroinI0@public.gmane.org>
2011-12-20 16:27 ` [PATCH v3 03/11] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 04/11] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 05/11] arm/dts: OMAP3: " Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 06/11] arm/dts: twl6030: Add DTS file for twl6030 PMIC Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 07/11] arm/dts: twl4030: Add DTS file for twl4030 PM + Audio IC Benoit Cousson
2011-12-20 16:47 ` Rob Herring
2011-12-20 16:51 ` Rob Herring
2011-12-20 16:27 ` [PATCH v3 08/11] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 09/11] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 10/11] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM Benoit Cousson
2011-12-20 16:27 ` [PATCH v3 11/11] ARM: OMAP2+: board-generic: Remove i2c static init Benoit Cousson
2011-12-22 15:07 ` [PATCH v3 00/11] OMAP4: Add DT support for i2c and twl6030 Rob Herring
2011-12-23 9:18 ` Cousson, Benoit
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=4EF2F08B.4070907@ti.com \
--to=b-cousson-l0cymroini0@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=khilman-l0cyMroinI0@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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).