Patchwork [OpenWrt-Devel,ar71xx] extended support for TP-Link TL-MR10U in trunk

login
register
Submitter Oleg Titov
Date 2013-07-22 22:59:12
Message ID <CACfd+CboksmZiRrT2w9UH5sD1G+gTb6iUnJA3iTc-z2-MkXJ0g@mail.gmail.com>
Download mbox | patch
Permalink /patch/3840/
State Accepted
Delegated to: Gabor Juhos
Headers show

Comments

Oleg Titov - 2013-07-22 22:59:12
Extended support for TP-Link TL-MR10U in Buildroot added. Supports
current trunk.
Based on andelf's patch http://andelf.diandian.com/post/2013-05-22/40050677370

Signed-off-by: Oleg Titov <oleg.titov@gmail.com>

--
Gabor Juhos - 2013-07-26 07:33:50
2013.07.23. 0:59 keltezéssel, Oleg Titov írta:
> Extended support for TP-Link TL-MR10U in Buildroot added. Supports
> current trunk.
> Based on andelf's patch http://andelf.diandian.com/post/2013-05-22/40050677370
> 
> Signed-off-by: Oleg Titov <oleg.titov@gmail.com>

Applied with some changes. However I had to apply the changes manually, because
the whitespaces in the patch were damaged. Please verify that I did not make a
mistake.

Thanks,
Gabor
Oleg Titov - 2013-07-26 14:48:08
Everything is fine! Thank you Gabor!

Regards,
Oleg

On Fri, Jul 26, 2013 at 2:33 AM, Gabor Juhos <juhosg@openwrt.org> wrote:
> 2013.07.23. 0:59 keltezéssel, Oleg Titov írta:
>> Extended support for TP-Link TL-MR10U in Buildroot added. Supports
>> current trunk.
>> Based on andelf's patch http://andelf.diandian.com/post/2013-05-22/40050677370
>>
>> Signed-off-by: Oleg Titov <oleg.titov@gmail.com>
>
> Applied with some changes. However I had to apply the changes manually, because
> the whitespaces in the patch were damaged. Please verify that I did not make a
> mistake.
>
> Thanks,
> Gabor

Patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh
b/target/linux/ar71xx/base-files/etc/diag.sh
index 72390c0..56e87b1 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -133,6 +133,7 @@  get_status_led() {
  status_led="tp-link:green:system"
  ;;
  archer-c7 | \
+ tl-mr10u | \
  tl-wdr4300 | \
  tl-wr703n | \
  tl-wr720n-v3)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index c4b6cd2..05b4566 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -209,6 +209,7 @@  eap7660d |\
 mr600 |\
 mr600v2 |\
 rb-411 |\
+tl-mr10u |\
 tl-mr11u |\
 tl-mr3020 |\
 tl-mr3040 |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 19f19e7..c11091f 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -132,7 +132,7 @@  tplink_board_detect() {
  "254300"*)
  model="TP-Link TL-WR2543N/ND"
  ;;
- "001001"*)
+ "100101"*)
  model="TP-Link TL-MR10U"
  ;;
  "001101"*)
@@ -450,6 +450,9 @@  ar71xx_board_detect() {
  *"TL-WR720N v3")
  name="tl-wr720n-v3"
  ;;
