2021-02-05 08:57:24

by Alain Volmat

[permalink] [raw]
Subject: [PATCH 5/5] i2c: stm32f7: indicate the address being accessed on errors

To help debugging issues, add the address of the slave being
accessed when getting an error.

Signed-off-by: Alain Volmat <[email protected]>
---
drivers/i2c/busses/i2c-stm32f7.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index f77cd6512a86..ef642fe1eb2c 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1602,7 +1602,8 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)

/* Bus error */
if (status & STM32F7_I2C_ISR_BERR) {
- dev_err(dev, "<%s>: Bus error\n", __func__);
+ dev_err(dev, "<%s>: Bus error accessing addr 0x%x\n",
+ __func__, f7_msg->addr);
writel_relaxed(STM32F7_I2C_ICR_BERRCF, base + STM32F7_I2C_ICR);
stm32f7_i2c_release_bus(&i2c_dev->adap);
f7_msg->result = -EIO;
@@ -1610,13 +1611,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)

/* Arbitration loss */
if (status & STM32F7_I2C_ISR_ARLO) {
- dev_dbg(dev, "<%s>: Arbitration loss\n", __func__);
+ dev_dbg(dev, "<%s>: Arbitration loss accessing addr 0x%x\n",
+ __func__, f7_msg->addr);
writel_relaxed(STM32F7_I2C_ICR_ARLOCF, base + STM32F7_I2C_ICR);
f7_msg->result = -EAGAIN;
}

if (status & STM32F7_I2C_ISR_PECERR) {
- dev_err(dev, "<%s>: PEC error in reception\n", __func__);
+ dev_err(dev, "<%s>: PEC error in reception accessing addr 0x%x\n",
+ __func__, f7_msg->addr);
writel_relaxed(STM32F7_I2C_ICR_PECCF, base + STM32F7_I2C_ICR);
f7_msg->result = -EINVAL;
}
--
2.17.1


2021-02-05 23:38:38

by Pierre Yves MORDRET

[permalink] [raw]
Subject: Re: [PATCH 5/5] i2c: stm32f7: indicate the address being accessed on errors

Hello all

Looks good to me

Signed-off-by: Pierre-Yves MORDRET <[email protected]>

Regards

On 2/5/21 9:51 AM, Alain Volmat wrote:
> To help debugging issues, add the address of the slave being
> accessed when getting an error.
>
> Signed-off-by: Alain Volmat <[email protected]>
> ---
> drivers/i2c/busses/i2c-stm32f7.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
> index f77cd6512a86..ef642fe1eb2c 100644
> --- a/drivers/i2c/busses/i2c-stm32f7.c
> +++ b/drivers/i2c/busses/i2c-stm32f7.c
> @@ -1602,7 +1602,8 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)
>
> /* Bus error */
> if (status & STM32F7_I2C_ISR_BERR) {
> - dev_err(dev, "<%s>: Bus error\n", __func__);
> + dev_err(dev, "<%s>: Bus error accessing addr 0x%x\n",
> + __func__, f7_msg->addr);
> writel_relaxed(STM32F7_I2C_ICR_BERRCF, base + STM32F7_I2C_ICR);
> stm32f7_i2c_release_bus(&i2c_dev->adap);
> f7_msg->result = -EIO;
> @@ -1610,13 +1611,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)
>
> /* Arbitration loss */
> if (status & STM32F7_I2C_ISR_ARLO) {
> - dev_dbg(dev, "<%s>: Arbitration loss\n", __func__);
> + dev_dbg(dev, "<%s>: Arbitration loss accessing addr 0x%x\n",
> + __func__, f7_msg->addr);
> writel_relaxed(STM32F7_I2C_ICR_ARLOCF, base + STM32F7_I2C_ICR);
> f7_msg->result = -EAGAIN;
> }
>
> if (status & STM32F7_I2C_ISR_PECERR) {
> - dev_err(dev, "<%s>: PEC error in reception\n", __func__);
> + dev_err(dev, "<%s>: PEC error in reception accessing addr 0x%x\n",
> + __func__, f7_msg->addr);
> writel_relaxed(STM32F7_I2C_ICR_PECCF, base + STM32F7_I2C_ICR);
> f7_msg->result = -EINVAL;
> }
>

--
--
~ Py MORDRET
--

2021-03-18 11:00:08

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH 5/5] i2c: stm32f7: indicate the address being accessed on errors

On Fri, Feb 05, 2021 at 09:51:44AM +0100, Alain Volmat wrote:
> To help debugging issues, add the address of the slave being
> accessed when getting an error.
>
> Signed-off-by: Alain Volmat <[email protected]>

Applied to for-next, thanks!


Attachments:
(No filename) (258.00 B)
signature.asc (849.00 B)
Download all attachments