OpenWrt – Blame information for rev 2
?pathlinks?
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | office | 1 | /* |
| 2 | * Domino board support |
||
| 3 | * |
||
| 4 | * Copyright (C) 2011 dongyuqi <729650915@qq.com> |
||
| 5 | * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org> |
||
| 6 | * Copyright (C) 2013 alzhao <alzhao@gmail.com> |
||
| 7 | * Copyright (C) 2014 Michel Stempin <michel.stempin@wanadoo.fr> |
||
| 8 | * |
||
| 9 | * This program is free software; you can redistribute it and/or modify it |
||
| 10 | * under the terms of the GNU General Public License version 2 as published |
||
| 11 | * by the Free Software Foundation. |
||
| 12 | */ |
||
| 13 | |||
| 14 | #include <linux/gpio.h> |
||
| 15 | |||
| 16 | #include <asm/mach-ath79/ath79.h> |
||
| 17 | |||
| 18 | #include "dev-eth.h" |
||
| 19 | #include "dev-gpio-buttons.h" |
||
| 20 | #include "dev-leds-gpio.h" |
||
| 21 | #include "dev-m25p80.h" |
||
| 22 | #include "dev-usb.h" |
||
| 23 | #include "dev-wmac.h" |
||
| 24 | #include "machtypes.h" |
||
| 25 | |||
| 26 | #define DOMINO_GPIO_LED_WLAN 0 |
||
| 27 | #define DOMINO_GPIO_LED_WAN 17 |
||
| 28 | #define DOMINO_GPIO_LED_USB 1 |
||
| 29 | #define DOMINO_GPIO_LED_LAN1 13 |
||
| 30 | #define DOMINO_GPIO_LED_LAN2 14 |
||
| 31 | #define DOMINO_GPIO_LED_LAN3 15 |
||
| 32 | #define DOMINO_GPIO_LED_LAN4 16 |
||
| 33 | #define DOMINO_GPIO_LED_SYS 27 |
||
| 34 | #define DOMINO_GPIO_LED_WPS 26 |
||
| 35 | #define DOMINO_GPIO_USB_POWER 6 |
||
| 36 | |||
| 37 | #define DOMINO_GPIO_BTN_RESET 11 |
||
| 38 | #define DOMINO_GPIO_BTN_WPS 20 |
||
| 39 | |||
| 40 | #define DOMINO_KEYS_POLL_INTERVAL 20 /* msecs */ |
||
| 41 | #define DOMINO_KEYS_DEBOUNCE_INTERVAL (3 * DOMINO_KEYS_POLL_INTERVAL) |
||
| 42 | |||
| 43 | #define DOMINO_MAC0_OFFSET 0x0000 |
||
| 44 | #define DOMINO_MAC1_OFFSET 0x0000 |
||
| 45 | #define DOMINO_CALDATA_OFFSET 0x1000 |
||
| 46 | #define DOMINO_WMAC_MAC_OFFSET 0x0000 |
||
| 47 | |||
| 48 | static struct gpio_led domino_leds_gpio[] __initdata = { |
||
| 49 | { |
||
| 50 | .name = "gl-domino:blue:wlan", |
||
| 51 | .gpio = DOMINO_GPIO_LED_WLAN, |
||
| 52 | .active_low = 0, |
||
| 53 | }, |
||
| 54 | { |
||
| 55 | .name = "gl-domino:red:wan", |
||
| 56 | .gpio = DOMINO_GPIO_LED_WAN, |
||
| 57 | .active_low = 1, |
||
| 58 | }, |
||
| 59 | { |
||
| 60 | .name = "gl-domino:white:usb", |
||
| 61 | .gpio = DOMINO_GPIO_LED_USB, |
||
| 62 | .active_low = 0, |
||
| 63 | }, |
||
| 64 | { |
||
| 65 | .name = "gl-domino:green:lan1", |
||
| 66 | .gpio = DOMINO_GPIO_LED_LAN1, |
||
| 67 | .active_low = 0, |
||
| 68 | }, |
||
| 69 | { |
||
| 70 | .name = "gl-domino:yellow:wps", |
||
| 71 | .gpio = DOMINO_GPIO_LED_WPS, |
||
| 72 | .active_low = 1, |
||
| 73 | }, |
||
| 74 | { |
||
| 75 | .name = "gl-domino:orange:sys", |
||
| 76 | .gpio = DOMINO_GPIO_LED_SYS, |
||
| 77 | .active_low = 1, |
||
| 78 | }, |
||
| 79 | }; |
||
| 80 | |||
| 81 | static struct gpio_keys_button domino_gpio_keys[] __initdata = { |
||
| 82 | { |
||
| 83 | .desc = "reset", |
||
| 84 | .type = EV_KEY, |
||
| 85 | .code = KEY_RESTART, |
||
| 86 | .debounce_interval = DOMINO_KEYS_DEBOUNCE_INTERVAL, |
||
| 87 | .gpio = DOMINO_GPIO_BTN_RESET, |
||
| 88 | .active_low = 0, |
||
| 89 | }, |
||
| 90 | { |
||
| 91 | .desc = "wps", |
||
| 92 | .type = EV_KEY, |
||
| 93 | .code = KEY_WPS_BUTTON, |
||
| 94 | .debounce_interval = DOMINO_KEYS_DEBOUNCE_INTERVAL, |
||
| 95 | .gpio = DOMINO_GPIO_BTN_WPS, |
||
| 96 | .active_low = 0, |
||
| 97 | } |
||
| 98 | }; |
||
| 99 | |||
| 100 | static void __init domino_setup(void) |
||
| 101 | { |
||
| 102 | |||
| 103 | /* ART base address */ |
||
| 104 | u8 *art = (u8 *) KSEG1ADDR(0x1fff0000); |
||
| 105 | |||
| 106 | /* disable PHY_SWAP and PHY_ADDR_SWAP bits */ |
||
| 107 | ath79_setup_ar933x_phy4_switch(false, false); |
||
| 108 | |||
| 109 | /* register flash. */ |
||
| 110 | ath79_register_m25p80(NULL); |
||
| 111 | |||
| 112 | /* register gpio LEDs and keys */ |
||
| 113 | ath79_register_leds_gpio(-1, ARRAY_SIZE(domino_leds_gpio), |
||
| 114 | domino_leds_gpio); |
||
| 115 | ath79_register_gpio_keys_polled(-1, DOMINO_KEYS_POLL_INTERVAL, |
||
| 116 | ARRAY_SIZE(domino_gpio_keys), |
||
| 117 | domino_gpio_keys); |
||
| 118 | |||
| 119 | gpio_request_one(DOMINO_GPIO_USB_POWER, |
||
| 120 | GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED, |
||
| 121 | "USB power"); |
||
| 122 | /* enable usb */ |
||
| 123 | ath79_register_usb(); |
||
| 124 | |||
| 125 | /* register eth0 as WAN, eth1 as LAN */ |
||
| 126 | ath79_init_mac(ath79_eth0_data.mac_addr, art+DOMINO_MAC0_OFFSET, 0); |
||
| 127 | ath79_init_mac(ath79_eth1_data.mac_addr, art+DOMINO_MAC1_OFFSET, 0); |
||
| 128 | ath79_register_mdio(0, 0x0); |
||
| 129 | ath79_register_eth(0); |
||
| 130 | ath79_register_eth(1); |
||
| 131 | |||
| 132 | /* register wireless mac with cal data */ |
||
| 133 | ath79_register_wmac(art + DOMINO_CALDATA_OFFSET, art + DOMINO_WMAC_MAC_OFFSET); |
||
| 134 | } |
||
| 135 | |||
| 136 | MIPS_MACHINE(ATH79_MACH_GL_DOMINO, "DOMINO", "Domino Pi", domino_setup); |