+ *"TL-MR10U")
+ name="tl-mr10u"
+ ;;
  *"TL-MR11U")
  name="tl-mr11u"
  ;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 9542295..c57e5d5 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -157,6 +157,7 @@  platform_check_image() {
  ;;

  archer-c7 | \
+ tl-mr10u | \
  tl-mr11u | \
  tl-mr3020 | \
  tl-mr3040 | \
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 8695bad..641afae 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -63,6 +63,7 @@  CONFIG_ATH79_MACH_RW2458N=y
 CONFIG_ATH79_MACH_TEW_632BRP=y
 CONFIG_ATH79_MACH_TEW_673GRU=y
 CONFIG_ATH79_MACH_TEW_712BR=y
+CONFIG_ATH79_MACH_TL_MR10U=y
 CONFIG_ATH79_MACH_TL_MR11U=y
 CONFIG_ATH79_MACH_TL_MR3020=y
 CONFIG_ATH79_MACH_TL_MR3X20=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr10u.c
b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr10u.c
new file mode 100644
index 0000000..d4b2006
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-tl-mr10u.c
@@ -0,0 +1,89 @@ 
+/*
+ *  TP-LINK TL-MR10U board support
+ *
+ *  Copyright (C) 2011 dongyuqi <729650915@qq.com>
+ *  Copyright (C) 2013 andelf <andelf@gmail.com>
+ *
+ *  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/gpio.h>
+
+#include <asm/mach-ath79/ath79.h>
+
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define TL_MR10U_GPIO_LED_SYSTEM 27
+#define TL_MR10U_GPIO_BTN_RESET 11
+
+#define TL_MR10U_GPIO_USB_POWER 18
+
+#define TL_MR10U_KEYS_POLL_INTERVAL 20 /* msecs */
+#define TL_MR10U_KEYS_DEBOUNCE_INTERVAL (3 * TL_MR10U_KEYS_POLL_INTERVAL)
+
+static const char *tl_mr10u_part_probes[] = {
+ "tp-link",
+ NULL,
+};
+
+static struct flash_platform_data tl_mr10u_flash_data = {
+ .part_probes = tl_mr10u_part_probes,
+};
+
+static struct gpio_led tl_mr10u_leds_gpio[] __initdata = {
+ {
+ .name = "tp-link:blue:system",
+ .gpio = TL_MR10U_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button tl_mr10u_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = TL_MR10U_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = TL_MR10U_GPIO_BTN_RESET,
+ .active_low = 0,
+ }
+};
+
+static void __init tl_mr10u_setup(void)
+{
+ u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
+ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
+
+ /* disable PHY_SWAP and PHY_ADDR_SWAP bits */
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_m25p80(&tl_mr10u_flash_data);
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_mr10u_leds_gpio),
+ tl_mr10u_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, TL_MR10U_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(tl_mr10u_gpio_keys),
+ tl_mr10u_gpio_keys);
+
+ gpio_request_one(TL_MR10U_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ ath79_register_usb();
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
+
+ ath79_register_mdio(0, 0x0);
+ ath79_register_eth(0);
+
+ ath79_register_wmac(ee, mac);
+}
+
+MIPS_MACHINE(ATH79_MACH_TL_MR10U, "TL-MR10U", "TP-LINK TL-MR10U",
+     tl_mr10u_setup);
diff --git a/target/linux/ar71xx/generic/profiles/tp-link.mk
b/target/linux/ar71xx/generic/profiles/tp-link.mk
index 8c16df6..30e2b9c 100644
--- a/target/linux/ar71xx/generic/profiles/tp-link.mk
+++ b/target/linux/ar71xx/generic/profiles/tp-link.mk
@@ -16,6 +16,17 @@  endef
 $(eval $(call Profile,ARCHERC7))


+define Profile/TLMR10U
+ NAME:=TP-LINK TL-MR10U
+ PACKAGES:=kmod-usb-core kmod-usb2
+endef
+
+define Profile/TLMR10U/Description
+ Package set optimized for the TP-LINK TL-MR10U.
+endef
+$(eval $(call Profile,TLMR10U))
+
+
 define Profile/TLMR11U
  NAME:=TP-LINK TL-MR11U
  PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
diff --git a/target/linux/ar71xx/image/Makefile
b/target/linux/ar71xx/image/Makefile
index 05412ae..ceb0d0a 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -970,7 +970,7 @@  $(eval $(call
SingleProfile,TPLINK,$(fs_64kraw),TLWR941NV4,tl-wr941nd-v4,TL-WR74
 $(eval $(call SingleProfile,TPLINK,$(fs_64kraw),TLWR1043,tl-wr1043nd-v1,TL-WR1043ND,ttyS0,115200,0x10430001,1,8M))

 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),ARCHERC7,archer-c7-v1,ARCHER-C7,ttyS0,115200,0x75000001,1,8Mlzma))
