ar71xx: move PB42 specific PCI init code into a separate file
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-aw-nr580.c
1 /*
2 * AzureWave AW-NR580 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/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/input.h>
16
17 #include <asm/mips_machine.h>
18 #include <asm/mach-ar71xx/ar71xx.h>
19
20 #include "devices.h"
21 #include "dev-m25p80.h"
22 #include "dev-pb42-pci.h"
23
24 #define AW_NR580_GPIO_LED_READY_RED 0
25 #define AW_NR580_GPIO_LED_WLAN 1
26 #define AW_NR580_GPIO_LED_READY_GREEN 2
27 #define AW_NR580_GPIO_LED_WPS_GREEN 4
28 #define AW_NR580_GPIO_LED_WPS_AMBER 5
29
30 #define AW_NR580_GPIO_BTN_WPS 3
31 #define AW_NR580_GPIO_BTN_RESET 11
32
33 #define AW_NR580_BUTTONS_POLL_INTERVAL 20
34
35 static struct gpio_led aw_nr580_leds_gpio[] __initdata = {
36 {
37 .name = "aw-nr580:red:ready",
38 .gpio = AW_NR580_GPIO_LED_READY_RED,
39 .active_low = 0,
40 }, {
41 .name = "aw-nr580:green:ready",
42 .gpio = AW_NR580_GPIO_LED_READY_GREEN,
43 .active_low = 0,
44 }, {
45 .name = "aw-nr580:green:wps",
46 .gpio = AW_NR580_GPIO_LED_WPS_GREEN,
47 .active_low = 0,
48 }, {
49 .name = "aw-nr580:amber:wps",
50 .gpio = AW_NR580_GPIO_LED_WPS_AMBER,
51 .active_low = 0,
52 }, {
53 .name = "aw-nr580:green:wlan",
54 .gpio = AW_NR580_GPIO_LED_WLAN,
55 .active_low = 0,
56 }
57 };
58
59 static struct gpio_button aw_nr580_gpio_buttons[] __initdata = {
60 {
61 .desc = "reset",
62 .type = EV_KEY,
63 .code = BTN_0,
64 .threshold = 5,
65 .gpio = AW_NR580_GPIO_BTN_RESET,
66 .active_low = 1,
67 }, {
68 .desc = "wps",
69 .type = EV_KEY,
70 .code = BTN_1,
71 .threshold = 5,
72 .gpio = AW_NR580_GPIO_BTN_WPS,
73 .active_low = 1,
74 }
75 };
76
77 static void __init aw_nr580_setup(void)
78 {
79 ar71xx_add_device_mdio(0x0);
80
81 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
82 ar71xx_eth0_data.phy_mask = 0xf;
83 ar71xx_eth0_data.speed = SPEED_100;
84 ar71xx_eth0_data.duplex = DUPLEX_FULL;
85
86 ar71xx_add_device_eth(0);
87
88 pb42_pci_init();
89
90 ar71xx_add_device_m25p80(NULL);
91
92 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio),
93 aw_nr580_leds_gpio);
94
95 ar71xx_add_device_gpio_buttons(-1, AW_NR580_BUTTONS_POLL_INTERVAL,
96 ARRAY_SIZE(aw_nr580_gpio_buttons),
97 aw_nr580_gpio_buttons);
98 }
99
100 MIPS_MACHINE(AR71XX_MACH_AW_NR580, "AzureWave AW-NR580", aw_nr580_setup);