OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * Netgear WNDAP360 board support (proper leds / button support missing) |
||
3 | * |
||
4 | * Based on AP96 |
||
5 | * Copyright (C) 2013 Jacek Kikiewicz |
||
6 | * Copyright (C) 2009 Marco Porsch |
||
7 | * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org> |
||
8 | * Copyright (C) 2010 Atheros Communications |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it |
||
11 | * under the terms of the GNU General Public License version 2 as published |
||
12 | * by the Free Software Foundation. |
||
13 | */ |
||
14 | |||
15 | #include <linux/platform_device.h> |
||
16 | #include <linux/delay.h> |
||
17 | |||
18 | #include <asm/mach-ath79/ath79.h> |
||
19 | |||
20 | #include "dev-ap9x-pci.h" |
||
21 | #include "dev-eth.h" |
||
22 | #include "dev-gpio-buttons.h" |
||
23 | #include "dev-leds-gpio.h" |
||
24 | #include "dev-m25p80.h" |
||
25 | #include "machtypes.h" |
||
26 | |||
27 | #define WNDAP360_GPIO_LED_POWER_ORANGE 0 |
||
28 | #define WNDAP360_GPIO_LED_POWER_GREEN 2 |
||
29 | |||
30 | /* Reset button - next to the power connector */ |
||
31 | #define WNDAP360_GPIO_BTN_RESET 8 |
||
32 | |||
33 | #define WNDAP360_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
34 | #define WNDAP360_KEYS_DEBOUNCE_INTERVAL (3 * WNDAP360_KEYS_POLL_INTERVAL) |
||
35 | |||
36 | #define WNDAP360_WMAC0_MAC_OFFSET 0x120c |
||
37 | #define WNDAP360_WMAC1_MAC_OFFSET 0x520c |
||
38 | #define WNDAP360_CALDATA0_OFFSET 0x1000 |
||
39 | #define WNDAP360_CALDATA1_OFFSET 0x5000 |
||
40 | |||
41 | /* |
||
42 | * WNDAP360 this still uses leds definitions from AP96 |
||
43 | * |
||
44 | */ |
||
45 | static struct gpio_led wndap360_leds_gpio[] __initdata = { |
||
46 | { |
||
47 | .name = "netgear:green:power", |
||
48 | .gpio = WNDAP360_GPIO_LED_POWER_GREEN, |
||
49 | .active_low = 1, |
||
50 | }, { |
||
51 | .name = "netgear:orange:power", |
||
52 | .gpio = WNDAP360_GPIO_LED_POWER_ORANGE, |
||
53 | .active_low = 1, |
||
54 | } |
||
55 | }; |
||
56 | |||
57 | static struct gpio_keys_button wndap360_gpio_keys[] __initdata = { |
||
58 | { |
||
59 | .desc = "reset", |
||
60 | .type = EV_KEY, |
||
61 | .code = KEY_RESTART, |
||
62 | .debounce_interval = WNDAP360_KEYS_DEBOUNCE_INTERVAL, |
||
63 | .gpio = WNDAP360_GPIO_BTN_RESET, |
||
64 | .active_low = 1, |
||
65 | } |
||
66 | }; |
||
67 | |||
68 | #define WNDAP360_LAN_PHYMASK 0x0f |
||
69 | |||
70 | static void __init wndap360_setup(void) |
||
71 | { |
||
72 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
||
73 | |||
74 | ath79_register_mdio(0, ~(WNDAP360_LAN_PHYMASK)); |
||
75 | |||
76 | /* Reusing wifi MAC with offset of 1 as eth0 MAC */ |
||
77 | ath79_init_mac(ath79_eth0_data.mac_addr, |
||
78 | art + WNDAP360_WMAC0_MAC_OFFSET, 1); |
||
79 | ath79_eth0_pll_data.pll_1000 = 0x11110000; |
||
80 | ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII; |
||
81 | ath79_eth0_data.phy_mask = WNDAP360_LAN_PHYMASK; |
||
82 | ath79_eth0_data.speed = SPEED_1000; |
||
83 | ath79_eth0_data.duplex = DUPLEX_FULL; |
||
84 | |||
85 | ath79_register_eth(0); |
||
86 | |||
87 | ath79_register_m25p80(NULL); |
||
88 | |||
89 | ath79_register_leds_gpio(-1, ARRAY_SIZE(wndap360_leds_gpio), |
||
90 | wndap360_leds_gpio); |
||
91 | |||
92 | ath79_register_gpio_keys_polled(-1, WNDAP360_KEYS_POLL_INTERVAL, |
||
93 | ARRAY_SIZE(wndap360_gpio_keys), |
||
94 | wndap360_gpio_keys); |
||
95 | |||
96 | ap9x_pci_setup_wmac_led_pin(0, 5); |
||
97 | ap9x_pci_setup_wmac_led_pin(1, 5); |
||
98 | |||
99 | ap94_pci_init(art + WNDAP360_CALDATA0_OFFSET, |
||
100 | art + WNDAP360_WMAC0_MAC_OFFSET, |
||
101 | art + WNDAP360_CALDATA1_OFFSET, |
||
102 | art + WNDAP360_WMAC1_MAC_OFFSET); |
||
103 | } |
||
104 | |||
105 | MIPS_MACHINE(ATH79_MACH_WNDAP360, "WNDAP360", "NETGEAR WNDAP360", wndap360_setup); |