Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
[pandora-kernel.git] / arch / xtensa / platforms / s6105 / setup.c
1 /*
2  * s6105 control routines
3  *
4  * Copyright (c) 2009 emlix GmbH
5  */
6 #include <linux/irq.h>
7 #include <linux/io.h>
8 #include <linux/gpio.h>
9
10 #include <asm/bootparam.h>
11
12 #include <variant/hardware.h>
13 #include <platform/gpio.h>
14
15 void platform_halt(void)
16 {
17         local_irq_disable();
18         while (1)
19                 ;
20 }
21
22 void platform_power_off(void)
23 {
24         platform_halt();
25 }
26
27 void platform_restart(void)
28 {
29         platform_halt();
30 }
31
32 void __init platform_setup(char **cmdline)
33 {
34         unsigned long reg;
35
36         reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
37         reg &= ~(1 << S6_GREG1_BLOCK_SB);
38         writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
39
40         reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
41         reg |= 1 << S6_GREG1_BLOCK_SB;
42         writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
43
44         printk(KERN_NOTICE "S6105 on Stretch S6000 - "
45                 "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
46 }
47
48 void __init platform_init(bp_tag_t *first)
49 {
50         gpio_request(GPIO_LED1_NGREEN, "led1_green");
51         gpio_request(GPIO_LED1_RED, "led1_red");
52         gpio_direction_output(GPIO_LED1_NGREEN, 1);
53 }
54
55 void platform_heartbeat(void)
56 {
57         static unsigned int c;
58
59         if (!(++c & 0x4F))
60                 gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
61 }