| 1 | /* |
| 2 | * Atheros AP113 board support |
| 3 | * |
| 4 | * Copyright (C) 2011 Florian Fainelli <florian@openwrt.org> |
| 5 | * |
| 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. |
| 9 | */ |
| 10 | |
| 11 | #include "dev-eth.h" |
| 12 | #include "dev-gpio-buttons.h" |
| 13 | #include "dev-leds-gpio.h" |
| 14 | #include "dev-m25p80.h" |
| 15 | #include "pci.h" |
| 16 | #include "dev-usb.h" |
| 17 | #include "machtypes.h" |
| 18 | |
| 19 | #define AP113_GPIO_LED_USB 0 |
| 20 | #define AP113_GPIO_LED_STATUS 1 |
| 21 | #define AP113_GPIO_LED_ST 11 |
| 22 | |
| 23 | #define AP113_GPIO_BTN_JUMPSTART 12 |
| 24 | |
| 25 | #define AP113_KEYS_POLL_INTERVAL 20 /* msecs */ |
| 26 | #define AP113_KEYS_DEBOUNCE_INTERVAL (3 * AP113_KEYS_POLL_INTERVAL) |
| 27 | |
| 28 | static struct gpio_led ap113_leds_gpio[] __initdata = { |
| 29 | { |
| 30 | .name = "ap113:green:usb", |
| 31 | .gpio = AP113_GPIO_LED_USB, |
| 32 | .active_low = 1, |
| 33 | }, |
| 34 | { |
| 35 | .name = "ap113:green:status", |
| 36 | .gpio = AP113_GPIO_LED_STATUS, |
| 37 | .active_low = 1, |
| 38 | }, |
| 39 | { |
| 40 | .name = "ap113:green:st", |
| 41 | .gpio = AP113_GPIO_LED_ST, |
| 42 | .active_low = 1, |
| 43 | } |
| 44 | }; |
| 45 | |
| 46 | static struct gpio_keys_button ap113_gpio_keys[] __initdata = { |
| 47 | { |
| 48 | .desc = "jumpstart button", |
| 49 | .type = EV_KEY, |
| 50 | .code = KEY_WPS_BUTTON, |
| 51 | .debounce_interval = AP113_KEYS_DEBOUNCE_INTERVAL, |
| 52 | .gpio = AP113_GPIO_BTN_JUMPSTART, |
| 53 | .active_low = 1, |
| 54 | }, |
| 55 | }; |
| 56 | |
| 57 | static void __init ap113_setup(void) |
| 58 | { |
| 59 | u8 *mac = (u8 *) KSEG1ADDR(0x1fff0000); |
| 60 | |
| 61 | ath79_register_m25p80(NULL); |
| 62 | |
| 63 | ath79_register_mdio(0, ~BIT(0)); |
| 64 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
| 65 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
| 66 | ath79_eth0_data.speed = SPEED_1000; |
| 67 | ath79_eth0_data.duplex = DUPLEX_FULL; |
| 68 | ath79_eth0_data.phy_mask = BIT(0); |
| 69 | |
| 70 | ath79_register_eth(0); |
| 71 | |
| 72 | ath79_register_gpio_keys_polled(-1, AP113_KEYS_POLL_INTERVAL, |
| 73 | ARRAY_SIZE(ap113_gpio_keys), |
| 74 | ap113_gpio_keys); |
| 75 | ath79_register_leds_gpio(-1, ARRAY_SIZE(ap113_leds_gpio), |
| 76 | ap113_leds_gpio); |
| 77 | |
| 78 | ath79_register_pci(); |
| 79 | |
| 80 | ath79_register_usb(); |
| 81 | } |
| 82 | |
| 83 | MIPS_MACHINE(ATH79_MACH_AP113, "AP113", "Atheros AP113", |
| 84 | ap113_setup); |
| 85 | |