2 * Easy-Link EL-M150 board support
4 * Copyright (C) 2012 huangfc <huangfangcheng@163.com>
5 * Copyright (C) 2012 HYS <550663898@qq.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
12 #include <linux/gpio.h>
14 #include <asm/mach-ath79/ath79.h>
15 #include <asm/mach-ath79/ar71xx_regs.h>
19 #include "dev-gpio-buttons.h"
20 #include "dev-leds-gpio.h"
21 #include "dev-m25p80.h"
23 #include "machtypes.h"
26 #define EL_M150_GPIO_BTN6 6
27 #define EL_M150_GPIO_BTN7 7
28 #define EL_M150_GPIO_BTN_RESET 11
30 #define EL_M150_GPIO_LED_SYSTEM 27
31 #define EL_M150_GPIO_USB_POWER 8
33 #define EL_M150_KEYS_POLL_INTERVAL 20 /* msecs */
34 #define EL_M150_KEYS_DEBOUNCE_INTERVAL (3 * EL_M150_KEYS_POLL_INTERVAL)
36 static const char *EL_M150_part_probes[] = {
41 static struct flash_platform_data EL_M150_flash_data = {
42 .part_probes = EL_M150_part_probes,
45 static struct gpio_led EL_M150_leds_gpio[] __initdata = {
47 .name = "ELINK:green:system",
48 .gpio = EL_M150_GPIO_LED_SYSTEM,
53 static struct gpio_keys_button EL_M150_gpio_keys[] __initdata = {
58 .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
59 .gpio = EL_M150_GPIO_BTN_RESET,
66 .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
67 .gpio = EL_M150_GPIO_BTN6,
74 .debounce_interval = EL_M150_KEYS_DEBOUNCE_INTERVAL,
75 .gpio = EL_M150_GPIO_BTN7,
80 static void __init el_m150_setup(void)
82 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
83 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
85 /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
86 ath79_setup_ar933x_phy4_switch(false, false);
88 ath79_register_leds_gpio(-1, ARRAY_SIZE(EL_M150_leds_gpio),
91 ath79_register_gpio_keys_polled(-1, EL_M150_KEYS_POLL_INTERVAL,
92 ARRAY_SIZE(EL_M150_gpio_keys),
95 gpio_request_one(EL_M150_GPIO_USB_POWER,
96 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
100 ath79_register_m25p80(&EL_M150_flash_data);
101 ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
102 ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);
104 ath79_register_mdio(0, 0x0);
105 ath79_register_eth(0);
106 ath79_register_eth(1);
108 ath79_register_wmac(ee, mac);
111 MIPS_MACHINE(ATH79_MACH_EL_M150, "EL-M150",
112 "EasyLink EL-M150", el_m150_setup);