From: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Wolfram Sang <wsa@the-dreams.de>,
linux-i2c@vger.kernel.org,
Chris Paterson <Chris.Paterson2@renesas.com>,
Biju Das <biju.das@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro@bp.renesas.com>,
stable@vger.kernel.org,
Ben Hutchings <ben.hutchings@codethink.co.uk>
Subject: [PATCH 2/6] i2c: rcar: rework hw init
Date: Tue, 29 May 2018 14:33:12 +0100 [thread overview]
Message-ID: <1527600796-25901-3-git-send-email-fabrizio.castro@bp.renesas.com> (raw)
In-Reply-To: <1527600796-25901-1-git-send-email-fabrizio.castro@bp.renesas.com>
From: Wolfram Sang <wsa+renesas@sang-engineering.com>
commit 2c78cdc1c06308a59d6ed4145cdba73fdeff8c0d upstream.
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>
[fabrizio: cherry-pick to 4.4]
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Reviewed-by: Chris Paterson <Chris.Paterson2@renesas.com>
---
drivers/i2c/busses/i2c-rcar.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index fef53c1..b8ff5f2 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)
@@ -496,16 +497,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;
@@ -666,6 +657,7 @@ static int rcar_i2c_probe(struct platform_device *pdev)
if (ret < 0)
goto out_pm_put;
+ rcar_i2c_init(priv);
pm_runtime_put(dev);
irq = platform_get_irq(pdev, 0);
--
2.7.4
next prev parent reply other threads:[~2018-05-29 13:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 13:33 [PATCH 0/6] Fix R-Car I2C data byte sent twice issue Fabrizio Castro
2018-05-29 13:33 ` [PATCH 1/6] i2c: rcar: make sure clocks are on when doing clock calculation Fabrizio Castro
2018-05-29 13:33 ` Fabrizio Castro [this message]
2018-05-29 13:33 ` [PATCH 3/6] i2c: rcar: remove unused IOERROR state Fabrizio Castro
2018-05-29 13:33 ` [PATCH 4/6] i2c: rcar: remove spinlock Fabrizio Castro
2018-05-29 13:33 ` [PATCH 5/6] i2c: rcar: refactor setup of a msg Fabrizio Castro
2018-05-29 13:33 ` [PATCH 6/6] i2c: rcar: init new messages in irq Fabrizio Castro
2018-05-29 17:19 ` [PATCH 0/6] Fix R-Car I2C data byte sent twice issue Wolfram Sang
2018-05-29 17:25 ` Wolfram Sang
2018-05-29 18:52 ` Fabrizio Castro
2018-05-29 19:16 ` Wolfram Sang
2018-05-29 18:08 ` Fabrizio Castro
2018-06-02 13:16 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527600796-25901-3-git-send-email-fabrizio.castro@bp.renesas.com \
--to=fabrizio.castro@bp.renesas.com \
--cc=Chris.Paterson2@renesas.com \
--cc=ben.hutchings@codethink.co.uk \
--cc=biju.das@bp.renesas.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-i2c@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).