All of lore.kernel.org
 help / color / mirror / Atom feed
From: Parker Newman <pnewman@connecttech.com>
To: Dmitry Osipenko <digetx@gmail.com>, Andi Shyti <andi.shyti@kernel.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i2c: tegra: Fix i2c-tegra DMA config option processing
Date: Mon, 14 Aug 2023 15:54:56 +0000	[thread overview]
Message-ID: <2702e51d-1e7e-a71b-f07b-ab224b9eff31@connecttech.com> (raw)
In-Reply-To: <5594f66d-1aec-ee2f-d3d1-1185ca9cb06f@gmail.com>

On 2023-08-14 11:25, Dmitry Osipenko wrote:
> 05.08.2023 00:49, Andi Shyti пишет:
>> Hi Laxman and/or Dmitry,
>>
>> On Thu, Aug 03, 2023 at 05:10:02PM +0000, Parker Newman wrote:
>>>
>>> This patch fixes the Tegra DMA config option processing in the
>>> i2c-tegra driver.
>>>
>>> Tegra processors prior to Tegra186 used APB DMA for I2C requiring
>>> CONFIG_TEGRA20_APB_DMA=y while Tegra186 and later use GPC DMA requiring
>>> CONFIG_TEGRA186_GPC_DMA=y.
>>>
>>> The check for if the processor uses APB DMA is inverted and so the wrong
>>> DMA config options are checked.
>>>
>>> This means if CONFIG_TEGRA20_APB_DMA=y but CONFIG_TEGRA186_GPC_DMA=n
>>> with a Tegra186 or later processor the driver will incorrectly think DMA is
>>> enabled and attempt to request DMA channels that will never be availible,
>>> leaving the driver in a perpetual EPROBE_DEFER state.
>>>
>>> Signed-off-by: Parker Newman <pnewman@connecttech.com>
>>> ---
>>>  drivers/i2c/busses/i2c-tegra.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
>>> index bcbbf23aa530..dc6ed3a8d69e 100644
>>> --- a/drivers/i2c/busses/i2c-tegra.c
>>> +++ b/drivers/i2c/busses/i2c-tegra.c
>>> @@ -442,7 +442,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
>>>     if (IS_VI(i2c_dev))
>>>         return 0;
>>>
>>> -   if (!i2c_dev->hw->has_apb_dma) {
>>> +   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;
>>
>> Can I have your opinion here, please?
> 
> The patch looks good, thanks Parker for fixing it. I'll be able to test
> it only sometime later and let you all know if there will be any
> problem. Previously I haven't noticed any Tegra I2C regressions, maybe
> we should change that dev_dbg to dev_warn.
> 

Hi Dmitry,

You will not notice any issues if both options are set (or not set) as it 
will fall through and configure the DMA or skip DMA setup as expected. 

I only noticed the issue after I enabled CONFIG_TEGRA20_APB_DMA which is a 
KConfig requirement for the Tegra HS-UART driver and my I2C stopped working. 

Which now as I write this I realize is possibly another "bug"... As far as I know
the HS UARTs also use GPC DMA on T186 or later? I would need to look into that.

I don't think the print needs to be a warning, not having DMA enabled
is a valid option, it just needed the correct CONFIG options to be checked for 
the DMA type (APB versus GPC).

-Parker

  reply	other threads:[~2023-08-14 15:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 17:10 [PATCH] i2c: tegra: Fix i2c-tegra DMA config option processing Parker Newman
2023-08-04 21:49 ` Andi Shyti
2023-08-14 15:25   ` Dmitry Osipenko
2023-08-14 15:54     ` Parker Newman [this message]
2023-08-04 21:56 ` Andi Shyti
2023-08-06 14:21   ` Akhil R
2023-08-08 12:42     ` Parker Newman
2023-08-08 13:23       ` Andi Shyti
2023-08-14 13:37     ` Wolfram Sang
2023-08-14 14:26       ` Akhil R
2023-08-08 14:05 ` Andi Shyti
2023-08-14 13:38 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2702e51d-1e7e-a71b-f07b-ab224b9eff31@connecttech.com \
    --to=pnewman@connecttech.com \
    --cc=andi.shyti@kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.