All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ARM: bcm2835: probe clock and sdram driver early
@ 2016-05-20  7:23 ` kernel at martin.sperl.org
  0 siblings, 0 replies; 6+ messages in thread
From: kernel @ 2016-05-20  7:23 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Stephen Warren, Lee Jones,
	Eric Anholt, linux-clk, linux-rpi-kernel, linux-arm-kernel
  Cc: Martin Sperl

From: Martin Sperl <kernel@martin.sperl.org>

Probe the clock and sdram driver early during the boot process.
This is done to minimize the risk that the PLLD_CORE0 or PLLD
clocks get disabled by another driver.

Such a situation results in the SDRAM stopping to work, which
we can trigger easily with current kernels when there are only a
few clocks enabled.

Right now both drivers are registered with core_initcall.
I am unsure if there is any link-ordering that could
impact us - if such is the case we will need to move the
priorities of one of the drivers slightly. Recommendations?

Note that this patchset requires the sdram memory driver patch
to be applied first.

Martin Sperl (2):
  clk: bcm2835: register clocks early
  memory: bcm2835: enable driver early in the boot process

 drivers/clk/bcm/clk-bcm2835.c  | 18 +++++++++++++++---
 drivers/memory/bcm2835-sdram.c | 10 +++++++++-
 2 files changed, 24 insertions(+), 4 deletions(-)

--
2.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 0/2] ARM: bcm2835: probe clock and sdram driver early
@ 2016-05-20  7:23 ` kernel at martin.sperl.org
  0 siblings, 0 replies; 6+ 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>

Probe the clock and sdram driver early during the boot process.
This is done to minimize the risk that the PLLD_CORE0 or PLLD
clocks get disabled by another driver.

Such a situation results in the SDRAM stopping to work, which
we can trigger easily with current kernels when there are only a
few clocks enabled.

Right now both drivers are registered with core_initcall.
I am unsure if there is any link-ordering that could
impact us - if such is the case we will need to move the
priorities of one of the drivers slightly. Recommendations?

Note that this patchset requires the sdram memory driver patch
to be applied first.

Martin Sperl (2):
  clk: bcm2835: register clocks early
  memory: bcm2835: enable driver early in the boot process

 drivers/clk/bcm/clk-bcm2835.c  | 18 +++++++++++++++---
 drivers/memory/bcm2835-sdram.c | 10 +++++++++-
 2 files changed, 24 insertions(+), 4 deletions(-)

--
2.1.4

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] clk: bcm2835: register clocks early
  2016-05-20  7:23 ` kernel at martin.sperl.org
@ 2016-05-20  7:23   ` kernel at martin.sperl.org
  -1 siblings, 0 replies; 6+ messages in thread
From: kernel @ 2016-05-20  7:23 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Stephen Warren, Lee Jones,
	Eric Anholt, linux-clk, linux-rpi-kernel, linux-arm-kernel
  Cc: Martin Sperl

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] 6+ messages in thread

* [PATCH 1/2] clk: bcm2835: register clocks early
@ 2016-05-20  7:23   ` kernel at martin.sperl.org
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

* [PATCH 2/2] memory: bcm2835: enable driver early in the boot process
  2016-05-20  7:23 ` kernel at martin.sperl.org
@ 2016-05-20  7:23   ` kernel at martin.sperl.org
  -1 siblings, 0 replies; 6+ messages in thread
From: kernel @ 2016-05-20  7:23 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Stephen Warren, Lee Jones,
	Eric Anholt, linux-clk, linux-rpi-kernel, linux-arm-kernel
  Cc: Martin Sperl

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] 6+ messages in thread

* [PATCH 2/2] memory: bcm2835: enable driver early in the boot process
@ 2016-05-20  7:23   ` kernel at martin.sperl.org
  0 siblings, 0 replies; 6+ 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] 6+ messages in thread

end of thread, other threads:[~2016-05-20  7:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] clk: bcm2835: register clocks early kernel
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
2016-05-20  7:23   ` kernel at martin.sperl.org

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.