diff options
Diffstat (limited to 'drivers/mfd/vexpress-sysreg.c')
-rw-r--r-- | drivers/mfd/vexpress-sysreg.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index e5d8f63b252a..77048b18439e 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c | |||
@@ -313,19 +313,11 @@ static void vexpress_sysreg_config_complete(unsigned long data) | |||
313 | } | 313 | } |
314 | 314 | ||
315 | 315 | ||
316 | void __init vexpress_sysreg_early_init(void __iomem *base) | 316 | void __init vexpress_sysreg_setup(struct device_node *node) |
317 | { | 317 | { |
318 | struct device_node *node = of_find_compatible_node(NULL, NULL, | 318 | if (WARN_ON(!vexpress_sysreg_base)) |
319 | "arm,vexpress-sysreg"); | ||
320 | |||
321 | if (node) | ||
322 | base = of_iomap(node, 0); | ||
323 | |||
324 | if (WARN_ON(!base)) | ||
325 | return; | 319 | return; |
326 | 320 | ||
327 | vexpress_sysreg_base = base; | ||
328 | |||
329 | if (readl(vexpress_sysreg_base + SYS_MISC) & SYS_MISC_MASTERSITE) | 321 | if (readl(vexpress_sysreg_base + SYS_MISC) & SYS_MISC_MASTERSITE) |
330 | vexpress_master_site = VEXPRESS_SITE_DB2; | 322 | vexpress_master_site = VEXPRESS_SITE_DB2; |
331 | else | 323 | else |
@@ -336,9 +328,23 @@ void __init vexpress_sysreg_early_init(void __iomem *base) | |||
336 | WARN_ON(!vexpress_sysreg_config_bridge); | 328 | WARN_ON(!vexpress_sysreg_config_bridge); |
337 | } | 329 | } |
338 | 330 | ||
331 | void __init vexpress_sysreg_early_init(void __iomem *base) | ||
332 | { | ||
333 | vexpress_sysreg_base = base; | ||
334 | vexpress_sysreg_setup(NULL); | ||
335 | } | ||
336 | |||
339 | void __init vexpress_sysreg_of_early_init(void) | 337 | void __init vexpress_sysreg_of_early_init(void) |
340 | { | 338 | { |
341 | vexpress_sysreg_early_init(NULL); | 339 | struct device_node *node = of_find_compatible_node(NULL, NULL, |
340 | "arm,vexpress-sysreg"); | ||
341 | |||
342 | if (node) { | ||
343 | vexpress_sysreg_base = of_iomap(node, 0); | ||
344 | vexpress_sysreg_setup(node); | ||
345 | } else { | ||
346 | pr_info("vexpress-sysreg: No Device Tree node found."); | ||
347 | } | ||
342 | } | 348 | } |
343 | 349 | ||
344 | 350 | ||
@@ -426,9 +432,11 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) | |||
426 | return -EBUSY; | 432 | return -EBUSY; |
427 | } | 433 | } |
428 | 434 | ||
429 | if (!vexpress_sysreg_base) | 435 | if (!vexpress_sysreg_base) { |
430 | vexpress_sysreg_base = devm_ioremap(&pdev->dev, res->start, | 436 | vexpress_sysreg_base = devm_ioremap(&pdev->dev, res->start, |
431 | resource_size(res)); | 437 | resource_size(res)); |
438 | vexpress_sysreg_setup(pdev->dev.of_node); | ||
439 | } | ||
432 | 440 | ||
433 | if (!vexpress_sysreg_base) { | 441 | if (!vexpress_sysreg_base) { |
434 | dev_err(&pdev->dev, "Failed to obtain base address!\n"); | 442 | dev_err(&pdev->dev, "Failed to obtain base address!\n"); |