fed up with those stupid warnings
[mmotm.git] / arch / xtensa / platforms / s6105 / setup.c
blob86ce730f791321a11b7b8a52bb553a374ddfa5d7
1 /*
2 * s6105 control routines
4 * Copyright (c) 2009 emlix GmbH
5 */
6 #include <linux/irq.h>
7 #include <linux/io.h>
8 #include <linux/gpio.h>
10 #include <asm/bootparam.h>
12 #include <variant/hardware.h>
13 #include <variant/gpio.h>
15 #include <platform/gpio.h>
17 void platform_halt(void)
19 local_irq_disable();
20 while (1)
24 void platform_power_off(void)
26 platform_halt();
29 void platform_restart(void)
31 platform_halt();
34 void __init platform_setup(char **cmdline)
36 unsigned long reg;
38 reg = readl(S6_REG_GREG1 + S6_GREG1_PLLSEL);
39 reg &= ~(S6_GREG1_PLLSEL_GMAC_MASK << S6_GREG1_PLLSEL_GMAC |
40 S6_GREG1_PLLSEL_GMII_MASK << S6_GREG1_PLLSEL_GMII);
41 reg |= S6_GREG1_PLLSEL_GMAC_125MHZ << S6_GREG1_PLLSEL_GMAC |
42 S6_GREG1_PLLSEL_GMII_125MHZ << S6_GREG1_PLLSEL_GMII;
43 writel(reg, S6_REG_GREG1 + S6_GREG1_PLLSEL);
45 reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
46 reg &= ~(1 << S6_GREG1_BLOCK_SB);
47 reg &= ~(1 << S6_GREG1_BLOCK_GMAC);
48 writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);
50 reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
51 reg |= 1 << S6_GREG1_BLOCK_SB;
52 reg |= 1 << S6_GREG1_BLOCK_GMAC;
53 writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);
55 printk(KERN_NOTICE "S6105 on Stretch S6000 - "
56 "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
59 void __init platform_init(bp_tag_t *first)
61 s6_gpio_init(0);
62 gpio_request(GPIO_LED1_NGREEN, "led1_green");
63 gpio_request(GPIO_LED1_RED, "led1_red");
64 gpio_direction_output(GPIO_LED1_NGREEN, 1);
67 void platform_heartbeat(void)
69 static unsigned int c;
71 if (!(++c & 0x4F))
72 gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));