2 * Atheros AP83 board support
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 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/input.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/spi/spi.h>
18 #include <linux/spi/spi_gpio.h>
20 #include <asm/mips_machine.h>
21 #include <asm/mach-ar71xx/ar71xx.h>
25 #define AP83_GPIO_LED_WLAN 6
26 #define AP83_GPIO_LED_POWER 14
27 #define AP83_GPIO_LED_JUMPSTART 15
28 #define AP83_GPIO_BTN_JUMPSTART 12
29 #define AP83_GPIO_BTN_RESET 21
31 #define AP83_GPIO_VSC7385_CS 1
32 #define AP83_GPIO_VSC7385_MISO 3
33 #define AP83_GPIO_VSC7385_MOSI 16
34 #define AP83_GPIO_VSC7385_SCK 17
36 #ifdef CONFIG_MTD_PARTITIONS
37 static struct mtd_partition ap83_flash_partitions
[] = {
42 .mask_flags
= MTD_WRITEABLE
,
47 .mask_flags
= MTD_WRITEABLE
,
60 .mask_flags
= MTD_WRITEABLE
,
67 #endif /* CONFIG_MTD_PARTITIONS */
69 static struct physmap_flash_data ap83_flash_data
= {
71 #ifdef CONFIG_MTD_PARTITIONS
72 .parts
= ap83_flash_partitions
,
73 .nr_parts
= ARRAY_SIZE(ap83_flash_partitions
),
77 static struct resource ap83_flash_resources
[] = {
79 .start
= AR71XX_SPI_BASE
,
80 .end
= AR71XX_SPI_BASE
+ AR71XX_SPI_SIZE
- 1,
81 .flags
= IORESOURCE_MEM
,
85 static struct platform_device ap83_flash_device
= {
86 .name
= "physmap-flash",
88 .resource
= ap83_flash_resources
,
89 .num_resources
= ARRAY_SIZE(ap83_flash_resources
),
91 .platform_data
= &ap83_flash_data
,
95 static struct gpio_led ap83_leds_gpio
[] __initdata
= {
97 .name
= "ap83:green:jumpstart",
98 .gpio
= AP83_GPIO_LED_JUMPSTART
,
101 .name
= "ap83:green:power",
102 .gpio
= AP83_GPIO_LED_POWER
,
105 .name
= "ap83:green:wlan",
106 .gpio
= AP83_GPIO_LED_WLAN
,
111 static struct gpio_button ap83_gpio_buttons
[] __initdata
= {
113 .desc
= "soft_reset",
117 .gpio
= AP83_GPIO_BTN_RESET
,
124 .gpio
= AP83_GPIO_BTN_JUMPSTART
,
129 static struct spi_gpio_platform_data ap83_spi_data
= {
130 .miso
= AP83_GPIO_VSC7385_MISO
,
131 .mosi
= AP83_GPIO_VSC7385_MOSI
,
132 .sck
= AP83_GPIO_VSC7385_SCK
,
136 static struct platform_device ap83_spi_device
= {
140 .platform_data
= &ap83_spi_data
,
144 static void __init
ap83_setup(void)
146 ar71xx_add_device_mdio(0xfffffffe);
148 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
149 ar71xx_eth0_data
.phy_mask
= 0x1;
151 ar71xx_add_device_eth(0);
153 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
154 ar71xx_eth1_data
.phy_mask
= 0x0;
155 ar71xx_eth1_data
.speed
= SPEED_1000
;
156 ar71xx_eth1_data
.duplex
= DUPLEX_FULL
;
158 ar71xx_eth1_pll_data
.pll_1000
= 0x1f000000;
160 ar71xx_add_device_eth(1);
162 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(ap83_leds_gpio
),
165 ar71xx_add_device_gpio_buttons(-1, 20, ARRAY_SIZE(ap83_gpio_buttons
),
168 ar71xx_add_device_usb();
170 ar91xx_add_device_wmac();
172 platform_device_register(&ap83_spi_device
);
173 platform_device_register(&ap83_flash_device
);
176 MIPS_MACHINE(AR71XX_MACH_AP83
, "Atheros AP83", ap83_setup
);