[ar71xx] simplify leds-gpio device registration
[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 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/spi/spi.h>
14 #include <linux/spi/flash.h>
15
16 #include <asm/mips_machine.h>
17 #include <asm/mach-ar71xx/ar71xx.h>
18 #include <asm/mach-ar71xx/pci.h>
19 #include <asm/mach-ar71xx/platform.h>
20
21 #define WP543_GPIO_LED_1        3
22 #define WP543_GPIO_LED_2        4
23 #define WP543_GPIO_LED_WLAN     5
24 #define WP543_GPIO_LED_CONN     6
25 #define WP543_GPIO_LED_DIAG     7
26
27 static struct flash_platform_data wp543_flash_data = {
28         /* TODO: add partition map */
29 };
30
31 static struct spi_board_info wp543_spi_info[] = {
32         {
33                 .bus_num        = 0,
34                 .chip_select    = 0,
35                 .max_speed_hz   = 25000000,
36                 .modalias       = "m25p80",
37                 .platform_data  = &wp543_flash_data,
38         }
39 };
40
41 static struct ar71xx_pci_irq wp543_pci_irqs[] __initdata = {
42         {
43                 .slot   = 1,
44                 .pin    = 1,
45                 .irq    = AR71XX_PCI_IRQ_DEV0,
46         }, {
47                 .slot   = 1,
48                 .pin    = 2,
49                 .irq    = AR71XX_PCI_IRQ_DEV1,
50         }
51 };
52
53 static struct gpio_led wp543_leds_gpio[] __initdata = {
54         {
55                 .name           = "wp543:green:led1",
56                 .gpio           = WP543_GPIO_LED_1,
57                 .active_low     = 1,
58         }, {
59                 .name           = "wp543:green:led2",
60                 .gpio           = WP543_GPIO_LED_2,
61                 .active_low     = 1,
62         }, {
63                 .name           = "wp543:green:wlan",
64                 .gpio           = WP543_GPIO_LED_WLAN,
65                 .active_low     = 1,
66         }, {
67                 .name           = "wp543:green:conn",
68                 .gpio           = WP543_GPIO_LED_CONN,
69                 .active_low     = 1,
70         }, {
71                 .name           = "wp543:green:diag",
72                 .gpio           = WP543_GPIO_LED_DIAG,
73                 .active_low     = 1,
74         }
75 };
76
77 static void __init wp543_setup(void)
78 {
79         ar71xx_add_device_spi(NULL, wp543_spi_info, ARRAY_SIZE(wp543_spi_info));
80
81         ar71xx_add_device_mdio(0xfffffff7);
82         ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000008);
83
84         ar71xx_add_device_usb();
85
86         ar71xx_pci_init(ARRAY_SIZE(wp543_pci_irqs), wp543_pci_irqs);
87
88         ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(wp543_leds_gpio),
89                                         wp543_leds_gpio);
90 }
91
92 MIPS_MACHINE(MACH_AR71XX_WP543, "Compex WP543", wp543_setup);