cddd459140
Add patches for linux-5.4. The patches are from NXP LSDK-20.04 release which was tagged LSDK-20.04-V5.4. https://source.codeaurora.org/external/qoriq/qoriq-components/linux/ For boards LS1021A-IOT, and Traverse-LS1043 which are not involved in LSDK, port the dts patches from 4.14. The patches are sorted into the following categories: 301-arch-xxxx 302-dts-xxxx 303-core-xxxx 701-net-xxxx 801-audio-xxxx 802-can-xxxx 803-clock-xxxx 804-crypto-xxxx 805-display-xxxx 806-dma-xxxx 807-gpio-xxxx 808-i2c-xxxx 809-jailhouse-xxxx 810-keys-xxxx 811-kvm-xxxx 812-pcie-xxxx 813-pm-xxxx 814-qe-xxxx 815-sata-xxxx 816-sdhc-xxxx 817-spi-xxxx 818-thermal-xxxx 819-uart-xxxx 820-usb-xxxx 821-vfio-xxxx Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
94 lines
2.9 KiB
Diff
94 lines
2.9 KiB
Diff
From 27ea8554c8fdcdf1d7aba5ce47630d878ce96691 Mon Sep 17 00:00:00 2001
|
|
From: Biwen Li <biwen.li@nxp.com>
|
|
Date: Thu, 24 Oct 2019 13:14:44 +0800
|
|
Subject: [PATCH] i2c: imx: correct code of errata A-010650 for layerscape
|
|
platform
|
|
|
|
- Simplify code with helper function i2c_imx_clr_al_bit
|
|
- Fix an error about clearing arbitration lost bit
|
|
- Fix an error that not set I2Cx_IBCR following by
|
|
the workaround of A-010650 (in step 5)
|
|
|
|
Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
|
|
Signed-off-by: Biwen Li <biwen.li@nxp.com>
|
|
---
|
|
drivers/i2c/busses/i2c-imx.c | 38 +++++++++++++++++++-------------------
|
|
1 file changed, 19 insertions(+), 19 deletions(-)
|
|
|
|
--- a/drivers/i2c/busses/i2c-imx.c
|
|
+++ b/drivers/i2c/busses/i2c-imx.c
|
|
@@ -503,6 +503,14 @@ static void i2c_imx_dma_free(struct imx_
|
|
dma->chan_using = NULL;
|
|
}
|
|
|
|
+/* Clear arbitration lost bit */
|
|
+static void i2c_imx_clr_al_bit(unsigned int status, struct imx_i2c_struct *i2c_imx)
|
|
+{
|
|
+ status &= ~I2SR_IAL;
|
|
+ status |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IAL);
|
|
+ imx_i2c_write_reg(status, i2c_imx, IMX_I2C_I2SR);
|
|
+}
|
|
+
|
|
static int i2c_imx_bus_busy(struct imx_i2c_struct *i2c_imx, int for_busy)
|
|
{
|
|
unsigned long orig_jiffies = jiffies;
|
|
@@ -515,8 +523,7 @@ static int i2c_imx_bus_busy(struct imx_i
|
|
|
|
/* check for arbitration lost */
|
|
if (temp & I2SR_IAL) {
|
|
- temp &= ~I2SR_IAL;
|
|
- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
|
|
+ i2c_imx_clr_al_bit(temp, i2c_imx);
|
|
return -EAGAIN;
|
|
}
|
|
|
|
@@ -700,14 +707,6 @@ static void i2c_imx_clr_if_bit(unsigned
|
|
imx_i2c_write_reg(status, i2c_imx, IMX_I2C_I2SR);
|
|
}
|
|
|
|
-/* Clear arbitration lost bit */
|
|
-static void i2c_imx_clr_al_bit(unsigned int status, struct imx_i2c_struct *i2c_imx)
|
|
-{
|
|
- status &= ~I2SR_IAL;
|
|
- status |= (i2c_imx->hwdata->i2sr_clr_opcode & I2SR_IAL);
|
|
- imx_i2c_write_reg(status, i2c_imx, IMX_I2C_I2SR);
|
|
-}
|
|
-
|
|
static irqreturn_t i2c_imx_master_isr(struct imx_i2c_struct *i2c_imx)
|
|
{
|
|
unsigned int status;
|
|
@@ -1050,12 +1049,14 @@ static int i2c_imx_recovery_for_layersca
|
|
gpio_set_value(i2c_imx->gpio, 1);
|
|
|
|
/*
|
|
- * Set I2Cx_IBCR = 0h00 to generate a STOP and then
|
|
- * set I2Cx_IBCR = 0h80 to reset
|
|
+ * Set I2Cx_IBCR = 0h00 to generate a STOP
|
|
*/
|
|
- temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2CR);
|
|
- temp &= ~(I2CR_MSTA | I2CR_MTX);
|
|
- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2CR);
|
|
+ imx_i2c_write_reg(i2c_imx->hwdata->i2cr_ien_opcode, i2c_imx, IMX_I2C_I2CR);
|
|
+
|
|
+ /*
|
|
+ * Set I2Cx_IBCR = 0h80 to reset the I2Cx controller
|
|
+ */
|
|
+ imx_i2c_write_reg(i2c_imx->hwdata->i2cr_ien_opcode | I2CR_IEN, i2c_imx, IMX_I2C_I2CR);
|
|
|
|
/* Restore the saved value of the register SCFG_RCWPMUXCR0 */
|
|
if (i2c_imx->need_set_pmuxcr == 1) {
|
|
@@ -1069,10 +1070,9 @@ static int i2c_imx_recovery_for_layersca
|
|
* I2C_IBSR[IBAL] = 1
|
|
*/
|
|
temp = imx_i2c_read_reg(i2c_imx, IMX_I2C_I2SR);
|
|
- if (temp & I2SR_IAL) {
|
|
- temp &= ~I2SR_IAL;
|
|
- imx_i2c_write_reg(temp, i2c_imx, IMX_I2C_I2SR);
|
|
- }
|
|
+ if (temp & I2SR_IAL)
|
|
+ i2c_imx_clr_al_bit(temp, i2c_imx);
|
|
+
|
|
return 0;
|
|
}
|
|
|