OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * Cisco Meraki MR12 board support |
||
3 | * |
||
4 | * Copyright (C) 2014-2015 Chris Blake <chrisrblake93@gmail.com> |
||
5 | * |
||
6 | * Based on Atheros AP96 board support configuration |
||
7 | * |
||
8 | * Copyright (C) 2009 Marco Porsch |
||
9 | * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> |
||
10 | * Copyright (C) 2010 Atheros Communications |
||
11 | * |
||
12 | * This program is free software; you can redistribute it and/or modify it |
||
13 | * under the terms of the GNU General Public License version 2 as published |
||
14 | * by the Free Software Foundation. |
||
15 | */ |
||
16 | |||
17 | #include <linux/platform_device.h> |
||
18 | #include <linux/delay.h> |
||
19 | |||
20 | #include <asm/mach-ath79/ath79.h> |
||
21 | |||
22 | #include "dev-ap9x-pci.h" |
||
23 | #include "dev-eth.h" |
||
24 | #include "dev-gpio-buttons.h" |
||
25 | #include "dev-leds-gpio.h" |
||
26 | #include "dev-m25p80.h" |
||
27 | #include "machtypes.h" |
||
28 | |||
29 | #define MR12_GPIO_LED_W4_GREEN 14 |
||
30 | #define MR12_GPIO_LED_W3_GREEN 13 |
||
31 | #define MR12_GPIO_LED_W2_GREEN 12 |
||
32 | #define MR12_GPIO_LED_W1_GREEN 11 |
||
33 | |||
34 | #define MR12_GPIO_LED_WAN 15 |
||
35 | |||
36 | #define MR12_GPIO_LED_POWER_ORANGE 16 |
||
37 | #define MR12_GPIO_LED_POWER_GREEN 17 |
||
38 | |||
39 | #define MR12_GPIO_BTN_RESET 8 |
||
40 | #define MR12_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
41 | #define MR12_KEYS_DEBOUNCE_INTERVAL (3 * MR12_KEYS_POLL_INTERVAL) |
||
42 | |||
43 | #define MR12_WAN_PHYMASK BIT(4) |
||
44 | |||
45 | #define MR12_CALDATA0_OFFSET 0x21000 |
||
46 | |||
47 | static struct gpio_led MR12_leds_gpio[] __initdata = { |
||
48 | { |
||
49 | .name = "mr12:green:wan", |
||
50 | .gpio = MR12_GPIO_LED_WAN, |
||
51 | .active_low = 1, |
||
52 | }, { |
||
53 | .name = "mr12:orange:power", |
||
54 | .gpio = MR12_GPIO_LED_POWER_ORANGE, |
||
55 | .active_low = 1, |
||
56 | }, { |
||
57 | .name = "mr12:green:power", |
||
58 | .gpio = MR12_GPIO_LED_POWER_GREEN, |
||
59 | .active_low = 1, |
||
60 | }, { |
||
61 | .name = "mr12:green:wifi4", |
||
62 | .gpio = MR12_GPIO_LED_W4_GREEN, |
||
63 | .active_low = 1, |
||
64 | }, { |
||
65 | .name = "mr12:green:wifi3", |
||
66 | .gpio = MR12_GPIO_LED_W3_GREEN, |
||
67 | .active_low = 1, |
||
68 | }, { |
||
69 | .name = "mr12:green:wifi2", |
||
70 | .gpio = MR12_GPIO_LED_W2_GREEN, |
||
71 | .active_low = 1, |
||
72 | }, { |
||
73 | .name = "mr12:green:wifi1", |
||
74 | .gpio = MR12_GPIO_LED_W1_GREEN, |
||
75 | .active_low = 1, |
||
76 | } |
||
77 | }; |
||
78 | |||
79 | static struct gpio_keys_button MR12_gpio_keys[] __initdata = { |
||
80 | { |
||
81 | .desc = "reset", |
||
82 | .type = EV_KEY, |
||
83 | .code = KEY_RESTART, |
||
84 | .debounce_interval = MR12_KEYS_DEBOUNCE_INTERVAL, |
||
85 | .gpio = MR12_GPIO_BTN_RESET, |
||
86 | .active_low = 1, |
||
87 | } |
||
88 | }; |
||
89 | |||
90 | static void __init MR12_setup(void) |
||
91 | { |
||
92 | u8 *mac = (u8 *) KSEG1ADDR(0xbffd0000); |
||
93 | u8 wlan_mac[ETH_ALEN]; |
||
94 | |||
95 | ath79_register_mdio(0,0x0); |
||
96 | |||
97 | ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0); |
||
98 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
99 | ath79_eth0_data.phy_mask = MR12_WAN_PHYMASK; |
||
100 | ath79_register_eth(0); |
||
101 | |||
102 | ath79_register_m25p80(NULL); |
||
103 | |||
104 | ath79_register_leds_gpio(-1, ARRAY_SIZE(MR12_leds_gpio), |
||
105 | MR12_leds_gpio); |
||
106 | ath79_register_gpio_keys_polled(-1, MR12_KEYS_POLL_INTERVAL, |
||
107 | ARRAY_SIZE(MR12_gpio_keys), |
||
108 | MR12_gpio_keys); |
||
109 | |||
110 | ath79_init_mac(wlan_mac, mac, 1); |
||
111 | ap91_pci_init(mac + MR12_CALDATA0_OFFSET, wlan_mac); |
||
112 | } |
||
113 | |||
114 | MIPS_MACHINE(ATH79_MACH_MR12, "MR12", "Meraki MR12", MR12_setup); |