Root/target/linux/ar71xx/files/arch/mips/ath79/mach-wp543.c

1/*
2 * Compex WP543/WPJ543 board support
3 *
4 * Copyright (C) 2008-2012 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 <asm/mach-ath79/ar71xx_regs.h>
13#include <asm/mach-ath79/ath79.h>
14
15#include "dev-eth.h"
16#include "dev-gpio-buttons.h"
17#include "dev-leds-gpio.h"
18#include "dev-m25p80.h"
19#include "dev-usb.h"
20#include "machtypes.h"
21#include "pci.h"
22
23#define WP543_GPIO_SW6 2
24#define WP543_GPIO_LED_1 3
25#define WP543_GPIO_LED_2 4
26#define WP543_GPIO_LED_WLAN 5
27#define WP543_GPIO_LED_CONN 6
28#define WP543_GPIO_LED_DIAG 7
29#define WP543_GPIO_SW4 8
30
31#define WP543_KEYS_POLL_INTERVAL 20 /* msecs */
32#define WP543_KEYS_DEBOUNCE_INTERVAL (3 * WP543_KEYS_POLL_INTERVAL)
33
34static 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
58static struct gpio_keys_button wp543_gpio_keys[] __initdata = {
59    {
60        .desc = "sw6",
61        .type = EV_KEY,
62        .code = BTN_0,
63        .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
64        .gpio = WP543_GPIO_SW6,
65    }, {
66        .desc = "sw4",
67        .type = EV_KEY,
68        .code = BTN_1,
69        .debounce_interval = WP543_KEYS_DEBOUNCE_INTERVAL,
70        .gpio = WP543_GPIO_SW4,
71    }
72};
73
74static const char *wp543_part_probes[] = {
75    "MyLoader",
76    NULL,
77};
78
79static struct flash_platform_data wp543_flash_data = {
80    .part_probes = wp543_part_probes,
81};
82
83static void __init wp543_setup(void)
84{
85    ath79_register_m25p80(&wp543_flash_data);
86
87    ath79_register_mdio(0, 0xfffffff0);
88
89    ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
90    ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
91    ath79_eth0_data.phy_mask = 0x0f;
92    ath79_eth0_data.reset_bit = AR71XX_RESET_GE0_MAC |
93                    AR71XX_RESET_GE0_PHY;
94    ath79_register_eth(0);
95
96    ath79_register_usb();
97    ath79_register_pci();
98
99    ath79_register_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
100                    wp543_leds_gpio);
101
102    ath79_register_gpio_keys_polled(-1, WP543_KEYS_POLL_INTERVAL,
103                     ARRAY_SIZE(wp543_gpio_keys),
104                     wp543_gpio_keys);
105}
106
107MIPS_MACHINE(ATH79_MACH_WP543, "WP543", "Compex WP543", wp543_setup);
108

Archive Download this file



interactive