2 * TP-LINK TL-WR1043ND board support
4 * Copyright (C) 2009 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/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
13 #include <linux/platform_device.h>
14 #include <linux/rtl8366rb.h>
15 #include <asm/mach-ar71xx/ar71xx.h>
19 #include "dev-m25p80.h"
20 #include "dev-ar913x-wmac.h"
21 #include "dev-gpio-buttons.h"
22 #include "dev-leds-gpio.h"
25 #define TL_WR1043ND_GPIO_LED_USB 1
26 #define TL_WR1043ND_GPIO_LED_SYSTEM 2
27 #define TL_WR1043ND_GPIO_LED_QSS 5
28 #define TL_WR1043ND_GPIO_LED_WLAN 9
30 #define TL_WR1043ND_GPIO_BTN_RESET 3
31 #define TL_WR1043ND_GPIO_BTN_QSS 7
33 #define TL_WR1043ND_GPIO_RTL8366_SDA 18
34 #define TL_WR1043ND_GPIO_RTL8366_SCK 19
36 #define TL_WR1043ND_BUTTONS_POLL_INTERVAL 20
38 #ifdef CONFIG_MTD_PARTITIONS
39 static struct mtd_partition tl_wr1043nd_partitions[] = {
44 .mask_flags = MTD_WRITEABLE,
57 .mask_flags = MTD_WRITEABLE,
64 #endif /* CONFIG_MTD_PARTITIONS */
66 static struct flash_platform_data tl_wr1043nd_flash_data = {
67 #ifdef CONFIG_MTD_PARTITIONS
68 .parts = tl_wr1043nd_partitions,
69 .nr_parts = ARRAY_SIZE(tl_wr1043nd_partitions),
73 static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = {
75 .name = "tl-wr1043nd:green:usb",
76 .gpio = TL_WR1043ND_GPIO_LED_USB,
79 .name = "tl-wr1043nd:green:system",
80 .gpio = TL_WR1043ND_GPIO_LED_SYSTEM,
83 .name = "tl-wr1043nd:green:qss",
84 .gpio = TL_WR1043ND_GPIO_LED_QSS,
87 .name = "tl-wr1043nd:green:wlan",
88 .gpio = TL_WR1043ND_GPIO_LED_WLAN,
93 static struct gpio_button tl_wr1043nd_gpio_buttons[] __initdata = {
99 .gpio = TL_WR1043ND_GPIO_BTN_RESET,
104 .code = KEY_WPS_BUTTON,
106 .gpio = TL_WR1043ND_GPIO_BTN_QSS,
111 static struct rtl8366rb_platform_data tl_wr1043nd_rtl8366rb_data = {
112 .gpio_sda = TL_WR1043ND_GPIO_RTL8366_SDA,
113 .gpio_sck = TL_WR1043ND_GPIO_RTL8366_SCK,
116 static struct platform_device tl_wr1043nd_rtl8366rb_device = {
117 .name = RTL8366RB_DRIVER_NAME,
120 .platform_data = &tl_wr1043nd_rtl8366rb_data,
124 static void __init tl_wr1043nd_setup(void)
126 u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
127 u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);
129 ar71xx_init_mac(ar71xx_eth0_data.mac_addr, mac, 0);
130 ar71xx_eth0_data.mii_bus_dev = &tl_wr1043nd_rtl8366rb_device.dev;
131 ar71xx_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
132 ar71xx_eth0_data.speed = SPEED_1000;
133 ar71xx_eth0_data.duplex = DUPLEX_FULL;
134 ar71xx_eth0_pll_data.pll_1000 = 0x1a000000;
136 ar71xx_add_device_eth(0);
138 ar71xx_add_device_usb();
140 ar71xx_add_device_m25p80(&tl_wr1043nd_flash_data);
142 ar71xx_add_device_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio),
143 tl_wr1043nd_leds_gpio);
145 platform_device_register(&tl_wr1043nd_rtl8366rb_device);
147 ar71xx_add_device_gpio_buttons(-1, TL_WR1043ND_BUTTONS_POLL_INTERVAL,
148 ARRAY_SIZE(tl_wr1043nd_gpio_buttons),
149 tl_wr1043nd_gpio_buttons);
151 ar913x_add_device_wmac(eeprom, mac);
154 MIPS_MACHINE(AR71XX_MACH_TL_WR1043ND, "TL-WR1043ND", "TP-LINK TL-WR1043ND",