2 * Redwave RW2458N support
4 * Copyright (C) 2011-2013 Cezary Jackiewicz <cezary@eko.one.pl>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <asm/mach-ath79/ath79.h>
14 #include "dev-ap9x-pci.h"
15 #include "dev-gpio-buttons.h"
16 #include "dev-leds-gpio.h"
17 #include "dev-m25p80.h"
19 #include "machtypes.h"
22 #define RW2458N_GPIO_LED_D3 1
23 #define RW2458N_GPIO_LED_D4 0
24 #define RW2458N_GPIO_LED_D5 11
25 #define RW2458N_GPIO_LED_D6 7
26 #define RW2458N_GPIO_BTN_RESET 12
28 #define RW2458N_KEYS_POLL_INTERVAL 20 /* msecs */
29 #define RW2458N_KEYS_DEBOUNCE_INTERVAL (3 * RW2458N_KEYS_POLL_INTERVAL)
31 static struct gpio_keys_button rw2458n_gpio_keys[] __initdata = {
36 .debounce_interval = RW2458N_KEYS_DEBOUNCE_INTERVAL,
37 .gpio = RW2458N_GPIO_BTN_RESET,
42 #define RW2458N_WAN_PHYMASK BIT(4)
44 static struct gpio_led rw2458n_leds_gpio[] __initdata = {
46 .name = "rw2458n:green:d3",
47 .gpio = RW2458N_GPIO_LED_D3,
50 .name = "rw2458n:green:d4",
51 .gpio = RW2458N_GPIO_LED_D4,
54 .name = "rw2458n:green:d5",
55 .gpio = RW2458N_GPIO_LED_D5,
58 .name = "rw2458n:green:d6",
59 .gpio = RW2458N_GPIO_LED_D6,
64 static void __init rw2458n_setup(void)
66 u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000);
67 u8 *mac2 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN);
69 ath79_register_m25p80(NULL);
71 ath79_register_mdio(0, ~RW2458N_WAN_PHYMASK);
73 ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0);
74 ath79_init_mac(ath79_eth1_data.mac_addr, mac2, 0);
76 ath79_register_eth(0);
77 ath79_register_eth(1);
79 ath79_register_leds_gpio(-1, ARRAY_SIZE(rw2458n_leds_gpio),
82 ath79_register_gpio_keys_polled(-1, RW2458N_KEYS_POLL_INTERVAL,
83 ARRAY_SIZE(rw2458n_gpio_keys),
90 MIPS_MACHINE(ATH79_MACH_RW2458N, "RW2458N", "Redwave RW2458N",