[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230902203052.ecoly4r67i5qbxu3@zenone.zhora.eu>
Date: Sat, 2 Sep 2023 22:30:52 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Huangzheng Lai <Huangzheng.Lai@...soc.com>
Cc: Orson Zhai <orsonzhai@...il.com>,
Baolin Wang <baolin.wang@...ux.alibaba.com>,
Chunyan Zhang <zhang.lyra@...il.com>,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
huangzheng lai <laihuangzheng@...il.com>,
Xiongpeng Wu <xiongpeng.wu@...soc.com>
Subject: Re: [PATCH 2/8] i2c: sprd: Add I2C driver to use 'reset framework'
function
Hi Huangzheng,
On Thu, Aug 17, 2023 at 05:45:14PM +0800, Huangzheng Lai wrote:
> This patch adds the 'reset framework' function for I2C drivers, which
> resets the I2C controller when a timeout exception occurs.
as in the earlier patch, please use the imperative form.
> Signed-off-by: Huangzheng Lai <Huangzheng.Lai@...soc.com>
[...]
> @@ -247,6 +249,7 @@ static int sprd_i2c_handle_msg(struct i2c_adapter *i2c_adap,
> {
> struct sprd_i2c *i2c_dev = i2c_adap->algo_data;
> unsigned long time_left;
> + int ret;
please move this declaration...
>
> i2c_dev->msg = msg;
> i2c_dev->buf = msg->buf;
> @@ -278,9 +281,16 @@ static int sprd_i2c_handle_msg(struct i2c_adapter *i2c_adap,
>
> time_left = wait_for_completion_timeout(&i2c_dev->complete,
> msecs_to_jiffies(I2C_XFER_TIMEOUT));
> - if (!time_left)
> + if (!time_left) {
> + dev_err(i2c_dev->dev, "transfer timeout, I2C_STATUS = 0x%x\n",
> + readl(i2c_dev->base + I2C_STATUS));
> + if (i2c_dev->rst != NULL) {
... here.
> + ret = reset_control_reset(i2c_dev->rst);
> + if (ret < 0)
> + dev_err(i2c_dev->dev, "i2c soft reset failed, ret = %d\n", ret);
dev_warn()
> + }
> return -ETIMEDOUT;
> -
> + }
> return i2c_dev->err;
> }
>
> @@ -535,6 +545,11 @@ static int sprd_i2c_probe(struct platform_device *pdev)
> return ret;
>
> platform_set_drvdata(pdev, i2c_dev);
> + i2c_dev->rst = devm_reset_control_get(i2c_dev->dev, "i2c_rst");
> + if (IS_ERR(i2c_dev->rst)) {
> + dev_err(i2c_dev->dev, "can't get i2c reset node\n");
if the i2c_rst is optional then this is not an error and it
should use dev_dbg(); right?
In that case please reword the message to "reset control not
configured".
Andi
Powered by blists - more mailing lists