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 <kernel@martin.sperl.org>

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 <dave.stevenson@raspberrypi.org>

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: https://github.com/raspberrypi/linux/issues/3291
     https://github.com/raspberrypi/linux/pull/3297

Signed-off-by: Luke Hinds <lhinds@redhat.com>
Co-authored-by: Phil Elwell <phil@raspberrypi.org>

clk-bcm2835: use subsys_initcall for the clock driver when IMA is enabled

Co-authored-by: Davide Scovotto <scovottodavide@gmail.com>
Co-developed-by: Davide Scovotto <scovottodavide@gmail.com>
Signed-off-by: Davide Scovotto <scovottodavide@gmail.com>
Signed-off-by: Alberto Solavagione <albertosolavagione30@gmail.com>
This commit is contained in:
Martin Sperl
2016-09-02 16:45:27 +01:00
committed by Dom Cobley
parent d0b3be16b5
commit 583428b488

View File

@@ -2324,8 +2324,15 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
if (ret)
return ret;
return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
ret = of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
&cprman->onecell);
if (ret)
return ret;
/* note that we have registered all the clocks */
dev_dbg(dev, "registered %zd clocks\n", asize);
return 0;
}
static const struct cprman_plat_data cprman_bcm2835_plat_data = {
@@ -2351,7 +2358,15 @@ 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);
}
#ifdef CONFIG_IMA
subsys_initcall(__bcm2835_clk_driver_init);
#else
postcore_initcall(__bcm2835_clk_driver_init);
#endif
MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
MODULE_DESCRIPTION("BCM2835 clock driver");