[OpenWrt-Devel] [PATCH] ar71xx: add qihoo 360 c301 router support

hackpascal at gmail.com hackpascal at gmail.com
Wed Sep 10 13:21:10 EDT 2014


From: Weijie Gao <hackpascal at gmail.com>

Qihoo 360 C301 is a dual band wireless router supports 802.11n and 802.11ac.
Its chipset is AR9344 + AR9882 with two 16MB flashes.

This patch adds its initial support.

Signed-off-by: Weijie Gao <hackpascal at gmail.com>
---
 target/linux/ar71xx/base-files/etc/diag.sh         |   3 +
 .../ar71xx/base-files/etc/uci-defaults/01_leds     |   5 +
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   3 +
 .../lib/preinit/81_load_ath10k_board_bin           |  23 +++
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +
 target/linux/ar71xx/config-3.10                    |   1 +
 target/linux/ar71xx/config-3.14                    |   1 +
 .../ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c | 169 +++++++++++++++++++++
 target/linux/ar71xx/generic/profiles/qihoo.mk      |  16 ++
 target/linux/ar71xx/image/Makefile                 |   3 +
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 .../610-MIPS-ath79-openwrt-machines.patch          |  19 ++-
 .../601-MIPS-ath79-add-more-register-defines.patch |   3 +-
 .../610-MIPS-ath79-openwrt-machines.patch          |  19 ++-
 15 files changed, 262 insertions(+), 8 deletions(-)
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
 create mode 100644 target/linux/ar71xx/generic/profiles/qihoo.mk

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 1864b11..c16b7d7 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -166,6 +166,9 @@ get_status_led() {
 	oolite)
 		status_led="oolite:red:system"
 		;;
+	qihoo-c301)
+		status_led="qihoo:green:status"
+		;;
 	tew-632brp)
 		status_led="tew-632brp:green:status"
 		;;
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index d3b766d..872fc0d 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -191,6 +191,11 @@ om5p)
 	ucidef_set_led_netdev "port2" "port2" "om5p:blue:lan" "eth1"
 	;;
 
+qihoo-c301)
+	ucidef_set_led_wlan "wlan2g" "WLAN2G" "qihoo:green:status" "phy1tpt"
+	ucidef_set_led_wlan "wlan5g" "WLAN5G" "qihoo:red:status" "phy0tpt"
+	;;
+
 smart-300)
 	ucidef_set_led_netdev "wan" "WAN" "nc-link:green:wan" "eth0"
 	ucidef_set_led_switch "lan1" "LAN1" "nc-link:green:lan1" "switch0" "0x04"
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 c5cfd67..d5a43bd 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -346,6 +346,7 @@ hiwifi-hc6361 |\
 ja76pf |\
 mynet-n600 |\
 oolite |\
+qihoo-c301 |\
 rb-750 |\
 rb-751 |\
 tew-632brp |\
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 1e96b6d..1c685c6 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -430,6 +430,9 @@ ar71xx_board_detect() {
 	*PB92)
 		name="pb92"
 		;;
+	*"Qihoo 360 C301")
+		name="qihoo-c301"
+		;;
 	*"RouterBOARD 411/A/AH")
 		name="rb-411"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
