All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: at91: Add support for configurable main clock frequency.
@ 2012-03-01 15:14 Boris BREZILLON
  2012-03-01 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 2+ messages in thread
From: Boris BREZILLON @ 2012-03-01 15:14 UTC (permalink / raw)
  To: linux-arm-kernel

This patch provides main clock frequency configuration from device tree
definition.

If the "main-clock" attribute of pmc node is not specified it takes
12MHz as default value.

With this patch we can add board support using a different main clock
frequency (our custom board is using a 18,432MHz main clock).

---
 arch/arm/boot/dts/at91sam9g20.dtsi |    5 +++++
 arch/arm/mach-at91/board-dt.c      |   21 ++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9g20.dtsi
b/arch/arm/boot/dts/at91sam9g20.dtsi
index 07603b8..da253b2 100644
--- a/arch/arm/boot/dts/at91sam9g20.dtsi
+++ b/arch/arm/boot/dts/at91sam9g20.dtsi
@@ -46,6 +46,11 @@
 			#size-cells = <1>;
 			ranges;

+			pmc {
+				compatible = "atmel,at91-pmc";
+				reg = <0xfffffc00 0x100>;
+			};
+
 			aic: interrupt-controller at fffff000 {
 				#interrupt-cells = <1>;
 				compatible = "atmel,at91rm9200-aic";
diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c
index bb6b434..c64a3b0 100644
--- a/arch/arm/mach-at91/board-dt.c
+++ b/arch/arm/mach-at91/board-dt.c
@@ -33,11 +33,30 @@
 #include "sam9_smc.h"
 #include "generic.h"

+static const struct of_device_id pmc_of_match[] __initconst = {
+	{ .compatible = "atmel,at91-pmc" },
+	{},
+};

 static void __init ek_init_early(void)
 {
+	struct device_node *node;
+	unsigned long main_clock = 12000000;
+
+	node = of_find_matching_node(NULL, pmc_of_match);
+
+	if (node) {
+		const __be32 *ip;
+		ip = of_get_property(node, "main-clock", NULL);
+		if (ip) {
+			main_clock = be32_to_cpup(ip);
+		}
+		of_node_put(node);
+	}
+
+
 	/* Initialize processor: 12.000 MHz crystal */
-	at91_initialize(12000000);
+	at91_initialize(main_clock);

 	/* DGBU on ttyS0. (Rx & Tx only) */
 	at91_register_uart(0, 0, 0);
-- 
1.7.0.4

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

* [PATCH] ARM: at91: Add support for configurable main clock frequency.
  2012-03-01 15:14 [PATCH] ARM: at91: Add support for configurable main clock frequency Boris BREZILLON
@ 2012-03-01 16:02 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-03-01 16:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 16:14 Thu 01 Mar     , Boris BREZILLON wrote:
> This patch provides main clock frequency configuration from device tree
> definition.
> 
> If the "main-clock" attribute of pmc node is not specified it takes
> 12MHz as default value.
> 
> With this patch we can add board support using a different main clock
> frequency (our custom board is using a 18,432MHz main clock).
> 
This is not the right way you need to define a fixed clock

and the pmc is at91rm9200 compatible

You did do the Documentation either

wait a few I'll send it's support

Best Regards,
J.

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

end of thread, other threads:[~2012-03-01 16:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 15:14 [PATCH] ARM: at91: Add support for configurable main clock frequency Boris BREZILLON
2012-03-01 16:02 ` Jean-Christophe PLAGNIOL-VILLARD

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.