Author: hailfinger Date: 2008-08-28 00:58:04 +0200 (Thu, 28 Aug 2008) New Revision: 830
Modified: coreboot-v3/mainboard/adl/msm800sev/initram.c coreboot-v3/mainboard/amd/db800/initram.c coreboot-v3/mainboard/amd/norwich/initram.c coreboot-v3/southbridge/amd/cs5536/smbus_initram.c Log: Every GeodeLX target already has spd_read_byte in mainboard/$VENDOR/$BOARD/initram.c. It's pointless to have it in the southbridge code as well. Kill it in the southbridge code and use mainboard code only.
Thanks to Segher for rediscovering this bug.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net Acked-by: Ronald G. Minnich rminnich@gmail.com
Modified: coreboot-v3/mainboard/adl/msm800sev/initram.c =================================================================== --- coreboot-v3/mainboard/adl/msm800sev/initram.c 2008-08-27 22:45:18 UTC (rev 829) +++ coreboot-v3/mainboard/adl/msm800sev/initram.c 2008-08-27 22:58:04 UTC (rev 830) @@ -34,6 +34,8 @@ #include <southbridge/amd/cs5536/cs5536.h> #include <northbridge/amd/geodelx/raminit.h>
+extern int smbus_read_byte(u16 device, u8 address); + #define MANUALCONF 0 /* Do automatic strapped PLL config. */
#define PLLMSRHI 0x00001490 /* Manual settings for the PLL */ @@ -42,6 +44,31 @@ #define DIMM0 ((u8) 0xA0) #define DIMM1 ((u8) 0xA2)
+/** + * Read a byte from the SPD. + * + * For this board, that is really just saying 'read a byte from SMBus'. + * So we use smbus_read_byte(). Nota Bene: leave this here as a function + * rather than a #define in an obscure location. This function is called + * only a few dozen times, and it's not performance critical. + * + * @param device The device. + * @param address The address. + * @return The data from the SMBus packet area or an error of 0xff (i.e. -1). + */ +u8 spd_read_byte(u16 device, u8 address) +{ + u8 spdbyte; + + printk(BIOS_DEBUG, "spd_read_byte dev %04x\n", device); + + spdbyte = smbus_read_byte(device, address); + + printk(BIOS_DEBUG, " addr %02x returns %02x\n", address, spdbyte); + + return spdbyte; +} + int main(void) { void done_cache_as_ram_main(void);
Modified: coreboot-v3/mainboard/amd/db800/initram.c =================================================================== --- coreboot-v3/mainboard/amd/db800/initram.c 2008-08-27 22:45:18 UTC (rev 829) +++ coreboot-v3/mainboard/amd/db800/initram.c 2008-08-27 22:58:04 UTC (rev 830) @@ -42,6 +42,18 @@ #define DIMM0 ((u8) 0xA0) #define DIMM1 ((u8) 0xA2)
+/** + * Read a byte from the SPD. + * + * For this board, that is really just saying 'read a byte from SMBus'. + * So we use smbus_read_byte(). Nota Bene: leave this here as a function + * rather than a #define in an obscure location. This function is called + * only a few dozen times, and it's not performance critical. + * + * @param device The device. + * @param address The address. + * @return The data from the SMBus packet area or an error of 0xff (i.e. -1). + */ u8 spd_read_byte(u16 device, u8 address) { u8 spdbyte;
Modified: coreboot-v3/mainboard/amd/norwich/initram.c =================================================================== --- coreboot-v3/mainboard/amd/norwich/initram.c 2008-08-27 22:45:18 UTC (rev 829) +++ coreboot-v3/mainboard/amd/norwich/initram.c 2008-08-27 22:58:04 UTC (rev 830) @@ -42,6 +42,18 @@ #define DIMM0 ((u8) 0xA0) #define DIMM1 ((u8) 0xA2)
+/** + * Read a byte from the SPD. + * + * For this board, that is really just saying 'read a byte from SMBus'. + * So we use smbus_read_byte(). Nota Bene: leave this here as a function + * rather than a #define in an obscure location. This function is called + * only a few dozen times, and it's not performance critical. + * + * @param device The device. + * @param address The address. + * @return The data from the SMBus packet area or an error of 0xff (i.e. -1). + */ u8 spd_read_byte(u16 device, u8 address) { u8 spdbyte;
Modified: coreboot-v3/southbridge/amd/cs5536/smbus_initram.c =================================================================== --- coreboot-v3/southbridge/amd/cs5536/smbus_initram.c 2008-08-27 22:45:18 UTC (rev 829) +++ coreboot-v3/southbridge/amd/cs5536/smbus_initram.c 2008-08-27 22:58:04 UTC (rev 830) @@ -330,20 +330,3 @@
return do_smbus_read_byte(SMBUS_IO_BASE, device, address); } - -/** - * Read a byte from the SPD. - * - * For this chip, that is really just saying 'read a byte from SMBus'. - * So we use smbus_read_byte(). Nota Bene: leave this here as a function - * rather than a #define in an obscure location. This function is called - * only a few dozen times, and it's not performance critical. - * - * @param device The device. - * @param address The address. - * @return The data from the SMBus packet area or an error of 0xff (i.e. -1). - */ -u8 spd_read_byte(u16 device, u8 address) -{ - return smbus_read_byte(device, address); -}