[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM0PR0402MB3937905A3108833DD8F52982E8032@AM0PR0402MB3937.eurprd04.prod.outlook.com>
Date: Tue, 24 Dec 2024 02:55:18 +0000
From: Carlos Song <carlos.song@....com>
To: Andi Shyti <andi.shyti@...nel.org>
CC: "o.rempel@...gutronix.de" <o.rempel@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>, "shawnguo@...nel.org"
<shawnguo@...nel.org>, "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>, "linux-i2c@...r.kernel.org"
<linux-i2c@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Clark Wang <xiaoning.wang@....com>, Ahmad
Fatoum <a.fatoum@...gutronix.de>
Subject: Re: [PATCH v6] i2c: imx: support DMA defer probing
> -----Original Message-----
> From: Andi Shyti <andi.shyti@...nel.org>
> Sent: Tuesday, December 24, 2024 7:14 AM
> To: Carlos Song <carlos.song@....com>
> Cc: o.rempel@...gutronix.de; kernel@...gutronix.de; shawnguo@...nel.org;
> s.hauer@...gutronix.de; festevam@...il.com; linux-i2c@...r.kernel.org;
> imx@...ts.linux.dev; linux-arm-kernel@...ts.infradead.org;
> linux-kernel@...r.kernel.org; Clark Wang <xiaoning.wang@....com>; Ahmad
> Fatoum <a.fatoum@...gutronix.de>
> Subject: [EXT] Re: [PATCH v6] i2c: imx: support DMA defer probing
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
>
>
> Hi Carlos,
>
> ...
>
> > @@ -1802,6 +1803,18 @@ static int i2c_imx_probe(struct platform_device
> *pdev)
> > if (ret == -EPROBE_DEFER)
> > goto clk_notifier_unregister;
> >
> > + /* As we can always fall back to PIO, let's ignore the error setting up
> DMA. */
> > + ret = i2c_imx_dma_request(i2c_imx, phy_addr);
> > + if (ret) {
> > + if (ret == -EPROBE_DEFER)
> > + goto clk_notifier_unregister;
> > + else if (ret == -ENODEV)
> > + dev_dbg(&pdev->dev, "Only use PIO mode\n");
> > + else
> > + dev_err(&pdev->dev, "Failed to setup DMA (%pe),
> only use PIO mode\n",
> > + ERR_PTR(ret));
>
> My question here is not just about the use of dev_err vs dev_err_probe, but why
> don't we exit the probe if we get an error.
>
> We should use PIO only in case of ENODEV, in all the other cases I think we
> should just leave. E.g. why don't we exit if we meet ret == -ENOMEM?
Hi, Andi
Thank you! From my point, I2C is critical bus so it should be available as much as possible.
-ENOMEM or other unknown errors all are from i2c_imx_dma_request(). So error happened in enable DMA mode process.
As I comment at previous mail[1]:
DMA mode should be optional for i2c-imx[2], i2c-imx can accept DMA mode not enabled.
Even though DMA mode can not be enabled by some known/unknown issue, I2C still can work in PIO mode in all time for all cases.
As a result, don't exit the I2C probe and only print error to show i2c DMA error.
This patch just is used to make i2c-imx can support defer probe to use DMA resources as much as possible.
If meet a DMA error then exit i2c probe, which means binding I2C to DMA, this is not what we expect. Once the DMA encounters a problem,
the entire I2C bus and peripherals will not be able to start, this is not a small damage, so we use current logic.
[1]: https://lore.kernel.org/imx/AM0PR0402MB39374E34FD6133B5E3D414D7E82F2@AM0PR0402MB3937.eurprd04.prod.outlook.com/
[2]:
commit ce1a78840ff7ab846065d5b65eaac959bafe1949
Author: Yao Yuan <yao.yuan@...escale.com>
Date: Tue Nov 18 18:31:06 2014 +0800
i2c: imx: add DMA support for freescale i2c driver
Add dma support for i2c. This function depend on DMA driver.
You can turn on it by write both the dmas and dma-name properties in dts node.
DMA is optional, even DMA request unsuccessfully, i2c can also work well.
Signed-off-by: Yuan Yao <yao.yuan@...escale.com>
Signed-off-by: Wolfram Sang <wsa@...-dreams.de>
Carlos
>
> Andi
Powered by blists - more mailing lists