ar71xx: fix PCI IRQ map of the WP543
[openwrt-10.03/.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-wp543.c
1 /*
2  *  Compex WP543 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/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/input.h>
18
19 #include <asm/mips_machine.h>
20 #include <asm/mach-ar71xx/ar71xx.h>
21 #include <asm/mach-ar71xx/pci.h>
22
23 #include "devices.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_BUTTONS_POLL_INTERVAL     20
34
35 static struct spi_board_info wp543_spi_info[] = {
36         {
37                 .bus_num        = 0,
38                 .chip_select    = 0,
39                 .max_speed_hz   = 25000000,
40                 .modalias       = "m25p80",
41         }
42 };
43
44 static struct ar71xx_pci_irq wp543_pci_irqs[] __initdata = {
45         {
46                 .slot   = 0,
47                 .pin    = 1,
48                 .irq    = AR71XX_PCI_IRQ_DEV0,
49         }, {
50                 .slot   = 1,
51                 .pin    = 1,
52                 .irq    = AR71XX_PCI_IRQ_DEV1,
53         }, {
54                 .slot   = 2,
55                 .pin    = 1,
56                 .irq    = AR71XX_PCI_IRQ_DEV2,
57         }
58 };
59
60 static struct gpio_led wp543_leds_gpio[] __initdata = {
61         {
62                 .name           = "wp543:green:led1",
63                 .gpio           = WP543_GPIO_LED_1,
64                 .active_low     = 1,
65         }, {
66                 .name           = "wp543:green:led2",
67                 .gpio           = WP543_GPIO_LED_2,
68                 .active_low     = 1,
69         }, {
70                 .name           = "wp543:green:wlan",
71                 .gpio           = WP543_GPIO_LED_WLAN,
72                 .active_low     = 1,
73         }, {
74                 .name           = "wp543:green:conn",
75                 .gpio           = WP543_GPIO_LED_CONN,
76                 .active_low     = 1,
77         }, {
78                 .name           = "wp543:green:diag",
79                 .gpio           = WP543_GPIO_LED_DIAG,
80                 .active_low     = 1,
81         }
82 };
83
84 static struct gpio_button wp543_gpio_buttons[] __initdata = {
85         {
86                 .desc           = "sw6",
87                 .type           = EV_KEY,
88                 .code           = BTN_0,
89                 .threshold      = 5,
90                 .gpio           = WP543_GPIO_SW6,
91         }, {
92                 .desc           = "sw4",
93                 .type           = EV_KEY,
94                 .code           = BTN_1,
95                 .threshold      = 5,
96                 .gpio           = WP543_GPIO_SW4,
97         }
98 };
99
100 static void __init wp543_setup(void)
101 {
102         ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info));
103
104         ar71xx_add_device_mdio(0xfffffff7);
105
106         ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
107         ar71xx_eth0_data.phy_mask = 0x00000008;
108         ar71xx_eth0_data.reset_bit = RESET_MODULE_GE0_MAC |
109                                      RESET_MODULE_GE0_PHY;
110         ar71xx_add_device_eth(0);
111
112         ar71xx_add_device_usb();
113
114         ar71xx_pci_init(ARRAY_SIZE(wp543_pci_irqs), wp543_pci_irqs);
115
116         ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
117                                         wp543_leds_gpio);
118
119         ar71xx_add_device_gpio_buttons(-1, WP543_BUTTONS_POLL_INTERVAL,
120                                         ARRAY_SIZE(wp543_gpio_buttons),
121                                         wp543_gpio_buttons);
122 }
123
124 MIPS_MACHINE(AR71XX_MACH_WP543, "Compex WP543", wp543_setup);