Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35076 )
Change subject: drivers/spi/acpi: Support power resource as parent in device tree
......................................................................
drivers/spi/acpi: Support power resource as parent in device tree
This allows supporting an independent power resource for SPI ACPI
devices, so that the power resource configuration can be refactored
out of individual drivers and coalesced into a separate one.
Change-Id: Ib1e52a0f31d430637c9d819e231f9c4af6c68672
Signed-off-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/drivers/spi/acpi/acpi.c
1 file changed, 16 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/35076/1
diff --git a/src/drivers/spi/acpi/acpi.c b/src/drivers/spi/acpi/acpi.c
index 5ae010f..07f1a4b 100644
--- a/src/drivers/spi/acpi/acpi.c
+++ b/src/drivers/spi/acpi/acpi.c
@@ -23,6 +23,7 @@
#include <stdint.h>
#include <string.h>
#include "chip.h"
+#include "drivers/generic/power_resource/chip.h"
static int spi_acpi_get_bus(const struct device *dev)
{
@@ -73,8 +74,19 @@
static void spi_acpi_fill_ssdt_generator(struct device *dev)
{
+ const int parent_is_power_resource =
+ CONFIG(DRIVERS_GENERIC_POWER_RESOURCE) &&
+ (dev->bus && dev->bus->children == dev &&
+ dev->bus->dev->chip_ops == &drivers_generic_power_resource_ops);
+ /*
+ * Because the power resource is a "pseudo-device", we don't want it
+ * to be included in the ACPI path
+ */
+ const char *pr_scope = parent_is_power_resource ?
+ acpi_device_scope(dev->bus->dev) :
+ NULL;
struct drivers_spi_acpi_config *config = dev->chip_info;
- const char *scope = acpi_device_scope(dev);
+ const char *scope = (pr_scope == NULL) ? acpi_device_scope(dev) : pr_scope;
const char *path = acpi_device_path(dev);
struct acpi_spi spi = {
.device_select = dev->path.spi.cs,
@@ -184,6 +196,9 @@
acpi_device_path(dev));
acpi_add_device_power_resource("PRIC");
+ } else if (parent_is_power_resource) {
+ /* Parent device is a power resource, so set up _PR0/_PR3 */
+ acpi_add_device_power_resource(acpi_device_path(dev->bus->dev));
}
acpigen_pop_len(); /* Device */
--
To view, visit https://review.coreboot.org/c/coreboot/+/35076
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib1e52a0f31d430637c9d819e231f9c4af6c68672
Gerrit-Change-Number: 35076
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-MessageType: newchange
Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35075 )
Change subject: drivers/i2c/generic: Support power resource as parent in device tree
......................................................................
drivers/i2c/generic: Support power resource as parent in device tree
This allows supporting an independent power resource for I2C generic
devices, so that the power resource configuration can be refactored
out of individual drivers and coalesced into a separate one.
Change-Id: I7554ab4fef88ffea0d3423ea27bb18a56b7f4de5
Signed-off-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/drivers/i2c/generic/generic.c
1 file changed, 16 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/35075/1
diff --git a/src/drivers/i2c/generic/generic.c b/src/drivers/i2c/generic/generic.c
index 27ff9ff..a3411b0 100644
--- a/src/drivers/i2c/generic/generic.c
+++ b/src/drivers/i2c/generic/generic.c
@@ -23,6 +23,7 @@
#include <stdint.h>
#include <string.h>
#include "chip.h"
+#include "drivers/generic/power_resource/chip.h"
#if CONFIG(HAVE_ACPI_TABLES)
@@ -59,7 +60,18 @@
void (*callback)(struct device *dev),
struct drivers_i2c_generic_config *config)
{
- const char *scope = acpi_device_scope(dev);
+ const int parent_is_power_resource =
+ CONFIG(DRIVERS_GENERIC_POWER_RESOURCE) &&
+ (dev->bus && dev->bus->children == dev &&
+ dev->bus->dev->chip_ops == &drivers_generic_power_resource_ops);
+ /*
+ * Because the power resource is a "pseudo-device", we don't want it
+ * to be included in the ACPI path
+ */
+ const char *pr_scope = parent_is_power_resource ?
+ acpi_device_scope(dev->bus->dev) :
+ NULL;
+ const char *scope = (pr_scope == NULL) ? acpi_device_scope(dev) : pr_scope;
struct acpi_i2c i2c = {
.address = dev->path.i2c.device,
.mode_10bit = dev->path.i2c.mode_10bit,
@@ -163,7 +175,9 @@
acpi_device_path(dev));
acpi_add_device_power_resource("PRIC");
-
+ } else if (parent_is_power_resource) {
+ /* Parent device is a power resource, so set up _PR0/_PR3 */
+ acpi_add_device_power_resource(acpi_device_path(dev->bus->dev));
}
/* Callback if any. */
--
To view, visit https://review.coreboot.org/c/coreboot/+/35075
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7554ab4fef88ffea0d3423ea27bb18a56b7f4de5
Gerrit-Change-Number: 35075
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-MessageType: newchange
Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35074 )
Change subject: device: Allow scan_generic_bus to recurse on pseudo-devices
......................................................................
device: Allow scan_generic_bus to recurse on pseudo-devices
To handle cases of pseudo-devices containing a child device, e.g., power
resources, recurse onto them, treating them like a bus.
Change-Id: Ia8442939ef1e840c112ad4dd23e324afd99ff7d3
Signed-off-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/device/root_device.c
1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/35074/1
diff --git a/src/device/root_device.c b/src/device/root_device.c
index f8e2907..ec24ff5 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -112,6 +112,13 @@
printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
child->enabled ? "enabled" : "disabled");
+
+ /*
+ * To handle cases of pseudo-devices containing a child
+ * device when it's not explicitly a bus, e.g., power
+ * resources, we recurse into them.
+ */
+ scan_generic_bus(child);
}
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/35074
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia8442939ef1e840c112ad4dd23e324afd99ff7d3
Gerrit-Change-Number: 35074
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-MessageType: newchange
Tim Wawrzynczak has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35073 )
Change subject: drivers/generic: Add new driver for power resource pseudo-device
......................................................................
drivers/generic: Add new driver for power resource pseudo-device
There is some duplication of fields dealing with ACPI power resources
(see drivers/i2c/generic.c, also used by drivers/i2c/hid, as well as
drivers/spi/acpi). This CL creates a new driver for this pseudo-device.
This patch allows a new style of dealing with power resources in the
device tree:
device pci 00.0
chip drivers/generic/power_resource
register "enable_gpio" = "ACPI_GPIO_OUTPUT_ACTIVE_LOW(GPP_A1)"
device generic 0 on
chip drivers/i2c/generic
register ...
end
end
end
end
and then the power resource driver does most of the work. This should
make it easier to support other drivers requiring ACPI power resources
in the future (see the diff in the two changed here).
Change-Id: Id9d66fedd342eb5359d90d9778c515e7aa2de1d7
Signed-off-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
A src/drivers/generic/power_resource/Kconfig
A src/drivers/generic/power_resource/Makefile.inc
A src/drivers/generic/power_resource/chip.h
A src/drivers/generic/power_resource/power_resource.c
4 files changed, 128 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/35073/1
diff --git a/src/drivers/generic/power_resource/Kconfig b/src/drivers/generic/power_resource/Kconfig
new file mode 100644
index 0000000..447edb9
--- /dev/null
+++ b/src/drivers/generic/power_resource/Kconfig
@@ -0,0 +1,5 @@
+# TODO: once everything is moved to the new power resource structure,
+# those drivers that use it should auto-select this config option
+config DRIVERS_GENERIC_POWER_RESOURCE
+ bool
+ depends on HAVE_ACPI_TABLES
diff --git a/src/drivers/generic/power_resource/Makefile.inc b/src/drivers/generic/power_resource/Makefile.inc
new file mode 100644
index 0000000..2120ef1
--- /dev/null
+++ b/src/drivers/generic/power_resource/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_GENERIC_POWER_RESOURCE) += power_resource.c
diff --git a/src/drivers/generic/power_resource/chip.h b/src/drivers/generic/power_resource/chip.h
new file mode 100644
index 0000000..e698296
--- /dev/null
+++ b/src/drivers/generic/power_resource/chip.h
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC.
+ *
+ * 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 __GENERIC_POWER_RESOURCE_CHIP_H__
+#define __GENERIC_POWER_RESOURCE_CHIP_H__
+
+#include <device/device.h>
+#include <arch/acpi_device.h>
+
+extern struct chip_operations drivers_generic_power_resource_ops;
+
+struct drivers_generic_power_resource_config {
+ /* GPIO used to take device out of reset or to put it into reset. */
+ struct acpi_gpio reset_gpio;
+ /* Delay to be inserted after device is taken out of reset. */
+ unsigned int reset_delay_ms;
+ /* Delay to be inserted after device is put into reset. */
+ unsigned int reset_off_delay_ms;
+ /* GPIO used to enable device. */
+ struct acpi_gpio enable_gpio;
+ /* Delay to be inserted after device is enabled. */
+ unsigned int enable_delay_ms;
+ /* Delay to be inserted after device is disabled. */
+ unsigned int enable_off_delay_ms;
+ /* GPIO used to stop operation of device. */
+ struct acpi_gpio stop_gpio;
+ /* Delay to be inserted after disabling stop. */
+ unsigned int stop_delay_ms;
+ /* Delay to be inserted after enabling stop. */
+ unsigned int stop_off_delay_ms;
+ /* ACPI device name */
+ char acpi_name[5];
+};
+
+#endif /* __GENERIC_POWER_RESOURCE_CHIP_H__ */
diff --git a/src/drivers/generic/power_resource/power_resource.c b/src/drivers/generic/power_resource/power_resource.c
new file mode 100644
index 0000000..d08c1a2
--- /dev/null
+++ b/src/drivers/generic/power_resource/power_resource.c
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC.
+ *
+ * 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/device.h>
+#include <device/path.h>
+#include <console/console.h>
+#include <string.h>
+#include "chip.h"
+
+static void power_resource_fill_ssdt(struct device *dev)
+{
+ bool ret;
+ struct drivers_generic_power_resource_config *config = dev->chip_info;
+ const struct acpi_power_res_params power_res_params = {
+ &config->reset_gpio,
+ config->reset_delay_ms,
+ config->reset_off_delay_ms,
+ &config->enable_gpio,
+ config->enable_delay_ms,
+ config->enable_off_delay_ms,
+ &config->stop_gpio,
+ config->stop_delay_ms,
+ config->stop_off_delay_ms
+ };
+
+ ret = acpi_declare_scoped_power_resource(acpi_device_scope(dev),
+ acpi_device_name(dev),
+ &power_res_params);
+ if (!ret)
+ printk(BIOS_ERR, "Failed to add power resource %s\n",
+ acpi_device_name(dev));
+
+}
+
+static const char *power_resource_acpi_name(const struct device *dev)
+{
+ static unsigned int count;
+ struct drivers_generic_power_resource_config *config = dev->chip_info;
+
+ if (config->acpi_name[0] == '\0')
+ snprintf(config->acpi_name, sizeof(config->acpi_name), "PR%02X", count++);
+
+ return config->acpi_name;
+}
+
+static struct device_operations power_resource_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+ .scan_bus = scan_generic_bus,
+ .acpi_name = power_resource_acpi_name,
+ .acpi_fill_ssdt_generator = power_resource_fill_ssdt
+};
+
+static void power_resource_enable(struct device *dev)
+{
+ dev->ops = &power_resource_ops;
+}
+
+struct chip_operations drivers_generic_power_resource_ops = {
+ CHIP_NAME("Power Resource")
+ .enable_dev = power_resource_enable
+};
--
To view, visit https://review.coreboot.org/c/coreboot/+/35073
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Id9d66fedd342eb5359d90d9778c515e7aa2de1d7
Gerrit-Change-Number: 35073
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-MessageType: newchange
Nitheesh Sekar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32388
Change subject: TEMP: NOT FOR REVIEW: Use absolute jump address
......................................................................
TEMP: NOT FOR REVIEW: Use absolute jump address
When the qcs405 soc jumps from qc_sec to bootblock,
the pc is at 0x0 address mapped to actual SRAM address(0x8c30000).
The mapping happens in a hardware block 'boot-remapper'
only for a maximum of 128K possible.
If the bootflow continues from the 0x0 address,
bootblock references variable beyond 128K crashing the boot.
So change the PC to start execting from the absolute address
instead.
Change-Id: I004798ac73c14a431f2d561099a30295c5675abc
Signed-off-by: Nitheesh Sekar <nsekar(a)codeaurora.org>
---
M src/arch/arm64/armv8/bootblock.S
1 file changed, 4 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/88/32388/1
diff --git a/src/arch/arm64/armv8/bootblock.S b/src/arch/arm64/armv8/bootblock.S
index e5758bc..7dc8b0f 100644
--- a/src/arch/arm64/armv8/bootblock.S
+++ b/src/arch/arm64/armv8/bootblock.S
@@ -23,7 +23,9 @@
ENTRY(_start)
/* Initialize PSTATE, SCTLR and caches to clean state, set up stack. */
- bl arm64_init_cpu
+ ldr x15, =arm64_init_cpu
+ blr x15
- bl main
+ ldr x15, =main
+ blr x15
ENDPROC(_start)
--
To view, visit https://review.coreboot.org/c/coreboot/+/32388
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I004798ac73c14a431f2d561099a30295c5675abc
Gerrit-Change-Number: 32388
Gerrit-PatchSet: 1
Gerrit-Owner: Nitheesh Sekar <nsekar(a)codeaurora.org>
Gerrit-MessageType: newchange
Nitheesh Sekar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34931 )
Change subject: qcs405: Add 500 ms delay
......................................................................
qcs405: Add 500 ms delay
Add 500 ms delay before writing the ddr training data
to the spi flash. Actual delay has to be calculated based
on the calibrations taken during waveforms.
Change-Id: Ic956d73ad39481beadc0f3496c2f643b12694702
Signed-off-by: Nitheesh Sekar <nsekar(a)codeaurora.org>
---
M src/soc/qualcomm/common/qclib.c
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/34931/1
diff --git a/src/soc/qualcomm/common/qclib.c b/src/soc/qualcomm/common/qclib.c
index ac80a76..f8be4f3 100644
--- a/src/soc/qualcomm/common/qclib.c
+++ b/src/soc/qualcomm/common/qclib.c
@@ -16,6 +16,7 @@
#include <console/cbmem_console.h>
#include <cbmem.h>
#include <boardid.h>
+#include <delay.h>
#include <string.h>
#include <fmap.h>
#include <assert.h>
@@ -82,6 +83,8 @@
} else if (!strncmp(QCLIB_TE_DDR_TRAINING_DATA, te->name,
sizeof(te->name))) {
+ mdelay(500); //Add 500 ms delay
+
assert(fmap_overwrite_area(QCLIB_FR_DDR_TRAINING_DATA,
(const void *)te->blob_address, te->size));
--
To view, visit https://review.coreboot.org/c/coreboot/+/34931
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ic956d73ad39481beadc0f3496c2f643b12694702
Gerrit-Change-Number: 34931
Gerrit-PatchSet: 1
Gerrit-Owner: Nitheesh Sekar <nsekar(a)codeaurora.org>
Gerrit-MessageType: newchange