ar71xx: build ALFA AP96 images with default profile as well
[oweals/openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-ja76pf.c
index d39de3c4d03de38914dc6b5184226aed9ecb8bca..9f56c3fa733f7e9576ded6d515c7689b6cb25397 100644 (file)
 #include "dev-usb.h"
 #include "dev-leds-gpio.h"
 
-#define JA76PF_BUTTONS_POLL_INTERVAL   20
+#define JA76PF_KEYS_POLL_INTERVAL      20      /* msecs */
+#define JA76PF_KEYS_DEBOUNCE_INTERVAL  (3 * JA76PF_KEYS_POLL_INTERVAL)
 
 #define JA76PF_GPIO_I2C_SCL            0
 #define JA76PF_GPIO_I2C_SDA            1
 #define JA76PF_GPIO_LED_1              5
 #define JA76PF_GPIO_LED_2              4
+#define JA76PF_GPIO_LED_3              3
 #define JA76PF_GPIO_BTN_RESET          11
 
 static struct gpio_led ja76pf_leds_gpio[] __initdata = {
@@ -32,15 +34,19 @@ static struct gpio_led ja76pf_leds_gpio[] __initdata = {
                .name           = "ja76pf:green:led2",
                .gpio           = JA76PF_GPIO_LED_2,
                .active_low     = 1,
+       }, {
+               .name           = "ja76pf:green:led3",
+               .gpio           = JA76PF_GPIO_LED_3,
+               .active_low     = 1,
        }
 };
 
-static struct gpio_button ja76pf_gpio_buttons[] __initdata = {
+static struct gpio_keys_button ja76pf_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
-               .threshold      = 3,
+               .debounce_interval = JA76PF_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = JA76PF_GPIO_BTN_RESET,
                .active_low     = 1,
        }
@@ -59,19 +65,30 @@ static struct platform_device ja76pf_i2c_gpio_device = {
        }
 };
 
+static const char *ja76pf_part_probes[] = {
+       "RedBoot",
+       NULL,
+};
+
+static struct flash_platform_data ja76pf_flash_data = {
+       .part_probes    = ja76pf_part_probes,
+};
+
 #define JA76PF_WAN_PHYMASK     (1 << 4)
 #define JA76PF_LAN_PHYMASK     ((1 << 0) | (1 << 1) | (1 << 2) | (1 < 3))
 #define JA76PF_MDIO_PHYMASK    (JA76PF_LAN_PHYMASK | JA76PF_WAN_PHYMASK)
 
 static void __init ja76pf_init(void)
 {
-       ar71xx_add_device_m25p80(NULL);
+       ar71xx_add_device_m25p80(&ja76pf_flash_data);
 
-       ar71xx_add_device_mdio(~JA76PF_MDIO_PHYMASK);
+       ar71xx_add_device_mdio(0, ~JA76PF_MDIO_PHYMASK);
 
+       ar71xx_init_mac(ar71xx_eth0_data.mac_addr, ar71xx_mac_base, 0);
        ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
        ar71xx_eth0_data.phy_mask = JA76PF_LAN_PHYMASK;
 
+       ar71xx_init_mac(ar71xx_eth1_data.mac_addr, ar71xx_mac_base, 1);
        ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
        ar71xx_eth1_data.phy_mask = JA76PF_WAN_PHYMASK;
        ar71xx_eth1_data.speed = SPEED_1000;
@@ -85,9 +102,9 @@ static void __init ja76pf_init(void)
        ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ja76pf_leds_gpio),
                                        ja76pf_leds_gpio);
 
-       ar71xx_add_device_gpio_buttons(-1, JA76PF_BUTTONS_POLL_INTERVAL,
-                                       ARRAY_SIZE(ja76pf_gpio_buttons),
-                                       ja76pf_gpio_buttons);
+       ar71xx_register_gpio_keys_polled(-1, JA76PF_KEYS_POLL_INTERVAL,
+                                        ARRAY_SIZE(ja76pf_gpio_keys),
+                                        ja76pf_gpio_keys);
 
        ar71xx_add_device_usb();
        pb42_pci_init();