the following patch was just integrated into master:
commit a090ae04c285c4086973e826a36fe87dfeb74d9e
Author: Damien Zammit <damien(a)zamaudio.com>
Date: Sat May 21 01:56:01 2016 +1000
nb/intel/x4x: Add DMI/EP init
The values were obtained from vendor bios at runtime.
I am not 100% sure of the sequence required to initiate them,
but guessed from the gm45 code. There may be some status bytes
needed to be polled during the sequence that is missing,
but as I don't have bios writer's datasheet it's very hard
for me to know.
Change-Id: Idd205e0bab5f75e01c6e3a5dc320c08639f52db8
Signed-off-by: Damien Zammit <damien(a)zamaudio.com>
Reviewed-on: https://review.coreboot.org/14925
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth(a)google.com>
See https://review.coreboot.org/14925 for details.
-gerrit
the following patch was just integrated into master:
commit 2b2f465fcb1afe4960c613b8ca91e868c64592d4
Author: Damien Zammit <damien(a)zamaudio.com>
Date: Wed May 11 19:08:33 2016 +1000
mb/gigabyte/ga-g41m-es2l: Fix ACPI IRQ settings for SATA
Previously, due to a bug in devicetree and incorrect IRQ
settings in ACPI, SATA controller would not initialize
any HDDs in the OS, even though it worked in SeaBIOS.
The devicetree setting is not needed because SATA must
function in "plain" mode on this board, as "combined" mode
does not work at all.
Change-Id: I0036c4734de00b84cc3d64f38e4b1fd80fd1a25d
Signed-off-by: Damien Zammit <damien(a)zamaudio.com>
Reviewed-on: https://review.coreboot.org/14776
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth(a)google.com>
See https://review.coreboot.org/14776 for details.
-gerrit
Hannah Williams (hannah.williams(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15021
-gerrit
commit 1e7ed8ab2a3f65b79b1c30795159be3839966e94
Author: Hannah Williams <hannah.williams(a)intel.com>
Date: Wed May 18 13:45:20 2016 -0700
soc/intel/common: Add _OSC method
Not masking any bits in Operating System Capabilities, which means we
support all the capabilities that OS passed in Arg3
Change-Id: Ib87915e18e305db41b52891ac5430201dda64bb5
Signed-off-by: Hannah Williams <hannah.williams(a)intel.com>
---
src/soc/intel/common/acpi/osc.asl | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/soc/intel/common/acpi/osc.asl b/src/soc/intel/common/acpi/osc.asl
new file mode 100644
index 0000000..749efd8
--- /dev/null
+++ b/src/soc/intel/common/acpi/osc.asl
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2016 Intel Corp.
+ *
+ * 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.
+ */
+
+Method (_OSC, 4)
+{
+ /* Check for proper GUID */
+ If (LEqual (Arg0, ToUUID ("33DB4D5B-1FF7-401C-9657-7441C03DD766")))
+ {
+ /* Let OS control everything */
+ Return (Arg3)
+ }
+ Else
+ {
+ /* Unrecognized UUID */
+ CreateDWordField (Arg3, 0, CDW1)
+ Or (CDW1, 4, CDW1)
+ Return (Arg3)
+ }
+}
Duncan Laurie (dlaurie(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15017
-gerrit
commit 9204eb0f591c87b6650ec3d8a5de0f4b0910e0d5
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Wed May 11 11:27:47 2016 -0700
generic: Add a Maxim 98357A codec driver
The Maxim Integrated 98357A codec is an I2S slave device that has no
control channel for configuration and instead provides a GPIO that is
used for channel selection and power down. This means it does not fit
into a bus hierarchy easily and is instead represented as a generic
device and found with a static bus scan using the devicetree.
This driver provides configuration options for passing the "sdmode" GPIO
descriptor as well as a second option for "sdmode delay" which can
configure the timing of the sdmode toggling in relation to the I2S
channel output.
In addition an GPIO can be provided to indicate to the driver whether
this device is present or not. This can be used for board designs that
may have different codec possibilities that are selected by HW strap.
Sample usage for this device driver:
device pci 1f.3 on
chip drivers/generic/max98357a
register "sdmode_gpio" = "ACPI_GPIO_OUTPUT(GPP_C6)"
register "sdmode_delay" = "100"
device generic 0 on end
end
end
Will result in the following code in the SSDT:
Scope (\_SB.PCI0.HDAS) {
Device (MAXM) {
Name (_HID, "MX98357A")
Name (_UID, Zero)
Name (_DDN, "Maxim Integrated 98357A Amplifier")
Method (_STA) { Return (0xF) }
Name (_CRS, ResourceTemplate () {
GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
"\\_SB.PCI0.GPIO", 0, ResourceConsumer)
})
Name (_DSD, Package () {
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () {
Package () { "maxim,sdmode-gpio", \_SB.PCI0.HDAS.MAXM, 0, 0, 0 }
Package () { "maxim,sdmode-delay", 100 }
Package () { "sdmode-delay", 100 }
}
})
}
}
Change-Id: Ia0bafe49bea9bbe4a3cc0f9f9cdb6f6390da57b5
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/drivers/generic/max98357a/Kconfig | 2 +
src/drivers/generic/max98357a/Makefile.inc | 1 +
src/drivers/generic/max98357a/chip.h | 13 ++++
src/drivers/generic/max98357a/max98357a.c | 109 +++++++++++++++++++++++++++++
4 files changed, 125 insertions(+)
diff --git a/src/drivers/generic/max98357a/Kconfig b/src/drivers/generic/max98357a/Kconfig
new file mode 100644
index 0000000..a7104f1
--- /dev/null
+++ b/src/drivers/generic/max98357a/Kconfig
@@ -0,0 +1,2 @@
+config DRIVERS_GENERIC_MAX98357A
+ bool
diff --git a/src/drivers/generic/max98357a/Makefile.inc b/src/drivers/generic/max98357a/Makefile.inc
new file mode 100644
index 0000000..529e24a
--- /dev/null
+++ b/src/drivers/generic/max98357a/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_GENERIC_MAX98357A) += max98357a.c
diff --git a/src/drivers/generic/max98357a/chip.h b/src/drivers/generic/max98357a/chip.h
new file mode 100644
index 0000000..0abd616
--- /dev/null
+++ b/src/drivers/generic/max98357a/chip.h
@@ -0,0 +1,13 @@
+#include <arch/acpi_device.h>
+
+struct drivers_generic_max98357a_config {
+ /* SDMODE GPIO */
+ struct acpi_gpio sdmode_gpio;
+
+ /* SDMODE Delay */
+ unsigned sdmode_delay;
+
+ /* GPIO used to indicate if this device is present */
+ unsigned device_present_gpio;
+ unsigned device_present_gpio_invert;
+};
diff --git a/src/drivers/generic/max98357a/max98357a.c b/src/drivers/generic/max98357a/max98357a.c
new file mode 100644
index 0000000..331df4c
--- /dev/null
+++ b/src/drivers/generic/max98357a/max98357a.c
@@ -0,0 +1,109 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google Inc.
+ *
+ * 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 <arch/acpi_device.h>
+#include <arch/acpigen.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <device/path.h>
+#include <gpio.h>
+#include <stdint.h>
+#include <string.h>
+#include "chip.h"
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+
+#define MAX98357A_ACPI_NAME "MAXM"
+#define MAX98357A_ACPI_HID "MX98357A"
+
+static void max98357a_fill_ssdt(struct device *dev)
+{
+ struct drivers_generic_max98357a_config *config = dev->chip_info;
+ const char *path = acpi_device_path(dev);
+
+ if (!dev->enabled || !path)
+ return;
+
+ /* Device */
+ acpigen_write_scope(acpi_device_scope(dev));
+ acpigen_write_device(acpi_device_name(dev));
+ acpigen_write_name_string("_HID", MAX98357A_ACPI_HID);
+ acpigen_write_name_integer("_UID", 0);
+ acpigen_write_name_string("_DDN", dev->chip_ops->name);
+ acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
+
+ /* Resources */
+ acpigen_write_name("_CRS");
+ acpigen_write_resourcetemplate_header();
+ acpi_device_write_gpio(&config->sdmode_gpio);
+ acpigen_write_resourcetemplate_footer();
+
+ /* _DSD for devicetree properties */
+ acpi_dp_write_header();
+ /* This points to the first pin in the first gpio entry in _CRS */
+ acpi_dp_write_gpio("maxim,sdmode-gpio", path, 0, 0, 0);
+ /* This is the correctly formatted Device Property name */
+ acpi_dp_write_integer("maxim,sdmode-delay", config->sdmode_delay);
+ /* This is used by the chromium kernel but is not upstream */
+ acpi_dp_write_integer("sdmode-delay", config->sdmode_delay);
+ acpi_dp_write_footer();
+
+ acpigen_pop_len(); /* Device */
+ acpigen_pop_len(); /* Scope */
+
+ printk(BIOS_INFO, "%s: %s\n", path, dev->chip_ops->name);
+}
+
+static const char *max98357a_acpi_name(struct device *dev)
+{
+ return MAX98357A_ACPI_NAME;
+}
+#endif
+
+static struct device_operations max98357a_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+ .acpi_name = &max98357a_acpi_name,
+ .acpi_fill_ssdt_generator = &max98357a_fill_ssdt,
+#endif
+};
+
+static void max98357a_enable(struct device *dev)
+{
+ struct drivers_generic_max98357a_config *config = dev->chip_info;
+
+ /* Check if device is present by reading GPIO */
+ if (config->device_present_gpio) {
+ int present = gpio_get(config->device_present_gpio);
+ present ^= config->device_present_gpio_invert;
+
+ printk(BIOS_INFO, "%s is %spresent\n",
+ dev->chip_ops->name, present ? "" : "not ");
+
+ if (!present) {
+ dev->enabled = 0;
+ return;
+ }
+ }
+
+ dev->ops = &max98357a_ops;
+}
+
+struct chip_operations drivers_generic_max98357a_ops = {
+ CHIP_NAME("Maxim Integrated 98357A Amplifier")
+ .enable_dev = &max98357a_enable
+};
Duncan Laurie (dlaurie(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15016
-gerrit
commit 83d09e2d4fd92452bf113695fb26c59113a8cde1
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Wed May 11 09:50:59 2016 -0700
i2c: Add a generic i2c driver
This adds a generic I2C driver that can be described in the devicetree
and used to generate ACPI objects in the SSDT based on the information
provided in the config registers.
The I2C bus can be configured and the device can provide an interrupt and
wake capability to the OS. A configuration option allows for a GPIO to
be provided that will be checked to determine if the device is preset on
the board before including it in the generated SSDT.
The driver is generic enough to be used for basic I2C devices that do
not have special configuration needs such as touchpads, touchscreens,
sensors, some audio codec/amplifiers, etc.
Sample usage for a touchpad device:
device pci 15.1 on
chip drivers/i2c/generic
register "hid" = ""ELAN0000""
register "desc" = "ELAN Touchpad"
register "irq" = "IRQ_EDGE_LOW(GPP_B3_IRQ)"
register "wake" = "GPE0_DW0_05"
device i2c 15.0 on end
end
end
Will result in the following code in the SSDT:
Scope (\_SB.PCI0.I2C1) {
Device (D015) {
Name (_HID, "ELAN0000")
Name (_UID, 0)
Name (_S0W, 4)
Name (_PRW, Package () { 5, 3 })
Method (_STA) { Return (0x0f) }
Name (_CRS, ResourceTemplate () {
I2cSerialBus (0x15, ControllerInitiated, 400000, AddressingMode7Bit,
"\\_S.PCI0.I2C1", 0, ResourceConsumer)
Interrupt (ResourceConsumer, Edge, ActiveLow) { 51 }
})
}
}
Change-Id: Ib32055720835b70e91ede5e4028ecd91894d70d5
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/drivers/i2c/generic/Kconfig | 2 +
src/drivers/i2c/generic/Makefile.inc | 1 +
src/drivers/i2c/generic/chip.h | 15 +++++
src/drivers/i2c/generic/generic.c | 123 +++++++++++++++++++++++++++++++++++
4 files changed, 141 insertions(+)
diff --git a/src/drivers/i2c/generic/Kconfig b/src/drivers/i2c/generic/Kconfig
new file mode 100644
index 0000000..a4c0104
--- /dev/null
+++ b/src/drivers/i2c/generic/Kconfig
@@ -0,0 +1,2 @@
+config DRIVERS_I2C_GENERIC
+ bool
diff --git a/src/drivers/i2c/generic/Makefile.inc b/src/drivers/i2c/generic/Makefile.inc
new file mode 100644
index 0000000..86cbc7b
--- /dev/null
+++ b/src/drivers/i2c/generic/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_I2C_GENERIC) += generic.c
diff --git a/src/drivers/i2c/generic/chip.h b/src/drivers/i2c/generic/chip.h
new file mode 100644
index 0000000..7b371c4
--- /dev/null
+++ b/src/drivers/i2c/generic/chip.h
@@ -0,0 +1,15 @@
+#include <arch/acpi_device.h>
+
+struct drivers_i2c_generic_config {
+ const char *hid; /* ACPI _HID (required) */
+ const char *name; /* ACPI Device Name */
+ const char *desc; /* Device Description */
+ unsigned uid; /* ACPI _UID */
+ unsigned bus_speed; /* I2C Bus Frequency (default=400kHz) */
+ unsigned wake; /* Wake GPE */
+ struct acpi_irq irq; /* Interrupt */
+
+ /* GPIO used to indicate if this device is present */
+ unsigned device_present_gpio;
+ unsigned device_present_gpio_invert;
+};
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
new file mode 100644
index 0000000..a12c273
--- /dev/null
+++ b/src/drivers/i2c/generic/generic.c
@@ -0,0 +1,123 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2016 Google Inc.
+ *
+ * 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 <arch/acpi_device.h>
+#include <arch/acpigen.h>
+#include <console/console.h>
+#include <device/i2c.h>
+#include <device/device.h>
+#include <device/path.h>
+#include <gpio.h>
+#include <stdint.h>
+#include <string.h>
+#include "chip.h"
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+static void i2c_generic_fill_ssdt(struct device *dev)
+{
+ struct drivers_i2c_generic_config *config = dev->chip_info;
+ const char *scope = acpi_device_scope(dev);
+ struct acpi_i2c i2c = {
+ .address = dev->path.i2c.device,
+ .mode_10bit = dev->path.i2c.mode_10bit,
+ .speed = config->bus_speed ? : I2C_SPEED_FAST,
+ .resource = scope,
+ };
+
+ if (!dev->enabled || !scope)
+ return;
+
+ if (!config->hid) {
+ printk(BIOS_ERR, "%s: ERROR: HID required\n", dev_path(dev));
+ return;
+ }
+
+ /* Device */
+ acpigen_write_scope(scope);
+ acpigen_write_device(acpi_device_name(dev));
+ acpigen_write_name_string("_HID", config->hid);
+ acpigen_write_name_integer("_UID", config->uid);
+ acpigen_write_name_string("_DDN", config->desc);
+ acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
+
+ /* Resources */
+ acpigen_write_name("_CRS");
+ acpigen_write_resourcetemplate_header();
+ acpi_device_write_i2c(&i2c);
+ acpi_device_write_interrupt(&config->irq);
+ acpigen_write_resourcetemplate_footer();
+
+ /* Wake capabilities */
+ if (config->wake) {
+ acpigen_write_name_integer("_S0W", 4);
+ acpigen_write_PRW(config->wake, 3);
+ }
+
+ acpigen_pop_len(); /* Device */
+ acpigen_pop_len(); /* Scope */
+
+ printk(BIOS_INFO, "%s: %s at %s\n", acpi_device_path(dev),
+ config->desc ? : dev->chip_ops->name, dev_path(dev));
+}
+
+/* Use name specified in config or build one from I2C address */
+static const char *i2c_generic_acpi_name(struct device *dev)
+{
+ struct drivers_i2c_generic_config *config = dev->chip_info;
+ static char name[5];
+
+ if (config->name)
+ return name;
+
+ snprintf(name, sizeof(name), "D%03X", dev->path.i2c.device);
+ return name;
+}
+#endif
+
+static struct device_operations i2c_generic_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+ .acpi_name = &i2c_generic_acpi_name,
+ .acpi_fill_ssdt_generator = &i2c_generic_fill_ssdt,
+#endif
+};
+
+static void i2c_generic_enable(struct device *dev)
+{
+ struct drivers_i2c_generic_config *config = dev->chip_info;
+
+ /* Check if device is present by reading GPIO */
+ if (config->device_present_gpio) {
+ int present = gpio_get(config->device_present_gpio);
+ present ^= config->device_present_gpio_invert;
+
+ printk(BIOS_INFO, "%s is %spresent\n",
+ dev->chip_ops->name, present ? "" : "not ");
+
+ if (!present) {
+ dev->enabled = 0;
+ return;
+ }
+ }
+
+ dev->ops = &i2c_generic_ops;
+}
+
+struct chip_operations drivers_i2c_generic_ops = {
+ CHIP_NAME("I2C Device")
+ .enable_dev = &i2c_generic_enable
+};