2 * Atheros AP81 board support
4 * Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2009 Imre Kaloz <kaloz@openwrt.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/platform_device.h>
13 #include <linux/mtd/mtd.h>
14 #include <linux/mtd/partitions.h>
15 #include <linux/spi/spi.h>
16 #include <linux/spi/flash.h>
17 #include <linux/input.h>
19 #include <asm/mips_machine.h>
20 #include <asm/mach-ar71xx/ar71xx.h>
24 #define AP81_GPIO_LED_STATUS 1
25 #define AP81_GPIO_LED_AOSS 3
26 #define AP81_GPIO_LED_WLAN 6
27 #define AP81_GPIO_LED_POWER 14
29 #define AP81_GPIO_BTN_SW4 12
30 #define AP81_GPIO_BTN_SW1 21
32 #define AP81_BUTTONS_POLL_INTERVAL 20
34 #ifdef CONFIG_MTD_PARTITIONS
35 static struct mtd_partition ap81_partitions[] = {
40 .mask_flags = MTD_WRITEABLE,
57 .mask_flags = MTD_WRITEABLE,
60 #endif /* CONFIG_MTD_PARTITIONS */
62 static struct flash_platform_data ap81_flash_data = {
63 #ifdef CONFIG_MTD_PARTITIONS
64 .parts = ap81_partitions,
65 .nr_parts = ARRAY_SIZE(ap81_partitions),
69 static struct spi_board_info ap81_spi_info[] = {
73 .max_speed_hz = 25000000,
75 .platform_data = &ap81_flash_data,
79 static struct gpio_led ap81_leds_gpio[] __initdata = {
81 .name = "ap81:green:status",
82 .gpio = AP81_GPIO_LED_STATUS,
85 .name = "ap81:amber:aoss",
86 .gpio = AP81_GPIO_LED_AOSS,
89 .name = "ap81:green:wlan",
90 .gpio = AP81_GPIO_LED_WLAN,
93 .name = "ap81:green:power",
94 .gpio = AP81_GPIO_LED_POWER,
99 static struct gpio_button ap81_gpio_buttons[] __initdata = {
105 .gpio = AP81_GPIO_BTN_SW1,
112 .gpio = AP81_GPIO_BTN_SW4,
117 static void __init ap81_setup(void)
119 u8 *mac = (u8 *) KSEG1ADDR(0x1fff1000);
121 ar71xx_set_mac_base(mac);
122 ar71xx_add_device_mdio(0x0);
124 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
125 ar71xx_eth0_data.phy_mask = 0xf;
126 ar71xx_eth0_data.speed = SPEED_100;
127 ar71xx_eth0_data.duplex = DUPLEX_FULL;
128 ar71xx_eth0_data.has_ar8216 = 1;
130 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
131 ar71xx_eth1_data.phy_mask = 0x10;
133 ar71xx_add_device_eth(0);
134 ar71xx_add_device_eth(1);
136 ar71xx_add_device_usb();
138 ar71xx_add_device_spi(NULL, ap81_spi_info,
139 ARRAY_SIZE(ap81_spi_info));
141 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap81_leds_gpio),
144 ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
145 ARRAY_SIZE(ap81_gpio_buttons),
148 ar91xx_add_device_wmac();
151 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);