diff mbox series

[v2,1/3] i2c: tegra: Add GPCDMA support

Message ID 20220906144716.16274-2-akhilrajeev@nvidia.com
State Accepted
Commit 48cb6356fae1259fee41b2fb441f669ee330b7c4
Headers show
Series Add GPCDMA support to Tegra I2C | expand

Commit Message

Akhil R Sept. 6, 2022, 2:47 p.m. UTC
Enable support for GPCDMA, which is used in I2C controllers
in Tegra 186 and above. The chips before that used APB DMA.
This change works under the presumption that all chips apart from
those supporting APB DMA is using GPCDMA.

Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
 drivers/i2c/busses/i2c-tegra.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Dmitry Osipenko Sept. 10, 2022, 9:03 a.m. UTC | #1
06.09.2022 17:47, Akhil R пишет:
> Enable support for GPCDMA, which is used in I2C controllers
> in Tegra 186 and above. The chips before that used APB DMA.
> This change works under the presumption that all chips apart from
> those supporting APB DMA is using GPCDMA.
> 
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 031c78ac42e6..954022c04cc4 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -443,11 +443,16 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
>  	u32 *dma_buf;
>  	int err;
>  
> -	if (!i2c_dev->hw->has_apb_dma || i2c_dev->is_vi)
> +	if (i2c_dev->is_vi)
>  		return 0;
>  
> -	if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) {
> -		dev_dbg(i2c_dev->dev, "DMA support not enabled\n");
> +	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");
> +			return 0;
> +		}
> +	} else if (!IS_ENABLED(CONFIG_TEGRA186_GPC_DMA)) {
> +		dev_dbg(i2c_dev->dev, "GPC DMA support not enabled\n");
>  		return 0;
>  	}
>  

To me the symmetrical if-else will look a bit better, but that's a too
minor nit.

if () {
	if ()
} else {
	if ()
}

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Wolfram Sang Sept. 16, 2022, 7:47 p.m. UTC | #2
On Tue, Sep 06, 2022 at 08:17:14PM +0530, Akhil R wrote:
> Enable support for GPCDMA, which is used in I2C controllers
> in Tegra 186 and above. The chips before that used APB DMA.
> This change works under the presumption that all chips apart from
> those supporting APB DMA is using GPCDMA.
> 
> Signed-off-by: Akhil R <akhilrajeev@nvidia.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 031c78ac42e6..954022c04cc4 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -443,11 +443,16 @@  static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
 	u32 *dma_buf;
 	int err;
 
-	if (!i2c_dev->hw->has_apb_dma || i2c_dev->is_vi)
+	if (i2c_dev->is_vi)
 		return 0;
 
-	if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) {
-		dev_dbg(i2c_dev->dev, "DMA support not enabled\n");
+	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");
+			return 0;
+		}
+	} else if (!IS_ENABLED(CONFIG_TEGRA186_GPC_DMA)) {
+		dev_dbg(i2c_dev->dev, "GPC DMA support not enabled\n");
 		return 0;
 	}