Nico Huber has uploaded this change for review.
[WIP] Give `lenovo_serial` EEPROMs a name in dt
Change-Id: I99edb7a8428ac7efa275fa09a10ec051b0f9abd3
Signed-off-by: Nico Huber <nico.huber@secunet.com>
---
M src/drivers/i2c/at24rf08c/lenovo_serials.c
M src/mainboard/lenovo/x200/devicetree.cb
2 files changed, 13 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/57/35457/1
diff --git a/src/drivers/i2c/at24rf08c/lenovo_serials.c b/src/drivers/i2c/at24rf08c/lenovo_serials.c
index 0a6b343..3464e4a 100644
--- a/src/drivers/i2c/at24rf08c/lenovo_serials.c
+++ b/src/drivers/i2c/at24rf08c/lenovo_serials.c
@@ -20,17 +20,22 @@
#include <smbios.h>
#include <console/console.h>
#include <version.h>
+#include <static.h>
#include "lenovo.h"
#define ERROR_STRING "*INVALID*"
static struct device *at24rf08c_find_bank(u8 bank)
{
- struct device *dev;
- dev = dev_find_slot_on_smbus(1, 0x54 | bank);
- if (!dev)
- printk(BIOS_WARNING, "EEPROM not found\n");
- return dev;
+ switch (bank) {
+ case 0:
+ return &__static_lenovo_serial0;
+ case 2:
+ return &__static_lenovo_serial2;
+ default:
+ die("%s: Unknown EEPROM bank number.\n", __func__);
+ return NULL;
+ }
}
static int at24rf08c_read_byte(struct device *dev, u8 addr)
@@ -134,14 +139,7 @@
memset(result, 0, sizeof (result));
- dev = dev_find_slot_on_smbus(1, 0x56);
- if (dev == NULL) {
- printk(BIOS_WARNING, "EEPROM not found\n");
- already_read = 1;
- memset(uuid, 0, 16);
- return;
- }
-
+ dev = at24rf08c_find_bank(2);
for (i = 0; i < 16; i++) {
int t;
int j;
diff --git a/src/mainboard/lenovo/x200/devicetree.cb b/src/mainboard/lenovo/x200/devicetree.cb
index 2ed4308..5ff5d52 100644
--- a/src/mainboard/lenovo/x200/devicetree.cb
+++ b/src/mainboard/lenovo/x200/devicetree.cb
@@ -215,9 +215,9 @@
ioapic_irq 2 INTC 0x12
# eeprom, 8 virtual devices, same chip
chip drivers/i2c/at24rf08c
- device i2c 54 on end
+ device i2c 54 as lenovo_serial0 on end
device i2c 55 on end
- device i2c 56 on end
+ device i2c 56 as lenovo_serial2 on end
device i2c 57 on end
device i2c 5c on end
device i2c 5d on end
To view, visit change 35457. To unsubscribe, or for help writing mail filters, visit settings.