[coreboot] patch: remove static variable from cs5536 smbus function

ron minnich rminnich at gmail.com
Mon Sep 15 20:39:50 CEST 2008

in the cs5536 we have this:
 int smbus_read_byte(u16 device, u8 address)
	static int first_time = 1;

	if (first_time) {
		first_time = 0;

 	return do_smbus_read_byte(SMBUS_IO_BASE, device, address);

This construct is problematic due to the use of the static; it will
not work in CAR mode. It is only an accident that it ever worked at

This fix proposes the following:
1. mainboard/*/*/initram.c has to provide an spd_init function just as
each mainboard provides an spd_read_byte function now.
2. this function is called from sdram_set_spd_registers before any spd
functions are used.

It does require that we add an spd_init function to mainboards. This
addition is very useful, in fact, as many mainboards have I2C hardware
that is special and unique to that board that has to be set up (think:
I2C mux).

I realize it is a bit more inconvenient to require adding this
function but I think it is worth it.

Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>

test to build only on dbe62. Testing on real hardware later today.
Comments welcome.


More information about the coreboot mailing list