aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-12-16 18:08:51 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-12-16 18:08:51 +0000
commitb84c8ab13ff7e6775dd962deb8830a4b5b425889 (patch)
treea7657336fe2e888f849158fc75ff338e279d0908
parent0005aadc83f989408e83c43fcacad3eec97ae64b (diff)
downloadmaster-187ad058-b84c8ab13ff7e6775dd962deb8830a4b5b425889.tar.gz
master-187ad058-b84c8ab13ff7e6775dd962deb8830a4b5b425889.tar.bz2
master-187ad058-b84c8ab13ff7e6775dd962deb8830a4b5b425889.zip
ar71xx: add initial support for the Mikrotik RB911G/RB912UAG boards
It is only on RB911G-5HPnD and RB912UAG-5HPnD boards. The LEDs and the USB port is not working yet. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39102 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/ar71xx/config-3.101
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c176
-rw-r--r--target/linux/ar71xx/mikrotik/config-default2
-rw-r--r--target/linux/ar71xx/patches-3.10/703-MIPS-ath79-add-RB91x-support.patch39
4 files changed, 218 insertions, 0 deletions
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 2d6f404006..f0568b0c8f 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -64,6 +64,7 @@ CONFIG_ATH79_MACH_PB92=y
# CONFIG_ATH79_MACH_RB2011 is not set
# CONFIG_ATH79_MACH_RB4XX is not set
# CONFIG_ATH79_MACH_RB750 is not set
+# CONFIG_ATH79_MACH_RB91X is not set
# CONFIG_ATH79_MACH_RB95X is not set
CONFIG_ATH79_MACH_RW2458N=y
CONFIG_ATH79_MACH_TEW_632BRP=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c
new file mode 100644
index 0000000000..65d9ee5b9d
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb91x.c
@@ -0,0 +1,176 @@
+/*
+ * MikroTik RouterBOARD 91X support
+ *
+ * Copyright (C) 2013 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) "rb91x: " fmt
+
+#include <linux/phy.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/nand.h>
+#include <linux/mtd/partitions.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/74x164.h>
+#include <linux/spi/flash.h>
+#include <linux/routerboot.h>
+#include <linux/gpio.h>
+
+#include <asm/prom.h>
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ath79_spi_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-eth.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-nfc.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "routerboot.h"
+
+#define RB_ROUTERBOOT_OFFSET 0x0000
+#define RB_ROUTERBOOT_MIN_SIZE 0xb000
+#define RB_HARD_CFG_SIZE 0x1000
+#define RB_BIOS_OFFSET 0xd000
+#define RB_BIOS_SIZE 0x1000
+#define RB_SOFT_CFG_OFFSET 0xf000
+#define RB_SOFT_CFG_SIZE 0x1000
+
+#define RB91X_FLAG_USB BIT(0)
+#define RB91X_FLAG_PCIE BIT(1)
+
+struct rb_board_info {
+ const char *name;
+ u32 flags;
+};
+
+static struct mtd_partition rb711gr100_spi_partitions[] = {
+ {
+ .name = "routerboot",
+ .offset = RB_ROUTERBOOT_OFFSET,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "hard_config",
+ .size = RB_HARD_CFG_SIZE,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "bios",
+ .offset = RB_BIOS_OFFSET,
+ .size = RB_BIOS_SIZE,
+ .mask_flags = MTD_WRITEABLE,
+ }, {
+ .name = "soft_config",
+ .size = RB_SOFT_CFG_SIZE,
+ }
+};
+
+static struct flash_platform_data rb711gr100_spi_flash_data = {
+ .parts = rb711gr100_spi_partitions,
+ .nr_parts = ARRAY_SIZE(rb711gr100_spi_partitions),
+};
+
+static void __init rb711gr100_init_partitions(const struct rb_info *info)
+{
+ rb711gr100_spi_partitions[0].size = info->hard_cfg_offs;
+ rb711gr100_spi_partitions[1].offset = info->hard_cfg_offs;
+
+ rb711gr100_spi_partitions[3].offset = info->soft_cfg_offs;
+}
+
+void __init rb711gr100_wlan_init(void)
+{
+ char *caldata;
+ u8 wlan_mac[ETH_ALEN];
+
+ caldata = rb_get_wlan_data();
+ if (caldata == NULL)
+ return;
+
+ ath79_init_mac(wlan_mac, ath79_mac_base, 1);
+ ath79_register_wmac(caldata + 0x1000, wlan_mac);
+
+ kfree(caldata);
+}
+
+#define RB_BOARD_INFO(_name, _flags) \
+ { \
+ .name = (_name), \
+ .flags = (_flags), \
+ }
+
+static const struct rb_board_info rb711gr100_boards[] __initconst = {
+ RB_BOARD_INFO("911G-2HPnD", 0),
+ RB_BOARD_INFO("911G-5HPnD", 0),
+ RB_BOARD_INFO("912UAG-2HPnD", RB91X_FLAG_USB | RB91X_FLAG_PCIE),
+ RB_BOARD_INFO("912UAG-5HPnD", RB91X_FLAG_USB | RB91X_FLAG_PCIE),
+};
+
+static u32 rb711gr100_get_flags(const struct rb_info *info)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(rb711gr100_boards); i++) {
+ const struct rb_board_info *bi;
+
+ bi = &rb711gr100_boards[i];
+ if (strcmp(info->board_name, bi->name) == 0)
+ return bi->flags;
+ }
+
+ return 0;
+}
+
+static void __init rb711gr100_setup(void)
+{
+ const struct rb_info *info;
+ char buf[64];
+ u32 flags;
+
+ info = rb_init_info((void *) KSEG1ADDR(0x1f000000), 0x10000);
+ if (!info)
+ return;
+
+ scnprintf(buf, sizeof(buf), "Mikrotik RouterBOARD %s",
+ (info->board_name) ? info->board_name : "");
+ mips_set_machine_name(buf);
+
+ rb711gr100_init_partitions(info);
+ ath79_register_m25p80(&rb711gr100_spi_flash_data);
+
+ ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_RGMII_GMAC0 |
+ AR934X_ETH_CFG_SW_ONLY_MODE);
+
+ ath79_register_mdio(0, 0x0);
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+ ath79_eth0_data.phy_mask = BIT(0);
+
+ ath79_register_eth(0);
+
+ rb711gr100_wlan_init();
+
+ platform_device_register_simple("rb91x-nand", -1, NULL, 0);
+
+ flags = rb711gr100_get_flags(info);
+
+ if (flags & RB91X_FLAG_USB)
+ ath79_register_usb();
+
+ if (flags & RB91X_FLAG_PCIE)
+ ath79_register_pci();
+
+}
+
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_711GR100, "711Gr100", rb711gr100_setup);
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index d9a8102ec2..0c64d316bf 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -37,6 +37,7 @@
CONFIG_ATH79_MACH_RB2011=y
CONFIG_ATH79_MACH_RB4XX=y
CONFIG_ATH79_MACH_RB750=y
+CONFIG_ATH79_MACH_RB91X=y
CONFIG_ATH79_MACH_RB95X=y
# CONFIG_ATH79_MACH_RW2458N is not set
# CONFIG_ATH79_MACH_TEW_632BRP is not set
@@ -98,6 +99,7 @@ CONFIG_MTD_NAND_AR934X=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_RB4XX=y
CONFIG_MTD_NAND_RB750=y
+CONFIG_MTD_NAND_RB91X=y
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_SM_COMMON is not set
# CONFIG_MTD_TPLINK_PARTS is not set
diff --git a/target/linux/ar71xx/patches-3.10/703-MIPS-ath79-add-RB91x-support.patch b/target/linux/ar71xx/patches-3.10/703-MIPS-ath79-add-RB91x-support.patch
new file mode 100644
index 0000000000..59679a2722
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/703-MIPS-ath79-add-RB91x-support.patch
@@ -0,0 +1,39 @@
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -75,6 +75,7 @@ enum ath79_mach_type {
+ ATH79_MACH_RB_450, /* MikroTik RouterBOARD 450 */
+ ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */
+ ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */
++ ATH79_MACH_RB_711GR100, /* Mikrotik RouterBOARD 911/912 boards */
+ ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */
+ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */
+ ATH79_MACH_RB_751, /* MikroTik RouterBOARD 751 */
+--- a/arch/mips/ath79/Kconfig
++++ b/arch/mips/ath79/Kconfig
+@@ -391,6 +391,16 @@ config ATH79_MACH_RB750
+ select ATH79_ROUTERBOOT
+ select RLE_DECOMPRESS
+
++config ATH79_MACH_RB91X
++ bool "MikroTik RouterBOARD 91X support"
++ select SOC_AR934X
++ select ATH79_DEV_ETH
++ select ATH79_DEV_M25P80
++ select ATH79_DEV_WMAC
++ select ATH79_DEV_USB
++ select ATH79_ROUTERBOOT
++ select RLE_DECOMPRESS
++
+ config ATH79_MACH_RB95X
+ bool "MikroTik RouterBOARD 95X support"
+ select SOC_AR934X
+--- a/arch/mips/ath79/Makefile
++++ b/arch/mips/ath79/Makefile
+@@ -78,6 +78,7 @@ obj-$(CONFIG_ATH79_MACH_PB44) += mach-p
+ obj-$(CONFIG_ATH79_MACH_PB92) += mach-pb92.o
+ obj-$(CONFIG_ATH79_MACH_RB4XX) += mach-rb4xx.o
+ obj-$(CONFIG_ATH79_MACH_RB750) += mach-rb750.o
++obj-$(CONFIG_ATH79_MACH_RB91X) += mach-rb91x.o
+ obj-$(CONFIG_ATH79_MACH_RB95X) += mach-rb95x.o
+ obj-$(CONFIG_ATH79_MACH_RB2011) += mach-rb2011.o
+ obj-$(CONFIG_ATH79_MACH_RW2458N) += mach-rw2458n.o