[PATCH v3 2/2] i2c: piix4: Register SPDs

Thomas Weißschuh posted 2 patches 1 year, 5 months ago
[PATCH v3 2/2] i2c: piix4: Register SPDs
Posted by Thomas Weißschuh 1 year, 5 months ago
The piix4 I2C bus can carry SPDs, register them if present.
Only look on bus 0, as this is where the SPDs seem to be located.

Only the first 8 slots are supported. If the system has more,
then these will not be visible.

The AUX bus can not be probed as on some platforms it reports all
devices present and all reads return "0".
This would allow the ee1004 to be probed incorrectly.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/i2c/busses/Kconfig     | 1 +
 drivers/i2c/busses/i2c-piix4.c | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index fe6e8a1bb607..ff66e883b348 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -195,6 +195,7 @@ config I2C_ISMT
 config I2C_PIIX4
 	tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)"
 	depends on PCI && HAS_IOPORT
+	select I2C_SMBUS
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  PIIX4 family of mainboard I2C interfaces.  Specifically, the following
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 6a0392172b2f..14752d946f58 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -29,6 +29,7 @@
 #include <linux/stddef.h>
 #include <linux/ioport.h>
 #include <linux/i2c.h>
+#include <linux/i2c-smbus.h>
 #include <linux/slab.h>
 #include <linux/dmi.h>
 #include <linux/acpi.h>
@@ -982,6 +983,9 @@ static int piix4_add_adapter(struct pci_dev *dev, unsigned short smba,
 		return retval;
 	}
 
+	if (port == 0)
+		i2c_register_spd(adap);
+
 	*padap = adap;
 	return 0;
 }

-- 
2.45.2

Re: [PATCH v3 2/2] i2c: piix4: Register SPDs
Posted by Wolfram Sang 1 year, 5 months ago
> Only the first 8 slots are supported. If the system has more,
> then these will not be visible.
> 
> The AUX bus can not be probed as on some platforms it reports all
> devices present and all reads return "0".
> This would allow the ee1004 to be probed incorrectly.

I think this information would also be helpful as a comment above the
code. But to allow this series to be applied now, I think an incremental
patch will do. With Heiner's ack, I think this can go in now.

Re: [PATCH v3 2/2] i2c: piix4: Register SPDs
Posted by Andi Shyti 1 year, 5 months ago
Hi Thomas,

On Fri, Jul 12, 2024 at 02:53:49PM GMT, Wolfram Sang wrote:
> > Only the first 8 slots are supported. If the system has more,
> > then these will not be visible.
> > 
> > The AUX bus can not be probed as on some platforms it reports all
> > devices present and all reads return "0".
> > This would allow the ee1004 to be probed incorrectly.
> 
> I think this information would also be helpful as a comment above the
> code. But to allow this series to be applied now, I think an incremental
> patch will do. With Heiner's ack, I think this can go in now.

I agree with Wolfram here. Are you up for a v4 or do you want me
to add the comment while pushing?

Andi
Re: [PATCH v3 2/2] i2c: piix4: Register SPDs
Posted by Thomas Weißschuh 1 year, 5 months ago
Hi Andi,

On 2024-07-16 19:46:43+0000, Andi Shyti wrote:
> On Fri, Jul 12, 2024 at 02:53:49PM GMT, Wolfram Sang wrote:
> > > Only the first 8 slots are supported. If the system has more,
> > > then these will not be visible.
> > > 
> > > The AUX bus can not be probed as on some platforms it reports all
> > > devices present and all reads return "0".
> > > This would allow the ee1004 to be probed incorrectly.
> > 
> > I think this information would also be helpful as a comment above the
> > code. But to allow this series to be applied now, I think an incremental
> > patch will do. With Heiner's ack, I think this can go in now.
> 
> I agree with Wolfram here. Are you up for a v4 or do you want me
> to add the comment while pushing?

I also agree. My first interpretation of that message was that I would
send the incremental patch during the 6.12 cycle.
But if it's still fine for 6.11, even better.
If you could add the comment, that would be great,
but I'm also fine with resending.


Thomas
Re: [PATCH v3 2/2] i2c: piix4: Register SPDs
Posted by Andi Shyti 1 year, 5 months ago
On Tue, Jul 16, 2024 at 07:50:04PM GMT, Thomas Weißschuh wrote:
> On 2024-07-16 19:46:43+0000, Andi Shyti wrote:
> > On Fri, Jul 12, 2024 at 02:53:49PM GMT, Wolfram Sang wrote:
> > > > Only the first 8 slots are supported. If the system has more,
> > > > then these will not be visible.
> > > > 
> > > > The AUX bus can not be probed as on some platforms it reports all
> > > > devices present and all reads return "0".
> > > > This would allow the ee1004 to be probed incorrectly.
> > > 
> > > I think this information would also be helpful as a comment above the
> > > code. But to allow this series to be applied now, I think an incremental
> > > patch will do. With Heiner's ack, I think this can go in now.
> > 
> > I agree with Wolfram here. Are you up for a v4 or do you want me
> > to add the comment while pushing?
> 
> I also agree. My first interpretation of that message was that I would
> send the incremental patch during the 6.12 cycle.
> But if it's still fine for 6.11, even better.
> If you could add the comment, that would be great,
> but I'm also fine with resending.

That's why I'm pushing... Wolfram is allowing me a pull request
part 2 and I wanted this to go in.

I will fix the comment then.

Thanks,
Andi