aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/mach-sdk7786
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-19 05:38:36 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-01-19 05:38:36 -0500
commitc8098218271d19e7123d8b9137b9a4b87e5ffec0 (patch)
tree9b64d3b25bf34c6e6270aa17a5cc6275626a170c /arch/sh/boards/mach-sdk7786
parent43a1839cb1e0e0ed08b8ace0adb3716865fd0c4c (diff)
sh: mach-sdk7786: Detect/configure/propagate EXTAL.
This uses the mode pins exposed through the FPGA to work out whether we're driven from EXTAL or not and does the appropriate setup and propagation through the clock framework. This will also -EINVAL out for anyone adding in their own oscillators, forcing proper configuration with the clock framework instead of proceeding on with bogus clock values. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/mach-sdk7786')
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index c38c6cc293b5..0e4b1c39742c 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -14,6 +14,7 @@
14#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/clk.h>
17#include <asm/machvec.h> 18#include <asm/machvec.h>
18#include <asm/heartbeat.h> 19#include <asm/heartbeat.h>
19#include <asm/sizes.h> 20#include <asm/sizes.h>
@@ -235,6 +236,27 @@ static int sdk7786_mode_pins(void)
235 return pin_states; 236 return pin_states;
236} 237}
237 238
239static int sdk7786_clk_init(void)
240{
241 struct clk *clk;
242 int ret;
243
244 /*
245 * Only handle the EXTAL case, anyone interfacing a crystal
246 * resonator will need to provide their own input clock.
247 */
248 if (test_mode_pin(MODE_PIN9))
249 return -EINVAL;
250
251 clk = clk_get(NULL, "extal");
252 if (!clk || IS_ERR(clk))
253 return PTR_ERR(clk);
254 ret = clk_set_rate(clk, 33333333);
255 clk_put(clk);
256
257 return ret;
258}
259
238/* Initialize the board */ 260/* Initialize the board */
239static void __init sdk7786_setup(char **cmdline_p) 261static void __init sdk7786_setup(char **cmdline_p)
240{ 262{
@@ -248,5 +270,6 @@ static struct sh_machine_vector mv_sdk7786 __initmv = {
248 .mv_name = "SDK7786", 270 .mv_name = "SDK7786",
249 .mv_setup = sdk7786_setup, 271 .mv_setup = sdk7786_setup,
250 .mv_mode_pins = sdk7786_mode_pins, 272 .mv_mode_pins = sdk7786_mode_pins,
273 .mv_clk_init = sdk7786_clk_init,
251 .mv_init_irq = init_sdk7786_IRQ, 274 .mv_init_irq = init_sdk7786_IRQ,
252}; 275};