linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: b-cousson@ti.com (Cousson, Benoit)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller
Date: Thu, 15 Dec 2011 16:05:41 +0100	[thread overview]
Message-ID: <4EEA0CC5.4090602@ti.com> (raw)
In-Reply-To: <4EE8D5A1.2080100@gmail.com>

Hi Rob,

On 12/14/2011 5:58 PM, Rob Herring wrote:
> Benoit,
>
> On 12/09/2011 08:02 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@ti.com>
>> Cc: Ben Dooks<ben-linux@fluff.org>
>> ---
>>   Documentation/devicetree/bindings/i2c/omap-i2c.txt |   42 ++++++++
>>   drivers/i2c/busses/i2c-omap.c                      |  100 +++++++++++++-------
>>   2 files changed, 107 insertions(+), 35 deletions(-)
>>   create mode 100644 Documentation/devicetree/bindings/i2c/omap-i2c.txt
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/omap-i2c.txt b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> new file mode 100644
>> index 0000000..d259a17
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/i2c/omap-i2c.txt
>> @@ -0,0 +1,42 @@
>> +I2C for OMAP platforms
>> +
>> +Required properties :
>> +- compatible : Must be "ti,omap3-i2c" or "ti,omap4-i2c"
>> +- ti,hwmods : Must be "i2c<n>", n being the instance number (1-based)
>> +- #address-cells =<1>;
>> +- #size-cells =<0>;
>> +
>> +Recommended properties :
>> +- clock-frequency : Desired I2C bus clock frequency in Hz. Otherwise
>> +  the default 100 kHz frequency will be used.
>> +
>> +Optional properties:
>> +- Child nodes conforming to i2c bus binding
>> +- ti,flags : u32: settings or errata relative to the i2c
>> +    0x1:   OMAP_I2C_FLAG_NO_FIFO
>> +    0x2:   OMAP_I2C_FLAG_SIMPLE_CLOCK
>> +    0x4:   OMAP_I2C_FLAG_16BIT_DATA_REG
>> +    0x8:   OMAP_I2C_FLAG_RESET_REGS_POSTIDLE
>> +    0x10:  OMAP_I2C_FLAG_APPLY_ERRATA_I207
>> +    0x20:  OMAP_I2C_FLAG_ALWAYS_ARMXOR_CLK
>> +    0x40:  OMAP_I2C_FLAG_FORCE_19200_INT_CLK
>> +  Valid for ti,omap3-i2c only:
>> +    0x80:  OMAP_I2C_FLAG_BUS_SHIFT_1: 8 bits registers
>> +    0x100: OMAP_I2C_FLAG_BUS_SHIFT_2: 16 bits registers
>
> It's generally preferred to split these out to separate properties since
> there is not yet define capability in dts.

Yeah, I was hoping that Stephen's DTC patches were accepted to avoid that.

> Can some of these be removed
> by having more specific compatible strings? That is the whole point in
> having compatible strings not be generic. omap4-i2c and omap3-i2c is
> still kind of generic.

Do you mean creating some attributes like that:

+    ti,16bits_shift;
+    ti,reset_postidle;
+    ti,errata_i207;

Or using some omap3-i2c or omap4-i2c to determine the proper version and 
thus populate the right flags during probe.

[...]

>> @@ -965,6 +956,31 @@ static const struct i2c_algorithm omap_i2c_algo = {
>>   	.functionality	= omap_i2c_func,
>>   };
>>
>> +#ifdef CONFIG_OF
>> +static struct omap_i2c_bus_platform_data omap3_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_1,
>> +};
>> +
>> +static struct omap_i2c_bus_platform_data omap4_pdata = {
>> +	.rev = OMAP_I2C_IP_VERSION_2,
>> +};
>
> This is redundant. The ip version can be determined from the compatible
> string.

I'm confused...
I'm using the compatible string below to chose the proper value.
This flag is then used later at runtime.
I'm using a pseudo pdata because that driver is still used in old 
platform that does and will never not have DT support.

>> +static const struct of_device_id omap_i2c_of_match[] = {
>> +	{
>> +		.compatible = "ti,omap4-i2c",
>> +		.data =&omap4_pdata,
>> +	},
>> +	{
>> +		.compatible = "ti,omap3-i2c",
>> +		.data =&omap3_pdata,
>> +	},
>> +	{ },
>> +};
>> +MODULE_DEVICE_TABLE(of, omap_i2c_of_match);
>> +#else
>> +#define omap_i2c_of_match NULL
>
> Use of_match_ptr instead of the #else.

OK, good point.

Thanks,
Benoit

  reply	other threads:[~2011-12-15 15:05 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09 14:02 [PATCH v2 00/10] OMAP4: Add DT support for i2c and twl6030 Benoit Cousson
2011-12-09 14:02 ` [PATCH v2 01/10] ARM: OMAP2+: pm: Do not init statically the SR and voltage layer with DT Benoit Cousson
2012-01-04 18:04   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 02/10] i2c: OMAP: Add DT support for i2c controller Benoit Cousson
2011-12-14  1:06   ` Kevin Hilman
2012-01-04 13:36     ` Cousson, Benoit
2012-01-04 18:08       ` Grant Likely
2012-01-04 21:28       ` Kevin Hilman
2012-01-04 21:56         ` Grant Likely
2011-12-14 16:58   ` Rob Herring
2011-12-15 15:05     ` Cousson, Benoit [this message]
2011-12-15 15:48       ` Rob Herring
2011-12-15 16:09         ` Cousson, Benoit
2011-12-22  8:22   ` Shubhrajyoti
2011-12-09 14:02 ` [PATCH v2 03/10] mfd: twl-core: Add initial DT support for twl4030/twl6030 Benoit Cousson
2011-12-19 12:03   ` Samuel Ortiz
2011-12-19 13:53     ` Cousson, Benoit
2012-01-04 18:12   ` Grant Likely
2012-01-05 10:21     ` Cousson, Benoit
2011-12-09 14:02 ` [PATCH v2 04/10] rtc: rtc-twl: Add DT support for RTC inside twl4030/twl6030 Benoit Cousson
2011-12-19 16:52   ` Cousson, Benoit
2011-12-26  1:18     ` Alessandro Zummo
2011-12-20 15:13   ` Cousson, Benoit
2012-01-04 18:13   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 05/10] arm/dts: OMAP4: Add i2c controller nodes Benoit Cousson
2012-01-04 18:13   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 06/10] arm/dts: OMAP3: " Benoit Cousson
2012-01-04 18:14   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 07/10] arm/dts: omap4-panda: Add twl6030 and i2c EEPROM Benoit Cousson
2011-12-14  5:06   ` Kevin Hilman
2011-12-14 16:50     ` Cousson, Benoit
2011-12-15  0:31       ` Kevin Hilman
2012-01-04 18:14   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 08/10] arm/dts: omap4-sdp: Add twl6030, i2c3 and i2c4 devices Benoit Cousson
2012-01-04 18:14   ` Grant Likely
2011-12-09 14:02 ` [PATCH v2 09/10] arm/dts: omap3-beagle: Add twl4030 and i2c EEPROM Benoit Cousson
2012-01-04 18:15   ` Grant Likely
2012-01-09 23:24   ` Tabi Timur-B04825
2012-01-10 10:09     ` Cousson, Benoit
2011-12-09 14:02 ` [PATCH v2 10/10] ARM: OMAP2+: board-generic: Remove i2c static init Benoit Cousson
2012-01-04 18:15   ` Grant Likely

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=4EEA0CC5.4090602@ti.com \
    --to=b-cousson@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).