diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2015-09-03 22:20:05 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-10-09 22:29:28 +0100 |
commit | 93c659d820ef291f6ca5e628f44b26cfb2226aba (patch) | |
tree | da6a8f48c8dd17ea6ef721a4a360fac958898db6 /drivers/i2c | |
parent | 049e6dde7e57f0054fdc49102e7ef4830c698b46 (diff) | |
download | blackbird-op-linux-93c659d820ef291f6ca5e628f44b26cfb2226aba.tar.gz blackbird-op-linux-93c659d820ef291f6ca5e628f44b26cfb2226aba.zip |
i2c: rcar: rework hw init
We don't need to init HW before every transfer since we know the HW
state then. HW init at probe time is enough. While here, add setting the
clock register which belongs to init HW. Also, set MDBS bit since not
setting it is prohibited according to the manual.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-rcar.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index d8361dada584..877ce97ac7a5 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -144,9 +144,10 @@ static void rcar_i2c_init(struct rcar_i2c_priv *priv) { /* reset master mode */ rcar_i2c_write(priv, ICMIER, 0); - rcar_i2c_write(priv, ICMCR, 0); + rcar_i2c_write(priv, ICMCR, MDBS); rcar_i2c_write(priv, ICMSR, 0); - rcar_i2c_write(priv, ICMAR, 0); + /* start clock */ + rcar_i2c_write(priv, ICCCR, priv->icccr); } static int rcar_i2c_bus_barrier(struct rcar_i2c_priv *priv) @@ -495,16 +496,6 @@ static int rcar_i2c_master_xfer(struct i2c_adapter *adap, pm_runtime_get_sync(dev); - /*-------------- spin lock -----------------*/ - spin_lock_irqsave(&priv->lock, flags); - - rcar_i2c_init(priv); - /* start clock */ - rcar_i2c_write(priv, ICCCR, priv->icccr); - - spin_unlock_irqrestore(&priv->lock, flags); - /*-------------- spin unlock -----------------*/ - ret = rcar_i2c_bus_barrier(priv); if (ret < 0) goto out; @@ -669,6 +660,8 @@ static int rcar_i2c_probe(struct platform_device *pdev) if (IS_ERR(priv->io)) return PTR_ERR(priv->io); + rcar_i2c_init(priv); + irq = platform_get_irq(pdev, 0); init_waitqueue_head(&priv->wait); spin_lock_init(&priv->lock); |