--- zzzz-none-000/linux-4.4.271/drivers/of/platform.c 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/drivers/of/platform.c 2023-04-19 10:22:29.000000000 +0000 @@ -21,6 +21,7 @@ #include #include #include +#include #include const struct of_device_id of_default_bus_match_table[] = { @@ -185,6 +186,7 @@ dev->dev.platform_data = platform_data; of_dma_configure(&dev->dev, dev->dev.of_node); of_msi_configure(&dev->dev, dev->dev.of_node); + of_reserved_mem_device_init(&dev->dev); if (of_device_add(dev) != 0) { of_dma_deconfigure(&dev->dev); @@ -470,6 +472,31 @@ } EXPORT_SYMBOL_GPL(of_platform_default_populate); +static int __init of_platform_default_populate_init(void) +{ + struct device_node *node; + + if (!of_have_populated_dt()) + return -ENODEV; + + /* + * Handle ramoops explicitly, since it is inside /reserved-memory, + * which lacks a "compatible" property. + */ + node = of_find_node_by_path("/reserved-memory"); + if (node) { + node = of_find_compatible_node(node, NULL, "ramoops"); + if (node) + of_platform_device_create(node, NULL, NULL); + } + + /* Populate everything else. */ + of_platform_default_populate(NULL, NULL, NULL); + + return 0; +} +arch_initcall_sync(of_platform_default_populate_init); + static int of_platform_device_destroy(struct device *dev, void *data) { /* Do not touch devices not populated from the device tree */