index a28932f..66ccb1f 100644
--- a/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
+++ b/target/linux/ar71xx/base-files/lib/preinit/81_load_ath10k_board_bin
@@ -24,6 +24,29 @@ do_load_ath10k_board_bin() {
 				bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
 
 		;;
+		qihoo-c301)
+			local mac
+			local tmp
+
+			dd if=/dev/mtdblock2 of=/tmp/c301-nvram >/dev/null 2>/dev/null
+
+			tmp=$(cat /tmp/c301-nvram | grep 'wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)')
+
+			if [ $? == 0 ]; then
+				rm -f /tmp/c301-nvram
+				mac=$(echo ${tmp} | sed 's/wlan5mac=\(.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]:.[0-9A-Fa-f]\)/\1/g')
+			else
+				mac=$(macaddr_add $(cat /sys/class/net/eth0/address) -2)
+			fi
+
+			dd if=/dev/mtdblock10 \
+				bs=1 skip=20480 count=6 \
+				of=/tmp/ath10k-board.bin
+			macaddr_2bin $mac >> /tmp/ath10k-board.bin
+			dd if=/dev/mtdblock10 \
+				bs=1 skip=20492 count=2104 >> /tmp/ath10k-board.bin
+
+		;;
 	esac
 	[ -f /tmp/ath10k-board.bin ] || {
 		return
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 846954c..6122d45 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -225,6 +225,7 @@ platform_check_image() {
 		return 1
 		;;
 
+	qihoo-c301 | \
 	mynet-n600 | \
 	mynet-n750)
 		[ "$magic_long" != "5ea3a417" ] && {
diff --git a/target/linux/ar71xx/config-3.10 b/target/linux/ar71xx/config-3.10
index 9a8378a..48ff491 100644
--- a/target/linux/ar71xx/config-3.10
+++ b/target/linux/ar71xx/config-3.10
@@ -72,6 +72,7 @@ CONFIG_ATH79_MACH_OM5P=y
 CONFIG_ATH79_MACH_PB42=y
 CONFIG_ATH79_MACH_PB44=y
 CONFIG_ATH79_MACH_PB92=y
+CONFIG_ATH79_MACH_QIHOO_C301=y
 # CONFIG_ATH79_MACH_RB2011 is not set
 # CONFIG_ATH79_MACH_RB4XX is not set
 # CONFIG_ATH79_MACH_RB750 is not set
diff --git a/target/linux/ar71xx/config-3.14 b/target/linux/ar71xx/config-3.14
index c642913..0996ccb 100644
--- a/target/linux/ar71xx/config-3.14
+++ b/target/linux/ar71xx/config-3.14
@@ -73,6 +73,7 @@ CONFIG_ATH79_MACH_OM5P=y
 CONFIG_ATH79_MACH_PB42=y
 CONFIG_ATH79_MACH_PB44=y
 CONFIG_ATH79_MACH_PB92=y
+CONFIG_ATH79_MACH_QIHOO_C301=y
 # CONFIG_ATH79_MACH_RB2011 is not set
 # CONFIG_ATH79_MACH_RB4XX is not set
 # CONFIG_ATH79_MACH_RB750 is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
new file mode 100644
index 0000000..2bd0779
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-qihoo-c301.c
@@ -0,0 +1,169 @@
+/*
+ *  Qihoo 360 C301 board support
+ *
+ *  Copyright (C) 2013 Gabor Juhos <juhosg at openwrt.org>
+ *  Copyright (C) 2014 hackpascal <hackpascal at 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/pci.h>
+#include <linux/phy.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-ap9x-pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-m25p80.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+#include "nvram.h"
+
+#define QIHOO_C301_GPIO_LED_STATUS_GREEN	0
+#define QIHOO_C301_GPIO_LED_STATUS_RED		11
+
+#define QIHOO_C301_GPIO_LED_WAN			1
+#define QIHOO_C301_GPIO_LED_LAN1		2
+#define QIHOO_C301_GPIO_LED_LAN2		3
+#define QIHOO_C301_GPIO_ETH_LEN_EN		18
+
+#define QIHOO_C301_GPIO_BTN_RESET		16
+
+#define QIHOO_C301_GPIO_USB_POWER		19
+
+#define QIHOO_C301_GPIO_SPI_CS1			12
+
+#define QIHOO_C301_GPIO_EXTERNAL_LNA0		14
+#define QIHOO_C301_GPIO_EXTERNAL_LNA1		15
+
+#define QIHOO_C301_KEYS_POLL_INTERVAL		20	/* msecs */
+#define QIHOO_C301_KEYS_DEBOUNCE_INTERVAL	\
+	(3 * QIHOO_C301_KEYS_POLL_INTERVAL)
+
+#define QIHOO_C301_WMAC_CALDATA_OFFSET		0x1000
+#define QIHOO_C301_PCIE_CALDATA_OFFSET		0x5000
+
+#define QIHOO_C301_NVRAM_ADDR			0x1f058010
+#define QIHOO_C301_NVRAM_SIZE			0x7ff0
+
+static struct gpio_led qihoo_c301_leds_gpio[] __initdata = {
+	{
+		.name		= "qihoo:green:status",
+		.gpio		= QIHOO_C301_GPIO_LED_STATUS_GREEN,
+		.active_low	= 1,
+	},
+	{
+		.name		= "qihoo:red:status",
+		.gpio		= QIHOO_C301_GPIO_LED_STATUS_RED,
+		.active_low	= 1,
+	},
+};
+
+static struct gpio_keys_button qihoo_c301_gpio_keys[] __initdata = {
+	{
+		.desc		= "reset",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = QIHOO_C301_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= QIHOO_C301_GPIO_BTN_RESET,
+		.active_low	= 1,
+	},
+};
+
+struct flash_platform_data flash __initdata = {NULL, NULL, 0};
+
+static void qihoo_c301_get_mac(const char *name, char *mac)
+{
+	u8 *nvram = (u8 *) KSEG1ADDR(QIHOO_C301_NVRAM_ADDR);
+	int err;
+
+	err = ath79_nvram_parse_mac_addr(nvram, QIHOO_C301_NVRAM_SIZE,
+					 name, mac);
+	if (err)
+		pr_err("no MAC address found for %s\n", name);
+}
+
+static void __init qihoo_c301_setup(void)
+{
+	u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+	u8 tmpmac[ETH_ALEN];
+
+	ath79_register_m25p80_multi(&flash);
+
+	ath79_gpio_function_enable(AR934X_GPIO_FUNC_JTAG_DISABLE);
+
+	ath79_gpio_output_select(QIHOO_C301_GPIO_LED_WAN,
+				 AR934X_GPIO_OUT_LED_LINK4);
+	ath79_gpio_output_select(QIHOO_C301_GPIO_LED_LAN1,
+				 AR934X_GPIO_OUT_LED_LINK1);
+	ath79_gpio_output_select(QIHOO_C301_GPIO_LED_LAN2,
+				 AR934X_GPIO_OUT_LED_LINK2);
+
+	ath79_gpio_output_select(QIHOO_C301_GPIO_SPI_CS1,
+				 AR934X_GPIO_OUT_SPI_CS1);
+
+	gpio_request_one(QIHOO_C301_GPIO_ETH_LEN_EN,
+			 GPIOF_OUT_INIT_LOW | GPIOF_EXPORT_DIR_FIXED,
+			 "Ethernet LED enable");
+
+	ath79_register_leds_gpio(-1, ARRAY_SIZE(qihoo_c301_leds_gpio),
+				 qihoo_c301_leds_gpio);
+
+	ath79_register_gpio_keys_polled(-1, QIHOO_C301_KEYS_POLL_INTERVAL,
+					ARRAY_SIZE(qihoo_c301_gpio_keys),
+					qihoo_c301_gpio_keys);
+
+	ath79_wmac_set_ext_lna_gpio(0, QIHOO_C301_GPIO_EXTERNAL_LNA0);
+	ath79_wmac_set_ext_lna_gpio(1, QIHOO_C301_GPIO_EXTERNAL_LNA1);
+
+	qihoo_c301_get_mac("wlan24mac=", tmpmac);
+	ath79_register_wmac(art + QIHOO_C301_WMAC_CALDATA_OFFSET, tmpmac);
+
+	qihoo_c301_get_mac("wlan5mac=", tmpmac);
+	ap91_pci_init(art + QIHOO_C301_PCIE_CALDATA_OFFSET, tmpmac);
+
+	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE |
+				   AR934X_ETH_CFG_SW_PHY_SWAP);
+
+	ath79_register_mdio(1, 0x0);
+
+	/* LAN */
+	qihoo_c301_get_mac("lanmac=", ath79_eth1_data.mac_addr);
+
+	/* GMAC1 is connected to the internal switch */
+	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+
+	ath79_register_eth(1);
+
+	/* WAN */
+	qihoo_c301_get_mac("wanmac=", ath79_eth0_data.mac_addr);
+
+	/* GMAC0 is connected to the PHY4 of the internal switch */
+	ath79_switch_data.phy4_mii_en = 1;
+	ath79_switch_data.phy_poll_mask = BIT(0);
+
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+	ath79_eth0_data.phy_mask = BIT(0);
+	ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
+
+	ath79_register_eth(0);
+
+	gpio_request_one(QIHOO_C301_GPIO_USB_POWER,
+			 GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+			 "USB power");
+	ath79_register_usb();
+}
+
+MIPS_MACHINE(ATH79_MACH_QIHOO_C301, "QIHOO-C301", "Qihoo 360 C301",
+	     qihoo_c301_setup);
+
diff --git a/target/linux/ar71xx/generic/profiles/qihoo.mk b/target/linux/ar71xx/generic/profiles/qihoo.mk
new file mode 100644
index 0000000..0ec778a
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/qihoo.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/QIHOO360
+	NAME:=Qihoo 360 C301
+	PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev kmod-ath10k
+endef
+
+define Profile/QIHOO360/Description
+  Package set optimized for the Qihoo 360 C301 device.
+endef
+$(eval $(call Profile,QIHOO360))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 683c238..d56585e 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -290,6 +290,7 @@ zcn1523h_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6208k(rootfs
 mynet_n600_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,64k(devdata)ro,64k(devconf)ro,15872k(firmware),64k(radiocfg)ro
 mynet_rext_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,7808k(firmware),64k(nvram)ro,64k(ART)ro,6848k at 0x130000(filesystem)
 zyx_nbg6716_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(env)ro,64k(RFdata)ro,-(nbu);ar934x-nfc:2048k(zyxel_rfsd),2048k(romd),1024k(header),2048k(kernel),-(ubi)
+qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata),64k(devconf),15744k(firmware),64k(warm_start),64k(action_image_config),64k(radiocfg)ro;spi0.1:15360k(upgrade2),1024k(privatedata)
 
 
 define Image/BuildKernel
@@ -1156,6 +1157,8 @@ $(eval $(call SingleProfile,Planex,64kraw,MZKW300NH,mzk-w300nh,MZK-W300NH,ttyS0,
 $(eval $(call SingleProfile,Seama,64k,MYNETN600,mynet-n600,MYNET-N600,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd16_wd_db600,1310720,16187392))
 $(eval $(call SingleProfile,Seama,64k,MYNETN750,mynet-n750,MYNET-N750,ttyS0,115200,$$(mynet_n600_mtdlayout),wrgnd13_wd_av,1310720,16187392))
 
+$(eval $(call SingleProfile,Seama,64k,QIHOO360,qihoo-c301,QIHOO-C301,ttyS0,115200,$$(qihoo_c301_mtdlayout),wrgac26_qihoo360_360rg,1310720,16121856))
+
 $(eval $(call SingleProfile,Senao,squashfs-only,EAP300V2,eap300v2,EAP300V2,ttyS0,115200,$$(eap300v2_mtdlayout)))
 
 $(eval $(call SingleProfile,TPLINKOLD,squashfs-only,TLWR841NV15,tl-wr841nd-v1.5,TL-WR841N-v1.5,ttyS0,115200,0x08410002,2,4M))
diff --git a/target/linux/ar71xx/patches-3.10/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.10/601-MIPS-ath79-add-more-register-defines.patch
index 81a997b..214aa73 100644
--- a/target/linux/ar71xx/patches-3.10/601-MIPS-ath79-add-more-register-defines.patch
+++ b/target/linux/ar71xx/patches-3.10/601-MIPS-ath79-add-more-register-defines.patch
@@ -207,7 +207,7 @@
  #define AR934X_GPIO_REG_FUNC		0x6c
  
  #define AR71XX_GPIO_COUNT		16
-@@ -561,4 +664,148 @@
+@@ -561,4 +664,149 @@
  #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT	13
  #define AR934X_SRIF_DPLL2_OUTDIV_MASK	0x7
  
@@ -279,6 +279,7 @@
 +#define AR934X_GPIO_FUNC_JTAG_DISABLE		BIT(1)
 +
 +#define AR934X_GPIO_OUT_GPIO		0
++#define AR934X_GPIO_OUT_SPI_CS1	7
 +#define AR934X_GPIO_OUT_LED_LINK0	41
 +#define AR934X_GPIO_OUT_LED_LINK1	42
 +#define AR934X_GPIO_OUT_LED_LINK2	43
diff --git a/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch
index cba18a8..df28564 100644
--- a/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.10/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,144 @@
+@@ -16,22 +16,145 @@
  
  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
@@ -54,6 +54,7 @@
 +	ATH79_MACH_OM2P,		/* OpenMesh OM2P */
 +	ATH79_MACH_PB42,		/* Atheros PB42 */
 +	ATH79_MACH_PB92,		/* Atheros PB92 */
++	ATH79_MACH_QIHOO_C301,		/* Qihoo 360 C301 */
 +	ATH79_MACH_RB_411,		/* MikroTik RouterBOARD 411/411A/411AH */
 +	ATH79_MACH_RB_411U,		/* MikroTik RouterBOARD 411U */
 +	ATH79_MACH_RB_433,		/* MikroTik RouterBOARD 433/433AH */
@@ -974,7 +975,7 @@
  
  config ATH79_MACH_UBNT_XM
  	bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +810,65 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +810,76 @@ config ATH79_MACH_UBNT_XM
  	  Say 'Y' here if you want your kernel to support the
  	  Ubiquiti Networks XM (rev 1.0) board.
  
@@ -1037,6 +1038,17 @@
 +	select ATH79_DEV_USB
 +	select ATH79_DEV_WMAC
 +
++config ATH79_MACH_QIHOO_C301
++	bool "Qihoo 360 C301 board support"
++	select SOC_AR934X
++	select ATH79_DEV_ETH
++	select ATH79_DEV_GPIO_BUTTONS
++	select ATH79_DEV_LEDS_GPIO
++	select ATH79_DEV_M25P80
++	select ATH79_DEV_WMAC
++	select ATH79_DEV_USB
++	select ATH79_NVRAM
++
  endmenu
  
  config SOC_AR71XX
@@ -1062,7 +1074,7 @@
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,90 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
+@@ -38,9 +38,91 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
  #
  # Machines
  #
@@ -1103,6 +1115,7 @@
 +obj-$(CONFIG_ATH79_MACH_PB42)		+= mach-pb42.o
  obj-$(CONFIG_ATH79_MACH_PB44)		+= mach-pb44.o
 +obj-$(CONFIG_ATH79_MACH_PB92)		+= mach-pb92.o
++obj-$(CONFIG_ATH79_MACH_QIHOO_C301)	+= mach-qihoo-c301.o
 +obj-$(CONFIG_ATH79_MACH_RB4XX)		+= mach-rb4xx.o
 +obj-$(CONFIG_ATH79_MACH_RB750)		+= mach-rb750.o
 +obj-$(CONFIG_ATH79_MACH_RB95X)		+= mach-rb95x.o
diff --git a/target/linux/ar71xx/patches-3.14/601-MIPS-ath79-add-more-register-defines.patch b/target/linux/ar71xx/patches-3.14/601-MIPS-ath79-add-more-register-defines.patch
index 79e53b3..2dec020 100644
--- a/target/linux/ar71xx/patches-3.14/601-MIPS-ath79-add-more-register-defines.patch
+++ b/target/linux/ar71xx/patches-3.14/601-MIPS-ath79-add-more-register-defines.patch
@@ -207,7 +207,7 @@
  #define AR934X_GPIO_REG_FUNC		0x6c
  
  #define AR71XX_GPIO_COUNT		16
-@@ -560,4 +663,148 @@
+@@ -560,4 +663,149 @@
  #define AR934X_SRIF_DPLL2_OUTDIV_SHIFT	13
  #define AR934X_SRIF_DPLL2_OUTDIV_MASK	0x7
  
@@ -279,6 +279,7 @@
 +#define AR934X_GPIO_FUNC_JTAG_DISABLE		BIT(1)
 +
 +#define AR934X_GPIO_OUT_GPIO		0
++#define AR934X_GPIO_OUT_SPI_CS1	7
 +#define AR934X_GPIO_OUT_LED_LINK0	41
 +#define AR934X_GPIO_OUT_LED_LINK1	42
 +#define AR934X_GPIO_OUT_LED_LINK2	43
diff --git a/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch
index cba18a8..df28564 100644
--- a/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.14/610-MIPS-ath79-openwrt-machines.patch
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,22 +16,144 @@
+@@ -16,22 +16,145 @@
  
  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
@@ -54,6 +54,7 @@
 +	ATH79_MACH_OM2P,		/* OpenMesh OM2P */
 +	ATH79_MACH_PB42,		/* Atheros PB42 */
 +	ATH79_MACH_PB92,		/* Atheros PB92 */
++	ATH79_MACH_QIHOO_C301,		/* Qihoo 360 C301 */
 +	ATH79_MACH_RB_411,		/* MikroTik RouterBOARD 411/411A/411AH */
 +	ATH79_MACH_RB_411U,		/* MikroTik RouterBOARD 411U */
 +	ATH79_MACH_RB_433,		/* MikroTik RouterBOARD 433/433AH */
@@ -974,7 +975,7 @@
  
  config ATH79_MACH_UBNT_XM
  	bool "Ubiquiti Networks XM/UniFi boards"
-@@ -83,6 +810,65 @@ config ATH79_MACH_UBNT_XM
+@@ -83,6 +810,76 @@ config ATH79_MACH_UBNT_XM
  	  Say 'Y' here if you want your kernel to support the
  	  Ubiquiti Networks XM (rev 1.0) board.
  
@@ -1037,6 +1038,17 @@
 +	select ATH79_DEV_USB
 +	select ATH79_DEV_WMAC
 +
++config ATH79_MACH_QIHOO_C301
++	bool "Qihoo 360 C301 board support"
++	select SOC_AR934X
++	select ATH79_DEV_ETH
++	select ATH79_DEV_GPIO_BUTTONS
++	select ATH79_DEV_LEDS_GPIO
++	select ATH79_DEV_M25P80
++	select ATH79_DEV_WMAC
++	select ATH79_DEV_USB
++	select ATH79_NVRAM
++
  endmenu
  
  config SOC_AR71XX
@@ -1062,7 +1074,7 @@
  endif
 --- a/arch/mips/ath79/Makefile
 +++ b/arch/mips/ath79/Makefile
-@@ -38,9 +38,90 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
+@@ -38,9 +38,91 @@ obj-$(CONFIG_ATH79_ROUTERBOOT)		+= route
  #
  # Machines
  #
@@ -1103,6 +1115,7 @@
 +obj-$(CONFIG_ATH79_MACH_PB42)		+= mach-pb42.o
  obj-$(CONFIG_ATH79_MACH_PB44)		+= mach-pb44.o
 +obj-$(CONFIG_ATH79_MACH_PB92)		+= mach-pb92.o
++obj-$(CONFIG_ATH79_MACH_QIHOO_C301)	+= mach-qihoo-c301.o
 +obj-$(CONFIG_ATH79_MACH_RB4XX)		+= mach-rb4xx.o
 +obj-$(CONFIG_ATH79_MACH_RB750)		+= mach-rb750.o
 +obj-$(CONFIG_ATH79_MACH_RB95X)		+= mach-rb95x.o
-- 
2.1.0.GIT
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list