From 27b2fb4f07bf1c76c6576e8119ff44bdd30d3e7c Mon Sep 17 00:00:00 2001 From: Carl-Daniel Hailfinger Date: Wed, 27 Aug 2008 22:58:04 +0000 Subject: [PATCH] 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 Acked-by: Ronald G. Minnich git-svn-id: svn://coreboot.org/repository/coreboot-v3@830 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- mainboard/adl/msm800sev/initram.c | 27 ++++++++++++++++++++++++++ mainboard/amd/db800/initram.c | 12 ++++++++++++ mainboard/amd/norwich/initram.c | 12 ++++++++++++ southbridge/amd/cs5536/smbus_initram.c | 17 ---------------- 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/mainboard/adl/msm800sev/initram.c b/mainboard/adl/msm800sev/initram.c index 024b5afb59..a7f14253bc 100644 --- a/mainboard/adl/msm800sev/initram.c +++ b/mainboard/adl/msm800sev/initram.c @@ -34,6 +34,8 @@ #include #include +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); diff --git a/mainboard/amd/db800/initram.c b/mainboard/amd/db800/initram.c index a31fac4ff6..34f3308f18 100644 --- a/mainboard/amd/db800/initram.c +++ b/mainboard/amd/db800/initram.c @@ -42,6 +42,18 @@ extern int smbus_read_byte(u16 device, u8 address); #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; diff --git a/mainboard/amd/norwich/initram.c b/mainboard/amd/norwich/initram.c index 3ca8916381..07563b455c 100644 --- a/mainboard/amd/norwich/initram.c +++ b/mainboard/amd/norwich/initram.c @@ -42,6 +42,18 @@ extern int smbus_read_byte(u16 device, u8 address); #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; diff --git a/southbridge/amd/cs5536/smbus_initram.c b/southbridge/amd/cs5536/smbus_initram.c index 1ba2d72038..989a705903 100644 --- a/southbridge/amd/cs5536/smbus_initram.c +++ b/southbridge/amd/cs5536/smbus_initram.c @@ -330,20 +330,3 @@ int smbus_read_byte(u16 device, u8 address) 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); -}