-$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR10UV1,tl-mr10u-v1,TL-MR3040,ttyATH0,115200,0x00100101,1,4Mlzma))
+$(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR10U,tl-mr10u-v1,TL-MR10U,ttyATH0,115200,0x00100101,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR11UV1,tl-mr11u-v1,TL-MR11U,ttyATH0,115200,0x00110101,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR11UV2,tl-mr11u-v2,TL-MR11U,ttyATH0,115200,0x00110102,1,4Mlzma))
 $(eval $(call SingleProfile,TPLINK-LZMA,$(fs_64kraw),TLMR3020,tl-mr3020-v1,TL-MR3020,ttyATH0,115200,0x30200001,1,4Mlzma))
diff --git a/target/linux/ar71xx/patches-3.10/920-add-tl-mr10u-support.patch
b/target/linux/ar71xx/patches-3.10/920-add-tl-mr10u-support.patch
new file mode 100644
index 0000000..6925a6f
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/920-add-tl-mr10u-support.patch
@@ -0,0 +1,39 @@ 
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -506,6 +506,16 @@ config ATH79_MACH_ARCHER_C7
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
++config ATH79_MACH_TL_MR10U
++ bool "TP-LINK TL-MR10U support"
++ select SOC_AR933X
++ select ATH79_DEV_ETH
++ select ATH79_DEV_GPIO_BUTTONS
++ select ATH79_DEV_LEDS_GPIO
++ select ATH79_DEV_M25P80
++ select ATH79_DEV_USB
++ select ATH79_DEV_WMAC
++
+ config ATH79_MACH_TL_MR11U
+ bool "TP-LINK TL-MR11U/TL-MR3040 support"
+ select SOC_AR933X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -78,6 +78,7 @@ obj-$(CONFIG_ATH79_MACH_RW2458N) += mach
+ obj-$(CONFIG_ATH79_MACH_TEW_632BRP) += mach-tew-632brp.o
+ obj-$(CONFIG_ATH79_MACH_TEW_673GRU) += mach-tew-673gru.o
+ obj-$(CONFIG_ATH79_MACH_TEW_712BR) += mach-tew-712br.o
++obj-$(CONFIG_ATH79_MACH_TL_MR10U) += mach-tl-mr10u.o
+ obj-$(CONFIG_ATH79_MACH_TL_MR11U) += mach-tl-mr11u.o
+ obj-$(CONFIG_ATH79_MACH_TL_MR3020) += mach-tl-mr3020.o
+ obj-$(CONFIG_ATH79_MACH_TL_MR3X20) += mach-tl-mr3x20.o
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -81,6 +81,7 @@ enum ath79_mach_type {
+ ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */
+ ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */
+ ATH79_MACH_TEW_712BR, /* TRENDnet TEW-712BR */
++ ATH79_MACH_TL_MR10U, /* TP-LINK TL-MR10U */
+ ATH79_MACH_TL_MR11U, /* TP-LINK TL-MR11U */
+ ATH79_MACH_TL_MR3020, /* TP-LINK TL-MR3020 */
+ ATH79_MACH_TL_MR3040, /* TP-LINK TL-MR3040 */
diff --git a/tools/firmware-utils/src/mktplinkfw.c
b/tools/firmware-utils/src/mktplinkfw.c
index 74a55fd..19dc2b4 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -30,6 +30,7 @@ 
 #define ALIGN(x,a) ({ typeof(a) __a = (a); (((x) + __a - 1) & ~(__a - 1)); })

 #define HEADER_VERSION_V1 0x01000000
+#define HWID_TL_MR10U_V1 0x00100101
 #define HWID_TL_MR3020_V1 0x30200001
 #define HWID_TL_MR3220_V1 0x32200001
 #define HWID_TL_MR3220_V2 0x32200002
@@ -193,6 +194,11 @@  static struct flash_layout layouts[] = {

 static struct board_info boards[] = {
  {
+ .id = "TL-MR10Uv1",
+ .hw_id = HWID_TL_MR10U_V1,
+ .hw_rev = 1,
+ .layout_id = "4Mlzma",
+ }, {
  .id = "TL-MR3020v1",
  .hw_id = HWID_TL_MR3020_V1,
  .hw_rev = 1,