public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jean Delvare <jdelvare@suse.com>,
	Andi Shyti <andi.shyti@kernel.org>, Peter Rosin <peda@axentia.se>,
	Wolfram Sang <wsa@kernel.org>,
	Peter Korsgaard <peter.korsgaard@barco.com>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: [PATCH v2 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments
Date: Sat, 13 Jan 2024 12:25:05 +0100	[thread overview]
Message-ID: <9d256562-3f81-4906-b514-1a90f91c46ae@gmail.com> (raw)
In-Reply-To: <9f37f64e-f5b8-4928-8716-6d2846c2688a@gmail.com>

If this is an adapter on a muxed bus segment, assume that each segment
is connected to a subset of the (> 8) overall memory slots. In this
case let's probe the maximum of 8 slots, however stop if the number
of overall populated slots is reached.

If we're not on a muxed segment and the total number of slots is > 8,
report an error, because then not all SPD eeproms can be addressed.
Presumably the bus is muxed, but the mux config is missing.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- remove now obsolete comment
---
 drivers/i2c/i2c-smbus.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 74807c6db..44331c5e2 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -309,7 +309,6 @@ EXPORT_SYMBOL_GPL(i2c_free_slave_host_notify_device);
  * Restrictions to automatic SPD instantiation:
  *  - Only works if all filled slots have the same memory type
  *  - Only works for DDR, DDR2, DDR3 and DDR4 for now
- *  - Only works on systems with 1 to 8 memory slots
  */
 #if IS_ENABLED(CONFIG_DMI)
 void i2c_register_spd(struct i2c_adapter *adap)
@@ -351,13 +350,18 @@ void i2c_register_spd(struct i2c_adapter *adap)
 	if (!dimm_count)
 		return;
 
-	dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
-		 dimm_count, slot_count);
-
-	if (slot_count > 8) {
-		dev_warn(&adap->dev,
-			 "Systems with more than 8 memory slots not supported yet, not instantiating SPD\n");
-		return;
+	/* Check whether we're a child adapter on a muxed segment */
+	if (i2c_parent_is_i2c_adapter(adap)) {
+		if (slot_count > 8)
+			slot_count = 8;
+	} else {
+		dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
+			 dimm_count, slot_count);
+		if (slot_count > 8) {
+			dev_err(&adap->dev,
+				"More than 8 memory slots on a single bus, mux config missing?\n");
+			return;
+		}
 	}
 
 	/*
-- 
2.43.0



  reply	other threads:[~2024-01-13 11:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13 11:23 [PATCH v2 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
2024-01-13 11:25 ` Heiner Kallweit [this message]
2024-01-13 11:27 ` [PATCH v2 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed " Heiner Kallweit
2024-01-13 11:28 ` [PATCH v2 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment Heiner Kallweit
2024-01-13 11:28 ` [PATCH v2 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments Heiner Kallweit
2024-01-26 21:15 ` [PATCH v2 0/4] i2c: Support i2c_register_spd() on multiplexed " Heiner Kallweit
2024-02-21 17:19 ` Wolfram Sang
2024-02-21 19:46   ` Heiner Kallweit
2024-02-22 22:05   ` Heiner Kallweit

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=9d256562-3f81-4906-b514-1a90f91c46ae@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=peter.korsgaard@barco.com \
    --cc=wsa@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