cf21632f7e0a22f228000697d61d69fec61f4004
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-wp543.c
1 /*
2  *  Compex WP543/WPJ543 board support
3  *
4  *  Copyright (C) 2008-2009 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/mips_machine.h>
16 #include <asm/mach-ar71xx/ar71xx.h>
17
18 #include "devices.h"
19 #include "dev-m25p80.h"
20 #include "dev-pb42-pci.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
23
24 #define WP543_GPIO_SW6          2
25 #define WP543_GPIO_LED_1        3
26 #define WP543_GPIO_LED_2        4
27 #define WP543_GPIO_LED_WLAN     5
28 #define WP543_GPIO_LED_CONN     6
29 #define WP543_GPIO_LED_DIAG     7
30 #define WP543_GPIO_SW4          8
31
32 #define WP543_BUTTONS_POLL_INTERVAL     20
33
34 static struct gpio_led wp543_leds_gpio[] __initdata = {
35         {
36                 .name           = "wp543:green:led1",
37                 .gpio           = WP543_GPIO_LED_1,
38                 .active_low     = 1,
39         }, {
40                 .name           = "wp543:green:led2",
41                 .gpio           = WP543_GPIO_LED_2,
42                 .active_low     = 1,
43         }, {
44                 .name           = "wp543:green:wlan",
45                 .gpio           = WP543_GPIO_LED_WLAN,
46                 .active_low     = 1,
47         }, {
48                 .name           = "wp543:green:conn",
49                 .gpio           = WP543_GPIO_LED_CONN,
50                 .active_low     = 1,
51         }, {
52                 .name           = "wp543:green:diag",
53                 .gpio           = WP543_GPIO_LED_DIAG,
54                 .active_low     = 1,
55         }
56 };
57
58 static struct gpio_button wp543_gpio_buttons[] __initdata = {
59         {
60                 .desc           = "sw6",
61                 .type           = EV_KEY,
62                 .code           = BTN_0,
63                 .threshold      = 5,
64                 .gpio           = WP543_GPIO_SW6,
65         }, {
66                 .desc           = "sw4",
67                 .type           = EV_KEY,
68                 .code           = BTN_1,
69                 .threshold      = 5,
70                 .gpio           = WP543_GPIO_SW4,
71         }
72 };
73
74 static void __init wp543_setup(void)
75 {
76         ar71xx_add_device_m25p80(NULL);
77
78         ar71xx_add_device_mdio(0xfffffff7);
79
80         ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
81         ar71xx_eth0_data.phy_mask = 0x00000008;
82         ar71xx_eth0_data.reset_bit = RESET_MODULE_GE0_MAC |
83                                      RESET_MODULE_GE0_PHY;
84         ar71xx_add_device_eth(0);
85
86         ar71xx_add_device_usb();
87
88         pb42_pci_init();
89
90         ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
91                                         wp543_leds_gpio);
92
93         ar71xx_add_device_gpio_buttons(-1, WP543_BUTTONS_POLL_INTERVAL,
94                                         ARRAY_SIZE(wp543_gpio_buttons),
95                                         wp543_gpio_buttons);
96 }
97
98 MIPS_MACHINE(AR71XX_MACH_WP543, "Compex WP543", wp543_setup);