diff mbox

[PATCH/RFC,03/19] ARM: shmobile: gose: add i2c2 bus to device tree

Message ID 1449802376-11301-4-git-send-email-horms+renesas@verge.net.au (mailing list archive)
State RFC
Delegated to: Simon Horman
Headers show

Commit Message

Simon Horman Dec. 11, 2015, 2:52 a.m. UTC
Activate i2c2 bus in r8a7793/gose device tree.

Based on similar work for the r8a7791/koelsch by Wolfram Sang.

Cc: Wolfram Sang <wsa@sang-engineering.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/r8a7793-gose.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Sergei Shtylyov Dec. 11, 2015, 11:25 a.m. UTC | #1
Hello.

On 12/11/2015 5:52 AM, Simon Horman wrote:

> Activate i2c2 bus in r8a7793/gose device tree.
>
> Based on similar work for the r8a7791/koelsch by Wolfram Sang.
>
> Cc: Wolfram Sang <wsa@sang-engineering.com>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>   arch/arm/boot/dts/r8a7793-gose.dts | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
>
> diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
> index 3e3122490650..9a71ff6d4474 100644
> --- a/arch/arm/boot/dts/r8a7793-gose.dts
> +++ b/arch/arm/boot/dts/r8a7793-gose.dts
[...]
> @@ -135,3 +140,17 @@
>   		};
>   	};
>   };
> +
> +&i2c2 {
> +	pinctrl-0 = <&i2c2_pins>;
> +	pinctrl-names = "default";
> +
> +	status = "okay";
> +	clock-frequency = <100000>;
> +
> +	eeprom@50 {
> +		compatible = "renesas,24c02";

    This is not a valid value -- the Renesas chip model is different from 24c02.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 14, 2015, 2:11 a.m. UTC | #2
Hi Sergei,

On Fri, Dec 11, 2015 at 02:25:25PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 12/11/2015 5:52 AM, Simon Horman wrote:
> 
> >Activate i2c2 bus in r8a7793/gose device tree.
> >
> >Based on similar work for the r8a7791/koelsch by Wolfram Sang.
> >
> >Cc: Wolfram Sang <wsa@sang-engineering.com>
> >Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >---
> >  arch/arm/boot/dts/r8a7793-gose.dts | 19 +++++++++++++++++++
> >  1 file changed, 19 insertions(+)
> >
> >diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
> >index 3e3122490650..9a71ff6d4474 100644
> >--- a/arch/arm/boot/dts/r8a7793-gose.dts
> >+++ b/arch/arm/boot/dts/r8a7793-gose.dts
> [...]
> >@@ -135,3 +140,17 @@
> >  		};
> >  	};
> >  };
> >+
> >+&i2c2 {
> >+	pinctrl-0 = <&i2c2_pins>;
> >+	pinctrl-names = "default";
> >+
> >+	status = "okay";
> >+	clock-frequency = <100000>;
> >+
> >+	eeprom@50 {
> >+		compatible = "renesas,24c02";
> 
>    This is not a valid value -- the Renesas chip model is different from 24c02.

I copied this value from r8a7791.dtsi.

Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
this patch to "renesas,24002" or leave things as is?
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Dec. 14, 2015, 7:11 a.m. UTC | #3
> > >+	eeprom@50 {
> > >+		compatible = "renesas,24c02";
> > 
> >    This is not a valid value -- the Renesas chip model is different from 24c02.
> 
> I copied this value from r8a7791.dtsi.
> 
> Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
> I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
> this patch to "renesas,24002" or leave things as is?

I wouldn't like to update the at24 driver with all namings from all
vendors for chips which in large cases are simple 24c02 devices.

So, if Sergei insists on the change, I'd propose

	compatible = "renesas,24002", "24c02";

to keep things sane.
Geert Uytterhoeven Dec. 14, 2015, 9:39 a.m. UTC | #4
On Mon, Dec 14, 2015 at 8:11 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
>> > >+  eeprom@50 {
>> > >+          compatible = "renesas,24c02";
>> >
>> >    This is not a valid value -- the Renesas chip model is different from 24c02.
>>
>> I copied this value from r8a7791.dtsi.
>>
>> Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
>> I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
>> this patch to "renesas,24002" or leave things as is?
>
> I wouldn't like to update the at24 driver with all namings from all
> vendors for chips which in large cases are simple 24c02 devices.
>
> So, if Sergei insists on the change, I'd propose
>
>         compatible = "renesas,24002", "24c02";

"renesas,r1ex24002"?

I don't think the "A" is relevant (<= 64 is A, >= 128 is B).

http://www.renesas.com/products/memory/eeprom/product_selector.jsp

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 14, 2015, 5:03 p.m. UTC | #5
On 12/14/2015 05:11 AM, Simon Horman wrote:

>>> Activate i2c2 bus in r8a7793/gose device tree.
>>>
>>> Based on similar work for the r8a7791/koelsch by Wolfram Sang.
>>>
>>> Cc: Wolfram Sang <wsa@sang-engineering.com>
>>> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>>> ---
>>>   arch/arm/boot/dts/r8a7793-gose.dts | 19 +++++++++++++++++++
>>>   1 file changed, 19 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
>>> index 3e3122490650..9a71ff6d4474 100644
>>> --- a/arch/arm/boot/dts/r8a7793-gose.dts
>>> +++ b/arch/arm/boot/dts/r8a7793-gose.dts
>> [...]
>>> @@ -135,3 +140,17 @@
>>>   		};
>>>   	};
>>>   };
>>> +
>>> +&i2c2 {
>>> +	pinctrl-0 = <&i2c2_pins>;
>>> +	pinctrl-names = "default";
>>> +
>>> +	status = "okay";
>>> +	clock-frequency = <100000>;
>>> +
>>> +	eeprom@50 {
>>> +		compatible = "renesas,24c02";
>>
>>     This is not a valid value -- the Renesas chip model is different from 24c02.
>
> I copied this value from r8a7791.dtsi.

    r8a7791-koelsch.dts, you mean? I remember there has been a discussion on 
this topic, and I then refrained from adding MAC address EEPROMs as a result. :-)

> Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
> I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
> this patch to "renesas,24002" or leave things as is?

    What Geert has suggested seems the right thing to me.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 18, 2015, 3:02 a.m. UTC | #6
On Mon, Dec 14, 2015 at 10:39:47AM +0100, Geert Uytterhoeven wrote:
> On Mon, Dec 14, 2015 at 8:11 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> >> > >+  eeprom@50 {
> >> > >+          compatible = "renesas,24c02";
> >> >
> >> >    This is not a valid value -- the Renesas chip model is different from 24c02.
> >>
> >> I copied this value from r8a7791.dtsi.
> >>
> >> Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
> >> I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
> >> this patch to "renesas,24002" or leave things as is?
> >
> > I wouldn't like to update the at24 driver with all namings from all
> > vendors for chips which in large cases are simple 24c02 devices.
> >
> > So, if Sergei insists on the change, I'd propose
> >
> >         compatible = "renesas,24002", "24c02";
> 
> "renesas,r1ex24002"?
> 
> I don't think the "A" is relevant (<= 64 is A, >= 128 is B).
> 
> http://www.renesas.com/products/memory/eeprom/product_selector.jsp

Thanks.

It seems to me that we have some consensus around:

	compatible = "renesas,r1ex24002", "24c02";

Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
Or documented elsewhere?

I believe that as well as any documentation and update of this patch-set
that r8a7791-koelsch.dts will also need to be updated. I plan to do so.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Dec. 18, 2015, 7:35 a.m. UTC | #7
On Fri, Dec 18, 2015 at 12:02:39PM +0900, Simon Horman wrote:
> On Mon, Dec 14, 2015 at 10:39:47AM +0100, Geert Uytterhoeven wrote:
> > On Mon, Dec 14, 2015 at 8:11 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> > >> > >+  eeprom@50 {
> > >> > >+          compatible = "renesas,24c02";
> > >> >
> > >> >    This is not a valid value -- the Renesas chip model is different from 24c02.
> > >>
> > >> I copied this value from r8a7791.dtsi.
> > >>
> > >> Looking at the schematic for gose (v100), koelsch (rev024) and porter (v300)
> > >> I see the following "R1EX24002ATAS0G#U0". Shall we update r8a7791 and
> > >> this patch to "renesas,24002" or leave things as is?
> > >
> > > I wouldn't like to update the at24 driver with all namings from all
> > > vendors for chips which in large cases are simple 24c02 devices.
> > >
> > > So, if Sergei insists on the change, I'd propose
> > >
> > >         compatible = "renesas,24002", "24c02";
> > 
> > "renesas,r1ex24002"?
> > 
> > I don't think the "A" is relevant (<= 64 is A, >= 128 is B).
> > 
> > http://www.renesas.com/products/memory/eeprom/product_selector.jsp
> 
> Thanks.
> 
> It seems to me that we have some consensus around:
> 
> 	compatible = "renesas,r1ex24002", "24c02";

Thinking again, "generic,24c02" or "generic-24c02" could also be an
option.

> Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
> Or documented elsewhere?

Probably we need a DT maintainers advice here? I don't mind vendor
specific compatibles being documented, but I'm reluctant to add all
these compatibles for the myriads of I2C eeproms to the at24 driver. 99%
are covered by the generic case.

Adding DT to CC.

Thanks,

   Wolfram
Arnd Bergmann Dec. 18, 2015, 9:06 a.m. UTC | #8
On Friday 18 December 2015 08:35:32 Wolfram Sang wrote:
> > 
> > It seems to me that we have some consensus around:
> > 
> >       compatible = "renesas,r1ex24002", "24c02";
> 
> Thinking again, "generic,24c02" or "generic-24c02" could also be an
> option.
> 
> > Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
> > Or documented elsewhere?
> 
> Probably we need a DT maintainers advice here? I don't mind vendor
> specific compatibles being documented, but I'm reluctant to add all
> these compatibles for the myriads of I2C eeproms to the at24 driver. 99%
> are covered by the generic case.
> 
> Adding DT to CC.

I'd rather use some vendor string in addition to 24c02. Isn't this originally
an Atmel part? In that case, using "atmel,24c02" as the most generic string
would be appropriate, and IIRC the i2c framework will just match that with
the "24c02" entry in the i2c_device_id list.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wolfram Sang Dec. 18, 2015, 10:32 a.m. UTC | #9
On Fri, Dec 18, 2015 at 10:06:48AM +0100, Arnd Bergmann wrote:
> On Friday 18 December 2015 08:35:32 Wolfram Sang wrote:
> > > 
> > > It seems to me that we have some consensus around:
> > > 
> > >       compatible = "renesas,r1ex24002", "24c02";
> > 
> > Thinking again, "generic,24c02" or "generic-24c02" could also be an
> > option.
> > 
> > > Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
> > > Or documented elsewhere?
> > 
> > Probably we need a DT maintainers advice here? I don't mind vendor
> > specific compatibles being documented, but I'm reluctant to add all
> > these compatibles for the myriads of I2C eeproms to the at24 driver. 99%
> > are covered by the generic case.
> > 
> > Adding DT to CC.
> 
> I'd rather use some vendor string in addition to 24c02. Isn't this originally
> an Atmel part? In that case, using "atmel,24c02" as the most generic string
> would be appropriate,

Yeah, the at24 driver is named after Atmel chips AFAIR. Having "atmel,*"
as the generic fallback sounds like a good solution to me, too.

> and IIRC the i2c framework will just match that with
> the "24c02" entry in the i2c_device_id list.

True, although this behaviour is often complained about. There have been
attempts to make i2c/spi behave like the rest of the DT world and to
deprecate the current way. It didn't happen because of lots gory details,
however :/
Simon Horman Dec. 21, 2015, 4:33 a.m. UTC | #10
On Fri, Dec 18, 2015 at 11:32:15AM +0100, Wolfram Sang wrote:
> On Fri, Dec 18, 2015 at 10:06:48AM +0100, Arnd Bergmann wrote:
> > On Friday 18 December 2015 08:35:32 Wolfram Sang wrote:
> > > > 
> > > > It seems to me that we have some consensus around:
> > > > 
> > > >       compatible = "renesas,r1ex24002", "24c02";
> > > 
> > > Thinking again, "generic,24c02" or "generic-24c02" could also be an
> > > option.
> > > 
> > > > Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
> > > > Or documented elsewhere?
> > > 
> > > Probably we need a DT maintainers advice here? I don't mind vendor
> > > specific compatibles being documented, but I'm reluctant to add all
> > > these compatibles for the myriads of I2C eeproms to the at24 driver. 99%
> > > are covered by the generic case.
> > > 
> > > Adding DT to CC.
> > 
> > I'd rather use some vendor string in addition to 24c02. Isn't this originally
> > an Atmel part? In that case, using "atmel,24c02" as the most generic string
> > would be appropriate,
> 
> Yeah, the at24 driver is named after Atmel chips AFAIR. Having "atmel,*"
> as the generic fallback sounds like a good solution to me, too.
> 
> > and IIRC the i2c framework will just match that with
> > the "24c02" entry in the i2c_device_id list.
> 
> True, although this behaviour is often complained about. There have been
> attempts to make i2c/spi behave like the rest of the DT world and to
> deprecate the current way. It didn't happen because of lots gory details,
> however :/

My reading of the above is that we are currently leaning towards:

	compatible = "renesas,r1ex24002", "atmel,24c02";

And we are unsure what to do about the documentation.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Dec. 21, 2015, 8:02 a.m. UTC | #11
On Mon, Dec 21, 2015 at 5:33 AM, Simon Horman <horms@verge.net.au> wrote:
> On Fri, Dec 18, 2015 at 11:32:15AM +0100, Wolfram Sang wrote:
>> On Fri, Dec 18, 2015 at 10:06:48AM +0100, Arnd Bergmann wrote:
>> > On Friday 18 December 2015 08:35:32 Wolfram Sang wrote:
>> > > >
>> > > > It seems to me that we have some consensus around:
>> > > >
>> > > >       compatible = "renesas,r1ex24002", "24c02";
>> > >
>> > > Thinking again, "generic,24c02" or "generic-24c02" could also be an
>> > > option.
>> > >
>> > > > Should this be added to Documentation/devicetree/bindings/eeprom/eeprom.txt ?
>> > > > Or documented elsewhere?
>> > >
>> > > Probably we need a DT maintainers advice here? I don't mind vendor
>> > > specific compatibles being documented, but I'm reluctant to add all
>> > > these compatibles for the myriads of I2C eeproms to the at24 driver. 99%
>> > > are covered by the generic case.
>> > >
>> > > Adding DT to CC.
>> >
>> > I'd rather use some vendor string in addition to 24c02. Isn't this originally
>> > an Atmel part? In that case, using "atmel,24c02" as the most generic string
>> > would be appropriate,
>>
>> Yeah, the at24 driver is named after Atmel chips AFAIR. Having "atmel,*"
>> as the generic fallback sounds like a good solution to me, too.
>>
>> > and IIRC the i2c framework will just match that with
>> > the "24c02" entry in the i2c_device_id list.
>>
>> True, although this behaviour is often complained about. There have been
>> attempts to make i2c/spi behave like the rest of the DT world and to
>> deprecate the current way. It didn't happen because of lots gory details,
>> however :/
>
> My reading of the above is that we are currently leaning towards:
>
>         compatible = "renesas,r1ex24002", "atmel,24c02";
>
> And we are unsure what to do about the documentation.

To avoid checkpatch.pl complaining about our DTS patches, "renesas,r1ex24002"
should be added to Documentation/devicetree/bindings/eeprom/eeprom.txt.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/arm/boot/dts/r8a7793-gose.dts b/arch/arm/boot/dts/r8a7793-gose.dts
index 3e3122490650..9a71ff6d4474 100644
--- a/arch/arm/boot/dts/r8a7793-gose.dts
+++ b/arch/arm/boot/dts/r8a7793-gose.dts
@@ -38,6 +38,11 @@ 
 };
 
 &pfc {
+	i2c2_pins: i2c2 {
+		renesas,groups = "i2c2";
+		renesas,function = "i2c2";
+	};
+
 	scif0_pins: serial0 {
 		renesas,groups = "scif0_data_d";
 		renesas,function = "scif0";
@@ -135,3 +140,17 @@ 
 		};
 	};
 };
+
+&i2c2 {
+	pinctrl-0 = <&i2c2_pins>;
+	pinctrl-names = "default";
+
+	status = "okay";
+	clock-frequency = <100000>;
+
+	eeprom@50 {
+		compatible = "renesas,24c02";
+		reg = <0x50>;
+		pagesize = <16>;
+	};
+};