On 22.02.2008 22:02, Marc Jones wrote:
We need to discuss v3 smbus operations. Someone has done a lot of work to make smbus_ops.c and smbus.h. The code treats smbus as a bus, like the pci bus, with a device structure and all.
This approach seems nice and maybe the right way to do it, but it is somewhat overkill. I think that the complexity is one reason why the structure is in place in v2 but never used. Instead, simpler chipset/mainboard specific functions are used. The other reason is that the smbus is accessed in ROMCC/CAR code and not in the main coreboot bus enumeration code. My observation is that the SPD is the only device on smbus used by most mainboards in coreboot.
So, what do we want to do for v3? If we go with the bus/device structure every mainboard in v2 will need to have the smbus functions ported. Also, someone will have to figure out how to describe the smbus devices in the dts and the entire thing might need to use a simpler bus/device structure. Or, we can do as was done in v2 and leave it to the chipset/mainboard code.
This is a bit more complicated than visible at first glance. We have two different smbus_read_byte() functions in v3: int smbus_read_byte(u16 device, u8 address); int smbus_read_byte(struct device *dev, u8 addr);
The confusion arises because these two clearly different functions have the same name. I'd suggest to rename the first smbus_read_byte to smbus_read_byte_early to make it clear that it does not care about the device tree. All initram stuff just uses the first function.
Regards, Carl-Daniel