From: Aniket Limaye <a-limaye@ti.com>
To: Mark Brown <broonie@kernel.org>
Cc: Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
<linux-i2c@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<lianfeng.ouyang@starfivetech.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH v4 2/2] i2c: Add Synopsys Advanced I2C (DWC_i2c) driver
Date: Sat, 31 Oct 2026 15:58:27 +0530 [thread overview]
Message-ID: <03bf8f02-3270-4f5f-9737-b2fc327c454a@ti.com> (raw)
In-Reply-To: <8e393ecc-9955-4686-8689-5c8e4a105a28@sirena.org.uk>
On 27/10/26 22:02, Mark Brown wrote:
> On Tue, Oct 27, 2026 at 05:00:36PM +0530, Aniket Limaye wrote:
>> Add a new platform driver for the Synopsys Advanced I2C (DWC_i2c),
>> controller mode only.
>
>> The register offsets are defined with respect to header registers for
>> each block. These header registers are discovered at runtime by walking
>> the block header chain.
>
> This mostly makes sense to me, I've not tested yet and will dig in a bit
> more as part of that but a few minor comments below - I'll let you know
> how my testing goes hopefully later this week.
>
Sure, let me know how your testing goes.
>> +config I2C_DWC_ADV
>> + tristate "Synopsys Advanced I2C (DWC_i2c) driver"
>> + depends on ARCH_K3 || COMPILE_TEST
>> + help
>
> The dependency is there due to the whole sadness with being unable to
> discover the FIFO depths so not having a fallback, but as soon as we add
> ACPI bindings we'll have to either drop it or broaden it to be on
> CONFIG_ACPI which gets so broad as to be meaningless. There's a
> reasonable chance the dependency list will end up unwieldy for the DT
> platforms too.
>
> Since I believe we're always working with configurable trigger levels
> for the FIFOs I think it might be better to have a fallback compatible
> that uses the IP minimum of two entries in each of the FIFOs, that ought
> to work even if the FIFOs are in reality bigger. Performance would
> suffer but slow and functional beats not working at all.
>
> It's really unfortunate that we can't enumerate this from the IP
> directly.
>
Well, I was going off of direction from v1 [0], where feedback was to
avoid generic compatible.
Although I do understand that the feedback then was for when I was
adding support in existing driver, so may not apply directly when adding
a separate new driver, where having one fallback may make sense?
I personally would rather we keep it simple and not add a fallback,
which may not really get used since one would want an IP specific fifo
depth configured in the driver, but willing to add one if that's the norm.
In case we do want a fallback, shall I add a fallback of fifo depths=2
for both rx/tx? That's what the IP doc seems to say as a minimum for
their respective configuration parameters.
[0]:
https://lore.kernel.org/all/20260921141031.GX106095@black.igk.intel.com/
>> +static void dwc_adv_i2c_read(struct dwc_adv_i2c_dev *dev)
>> +{
>
>> + if (msgs[dev->msg_read_idx].flags & I2C_M_RECV_LEN) {
>> + /*
>> + * STOP is only set after receiving the block
>> + * data response length. When that length is
>> + * invalid, read one more byte with STOP set to
>> + * complete the transaction.
>> + */
>> + if (!data || data > I2C_SMBUS_BLOCK_MAX)
>> + data = 1;
>> +
>> + len = dwc_adv_i2c_recv_len(dev, data);
>> + }
>
> It feels off to silently fix up an invalid length, but possibly that's
> the most sensible thing - I didn't cross check what's idiomatic for I2C
> in general.
>
Yeah, will return with -EPROTO in next version
>> +static irqreturn_t dwc_adv_i2c_handle_irq(struct dwc_adv_i2c_dev *dev)
>> +{
>> + u32 enabled, stat;
>> +
>> + enabled = dwc_adv_reg_read(dev, dev->regs.enable);
>> + stat = dwc_adv_reg_read(dev, dev->regs.raw_intr_stat);
>> +
>> + if (!enabled || !(stat & ~DWC_ADV_I2C_INTR_ACTIVITY))
>> + return IRQ_NONE;
>
> Should we check for enabled before we read the status register
> (microoptimisation is fun!)?
Will take care of in next version
Thanks for the review!
Aniket
next prev parent reply other threads:[~2026-10-31 10:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 11:30 [PATCH v4 0/2] i2c: Add Synopsys Advanced I2C (DWC_i2c) support for TI TDA54 Aniket Limaye
2026-10-27 11:30 ` [PATCH v4 1/2] dt-bindings: i2c: Add Synopsys DWC_i2c controller Aniket Limaye
2026-10-27 18:36 ` Krzysztof Kozlowski
2026-10-31 9:55 ` Aniket Limaye
2026-10-27 11:30 ` [PATCH v4 2/2] i2c: Add Synopsys Advanced I2C (DWC_i2c) driver Aniket Limaye
2026-10-27 16:32 ` Mark Brown
2026-10-31 10:28 ` Aniket Limaye [this message]
2026-10-28 7:14 ` Uwe Kleine-König
2026-10-31 9:54 ` Aniket Limaye
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=03bf8f02-3270-4f5f-9737-b2fc327c454a@ti.com \
--to=a-limaye@ti.com \
--cc=andi.shyti@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lianfeng.ouyang@starfivetech.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®