summaryrefslogtreecommitdiff
path: root/arch/x86/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-06-01 23:34:18 -0400
committerTom Rini <trini@konsulko.com>2020-06-01 23:34:18 -0400
commitecd4d99f654f3f7bfb96001891d69c3125e70b69 (patch)
tree405530bb85d5fdc97aadd6c65d9678d4ce3c54b6 /arch/x86/lib
parentb5d54d26ea1354fede1121671a7ca3b9b44b5b5c (diff)
parent95cfa1d46c61461bdadb195799a205b48b907a5e (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86
- Corrected some FSP-M/FSP-S settings for Chromebook Coral - ICH SPI driver and mrccache fixes for obtaining the SPI memory map - Fixed various warnings generated by latest version IASL when compiling ACPI tables
Diffstat (limited to 'arch/x86/lib')
-rw-r--r--arch/x86/lib/mrccache.c35
-rw-r--r--arch/x86/lib/spl.c4
2 files changed, 27 insertions, 12 deletions
diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c
index 21c71e036e..f181e8100c 100644
--- a/arch/x86/lib/mrccache.c
+++ b/arch/x86/lib/mrccache.c
@@ -233,6 +233,7 @@ int mrccache_get_region(enum mrc_type_t type, struct udevice **devp,
ulong map_base;
uint map_size;
uint offset;
+ ofnode node;
u32 reg[2];
int ret;
@@ -242,23 +243,36 @@ int mrccache_get_region(enum mrc_type_t type, struct udevice **devp,
* memory map cannot be read.
*/
ret = uclass_find_first_device(UCLASS_SPI_FLASH, &dev);
- if (!ret && !dev)
+ if (ret || !dev) {
+ /*
+ * Fall back to searching the device tree since driver model
+ * may not be ready yet (e.g. with FSPv1)
+ */
+ node = ofnode_by_compatible(ofnode_null(), "jedec,spi-nor");
+ if (!ofnode_valid(node))
+ return log_msg_ret("Cannot find SPI flash\n", -ENOENT);
ret = -ENODEV;
- if (ret)
- return log_msg_ret("Cannot find SPI flash\n", ret);
- ret = dm_spi_get_mmap(dev, &map_base, &map_size, &offset);
- if (!ret) {
- entry->base = map_base;
} else {
- ret = dev_read_u32_array(dev, "memory-map", reg, 2);
+ ret = dm_spi_get_mmap(dev, &map_base, &map_size, &offset);
+ if (!ret)
+ entry->base = map_base;
+ node = dev_ofnode(dev);
+ }
+
+ /*
+ * At this point we have entry->base if ret == 0. If not, then we have
+ * the node and can look for memory-map
+ */
+ if (ret) {
+ ret = ofnode_read_u32_array(node, "memory-map", reg, 2);
if (ret)
return log_msg_ret("Cannot find memory map\n", ret);
entry->base = reg[0];
}
/* Find the place where we put the MRC cache */
- mrc_node = dev_read_subnode(dev, type == MRC_TYPE_NORMAL ?
- "rw-mrc-cache" : "rw-var-mrc-cache");
+ mrc_node = ofnode_find_subnode(node, type == MRC_TYPE_NORMAL ?
+ "rw-mrc-cache" : "rw-var-mrc-cache");
if (!ofnode_valid(mrc_node))
return log_msg_ret("Cannot find node", -EPERM);
@@ -271,7 +285,8 @@ int mrccache_get_region(enum mrc_type_t type, struct udevice **devp,
if (devp)
*devp = dev;
debug("MRC cache type %d in '%s', offset %x, len %x, base %x\n",
- type, dev->name, entry->offset, entry->length, entry->base);
+ type, dev ? dev->name : ofnode_get_name(node), entry->offset,
+ entry->length, entry->base);
return 0;
}
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index b6f9a70ba7..cf22fa2d7b 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -164,8 +164,8 @@ void board_init_f(ulong flags)
ret = x86_spl_init();
if (ret) {
- debug("Error %d\n", ret);
- panic("x86_spl_init fail");
+ printf("x86_spl_init: error %d\n", ret);
+ hang();
}
#if IS_ENABLED(CONFIG_TPL) || IS_ENABLED(CONFIG_SYS_COREBOOT)
gd->bd = malloc(sizeof(*gd->bd));