2 * Telldus TellStick ZNet Lite board support
4 * Copyright (C) 2016 Micke Prag <micke.prag@telldus.se>
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.
11 #include <linux/gpio.h>
13 #include <asm/mach-ath79/ath79.h>
14 #include <asm/mach-ath79/ar71xx_regs.h>
18 #include "dev-gpio-buttons.h"
19 #include "dev-leds-gpio.h"
20 #include "dev-m25p80.h"
23 #include "machtypes.h"
25 #define TELLSTICK_GPIO_LED_SYSTEM 27
26 #define TELLSTICK_GPIO_LED_BLUE 0
27 #define TELLSTICK_GPIO_LED_RED 14
28 #define TELLSTICK_GPIO_LED_GREEN 15
29 #define TELLSTICK_GPIO_LED_LAN_GREEN 16
30 #define TELLSTICK_GPIO_LED_LAN_ORANGE 17
32 #define TELLSTICK_GPIO_BTN_RESET 11
34 #define TELLSTICK_GPIO_RF433_RESET 13
36 #define TELLSTICK_KEYS_POLL_INTERVAL 20 /* msecs */
37 #define TELLSTICK_KEYS_DEBOUNCE_INTERVAL (3 * TELLSTICK_KEYS_POLL_INTERVAL)
39 static const char *tellstick_part_probes[] = {
44 static struct flash_platform_data tellstick_flash_data = {
45 .part_probes = tellstick_part_probes,
48 static struct gpio_led tellstick_leds_gpio[] __initdata = {
50 .name = "tellstick:white:system",
51 .gpio = TELLSTICK_GPIO_LED_SYSTEM,
55 .name = "tellstick:blue:status",
56 .gpio = TELLSTICK_GPIO_LED_BLUE,
60 .name = "tellstick:red:status",
61 .gpio = TELLSTICK_GPIO_LED_RED,
65 .name = "tellstick:green:status",
66 .gpio = TELLSTICK_GPIO_LED_GREEN,
70 .name = "tellstick:green:lan",
71 .gpio = TELLSTICK_GPIO_LED_LAN_GREEN,
75 .name = "tellstick:orange:lan",
76 .gpio = TELLSTICK_GPIO_LED_LAN_ORANGE,
81 static struct gpio_keys_button tellstick_gpio_keys[] __initdata = {
86 .debounce_interval = TELLSTICK_KEYS_DEBOUNCE_INTERVAL,
87 .gpio = TELLSTICK_GPIO_BTN_RESET,
92 static void __init tellstick_znet_lite_setup(void)
94 u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
96 memcpy(&mac, (u8 *) KSEG1ADDR(0x1f01fc00), sizeof(mac));
98 ath79_gpio_function_disable(
99 AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
100 AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
101 AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
102 AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
103 AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN
106 ath79_register_m25p80(&tellstick_flash_data);
107 ath79_register_leds_gpio(-1, ARRAY_SIZE(tellstick_leds_gpio),
108 tellstick_leds_gpio);
109 ath79_register_gpio_keys_polled(-1, TELLSTICK_KEYS_POLL_INTERVAL,
110 ARRAY_SIZE(tellstick_gpio_keys),
111 tellstick_gpio_keys);
113 gpio_request_one(TELLSTICK_GPIO_RF433_RESET,
114 GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
116 ath79_register_usb();
118 ath79_init_mac(ath79_eth0_data.mac_addr, (u8 *)mac, 0);
120 ath79_register_mdio(0, 0x0);
121 ath79_register_eth(0);
123 // wlan0 mac needs to be different then eth0
125 ath79_register_wmac(ee, (u8 *)mac);
128 MIPS_MACHINE(ATH79_MACH_TELLSTICK_ZNET_LITE, "TELLSTICK-ZNET-LITE", "Telldus TellStick ZNet Lite",
129 tellstick_znet_lite_setup);