* [PATCH 1/2] clk: bcm2835: register clocks early
2016-05-20 7:23 [PATCH 0/2] ARM: bcm2835: probe clock and sdram driver early kernel at martin.sperl.org
@ 2016-05-20 7:23 ` kernel at martin.sperl.org
2016-05-20 7:23 ` [PATCH 2/2] memory: bcm2835: enable driver early in the boot process kernel at martin.sperl.org
1 sibling, 0 replies; 3+ messages in thread
From: kernel at martin.sperl.org @ 2016-05-20 7:23 UTC (permalink / raw)
To: linux-arm-kernel
From: Martin Sperl <kernel@martin.sperl.org>
Register the clocks early during the boot process,
so that special/critical clocks can get enabled early on
in the boot process avoiding the risk of disabling a clock,
pll_divider or pll when a claiming driver fails to install
propperly - maybe it needs to defer.
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
---
drivers/clk/bcm/clk-bcm2835.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 085e521..6aaeab4 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -1825,6 +1825,7 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
const struct bcm2835_clk_desc *desc;
const size_t asize = ARRAY_SIZE(clk_desc_array);
size_t i;
+ int err;
cprman = devm_kzalloc(dev,
sizeof(*cprman) + asize * sizeof(*clks),
@@ -1855,8 +1856,15 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
clks[i] = desc->clk_register(cprman, desc->data);
}
- return of_clk_add_provider(dev->of_node, of_clk_src_onecell_get,
- &cprman->onecell);
+ err = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get,
+ &cprman->onecell);
+ if (err)
+ return err;
+
+ /* note that we have registered all the clocks */
+ dev_dbg(dev, "registered %d clocks\n", asize);
+
+ return 0;
}
static const struct of_device_id bcm2835_clk_of_match[] = {
@@ -1873,7 +1881,11 @@ static struct platform_driver bcm2835_clk_driver = {
.probe = bcm2835_clk_probe,
};
-builtin_platform_driver(bcm2835_clk_driver);
+static int __init __bcm2835_clk_driver_init(void)
+{
+ return platform_driver_register(&bcm2835_clk_driver);
+}
+core_initcall(__bcm2835_clk_driver_init);
MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
MODULE_DESCRIPTION("BCM2835 clock driver");
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] memory: bcm2835: enable driver early in the boot process
2016-05-20 7:23 [PATCH 0/2] ARM: bcm2835: probe clock and sdram driver early kernel at martin.sperl.org
2016-05-20 7:23 ` [PATCH 1/2] clk: bcm2835: register clocks early kernel at martin.sperl.org
@ 2016-05-20 7:23 ` kernel at martin.sperl.org
1 sibling, 0 replies; 3+ messages in thread
From: kernel at martin.sperl.org @ 2016-05-20 7:23 UTC (permalink / raw)
To: linux-arm-kernel
From: Martin Sperl <kernel@martin.sperl.org>
Enable the critical sdram-clocks early during the boot process,
so that these clocks (and their PLLs) can not get disabled
when a different driver disables its clocks again because
it failed to probe propperly (maybe deferred).
Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
---
drivers/memory/bcm2835-sdram.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/memory/bcm2835-sdram.c b/drivers/memory/bcm2835-sdram.c
index 9d8cce2..7b6406d 100644
--- a/drivers/memory/bcm2835-sdram.c
+++ b/drivers/memory/bcm2835-sdram.c
@@ -431,6 +431,9 @@ static int bcm2835_sdram_probe(struct platform_device *pdev)
/* setup debugfs */
bcm2835_sdram_debugfs(pdev);
+ /* note that we have registered sdram */
+ dev_dbg(&pdev->dev, "registered sdram\n");
+
return 0;
}
@@ -457,7 +460,12 @@ static struct platform_driver bcm2835_sdram_driver = {
.of_match_table = bcm2835_sdram_of_match_table,
},
};
-module_platform_driver(bcm2835_sdram_driver);
+
+static int __init __bcm2835_sdram_driver_init(void)
+{
+ return platform_driver_register(&bcm2835_sdram_driver);
+}
+core_initcall_sync(__bcm2835_sdram_driver_init);
MODULE_AUTHOR("Martin Sperl");
MODULE_DESCRIPTION("sdram driver for bcm2835 chip");
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread