summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch50
1 files changed, 30 insertions, 20 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
index f4dfd6cfa..ba564e695 100644
--- a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0068-i2c-aspeed-add-H-W-timeout-support.patch
@@ -1,4 +1,4 @@
-From 9a43b47fb794fd195912c6956783b021a46307f8 Mon Sep 17 00:00:00 2001
+From 25a38287274f9c39eb8355d51ba06203efdb07aa Mon Sep 17 00:00:00 2001
From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
Date: Thu, 11 Jul 2019 13:53:34 -0700
Subject: [PATCH] i2c: aspeed: add H/W timeout support
@@ -7,14 +7,22 @@ This commit adds I2C H/W timeout support.
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
---
- drivers/i2c/busses/i2c-aspeed.c | 79 +++++++++++++++++++++++++++++++++++++----
- 1 file changed, 73 insertions(+), 6 deletions(-)
+ drivers/i2c/busses/i2c-aspeed.c | 82 ++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 76 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
-index 0ed9a27850e6..ecb5793036cc 100644
+index 127bc69952ca..542b0f4017eb 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
-@@ -71,10 +71,14 @@
+@@ -55,6 +55,7 @@
+ /* Device Register Definition */
+ /* 0x00 : I2CD Function Control Register */
+ #define ASPEED_I2CD_BUFFER_PAGE_SEL_MASK GENMASK(22, 20)
++#define ASPEED_I2CD_BUS_AUTO_RECOVERY_EN BIT(17)
+ #define ASPEED_I2CD_MULTI_MASTER_DIS BIT(15)
+ #define ASPEED_I2CD_SDA_DRIVE_1T_EN BIT(8)
+ #define ASPEED_I2CD_M_SDA_DRIVE_1T_EN BIT(7)
+@@ -71,10 +72,14 @@
#define ASPEED_I2CD_TIME_SCL_HIGH_MASK GENMASK(19, 16)
#define ASPEED_I2CD_TIME_SCL_LOW_SHIFT 12
#define ASPEED_I2CD_TIME_SCL_LOW_MASK GENMASK(15, 12)
@@ -30,7 +38,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
/* 0x0c : I2CD Interrupt Control Register &
* 0x10 : I2CD Interrupt Status Register
-@@ -82,6 +86,7 @@
+@@ -82,6 +87,7 @@
* These share bit definitions, so use the same values for the enable &
* status bits.
*/
@@ -38,7 +46,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
#define ASPEED_I2CD_INTR_SDA_DL_TIMEOUT BIT(14)
#define ASPEED_I2CD_INTR_BUS_RECOVER_DONE BIT(13)
#define ASPEED_I2CD_INTR_GCALL_ADDR BIT(8)
-@@ -98,8 +103,11 @@
+@@ -98,8 +104,11 @@
ASPEED_I2CD_INTR_SCL_TIMEOUT | \
ASPEED_I2CD_INTR_ABNORMAL | \
ASPEED_I2CD_INTR_ARBIT_LOSS)
@@ -51,7 +59,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
ASPEED_I2CD_INTR_BUS_RECOVER_DONE | \
ASPEED_I2CD_INTR_SCL_TIMEOUT | \
ASPEED_I2CD_INTR_ABNORMAL | \
-@@ -180,6 +188,7 @@ struct aspeed_i2c_bus {
+@@ -180,6 +189,7 @@ struct aspeed_i2c_bus {
u32 divisor);
unsigned long parent_clk_frequency;
u32 bus_frequency;
@@ -59,7 +67,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
/* Transaction state. */
enum aspeed_i2c_master_state master_state;
struct i2c_msg *msgs;
-@@ -297,6 +306,14 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus)
+@@ -297,6 +307,14 @@ static int aspeed_i2c_recover_bus(struct aspeed_i2c_bus *bus)
}
#if IS_ENABLED(CONFIG_I2C_SLAVE)
@@ -74,7 +82,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
{
u32 command, irq_handled = 0;
-@@ -307,6 +324,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -307,6 +325,14 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
if (!slave)
return 0;
@@ -89,7 +97,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
command = readl(bus->base + ASPEED_I2C_CMD_REG);
/* Slave was requested, restart state machine. */
-@@ -649,7 +674,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus)
+@@ -649,7 +675,7 @@ static void aspeed_i2c_next_msg_or_stop(struct aspeed_i2c_bus *bus)
}
}
@@ -98,7 +106,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
{
if (irq_status & ASPEED_I2CD_INTR_ARBIT_LOSS)
return -EAGAIN;
-@@ -680,9 +705,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
+@@ -680,9 +706,9 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
* should clear the command queue effectively taking us back to the
* INACTIVE state.
*/
@@ -110,7 +118,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
irq_status);
irq_handled |= (irq_status & ASPEED_I2CD_INTR_MASTER_ERRORS);
if (bus->master_state != ASPEED_I2C_MASTER_INACTIVE) {
-@@ -1251,6 +1276,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor)
+@@ -1251,6 +1277,7 @@ static u32 aspeed_i2c_25xx_get_clk_reg_val(struct device *dev, u32 divisor)
/* precondition: bus.lock has been acquired. */
static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus)
{
@@ -118,7 +126,7 @@ index 0ed9a27850e6..ecb5793036cc 100644
u32 divisor, clk_reg_val;
divisor = DIV_ROUND_UP(bus->parent_clk_frequency, bus->bus_frequency);
-@@ -1259,8 +1285,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus)
+@@ -1259,8 +1286,46 @@ static int aspeed_i2c_init_clk(struct aspeed_i2c_bus *bus)
ASPEED_I2CD_TIME_THDSTA_MASK |
ASPEED_I2CD_TIME_TACST_MASK);
clk_reg_val |= bus->get_clk_reg_val(bus->dev, divisor);
@@ -166,16 +174,18 @@ index 0ed9a27850e6..ecb5793036cc 100644
return 0;
}
-@@ -1464,6 +1528,9 @@ static int aspeed_i2c_probe_bus(struct platform_device *pdev)
- }
- }
+@@ -1275,6 +1340,11 @@ static int aspeed_i2c_init(struct aspeed_i2c_bus *bus,
+ /* Disable everything. */
+ writel(0, bus->base + ASPEED_I2C_FUN_CTRL_REG);
+ device_property_read_u32(&pdev->dev, "aspeed,hw-timeout-ms",
+ &bus->hw_timeout_ms);
++ if (bus->hw_timeout_ms)
++ fun_ctrl_reg |= ASPEED_I2CD_BUS_AUTO_RECOVERY_EN;
+
- /* Initialize the I2C adapter */
- spin_lock_init(&bus->lock);
- init_completion(&bus->cmd_complete);
+ ret = aspeed_i2c_init_clk(bus);
+ if (ret < 0)
+ return ret;
--
2.7.4