diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-04-06 06:45:07 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-04-06 06:45:07 +0000 |
commit | e295a077cea86adad6d897b72b2b8b371a3d7fc4 (patch) | |
tree | 8977dcd832938312416046459d3ead68e323aad6 /target | |
parent | fe6d66afe2e150d70337d25b07bc7b16898ff049 (diff) | |
download | upstream-e295a077cea86adad6d897b72b2b8b371a3d7fc4.tar.gz upstream-e295a077cea86adad6d897b72b2b8b371a3d7fc4.tar.bz2 upstream-e295a077cea86adad6d897b72b2b8b371a3d7fc4.zip |
ar71xx: initial support for Mikrotik RB751G-2HnD and RB751U-2HnD
Great collaboration on these two fantastic routers on the openwrt forum:
https://forum.openwrt.org/viewtopic.php?id=32320
Above all kudos to aryufan. Well done and thank you everyone else who
contributed.
To-Do: LED for wlan is not yet activated
To-Do: TxPower over 20dBm (RB751U) or 22dBm (RB751G) are not accepted by
the router
Signed-off-by: Hanno Schupp <hanno.schupp@gmail.com>
[juhosg: fix line wrapped patch, fix checkpatch errors, add missing
kernel patches]
SVN-Revision: 31208
Diffstat (limited to 'target')
5 files changed, 142 insertions, 0 deletions
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/network b/target/linux/ar71xx/base-files/etc/uci-defaults/network index 2aa91d315d..3863705f86 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/network +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/network @@ -63,6 +63,7 @@ routerstation-pro) ;; rb-750gl |\ +rb-751g |\ wzr-hp-g450h) ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2" ucidef_add_switch "switch0" "1" "1" @@ -153,6 +154,7 @@ dir-615-c1 |\ dir-615-e4 |\ ja76pf |\ rb-750 |\ +rb-751 |\ tew-632brp |\ tl-mr3220 |\ tl-mr3420 |\ diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index be42aad9e5..3802e12179 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -250,6 +250,12 @@ ar71xx_board_detect() { *"RouterBOARD 750GL") name="rb-750gl" ;; + *"RouterBOARD 751") + name="rb-751" + ;; + *"RouterBOARD 751G") + name="rb-751g" + ;; *"Rocket M") name="rocket-m" ;; diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c index 3187e8f34c..3e4a5527f8 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c @@ -9,17 +9,24 @@ */ #include <linux/export.h> +#include <linux/pci.h> +#include <linux/ath9k_platform.h> #include <linux/platform_device.h> #include <linux/phy.h> #include <linux/ar8216_platform.h> #include <asm/mach-ath79/ar71xx_regs.h> #include <asm/mach-ath79/ath79.h> +#include <asm/mach-ath79/pci.h> +#include <asm/mach-ath79/irq.h> #include <asm/mach-ath79/mach-rb750.h> #include "common.h" +#include "dev-usb.h" #include "dev-eth.h" #include "machtypes.h" +#include "pci-ath9k-fixup.h" +#include "pci.h" static struct rb750_led_data rb750_leds[] = { { @@ -270,3 +277,88 @@ static void __init rb750gr3_setup(void) MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL", rb750gr3_setup); + +static struct ath9k_platform_data rb751_wmac_data = { + .led_pin = -1, +}; + +static u8 rb751_wmac_mac[6]; + +static int rb751_pci_plat_dev_init(struct pci_dev *dev) +{ + switch (PCI_SLOT(dev->devfn)) { + case 0: + dev->dev.platform_data = &rb751_wmac_data; + break; + } + + return 0; +} + +static int decode_rle(char *output, int len, char *in) +{ + char *ptr = output; + char *end = output + len; + while (*in) { + if (*in < 0) { + int i = -*in++; + while (i-- > 0) { + if (ptr >= end) + return -1; + *ptr++ = *in++; + } + } else if (*in > 0) { + int i = *in++; + while (i-- > 0) { + if (ptr >= end) + return -1; + *ptr++ = *in; + } + in++; + } + } + return ptr - output; +} + +#define RB751_HARDCONFIG 0x1f00b000 +#define RB751_MAC_ADDRESS_OFFSET 0xE80 +#define RB751_CALDATA_OFFSET 0x27C + +static void __init rb751_wlan_and_usb_setup(void) +{ + u8 *hardconfig = (u8 *) KSEG1ADDR(RB751_HARDCONFIG); + + ath79_register_usb(); + + ath79_pci_set_plat_dev_init(rb751_pci_plat_dev_init); + ath79_register_pci(); + + rb751_wmac_data.macaddr = memcpy(rb751_wmac_mac, + hardconfig + RB751_MAC_ADDRESS_OFFSET, 6); + + if (decode_rle((char *)rb751_wmac_data.eeprom_data, + sizeof(rb751_wmac_data.eeprom_data), + hardconfig + RB751_CALDATA_OFFSET) == + sizeof(rb751_wmac_data.eeprom_data)) { + pr_info("rb7xx: calibration data found\n"); + pci_enable_ath9k_fixup(0, rb751_wmac_data.eeprom_data); + } +} + +static void __init rb751_setup(void) +{ + rb750_setup(); + rb751_wlan_and_usb_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_751, "751", "MikroTik RouterBOARD 751", + rb751_setup); + +static void __init rb751g_setup(void) +{ + rb750gr3_setup(); + rb751_wlan_and_usb_setup(); +} + +MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G", + rb751g_setup); diff --git a/target/linux/ar71xx/patches-3.2/614-MIPS-ath79-RB751GL-support.patch b/target/linux/ar71xx/patches-3.2/614-MIPS-ath79-RB751GL-support.patch new file mode 100644 index 0000000000..80689c6a90 --- /dev/null +++ b/target/linux/ar71xx/patches-3.2/614-MIPS-ath79-RB751GL-support.patch @@ -0,0 +1,21 @@ +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -300,6 +300,7 @@ config ATH79_MACH_RB750 + bool "MikroTik RouterBOARD 750 support" + select SOC_AR724X + select ATH79_DEV_ETH ++ select ATH79_DEV_USB + + config ATH79_MACH_WNDR3700 + bool "NETGEAR WNDR3700 board support" +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -53,6 +53,8 @@ enum ath79_mach_type { + ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ + ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ + ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ++ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ ++ ATH79_MACH_RB_751G, /* Mikrotik RouterBOARD 751G */ + ATH79_MACH_RW2458N, /* Redwave RW2458N */ + ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */ + ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */ diff --git a/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-RB751GL-support.patch b/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-RB751GL-support.patch new file mode 100644 index 0000000000..80689c6a90 --- /dev/null +++ b/target/linux/ar71xx/patches-3.3/614-MIPS-ath79-RB751GL-support.patch @@ -0,0 +1,21 @@ +--- a/arch/mips/ath79/Kconfig ++++ b/arch/mips/ath79/Kconfig +@@ -300,6 +300,7 @@ config ATH79_MACH_RB750 + bool "MikroTik RouterBOARD 750 support" + select SOC_AR724X + select ATH79_DEV_ETH ++ select ATH79_DEV_USB + + config ATH79_MACH_WNDR3700 + bool "NETGEAR WNDR3700 board support" +--- a/arch/mips/ath79/machtypes.h ++++ b/arch/mips/ath79/machtypes.h +@@ -53,6 +53,8 @@ enum ath79_mach_type { + ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */ + ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */ + ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */ ++ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */ ++ ATH79_MACH_RB_751G, /* Mikrotik RouterBOARD 751G */ + ATH79_MACH_RW2458N, /* Redwave RW2458N */ + ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */ + ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */ |