aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-09-09 14:05:32 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-09-09 14:05:32 +0000
commitaa2f4d4c8d753a90136a165ff70e15a1eb090183 (patch)
tree4b9785d09e623792d7a3f32c93a3db87b3367fa3 /target/linux/ar71xx
parent3686e187272855915e42762426c6ea4fb15a2ba8 (diff)
downloadupstream-aa2f4d4c8d753a90136a165ff70e15a1eb090183.tar.gz
upstream-aa2f4d4c8d753a90136a165ff70e15a1eb090183.tar.bz2
upstream-aa2f4d4c8d753a90136a165ff70e15a1eb090183.zip
ar71xx: add initial support for RB2011UAS-2HnD
SVN-Revision: 33349
Diffstat (limited to 'target/linux/ar71xx')
-rwxr-xr-xtarget/linux/ar71xx/base-files/etc/uci-defaults/network3
-rwxr-xr-xtarget/linux/ar71xx/base-files/lib/ar71xx.sh3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c56
-rw-r--r--target/linux/ar71xx/patches-3.3/614-MIPS-ath79-rb2011uas-2hnd-support.patch21
4 files changed, 82 insertions, 1 deletions
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network
index f4fa7a2500..f749cc668b 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network
@@ -22,7 +22,8 @@ ja76pf2)
;;
db120 |\
-rb-2011l)
+rb-2011l | \
+rb-2011uas-2hnd)
ucidef_set_interfaces_lan_wan "eth0.1 eth1" "eth0.2"
ucidef_add_switch "eth0" "1" "1"
ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index a007c4f531..8db983039c 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -294,6 +294,9 @@ ar71xx_board_detect() {
*"RouterBOARD 2011L")
name="rb-2011l"
;;
+ *"RouterBOARD 2011UAS-2HnD")
+ name="rb-2011uas-2hnd"
+ ;;
*"Rocket M")
name="rocket-m"
;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
index d3fa051977..4c7dc6dda9 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
@@ -2,26 +2,35 @@
* MikroTik RouterBOARD 2011 support
*
* Copyright (C) 2012 Stijn Tintel <stijn@linux-ipv6.be>
+ * Copyright (C) 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.
*/
+#define pr_fmt(fmt) "rb2011: " fmt
+
#include <linux/phy.h>
#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
+#include <linux/rle.h>
+#include <linux/routerboot.h>
+#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-eth.h"
#include "dev-m25p80.h"
+#include "dev-wmac.h"
#include "machtypes.h"
+#include "routerboot.h"
#define RB_ROUTERBOOT_OFFSET 0x0000
#define RB_ROUTERBOOT_SIZE 0xb000
@@ -32,6 +41,8 @@
#define RB_SOFT_CFG_OFFSET 0xf000
#define RB_SOFT_CFG_SIZE 0x1000
+#define RB_ART_SIZE 0x10000
+
static struct mtd_partition rb2011_spi_partitions[] = {
{
.name = "routerboot",
@@ -104,6 +115,42 @@ static void __init rb2011_gmac_setup(void)
iounmap(base);
}
+static void __init rb2011_wlan_init(void)
+{
+ u8 *hard_cfg = (u8 *) KSEG1ADDR(0x1f000000 + RB_HARD_CFG_OFFSET);
+ u16 tag_len;
+ u8 *tag;
+ char *art_buf;
+ u8 wlan_mac[ETH_ALEN];
+ int err;
+
+ err = routerboot_find_tag(hard_cfg, RB_HARD_CFG_SIZE, RB_ID_WLAN_DATA,
+ &tag, &tag_len);
+ if (err) {
+ pr_err("no calibration data found\n");
+ return;
+ }
+
+ art_buf = kmalloc(RB_ART_SIZE, GFP_KERNEL);
+ if (art_buf == NULL) {
+ pr_err("no memory for calibration data\n");
+ return;
+ }
+
+ err = rle_decode((char *) tag, tag_len, art_buf, RB_ART_SIZE,
+ NULL, NULL);
+ if (err) {
+ pr_err("unable to decode calibration data\n");
+ goto free;
+ }
+
+ ath79_init_mac(wlan_mac, ath79_mac_base, 11);
+ ath79_register_wmac(art_buf + 0x1000, wlan_mac);
+
+free:
+ kfree(art_buf);
+}
+
static void __init rb2011_setup(void)
{
ath79_register_m25p80(&rb2011_spi_flash_data);
@@ -136,3 +183,12 @@ static void __init rb2011_setup(void)
MIPS_MACHINE(ATH79_MACH_RB_2011L, "2011L", "MikroTik RouterBOARD 2011L",
rb2011_setup);
+
+static void __init rb2011g_setup(void)
+{
+ rb2011_setup();
+ rb2011_wlan_init();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_2011G, "2011G", "MikroTik RouterBOARD 2011UAS-2HnD",
+ rb2011g_setup);
diff --git a/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-rb2011uas-2hnd-support.patch b/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-rb2011uas-2hnd-support.patch
new file mode 100644
index 0000000000..875d17c14a
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-rb2011uas-2hnd-support.patch
@@ -0,0 +1,21 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -61,6 +61,7 @@ enum ath79_mach_type {
+ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */
+ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */
+ ATH79_MACH_RB_751G, /* Mikrotik RouterBOARD 751G */
++ ATH79_MACH_RB_2011G, /* Mikrotik RouterBOARD 2011UAS-2HnD */
+ ATH79_MACH_RB_2011L, /* Mikrotik RouterBOARD 2011L */
+ ATH79_MACH_RW2458N, /* Redwave RW2458N */
+ ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -339,6 +339,8 @@ config ATH79_MACH_RB2011
+ bool "MikroTik RouterBOARD 2011 support"
+ select SOC_AR934x
+ select ATH79_DEV_ETH
++ select ATH79_DEV_WMAC
++ select ATH79_ROUTERBOOT
+
+ config ATH79_MACH_WNDR3700
+ bool "NETGEAR WNDR3700 board support"