Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347059
b: refs/heads/master
c: 7b0e629
h: refs/heads/master
i:
  347057: b3384ac
  347055: 552f49f
v: v3
  • Loading branch information
Shinya Kuribayashi authored and Wolfram Sang committed Nov 16, 2012
1 parent 5283b29 commit 87a3955
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 27e0fbefa5ddebdd681d2be9824302d14494c5ff
refs/heads/master: 7b0e62920ac314eb819e68b7d2c51994b98b19ca
18 changes: 13 additions & 5 deletions trunk/drivers/i2c/busses/i2c-sh_mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,15 @@ static void iic_set_clr(struct sh_mobile_i2c_data *pd, int offs,
iic_wr(pd, offs, (iic_rd(pd, offs) | set) & ~clr);
}

static void activate_ch(struct sh_mobile_i2c_data *pd)
static void sh_mobile_i2c_init(struct sh_mobile_i2c_data *pd)
{
unsigned long i2c_clk;
u_int32_t num;
u_int32_t denom;
u_int32_t tmp;

/* Wake up device and enable clock */
pm_runtime_get_sync(pd->dev);
clk_enable(pd->clk);

/* Get clock rate after clock is enabled */
clk_enable(pd->clk);
i2c_clk = clk_get_rate(pd->clk);

/* Calculate the value for iccl. From the data sheet:
Expand Down Expand Up @@ -239,6 +236,15 @@ static void activate_ch(struct sh_mobile_i2c_data *pd)
pd->icic &= ~ICIC_ICCHB8;
}

clk_disable(pd->clk);
}

static void activate_ch(struct sh_mobile_i2c_data *pd)
{
/* Wake up device and enable clock */
pm_runtime_get_sync(pd->dev);
clk_enable(pd->clk);

/* Enable channel and configure rx ack */
iic_set_clr(pd, ICCR, ICCR_ICE, 0);

Expand Down Expand Up @@ -632,6 +638,8 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
if (size > 0x17)
pd->flags |= IIC_FLAG_HAS_ICIC67;

sh_mobile_i2c_init(pd);

/* Enable Runtime PM for this device.
*
* Also tell the Runtime PM core to ignore children
Expand Down

0 comments on commit 87a3955

Please sign in to comment.