Root/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/mach-ar71xx/ar71xx.h>
16
17#include "machtype.h"
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#include "dev-usb.h"
24
25#define WP543_GPIO_SW6 2
26#define WP543_GPIO_LED_1 3
27#define WP543_GPIO_LED_2 4
28#define WP543_GPIO_LED_WLAN 5
29#define WP543_GPIO_LED_CONN 6
30#define WP543_GPIO_LED_DIAG 7
31#define WP543_GPIO_SW4 8
32
33#define WP543_KEYS_POLL_INTERVAL 20 /* msecs */
34#define WP543_KEYS_DEBOUNCE_INTERVAL (3 * WP543_KEYS_POLL_INTERVAL)
35
36static struct gpio_led wp543_leds_gpio[] __initdata = {
37    {
38        .name = "wp543:green:led1",
39        .gpio = WP543_GPIO_LED_1,
40        .active_low = 1,
41    }, {
42        .name = "wp543:green:led2",
43        .gpio = WP543_GPIO_LED_2,
44        .active_low = 1,
45    }, {
46        .name = "wp543:green:wlan",
47        .gpio = WP543_GPIO_LED_WLAN,
48        .active_low = 1,
49    }, {
50        .name = "wp543:green:conn",
51        .gpio = WP543_GPIO_LED_CONN,
52        .active_low = 1,
53    }, {
54        .name = "wp543:green:diag",
55        .gpio = WP543_GPIO_LED_DIAG,
56        .active_low = 1,
57    }
58};
59
60static struct gpio_keys_button wp543_gpio_keys[] __initdata = {
61    {
62        .desc = "sw6",
63        .type = EV_KEY,
64        .code = BTN_0,
65        .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
66        .gpio = WP543_GPIO_SW6,
67    }, {
68        .desc = "sw4",
69        .type = EV_KEY,
70        .code = BTN_1,
71        .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
72        .gpio = WP543_GPIO_SW4,
73    }
74};
75
76static void __init wp543_setup(void)
77{
78    ar71xx_add_device_m25p80(NULL);
79
80    ar71xx_add_device_mdio(0xfffffff7);
81
82    ar71xx_init_mac(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, 0);
83    ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
84    ar71xx_eth0_data.phy_mask = 0x08;
85    ar71xx_eth0_data.reset_bit = RESET_MODULE_GE0_MAC |
86                     RESET_MODULE_GE0_PHY;
87    ar71xx_add_device_eth(0);
88
89    ar71xx_add_device_usb();
90
91    pb42_pci_init();
92
93    ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
94                    wp543_leds_gpio);
95
96    ar71xx_register_gpio_keys_polled(-1, WP543_KEYS_POLL_INTERVAL,
97                     ARRAY_SIZE(wp543_gpio_keys),
98                     wp543_gpio_keys);
99}
100
101MIPS_MACHINE(AR71XX_MACH_WP543, "WP543", "Compex WP543", wp543_setup);
102

Archive Download this file



interactive