From f7da8927f6d816679d603d082a496ae893e8daa5 Mon Sep 17 00:00:00 2001 From: Werner Zeh Date: Wed, 14 Feb 2018 08:08:24 +0100 Subject: siemens/mc_bdx1: Show mainboard hardware version on console Show mainboard version in the console log so that one can easily see it. Change-Id: I33bae8b340fce13c0cbe525521828929038b069a Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/23750 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/mainboard/siemens/mc_bdx1/mainboard.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainboard/siemens/mc_bdx1/mainboard.c b/src/mainboard/siemens/mc_bdx1/mainboard.c index ea525d4a6c..ebc6d40fdc 100644 --- a/src/mainboard/siemens/mc_bdx1/mainboard.c +++ b/src/mainboard/siemens/mc_bdx1/mainboard.c @@ -3,7 +3,7 @@ * * Copyright (C) 2007-2009 coresystems GmbH * Copyright (C) 2011 Google Inc. - * Copyright (C) 2016 Siemens AG + * Copyright (C) 2016-2018 Siemens AG * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ #include #include #include +#include #include #if IS_ENABLED(CONFIG_VGA_ROM_RUN) #include @@ -38,6 +39,7 @@ #include #include #include +#include #define MAX_PATH_DEPTH 12 #define MAX_NUM_MAPPINGS 10 @@ -88,6 +90,8 @@ #define SPI_REG_OPMENU_L 0x98 #define SPI_REG_OPMENU_H 0x9c +/* Define the slave address for the I/O expander. */ +#define PCA9538_SLAVE_ADR 0x71 /* * mainboard_enable is executed as first thing after enumerate_buses(). * This is the earliest point to add customization. @@ -143,6 +147,11 @@ static void mainboard_final(void *chip_info) cmd |= PCI_COMMAND_MASTER; pci_write_config16(dev, PCI_COMMAND, cmd); } + /* Show the mainboard version well-visible on console. */ + printk(BIOS_NOTICE, "***************************\n" + "* Mainboard version: 0x%02x *\n" + "***************************\n", + pca9538_read_input()); } /** \brief This function can decide if a given MAC address is valid or not. @@ -242,6 +251,23 @@ static void wait_for_legacy_dev(void *unused) printk(BIOS_NOTICE, "done!\n"); } +/* + * To access the I/O expander PCA9538 we need to know its device structure. + * This function will provide it as mainboard code has the knowledge of the + * right I2C slave address for the I/O expander. + */ +struct device *pca9538_get_dev(void) +{ + struct device *dev = NULL; + do { + dev = dev_find_path(dev, DEVICE_PATH_I2C); + if (dev->path.i2c.device == PCA9538_SLAVE_ADR) + break; + } while (dev); + return dev; +} + + BOOT_STATE_INIT_ENTRY(BS_DEV_ENUMERATE, BS_ON_ENTRY, wait_for_legacy_dev, NULL); struct chip_operations mainboard_ops = { -- cgit v1.2.3