* [PATCH 01/10] metag: init common clk and use "core" clk
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 02/10] metag: log core and timer frequencies from arch code James Hogan
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel
Cc: James Hogan, Mike Turquette, Grant Likely, Rob Herring,
devicetree-discuss
If the common clock framework is enabled, call of_clk_init(NULL) in
time_init() to register device tree clocks with the clock framework.
After this time_init() calls a new function init_metag_clocks(), which
looks for a clock named "core" in the node compatible with "img,meta"
(usually the root node). If found the get_core_freq machine callback is
overridden to obtain the core clock frequency using that clock.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Mike Turquette <mturquette@linaro.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: devicetree-discuss@lists.ozlabs.org
---
Documentation/devicetree/bindings/metag/meta.txt | 30 +++++++++++++
arch/metag/include/asm/clock.h | 8 ++++
arch/metag/kernel/clock.c | 57 +++++++++++++++++++++++-
arch/metag/kernel/time.c | 14 +++++-
4 files changed, 106 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/metag/meta.txt
diff --git a/Documentation/devicetree/bindings/metag/meta.txt b/Documentation/devicetree/bindings/metag/meta.txt
new file mode 100644
index 0000000..f4457f5
--- /dev/null
+++ b/Documentation/devicetree/bindings/metag/meta.txt
@@ -0,0 +1,30 @@
+* Meta Processor Binding
+
+This binding specifies what properties must be available in the device tree
+representation of a Meta Processor Core, which is the root node in the tree.
+
+Required properties:
+
+ - compatible: Specifies the compatibility list for the Meta processor.
+ The type shall be <string> and the value shall include "img,meta".
+
+Optional properties:
+
+ - clocks: Clock consumer specifiers as described in
+ Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+ - clock-names: Clock consumer names as described in
+ Documentation/devicetree/bindings/clock/clock-bindings.txt.
+
+Clocks are identified by name. Valid clocks are:
+
+ - "core": The Meta core clock from which the Meta timers are derived.
+
+* Examples
+
+/ {
+ compatible = "toumaz,tz1090", "img,meta";
+
+ clocks = <&meta_core_clk>;
+ clock-names = "core";
+};
diff --git a/arch/metag/include/asm/clock.h b/arch/metag/include/asm/clock.h
index 3e2915a..ded4ab2 100644
--- a/arch/metag/include/asm/clock.h
+++ b/arch/metag/include/asm/clock.h
@@ -19,6 +19,8 @@
* core frequency will be determined like this:
* Meta 1: based on loops_per_jiffy.
* Meta 2: (EXPAND_TIMER_DIV + 1) MHz.
+ * If a "core" clock is provided by the device tree, it
+ * will override this function.
*/
struct meta_clock_desc {
unsigned long (*get_core_freq)(void);
@@ -27,6 +29,12 @@ struct meta_clock_desc {
extern struct meta_clock_desc _meta_clock;
/*
+ * Perform platform clock initialisation, reading clocks from device tree etc.
+ * Only accessible during boot.
+ */
+void init_metag_clocks(void);
+
+/*
* Set up the default clock, ensuring all callbacks are valid - only accessible
* during boot.
*/
diff --git a/arch/metag/kernel/clock.c b/arch/metag/kernel/clock.c
index defc840..8bfd6a5 100644
--- a/arch/metag/kernel/clock.c
+++ b/arch/metag/kernel/clock.c
@@ -8,8 +8,10 @@
* published by the Free Software Foundation.
*/
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <asm/param.h>
#include <asm/clock.h>
@@ -34,8 +36,61 @@ static unsigned long get_core_freq_default(void)
#endif
}
+static struct clk *clk_core;
+
+/* Clk based get_core_freq callback. */
+static unsigned long get_core_freq_clk(void)
+{
+ return clk_get_rate(clk_core);
+}
+
+/**
+ * init_metag_core_clock() - Set up core clock from devicetree.
+ *
+ * Checks to see if a "core" clock is provided in the device tree, and overrides
+ * the get_core_freq callback to use it.
+ */
+static void __init init_metag_core_clock(void)
+{
+ /*
+ * See if a core clock is provided by the devicetree (and
+ * registered by the init callback above).
+ */
+ struct device_node *node;
+ node = of_find_compatible_node(NULL, NULL, "img,meta");
+ if (!node) {
+ pr_warn("%s: no compatible img,meta DT node found\n",
+ __func__);
+ return;
+ }
+
+ clk_core = of_clk_get_by_name(node, "core");
+ if (IS_ERR(clk_core)) {
+ pr_warn("%s: no core clock found in DT\n",
+ __func__);
+ return;
+ }
+
+ /*
+ * Override the core frequency callback to use
+ * this clk.
+ */
+ _meta_clock.get_core_freq = get_core_freq_clk;
+}
+
+/**
+ * init_metag_clocks() - Set up clocks from devicetree.
+ *
+ * Set up important clocks from device tree. In particular any needed for clock
+ * sources.
+ */
+void __init init_metag_clocks(void)
+{
+ init_metag_core_clock();
+}
+
/**
- * setup_meta_clocks() - Set up the Meta clock.
+ * setup_meta_clocks() - Early set up of the Meta clock.
* @desc: Clock descriptor usually provided by machine description
*
* Ensures all callbacks are valid.
diff --git a/arch/metag/kernel/time.c b/arch/metag/kernel/time.c
index 17dc107..f1c8c53 100644
--- a/arch/metag/kernel/time.c
+++ b/arch/metag/kernel/time.c
@@ -5,11 +5,21 @@
*
*/
-#include <linux/init.h>
-
#include <clocksource/metag_generic.h>
+#include <linux/clk-provider.h>
+#include <linux/init.h>
+#include <asm/clock.h>
void __init time_init(void)
{
+#ifdef CONFIG_COMMON_CLK
+ /* Init clocks from device tree */
+ of_clk_init(NULL);
+#endif
+
+ /* Init meta clocks, particularly the core clock */
+ init_metag_clocks();
+
+ /* Set up the timer clock sources */
metag_generic_timer_init();
}
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 02/10] metag: log core and timer frequencies from arch code
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
2013-06-13 12:19 ` [PATCH 01/10] metag: init common clk and use "core" clk James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 03/10] metag/kernel/irq.c: Declare root_domain as static James Hogan
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: James Hogan, John Stultz, Thomas Gleixner
Log core clock and Meta timer frequencies during init in architecture
generic code, removing the need for equivalent log messages in SoC
specific code.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
arch/metag/kernel/clock.c | 2 ++
drivers/clocksource/metag_generic.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/arch/metag/kernel/clock.c b/arch/metag/kernel/clock.c
index 8bfd6a5..6339c9c 100644
--- a/arch/metag/kernel/clock.c
+++ b/arch/metag/kernel/clock.c
@@ -87,6 +87,8 @@ static void __init init_metag_core_clock(void)
void __init init_metag_clocks(void)
{
init_metag_core_clock();
+
+ pr_info("Core clock frequency: %lu Hz\n", get_coreclock());
}
/**
diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
index ade7513..6722f0e 100644
--- a/drivers/clocksource/metag_generic.c
+++ b/drivers/clocksource/metag_generic.c
@@ -184,6 +184,8 @@ int __init metag_generic_timer_init(void)
#ifdef CONFIG_METAG_META21
hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1);
#endif
+ pr_info("Timer frequency: %u Hz\n", hwtimer_freq);
+
clocksource_register_hz(&clocksource_metag, hwtimer_freq);
setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq);
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 03/10] metag/kernel/irq.c: Declare root_domain as static
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
2013-06-13 12:19 ` [PATCH 01/10] metag: init common clk and use "core" clk James Hogan
2013-06-13 12:19 ` [PATCH 02/10] metag: log core and timer frequencies from arch code James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 04/10] metag/asm/irq.h: Declare init_IRQ James Hogan
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
It is only referenced within the irq.c file, so restrict it's scope
as appropriate.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/kernel/irq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c
index 87707ef..d91b1e9 100644
--- a/arch/metag/kernel/irq.c
+++ b/arch/metag/kernel/irq.c
@@ -25,7 +25,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
#endif
-struct irq_domain *root_domain;
+static struct irq_domain *root_domain;
static unsigned int startup_meta_irq(struct irq_data *data)
{
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 04/10] metag/asm/irq.h: Declare init_IRQ
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (2 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 03/10] metag/kernel/irq.c: Declare root_domain as static James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 05/10] metag/mm/cache: Restrict scope for metag_lnkget_probe James Hogan
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Fixes the following sparce warning:
warning: symbol 'init_IRQ' was not declared. Should it be static?
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/include/asm/irq.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/metag/include/asm/irq.h b/arch/metag/include/asm/irq.h
index be0c8f3..ad6bd0e 100644
--- a/arch/metag/include/asm/irq.h
+++ b/arch/metag/include/asm/irq.h
@@ -17,6 +17,7 @@ struct pt_regs;
int tbisig_map(unsigned int hw);
extern void do_IRQ(int irq, struct pt_regs *regs);
+extern void init_IRQ(void);
#ifdef CONFIG_METAG_SUSPEND_MEM
int traps_save_context(void);
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 05/10] metag/mm/cache: Restrict scope for metag_lnkget_probe
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (3 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 04/10] metag/asm/irq.h: Declare init_IRQ James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 06/10] metag/setup: Restrict scope for the capabilities variable James Hogan
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Hide symbol since it's only used within the cache.c file
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/mm/cache.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/metag/mm/cache.c b/arch/metag/mm/cache.c
index b5d3b2e..a622852 100644
--- a/arch/metag/mm/cache.c
+++ b/arch/metag/mm/cache.c
@@ -45,7 +45,7 @@ static volatile u32 lnkget_testdata[16] __initdata __aligned(64);
#define LNKGET_CONSTANT 0xdeadbeef
-void __init metag_lnkget_probe(void)
+static void __init metag_lnkget_probe(void)
{
int temp;
long flags;
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 06/10] metag/setup: Restrict scope for the capabilities variable
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (4 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 05/10] metag/mm/cache: Restrict scope for metag_lnkget_probe James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 07/10] metag/processor.h: Add missing cpuinfo_op declaration James Hogan
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/kernel/setup.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index e18cebb..c396cd0 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -591,20 +591,20 @@ PTBI pTBI_get(unsigned int cpu)
EXPORT_SYMBOL(pTBI_get);
#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU)
-char capabilites[] = "dsp fpu";
+static char capabilities[] = "dsp fpu";
#elif defined(CONFIG_METAG_DSP)
-char capabilites[] = "dsp";
+static char capabilities[] = "dsp";
#elif defined(CONFIG_METAG_FPU)
-char capabilites[] = "fpu";
+static char capabilities[] = "fpu";
#else
-char capabilites[] = "";
+static char capabilities[] = "";
#endif
static struct ctl_table caps_kern_table[] = {
{
.procname = "capabilities",
- .data = capabilites,
- .maxlen = sizeof(capabilites),
+ .data = capabilities,
+ .maxlen = sizeof(capabilities),
.mode = 0444,
.proc_handler = proc_dostring,
},
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 07/10] metag/processor.h: Add missing cpuinfo_op declaration.
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (5 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 06/10] metag/setup: Restrict scope for the capabilities variable James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 08/10] metag/traps: Mark die() as __noreturn to match the declaration James Hogan
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/include/asm/processor.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h
index 9b029a7..f16477d 100644
--- a/arch/metag/include/asm/processor.h
+++ b/arch/metag/include/asm/processor.h
@@ -199,4 +199,6 @@ extern void (*soc_halt)(void);
extern void show_trace(struct task_struct *tsk, unsigned long *sp,
struct pt_regs *regs);
+extern const struct seq_operations cpuinfo_op;
+
#endif
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 08/10] metag/traps: Mark die() as __noreturn to match the declaration.
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (6 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 07/10] metag/processor.h: Add missing cpuinfo_op declaration James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 09/10] metag/traps: include setup.h for the per_cpu_trap_init declaration James Hogan
2013-06-13 12:19 ` [PATCH 10/10] metag/.gitignore: Extend the *.dtb pattern to match the dtb.S files James Hogan
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/include/asm/bug.h | 4 ++--
arch/metag/kernel/traps.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/metag/include/asm/bug.h b/arch/metag/include/asm/bug.h
index d04b48c..9f8967f 100644
--- a/arch/metag/include/asm/bug.h
+++ b/arch/metag/include/asm/bug.h
@@ -6,7 +6,7 @@
struct pt_regs;
extern const char *trap_name(int trapno);
-extern void die(const char *str, struct pt_regs *regs, long err,
- unsigned long addr) __attribute__ ((noreturn));
+extern void __noreturn die(const char *str, struct pt_regs *regs, long err,
+ unsigned long addr);
#endif
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 2ceeaae..a7051de 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -87,8 +87,8 @@ const char *trap_name(int trapno)
static DEFINE_SPINLOCK(die_lock);
-void die(const char *str, struct pt_regs *regs, long err,
- unsigned long addr)
+void __noreturn die(const char *str, struct pt_regs *regs,
+ long err, unsigned long addr)
{
static int die_counter;
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 09/10] metag/traps: include setup.h for the per_cpu_trap_init declaration
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (7 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 08/10] metag/traps: Mark die() as __noreturn to match the declaration James Hogan
@ 2013-06-13 12:19 ` James Hogan
2013-06-13 12:19 ` [PATCH 10/10] metag/.gitignore: Extend the *.dtb pattern to match the dtb.S files James Hogan
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/kernel/traps.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index a7051de..c00ade0 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -33,6 +33,7 @@
#include <asm/siginfo.h>
#include <asm/traps.h>
#include <asm/hwthread.h>
+#include <asm/setup.h>
#include <asm/switch.h>
#include <asm/user_gateway.h>
#include <asm/syscall.h>
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH 10/10] metag/.gitignore: Extend the *.dtb pattern to match the dtb.S files
2013-06-13 12:19 [PATCH 00/10] metag: various patches for v3.11 James Hogan
` (8 preceding siblings ...)
2013-06-13 12:19 ` [PATCH 09/10] metag/traps: include setup.h for the per_cpu_trap_init declaration James Hogan
@ 2013-06-13 12:19 ` James Hogan
9 siblings, 0 replies; 11+ messages in thread
From: James Hogan @ 2013-06-13 12:19 UTC (permalink / raw)
To: linux-kernel; +Cc: Markos Chandras, James Hogan
From: Markos Chandras <markos.chandras@imgtec.com>
The .SECONDARY rule for generating the *.dtb.S files added in
0b4184c26b18ecbc0ec0657f514b087c3a6216fb
"metag: avoid unnecessary builtin dtb rebuilds"
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/boot/.gitignore | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/metag/boot/.gitignore b/arch/metag/boot/.gitignore
index a021da2..2d6c0c1 100644
--- a/arch/metag/boot/.gitignore
+++ b/arch/metag/boot/.gitignore
@@ -1,4 +1,4 @@
vmlinux*
uImage*
ramdisk.*
-*.dtb
+*.dtb*
--
1.8.1.2
^ permalink raw reply [flat|nested] 11+ messages in thread