2 * Atheros AP113 board support
4 * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/spi/flash.h>
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
19 #include "dev-m25p80.h"
20 #include "dev-pb9x-pci.h"
23 #define AP113_GPIO_LED_USB 0
24 #define AP113_GPIO_LED_STATUS 1
25 #define AP113_GPIO_LED_ST 11
27 #define AP113_GPIO_BTN_JUMPSTART 12
29 #define AP113_KEYS_POLL_INTERVAL 20 /* msecs */
30 #define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL)
32 #ifdef CONFIG_MTD_PARTITIONS
33 static struct mtd_partition ap113_parts[] = {
38 .mask_flags = MTD_WRITEABLE,
59 .mask_flags = MTD_WRITEABLE,
62 #define ap113_nr_parts ARRAY_SIZE(ap113_parts)
64 #define ap113_parts NULL
65 #define ap113_nr_parts 0
66 #endif /* CONFIG_MTD_PARTITIONS */
68 static struct flash_platform_data ap113_flash_data = {
70 .nr_parts = ap113_nr_parts,
73 static struct gpio_led ap113_leds_gpio[] __initdata = {
75 .name = "ap113:green:usb",
76 .gpio = AP113_GPIO_LED_USB,
80 .name = "ap113:green:status",
81 .gpio = AP113_GPIO_LED_STATUS,
85 .name = "ap113:green:st",
86 .gpio = AP113_GPIO_LED_ST,
91 static struct gpio_keys_button ap113_gpio_keys[] __initdata = {
93 .desc = "jumpstart button",
95 .code = KEY_WPS_BUTTON,
96 .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL,
97 .gpio = AP113_GPIO_BTN_JUMPSTART,
102 static void __init ap113_setup(void)
104 u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000);
106 ar71xx_add_device_m25p80(&ap113_flash_data);
108 ar71xx_add_device_mdio(0, ~BIT(0));
109 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
110 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
111 ar71xx_eth0_data.speed = SPEED_1000;
112 ar71xx_eth0_data.duplex = DUPLEX_FULL;
113 ar71xx_eth0_data.phy_mask = BIT(0);
115 ar71xx_add_device_eth(0);
117 ar71xx_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL,
118 ARRAY_SIZE(ap113_gpio_keys),
120 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio),
123 ar71xx_add_device_usb();
128 MIPS_MACHINE(AR71XX_MACH_AP113, "AP113", "Atheros AP113",