2 * ALFA Network N2/N5 board support
4 * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
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/ar71xx_regs.h>
12 #include <asm/mach-ath79/ath79.h>
16 #include "dev-ap9x-pci.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
20 #include "machtypes.h"
22 #define ALFA_NX_GPIO_LED_2 17
23 #define ALFA_NX_GPIO_LED_3 16
24 #define ALFA_NX_GPIO_LED_5 12
25 #define ALFA_NX_GPIO_LED_6 8
26 #define ALFA_NX_GPIO_LED_7 6
27 #define ALFA_NX_GPIO_LED_8 7
29 #define ALFA_NX_GPIO_BTN_RESET 11
31 #define ALFA_NX_KEYS_POLL_INTERVAL 20 /* msecs */
32 #define ALFA_NX_KEYS_DEBOUNCE_INTERVAL (3 * ALFA_NX_KEYS_POLL_INTERVAL)
34 #define ALFA_NX_MAC0_OFFSET 0
35 #define ALFA_NX_MAC1_OFFSET 6
36 #define ALFA_NX_CALDATA_OFFSET 0x1000
38 static struct gpio_keys_button alfa_nx_gpio_keys[] __initdata = {
40 .desc = "Reset button",
43 .debounce_interval = ALFA_NX_KEYS_DEBOUNCE_INTERVAL,
44 .gpio = ALFA_NX_GPIO_BTN_RESET,
49 static struct gpio_led alfa_nx_leds_gpio[] __initdata = {
51 .name = "alfa:green:led_2",
52 .gpio = ALFA_NX_GPIO_LED_2,
55 .name = "alfa:green:led_3",
56 .gpio = ALFA_NX_GPIO_LED_3,
59 .name = "alfa:red:led_5",
60 .gpio = ALFA_NX_GPIO_LED_5,
63 .name = "alfa:amber:led_6",
64 .gpio = ALFA_NX_GPIO_LED_6,
67 .name = "alfa:green:led_7",
68 .gpio = ALFA_NX_GPIO_LED_7,
71 .name = "alfa:green:led_8",
72 .gpio = ALFA_NX_GPIO_LED_8,
77 static void __init alfa_nx_setup(void)
79 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
81 ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE,
82 AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
83 AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
84 AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
85 AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
86 AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
88 ath79_register_m25p80(NULL);
90 ath79_register_leds_gpio(0, ARRAY_SIZE(alfa_nx_leds_gpio),
93 ath79_register_gpio_keys_polled(-1, ALFA_NX_KEYS_POLL_INTERVAL,
94 ARRAY_SIZE(alfa_nx_gpio_keys),
97 ath79_register_mdio(0, 0x0);
99 ath79_init_mac(ath79_eth0_data.mac_addr,
100 art + ALFA_NX_MAC0_OFFSET, 0);
101 ath79_init_mac(ath79_eth1_data.mac_addr,
102 art + ALFA_NX_MAC1_OFFSET, 0);
105 ath79_register_eth(0);
107 ath79_register_eth(1);
109 ap91_pci_init(art + ALFA_NX_CALDATA_OFFSET, NULL);
112 MIPS_MACHINE(ATH79_MACH_ALFA_NX, "ALFA-NX", "ALFA Network N2/N5",