[ar71xx] use MyLoader partition parser on the WP543 board
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-wp543.c
1 /*
2 * Compex WP543 board support
3 *
4 * Copyright (C) 2008 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 #include <asm/mach-ar71xx/platform.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 spi_board_info wp543_spi_info[] = {
35 {
36 .bus_num = 0,
37 .chip_select = 0,
38 .max_speed_hz = 25000000,
39 .modalias = "m25p80",
40 }
41 };
42
43 static struct ar71xx_pci_irq wp543_pci_irqs[] __initdata = {
44 {
45 .slot = 1,
46 .pin = 1,
47 .irq = AR71XX_PCI_IRQ_DEV0,
48 }, {
49 .slot = 1,
50 .pin = 2,
51 .irq = AR71XX_PCI_IRQ_DEV1,
52 }
53 };
54
55 static struct gpio_led wp543_leds_gpio[] __initdata = {
56 {
57 .name = "wp543:green:led1",
58 .gpio = WP543_GPIO_LED_1,
59 .active_low = 1,
60 }, {
61 .name = "wp543:green:led2",
62 .gpio = WP543_GPIO_LED_2,
63 .active_low = 1,
64 }, {
65 .name = "wp543:green:wlan",
66 .gpio = WP543_GPIO_LED_WLAN,
67 .active_low = 1,
68 }, {
69 .name = "wp543:green:conn",
70 .gpio = WP543_GPIO_LED_CONN,
71 .active_low = 1,
72 }, {
73 .name = "wp543:green:diag",
74 .gpio = WP543_GPIO_LED_DIAG,
75 .active_low = 1,
76 }
77 };
78
79 static struct gpio_button wp543_gpio_buttons[] __initdata = {
80 {
81 .desc = "sw6",
82 .type = EV_KEY,
83 .code = BTN_0,
84 .threshold = 5,
85 .gpio = WP543_GPIO_SW6,
86 }, {
87 .desc = "sw4",
88 .type = EV_KEY,
89 .code = BTN_1,
90 .threshold = 5,
91 .gpio = WP543_GPIO_SW4,
92 }
93 };
94
95 static void __init wp543_setup(void)
96 {
97 ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info));
98
99 ar71xx_add_device_mdio(0xfffffff7);
100
101 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
102 ar71xx_eth0_data.phy_mask = 0x00000008;
103 ar71xx_add_device_eth(0);
104
105 ar71xx_add_device_usb();
106
107 ar71xx_pci_init(ARRAY_SIZE(wp543_pci_irqs), wp543_pci_irqs);
108
109 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
110 wp543_leds_gpio);
111
112 ar71xx_add_device_gpio_buttons(-1, WP543_BUTTONS_POLL_INTERVAL,
113 ARRAY_SIZE(wp543_gpio_buttons),
114 wp543_gpio_buttons);
115 }
116
117 MIPS_MACHINE(MACH_AR71XX_WP543, "Compex WP543", wp543_setup);