blob: a937b52d9d6411c2d9b96558464a65b289868b86 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From: Russell King <rmk+kernel@armlinux.org.uk>
2Bcc: linux@mail.armlinux.org.uk
3Cc: linux-i2c@vger.kernel.org
4Subject: [PATCH 01/17] i2c: pxa: use official address byte helper
5MIME-Version: 1.0
6Content-Disposition: inline
7Content-Transfer-Encoding: 8bit
8Content-Type: text/plain; charset="utf-8"
9
10i2c-pxa was created before i2c_8bit_addr_from_msg() was implemented,
11and used its own i2c_pxa_addr_byte() which is functionally the same.
12Sadly, it was never updated to use this new helper. Switch it over.
13
14Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
15---
16 drivers/i2c/busses/i2c-pxa.c | 21 +++++++--------------
17 1 file changed, 7 insertions(+), 14 deletions(-)
18
19--- a/drivers/i2c/busses/i2c-pxa.c
20+++ b/drivers/i2c/busses/i2c-pxa.c
21@@ -674,16 +674,6 @@ static void i2c_pxa_slave_stop(struct px
22 * PXA I2C Master mode
23 */
24
25-static inline unsigned int i2c_pxa_addr_byte(struct i2c_msg *msg)
26-{
27- unsigned int addr = (msg->addr & 0x7f) << 1;
28-
29- if (msg->flags & I2C_M_RD)
30- addr |= 1;
31-
32- return addr;
33-}
34-
35 static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
36 {
37 u32 icr;
38@@ -691,8 +681,8 @@ static inline void i2c_pxa_start_message
39 /*
40 * Step 1: target slave address into IDBR
41 */
42- writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
43- i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
44+ i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
45+ writel(i2c->req_slave_addr, _IDBR(i2c));
46
47 /*
48 * Step 2: initiate the write.
49@@ -1003,8 +993,8 @@ static void i2c_pxa_irq_txempty(struct p
50 /*
51 * Write the next address.
52 */
53- writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
54- i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
55+ i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
56+ writel(i2c->req_slave_addr, _IDBR(i2c));
57
58 /*
59 * And trigger a repeated start, and send the byte.