summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2019-03-15 10:14:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-03-18 09:43:35 +0100
commit9aaf4e218dc47caaf93edafe9ec60efe3dc90fd6 (patch)
treeee3b783b5780af22b00ee08a21115cb4585a2710 /fs
parent60fd7d3c2bb90e6980a3889903963b09a1ab98cc (diff)
downloadbarebox-9aaf4e218dc47caaf93edafe9ec60efe3dc90fd6.tar.gz
barebox-9aaf4e218dc47caaf93edafe9ec60efe3dc90fd6.tar.xz
ramoops: probe from device tree if OFTREE is enabled
Switch to a device driver probed from device tree if CONFIG_OFTREE is enabled. Also switch from postcore_initcall to device_initcall, to make sure that memory banks have been initialized before request_sdram_region is called. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/ram.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index fdd92a60a5..fe65959791 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -349,8 +349,9 @@ static int ramoops_init_prz(struct ramoops_context *cxt,
return 0;
}
-static int ramoops_probe(struct ramoops_platform_data *pdata)
+static int ramoops_probe(struct device_d *dev)
{
+ struct ramoops_platform_data *pdata = dummy_data;
struct ramoops_context *cxt = &oops_cxt;
size_t dump_mem_sz;
phys_addr_t paddr;
@@ -498,12 +499,39 @@ static void ramoops_register_dummy(void)
*/
dummy_data->ecc_info.ecc_size = ramoops_ecc == 1 ? 16 : ramoops_ecc;
- ramoops_probe(dummy_data);
+ if (!IS_ENABLED(CONFIG_OFTREE))
+ ramoops_probe(NULL);
}
+static const struct of_device_id ramoops_dt_ids[] = {
+ { .compatible = "ramoops" },
+ { },
+};
+
+static struct driver_d ramoops_driver = {
+ .name = "ramoops",
+ .probe = ramoops_probe,
+ .of_compatible = DRV_OF_COMPAT(ramoops_dt_ids),
+};
+
static int __init ramoops_init(void)
{
+ if (IS_ENABLED(CONFIG_OFTREE)) {
+ struct device_node *node;
+
+ node = of_get_root_node();
+ if (!node)
+ return 0;
+
+ node = of_get_child_by_name(node, "reserved-memory");
+ if (!node)
+ return 0;
+
+ for_each_matching_node(node, ramoops_dt_ids)
+ of_platform_device_create(node, NULL);
+ }
+
ramoops_register_dummy();
- return 0;
+ return platform_driver_register(&ramoops_driver);
}
-postcore_initcall(ramoops_init);
+device_initcall(ramoops_init);