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>
16 #include "dev-gpio-buttons.h"
17 #include "dev-leds-gpio.h"
18 #include "dev-m25p80.h"
21 #include "machtypes.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 static struct mtd_partition ap113_parts
[] = {
37 .mask_flags
= MTD_WRITEABLE
,
58 .mask_flags
= MTD_WRITEABLE
,
61 #define ap113_nr_parts ARRAY_SIZE(ap113_parts)
63 static struct flash_platform_data ap113_flash_data
= {
65 .nr_parts
= ap113_nr_parts
,
68 static struct gpio_led ap113_leds_gpio
[] __initdata
= {
70 .name
= "ap113:green:usb",
71 .gpio
= AP113_GPIO_LED_USB
,
75 .name
= "ap113:green:status",
76 .gpio
= AP113_GPIO_LED_STATUS
,
80 .name
= "ap113:green:st",
81 .gpio
= AP113_GPIO_LED_ST
,
86 static struct gpio_keys_button ap113_gpio_keys
[] __initdata
= {
88 .desc
= "jumpstart button",
90 .code
= KEY_WPS_BUTTON
,
91 .debounce_interval
= AP113_KEYS_DEBOUNCE_INTERVAL
,
92 .gpio
= AP113_GPIO_BTN_JUMPSTART
,
97 static void __init
ap113_setup(void)
99 u8
*mac
= (u8
*) KSEG1ADDR(0x1fff0000);
101 ath79_register_m25p80(&ap113_flash_data
);
103 ath79_register_mdio(0, ~BIT(0));
104 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
105 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
106 ath79_eth0_data
.speed
= SPEED_1000
;
107 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
108 ath79_eth0_data
.phy_mask
= BIT(0);
110 ath79_register_eth(0);
112 ath79_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL
,
113 ARRAY_SIZE(ap113_gpio_keys
),
115 ath79_register_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio
),
118 ath79_register_pci();
120 ath79_register_usb();
123 MIPS_MACHINE(ATH79_MACH_AP113
, "AP113", "Atheros AP113",