[PATCH 6/8] i2c: sprd: Add additional IIC control bit configuration to adapt to the new IP version of the UNISOC platform

Huangzheng Lai posted 8 patches 2 years, 4 months ago
[PATCH 6/8] i2c: sprd: Add additional IIC control bit configuration to adapt to the new IP version of the UNISOC platform
Posted by Huangzheng Lai 2 years, 4 months ago
The new IIC IP version on the UNISOC platform has added I2C_NACK_EN and
I2C_TRANS_EN control bits. To ensure that the IIC controller can initiate
transmission smoothly, these two bits need to be configured.

Signed-off-by: Huangzheng Lai <Huangzheng.Lai@unisoc.com>
---
 drivers/i2c/busses/i2c-sprd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
index 7314c897525d..d867389c7f17 100644
--- a/drivers/i2c/busses/i2c-sprd.c
+++ b/drivers/i2c/busses/i2c-sprd.c
@@ -33,6 +33,8 @@
 #define ADDR_RST		0x2c
 
 /* I2C_CTL */
+#define I2C_NACK_EN		BIT(22)
+#define I2C_TRANS_EN		BIT(21)
 #define STP_EN			BIT(20)
 #define FIFO_AF_LVL_MASK	GENMASK(19, 16)
 #define FIFO_AF_LVL		16
@@ -397,7 +399,7 @@ static void sprd_i2c_enable(struct sprd_i2c *i2c_dev)
 	sprd_i2c_clear_irq(i2c_dev);
 
 	tmp = readl(i2c_dev->base + I2C_CTL);
-	writel(tmp | I2C_EN | I2C_INT_EN, i2c_dev->base + I2C_CTL);
+	writel(tmp | I2C_EN | I2C_INT_EN | I2C_NACK_EN | I2C_TRANS_EN, i2c_dev->base + I2C_CTL);
 }
 
 static irqreturn_t sprd_i2c_isr_thread(int irq, void *dev_id)
-- 
2.17.1
Re: [PATCH 6/8] i2c: sprd: Add additional IIC control bit configuration to adapt to the new IP version of the UNISOC platform
Posted by Chunyan Zhang 2 years, 3 months ago
On Thu, 17 Aug 2023 at 17:46, Huangzheng Lai <Huangzheng.Lai@unisoc.com> wrote:
>
> The new IIC IP version on the UNISOC platform has added I2C_NACK_EN and
> I2C_TRANS_EN control bits. To ensure that the IIC controller can initiate
> transmission smoothly, these two bits need to be configured.
>
> Signed-off-by: Huangzheng Lai <Huangzheng.Lai@unisoc.com>

I would suggest changing the subject to "i2c: sprd: Add I2C_NACK_EN
and I2C_TRANS_EN control bits".
> ---
>  drivers/i2c/busses/i2c-sprd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-sprd.c b/drivers/i2c/busses/i2c-sprd.c
> index 7314c897525d..d867389c7f17 100644
> --- a/drivers/i2c/busses/i2c-sprd.c
> +++ b/drivers/i2c/busses/i2c-sprd.c
> @@ -33,6 +33,8 @@
>  #define ADDR_RST               0x2c
>
>  /* I2C_CTL */
> +#define I2C_NACK_EN            BIT(22)
> +#define I2C_TRANS_EN           BIT(21)
>  #define STP_EN                 BIT(20)
>  #define FIFO_AF_LVL_MASK       GENMASK(19, 16)
>  #define FIFO_AF_LVL            16
> @@ -397,7 +399,7 @@ static void sprd_i2c_enable(struct sprd_i2c *i2c_dev)
>         sprd_i2c_clear_irq(i2c_dev);
>
>         tmp = readl(i2c_dev->base + I2C_CTL);
> -       writel(tmp | I2C_EN | I2C_INT_EN, i2c_dev->base + I2C_CTL);
> +       writel(tmp | I2C_EN | I2C_INT_EN | I2C_NACK_EN | I2C_TRANS_EN, i2c_dev->base + I2C_CTL);
>  }
>
>  static irqreturn_t sprd_i2c_isr_thread(int irq, void *dev_id)
> --
> 2.17.1
>