Call i2c_register_spd() per adapter, like i801 and piix4, instead of
telling the user to echo into new_device. The helper counts populated
slots from DMI and probes upwards from 0x50 via i2c_new_scanned_device(),
so it claims no address that does not answer; each channel carries half
the DIMMs and the scan is per adapter, so each finds its own. Verified:
four clients on load, two per channel, none on the empty slots, and
decode-dimms works with no manual step.
This needed Receive Byte to be worth doing — without I2C_FUNC_SMBUS_BYTE
ee1004 would not have bound to what was instantiated.
The write_disable variant is deliberate. This part is DDR4 only, where
the two are equivalent (the split gates spd5118 on DDR5), and of two
equivalent calls the one that does not read as "this driver enables SPD
writes" is the better name to leave in a driver whose bus is the memory
bus. In-tree convention is write_enable; the cover letter offers to
switch.
Kconfig gains select I2C_SMBUS.
Out-of-tree, compat.h maps the call onto the older unsplit
i2c_register_spd() where that is what the target kernel has. It is force
included from the Makefile so i2c-imc-skylake.c stays byte-identical to
the submitted file, and the Makefile detects the API by grepping the
target kernel's header rather than testing a version number, which keeps
it correct on backported trees. Builds clean against both 6.8 and 7.0
headers; DKMS 1.0.2 installs on all four kernels here.
test-smoke.sh needed two fixes to keep testing what it claims:
- A bound driver owns its address, so the raw transaction checks lost
the SPDs the moment the driver started instantiating them. The script
now unbinds ee1004 for the duration rather than deleting the clients:
sysfs delete_device only removes clients that new_device created,
and unbinding is sufficient because i2c-dev refuses an address only
while a driver is bound (i2cdev_check: `return dev->driver ? -EBUSY
: 0`). Rebound from an EXIT trap.
- Those checks were guarded on an SPD address having been found, and
when the lookup failed they vanished from the run silently: the suite
reported "12 passed, 0 failed" while seven checks had not executed.
Skipped checks are now counted and printed, which is how the above
was noticed at all.
Smoke suite: 20 passed, 0 failed, 0 skipped. checkpatch --strict 0/0/0,
in-tree W=1 and Sparse clean.
37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/*
|
|
* Out-of-tree build shim. NOT part of the upstream submission: the Makefile
|
|
* force includes it, i2c-imc-skylake.c never does, so the driver source stays
|
|
* free of build conditionals.
|
|
*
|
|
* i2c_register_spd() was split into i2c_register_spd_write_disable() and
|
|
* i2c_register_spd_write_enable() when DDR5 arrived and the caller had to say
|
|
* whether spd5118 should be instantiated at all. The driver targets current
|
|
* mainline and calls the split form; where only the old single function
|
|
* exists it has exactly the semantics this driver wants, since the split is
|
|
* about DDR5 and this part is DDR4 only.
|
|
*
|
|
* HAVE_I2C_REGISTER_SPD_SPLIT comes from the Makefile, which greps the target
|
|
* kernel's header for the symbol. Detecting the API beats guessing the version
|
|
* it appeared in, and it stays right on backported and vendor trees.
|
|
*/
|
|
|
|
#ifndef I2C_IMC_SKYLAKE_COMPAT_H
|
|
#define I2C_IMC_SKYLAKE_COMPAT_H
|
|
|
|
#include <linux/i2c-smbus.h>
|
|
|
|
#ifndef HAVE_I2C_REGISTER_SPD_SPLIT
|
|
static inline void i2c_register_spd_write_disable(struct i2c_adapter *adap)
|
|
{
|
|
i2c_register_spd(adap);
|
|
}
|
|
|
|
static inline void i2c_register_spd_write_enable(struct i2c_adapter *adap)
|
|
{
|
|
i2c_register_spd(adap);
|
|
}
|
|
#endif
|
|
|
|
#endif /* I2C_IMC_SKYLAKE_COMPAT_H */
|