ar71xx: 3.2: fix build errors if PCI is not enabled
[openwrt.git] / target / linux / ar71xx / files-3.2 / arch / mips / ath79 / mach-mzk-w300nh.c
1 /*
2 * Planex MZK-W300NH board support
3 *
4 * Copyright (C) 2008-2012 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
12 #include <linux/mtd/mtd.h>
13 #include <linux/mtd/partitions.h>
14
15 #include <asm/mach-ath79/ath79.h>
16
17 #include "dev-eth.h"
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
20 #include "dev-m25p80.h"
21 #include "dev-wmac.h"
22 #include "machtypes.h"
23
24 #define MZK_W300NH_GPIO_LED_STATUS 1
25 #define MZK_W300NH_GPIO_LED_WPS 3
26 #define MZK_W300NH_GPIO_LED_WLAN 6
27 #define MZK_W300NH_GPIO_LED_AP 15
28 #define MZK_W300NH_GPIO_LED_ROUTER 16
29
30 #define MZK_W300NH_GPIO_BTN_APROUTER 5
31 #define MZK_W300NH_GPIO_BTN_WPS 12
32 #define MZK_W300NH_GPIO_BTN_RESET 21
33
34 #define MZK_W300NH_KEYS_POLL_INTERVAL 20 /* msecs */
35 #define MZK_W300NH_KEYS_DEBOUNCE_INTERVAL (3 * MZK_W300NH_KEYS_POLL_INTERVAL)
36
37 static struct mtd_partition mzk_w300nh_partitions[] = {
38 {
39 .name = "u-boot",
40 .offset = 0,
41 .size = 0x040000,
42 .mask_flags = MTD_WRITEABLE,
43 }, {
44 .name = "u-boot-env",
45 .offset = 0x040000,
46 .size = 0x010000,
47 }, {
48 .name = "kernel",
49 .offset = 0x050000,
50 .size = 0x160000,
51 }, {
52 .name = "rootfs",
53 .offset = 0x1b0000,
54 .size = 0x630000,
55 }, {
56 .name = "art",
57 .offset = 0x7e0000,
58 .size = 0x020000,
59 .mask_flags = MTD_WRITEABLE,
60 }, {
61 .name = "firmware",
62 .offset = 0x050000,
63 .size = 0x790000,
64 }
65 };
66
67 static struct flash_platform_data mzk_w300nh_flash_data = {
68 .parts = mzk_w300nh_partitions,
69 .nr_parts = ARRAY_SIZE(mzk_w300nh_partitions),
70 };
71
72 static struct gpio_led mzk_w300nh_leds_gpio[] __initdata = {
73 {
74 .name = "planex:green:status",
75 .gpio = MZK_W300NH_GPIO_LED_STATUS,
76 .active_low = 1,
77 }, {
78 .name = "planex:blue:wps",
79 .gpio = MZK_W300NH_GPIO_LED_WPS,
80 .active_low = 1,
81 }, {
82 .name = "planex:green:wlan",
83 .gpio = MZK_W300NH_GPIO_LED_WLAN,
84 .active_low = 1,
85 }, {
86 .name = "planex:green:ap",
87 .gpio = MZK_W300NH_GPIO_LED_AP,
88 .active_low = 1,
89 }, {
90 .name = "planex:green:router",
91 .gpio = MZK_W300NH_GPIO_LED_ROUTER,
92 .active_low = 1,
93 }
94 };
95
96 static struct gpio_keys_button mzk_w300nh_gpio_keys[] __initdata = {
97 {
98 .desc = "reset",
99 .type = EV_KEY,
100 .code = KEY_RESTART,
101 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
102 .gpio = MZK_W300NH_GPIO_BTN_RESET,
103 .active_low = 1,
104 }, {
105 .desc = "wps",
106 .type = EV_KEY,
107 .code = KEY_WPS_BUTTON,
108 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
109 .gpio = MZK_W300NH_GPIO_BTN_WPS,
110 .active_low = 1,
111 }, {
112 .desc = "aprouter",
113 .type = EV_KEY,
114 .code = BTN_2,
115 .debounce_interval = MZK_W300NH_KEYS_DEBOUNCE_INTERVAL,
116 .gpio = MZK_W300NH_GPIO_BTN_APROUTER,
117 .active_low = 0,
118 }
119 };
120
121 #define MZK_W300NH_WAN_PHYMASK BIT(4)
122 #define MZK_W300NH_MDIO_MASK (~MZK_W300NH_WAN_PHYMASK)
123
124 static void __init mzk_w300nh_setup(void)
125 {
126 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
127
128 ath79_register_mdio(0, MZK_W300NH_MDIO_MASK);
129
130 ath79_init_mac(ath79_eth0_data.mac_addr, eeprom, 0);
131 ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
132 ath79_eth0_data.speed = SPEED_100;
133 ath79_eth0_data.duplex = DUPLEX_FULL;
134 ath79_eth0_data.has_ar8216 = 1;
135
136 ath79_init_mac(ath79_eth1_data.mac_addr, eeprom, 1);
137 ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
138 ath79_eth1_data.phy_mask = MZK_W300NH_WAN_PHYMASK;
139
140 ath79_register_eth(0);
141 ath79_register_eth(1);
142
143 ath79_register_m25p80(&mzk_w300nh_flash_data);
144
145 ath79_register_leds_gpio(-1, ARRAY_SIZE(mzk_w300nh_leds_gpio),
146 mzk_w300nh_leds_gpio);
147
148 ath79_register_gpio_keys_polled(-1, MZK_W300NH_KEYS_POLL_INTERVAL,
149 ARRAY_SIZE(mzk_w300nh_gpio_keys),
150 mzk_w300nh_gpio_keys);
151 ath79_register_wmac(eeprom, NULL);
152 }
153
154 MIPS_MACHINE(ATH79_MACH_MZK_W300NH, "MZK-W300NH", "Planex MZK-W300NH",
155 mzk_w300nh_setup);
This page took 0.052119 seconds and 5 git commands to generate.