2 * Atheros DB120 board (WASP SoC) support
4 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
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.
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
14 #include <asm/mach-ar71xx/ar71xx.h>
18 #include "dev-m25p80.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
22 #include "dev-ar9xxx-wmac.h"
23 #include "dev-db120-pci.h"
25 #define DB120_GPIO_LED_USB 11
26 #define DB120_GPIO_LED_WLAN_5G 12
27 #define DB120_GPIO_LED_WLAN_2G 13
28 #define DB120_GPIO_LED_STATUS 14
29 #define DB120_GPIO_LED_WPS 15
31 #define DB120_GPIO_BTN_WPS 16
33 #define DB120_MAC0_OFFSET 0
34 #define DB120_MAC1_OFFSET 6
35 #define DB120_CALDATA_OFFSET 0x1000
37 #define DB120_KEYS_POLL_INTERVAL 20 /* msecs */
38 #define DB120_KEYS_DEBOUNCE_INTERVAL (3 * DB120_KEYS_POLL_INTERVAL)
40 #ifdef CONFIG_MTD_PARTITIONS
41 static struct mtd_partition db120_partitions
[] = {
46 .mask_flags
= MTD_WRITEABLE
,
67 .mask_flags
= MTD_WRITEABLE
,
70 #endif /* CONFIG_MTD_PARTITIONS */
72 static struct flash_platform_data db120_flash_data
= {
73 #ifdef CONFIG_MTD_PARTITIONS
74 .parts
= db120_partitions
,
75 .nr_parts
= ARRAY_SIZE(db120_partitions
),
79 static struct gpio_led db120_leds_gpio
[] __initdata
= {
81 .name
= "db120:green:status",
82 .gpio
= DB120_GPIO_LED_STATUS
,
85 .name
= "db120:green:wps",
86 .gpio
= DB120_GPIO_LED_WPS
,
89 .name
= "db120:green:wlan-5g",
90 .gpio
= DB120_GPIO_LED_WLAN_5G
,
93 .name
= "db120:green:wlan-2g",
94 .gpio
= DB120_GPIO_LED_WLAN_2G
,
97 .name
= "db120:green:usb",
98 .gpio
= DB120_GPIO_LED_USB
,
103 static struct gpio_keys_button db120_gpio_keys
[] __initdata
= {
105 .desc
= "WPS button",
107 .code
= KEY_WPS_BUTTON
,
108 .debounce_interval
= DB120_KEYS_DEBOUNCE_INTERVAL
,
109 .gpio
= DB120_GPIO_BTN_WPS
,
114 static void __init
db120_setup(void)
116 u8
*art
= (u8
*) KSEG1ADDR(0x1fff0000);
118 ar71xx_add_device_usb();
120 ar71xx_add_device_m25p80(&db120_flash_data
);
122 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio
),
125 ar71xx_register_gpio_keys_polled(-1, DB120_KEYS_POLL_INTERVAL
,
126 ARRAY_SIZE(db120_gpio_keys
),
129 ar71xx_add_device_mdio(0, 0x0);
130 ar71xx_add_device_mdio(1, 0x0);
132 /* GMAC0 is connected to an AR8327 switch */
133 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, art
+ DB120_MAC0_OFFSET
, 0);
134 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
135 ar71xx_eth0_data
.speed
= SPEED_1000
;
136 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
138 ar71xx_add_device_eth(0);
140 /* GMAC1 is connected to the internal switch */
141 ar71xx_init_mac(ar71xx_eth1_data
.mac_addr
, art
+ DB120_MAC1_OFFSET
, 0);
142 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_GMII
;
143 ar71xx_eth1_data
.speed
= SPEED_100
;
144 ar71xx_eth1_data
.duplex
= DUPLEX_FULL
;
146 ar71xx_add_device_eth(1);
148 ar9xxx_add_device_wmac(art
+ DB120_CALDATA_OFFSET
, NULL
);
153 MIPS_MACHINE(AR71XX_MACH_DB120
, "DB120", "Atheros DB120", db120_setup
);