From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>,
linux-i2c@vger.kernel.org
Subject: Re: [PATCH v2] i2c: designware: add a new bit check for IC_CON control
Date: Wed, 18 Jan 2023 19:27:06 +0530 [thread overview]
Message-ID: <dbdc2d2a-8fcd-8667-3088-ca730212c162@amd.com> (raw)
In-Reply-To: <Y8a54u1ipywtTIlH@smile.fi.intel.com>
On 1/17/2023 8:38 PM, Andy Shevchenko wrote:
> On Tue, Jan 17, 2023 at 05:58:01PM +0530, Shyam Sundar S K wrote:
>> On some AMD platforms, based on the new designware datasheet,
>> BIOS sets the BIT(11) within the IC_CON register to advertise
>> the "bus clear feature capability".
>>
>> AMD/Designware datasheet says:
>>
>> Bit(11) BUS_CLEAR_FEATURE_CTRL. Read-write,Volatile. Reset: 0.
>> Description: In Master mode:
>> - 1'b1: Bus Clear Feature is enabled.
>> - 1'b0: Bus Clear Feature is Disabled.
>> In Slave mode, this register bit is not applicable.
>>
>> On AMD platform designs:
>> 1. BIOS programs the BUS_CLEAR_FEATURE_CTRL and enables the detection
>> of SCL/SDA stuck low.
>> 2. Whenever the stuck low is detected, the SMU FW shall do the bus
>> recovery procedure.
>>
>> Currently, the way in which the "master_cfg" is built in the driver, it
>> overrides the BUS_CLEAR_FEATURE_CTRL advertised by BIOS and the SMU FW
>> cannot initiate the bus recovery if the stuck low is detected.
>>
>> Hence add a check in i2c_dw_configure_master() that if the BIOS
>> advertises the bus clear feature, let driver not ignore it and
>> adapt accordingly.
>
> ...
>
>> + ic_con = ioread32(dev->base + DW_IC_CON);
>
> Any particular reason why regmap_read() can't be used?
Yes. init_regmap() happens at a later stage in dw_i2c_plat_probe() and
i2c_dw_configure() gets called first.
So dev->map will not be initialized to use regmap_read().
In order to use regmap_read() instead of ioread32() in this case, we
have to defer calling i2c_dw_configure()
Something like this.
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -311,8 +311,6 @@ static int dw_i2c_plat_probe(struct platform_device
*pdev)
if (ret)
goto exit_reset;
- i2c_dw_configure(dev);
-
/* Optional interface clock */
dev->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
if (IS_ERR(dev->pclk)) {
@@ -378,6 +376,7 @@ static int dw_i2c_plat_probe(struct platform_device
*pdev)
if (ret)
goto exit_probe;
+ i2c_dw_configure(dev);
return ret;
exit_probe:
What are your thoughts? Should I send a patch to reorder the call flow?
Thanks,
Shyam
next prev parent reply other threads:[~2023-01-18 14:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 12:28 [PATCH v2] i2c: designware: add a new bit check for IC_CON control Shyam Sundar S K
2023-01-17 15:08 ` Andy Shevchenko
2023-01-18 13:57 ` Shyam Sundar S K [this message]
2023-01-18 14:34 ` Andy Shevchenko
2023-01-19 3:44 ` Shyam Sundar S K
2023-01-20 12:35 ` Jarkko Nikula
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=dbdc2d2a-8fcd-8667-3088-ca730212c162@amd.com \
--to=shyam-sundar.s-k@amd.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox