ar71xx: add support for the Senao EAP7660D board
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-eap7660d.c
1 /*
2  *  Senao EAP7660D board support
3  *
4  *  Copyright (C) 2010 Daniel Golle <daniel.golle@gmail.com>
5  *  Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
6  *  Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
7  *
8  *  This program is free software; you can redistribute it and/or modify it
9  *  under the terms of the GNU General Public License version 2 as published
10  *  by the Free Software Foundation.
11  */
12
13 #include <asm/mach-ar71xx/ar71xx.h>
14
15 #include "machtype.h"
16 #include "devices.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-pb42-pci.h"
20 #include "dev-m25p80.h"
21
22 #define EAP7660D_BUTTONS_POLL_INTERVAL  20
23 #define EAP7660D_GPIO_DS4               7
24 #define EAP7660D_GPIO_DS5               2
25 #define EAP7660D_GPIO_DS7               0
26 #define EAP7660D_GPIO_DS8               4
27 #define EAP7660D_GPIO_SW1               3
28 #define EAP7660D_GPIO_SW3               8
29 #define EAP7660D_PHYMASK                BIT(20)
30
31 static struct gpio_led eap7660d_leds_gpio[] __initdata = {
32         {
33                 .name           = "eap7660d:green:ds8",
34                 .gpio           = EAP7660D_GPIO_DS8,
35                 .active_low     = 0,
36         },
37         {
38                 .name           = "eap7660d:green:ds5",
39                 .gpio           = EAP7660D_GPIO_DS5,
40                 .active_low     = 0,
41         },
42         {
43                 .name           = "eap7660d:green:ds7",
44                 .gpio           = EAP7660D_GPIO_DS7,
45                 .active_low     = 0,
46         },
47         {
48                 .name           = "eap7660d:green:ds4",
49                 .gpio           = EAP7660D_GPIO_DS4,
50                 .active_low     = 0,
51         }
52 };
53
54 static struct gpio_button eap7660d_gpio_buttons[] __initdata = {
55         {
56                 .desc           = "reset",
57                 .type           = EV_KEY,
58                 .code           = KEY_RESTART,
59                 .threshold      = 3,
60                 .gpio           = EAP7660D_GPIO_SW1,
61                 .active_low     = 1,
62         },
63         {
64                 .desc           = "wps",
65                 .type           = EV_KEY,
66                 .code           = KEY_WPS_BUTTON,
67                 .threshold      = 3,
68                 .gpio           = EAP7660D_GPIO_SW3,
69                 .active_low     = 1,
70         }
71 };
72
73 static void __init eap7660d_setup(void)
74 {
75         ar71xx_add_device_mdio(~EAP7660D_PHYMASK);
76         ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
77         ar71xx_eth0_data.phy_mask = EAP7660D_PHYMASK;
78         ar71xx_add_device_eth(0);
79         ar71xx_add_device_m25p80(NULL);
80         ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(eap7660d_leds_gpio),
81                                         eap7660d_leds_gpio);
82         ar71xx_add_device_gpio_buttons(-1, EAP7660D_BUTTONS_POLL_INTERVAL,
83                                         ARRAY_SIZE(eap7660d_gpio_buttons),
84                                         eap7660d_gpio_buttons);
85         pb42_pci_init();
86 };
87
88 MIPS_MACHINE(AR71XX_MACH_EAP7660D, "EAP7660D", "Senao EAP7660D",
89              eap7660d_setup);