kernel: backport v5.8 i2c-pxa updates
[openwrt/staging/stintel.git] / target / linux / generic / backport-5.4 / 803-v5.8-i2c-pxa-use-official-address-byte-helper.patch
1 From: Russell King <rmk+kernel@armlinux.org.uk>
2 Bcc: linux@mail.armlinux.org.uk
3 Cc: linux-i2c@vger.kernel.org
4 Subject: [PATCH 01/17] i2c: pxa: use official address byte helper
5 MIME-Version: 1.0
6 Content-Disposition: inline
7 Content-Transfer-Encoding: 8bit
8 Content-Type: text/plain; charset="utf-8"
9
10 i2c-pxa was created before i2c_8bit_addr_from_msg() was implemented,
11 and used its own i2c_pxa_addr_byte() which is functionally the same.
12 Sadly, it was never updated to use this new helper. Switch it over.
13
14 Signed-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 diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
20 index 2c3c3d6935c0..966000923e8e 100644
21 --- a/drivers/i2c/busses/i2c-pxa.c
22 +++ b/drivers/i2c/busses/i2c-pxa.c
23 @@ -675,16 +675,6 @@ static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
24 * PXA I2C Master mode
25 */
26
27 -static inline unsigned int i2c_pxa_addr_byte(struct i2c_msg *msg)
28 -{
29 - unsigned int addr = (msg->addr & 0x7f) << 1;
30 -
31 - if (msg->flags & I2C_M_RD)
32 - addr |= 1;
33 -
34 - return addr;
35 -}
36 -
37 static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
38 {
39 u32 icr;
40 @@ -693,8 +683,8 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
41 /*
42 * Step 1: target slave address into IDBR
43 */
44 - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
45 - i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
46 + i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
47 + writel(i2c->req_slave_addr, _IDBR(i2c));
48
49 /*
50 * Step 2: initiate the write.
51 @@ -1006,8 +999,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
52 /*
53 * Write the next address.
54 */
55 - writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
56 - i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
57 + i2c->req_slave_addr = i2c_8bit_addr_from_msg(i2c->msg);
58 + writel(i2c->req_slave_addr, _IDBR(i2c));
59
60 /*
61 * And trigger a repeated start, and send the byte.
62 --
63 2.20.1
64