Skip to content

Commit 991db77

Browse files
msperldavinat0r
authored andcommitted
clk: clk-bcm2835: 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 <[email protected]> clk: clk-bcm2835: Use %zd when printing size_t The debug text for how many clocks have been registered uses "%d" with a size_t. Correct it to "%zd". Signed-off-by: Dave Stevenson <[email protected]> Initialise rpi-firmware before clk-bcm2835 The IMA (Integrity Measurement Architecture) looks for a TPM (Trusted Platform Module) having been registered when it initialises; otherwise it assumes there is no TPM. It has been observed on BCM2835 that IMA is initialised before TPM, and that initialising the BCM2835 clock driver before the firmware driver has the effect of reversing this order. Change the firmware driver to initialise at core_initcall, delaying the BCM2835 clock driver to postcore_initcall. See: #3291 #3297 Signed-off-by: Luke Hinds <[email protected]> Co-authored-by: Phil Elwell <[email protected]> clk-bcm2835: use subsys_initcall for the clock driver when IMA is enabled Co-authored-by: Davide Scovotto <[email protected]> Co-developed-by: Davide Scovotto <[email protected]> Signed-off-by: Davide Scovotto <[email protected]> Signed-off-by: Alberto Solavagione <[email protected]>
1 parent d292cd8 commit 991db77

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

drivers/clk/bcm/clk-bcm2835.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,8 +2319,15 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
23192319
if (ret)
23202320
return ret;
23212321

2322-
return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
2322+
ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
23232323
&cprman->onecell);
2324+
if (ret)
2325+
return ret;
2326+
2327+
/* note that we have registered all the clocks */
2328+
dev_dbg(dev, "registered %zd clocks\n", asize);
2329+
2330+
return 0;
23242331
}
23252332

23262333
static const struct cprman_plat_data cprman_bcm2835_plat_data = {
@@ -2346,7 +2353,15 @@ static struct platform_driver bcm2835_clk_driver = {
23462353
.probe = bcm2835_clk_probe,
23472354
};
23482355

2349-
builtin_platform_driver(bcm2835_clk_driver);
2356+
static int __init __bcm2835_clk_driver_init(void)
2357+
{
2358+
return platform_driver_register(&bcm2835_clk_driver);
2359+
}
2360+
#ifdef CONFIG_IMA
2361+
subsys_initcall(__bcm2835_clk_driver_init);
2362+
#else
2363+
postcore_initcall(__bcm2835_clk_driver_init);
2364+
#endif
23502365

23512366
MODULE_AUTHOR("Eric Anholt <[email protected]>");
23522367
MODULE_DESCRIPTION("BCM2835 clock driver");

0 commit comments

Comments
 (0)