From: kernel@martin.sperl.org To: Michael Turquette <mturquette@baylibre.com>, Stephen Boyd <sboyd@codeaurora.org>, Stephen Warren <swarren@wwwdotorg.org>, Lee Jones <lee@kernel.org>, Eric Anholt <eric@anholt.net>, linux-clk@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Martin Sperl <kernel@martin.sperl.org> Subject: [PATCH 1/2] clk: bcm2835: register clocks early Date: Fri, 20 May 2016 07:23:16 +0000 [thread overview] Message-ID: <1463728997-8241-2-git-send-email-kernel@martin.sperl.org> (raw) In-Reply-To: <1463728997-8241-1-git-send-email-kernel@martin.sperl.org> 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
WARNING: multiple messages have this Message-ID (diff)
From: kernel@martin.sperl.org (kernel at martin.sperl.org) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] clk: bcm2835: register clocks early Date: Fri, 20 May 2016 07:23:16 +0000 [thread overview] Message-ID: <1463728997-8241-2-git-send-email-kernel@martin.sperl.org> (raw) In-Reply-To: <1463728997-8241-1-git-send-email-kernel@martin.sperl.org> 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
next prev parent reply other threads:[~2016-05-20 7:23 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-05-20 7:23 [PATCH 0/2] ARM: bcm2835: probe clock and sdram driver early kernel 2016-05-20 7:23 ` kernel at martin.sperl.org 2016-05-20 7:23 ` kernel [this message] 2016-05-20 7:23 ` [PATCH 1/2] clk: bcm2835: register clocks early kernel at martin.sperl.org 2016-05-20 7:23 ` [PATCH 2/2] memory: bcm2835: enable driver early in the boot process kernel 2016-05-20 7:23 ` kernel at martin.sperl.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1463728997-8241-2-git-send-email-kernel@martin.sperl.org \ --to=kernel@martin.sperl.org \ --cc=eric@anholt.net \ --cc=lee@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-clk@vger.kernel.org \ --cc=linux-rpi-kernel@lists.infradead.org \ --cc=mturquette@baylibre.com \ --cc=sboyd@codeaurora.org \ --cc=swarren@wwwdotorg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.