Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/23750
Change subject: siemens/mc_bdx1: Show mainboard hardware version on console
......................................................................
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 <werner.zeh(a)siemens.com>
---
M src/mainboard/siemens/mc_bdx1/mainboard.c
1 file changed, 27 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/23750/1
diff --git a/src/mainboard/siemens/mc_bdx1/mainboard.c b/src/mainboard/siemens/mc_bdx1/mainboard.c
index ea525d4..e19a912 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 <device/pci_def.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>
+#include <device/path.h>
#include <console/console.h>
#if IS_ENABLED(CONFIG_VGA_ROM_RUN)
#include <x86emu/x86emu.h>
@@ -38,6 +39,7 @@
#include <bootstate.h>
#include <timer.h>
#include <timestamp.h>
+#include <pca9538.h>
#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 @@
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 @@
printk(BIOS_NOTICE, "done!\n");
}
+/*
+ * To access the I/O expander PCA9538 we need to know it's 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 = {
--
To view, visit https://review.coreboot.org/23750
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I33bae8b340fce13c0cbe525521828929038b069a
Gerrit-Change-Number: 23750
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh(a)siemens.com>
Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/23748
Change subject: drivers/i2c: Add chip driver for I/O expander PCA9538
......................................................................
drivers/i2c: Add chip driver for I/O expander PCA9538
The chip PCA9538 is a 8 bit I/O expander connected to the systems I2C
bus. Add a chip driver to support this chip.
Beside the pure chip driver two interface functions are provided to read
the state of the pins and write output values to the pins.
As the slave address of this chip is hardware configurable the function
pca9538_get_dev() is used to get the right slave address. This function
needs to be implemented in mainboard code if one needs to use the
interface functions to read and write I/O state.
Change-Id: Ic856123b4f4c8b721928ee3a2a4bb37833ea4b20
Signed-off-by: Werner Zeh <werner.zeh(a)siemens.com>
---
A src/drivers/i2c/pca9538/Kconfig
A src/drivers/i2c/pca9538/Makefile.inc
A src/drivers/i2c/pca9538/chip.h
A src/drivers/i2c/pca9538/pca9538.c
A src/drivers/i2c/pca9538/pca9538.h
5 files changed, 136 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/23748/1
diff --git a/src/drivers/i2c/pca9538/Kconfig b/src/drivers/i2c/pca9538/Kconfig
new file mode 100644
index 0000000..558332b
--- /dev/null
+++ b/src/drivers/i2c/pca9538/Kconfig
@@ -0,0 +1,5 @@
+config DRIVERS_I2C_PCA9538
+ bool
+ default n
+ help
+ Enable support for I2C I/O expander PCA9538.
diff --git a/src/drivers/i2c/pca9538/Makefile.inc b/src/drivers/i2c/pca9538/Makefile.inc
new file mode 100644
index 0000000..cc35a24
--- /dev/null
+++ b/src/drivers/i2c/pca9538/Makefile.inc
@@ -0,0 +1,5 @@
+ramstage-$(CONFIG_DRIVERS_I2C_PCA9538) += pca9538.c
+
+ifeq ($(CONFIG_DRIVERS_I2C_PCA9538),y)
+CFLAGS_x86_32 += -Isrc/drivers/i2c/pca9538
+endif
diff --git a/src/drivers/i2c/pca9538/chip.h b/src/drivers/i2c/pca9538/chip.h
new file mode 100644
index 0000000..9c60aab
--- /dev/null
+++ b/src/drivers/i2c/pca9538/chip.h
@@ -0,0 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 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
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+
+struct drivers_i2c_pca9538_config {
+ unsigned char in_out; /* Use bit as input(1) or output (0). */
+ unsigned char invert; /* If a bit is 1, the input will be inverted. */
+ unsigned char out_val; /* Initial output value to drive. */
+};
diff --git a/src/drivers/i2c/pca9538/pca9538.c b/src/drivers/i2c/pca9538/pca9538.c
new file mode 100644
index 0000000..2841a77
--- /dev/null
+++ b/src/drivers/i2c/pca9538/pca9538.c
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 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
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <device/i2c_bus.h>
+#include <device/device.h>
+#include <console/console.h>
+#include "pca9538.h"
+#include "chip.h"
+
+/* This function can be used from outside the chip driver to read input. */
+uint8_t pca9538_read_input(void)
+{
+ struct device *dev = pca9538_get_dev();
+
+ if (!dev)
+ return 0;
+ else
+ return (uint8_t)(i2c_dev_readb_at(dev, INPUT_REG));
+}
+
+/* This function can be used from outside the chip driver to set output. */
+void pca9538_set_output(uint8_t val)
+{
+ struct device *dev = pca9538_get_dev();
+
+ if (dev)
+ i2c_dev_writeb_at(dev, OUTPUT_REG, val);
+}
+
+static void pca9538_init(struct device *dev)
+{
+ struct drivers_i2c_pca9538_config *config = dev->chip_info;
+
+ /* Set up registers as requested in devicetree. */
+ i2c_dev_writeb_at(dev, IO_CONFIG_REG, config->in_out);
+ i2c_dev_writeb_at(dev, INPUT_INVERT_REG, config->invert);
+ i2c_dev_writeb_at(dev, OUTPUT_REG, config->out_val);
+}
+
+static struct device_operations pca9538_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+ .init = pca9538_init,
+ .final = DEVICE_NOOP
+};
+
+static void pca9538_enable(struct device *dev)
+{
+ dev->ops = &pca9538_ops;
+}
+
+struct chip_operations drivers_i2c_pca9538_ops = {
+ CHIP_NAME("PCA9538")
+ .enable_dev = pca9538_enable
+};
diff --git a/src/drivers/i2c/pca9538/pca9538.h b/src/drivers/i2c/pca9538/pca9538.h
new file mode 100644
index 0000000..9c28845
--- /dev/null
+++ b/src/drivers/i2c/pca9538/pca9538.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 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
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _I2C_PCA9538_H_
+#define _I2C_PCA9538_H_
+
+#include <types.h>
+
+/* Register layout */
+#define INPUT_REG 0x00
+#define OUTPUT_REG 0x01
+#define INPUT_INVERT_REG 0x02
+#define IO_CONFIG_REG 0x03
+
+/* Provide some functions to read input and write output values. */
+uint8_t pca9538_read_input(void);
+void pca9538_set_output(uint8_t val);
+/*
+ * Provide a way to get the right device structure for the I/O expander.
+ * The user of this driver has to provide this function if read/write of I/O
+ * values on the I/O expander is needed.
+ */
+struct device *pca9538_get_dev(void);
+
+#endif /* _I2C_PCA9538_H_ */
--
To view, visit https://review.coreboot.org/23748
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic856123b4f4c8b721928ee3a2a4bb37833ea4b20
Gerrit-Change-Number: 23748
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh(a)siemens.com>
Werner Zeh has uploaded this change for review. ( https://review.coreboot.org/23749
Change subject: siemens/mc_bdx1: Enable PCA9538 I/O expander
......................................................................
siemens/mc_bdx1: Enable PCA9538 I/O expander
The I/O expander on the mc_bdx1 is used to get the hardware version of
the mainboard. This patch enables the chip driver for the I/O expander.
Change-Id: I98c667fe4dccf0698ab4cb5ede6082f020c70ec6
Signed-off-by: Werner Zeh <werner.zeh(a)siemens.com>
---
M src/mainboard/siemens/mc_bdx1/Kconfig
M src/mainboard/siemens/mc_bdx1/devicetree.cb
2 files changed, 8 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/23749/1
diff --git a/src/mainboard/siemens/mc_bdx1/Kconfig b/src/mainboard/siemens/mc_bdx1/Kconfig
index dc2093d..a24d09d 100644
--- a/src/mainboard/siemens/mc_bdx1/Kconfig
+++ b/src/mainboard/siemens/mc_bdx1/Kconfig
@@ -13,6 +13,7 @@
select DRIVER_INTEL_I210
select DRIVER_SIEMENS_NC_FPGA
select DRIVERS_I2C_RX6110SA
+ select DRIVERS_I2C_PCA9538
config MAINBOARD_DIR
string
diff --git a/src/mainboard/siemens/mc_bdx1/devicetree.cb b/src/mainboard/siemens/mc_bdx1/devicetree.cb
index 8bb582e..bb5d843 100644
--- a/src/mainboard/siemens/mc_bdx1/devicetree.cb
+++ b/src/mainboard/siemens/mc_bdx1/devicetree.cb
@@ -23,6 +23,13 @@
register "user_weekday" = "4"
device i2c 0x32 on end # RTC RX6110 SA
end
+ #Enable I/O expander
+ chip drivers/i2c/pca9538
+ register "in_out" = "0xff"
+ register "invert" = "0xff"
+ register "out_val" = "0x00"
+ device i2c 0x71 on end # I/O expander
+ end
end # SMBus Controller
device pci 1f.5 on end # SATA Controller
end
--
To view, visit https://review.coreboot.org/23749
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I98c667fe4dccf0698ab4cb5ede6082f020c70ec6
Gerrit-Change-Number: 23749
Gerrit-PatchSet: 1
Gerrit-Owner: Werner Zeh <werner.zeh(a)siemens.com>
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23731 )
Change subject: mb/google/poppy/variant/nautilus: Enable and configure DPTF
......................................................................
Patch Set 4: Verified+1
Build Successful
https://qa.coreboot.org/job/coreboot-gerrit/67441/ : SUCCESS
https://qa.coreboot.org/job/coreboot-checkpatch/21979/ : SUCCESS
--
To view, visit https://review.coreboot.org/23731
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I31b31d5282ab38278bc68045ce75fdc6192f1144
Gerrit-Change-Number: 23731
Gerrit-PatchSet: 4
Gerrit-Owner: Seunghwan Kim <sh_.kim(a)samsung.com>
Gerrit-Reviewer: Chris Wang <chriswang(a)ami.corp-partner.google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Peter Lin <peterlin(a)ami.corp-partner.google.com>
Gerrit-Reviewer: Seunghwan Kim <sh_.kim(a)samsung.com>
Gerrit-Reviewer: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Wed, 14 Feb 2018 06:48:51 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/23731 )
Change subject: mb/google/poppy/variant/nautilus: Enable and configure DPTF
......................................................................
Patch Set 3: Verified+1
Build Successful
https://qa.coreboot.org/job/coreboot-gerrit/67440/ : SUCCESS
https://qa.coreboot.org/job/coreboot-checkpatch/21978/ : SUCCESS
--
To view, visit https://review.coreboot.org/23731
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I31b31d5282ab38278bc68045ce75fdc6192f1144
Gerrit-Change-Number: 23731
Gerrit-PatchSet: 3
Gerrit-Owner: Seunghwan Kim <sh_.kim(a)samsung.com>
Gerrit-Reviewer: Chris Wang <chriswang(a)ami.corp-partner.google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-Reviewer: Peter Lin <peterlin(a)ami.corp-partner.google.com>
Gerrit-Reviewer: Seunghwan Kim <sh_.kim(a)samsung.com>
Gerrit-Reviewer: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Comment-Date: Wed, 14 Feb 2018 06:34:31 +0000
Gerrit-HasComments: No
Gerrit-HasLabels: Yes