ad7a8937edaa5c3e7a1cc9938804ef9fbb699c7d
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ar71xx / mach-db120.c
1 /*
2 * Atheros DB120 board (WASP SoC) support
3 *
4 * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
5 *
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.
9 */
10
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13
14 #include <asm/mach-ar71xx/ar71xx.h>
15
16 #include "machtype.h"
17 #include "devices.h"
18 #include "dev-m25p80.h"
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-usb.h"
22 #include "dev-ar934x-wmac.h"
23 #include "dev-db120-pci.h"
24
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
30
31 #define DB120_GPIO_BTN_SW1 16
32
33 #define DB120_CALDATA_OFFSET 0x1000
34 #define DB120_WMAC_MAC_OFFSET 0x1003
35
36 #define DB120_BUTTONS_POLL_INTERVAL 20
37
38 #ifdef CONFIG_MTD_PARTITIONS
39 static struct mtd_partition db120_partitions[] = {
40 {
41 .name = "u-boot",
42 .offset = 0,
43 .size = 0x040000,
44 .mask_flags = MTD_WRITEABLE,
45 }, {
46 .name = "u-boot-env",
47 .offset = 0x040000,
48 .size = 0x010000,
49 }, {
50 .name = "rootfs",
51 .offset = 0x050000,
52 .size = 0x630000,
53 }, {
54 .name = "uImage",
55 .offset = 0x680000,
56 .size = 0x160000,
57 }, {
58 .name = "NVRAM",
59 .offset = 0x7E0000,
60 .size = 0x010000,
61 }, {
62 .name = "ART",
63 .offset = 0x7F0000,
64 .size = 0x010000,
65 .mask_flags = MTD_WRITEABLE,
66 }
67 };
68 #endif /* CONFIG_MTD_PARTITIONS */
69
70 static struct flash_platform_data db120_flash_data = {
71 #ifdef CONFIG_MTD_PARTITIONS
72 .parts = db120_partitions,
73 .nr_parts = ARRAY_SIZE(db120_partitions),
74 #endif
75 };
76
77 static struct gpio_led db120_leds_gpio[] __initdata = {
78 {
79 .name = "db120:green:status",
80 .gpio = DB120_GPIO_LED_STATUS,
81 .active_low = 1,
82 }, {
83 .name = "db120:green:wps",
84 .gpio = DB120_GPIO_LED_WPS,
85 .active_low = 1,
86 }, {
87 .name = "db120:green:wlan-5g",
88 .gpio = DB120_GPIO_LED_WLAN_5G,
89 .active_low = 1,
90 }, {
91 .name = "db120:green:wlan-2g",
92 .gpio = DB120_GPIO_LED_WLAN_2G,
93 .active_low = 1,
94 }, {
95 .name = "db120:green:usb",
96 .gpio = DB120_GPIO_LED_USB,
97 .active_low = 1,
98 }
99 };
100
101 static struct gpio_button db120_gpio_buttons[] __initdata = {
102 {
103 .desc = "sw1",
104 .type = EV_KEY,
105 .code = BTN_0,
106 .threshold = 3,
107 .gpio = DB120_GPIO_BTN_SW1,
108 .active_low = 1,
109 }
110 };
111
112 static void __init db120_setup(void)
113 {
114 u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
115
116 ar71xx_add_device_usb();
117
118 ar71xx_add_device_m25p80(&db120_flash_data);
119
120 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(db120_leds_gpio),
121 db120_leds_gpio);
122
123 ar71xx_add_device_gpio_buttons(-1, DB120_BUTTONS_POLL_INTERVAL,
124 ARRAY_SIZE(db120_gpio_buttons),
125 db120_gpio_buttons);
126
127 ar934x_add_device_wmac(art + DB120_CALDATA_OFFSET,
128 art + DB120_WMAC_MAC_OFFSET);
129
130 db120_pci_init();
131 }
132
133 MIPS_MACHINE(AR71XX_MACH_DB120, "DB120", "Atheros DB120", db120_setup);
This page took 0.051496 seconds and 3 git commands to generate.