This patch has been backported to stable kernel 5.4 already.
Remove our local patch explicitly now, as by applying the patch
(or refreshing) the relevant code is actually added a second time.
Refresh remaining patches as well.
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
+++ /dev/null
-From: Russell King <rmk+kernel@armlinux.org.uk>
-Bcc: linux@mail.armlinux.org.uk
-Cc: Linus Walleij <linus.walleij@linaro.org>,Bartosz Golaszewski <bgolaszewski@baylibre.com>,linux-gpio@vger.kernel.org
-Subject: [PATCH] gpiolib: fix up emulated open drain outputs
-MIME-Version: 1.0
-Content-Disposition: inline
-Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset="utf-8"
-
-gpiolib has a corner case with open drain outputs that are emulated.
-When such outputs are outputting a logic 1, emulation will set the
-hardware to input mode, which will cause gpiod_get_direction() to
-report that it is in input mode. This is different from the behaviour
-with a true open-drain output.
-
-Unify the semantics here.
-
-Suggested-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
----
- drivers/gpio/gpiolib.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
-index 104ed299d5ea..99d19f80440e 100644
---- a/drivers/gpio/gpiolib.c
-+++ b/drivers/gpio/gpiolib.c
-@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc *desc)
- chip = gpiod_to_chip(desc);
- offset = gpio_chip_hwgpio(desc);
-
-+ /*
-+ * Open drain emulation using input mode may incorrectly report
-+ * input here, fix that up.
-+ */
-+ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) &&
-+ test_bit(FLAG_IS_OUT, &desc->flags))
-+ return 0;
-+
- if (!chip->get_direction)
- return -ENOTSUPP;
-
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 2c3c3d6935c0..966000923e8e 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -675,16 +675,6 @@ static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
+@@ -675,16 +675,6 @@ static void i2c_pxa_slave_stop(struct px
* PXA I2C Master mode
*/
static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
{
u32 icr;
-@@ -693,8 +683,8 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
+@@ -692,8 +682,8 @@ static inline void i2c_pxa_start_message
/*
* Step 1: target slave address into IDBR
*/
/*
* Step 2: initiate the write.
-@@ -1006,8 +999,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
+@@ -1006,8 +996,8 @@ static void i2c_pxa_irq_txempty(struct p
/*
* Write the next address.
*/
/*
* And trigger a repeated start, and send the byte.
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 4 ----
1 file changed, 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 966000923e8e..eddb749c9eae 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -20,8 +20,6 @@
struct pxa_reg_layout {
u32 ibmr;
u32 idbr;
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index eddb749c9eae..ee83d2e46de0 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -16,22 +16,22 @@
struct pxa_reg_layout {
u32 ibmr;
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 325 +++++++++++++++++------------------
1 file changed, 162 insertions(+), 163 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index ee83d2e46de0..e5f00ae39861 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -327,7 +327,6 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
+@@ -327,7 +327,6 @@ static void i2c_pxa_scream_blue_murder(s
#endif /* ifdef DEBUG / else */
static void i2c_pxa_master_complete(struct pxa_i2c *i2c, int ret);
static inline int i2c_pxa_is_slavemode(struct pxa_i2c *i2c)
{
-@@ -703,34 +702,6 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
+@@ -700,34 +699,6 @@ static inline void i2c_pxa_stop_message(
writel(icr, _ICR(i2c));
}
/*
* PXA I2C send master code
* 1. Load master code to IDBR and send it.
-@@ -759,140 +730,6 @@ static int i2c_pxa_send_mastercode(struct pxa_i2c *i2c)
+@@ -756,140 +727,6 @@ static int i2c_pxa_send_mastercode(struc
return (timeout == 0) ? I2C_RETRY : 0;
}
/*
* i2c_pxa_master_complete - complete the message and wake up.
*/
-@@ -1099,6 +936,71 @@ static irqreturn_t i2c_pxa_handler(int this_irq, void *dev_id)
+@@ -1096,6 +933,71 @@ static irqreturn_t i2c_pxa_handler(int t
return IRQ_HANDLED;
}
static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
{
-@@ -1132,6 +1034,103 @@ static const struct i2c_algorithm i2c_pxa_algorithm = {
+@@ -1129,6 +1031,103 @@ static const struct i2c_algorithm i2c_px
.functionality = i2c_pxa_functionality,
};
static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
.master_xfer = i2c_pxa_pio_xfer,
.functionality = i2c_pxa_functionality,
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 113 ++++++++++++++++-------------------
1 file changed, 53 insertions(+), 60 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index e5f00ae39861..ea96dfa6b9d5 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -33,6 +33,56 @@
static struct pxa_reg_layout pxa_reg_layout[] = {
[REGS_PXA2XX] = {
.ibmr = 0x00,
-@@ -96,8 +141,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -96,8 +141,8 @@ static struct pxa_reg_layout pxa_reg_lay
.icr = 0x08,
.isr = 0x0c,
.isar = 0x10,
},
};
-@@ -111,58 +156,6 @@ static const struct platform_device_id i2c_pxa_id_table[] = {
+@@ -111,58 +156,6 @@ static const struct platform_device_id i
};
MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table);
struct pxa_i2c {
spinlock_t lock;
wait_queue_head_t wait;
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index ea96dfa6b9d5..b3286d7ab75d 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -34,6 +34,9 @@
#define ICR_START (1 << 0) /* start bit */
#define ICR_STOP (1 << 1) /* stop bit */
#define ICR_ACKNAK (1 << 2) /* send ACK(0) or NAK(1) */
-@@ -335,7 +338,7 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c)
+@@ -335,7 +338,7 @@ static void i2c_pxa_abort(struct pxa_i2c
return;
}
unsigned long icr = readl(_ICR(i2c));
icr &= ~ICR_START;
-@@ -390,7 +393,8 @@ static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
+@@ -390,7 +393,8 @@ static int i2c_pxa_wait_master(struct px
* quick check of the i2c lines themselves to ensure they've
* gone high...
*/
if (i2c_debug > 0)
dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
return 1;
-@@ -575,7 +579,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr)
+@@ -575,7 +579,7 @@ static void i2c_pxa_slave_start(struct p
timeout = 0x10000;
while (1) {
break;
timeout--;
-@@ -638,7 +642,7 @@ static void i2c_pxa_slave_start(struct pxa_i2c *i2c, u32 isr)
+@@ -638,7 +642,7 @@ static void i2c_pxa_slave_start(struct p
timeout = 0x10000;
while (1) {
break;
timeout--;
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index b3286d7ab75d..05dbe6bf4633 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -114,6 +114,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -114,6 +114,8 @@ static struct pxa_reg_layout pxa_reg_lay
.icr = 0x10,
.isr = 0x18,
.isar = 0x20,
},
[REGS_PXA3XX] = {
.ibmr = 0x00,
-@@ -121,6 +123,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -121,6 +123,8 @@ static struct pxa_reg_layout pxa_reg_lay
.icr = 0x08,
.isr = 0x0c,
.isar = 0x10,
},
[REGS_CE4100] = {
.ibmr = 0x14,
-@@ -128,6 +132,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -128,6 +132,8 @@ static struct pxa_reg_layout pxa_reg_lay
.icr = 0x00,
.isr = 0x04,
/* no isar register */
},
[REGS_PXA910] = {
.ibmr = 0x00,
-@@ -137,6 +143,8 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -137,6 +143,8 @@ static struct pxa_reg_layout pxa_reg_lay
.isar = 0x20,
.ilcr = 0x28,
.iwcr = 0x30,
},
[REGS_A3700] = {
.ibmr = 0x00,
-@@ -1235,8 +1243,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
+@@ -1232,8 +1240,8 @@ static int i2c_pxa_probe(struct platform
i2c->reg_idbr = i2c->reg_base + pxa_reg_layout[i2c_type].idbr;
i2c->reg_icr = i2c->reg_base + pxa_reg_layout[i2c_type].icr;
i2c->reg_isr = i2c->reg_base + pxa_reg_layout[i2c_type].isr;
if (i2c_type != REGS_CE4100)
i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar;
---
-2.20.1
-
include/linux/platform_data/i2c-pxa.h | 48 ---------------------------
2 files changed, 43 insertions(+), 48 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 05dbe6bf4633..482768a9fdd2 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -86,6 +86,49 @@
struct pxa_reg_layout {
u32 ibmr;
u32 idbr;
-diff --git a/include/linux/platform_data/i2c-pxa.h b/include/linux/platform_data/i2c-pxa.h
-index cb290092599c..5c08a6ff3444 100644
--- a/include/linux/platform_data/i2c-pxa.h
+++ b/include/linux/platform_data/i2c-pxa.h
@@ -7,54 +7,6 @@
struct i2c_slave_client;
struct i2c_pxa_platform_data {
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 482768a9fdd2..760a29fb6af5 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -200,6 +200,15 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
+@@ -200,6 +200,15 @@ static struct pxa_reg_layout pxa_reg_lay
},
};
static const struct platform_device_id i2c_pxa_id_table[] = {
{ "pxa2xx-i2c", REGS_PXA2XX },
{ "pxa3xx-pwri2c", REGS_PXA3XX },
-@@ -1184,15 +1193,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
+@@ -1181,15 +1190,6 @@ static const struct i2c_algorithm i2c_px
.functionality = i2c_pxa_functionality,
};
static int i2c_pxa_probe_dt(struct platform_device *pdev, struct pxa_i2c *i2c,
enum pxa_i2c_types *i2c_types)
{
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 760a29fb6af5..f3a11050053c 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -364,11 +364,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
+@@ -364,11 +364,10 @@ static void i2c_pxa_scream_blue_murder(s
dev_err(dev, "IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n",
readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)),
readl(_ISR(i2c)));
}
#else /* ifdef DEBUG */
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index f3a11050053c..b2c7765756e2 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -287,13 +287,14 @@ struct bits {
}
#endif
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index b2c7765756e2..19505ffbb8f1 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -417,19 +417,26 @@ static void i2c_pxa_abort(struct pxa_i2c *i2c)
+@@ -417,19 +417,26 @@ static void i2c_pxa_abort(struct pxa_i2c
static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
{
int timeout = DEF_TIMEOUT;
}
static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index c1e50c0b9756..46f1cf97d955 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -1102,18 +1102,20 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
+@@ -1061,18 +1061,20 @@ static int i2c_pxa_do_xfer(struct pxa_i2
return ret;
}
udelay(100);
}
i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
-@@ -1123,6 +1125,14 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num
+@@ -1082,6 +1084,14 @@ static int i2c_pxa_xfer(struct i2c_adapt
return ret;
}
static u32 i2c_pxa_functionality(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
-@@ -1210,7 +1220,6 @@ static int i2c_pxa_pio_xfer(struct i2c_adapter *adap,
+@@ -1165,7 +1175,6 @@ static int i2c_pxa_pio_xfer(struct i2c_a
struct i2c_msg msgs[], int num)
{
struct pxa_i2c *i2c = adap->algo_data;
/* If the I2C controller is disabled we need to reset it
(probably due to a suspend/resume destroying state). We do
-@@ -1219,20 +1228,7 @@ static int i2c_pxa_pio_xfer(struct i2c_adapter *adap,
+@@ -1174,20 +1183,7 @@ static int i2c_pxa_pio_xfer(struct i2c_a
if (!(readl(_ICR(i2c)) & ICR_IUE))
i2c_pxa_reset(i2c);
}
static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 46f1cf97d955..f20f8b905793 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -90,6 +90,7 @@
+@@ -91,6 +91,7 @@
*/
#define DEF_TIMEOUT 32
#define BUS_ERROR (-EREMOTEIO)
#define XFER_NAKED (-ECONNREFUSED)
#define I2C_RETRY (-2000) /* an error has occurred retry transmit */
-@@ -881,7 +882,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
+@@ -840,7 +841,7 @@ static void i2c_pxa_irq_txempty(struct p
*/
if (isr & ISR_ACKNAK) {
if (i2c->msg_ptr == 0 && i2c->msg_idx == 0)
else
ret = XFER_NAKED;
}
-@@ -1109,16 +1110,19 @@ static int i2c_pxa_internal_xfer(struct pxa_i2c *i2c,
+@@ -1068,16 +1069,19 @@ static int i2c_pxa_internal_xfer(struct
{
int ret, i;
ret = -EREMOTEIO;
out:
i2c_pxa_set_slave(i2c, ret);
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index f20f8b905793..0becab239476 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -1095,7 +1095,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
+@@ -1054,7 +1054,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2
ret = i2c->msg_idx;
if (!timeout && i2c->msg_num) {
ret = I2C_RETRY;
}
-@@ -1169,7 +1169,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
+@@ -1124,7 +1124,7 @@ static int i2c_pxa_pio_set_master(struct
if (timeout < 0) {
show_state(i2c);
dev_err(&i2c->adap.dev,
return I2C_RETRY;
}
-@@ -1213,7 +1213,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
+@@ -1168,7 +1168,7 @@ static int i2c_pxa_do_pio_xfer(struct px
out:
if (timeout == 0) {
ret = I2C_RETRY;
}
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 0becab239476..db739cce93ac 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -1161,10 +1161,8 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
+@@ -1116,10 +1116,8 @@ static int i2c_pxa_pio_set_master(struct
/*
* Wait for the bus to become free.
*/
if (timeout < 0) {
show_state(i2c);
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index db739cce93ac..a72d07bdb793 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -795,11 +795,9 @@ static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)
+@@ -754,11 +754,9 @@ static inline void i2c_pxa_stop_message(
{
u32 icr;
writel(icr, _ICR(i2c));
}
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index a72d07bdb793..0e194d6cd1b5 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
-@@ -940,14 +940,8 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
+@@ -899,14 +899,8 @@ static void i2c_pxa_irq_txempty(struct p
icr &= ~ICR_ALDIE;
icr |= ICR_START | ICR_TB;
} else {
i2c_pxa_master_complete(i2c, 0);
}
---
-2.20.1
-
drivers/i2c/busses/i2c-pxa.c | 176 +++++++++++++++++++++++++++++++----
1 file changed, 159 insertions(+), 17 deletions(-)
-diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
-index 0e194d6cd1b5..a7885b8b5031 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -20,6 +20,7 @@
#include <linux/errno.h>
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
+ #include <linux/i2c-pxa.h>
#include <linux/init.h>
- #include <linux/interrupt.h>
-@@ -28,6 +29,7 @@
+@@ -29,6 +30,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/platform_data/i2c-pxa.h>
#include <linux/slab.h>
-@@ -260,6 +262,11 @@ struct pxa_i2c {
+@@ -261,6 +263,11 @@ struct pxa_i2c {
bool highmode_enter;
u32 fm_mask;
u32 hs_mask;
};
#define _IBMR(i2c) ((i2c)->reg_ibmr)
-@@ -559,13 +566,8 @@ static void i2c_pxa_set_slave(struct pxa_i2c *i2c, int errcode)
+@@ -560,13 +567,8 @@ static void i2c_pxa_set_slave(struct pxa
#define i2c_pxa_set_slave(i2c, err) do { } while (0)
#endif
/* reset according to 9.8 */
writel(ICR_UR, _ICR(i2c));
writel(I2C_ISR_INIT, _ISR(i2c));
-@@ -584,12 +586,25 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
+@@ -585,12 +587,25 @@ static void i2c_pxa_reset(struct pxa_i2c
#endif
i2c_pxa_set_slave(i2c, 0);
#ifdef CONFIG_I2C_PXA_SLAVE
/*
-@@ -1043,6 +1058,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
+@@ -1002,6 +1017,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2
ret = i2c_pxa_wait_bus_not_busy(i2c);
if (ret) {
dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n");
goto out;
}
-@@ -1088,6 +1104,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
+@@ -1047,6 +1063,7 @@ static int i2c_pxa_do_xfer(struct pxa_i2
if (!timeout && i2c->msg_num) {
i2c_pxa_scream_blue_murder(i2c, "timeout with active message");
ret = I2C_RETRY;
}
-@@ -1277,6 +1294,129 @@ static int i2c_pxa_probe_pdata(struct platform_device *pdev,
+@@ -1228,6 +1245,129 @@ static int i2c_pxa_probe_pdata(struct pl
return 0;
}
static int i2c_pxa_probe(struct platform_device *dev)
{
struct i2c_pxa_platform_data *plat = dev_get_platdata(&dev->dev);
-@@ -1289,6 +1429,16 @@ static int i2c_pxa_probe(struct platform_device *dev)
+@@ -1240,6 +1380,16 @@ static int i2c_pxa_probe(struct platform
if (!i2c)
return -ENOMEM;
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
i2c->reg_base = devm_ioremap_resource(&dev->dev, res);
if (IS_ERR(i2c->reg_base))
-@@ -1298,8 +1448,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
- if (irq < 0)
+@@ -1251,8 +1401,9 @@ static int i2c_pxa_probe(struct platform
return irq;
+ }
- /* Default adapter num to device id; i2c_pxa_probe_dt can override. */
- i2c->adap.nr = dev->id;
ret = i2c_pxa_probe_dt(dev, i2c, &i2c_type);
if (ret > 0)
-@@ -1307,9 +1458,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
+@@ -1260,9 +1411,6 @@ static int i2c_pxa_probe(struct platform
if (ret < 0)
return ret;
spin_lock_init(&i2c->lock);
init_waitqueue_head(&i2c->wait);
-@@ -1375,12 +1523,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
+@@ -1332,12 +1480,6 @@ static int i2c_pxa_probe(struct platform
i2c_pxa_reset(i2c);
ret = i2c_add_numbered_adapter(&i2c->adap);
if (ret < 0)
goto ereqirq;
---
-2.20.1
-