Skip to contentSkip to conversation

ARM: shmobile: r8a7790: add I2C clock

RFC In review Ulrich Hecht 2 participants 4 messages Aug 30, 2013 – Sep 3, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

RFC 6/10 ARM: shmobile: r8a7790: add I2C clock

From: Nguyen Viet Dung <[email protected]>

This patch add clock for I2C bus.

---
 arch/arm/mach-shmobile/clock-r8a7790.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-shmobile/clock-r8a7790.c +11 -0
index d99b87b..05cd34b 100644
@@ -52,6 +52,7 @@
 #define SMSTPCR5 0xe6150144
 #define SMSTPCR7 0xe615014c
 #define SMSTPCR8 0xe6150990
+#define SMSTPCR9 0xe6150994
 
 #define SDCKCR		0xE6150074
 #define SD2CKCR		0xE6150078
@@ -181,6 +182,7 @@ static struct clk div6_clks[DIV6_NR] = {
 
 /* MSTP */
 enum {
+	MSTP931, MSTP930, MSTP929, MSTP928,
 	MSTP813,
 	MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720,
 	MSTP717, MSTP716,
@@ -192,6 +194,10 @@ enum {
 };
 
 static struct clk mstp_clks[MSTP_NR] = {
+	[MSTP931] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 31, 0), /* I2C0 */
+	[MSTP930] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 30, 0), /* I2C1 */
+	[MSTP929] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 29, 0), /* I2C2 */
+	[MSTP928] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 28, 0), /* I2C3 */
 	[MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
 	[MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
 	[MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */
@@ -247,6 +253,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_CON_ID("mp",		&mp_clk),
 	CLKDEV_CON_ID("qspi",		&qspi_clk),
 	CLKDEV_CON_ID("cp",		&cp_clk),
+	CLKDEV_CON_ID("peripheral_clk",	&hp_clk),
 
 	/* DIV4 */
 	CLKDEV_CON_ID("sdh",		&div4_clks[DIV4_SDH]),
@@ -286,6 +293,10 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
 	CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
 	CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
+	CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP931]),
+	CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP930]),
+	CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP929]),
+	CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP928]),
 };
 
 #define R8A7790_CLOCK_ROOT(e, m, p0, p1, p30, p31)		\
Signature · 1 line
1.8.1.4
#1 lore raw

Hello.

Quoted 13 lines · Ulrich Hecht

From: Nguyen Viet Dung <[email protected]>

This patch add clock for I2C bus.

---
  arch/arm/mach-shmobile/clock-r8a7790.c | 11 +++++++++++
  1 file changed, 11 insertions(+)
arch/arm/mach-shmobile/clock-r8a7790.c +0 -0
index d99b87b..05cd34b 100644

[...]

arch/arm/mach-shmobile/clock-r8a7790.c static struct clk div6_clks[DIV6_NR] = { · line 185

Quoted 5 lines
arch/arm/mach-shmobile/clock-r8a7790.c +1 -0
@@ -181,6 +182,7 @@ static struct clk div6_clks[DIV6_NR] = {
 
  /* MSTP */
  enum {
+	MSTP931, MSTP930, MSTP929, MSTP928,

Please break the line after "MSTP930,".

[...]

arch/arm/mach-shmobile/clock-r8a7790.c static struct clk_lookup lookups[] = { · line 299

Quoted 8 lines
arch/arm/mach-shmobile/clock-r8a7790.c +4 -0
@@ -286,6 +293,10 @@ static struct clk_lookup lookups[] = {
  	CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
  	CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
  	CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
+	CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP931]),
+	CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP930]),
+	CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP929]),
+	CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP928]),

These should be sorted downwards by MSTPxxx index, no?

WBR, Sergei

#2 lore raw
In reply to Ulrich Hecht

Thanks for the review.

Quoted 10 lines · Sergei Shtylyov

arch/arm/mach-shmobile/clock-r8a7790.c static struct clk div6_clks[DIV6_NR] = { · line 185

Quoted 7 lines · Ulrich Hecht
arch/arm/mach-shmobile/clock-r8a7790.c +1 -0
@@ -181,6 +182,7 @@ static struct clk div6_clks[DIV6_NR] = {
 
  /* MSTP */
  enum {
+       MSTP931, MSTP930, MSTP929, MSTP928,

Please break the line after "MSTP930,".

Could you explain what the system behind this is?

Quoted 10 lines

arch/arm/mach-shmobile/clock-r8a7790.c static struct clk_lookup lookups[] = { · line 299

Quoted 8 lines
arch/arm/mach-shmobile/clock-r8a7790.c +4 -0
@@ -286,6 +293,10 @@ static struct clk_lookup lookups[] = {
        CLKDEV_DEV_ID("ee220000.mmcif", &mstp_clks[MSTP305]),
        CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
        CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
+       CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP931]),
+       CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP930]),
+       CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP929]),
+       CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP928]),

These should be sorted downwards by MSTPxxx index, no?

OK.

CU
Uli

#3 lore raw
In reply to Ulrich Hecht

Hello.

Quoted 6 lines · Ulrich Hecht
Quoted 5 lines · <[email protected]> wrote:
Quoted 4 lines · Ulrich Hecht
arch/arm/mach-shmobile/clock-r8a7790.c +0 -0
@@ -181,6 +182,7 @@ static struct clk div6_clks[DIV6_NR] = {
 
Quoted 7 lines
Quoted 5 lines

arch/arm/mach-shmobile/clock-r8a7790.c static struct clk div6_clks[DIV6_NR] = { · line 185

Quoted 3 lines
arch/arm/mach-shmobile/clock-r8a7790.c +1 -0
   /* MSTP */
   enum {
+       MSTP931, MSTP930, MSTP929, MSTP928,

Please break the line after "MSTP930,".

Could you explain what the system behind this is?

Every line should start with MSTPxx0 and end with MSTPxx9, ideally.
Although, I see this file doesn't always follow this rule, so you can ignore me. :-)

Quoted 2 lines

CU
Uli

WBR, Sergei