summaryrefslogtreecommitdiffstats
path: root/arch/xtensa/platforms/s6105/setup.c
blob: 95fa23c8e632d29b0370494c25678d2a903526c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * s6105 control routines
 *
 * Copyright (c) 2009 emlix GmbH
 */
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/gpio.h>

#include <asm/bootparam.h>

#include <variant/hardware.h>
#include <variant/gpio.h>

#include <platform/gpio.h>

void platform_halt(void)
{
	local_irq_disable();
	while (1)
		;
}

void platform_power_off(void)
{
	platform_halt();
}

void platform_restart(void)
{
	platform_halt();
}

void __init platform_setup(char **cmdline)
{
	unsigned long reg;

	reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE);
	reg &= ~(1 << S6_GREG1_BLOCK_SB);
	writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE);

	reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA);
	reg |= 1 << S6_GREG1_BLOCK_SB;
	writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA);

	printk(KERN_NOTICE "S6105 on Stretch S6000 - "
		"Copyright (C) 2009 emlix GmbH <info@emlix.com>\n");
}

void __init platform_init(bp_tag_t *first)
{
	s6_gpio_init(0);
	gpio_request(GPIO_LED1_NGREEN, "led1_green");
	gpio_request(GPIO_LED1_RED, "led1_red");
	gpio_direction_output(GPIO_LED1_NGREEN, 1);
}

void platform_heartbeat(void)
{
	static unsigned int c;

	if (!(++c & 0x4F))
		gpio_direction_output(GPIO_LED1_RED, !(c & 0x10));
}