Johannes Weiner | f82e939 | 2009-03-04 16:21:33 +0100 | [diff] [blame] | 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> |
Johannes Weiner | 1fb137c | 2009-05-11 15:43:34 +0200 | [diff] [blame^] | 13 | #include <variant/gpio.h> |
| 14 | |
Johannes Weiner | f82e939 | 2009-03-04 16:21:33 +0100 | [diff] [blame] | 15 | #include <platform/gpio.h> |
| 16 | |
| 17 | void platform_halt(void) |
| 18 | { |
| 19 | local_irq_disable(); |
| 20 | while (1) |
| 21 | ; |
| 22 | } |
| 23 | |
| 24 | void platform_power_off(void) |
| 25 | { |
| 26 | platform_halt(); |
| 27 | } |
| 28 | |
| 29 | void platform_restart(void) |
| 30 | { |
| 31 | platform_halt(); |
| 32 | } |
| 33 | |
| 34 | void __init platform_setup(char **cmdline) |
| 35 | { |
| 36 | unsigned long reg; |
| 37 | |
| 38 | reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE); |
| 39 | reg &= ~(1 << S6_GREG1_BLOCK_SB); |
| 40 | writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE); |
| 41 | |
| 42 | reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA); |
| 43 | reg |= 1 << S6_GREG1_BLOCK_SB; |
| 44 | writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA); |
| 45 | |
| 46 | printk(KERN_NOTICE "S6105 on Stretch S6000 - " |
| 47 | "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n"); |
| 48 | } |
| 49 | |
| 50 | void __init platform_init(bp_tag_t *first) |
| 51 | { |
Johannes Weiner | 1fb137c | 2009-05-11 15:43:34 +0200 | [diff] [blame^] | 52 | s6_gpio_init(); |
Johannes Weiner | f82e939 | 2009-03-04 16:21:33 +0100 | [diff] [blame] | 53 | gpio_request(GPIO_LED1_NGREEN, "led1_green"); |
| 54 | gpio_request(GPIO_LED1_RED, "led1_red"); |
| 55 | gpio_direction_output(GPIO_LED1_NGREEN, 1); |
| 56 | } |
| 57 | |
| 58 | void platform_heartbeat(void) |
| 59 | { |
| 60 | static unsigned int c; |
| 61 | |
| 62 | if (!(++c & 0x4F)) |
| 63 | gpio_direction_output(GPIO_LED1_RED, !(c & 0x10)); |
| 64 | } |