arm: shmobile: r7s72100: add native i2c support
Subsystems (8)
cover arm: shmobile: r7s72100: add native i2c support
Here is a series to support the I2C core of the r7s72100 natively. It has been tested with a genmai board where an eeprom is connected. The series can be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/riic
It is based on the latest r7s72100 topic branch from Simon and the latest patch series from Magnus. Note there is one issue with the current PFC driver which needs to be sorted out. Check patch 1/5 for details.
Comments welcome. Thanks,
Wolfram
Wolfram Sang (5):
pinctrl: r7s72100: add riic groups
arm: shmobile: r7s72100: add i2c clocks
arm: shmobile: r7s72100: add nodes for i2c controllers to dtsi
arm: shmobile: genmai: adapt dts to use native i2c driver
i2c: riic: add driver
Documentation/devicetree/bindings/i2c/i2c-riic.txt | 29 ++ arch/arm/boot/dts/r7s72100-genmai-reference.dts | 29 +- arch/arm/boot/dts/r7s72100.dtsi | 102 +++++ arch/arm/mach-shmobile/clock-r7s72100.c | 12 +- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-riic.c | 426 +++++++++++++++++++++ drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 45 +++ 8 files changed, 635 insertions(+), 19 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-riic.txt create mode 100644 drivers/i2c/busses/i2c-riic.c
Signature · 1 line
1.8.4.2
PATCH 1/5 pinctrl: r7s72100: add riic groups
From: Wolfram Sang <[email protected]>
Tested RIIC2 on a genmai board. Other riic groups are untested but seem trivial enough to be added.
---
Note: With the current PFC driver as posted by Magnus, it needs another patch to work. Yet, I think this is a seperate PFC issue which needs to be sorted out seperately and shouldn't affect these declarations. I'll add the needed patch as a response to this mail.
drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +45 -0
@@ -229,6 +229,27 @@ SCIF5(RZ_PIN_AND_MUX) SCIF6(RZ_PIN_AND_MUX) SCIF7(RZ_PIN_AND_MUX) +#define RIIC0 (fn) \ + fn(riic0, scl, 1, 0, 1) \ + fn(riic0, sda, 1, 1, 1) + +#define RIIC1 (fn) \ + fn(riic1, scl, 1, 2, 1) \ + fn(riic1, sda, 1, 3, 1) + +#define RIIC2 (fn) \ + fn(riic2, scl, 1, 4, 1) \ + fn(riic2, sda, 1, 5, 1) + +#define RIIC3 (fn) \ + fn(riic3, scl, 1, 6, 1) \ + fn(riic3, sda, 1, 7, 1) + +RIIC0 (RZ_PIN_AND_MUX) +RIIC1 (RZ_PIN_AND_MUX ) +RIIC2 (RZ_PIN_AND_MUX ) +RIIC3 (RZ_PIN_AND_MUX ) + static const struct sh_pfc_pin_group pinmux_groups[] = { SCIF0(RZ_PMX_GROUP)SCIF1 (RZ_PMX_GROUP )
@@ -238,6 +259,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { SCIF5(RZ_PMX_GROUP) SCIF6(RZ_PMX_GROUP) SCIF7(RZ_PMX_GROUP) + RIIC0(RZ_PMX_GROUP) + RIIC1(RZ_PMX_GROUP) + RIIC2(RZ_PMX_GROUP) + RIIC3(RZ_PMX_GROUP) };static const char *const scif0_groups[] = {
@@ -272,6 +297,22 @@ static const char * const scif7_groups[] = {SCIF7 (RZ_GROUPS) }; +static const char *const riic0_groups[] = { +RIIC0 (RZ_GROUPS ) +}; + +static const char *const riic1_groups[] = { +RIIC1 (RZ_GROUPS ) +}; + +static const char *const riic2_groups[] = { +RIIC2 (RZ_GROUPS ) +}; + +static const char *const riic3_groups[] = { +RIIC3 (RZ_GROUPS ) +}; +static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif0),SH_PFC_FUNCTION (scif1),
@@ -281,6 +322,10 @@ static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif5),SH_PFC_FUNCTION (scif6),SH_PFC_FUNCTION (scif7), +SH_PFC_FUNCTION (riic0), +SH_PFC_FUNCTION (riic1), +SH_PFC_FUNCTION (riic2), + SH_PFC_FUNCTION(riic3), };#define PFC_REG (idx, name, reg) \
Signature · 1 line
1.8.4.2
PATCH 1/5 pinctrl: r7s72100: add riic groups
Quoted 5 lines · Wolfram Sang
From: Wolfram Sang <[email protected]>
Tested RIIC2 on a genmai board. Other riic groups are untested but seem trivial enough to be added.
Quoted 8 lines
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>---
Note: With the current PFC driver as posted by Magnus, it needs another patch to work. Yet, I think this is a seperate PFC issue which needs to be sorted out seperately and shouldn't affect these declarations. I'll add the needed patch as a response to this mail.
Here it goes...
From: Wolfram Sang <[email protected]>
Subject: [PATCH] HACK: make magnus new driver work
--- drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +2 -2
@@ -68,11 +68,11 @@ enum {#define _P_GPIO (bank, _pin, _name, sfx) _GP_GPIO(16, bank, _pin, _name, sfx)#define _P_DATA (bank, pin, name, sfx) \ - PINMUX_DATA(name##_DATA, name##_PMC_0, name##_PIPC_0, \ + PINMUX_DATA(name##_DATA, name##_PMC_0, \ name##_PIBC_1, name##_PBDC_1)#define _P_FN (n, fn, pfcae, pfce, pfc) \ - PINMUX_DATA(n##_MARK_FN##fn, n##_PMC_1, n##_PIPC_1, \ + PINMUX_DATA(n##_MARK_FN##fn, n##_PMC_1, \ n##_PFCAE_##pfcae, n##_PFCE_##pfce, n##_PFC_##pfc)#define _P_MARK_FN1 (bank, pin, name, sfx) _P_FN(name, 1, 0, 0, 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131217/81673620/attachment.sig>
PATCH 1/5 pinctrl: r7s72100: add riic groups
In reply to Wolfram SangHi Wolfram,
Thank you for the patch.
Quoted 35 lines · On Tuesday 17 December 2013 22:44:34 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
Tested RIIC2 on a genmai board. Other riic groups are untested but seem trivial enough to be added.
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>---
Note: With the current PFC driver as posted by Magnus, it needs another patch to work. Yet, I think this is a seperate PFC issue which needs to be sorted out seperately and shouldn't affect these declarations. I'll add the needed patch as a response to this mail.
drivers/pinctrl/sh-pfc/pfc-r7s72100.c | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)(quoted diff) +0
-0
b/drivers/pinctrl/sh-pfc/pfc-r7s72100.cindex a662876..2b716d1 100644drivers/pinctrl/sh-pfc/pfc-r7s72100.c +10
-0@@ -229,6 +229,27 @@ SCIF5(RZ_PIN_AND_MUX) SCIF6(RZ_PIN_AND_MUX) SCIF7(RZ_PIN_AND_MUX) +#define RIIC0 (fn) \ + fn(riic0, scl, 1, 0, 1) \ + fn(riic0, sda, 1, 1, 1) + +#define RIIC1 (fn) \ + fn(riic1, scl, 1, 2, 1) \ + fn(riic1, sda, 1, 3, 1) + +#define RIIC2 (fn) \ + fn(riic2, scl, 1, 4, 1) \
drivers/pinctrl/sh-pfc/pfc-r7s72100.c SCIF5(RZ_PIN_AND_MUX) · line 251
Quoted 10 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +10
-0+ fn(riic2, sda, 1, 5, 1) + +#define RIIC3 (fn) \ + fn(riic3, scl, 1, 6, 1) \ + fn(riic3, sda, 1, 7, 1) + +RIIC0(RZ_PIN_AND_MUX) +RIIC1(RZ_PIN_AND_MUX) +RIIC2(RZ_PIN_AND_MUX) +RIIC3(RZ_PIN_AND_MUX)
Could you please move this above the SCIF declarations (same comment below) ? The pfc-*.c files tend to grow pretty big, and keeping entries sorted alphabetically helps.
Quoted 49 lines
drivers/pinctrl/sh-pfc/pfc-r7s72100.c +25
-0+static const struct sh_pfc_pin_group pinmux_groups[] = { SCIF0(RZ_PMX_GROUP)SCIF1 (RZ_PMX_GROUP )@@ -238,6 +259,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { SCIF5(RZ_PMX_GROUP) SCIF6(RZ_PMX_GROUP) SCIF7(RZ_PMX_GROUP) + RIIC0(RZ_PMX_GROUP) + RIIC1(RZ_PMX_GROUP) + RIIC2(RZ_PMX_GROUP) + RIIC3(RZ_PMX_GROUP) };static const char *const scif0_groups[] = {@@ -272,6 +297,22 @@ static const char * const scif7_groups[] = {SCIF7 (RZ_GROUPS) }; +static const char *const riic0_groups[] = { +RIIC0 (RZ_GROUPS ) +}; + +static const char *const riic1_groups[] = { +RIIC1 (RZ_GROUPS ) +}; + +static const char *const riic2_groups[] = { +RIIC2 (RZ_GROUPS ) +}; + +static const char *const riic3_groups[] = { +RIIC3 (RZ_GROUPS ) +}; +static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif0),SH_PFC_FUNCTION (scif1),@@ -281,6 +322,10 @@ static const struct sh_pfc_function pinmux_functions[] = {SH_PFC_FUNCTION (scif5),SH_PFC_FUNCTION (scif6),SH_PFC_FUNCTION (scif7), +SH_PFC_FUNCTION (riic0), +SH_PFC_FUNCTION (riic1), +SH_PFC_FUNCTION (riic2), +SH_PFC_FUNCTION (riic3), };#define PFC_REG (idx, name, reg) \
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Tested with RIIC2 on a genmai board. Others untested but hopefully trivial enough to be added.
--- arch/arm/mach-shmobile/clock-r7s72100.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/clock-r7s72100.c +11 -1
@@ -27,6 +27,7 @@#define FRQCR2 0xfcfe0014#define STBCR3 0xfcfe0420#define STBCR4 0xfcfe0424 +#define STBCR9 0xfcfe0438#define PLL_RATE 30
@@ -144,10 +145,15 @@ struct clk div4_clks[DIV4_NR] = { | CLK_ENABLE_ON_INIT), }; -enum {MSTP47 ,MSTP46 ,MSTP45 ,MSTP44 ,MSTP43 ,MSTP42 ,MSTP41 ,MSTP40 , +enum {MSTP97 ,MSTP96 ,MSTP95 ,MSTP94 , +MSTP47 ,MSTP46 ,MSTP45 ,MSTP44 ,MSTP43 ,MSTP42 ,MSTP41 ,MSTP40 ,MSTP33 ,MSTP_NR };static struct clk mstp_clks[MSTP_NR ] = { + [MSTP97 ] =SH_CLK_MSTP8 (&peripheral0_clk,STBCR9 ,7 ,0 ),/* RIIC0 */ + [MSTP96 ] =SH_CLK_MSTP8 (&peripheral0_clk,STBCR9 ,6 ,0 ),/* RIIC1 */ + [MSTP95 ] =SH_CLK_MSTP8 (&peripheral0_clk,STBCR9 ,5 ,0 ),/* RIIC2 */ + [MSTP94 ] =SH_CLK_MSTP8 (&peripheral0_clk,STBCR9 ,4 ,0 ),/* RIIC3 */ [MSTP47 ] =SH_CLK_MSTP8 (&peripheral1_clk,STBCR4 ,7 ,0 ),/* SCIF0 */ [MSTP46 ] =SH_CLK_MSTP8 (&peripheral1_clk,STBCR4 ,6 ,0 ),/* SCIF1 */ [MSTP45 ] =SH_CLK_MSTP8 (&peripheral1_clk,STBCR4 ,5 ,0 ),/* SCIF2 */
@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), +CLKDEV_DEV_ID ("fcfeec00.i2c" , &mstp_clks[MSTP94 ]),CLKDEV_ICK_ID ("sci_fck" ,"sh-sci.0" , &mstp_clks[MSTP47 ]),CLKDEV_ICK_ID ("sci_fck" ,"sh-sci.1" , &mstp_clks[MSTP46 ]), CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
Signature · 1 line
1.8.4.2
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Hello.
Quoted 15 lines · Wolfram Sang
From: Wolfram Sang <[email protected]>
Tested with RIIC2 on a genmai board. Others untested but hopefully trivial enough to be added.
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>--- arch/arm/mach-shmobile/clock-r7s72100.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)arch/arm/mach-shmobile/clock-r7s72100.c +0
-0
[...]
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),
These belong to some other place, the group marked by /* ICK */ is only
for CLKDEV_ICK_ID().
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 188
Quoted 3 lines
arch/arm/mach-shmobile/clock-r7s72100.c +0
-0CLKDEV_ICK_ID ("sci_fck" ,"sh-sci.0" , &mstp_clks[MSTP47 ]),CLKDEV_ICK_ID ("sci_fck" ,"sh-sci.1" , &mstp_clks[MSTP46 ]), CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
WBR, Sergei
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-shmobile/clock-r7s72100.c +0
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = { CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 5 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().
So, I'll create a /* DEV */ prefix?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131218/bd1a809b/attachment.sig>
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Quoted 12 lines · Wolfram Sang
Quoted 11 lines
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this case
despite all clocks, CLKDEV_DEV_ID() and CLKDEV_ICK_ID() are really MSTP clocks. I considered the idea of separating CLKDEV_ICK_ID() under /* ICK */ comment silly from the very start but Simon didn't listen to me.
WBR, Sergei
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Quoted 14 lines · Sergei Shtylyov
Quoted 11 lines · Wolfram Sang
Quoted 11 lines
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().
Quoted 7 lines
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this
case despite all clocks,CLKDEV_DEV_ID()andCLKDEV_ICK_ID()are really MSTP clocks. I considered the idea of separatingCLKDEV_ICK_ID()under /* ICK */ comment silly from the very start but Simon didn't listen to me.
I am puzzled, too. ICK is a type of registration and not a clock domain. Also, there is 'mtu2_fck' which is under ICK as well as MSTP? Looks wrong. From what I understand now, removing the /* ICK */ comment would be easiest and proper?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131218/f0c7f207/attachment.sig>
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Quoted 24 lines · Wolfram Sang
Quoted 14 lines · Sergei Shtylyov
Quoted 11 lines · Wolfram Sang
Quoted 11 lines
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().Quoted 7 lines
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this
case despite all clocks,CLKDEV_DEV_ID()andCLKDEV_ICK_ID()are really MSTP clocks. I considered the idea of separatingCLKDEV_ICK_ID()under /* ICK */ comment silly from the very start but Simon didn't listen to me.
Quoted 4 lines
I am puzzled, too. ICK is a type of registration and not a clock domain. Also, there is '
mtu2_fck' which is under ICK as well as MSTP? Looks wrong. From what I understand now, removing the /* ICK */ comment would be easiest and proper?
I'm not sure that I really understand what all the fuss is about.
As I understand things the convention that prevails for MSTP clocks under mach-shmobile is as follows:
1. Clocks not registered by CLKDEV_ICK_ID() are grouped together under /* MSTP */ followed by:
2. Clocks registered using CLKDEV_ICK_ID() are grouped together under /* ICK */
I am unsure of the historical reason for this but it does seem to be consistent.
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Hello.
Quoted 30 lines · Simon Horman
Quoted 20 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-shmobile/clock-r7s72100.c static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
arch/arm/mach-shmobile/clock-r7s72100.c +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = {CLKDEV_CON_ID ("mtu2_fck" , &mstp_clks[MSTP33 ]),/* ICK */ +CLKDEV_DEV_ID ("fcfee000.i2c" , &mstp_clks[MSTP97 ]), +CLKDEV_DEV_ID ("fcfee400.i2c" , &mstp_clks[MSTP96 ]), +CLKDEV_DEV_ID ("fcfee800.i2c" , &mstp_clks[MSTP95 ]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().Quoted 7 lines
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this
case despite all clocks,CLKDEV_DEV_ID()andCLKDEV_ICK_ID()are really MSTP clocks. I considered the idea of separatingCLKDEV_ICK_ID()under /* ICK */ comment silly from the very start but Simon didn't listen to me.Quoted 4 lines
I am puzzled, too. ICK is a type of registration and not a clock domain. Also, there is '
mtu2_fck' which is under ICK as well as MSTP? Looks wrong. From what I understand now, removing the /* ICK */ comment would be easiest and proper?I'm not sure that I really understand what all the fuss is about.
As I understand things the convention that prevails for MSTP clocks under mach-shmobile is as follows:
Quoted 6 lines
1. Clocks not registered by
CLKDEV_ICK_ID()are grouped together under /* MSTP */ followed by:
2. Clocks registered usingCLKDEV_ICK_ID()are grouped togetherunder /* ICK */I am unsure of the historical reason for this
Recent patches by Morimoto-san.
Quoted 1 line
but it does seem to be consistent.
No, it doesn't. These comments are *clearly* not consistent and should be
removed at least.
WBR, Sergei
Magnus Damm
maintainerPATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Quoted 51 lines · Sergei Shtylyov
Hello.
Quoted 38 lines · Simon Horman
Quoted 25 lines
Quoted 15 lines
Quoted 13 lines
Quoted 13 lines
Review static struct clk_lookup lookups[] = { · line 186
Quoted 9 lines
(quoted diff) +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = { CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), /* ICK */ + CLKDEV_DEV_ID("fcfee000.i2c", &mstp_clks[MSTP97]), + CLKDEV_DEV_ID("fcfee400.i2c", &mstp_clks[MSTP96]), + CLKDEV_DEV_ID("fcfee800.i2c", &mstp_clks[MSTP95]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().Quoted 8 lines
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this
case despite all clocks,CLKDEV_DEV_ID()andCLKDEV_ICK_ID()are really MSTP clocks. I considered the idea of separatingCLKDEV_ICK_ID()under /* ICK */ comment silly from the very start but Simon didn't listen to me.Quoted 4 lines
I am puzzled, too. ICK is a type of registration and not a clock domain. Also, there is '
mtu2_fck' which is under ICK as well as MSTP? Looks wrong. From what I understand now, removing the /* ICK */ comment would be easiest and proper?I'm not sure that I really understand what all the fuss is about.
As I understand things the convention that prevails for MSTP clocks under mach-shmobile is as follows:
Quoted 7 lines
1. Clocks not registered by
CLKDEV_ICK_ID()are grouped together under /* MSTP */ followed by:
2. Clocks registered usingCLKDEV_ICK_ID()are grouped togetherunder /* ICK */I am unsure of the historical reason for this
Quoted 8 lines
Recent patches by Morimoto-san.
Quoted 1 line
but it does seem to be consistent.
No, it doesn't. These comments are *clearly* not consistent and should be
removed at least.
Feel free to contribute patches!
/ magnus
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
Hello.
Quoted 37 lines · Magnus Damm
Quoted 36 lines
Quoted 36 lines
Quoted 20 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Review static struct clk_lookup lookups[] = { · line 185
Quoted 8 lines
(quoted diff) +4
-0@@ -173,6 +179,10 @@ static struct clk_lookup lookups[] = { CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), /* ICK */ + CLKDEV_DEV_ID("fcfee000.i2c", &mstp_clks[MSTP97]), + CLKDEV_DEV_ID("fcfee400.i2c", &mstp_clks[MSTP96]), + CLKDEV_DEV_ID("fcfee800.i2c", &mstp_clks[MSTP95]), + CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),These belong to some other place, the group marked by /* ICK */
is only forCLKDEV_ICK_ID().Quoted 7 lines
Quoted 1 line
So, I'll create a /* DEV */ prefix?
I really don't know. Other places have /* MSTP */ comment in this
case despite all clocks,CLKDEV_DEV_ID()andCLKDEV_ICK_ID()are really MSTP clocks. I considered the idea of separatingCLKDEV_ICK_ID()under /* ICK */ comment silly from the very start but Simon didn't listen to me.Quoted 4 lines
I am puzzled, too. ICK is a type of registration and not a clock domain. Also, there is '
mtu2_fck' which is under ICK as well as MSTP? Looks wrong. From what I understand now, removing the /* ICK */ comment would be easiest and proper?I'm not sure that I really understand what all the fuss is about.
As I understand things the convention that prevails for MSTP clocks under mach-shmobile is as follows:
1. Clocks not registered by
CLKDEV_ICK_ID()are grouped together under /* MSTP */ followed by:
2. Clocks registered usingCLKDEV_ICK_ID()are grouped togetherunder /* ICK */I am unsure of the historical reason for this
Quoted 8 lines
Quoted 6 lines
Recent patches by Morimoto-san.
Quoted 1 line
but it does seem to be consistent.
No, it doesn't. These comments are *clearly* not consistent and should be
removed at least.Feel free to contribute patches!
Of course, in my copious free time. I was against these ICKy comments (and
the patches introducing them) in the first place but my opinion didn't count. I'm not sure it will count if I go and submit the patches (but the time will be lost).
WBR, Sergei
PATCH 2/5 arm: shmobile: r7s72100: add i2c clocks
In reply to Simon HormanQuoted 2 lines
I am unsure of the historical reason for this but it does seem to be consistent.
Okay, I'll follow that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131218/fa73b848/attachment.sig>
PATCH 3/5 arm: shmobile: r7s72100: add nodes for i2c controllers to dtsi
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
I decided to put the pinmuxing into the dtsi file since there is only one pinmux posiibility which one probably wants to have when using the bus.
--- arch/arm/boot/dts/r7s72100.dtsi | 102 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+)
arch/arm/boot/dts/r7s72100.dtsi +102 -0
@@ -8,6 +8,8 @@ * kind, whether express or implied. */ +#include <dt-bindings/interrupt-controller/irq.h> + / { compatible = "renesas,r7s72100"; interrupt-parent = <&gic>;
@@ -15,6 +17,10 @@ #size-cells = <1>; aliases { + i2c0 = &i2c0; + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; gpio0 = &port0; gpio1 = &port1; gpio2 = &port2;
@@ -58,6 +64,26 @@ <0xfcfe7b40 0x04>, /* JPMC */ <0xfcfe7b90 0x04>, /* JPMCSR */ <0xfcfe7f00 0x04>; /* JPIBC */ + + riic0_pins: i2c0 { + renesas,groups = "riic0_scl_p1_0", "riic0_sda_p1_1"; + renesas,function = "riic0"; + }; + + riic1_pins: i2c1 { + renesas,groups = "riic1_scl_p1_2", "riic1_sda_p1_3"; + renesas,function = "riic1"; + }; + + riic2_pins: i2c2 { + renesas,groups = "riic2_scl_p1_4", "riic2_sda_p1_5"; + renesas,function = "riic2"; + }; + + riic3_pins: i2c3 { + renesas,groups = "riic3_scl_p1_6", "riic3_sda_p1_7"; + renesas,function = "riic3"; + }; }; port0: gpio at fcfe3100 {
@@ -187,4 +213,80 @@ gpio-controller; gpio-ranges = <&pfc 0 192 2>; }; + + i2c0: i2c at fcfee000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee000 0x44>; + interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>, + <0 158 IRQ_TYPE_EDGE_RISING>, + <0 159 IRQ_TYPE_EDGE_RISING>, + <0 160 IRQ_TYPE_LEVEL_HIGH>, + <0 161 IRQ_TYPE_LEVEL_HIGH>, + <0 162 IRQ_TYPE_LEVEL_HIGH>, + <0 163 IRQ_TYPE_LEVEL_HIGH>, + <0 164 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic0_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c1: i2c at fcfee400 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee400 0x44>; + interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>, + <0 166 IRQ_TYPE_EDGE_RISING>, + <0 167 IRQ_TYPE_EDGE_RISING>, + <0 168 IRQ_TYPE_LEVEL_HIGH>, + <0 169 IRQ_TYPE_LEVEL_HIGH>, + <0 170 IRQ_TYPE_LEVEL_HIGH>, + <0 171 IRQ_TYPE_LEVEL_HIGH>, + <0 172 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic1_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c2: i2c at fcfee800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee800 0x44>; + interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>, + <0 174 IRQ_TYPE_EDGE_RISING>, + <0 175 IRQ_TYPE_EDGE_RISING>, + <0 176 IRQ_TYPE_LEVEL_HIGH>, + <0 177 IRQ_TYPE_LEVEL_HIGH>, + <0 178 IRQ_TYPE_LEVEL_HIGH>, + <0 179 IRQ_TYPE_LEVEL_HIGH>, + <0 180 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic2_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c3: i2c at fcfeec00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfeec00 0x44>; + interrupts = <0 181 IRQ_TYPE_LEVEL_HIGH>, + <0 182 IRQ_TYPE_EDGE_RISING>, + <0 183 IRQ_TYPE_EDGE_RISING>, + <0 184 IRQ_TYPE_LEVEL_HIGH>, + <0 185 IRQ_TYPE_LEVEL_HIGH>, + <0 186 IRQ_TYPE_LEVEL_HIGH>, + <0 187 IRQ_TYPE_LEVEL_HIGH>, + <0 188 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic3_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; };
Signature · 1 line
1.8.4.2
PATCH 3/5 arm: shmobile: r7s72100: add nodes for i2c controllers to dtsi
Hi Wolfram,
Thank you for the patch.
Quoted 50 lines · On Tuesday 17 December 2013 22:44:36 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
I decided to put the pinmuxing into the dtsi file since there is only one pinmux posiibility which one probably wants to have when using the bus.
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>--- arch/arm/boot/dts/r7s72100.dtsi | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+)(quoted diff) +0
-0
b/arch/arm/boot/dts/r7s72100.dtsiindex d396b38..ff0bd6b 100644arch/arm/boot/dts/r7s72100.dtsi +16
-0@@ -8,6 +8,8 @@ * kind, whether express or implied. */ +#include <dt-bindings/interrupt-controller/irq.h> + / { compatible = "renesas,r7s72100"; interrupt-parent = <&gic>;@@ -15,6 +17,10 @@ #size-cells = <1>; aliases { + i2c0 = &i2c0; + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; gpio0 = &port0; gpio1 = &port1; gpio2 = &port2;@@ -58,6 +64,26 @@ <0xfcfe7b40 0x04>, /* JPMC */ <0xfcfe7b90 0x04>, /* JPMCSR */ <0xfcfe7f00 0x04>; /* JPIBC */ + + riic0_pins: i2c0 { + renesas,groups = "riic0_scl_p1_0", "riic0_sda_p1_1"; + renesas,function = "riic0"; + }; + + riic1_pins: i2c1 { + renesas,groups = "riic1_scl_p1_2", "riic1_sda_p1_3"; + renesas,function = "riic1"; + };
arch/arm/boot/dts/r7s72100.dtsi line 86
Quoted 10 lines
arch/arm/boot/dts/r7s72100.dtsi +10
-0+ + riic2_pins: i2c2 { + renesas,groups = "riic2_scl_p1_4", "riic2_sda_p1_5"; + renesas,function = "riic2"; + }; + + riic3_pins: i2c3 { + renesas,groups = "riic3_scl_p1_6", "riic3_sda_p1_7"; + renesas,function = "riic3"; + };
The SoC allows other options for the I2C pin groups. Instead of declaring all possible groups here, I think we should thus only add the groups that are really used to the board .dts files.
Quoted 13 lines
arch/arm/boot/dts/r7s72100.dtsi +6
-0}; port0: gpio at fcfe3100 {@@ -187,4 +213,80 @@ gpio-controller; gpio-ranges = <&pfc 0 192 2>; }; + + i2c0: i2c at fcfee000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee000 0x44>;
arch/arm/boot/dts/r7s72100.dtsi line 231
Quoted 10 lines
arch/arm/boot/dts/r7s72100.dtsi +10
-0+ interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>, + <0 158 IRQ_TYPE_EDGE_RISING>, + <0 159 IRQ_TYPE_EDGE_RISING>, + <0 160 IRQ_TYPE_LEVEL_HIGH>, + <0 161 IRQ_TYPE_LEVEL_HIGH>, + <0 162 IRQ_TYPE_LEVEL_HIGH>, + <0 163 IRQ_TYPE_LEVEL_HIGH>, + <0 164 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic0_pins>; + pinctrl-names = "default";
These two properties should then be moved to the board .dts files as well.
arch/arm/boot/dts/r7s72100.dtsi line 232
Quoted 1 line
arch/arm/boot/dts/r7s72100.dtsi +1
-0+ clock-frequency = <100000>;
Isn't that a board-specific property ?
Quoted 60 lines
arch/arm/boot/dts/r7s72100.dtsi +59
-0+ status = "disabled"; + }; + + i2c1: i2c at fcfee400 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee400 0x44>; + interrupts = <0 165 IRQ_TYPE_LEVEL_HIGH>, + <0 166 IRQ_TYPE_EDGE_RISING>, + <0 167 IRQ_TYPE_EDGE_RISING>, + <0 168 IRQ_TYPE_LEVEL_HIGH>, + <0 169 IRQ_TYPE_LEVEL_HIGH>, + <0 170 IRQ_TYPE_LEVEL_HIGH>, + <0 171 IRQ_TYPE_LEVEL_HIGH>, + <0 172 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic1_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c2: i2c at fcfee800 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee800 0x44>; + interrupts = <0 173 IRQ_TYPE_LEVEL_HIGH>, + <0 174 IRQ_TYPE_EDGE_RISING>, + <0 175 IRQ_TYPE_EDGE_RISING>, + <0 176 IRQ_TYPE_LEVEL_HIGH>, + <0 177 IRQ_TYPE_LEVEL_HIGH>, + <0 178 IRQ_TYPE_LEVEL_HIGH>, + <0 179 IRQ_TYPE_LEVEL_HIGH>, + <0 180 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic2_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; + + i2c3: i2c at fcfeec00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfeec00 0x44>; + interrupts = <0 181 IRQ_TYPE_LEVEL_HIGH>, + <0 182 IRQ_TYPE_EDGE_RISING>, + <0 183 IRQ_TYPE_EDGE_RISING>, + <0 184 IRQ_TYPE_LEVEL_HIGH>, + <0 185 IRQ_TYPE_LEVEL_HIGH>, + <0 186 IRQ_TYPE_LEVEL_HIGH>, + <0 187 IRQ_TYPE_LEVEL_HIGH>, + <0 188 IRQ_TYPE_LEVEL_HIGH>; + pinctrl-0 = <&riic3_pins>; + pinctrl-names = "default"; + clock-frequency = <100000>; + status = "disabled"; + }; };
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 3/5 arm: shmobile: r7s72100: add nodes for i2c controllers to dtsi
Hi,
Quoted 10 lines · Laurent Pinchart
Hi Wolfram,
Thank you for the patch.
Quoted 5 lines · On Tuesday 17 December 2013 22:44:36 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
I decided to put the pinmuxing into the dtsi file since there is only one pinmux posiibility which one probably wants to have when using the bus.
I tried to explain here why the pin-groups are in the dtsi.
Quoted 15 lines
Quoted 15 lines
arch/arm/boot/dts/r7s72100.dtsi +15
-0+ riic0_pins: i2c0 { + renesas,groups = "riic0_scl_p1_0", "riic0_sda_p1_1"; + renesas,function = "riic0"; + }; + + riic1_pins: i2c1 { + renesas,groups = "riic1_scl_p1_2", "riic1_sda_p1_3"; + renesas,function = "riic1"; + }; + + riic2_pins: i2c2 { + renesas,groups = "riic2_scl_p1_4", "riic2_sda_p1_5"; + renesas,function = "riic2"; + }; +
Quoted 8 lines
arch/arm/boot/dts/r7s72100.dtsi line 86
Quoted 4 lines
arch/arm/boot/dts/r7s72100.dtsi +4
-0+ riic3_pins: i2c3 { + renesas,groups = "riic3_scl_p1_6", "riic3_sda_p1_7"; + renesas,function = "riic3"; + };The SoC allows other options for the I2C pin groups. Instead of declaring all possible groups here, I think we should thus only add the groups that are really used to the board .dts files.
Really? Couldn't find any. This is why I included it here: since it is the only option, people probably want to use it when they activate the bus.
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ clock-frequency = <100000>;Isn't that a board-specific property ?
It is meant as a sane default. Can be overridden.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131217/c81148fc/attachment.sig>
PATCH 3/5 arm: shmobile: r7s72100: add nodes for i2c controllers to dtsi
Hi Wolfram,
Quoted 34 lines · On Tuesday 17 December 2013 23:13:09 Wolfram Sang wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Tuesday 17 December 2013 22:44:36 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
I decided to put the pinmuxing into the dtsi file since there is only one pinmux posiibility which one probably wants to have when using the bus.
I tried to explain here why the pin-groups are in the dtsi.
Quoted 15 lines
Quoted 15 lines
arch/arm/boot/dts/r7s72100.dtsi +15
-0+ riic0_pins: i2c0 { + renesas,groups = "riic0_scl_p1_0", "riic0_sda_p1_1"; + renesas,function = "riic0"; + }; + + riic1_pins: i2c1 { + renesas,groups = "riic1_scl_p1_2", "riic1_sda_p1_3"; + renesas,function = "riic1"; + }; + + riic2_pins: i2c2 { + renesas,groups = "riic2_scl_p1_4", "riic2_sda_p1_5"; + renesas,function = "riic2"; + }; +Quoted 8 lines
arch/arm/boot/dts/r7s72100.dtsi line 86
Quoted 4 lines
arch/arm/boot/dts/r7s72100.dtsi +4
-0+ riic3_pins: i2c3 { + renesas,groups = "riic3_scl_p1_6", "riic3_sda_p1_7"; + renesas,function = "riic3"; + };The SoC allows other options for the I2C pin groups. Instead of declaring all possible groups here, I think we should thus only add the groups that are really used to the board .dts files.
Quoted 3 lines
Really? Couldn't find any. This is why I included it here: since it is the only option, people probably want to use it when they activate the bus.
My bad, sorry, I've misread patch 1/5 and spoke too fast :-/ I thus makes sense to add the groups here.
Quoted 5 lines
Quoted 3 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ clock-frequency = <100000>;Isn't that a board-specific property ?
It is meant as a sane default. Can be overridden.
OK.
Signature · 10 lines
Regards, Laurent Pinchart -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 490 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131217/baa1d48d/attachment.sig>
PATCH 4/5 arm: shmobile: genmai: adapt dts to use native i2c driver
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Switch from the gpio-driver to the shiny new native driver. Tested by accessing the eeprom on the genmai board.
--- arch/arm/boot/dts/r7s72100-genmai-reference.dts | 29 ++++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-)
arch/arm/boot/dts/r7s72100-genmai-reference.dts +11 -18
@@ -39,24 +39,6 @@ gpios = <&port4 11 GPIO_ACTIVE_LOW>; }; }; - - i2c at 0 { - compatible = "i2c-gpio"; - gpios = <&port1 5 GPIO_ACTIVE_HIGH /* sda */ - &port1 4 GPIO_ACTIVE_HIGH /* scl */ - >; - i2c-gpio,sda-open-drain; - i2c-gpio,scl-open-drain; - i2c-gpio,delay-us = <5>; /* ~100 kHz */ - #address-cells = <1>; - #size-cells = <0>; - - flash at 50 { - compatible = "renesas,24c128"; - reg = <0x50>; - pagesize = <64>; - }; - }; }; &pfc {
@@ -68,3 +50,14 @@ renesas,function = "scif2"; }; }; + +&i2c2 { + status = "okay"; + clock-frequency = <400000>; + + eeprom: 24c128 at 50 { + compatible = "renesas,24c128"; + reg = <0x50>; + pagesize = <64>; + }; +};
Signature · 1 line
1.8.4.2
PATCH 4/5 arm: shmobile: genmai: adapt dts to use native i2c driver
Hi Wolfram,
Thank you for the patch.
Quoted 42 lines · On Tuesday 17 December 2013 22:44:37 Wolfram Sang wrote:
From: Wolfram Sang <[email protected]>
Switch from the gpio-driver to the shiny new native driver. Tested by accessing the eeprom on the genmai board.
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>--- arch/arm/boot/dts/r7s72100-genmai-reference.dts | 29 +++++++++------------- 1 file changed, 11 insertions(+), 18 deletions(-)(quoted diff) +0
-0
b/arch/arm/boot/dts/r7s72100-genmai-reference.dtsindex ce5da0b..739448a 100644arch/arm/boot/dts/r7s72100-genmai-reference.dts +0
-18@@ -39,24 +39,6 @@ gpios = <&port4 11 GPIO_ACTIVE_LOW>; }; }; - - i2c at 0 { - compatible = "i2c-gpio"; - gpios = <&port1 5 GPIO_ACTIVE_HIGH /* sda */ - &port1 4 GPIO_ACTIVE_HIGH /* scl */ - >; - i2c-gpio,sda-open-drain; - i2c-gpio,scl-open-drain; - i2c-gpio,delay-us = <5>; /* ~100 kHz */ - #address-cells = <1>; - #size-cells = <0>; - - flash at 50 { - compatible = "renesas,24c128"; - reg = <0x50>; - pagesize = <64>; - }; - }; }; &pfc {
arch/arm/boot/dts/r7s72100-genmai-reference.dts line 58
Quoted 9 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +6
-0@@ -68,3 +50,14 @@ renesas,function = "scif2"; }; }; + +&i2c2 { + status = "okay"; + clock-frequency = <400000>; + + eeprom: 24c128 at 50 {
That should be "24c128: eeprom at 50". You can actually omit the "24c128:" alias until it gets needed.
Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5
-0+ compatible = "renesas,24c128"; + reg = <0x50>; + pagesize = <64>; + }; +};
Signature · 3 lines
Regards, Laurent Pinchart
PATCH 4/5 arm: shmobile: genmai: adapt dts to use native i2c driver
In reply to Wolfram SangHello.
Quoted 41 lines · Wolfram Sang
From: Wolfram Sang <[email protected]>
Switch from the gpio-driver to the shiny new native driver. Tested by accessing the eeprom on the genmai board.
Signed-off-by Wolfram Sang <[email protected]>Acked-by Magnus Damm <[email protected]>--- arch/arm/boot/dts/r7s72100-genmai-reference.dts | 29 ++++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-)arch/arm/boot/dts/r7s72100-genmai-reference.dts +0
-18@@ -39,24 +39,6 @@ gpios = <&port4 11 GPIO_ACTIVE_LOW>; }; }; - - i2c at 0 { - compatible = "i2c-gpio"; - gpios = <&port1 5 GPIO_ACTIVE_HIGH /* sda */ - &port1 4 GPIO_ACTIVE_HIGH /* scl */ - >; - i2c-gpio,sda-open-drain; - i2c-gpio,scl-open-drain; - i2c-gpio,delay-us = <5>; /* ~100 kHz */ - #address-cells = <1>; - #size-cells = <0>; - - flash at 50 { - compatible = "renesas,24c128"; - reg = <0x50>; - pagesize = <64>; - }; - }; }; &pfc {
arch/arm/boot/dts/r7s72100-genmai-reference.dts line 58
Quoted 9 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +6
-0@@ -68,3 +50,14 @@ renesas,function = "scif2"; }; }; + +&i2c2 { + status = "okay"; + clock-frequency = <400000>; + + eeprom: 24c128 at 50 {
The node was called "flash at 50" for a reason: according to ePAPR spec, for
node names the generic device names should be used, not chip-specific.
arch/arm/boot/dts/r7s72100-genmai-reference.dts line 63
Quoted 5 lines
arch/arm/boot/dts/r7s72100-genmai-reference.dts +5
-0+ compatible = "renesas,24c128"; + reg = <0x50>; + pagesize = <64>; + }; +};
WBR, Sergei
PATCH 5/5 i2c: riic: add driver
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Tested with a r7s72100 genmai board acessing an eeprom.
--- Documentation/devicetree/bindings/i2c/i2c-riic.txt | 29 ++ drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-riic.c | 426 +++++++++++++++++++++ 4 files changed, 466 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-riic.txt create mode 100644 drivers/i2c/busses/i2c-riic.c
Documentation/devicetree/bindings/i2c/i2c-riic.txt new file +29 -0
@@ -0,0 +1,29 @@ +Device tree configuration for i2c-ocores + +Required properties: +- compatible : "renesas,riic-<soctype>". "renesas,riic-rz" as fallback +- reg : address start and address range size of device +- interrupts : 8 interrupts (TEI, RI, TI, SPI, STI, NAKI, ALI, TMOI) +- clock-frequency : frequency of bus clock in Hz +- #address-cells : should be <1> +- #size-cells : should be <0> + +Pinctrl properties might be needed, too. See there. + +Example: + + i2c0: i2c at fcfee000 { + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee000 0x44>; + interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>, + <0 158 IRQ_TYPE_EDGE_RISING>, + <0 159 IRQ_TYPE_EDGE_RISING>, + <0 160 IRQ_TYPE_LEVEL_HIGH>, + <0 161 IRQ_TYPE_LEVEL_HIGH>, + <0 162 IRQ_TYPE_LEVEL_HIGH>, + <0 163 IRQ_TYPE_LEVEL_HIGH>, + <0 164 IRQ_TYPE_LEVEL_HIGH>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + };
drivers/i2c/busses/Kconfig +10 -0
@@ -648,6 +648,16 @@ config I2C_PXA_SLAVE is necessary for systems where the PXA may be a target on the I2C bus. +config I2C_RIIC + tristate "Renesas RIIC adapter" + depends on ARCH_SHMOBILE || COMPILE_TEST + help + If you say yes to this option, support will be included for the + Renesas RIIC I2C interface. + + This driver can also be built as a module. If so, the module + will be called i2c-riic. + config HAVE_S3C2410_I2C bool help
drivers/i2c/busses/Makefile +1 -0
@@ -63,6 +63,7 @@ obj-$(CONFIG_I2C_PNX) += i2c-pnx.o obj-$(CONFIG_I2C_PUV3) += i2c-puv3.o obj-$(CONFIG_I2C_PXA) += i2c-pxa.o obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o +obj-$(CONFIG_I2C_RIIC) += i2c-riic.o obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o obj-$(CONFIG_I2C_S6000) += i2c-s6000.o obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
drivers/i2c/busses/i2c-riic.c new file +426 -0
426 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH 5/5 i2c: riic: add driver
CC devicetree at vger.kernel.org for the bindings part.
Quoted 20 lines · Wolfram Sang
From: Wolfram Sang <[email protected]>
Tested with a r7s72100 genmai board acessing an eeprom.
Signed-off-by Wolfram Sang <[email protected]>--- Documentation/devicetree/bindings/i2c/i2c-riic.txt | 29 ++ drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-riic.c | 426 +++++++++++++++++++++ 4 files changed, 466 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-riic.txt create mode 100644 drivers/i2c/busses/i2c-riic.cDocumentation/devicetree/bindings/i2c/i2c-riic.txt new file +0
-0
Documentation/devicetree/bindings/i2c/i2c-riic.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/i2c/i2c-riic.txt new file +1
-0@@ -0,0 +1,29 @@ +Device tree configuration for i2c-ocores
(e.g.) ... for Renesas RIIC SPI
Quoted 18 lines
Documentation/devicetree/bindings/i2c/i2c-riic.txt new file +18
-0+ +Required properties: +- compatible : "renesas,riic-<soctype>". "renesas,riic-rz" as fallback +- reg : address start and address range size of device +- interrupts : 8 interrupts (TEI, RI, TI, SPI, STI, NAKI, ALI, TMOI) +- clock-frequency : frequency of bus clock in Hz +- #address-cells : should be <1> +- #size-cells : should be <0> + +Pinctrl properties might be needed, too. See there. + +Example: + + i2c0: i2c at fcfee000 { + compatible = "renesas,riic-r7s72100", "renesas,riic-rz"; + reg = <0xfcfee000 0x44>; + interrupts = <0 157 IRQ_TYPE_LEVEL_HIGH>, + <0 158 IRQ_TYPE_EDGE_RISING>,
Documentation/devicetree/bindings/i2c/i2c-riic.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/i2c/i2c-riic.txt new file +10
-0+ <0 159 IRQ_TYPE_EDGE_RISING>, + <0 160 IRQ_TYPE_LEVEL_HIGH>, + <0 161 IRQ_TYPE_LEVEL_HIGH>, + <0 162 IRQ_TYPE_LEVEL_HIGH>, + <0 163 IRQ_TYPE_LEVEL_HIGH>, + <0 164 IRQ_TYPE_LEVEL_HIGH>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + };
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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