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_BTN_SW4 12
25 #define AP81_GPIO_BTN_SW1 21
27 #define AP81_BUTTONS_POLL_INTERVAL 20
29 #ifdef CONFIG_MTD_PARTITIONS
30 static struct mtd_partition ap81_partitions[] = {
35 .mask_flags = MTD_WRITEABLE,
52 .mask_flags = MTD_WRITEABLE,
55 #endif /* CONFIG_MTD_PARTITIONS */
57 static struct flash_platform_data ap81_flash_data = {
58 #ifdef CONFIG_MTD_PARTITIONS
59 .parts = ap81_partitions,
60 .nr_parts = ARRAY_SIZE(ap81_partitions),
64 static struct spi_board_info ap81_spi_info[] = {
68 .max_speed_hz = 25000000,
70 .platform_data = &ap81_flash_data,
74 static struct gpio_button ap81_gpio_buttons[] __initdata = {
80 .gpio = AP81_GPIO_BTN_SW1,
87 .gpio = AP81_GPIO_BTN_SW4,
92 static void __init ap81_setup(void)
94 ar71xx_add_device_mdio(0x0);
96 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
97 ar71xx_eth0_data.phy_mask = 0xf;
98 ar71xx_eth0_data.speed = SPEED_100;
99 ar71xx_eth0_data.duplex = DUPLEX_FULL;
100 ar71xx_eth0_data.has_ar8216 = 1;
102 ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RMII;
103 ar71xx_eth1_data.phy_mask = 0x10;
105 ar71xx_add_device_eth(0);
106 ar71xx_add_device_eth(1);
108 ar71xx_add_device_usb();
110 ar71xx_add_device_spi(NULL, ap81_spi_info,
111 ARRAY_SIZE(ap81_spi_info));
113 ar71xx_add_device_gpio_buttons(-1, AP81_BUTTONS_POLL_INTERVAL,
114 ARRAY_SIZE(ap81_gpio_buttons),
117 ar91xx_add_device_wmac();
120 MIPS_MACHINE(AR71XX_MACH_AP81, "Atheros AP81", ap81_setup);