Skip to content

Commit

Permalink
MIPS: ath79: Add the TL-WR1043ND as legacy device for testing
Browse files Browse the repository at this point in the history
Add the TL-WR1043ND as legacy device to allow testing a bit the legacy
code path.

Signed-off-by: Alban Bedel <albeu@free.fr>
  • Loading branch information
AlbanBedel committed Mar 24, 2018
1 parent bcfc1f4 commit 001ea01
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/mips/ath79/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ config ATH79_MACH_UBNT_XM
Say 'Y' here if you want your kernel to support the
Ubiquiti Networks XM (rev 1.0) board.

config ATH79_MACH_TL_WR1043ND
bool "TP-LINK TL-WR1043ND support"
select SOC_AR913X
select ATH79_DEV_GPIO_BUTTONS
select ATH79_DEV_LEDS_GPIO
select ATH79_DEV_SPI
select ATH79_DEV_USB
select ATH79_DEV_WMAC

endmenu

config SOC_AR71XX
Expand Down
1 change: 1 addition & 0 deletions arch/mips/ath79/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
obj-$(CONFIG_ATH79_MACH_DB120) += mach-db120.o
obj-$(CONFIG_ATH79_MACH_PB44) += mach-pb44.o
obj-$(CONFIG_ATH79_MACH_UBNT_XM) += mach-ubnt-xm.o
obj-$(CONFIG_ATH79_MACH_TL_WR1043ND) += mach-tl-wr1043nd.o
107 changes: 107 additions & 0 deletions arch/mips/ath79/mach-tl-wr1043nd.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* TP-LINK TL-WR1043N/ND board support
*
* Copyright (C) 2015 Alban Bedel <albeu@free.fr>
* Copyright (C) 2009-2012 Gabor Juhos <juhosg@openwrt.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*/

#include <linux/platform_device.h>

#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>

#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-spi.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"

#define TL_WR1043ND_GPIO_LED_USB 1
#define TL_WR1043ND_GPIO_LED_SYSTEM 2
#define TL_WR1043ND_GPIO_LED_QSS 5
#define TL_WR1043ND_GPIO_LED_WLAN 9

#define TL_WR1043ND_GPIO_BTN_RESET 3
#define TL_WR1043ND_GPIO_BTN_QSS 7

#define TL_WR1043ND_GPIO_RTL8366_SDA 18
#define TL_WR1043ND_GPIO_RTL8366_SCK 19

#define TL_WR1043ND_KEYS_POLL_INTERVAL 20 /* msecs */
#define TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL (3 * TL_WR1043ND_KEYS_POLL_INTERVAL)

static struct gpio_led tl_wr1043nd_leds_gpio[] __initdata = {
{
.name = "tp-link:green:usb",
.gpio = TL_WR1043ND_GPIO_LED_USB,
.active_low = 1,
}, {
.name = "tp-link:green:system",
.gpio = TL_WR1043ND_GPIO_LED_SYSTEM,
.active_low = 1,
}, {
.name = "tp-link:green:qss",
.gpio = TL_WR1043ND_GPIO_LED_QSS,
.active_low = 0,
}, {
.name = "tp-link:green:wlan",
.gpio = TL_WR1043ND_GPIO_LED_WLAN,
.active_low = 1,
}
};

static struct gpio_keys_button tl_wr1043nd_gpio_keys[] __initdata = {
{
.desc = "reset",
.type = EV_KEY,
.code = KEY_RESTART,
.debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WR1043ND_GPIO_BTN_RESET,
.active_low = 1,
}, {
.desc = "qss",
.type = EV_KEY,
.code = KEY_WPS_BUTTON,
.debounce_interval = TL_WR1043ND_KEYS_DEBOUNCE_INTERVAL,
.gpio = TL_WR1043ND_GPIO_BTN_QSS,
.active_low = 1,
}
};

static struct spi_board_info tl_wr1043nd_spi_info[] = {
{
.bus_num = 0,
.chip_select = 0,
.max_speed_hz = 25000000,
.modalias = "s25sl064a",
}
};

static struct ath79_spi_platform_data tl_wr1043nd_spi_data = {
.bus_num = 0,
.num_chipselect = 1,
};

static void __init tl_wr1043nd_setup(void)
{
u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff1000);

ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr1043nd_leds_gpio),
tl_wr1043nd_leds_gpio);
ath79_register_gpio_keys_polled(-1, TL_WR1043ND_KEYS_POLL_INTERVAL,
ARRAY_SIZE(tl_wr1043nd_gpio_keys),
tl_wr1043nd_gpio_keys);

ath79_register_spi(&tl_wr1043nd_spi_data, tl_wr1043nd_spi_info,
ARRAY_SIZE(tl_wr1043nd_spi_info));
ath79_register_usb();
ath79_register_wmac(eeprom);
}

MIPS_MACHINE(ATH79_MACH_TL_WR1043ND, "TL-WR1043ND", "TP-LINK TL-WR1043ND",
tl_wr1043nd_setup);
1 change: 1 addition & 0 deletions arch/mips/ath79/machtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ enum ath79_mach_type {
ATH79_MACH_DB120, /* Atheros DB120 reference board */
ATH79_MACH_PB44, /* Atheros PB44 reference board */
ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
ATH79_MACH_TL_WR1043ND, /* TP-LINK TL-WR1043ND rev 1.0 */
};

#endif /* _ATH79_MACHTYPE_H */

0 comments on commit 001ea01

Please sign in to comment.