2 * Buffalo WHR-HP-G300N board support
6 * TP-LINK TL-WR741ND board support
8 * Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License version 2 as published
12 * by the Free Software Foundation.
15 #include <linux/mtd/mtd.h>
16 #include <linux/mtd/partitions.h>
18 #include <asm/mach-ar71xx/ar71xx.h>
22 #include "dev-m25p80.h"
23 #include "dev-ap91-pci.h"
24 #include "dev-gpio-buttons.h"
25 #include "dev-leds-gpio.h"
27 #define WHRHPG300N_GPIO_LED_SECURITY 0
28 #define WHRHPG300N_GPIO_LED_DIAG 1
29 #define WHRHPG300N_GPIO_LED_ROUTER 6
31 #define WHRHPG300N_GPIO_BTN_ROUTER_ON 7
32 #define WHRHPG300N_GPIO_BTN_ROUTER_AUTO 8
33 #define WHRHPG300N_GPIO_BTN_RESET 11
34 #define WHRHPG300N_GPIO_BTN_AOSS 12
36 #define WHRHPG300N_KEYS_POLL_INTERVAL 20 /* msecs */
37 #define WHRHPG300N_KEYS_DEBOUNCE_INTERVAL (3 * WHRHPG300N_KEYS_POLL_INTERVAL)
39 #define WHRHPG300N_MAC_OFFSET 0x20c
41 #ifdef CONFIG_MTD_PARTITIONS
42 static struct mtd_partition whrhpg300n_partitions[] = {
47 .mask_flags = MTD_WRITEABLE,
52 .mask_flags = MTD_WRITEABLE,
62 .name = "user_property",
69 .mask_flags = MTD_WRITEABLE,
76 #endif /* CONFIG_MTD_PARTITIONS */
78 static struct flash_platform_data whrhpg300n_flash_data = {
79 #ifdef CONFIG_MTD_PARTITIONS
80 .parts = whrhpg300n_partitions,
81 .nr_parts = ARRAY_SIZE(whrhpg300n_partitions),
85 static struct gpio_led whrhpg300n_leds_gpio[] __initdata = {
87 .name = "buffalo:orange:security",
88 .gpio = WHRHPG300N_GPIO_LED_SECURITY,
91 .name = "buffalo:red:diag",
92 .gpio = WHRHPG300N_GPIO_LED_DIAG,
95 .name = "buffalo:green:router",
96 .gpio = WHRHPG300N_GPIO_LED_ROUTER,
101 static struct gpio_keys_button whrhpg300n_gpio_keys[] __initdata = {
106 .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL,
107 .gpio = WHRHPG300N_GPIO_BTN_RESET,
112 .code = KEY_WPS_BUTTON,
113 .gpio = WHRHPG300N_GPIO_BTN_AOSS,
114 .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL,
120 .gpio = WHRHPG300N_GPIO_BTN_ROUTER_ON,
121 .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL,
124 .desc = "router_auto",
127 .gpio = WHRHPG300N_GPIO_BTN_ROUTER_AUTO,
128 .debounce_interval = WHRHPG300N_KEYS_DEBOUNCE_INTERVAL,
133 static void __init whrhpg300n_setup(void)
135 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
136 u8 *mac = (u8 *) KSEG1ADDR(ee + WHRHPG300N_MAC_OFFSET);
138 ar71xx_add_device_m25p80(&whrhpg300n_flash_data);
140 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(whrhpg300n_leds_gpio),
141 whrhpg300n_leds_gpio);
143 ar71xx_register_gpio_keys_polled(-1, WHRHPG300N_KEYS_POLL_INTERVAL,
144 ARRAY_SIZE(whrhpg300n_gpio_keys),
145 whrhpg300n_gpio_keys);
147 ar71xx_eth1_data.has_ar7240_switch = 1;
148 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
149 ar71xx_init_mac(ar71xx_eth1_data.mac_addr, mac, 1);
152 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
153 ar71xx_eth0_data.speed = SPEED_100;
154 ar71xx_eth0_data.duplex = DUPLEX_FULL;
155 ar71xx_eth0_data.phy_mask = BIT(4);
158 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
159 ar71xx_eth1_data.speed = SPEED_1000;
160 ar71xx_eth1_data.duplex = DUPLEX_FULL;
162 ar71xx_add_device_mdio(0x0);
163 ar71xx_add_device_eth(1);
164 ar71xx_add_device_eth(0);
166 ap91_pci_setup_wmac_led_pin(1);
168 ap91_pci_init(ee, mac);
171 MIPS_MACHINE(AR71XX_MACH_WHR_HP_G300N, "WHR-HP-G300N", "Buffalo WHR-HP-G300N",