[PATCH v8 1/4] i2c: tegra: Do not configure DMA if not supported

Kartik Rajput posted 4 patches 2 weeks, 1 day ago
There is a newer version of this series
[PATCH v8 1/4] i2c: tegra: Do not configure DMA if not supported
Posted by Kartik Rajput 2 weeks, 1 day ago
On Tegra264, not all I2C controllers have the necessary interface to
GPC DMA, this causes failures when function tegra_i2c_init_dma()
is called.

Ensure that "dmas" device-tree property is present before initializing
DMA in function tegra_i2c_init_dma().

Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
v2 -> v4:
	* Add debug print if DMA is not supported by the I2C controller.
v1 -> v2:
	* Update commit message to clarify that some I2C controllers may
	  not have the necessary interface to GPC DMA.
---
 drivers/i2c/busses/i2c-tegra.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index e533460bccc3..d908e5e3f0af 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -446,6 +446,11 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
 	u32 *dma_buf;
 	int err;
 
+	if (!of_property_present(i2c_dev->dev->of_node, "dmas")) {
+		dev_dbg(i2c_dev->dev, "DMA not available, falling back to PIO\n");
+		return 0;
+	}
+
 	if (IS_VI(i2c_dev))
 		return 0;
 
-- 
2.43.0
Re: [PATCH v8 1/4] i2c: tegra: Do not configure DMA if not supported
Posted by Jon Hunter 2 weeks ago
On 17/09/2025 09:56, Kartik Rajput wrote:
> On Tegra264, not all I2C controllers have the necessary interface to
> GPC DMA, this causes failures when function tegra_i2c_init_dma()
> is called.
> 
> Ensure that "dmas" device-tree property is present before initializing
> DMA in function tegra_i2c_init_dma().
> 
> Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
> ---
> v2 -> v4:
> 	* Add debug print if DMA is not supported by the I2C controller.
> v1 -> v2:
> 	* Update commit message to clarify that some I2C controllers may
> 	  not have the necessary interface to GPC DMA.
> ---
>   drivers/i2c/busses/i2c-tegra.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index e533460bccc3..d908e5e3f0af 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -446,6 +446,11 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
>   	u32 *dma_buf;
>   	int err;
>   
> +	if (!of_property_present(i2c_dev->dev->of_node, "dmas")) {
> +		dev_dbg(i2c_dev->dev, "DMA not available, falling back to PIO\n");
> +		return 0;
> +	}
> +
>   	if (IS_VI(i2c_dev))
>   		return 0;
>   

No issue with this change, but we have a few checks for DMA support in 
this function and so it would be nice to have them altogether.

Jon

-- 
nvpublic
Re: [PATCH v8 1/4] i2c: tegra: Do not configure DMA if not supported
Posted by Kartik Rajput 2 weeks ago
On 17/09/25 19:38, Jon Hunter wrote:
> 
> On 17/09/2025 09:56, Kartik Rajput wrote:
>> On Tegra264, not all I2C controllers have the necessary interface to
>> GPC DMA, this causes failures when function tegra_i2c_init_dma()
>> is called.
>>
>> Ensure that "dmas" device-tree property is present before initializing
>> DMA in function tegra_i2c_init_dma().
>>
>> Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
>> ---
>> v2 -> v4:
>>     * Add debug print if DMA is not supported by the I2C controller.
>> v1 -> v2:
>>     * Update commit message to clarify that some I2C controllers may
>>       not have the necessary interface to GPC DMA.
>> ---
>>   drivers/i2c/busses/i2c-tegra.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
>> index e533460bccc3..d908e5e3f0af 100644
>> --- a/drivers/i2c/busses/i2c-tegra.c
>> +++ b/drivers/i2c/busses/i2c-tegra.c
>> @@ -446,6 +446,11 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
>>       u32 *dma_buf;
>>       int err;
>> +    if (!of_property_present(i2c_dev->dev->of_node, "dmas")) {
>> +        dev_dbg(i2c_dev->dev, "DMA not available, falling back to PIO\n");
>> +        return 0;
>> +    }
>> +
>>       if (IS_VI(i2c_dev))
>>           return 0;
> 
> No issue with this change, but we have a few checks for DMA support in this function and so it would be nice to have them altogether.
> 
> Jon
> 

Ack.

Thanks,
Kartik