summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files-2.6.33/arch/mips/ifxmips/danube/mach-arv4525.c
blob: 69c92e641eed602ef97509e1f4eb32894c6f2668 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
#include <linux/gpio.h>
#include <linux/gpio_buttons.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <linux/input.h>

#include <machine.h>
#include <ifxmips.h>
#include <ifxmips_prom.h>

#include "arcaydian.h"
#include "devices.h"

#define ARV452_EBU_GPIO_START	0x14000000
#define ARV452_EBU_GPIO_SIZE	0x00001000

#define ARV452_GPIO_BUTTON_RESET		14
#define ARV452_BUTTONS_POLL_INTERVAL	20

#define ARV452_LATCH_SWITCH				(1 << 10)

#ifdef CONFIG_MTD_PARTITIONS
static struct mtd_partition arv4525_partitions[] =
{
	{
		.name	= "uboot",
		.offset	= 0x0,
		.size	= 0x20000,
	},
	{
		.name	= "uboot_env",
		.offset	= 0x20000,
		.size	= 0x0,
	},
	{
		.name	= "kernel",
		.offset	= 0x0,
		.size	= 0x0,
	},
	{
		.name	= "rootfs",
		.offset	= 0x0,
		.size	= 0x0,
	},
	{
		.name	= "board_config",
		.offset	= 0x3f0000,
		.size	= 0x10000,
	},
	{
		.name	= "openwrt",
		.offset	= 0x0,
		.size	= 0x0,
	},
};
#endif

static struct physmap_flash_data arv4525_flash_data = {
#ifdef CONFIG_MTD_PARTITIONS
	.nr_parts	= ARRAY_SIZE(arv4525_partitions),
	.parts		= arv4525_partitions,
#endif
};

static struct gpio_led
arv4525_leds_gpio[] __initdata = {
	{ .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
	{ .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
	{ .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
	{ .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
	{ .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
	{ .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
	{ .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
	{ .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
	{ .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
	{ .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
	{ .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
	{ .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
	{ .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
};

static struct gpio_button
arv4525_gpio_buttons[] __initdata = {
	{
		.desc		= "reset",
		.type		= EV_KEY,
		.code		= BTN_0,
		.threshold	= 3,
		.gpio		= ARV452_GPIO_BUTTON_RESET,
		.active_low	= 1,
	}
};

static struct resource arv4525_ebu_resource =
{
	.name	= "ebu-gpio",
	.start	= ARV452_EBU_GPIO_START,
	.end	= ARV452_EBU_GPIO_START + ARV452_EBU_GPIO_SIZE - 1,
	.flags	= IORESOURCE_MEM,
};

static void __init
arv4525_init(void)
{
	unsigned char mac[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

	ifxmix_detect_brn_block();

	ifxmips_find_brn_mac(mac);

	ifxmips_register_gpio();

	danube_register_ebu_gpio(&arv4525_ebu_resource, ARV452_LATCH_SWITCH);

	ifxmips_register_mtd(&arv4525_flash_data);

	danube_register_pci(PCI_CLOCK_INT, 0);

	ifxmips_register_wdt();

	ifxmips_register_gpio_leds(arv4525_leds_gpio, ARRAY_SIZE(arv4525_leds_gpio));

	danube_register_ethernet(mac, MII_MODE);

	danube_register_usb();
}

MIPS_MACHINE(IFXMIPS_MACH_ARV4525,
			"ARV4525",
			"Speedport W502V",
			arv4525_init);