#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/spi/mmc_spi.h>
-#include <linux/leds.h>
+#include <linux/input.h>
#include <asm/mips_machine.h>
#include <asm/mach-ar71xx/ar71xx.h>
#include <asm/mach-ar71xx/platform.h>
#define RB4XX_GPIO_USER_LED 4
+#define RB4XX_GPIO_RESET_SWITCH 7
-static struct gpio_led rb4xx_leds_gpio[] = {
+#define RB4XX_BUTTONS_POLL_INTERVAL 20
+
+static struct gpio_led rb4xx_leds_gpio[] __initdata = {
{
.name = "rb4xx:yellow:user",
.gpio = RB4XX_GPIO_USER_LED,
},
};
-static struct gpio_led_platform_data rb4xx_leds_gpio_data = {
- .leds = rb4xx_leds_gpio,
- .num_leds = ARRAY_SIZE(rb4xx_leds_gpio),
-};
-
-static struct platform_device rb4xx_leds_gpio_device = {
- .name = "leds-gpio",
- .id = -1,
- .dev = {
- .platform_data = &rb4xx_leds_gpio_data,
+static struct gpio_button rb4xx_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset_switch",
+ .type = EV_KEY,
+ .code = BTN_0,
+ .threshold = 5,
+ .gpio = RB4XX_GPIO_RESET_SWITCH,
+ .active_low = 1,
}
};
{
rb4xx_add_device_spi();
+ ar71xx_add_device_mdio(0xfffffffe);
ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
- platform_device_register(&rb4xx_leds_gpio_device);
+ ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
+ rb4xx_leds_gpio);
+
+ ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL,
+ ARRAY_SIZE(rb4xx_gpio_buttons),
+ rb4xx_gpio_buttons);
+
platform_device_register(&rb4xx_nand_device);
ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
{
rb433_add_device_spi();
- ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
- ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff);
+ ar71xx_add_device_mdio(0xffffffec);
+ ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010);
+ ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000003);
+
+ ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
+ rb4xx_leds_gpio);
+
+ ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL,
+ ARRAY_SIZE(rb4xx_gpio_buttons),
+ rb4xx_gpio_buttons);
- platform_device_register(&rb4xx_leds_gpio_device);
platform_device_register(&rb4xx_nand_device);
ar71xx_pci_init(ARRAY_SIZE(rb4xx_pci_irqs), rb4xx_pci_irqs);
{
rb4xx_add_device_spi();
- ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x00000001);
- ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0xffffffff);
+ ar71xx_add_device_mdio(0xffffffe0);
+ ar71xx_add_device_eth(1, PHY_INTERFACE_MODE_RMII, 0x00000010);
+ ar71xx_add_device_eth(0, PHY_INTERFACE_MODE_MII, 0x0000000f);
+
+ ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(rb4xx_leds_gpio),
+ rb4xx_leds_gpio);
+
+ ar71xx_add_device_gpio_buttons(-1, RB4XX_BUTTONS_POLL_INTERVAL,
+ ARRAY_SIZE(rb4xx_gpio_buttons),
+ rb4xx_gpio_buttons);
- platform_device_register(&rb4xx_leds_gpio_device);
platform_device_register(&rb4xx_nand_device);
}