2 * TP-LINK TL-WR1043N/ND board support
4 * Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
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/platform_device.h>
12 #include <linux/rtl8366.h>
13 #include <asm/mach-ath79/ath79.h>
16 #include "dev-m25p80.h"
17 #include "dev-gpio-buttons.h"
18 #include "dev-leds-gpio.h"
21 #include "machtypes.h"
23 #define TL_WR1043ND_GPIO_LED_USB 1
24 #define TL_WR1043ND_GPIO_LED_SYSTEM 2
25 #define TL_WR1043ND_GPIO_LED_QSS 5
26 #define TL_WR1043ND_GPIO_LED_WLAN 9
28 #define TL_WR1043ND_GPIO_BTN_RESET 3
29 #define TL_WR1043ND_GPIO_BTN_QSS 7
31 #define TL_WR1043ND_GPIO_RTL8366_SDA 18
32 #define TL_WR1043ND_GPIO_RTL8366_SCK 19
34 #define TL_WR1043ND_KEYS_POLL_INTERVAL 20 /* msecs */
35 #define TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043ND_KEYS_POLL_INTERVAL)
37 static const char *tl_wr1043nd_part_probes
[] = {
42 static struct flash_platform_data tl_wr1043nd_flash_data
= {
43 .part_probes
= tl_wr1043nd_part_probes
,
46 static struct gpio_led tl_wr1043nd_leds_gpio
[] __initdata
= {
48 .name
= "tp-link:green:usb",
49 .gpio
= TL_WR1043ND_GPIO_LED_USB
,
52 .name
= "tp-link:green:system",
53 .gpio
= TL_WR1043ND_GPIO_LED_SYSTEM
,
56 .name
= "tp-link:green:qss",
57 .gpio
= TL_WR1043ND_GPIO_LED_QSS
,
60 .name
= "tp-link:green:wlan",
61 .gpio
= TL_WR1043ND_GPIO_LED_WLAN
,
66 static struct gpio_keys_button tl_wr1043nd_gpio_keys
[] __initdata
= {
71 .debounce_interval
= TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL
,
72 .gpio
= TL_WR1043ND_GPIO_BTN_RESET
,
77 .code
= KEY_WPS_BUTTON
,
78 .debounce_interval
= TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL
,
79 .gpio
= TL_WR1043ND_GPIO_BTN_QSS
,
84 static struct rtl8366_platform_data tl_wr1043nd_rtl8366rb_data
= {
85 .gpio_sda
= TL_WR1043ND_GPIO_RTL8366_SDA
,
86 .gpio_sck
= TL_WR1043ND_GPIO_RTL8366_SCK
,
89 static struct platform_device tl_wr1043nd_rtl8366rb_device
= {
90 .name
= RTL8366RB_DRIVER_NAME
,
93 .platform_data
= &tl_wr1043nd_rtl8366rb_data
,
97 static void __init
tl_wr1043nd_setup(void)
99 u8
*mac
= (u8
*) KSEG1ADDR(0x1f01fc00);
100 u8
*eeprom
= (u8
*) KSEG1ADDR(0x1fff1000);
102 ath79_init_mac(ath79_eth0_data
.mac_addr
, mac
, 0);
103 ath79_eth0_data
.mii_bus_dev
= &tl_wr1043nd_rtl8366rb_device
.dev
;
104 ath79_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RGMII
;
105 ath79_eth0_data
.speed
= SPEED_1000
;
106 ath79_eth0_data
.duplex
= DUPLEX_FULL
;
107 ath79_eth0_pll_data
.pll_1000
= 0x1a000000;
109 ath79_register_eth(0);
111 ath79_register_usb();
113 ath79_register_m25p80(&tl_wr1043nd_flash_data
);
115 ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio
),
116 tl_wr1043nd_leds_gpio
);
118 platform_device_register(&tl_wr1043nd_rtl8366rb_device
);
120 ath79_register_gpio_keys_polled(-1, TL_WR1043ND_KEYS_POLL_INTERVAL
,
121 ARRAY_SIZE(tl_wr1043nd_gpio_keys
),
122 tl_wr1043nd_gpio_keys
);
124 ath79_register_wmac(eeprom
, mac
);
127 MIPS_MACHINE(ATH79_MACH_TL_WR1043ND
, "TL-WR1043ND", "TP-LINK TL-WR1043ND",