From: Wolfram Sang <wsa+renesas@sang-engineering.com>
To: Markus Stockhausen <markus.stockhausen@gmx.de>
Cc: andi.shyti@kernel.org, linusw@kernel.org, brgl@kernel.org,
linux-i2c@vger.kernel.org, linux-gpio@vger.kernel.org,
Sander Vanheule <sander@svanheule.net>,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: Re: [PATCH v4] i2c: i2c-gpio: Enhance driver for buses with shared SCL
Date: Sun, 12 Jul 2026 23:29:08 +0200 [thread overview]
Message-ID: <alQHJFSIBq7QZren@shikoro> (raw)
In-Reply-To: <20260709062534.2864521-1-markus.stockhausen@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 2021 bytes --]
On Thu, Jul 09, 2026 at 08:25:33AM +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 GPIOs that are used by multiple I2C buses in the dts by
> using a unique identifier for each managed SCL.
>
> - The first probing instance allocates and requests the shared SCL
> GPIO plus 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 patch was successfully tested on Linksys LGS310C that has two
> SFP slots with two GPIO based I2C buses that share a sinlge 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>
Well, what I saw looks good to me. I have to admit that I don't have the
time to dive into the corner cases of its complexity. So, I wonder if
this patch should be resend with lkml in CC, so Sashiko can have a look
at it, too? This is optional, though, if Bartosz is also happy, we can
surely try it as is.
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Oh, there is a checkpatch warning:
WARNING: please, no spaces at the start of a line
#225: FILE: drivers/i2c/busses/i2c-gpio.c:440:
+ return a->fw_node == b->fw_node && a->fw_pin == b->fw_pin && a->fw_flags == b->fw_flags;$
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-07-12 21:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 6:25 [PATCH v4] i2c: i2c-gpio: Enhance driver for buses with shared SCL Markus Stockhausen
2026-07-12 21:29 ` Wolfram Sang [this message]
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=alQHJFSIBq7QZren@shikoro \
--to=wsa+renesas@sang-engineering.com \
--cc=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=markus.stockhausen@gmx.de \
--cc=sander@svanheule.net \
/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.