diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2014-10-24 13:26:37 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-10-24 13:26:37 -0700 |
commit | db65bcfd9563a7531c3dd46c350565705be1fd84 (patch) | |
tree | ff7b068472764e36ab02a739917e206dd11d6b46 /drivers/i2c/busses/i2c-imx.c | |
parent | b47dcbdc5161d3d5756f430191e2840d9b855492 (diff) | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
Merge tag 'v3.18-rc1' into x86/urgent
Reason:
Need to apply audit patch on top of v3.18-rc1.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'drivers/i2c/busses/i2c-imx.c')
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 613069bc561..c48e46af670 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -268,6 +268,14 @@ static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy) while (1) { temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR); + + /* check for arbitration lost */ + if (temp & I2SR_IAL) { + temp &= ~I2SR_IAL; + imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR); + return -EAGAIN; + } + if (for_busy && (temp & I2SR_IBB)) break; if (!for_busy && !(temp & I2SR_IBB)) @@ -702,7 +710,7 @@ static int i2c_imx_probe(struct platform_device *pdev) pdev->name, i2c_imx); if (ret) { dev_err(&pdev->dev, "can't claim irq %d\n", irq); - return ret; + goto clk_disable; } /* Init queue */ @@ -727,7 +735,7 @@ static int i2c_imx_probe(struct platform_device *pdev) ret = i2c_add_numbered_adapter(&i2c_imx->adapter); if (ret < 0) { dev_err(&pdev->dev, "registration failed\n"); - return ret; + goto clk_disable; } /* Set up platform driver data */ @@ -741,6 +749,10 @@ static int i2c_imx_probe(struct platform_device *pdev) dev_info(&i2c_imx->adapter.dev, "IMX I2C adapter registered\n"); return 0; /* Return OK */ + +clk_disable: + clk_disable_unprepare(i2c_imx->clk); + return ret; } static int i2c_imx_remove(struct platform_device *pdev) |