2008-11-25 21:19:55 +02:00
|
|
|
/*
|
|
|
|
* Atheros AP83 board support
|
|
|
|
*
|
2009-02-23 10:50:00 +02:00
|
|
|
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
|
2008-11-25 21:19:55 +02:00
|
|
|
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
|
|
* by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/input.h>
|
2009-05-31 15:37:40 +03:00
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
#include <linux/mtd/physmap.h>
|
2009-05-27 20:16:19 +03:00
|
|
|
#include <linux/spi/spi.h>
|
|
|
|
#include <linux/spi/spi_gpio.h>
|
2008-11-25 21:19:55 +02:00
|
|
|
|
|
|
|
#include <asm/mips_machine.h>
|
|
|
|
#include <asm/mach-ar71xx/ar71xx.h>
|
2009-02-23 10:50:00 +02:00
|
|
|
|
|
|
|
#include "devices.h"
|
2008-11-25 21:19:55 +02:00
|
|
|
|
2008-11-28 11:06:01 +02:00
|
|
|
#define AP83_GPIO_LED_WLAN 6
|
|
|
|
#define AP83_GPIO_LED_POWER 14
|
|
|
|
#define AP83_GPIO_LED_JUMPSTART 15
|
2008-12-04 14:18:17 +02:00
|
|
|
#define AP83_GPIO_BTN_JUMPSTART 12
|
|
|
|
#define AP83_GPIO_BTN_RESET 21
|
2008-11-28 11:06:01 +02:00
|
|
|
|
2009-05-27 20:16:19 +03:00
|
|
|
#define AP83_GPIO_VSC7385_CS 1
|
|
|
|
#define AP83_GPIO_VSC7385_MISO 3
|
|
|
|
#define AP83_GPIO_VSC7385_MOSI 16
|
|
|
|
#define AP83_GPIO_VSC7385_SCK 17
|
|
|
|
|
2009-05-31 15:37:40 +03:00
|
|
|
#ifdef CONFIG_MTD_PARTITIONS
|
|
|
|
static struct mtd_partition ap83_flash_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "u-boot",
|
|
|
|
.offset = 0,
|
|
|
|
.size = 0x040000,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
} , {
|
|
|
|
.name = "u-boot-env",
|
|
|
|
.offset = 0x040000,
|
|
|
|
.size = 0x020000,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
} , {
|
|
|
|
.name = "rootfs",
|
|
|
|
.offset = 0x060000,
|
|
|
|
.size = 0x400000,
|
|
|
|
} , {
|
|
|
|
.name = "kernel",
|
|
|
|
.offset = 0x460000,
|
|
|
|
.size = 0x100000,
|
|
|
|
} , {
|
|
|
|
.name = "art",
|
|
|
|
.offset = 0x560000,
|
|
|
|
.size = 0x2a0000,
|
|
|
|
.mask_flags = MTD_WRITEABLE,
|
|
|
|
} , {
|
|
|
|
.name = "firmware",
|
|
|
|
.offset = 0x060000,
|
|
|
|
.size = 0x500000,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif /* CONFIG_MTD_PARTITIONS */
|
|
|
|
|
|
|
|
static struct physmap_flash_data ap83_flash_data = {
|
|
|
|
.width = 2,
|
|
|
|
#ifdef CONFIG_MTD_PARTITIONS
|
|
|
|
.parts = ap83_flash_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(ap83_flash_partitions),
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource ap83_flash_resources[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = AR71XX_SPI_BASE,
|
|
|
|
.end = AR71XX_SPI_BASE + AR71XX_SPI_SIZE - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device ap83_flash_device = {
|
|
|
|
.name = "physmap-flash",
|
|
|
|
.id = -1,
|
|
|
|
.resource = ap83_flash_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(ap83_flash_resources),
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &ap83_flash_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-11-28 11:06:01 +02:00
|
|
|
static struct gpio_led ap83_leds_gpio[] __initdata = {
|
|
|
|
{
|
|
|
|
.name = "ap83:green:jumpstart",
|
|
|
|
.gpio = AP83_GPIO_LED_JUMPSTART,
|
|
|
|
.active_low = 0,
|
|
|
|
}, {
|
|
|
|
.name = "ap83:green:power",
|
|
|
|
.gpio = AP83_GPIO_LED_POWER,
|
|
|
|
.active_low = 0,
|
|
|
|
}, {
|
|
|
|
.name = "ap83:green:wlan",
|
|
|
|
.gpio = AP83_GPIO_LED_WLAN,
|
|
|
|
.active_low = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-12-04 14:18:17 +02:00
|
|
|
static struct gpio_button ap83_gpio_buttons[] __initdata = {
|
|
|
|
{
|
|
|
|
.desc = "soft_reset",
|
|
|
|
.type = EV_KEY,
|
|
|
|
.code = BTN_0,
|
|
|
|
.threshold = 5,
|
|
|
|
.gpio = AP83_GPIO_BTN_RESET,
|
|
|
|
.active_low = 1,
|
2008-12-04 14:50:21 +02:00
|
|
|
} , {
|
2008-12-04 14:18:17 +02:00
|
|
|
.desc = "jumpstart",
|
|
|
|
.type = EV_KEY,
|
|
|
|
.code = BTN_1,
|
|
|
|
.threshold = 5,
|
|
|
|
.gpio = AP83_GPIO_BTN_JUMPSTART,
|
|
|
|
.active_low = 1,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-05-27 20:16:19 +03:00
|
|
|
static struct spi_gpio_platform_data ap83_spi_data = {
|
|
|
|
.miso = AP83_GPIO_VSC7385_MISO,
|
|
|
|
.mosi = AP83_GPIO_VSC7385_MOSI,
|
|
|
|
.sck = AP83_GPIO_VSC7385_SCK,
|
|
|
|
.num_chipselect = 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device ap83_spi_device = {
|
|
|
|
.name = "spi_gpio",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &ap83_spi_data,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-11-25 21:19:55 +02:00
|
|
|
static void __init ap83_setup(void)
|
|
|
|
{
|
2008-11-27 10:39:08 +02:00
|
|
|
ar71xx_add_device_mdio(0xfffffffe);
|
|
|
|
|
|
|
|
ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
|
|
|
|
ar71xx_eth0_data.phy_mask = 0x1;
|
|
|
|
|
|
|
|
ar71xx_add_device_eth(0);
|
2008-11-28 11:06:01 +02:00
|
|
|
|
2008-11-28 11:07:01 +02:00
|
|
|
ar71xx_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
|
|
|
|
ar71xx_eth1_data.phy_mask = 0x0;
|
|
|
|
ar71xx_eth1_data.speed = SPEED_1000;
|
|
|
|
ar71xx_eth1_data.duplex = DUPLEX_FULL;
|
|
|
|
|
2009-05-28 16:00:08 +03:00
|
|
|
ar71xx_eth1_pll_data.pll_1000 = 0x1f000000;
|
|
|
|
|
2008-11-28 11:07:01 +02:00
|
|
|
ar71xx_add_device_eth(1);
|
|
|
|
|
2008-11-28 12:07:56 +02:00
|
|
|
ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap83_leds_gpio),
|
|
|
|
ap83_leds_gpio);
|
2008-11-28 11:06:01 +02:00
|
|
|
|
2008-12-04 14:18:17 +02:00
|
|
|
ar71xx_add_device_gpio_buttons(-1, 20, ARRAY_SIZE(ap83_gpio_buttons),
|
|
|
|
ap83_gpio_buttons);
|
|
|
|
|
2008-12-04 11:11:03 +02:00
|
|
|
ar71xx_add_device_usb();
|
2008-12-30 08:52:57 +02:00
|
|
|
|
|
|
|
ar91xx_add_device_wmac();
|
2009-05-27 20:16:19 +03:00
|
|
|
|
|
|
|
platform_device_register(&ap83_spi_device);
|
2009-05-31 15:37:40 +03:00
|
|
|
platform_device_register(&ap83_flash_device);
|
2008-11-25 21:19:55 +02:00
|
|
|
}
|
|
|
|
|
2008-12-02 23:17:31 +02:00
|
|
|
MIPS_MACHINE(AR71XX_MACH_AP83, "Atheros AP83", ap83_setup);
|