Linux I2C development
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@kernel.org>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Markus Stockhausen <markus.stockhausen@gmx.de>,
	linusw@kernel.org,  brgl@kernel.org, linux-i2c@vger.kernel.org,
	linux-gpio@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Sander Vanheule <sander@svanheule.net>,
	 Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: Re: [PATCH v7 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SCL
Date: Tue, 28 Jul 2026 21:25:16 +0200	[thread overview]
Message-ID: <amkB2rm2Ochu1bxJ@zenone.zhora.eu> (raw)
In-Reply-To: <alfvXUq_lNXhKQZk@ninjato>

Hi Wolfram,

On Wed, Jul 15, 2026 at 10:36:45PM +0200, Wolfram Sang wrote:
> On Tue, Jul 14, 2026 at 06:29:15PM +0200, Markus Stockhausen wrote:
> > Some lower end hardware (especially Realtek based switches) are
> > designed with multiple I2C buses that share a single clock line.
> > E.g. the D-Link DGS-1250-28X realizes 4 I2C SFP busses with 5 GPIOs.
> > 
> > Enhance the i2c-gpio driver so it can handle such hardware designs.
> > 
> > - Detect shared SCL GPIOs that are used by multiple I2C buses in the
> >   devicetree by using a "unique identifier". This is basically the
> >   phandle and all additional cells.
> > 
> > - The first probing instance allocates and requests the shared SCL
> >   GPIO with an associated rt_mutex. Subsequent instances detect the
> >   existing entry via the identifier and increment a reference count
> >   to reuse the descriptor.
> > 
> > - All data transfers are serialized via custom lock_ops that handle
> >   both the standard adapter bus lock and the shared SCL mutex. This
> >   ensures mutual exclusion across adapters sharing the clock line.
> > 
> > - This shared SCL detection works only for dts based systems where
> >   the GPIO node has at least one cell (usually the pin). GPIOs in
> >   legacy systems without devicetree will be handled individudally
> >   as before.
> > 
> > This patch was successfully tested on Linksys LGS310C that has two
> > SFP slots with two GPIO based I2C buses that share a single SCL.
> > Test environment: OpenWrt snapshot ported to kernel 6.19.14
> > including CONFIG_GPIO_SHARED=y and CONFIG_GPIO_SHARED_PROXY=y.
> > 
> > Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
> > Tested-by: Sander Vanheule <sander@svanheule.net>
> > Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> > Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks for testing this series!

> Cool stuff! It took a bit of handling gory details, but I could not only
> check that there are no regression with non-SCL-shared busses. I could
> also try two busses with shared SCL and it worked like a charm.
> Congrats!
> 
> Andi, from my side, you can pick up these two patches. I will put them
> also in my 'for-andi' branch to increase their visibility.

are you going to send a pull request at the merge window or can I
pull it? Either way works.

Thanks,
Andi

  reply	other threads:[~2026-07-28 19:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 16:29 [PATCH v7 0/2] i2c: i2c-gpio: Enhance driver for buses with shared SCL Markus Stockhausen
2026-07-14 16:29 ` [PATCH v7 1/2] i2c: algo: bit: Allow to skip bit test Markus Stockhausen
2026-07-15 20:31   ` Wolfram Sang
2026-07-16  8:15   ` Bartosz Golaszewski
2026-07-14 16:29 ` [PATCH v7 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SCL Markus Stockhausen
2026-07-15 20:36   ` Wolfram Sang
2026-07-28 19:25     ` Andi Shyti [this message]
2026-07-28 22:04       ` Wolfram Sang
2026-07-15  6:26 ` AW: [PATCH v7 0/2] " Markus Stockhausen
2026-07-15  6:44   ` 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=amkB2rm2Ochu1bxJ@zenone.zhora.eu \
    --to=andi.shyti@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus.stockhausen@gmx.de \
    --cc=sander@svanheule.net \
    --cc=wsa+renesas@sang-engineering.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