Revert "ar71xx: Clear bits in ath79_setup_qca955x_eth_cfg"
[openwrt.git] / target / linux / ar71xx / files / arch / mips / ath79 / mach-all0258n.c
1 /*
2  *  Allnet ALL0258N support
3  *
4  *  Copyright (C) 2011 Daniel Golle <dgolle@allnet.de>
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 <asm/mach-ath79/ath79.h>
12
13 #include "dev-eth.h"
14 #include "dev-ap9x-pci.h"
15 #include "dev-gpio-buttons.h"
16 #include "dev-leds-gpio.h"
17 #include "dev-m25p80.h"
18 #include "machtypes.h"
19
20 /* found via /sys/gpio/... try and error */
21 #define ALL0258N_GPIO_BTN_RESET         1
22 #define ALL0258N_GPIO_LED_RSSIHIGH      13
23 #define ALL0258N_GPIO_LED_RSSIMEDIUM    15
24 #define ALL0258N_GPIO_LED_RSSILOW       14
25
26 /* defaults taken from others machs */
27 #define ALL0258N_KEYS_POLL_INTERVAL     20      /* msecs */
28 #define ALL0258N_KEYS_DEBOUNCE_INTERVAL (3 * ALL0258N_KEYS_POLL_INTERVAL)
29
30 /* showed up in the original firmware's bootlog */
31 #define ALL0258N_SEC_PHYMASK BIT(3)
32
33 static struct gpio_led all0258n_leds_gpio[] __initdata = {
34         {
35                 .name           = "all0258n:green:rssihigh",
36                 .gpio           = ALL0258N_GPIO_LED_RSSIHIGH,
37                 .active_low     = 1,
38         }, {
39                 .name           = "all0258n:yellow:rssimedium",
40                 .gpio           = ALL0258N_GPIO_LED_RSSIMEDIUM,
41                 .active_low     = 1,
42         }, {
43                 .name           = "all0258n:red:rssilow",
44                 .gpio           = ALL0258N_GPIO_LED_RSSILOW,
45                 .active_low     = 1,
46         }
47 };
48
49 static struct gpio_keys_button all0258n_gpio_keys[] __initdata = {
50         {
51                 .desc           = "reset",
52                 .type           = EV_KEY,
53                 .code           = KEY_RESTART,
54                 .debounce_interval = ALL0258N_KEYS_DEBOUNCE_INTERVAL,
55                 .gpio           = ALL0258N_GPIO_BTN_RESET,
56                 .active_low     = 1,
57         }
58 };
59
60 static void __init all0258n_setup(void)
61 {
62         u8 *mac = (u8 *) KSEG1ADDR(0x1f7f0000);
63         u8 *ee =  (u8 *) KSEG1ADDR(0x1f7f1000);
64
65         ath79_register_m25p80(NULL);
66
67         ath79_register_leds_gpio(-1, ARRAY_SIZE(all0258n_leds_gpio),
68                                  all0258n_leds_gpio);
69
70         ath79_register_gpio_keys_polled(-1, ALL0258N_KEYS_POLL_INTERVAL,
71                                         ARRAY_SIZE(all0258n_gpio_keys),
72                                         all0258n_gpio_keys);
73
74         ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
75         ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
76
77         ath79_eth1_data.phy_mask = ALL0258N_SEC_PHYMASK;
78
79         ath79_register_mdio(0, 0x0);
80
81         ath79_register_eth(0);
82         ath79_register_eth(1);
83
84         ap91_pci_init(ee, mac);
85 }
86
87 MIPS_MACHINE(ATH79_MACH_ALL0258N, "ALL0258N", "Allnet ALL0258N",
88              all0258n_setup);