2021-01-11 14:31:36

by Mikko Perttunen

[permalink] [raw]
Subject: [PATCH] i2c: tegra-bpmp: ignore DMA safe buffer flag

From: Muhammed Fazal <[email protected]>

Ignore I2C_M_DMA_SAFE flag as it does not make a difference
for bpmp-i2c, but causes -EINVAL to be returned for valid
transactions.

Signed-off-by: Muhammed Fazal <[email protected]>
Cc: [email protected] # v4.19+
Signed-off-by: Mikko Perttunen <[email protected]>
---
This fixes failures seen with PMIC probing tools on
Tegra186+ boards.

drivers/i2c/busses/i2c-tegra-bpmp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c
index ec7a7e917edd..998d4b21fb59 100644
--- a/drivers/i2c/busses/i2c-tegra-bpmp.c
+++ b/drivers/i2c/busses/i2c-tegra-bpmp.c
@@ -80,6 +80,9 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
flags &= ~I2C_M_RECV_LEN;
}

+ if (flags & I2C_M_DMA_SAFE)
+ flags &= ~I2C_M_DMA_SAFE;
+
return (flags != 0) ? -EINVAL : 0;
}

--
2.30.0


2021-01-11 15:07:13

by Ben Dooks

[permalink] [raw]
Subject: Re: [PATCH] i2c: tegra-bpmp: ignore DMA safe buffer flag

On 11/01/2021 14:27, Mikko Perttunen wrote:
> From: Muhammed Fazal <[email protected]>
>
> Ignore I2C_M_DMA_SAFE flag as it does not make a difference
> for bpmp-i2c, but causes -EINVAL to be returned for valid
> transactions.
>
> Signed-off-by: Muhammed Fazal <[email protected]>
> Cc: [email protected] # v4.19+
> Signed-off-by: Mikko Perttunen <[email protected]>
> ---
> This fixes failures seen with PMIC probing tools on
> Tegra186+ boards.
>
> drivers/i2c/busses/i2c-tegra-bpmp.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c b/drivers/i2c/busses/i2c-tegra-bpmp.c
> index ec7a7e917edd..998d4b21fb59 100644
> --- a/drivers/i2c/busses/i2c-tegra-bpmp.c
> +++ b/drivers/i2c/busses/i2c-tegra-bpmp.c
> @@ -80,6 +80,9 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
> flags &= ~I2C_M_RECV_LEN;
> }
>
> + if (flags & I2C_M_DMA_SAFE)
> + flags &= ~I2C_M_DMA_SAFE;
> +

Just a comment, you can do without the test here.
Just doing this would have been fine:

flags &= ~I2C_M_DMA_SAFE;



--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

2021-01-12 08:32:30

by Mikko Perttunen

[permalink] [raw]
Subject: Re: [PATCH] i2c: tegra-bpmp: ignore DMA safe buffer flag

On 1/11/21 5:04 PM, Ben Dooks wrote:
> On 11/01/2021 14:27, Mikko Perttunen wrote:
>> From: Muhammed Fazal <[email protected]>
>>
>> Ignore I2C_M_DMA_SAFE flag as it does not make a difference
>> for bpmp-i2c, but causes -EINVAL to be returned for valid
>> transactions.
>>
>> Signed-off-by: Muhammed Fazal <[email protected]>
>> Cc: [email protected] # v4.19+
>> Signed-off-by: Mikko Perttunen <[email protected]>
>> ---
>> This fixes failures seen with PMIC probing tools on
>> Tegra186+ boards.
>>
>>   drivers/i2c/busses/i2c-tegra-bpmp.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-tegra-bpmp.c
>> b/drivers/i2c/busses/i2c-tegra-bpmp.c
>> index ec7a7e917edd..998d4b21fb59 100644
>> --- a/drivers/i2c/busses/i2c-tegra-bpmp.c
>> +++ b/drivers/i2c/busses/i2c-tegra-bpmp.c
>> @@ -80,6 +80,9 @@ static int tegra_bpmp_xlate_flags(u16 flags, u16 *out)
>>           flags &= ~I2C_M_RECV_LEN;
>>       }
>> +    if (flags & I2C_M_DMA_SAFE)
>> +        flags &= ~I2C_M_DMA_SAFE;
>> +
>
> Just a comment, you can do without the test here.
> Just doing this would have been fine:
>
>     flags &= ~I2C_M_DMA_SAFE;
>
>
>

Yep, I'll send a v2.

thanks,
Mikko