diff mbox series

[5/5] i2c: tegra: Do not configure DMA if not supported

Message ID 20250108110620.86900-6-kkartik@nvidia.com
State Superseded
Headers show
Series Add I2C support for Tegra264 | expand

Commit Message

Kartik Rajput Jan. 8, 2025, 11:06 a.m. UTC
On Tegra264, not all I2C controllers support 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>
---
 drivers/i2c/busses/i2c-tegra.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kartik Rajput Jan. 15, 2025, 11:42 a.m. UTC | #1
On Thu, 2025-01-09 at 11:33 +0100, Thierry Reding wrote:
> On Wed, Jan 08, 2025 at 04:36:20PM +0530, Kartik Rajput wrote:
> > On Tegra264, not all I2C controllers support DMA, this causes
> > failures
> > when function tegra_i2c_init_dma() is called.
> 
> What exactly does it mean when you say "not all I2C controllers
> support
> DMA"? Do they not have the necessary interface to the GPC DMA or are
> there not sufficient DMA channels to support all I2C controllers?
> 
> Thierry

They do not have the neccessary interface to the GPC DMA.
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index a5974af5b1af..9957802fa4ed 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -546,6 +546,9 @@  static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
 	if (IS_VI(i2c_dev))
 		return 0;
 
+	if (!device_property_present(i2c_dev->dev, "dmas"))
+		return 0;
+
 	if (i2c_dev->hw->has_apb_dma) {
 		if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) {
 			dev_dbg(i2c_dev->dev, "APB DMA support not enabled\n");