[OpenWrt-Devel] [PATCH] Add support for Yuncore XD3200 AP
Jeff Wischkaemper
jeff at wisch.org
Sat Jan 30 23:30:56 EST 2016
From: Jeff <jeff at debian>
Signed-off-by: Jeff <jeff at wisch.org>
---
.../etc/hotplug.d/firmware/11-ath10k-caldata | 4 +
target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 +
.../ar71xx/base-files/lib/upgrade/platform.sh | 1 +
target/linux/ar71xx/config-4.1 | 33 ++++-
.../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 ++
target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 +
.../ar71xx/files/arch/mips/ath79/mach-xd3200.c | 144 ++++++++++++++++++++
.../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 +
target/linux/ar71xx/generic/profiles/yuncore.mk | 19 +++
target/linux/ar71xx/image/Makefile | 4 +-
10 files changed, 217 insertions(+), 2 deletions(-)
create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-xd3200.c
create mode 100644 target/linux/ar71xx/generic/profiles/yuncore.mk
diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 74c3417..bec21eb 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -58,6 +58,10 @@ case "$FIRMWARE" in
ath10kcal_extract "art" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) -2)
;;
+ xd3200)
+ ath10kcal_extract "art" 20480 2116
+ ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) )
+ ;;
r6100)
ath10kcal_extract "caldata" 20480 2116
ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth1/address) +2)
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 34d5741..883c163 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -396,6 +396,9 @@ ar71xx_board_detect() {
*"AP152 reference board")
name="ap152"
;;
+ *"Yuncore XD3200")
+ name="xd3200"
+ ;;
*AP81)
name="ap81"
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 0276a69..563f34b 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -185,6 +185,7 @@ platform_check_image() {
ap135-020 | \
ap147-010 | \
ap152 | \
+ xd3200 | \
ap96 | \
bxu2000n-2-a1 | \
db120 | \
diff --git a/target/linux/ar71xx/config-4.1 b/target/linux/ar71xx/config-4.1
index fe1dd68..25eb0be 100644
--- a/target/linux/ar71xx/config-4.1
+++ b/target/linux/ar71xx/config-4.1
@@ -43,6 +43,7 @@ CONFIG_ATH79_MACH_AP136=y
CONFIG_ATH79_MACH_AP143=y
CONFIG_ATH79_MACH_AP147=y
CONFIG_ATH79_MACH_AP152=y
+CONFIG_ATH79_MACH_XD3200=y
CONFIG_ATH79_MACH_AP81=y
CONFIG_ATH79_MACH_AP83=y
CONFIG_ATH79_MACH_AP96=y
@@ -72,7 +73,6 @@ CONFIG_ATH79_MACH_DLAN_HOTSPOT=y
CONFIG_ATH79_MACH_DLAN_PRO_1200_AC=y
CONFIG_ATH79_MACH_DLAN_PRO_500_WP=y
CONFIG_ATH79_MACH_DR344=y
-CONFIG_ATH79_MACH_GL_DOMINO=y
CONFIG_ATH79_MACH_DRAGINO2=y
CONFIG_ATH79_MACH_EAP300V2=y
CONFIG_ATH79_MACH_EAP7660D=y
@@ -85,6 +85,7 @@ CONFIG_ATH79_MACH_EW_DORIN=y
CONFIG_ATH79_MACH_F9K1115V2=y
CONFIG_ATH79_MACH_GL_AR150=y
CONFIG_ATH79_MACH_GL_AR300=y
+CONFIG_ATH79_MACH_GL_DOMINO=y
CONFIG_ATH79_MACH_GL_INET=y
CONFIG_ATH79_MACH_GS_MINIBOX_V1=y
CONFIG_ATH79_MACH_GS_OOLITE=y
@@ -212,11 +213,13 @@ CONFIG_CSRC_R4K=y
CONFIG_DMA_NONCOHERENT=y
CONFIG_EARLY_PRINTK=y
CONFIG_ETHERNET_PACKET_MANGLE=y
+CONFIG_FIRMWARE_MEMMAP=y
CONFIG_GENERIC_ATOMIC64=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_GENERIC_IO=y
CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_MSI_IRQ=y
CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GENERIC_SCHED_CLOCK=y
CONFIG_GENERIC_SMP_IDLE_THREAD=y
@@ -264,6 +267,10 @@ CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
CONFIG_HAVE_VIRT_CPU_ACCOUNTING_GEN=y
+CONFIG_HOTPLUG_PCI=y
+# CONFIG_HOTPLUG_PCI_CPCI is not set
+CONFIG_HOTPLUG_PCI_PCIE=y
+# CONFIG_HOTPLUG_PCI_SHPC is not set
CONFIG_HW_HAS_PCI=y
CONFIG_HZ_PERIODIC=y
CONFIG_I2C=y
@@ -280,6 +287,7 @@ CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_WORK=y
CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_NU801=y
# CONFIG_LEDS_WNDR3700_USB is not set
CONFIG_MARVELL_PHY=y
CONFIG_MDIO_BOARDINFO=y
@@ -321,13 +329,36 @@ CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
# CONFIG_NO_IOPORT_MAP is not set
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PCI=y
+CONFIG_PCIEAER=y
+CONFIG_PCIEPORTBUS=y
CONFIG_PCI_AR724X=y
+CONFIG_PCI_ATS=y
+CONFIG_PCI_DEBUG=y
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_IOV=y
+CONFIG_PCI_MSI=y
+CONFIG_PCI_PASID=y
+CONFIG_PCI_PRI=y
+CONFIG_PCI_REALLOC_ENABLE_AUTO=y
+CONFIG_PCI_STUB=y
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PGTABLE_LEVELS=2
CONFIG_PHYLIB=y
+CONFIG_RAPIDIO=m
+# CONFIG_RAPIDIO_CPS_GEN2 is not set
+# CONFIG_RAPIDIO_CPS_XX is not set
+# CONFIG_RAPIDIO_DEBUG is not set
+CONFIG_RAPIDIO_DISC_TIMEOUT=30
+# CONFIG_RAPIDIO_DMA_ENGINE is not set
+# CONFIG_RAPIDIO_ENABLE_RX_TX_PORTS is not set
+# CONFIG_RAPIDIO_ENUM_BASIC is not set
+# CONFIG_RAPIDIO_TSI568 is not set
+# CONFIG_RAPIDIO_TSI57X is not set
+# CONFIG_RAPIDIO_TSI721 is not set
+CONFIG_RAS=y
# CONFIG_RCU_STALL_COMMON is not set
+# CONFIG_RIONET is not set
CONFIG_RTL8306_PHY=y
CONFIG_RTL8366RB_PHY=y
CONFIG_RTL8366S_PHY=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index da26414..9923603 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -157,6 +157,15 @@ config ATH79_MACH_AP152
Say 'Y' here if you want your kernel to support the
QCA AP152 reference boards.
+config ATH79_MACH_XD3200
+ bool "Yuncore XD3200"
+ select SOC_QCA956X
+ select ATH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+ select ATH79_DEV_AP9X_PCI if PCI
config ATH79_MACH_AP83
bool "Atheros AP83 board support"
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 991f6f2..9412649 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_ATH79_MACH_AP136) += mach-ap136.o
obj-$(CONFIG_ATH79_MACH_AP143) += mach-ap143.o
obj-$(CONFIG_ATH79_MACH_AP147) += mach-ap147.o
obj-$(CONFIG_ATH79_MACH_AP152) += mach-ap152.o
+obj-$(CONFIG_ATH79_MACH_XD3200) += mach-xd3200.o
obj-$(CONFIG_ATH79_MACH_AP81) += mach-ap81.o
obj-$(CONFIG_ATH79_MACH_AP83) += mach-ap83.o
obj-$(CONFIG_ATH79_MACH_AP96) += mach-ap96.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-xd3200.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-xd3200.c
new file mode 100644
index 0000000..5c5a074
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-xd3200.c
@@ -0,0 +1,144 @@
+
+/*
+
+This file modified to support the Yuncore XD3200, which is based on
+the reference implementation of the Atheros AP152.
+
+ * Qualcomm Atheros AP152 reference board support
+ *
+ * Copyright (c) 2015 Qualcomm Atheros
+ * Copyright (c) 2012 Gabor Juhos <juhosg at openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include <linux/ar8216_platform.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "common.h"
+#include "dev-m25p80.h"
+#include "machtypes.h"
+#include "pci.h"
+#include "dev-eth.h"
+#include "dev-gpio-buttons.h"
+#include "dev-leds-gpio.h"
+#include "dev-spi.h"
+#include "dev-usb.h"
+#include "dev-wmac.h"
+
+#define XD3200_GPIO_LED_USB0 7
+#define XD3200_GPIO_LED_USB1 8
+
+#define XD3200_GPIO_BTN_RESET 2
+#define XD3200_GPIO_BTN_WPS 1
+#define XD3200_KEYS_POLL_INTERVAL 20 /* msecs */
+#define XD3200_KEYS_DEBOUNCE_INTERVAL (3 * XD3200_KEYS_POLL_INTERVAL)
+
+#define XD3200_MAC0_OFFSET 0
+#define XD3200_WMAC_CALDATA_OFFSET 0x1000
+
+static struct gpio_led XD3200_leds_gpio[] __initdata = {
+ {
+ .name = "XD3200:green:usb0",
+ .gpio = XD3200_GPIO_LED_USB0,
+ .active_low = 1,
+ },
+ {
+ .name = "XD3200:green:usb1",
+ .gpio = XD3200_GPIO_LED_USB1,
+ .active_low = 1,
+ },
+};
+
+static struct gpio_keys_button XD3200_gpio_keys[] __initdata = {
+ {
+ .desc = "WPS button",
+ .type = EV_KEY,
+ .code = KEY_WPS_BUTTON,
+ .debounce_interval = XD3200_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = XD3200_GPIO_BTN_WPS,
+ .active_low = 1,
+ },
+ {
+ .desc = "Reset button",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = XD3200_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = XD3200_GPIO_BTN_RESET,
+ .active_low = 1,
+ },
+};
+
+static struct ar8327_pad_cfg XD3200_ar8337_pad0_cfg = {
+ .mode = AR8327_PAD_MAC_SGMII,
+ .sgmii_delay_en = true,
+};
+
+static struct ar8327_platform_data XD3200_ar8337_data = {
+ .pad0_cfg = &XD3200_ar8337_pad0_cfg,
+ .port0_cfg = {
+ .force_link = 1,
+ .speed = AR8327_PORT_SPEED_1000,
+ .duplex = 1,
+ .txpause = 1,
+ .rxpause = 1,
+ },
+};
+
+static struct mdio_board_info XD3200_mdio0_info[] = {
+ {
+ .bus_id = "ag71xx-mdio.0",
+ .phy_addr = 0,
+ .platform_data = &XD3200_ar8337_data,
+ },
+};
+
+static void __init XD3200_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(XD3200_leds_gpio),
+ XD3200_leds_gpio);
+ ath79_register_gpio_keys_polled(-1, XD3200_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(XD3200_gpio_keys),
+ XD3200_gpio_keys);
+
+ ath79_register_usb();
+
+ platform_device_register(&ath79_mdio0_device);
+
+ mdiobus_register_board_info(XD3200_mdio0_info,
+ ARRAY_SIZE(XD3200_mdio0_info));
+
+ ath79_register_wmac(art + XD3200_WMAC_CALDATA_OFFSET, NULL);
+ ath79_register_pci();
+
+ ath79_init_mac(ath79_eth0_data.mac_addr, art + XD3200_MAC0_OFFSET, 0);
+
+ /* GMAC0 is connected to an AR8337 switch */
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_SGMII;
+ ath79_eth0_data.speed = SPEED_1000;
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_mask = BIT(0);
+ ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+
+ ath79_register_eth(0);
+}
+
+MIPS_MACHINE(ATH79_MACH_XD3200, "xd3200", "Yuncore XD3200",
+ XD3200_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index a170e8d..88f8b2e 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -35,6 +35,7 @@ enum ath79_mach_type {
ATH79_MACH_AP143, /* Atheros AP143 reference board */
ATH79_MACH_AP147_010, /* Atheros AP147-010 reference board */
ATH79_MACH_AP152, /* Atheros AP152 reference board */
+ ATH79_MACH_XD3200, /* Yuncore XD3200 */
ATH79_MACH_AP81, /* Atheros AP81 reference board */
ATH79_MACH_AP83, /* Atheros AP83 */
ATH79_MACH_AP96, /* Atheros AP96 */
diff --git a/target/linux/ar71xx/generic/profiles/yuncore.mk b/target/linux/ar71xx/generic/profiles/yuncore.mk
new file mode 100644
index 0000000..0a2c7c0b
--- /dev/null
+++ b/target/linux/ar71xx/generic/profiles/yuncore.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2009-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+
+define Profile/XD3200
+ NAME:=Yuncore XD3200
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-usb-storage kmod-ath10k
+endef
+
+define Profile/XD3200/Description
+ Package set optimized for the Yuncore XD-3200 AP.
+endef
+
+$(eval $(call Profile,XD3200))
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 080d960..7580aa7 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -1533,6 +1533,7 @@ ap143_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs
ap143_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k at 0x50000(firmware)
ap147_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art),16000k at 0x50000(firmware)
ap152_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k at 0x50000(firmware)
+xd3200_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14528k(rootfs),1472k(kernel),64k(art)ro,16000k at 0x50000(firmware)
bxu2000n2_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1408k(kernel),8448k(rootfs),6016k(user),64k(cfg),64k(oem),64k(art)ro
cameo_ap81_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,3840k(firmware),64k(art)ro
cameo_ap91_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,3712k(firmware),64k(mac)ro,64k(art)ro
@@ -1590,7 +1591,6 @@ qihoo_c301_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),64k(devdata)
yun_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6464k(rootfs),1280k(kernel),64k(nvram),64k(art),7744k at 0x50000(firmware)
yun_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k at 0x50000(firmware)
-
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
cp $(KDIR)/vmlinux $(VMLINUX).bin
@@ -2352,6 +2352,7 @@ $(eval $(call SingleProfile,AthLzma,64k,AP143_8M,ap143-8M,AP143,ttyS0,115200,$$(
$(eval $(call SingleProfile,AthLzma,64k,AP143_16M,ap143-16M,AP143,ttyS0,115200,$$(ap143_mtdlayout_16M),RKuImage))
$(eval $(call SingleProfile,AthLzma,64k,AP147_010,ap147-010,AP147-010,ttyS0,115200,$$(ap147_mtdlayout),RKuImage))
$(eval $(call SingleProfile,AthLzma,64k,AP152_16M,ap152-16M,AP152,ttyS0,115200,$$(ap152_mtdlayout_16M),RKuImage))
+$(eval $(call SingleProfile,AthLzma,64k,XD3200_16M,xd3200-16M,XD3200,ttyS0,115200,$$(xd3200_mtdlayout_16M),RKuImage))
$(eval $(call SingleProfile,AthLzma,64k,BXU2000N2,bxu2000n-2-a1,BXU2000n-2-A1,ttyS0,115200,$$(bxu2000n2_mtdlayout),RKuImage))
$(eval $(call SingleProfile,AthLzma,64k,CAP4200AG,cap4200ag,CAP4200AG,ttyS0,115200,$$(cap4200ag_mtdlayout),KRuImage))
$(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))
@@ -2488,6 +2489,7 @@ $(eval $(call MultiProfile,AP136,AP136_010 AP136_020))
$(eval $(call MultiProfile,AP143,AP143_8M AP143_16M))
$(eval $(call MultiProfile,AP147,AP147_010))
$(eval $(call MultiProfile,AP152,AP152_16M))
+$(eval $(call MultiProfile,XD3200,XD3200_16M))
$(eval $(call MultiProfile,DIR615IX,DIR615I1 DIR615I3))
$(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT EWDORIN16M))
$(eval $(call MultiProfile,OPENMESH,OM2P OM5P MR600 MR900 MR1750))
--
1.7.10.4
_______________________________________________
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