I've created a patch to support the YunCore T740, but strangely when I select the device using make menuconfig
, after the build I get an image without support for the corresponding mach-file. On booting I get the error MIPS: no machine found for id 'T740'
. Thus I've checked the kernel config file in the kernel build dir and all ar71xx-generic ATH79_MACH_XXX options have been selected except my ATH79_MACH_T740. When I manually select the device mach file using make kernel_menuconfig
the build succeeds and the device works.
What am I missing here?
Here is the corresponding patch file:
From: Vincent Wiemann <vw@meshwrt.org>
Date: Wed, 3 Apr 2019 22:39:06 +0200
Subject: ar71xx: Add support for YunCore T740
TODO
diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx
index 2d9fcea1ac2f0bb11c4f754710f2ba6c409296ef..9e9f478c747335e214df10b8d85361a391d7940a 100644
--- a/package/boot/uboot-envtools/files/ar71xx
+++ b/package/boot/uboot-envtools/files/ar71xx
@@ -54,6 +54,7 @@ om5p-an|\
r36a|\
rme-eg200|\
sr3200|\
+t740|\
t830|\
tube2h|\
wam250|\
diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network
index 6f5f07e1c5d0c4d0b88c9b171f7cf208cf98cb49..1de43e4b5b255853b8c5b09f8b78b98297ec5299 100755
--- a/target/linux/ar71xx/base-files/etc/board.d/02_network
+++ b/target/linux/ar71xx/base-files/etc/board.d/02_network
@@ -471,7 +471,8 @@ ar71xx_setup_interfaces()
ucidef_add_switch "switch1" \
"0@eth1" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2" "5:wan"
;;
- rut900)
+ rut900|\
+ t740)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index 4eb2abb26ca2676576babb14eb1baa38a2f0de2b..027b7642667243049bd232a976c363f29aa1d500 100644
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -412,6 +412,9 @@ get_status_led() {
qihoo-c301)
status_led="qihoo:green:status"
;;
+ t740)
+ status_led="$board:green:status"
+ ;;
t830)
status_led="$board:green:usb"
;;
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 d21d4134d4af5239dd63293155aa63acde0d5509..124510cf6ae817eb8dd8e2310086554d2b927f16 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
@@ -79,6 +79,7 @@ case "$FIRMWARE" in
oolite-v5.2|\
oolite-v5.2-dev|\
sr3200|\
+ t740|\
xd3200)
ath10kcal_extract "art" 20480 2116
;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index ca1270b7fdc84c53f8417c226f18ca4fff1f27d8..ae963ecef5b8fcadf1b2c21d217c34929aedee31 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -294,6 +294,7 @@ platform_check_image() {
sc300m|\
sc450|\
sr3200|\
+ t740|\
t830|\
tew-632brp|\
tew-712br|\
diff --git a/target/linux/ar71xx/config-4.9 b/target/linux/ar71xx/config-4.9
index 8aa0b41ae961d2aa34513b7456520265f14ef5b5..387acb89e9a064078f49bf5b45747c99361ef8b9 100644
--- a/target/linux/ar71xx/config-4.9
+++ b/target/linux/ar71xx/config-4.9
@@ -188,6 +188,7 @@ CONFIG_ATH79=y
# CONFIG_ATH79_MACH_SMART_300 is not set
# CONFIG_ATH79_MACH_SOM9331 is not set
# CONFIG_ATH79_MACH_SR3200 is not set
+# CONFIG_ATH79_MACH_T740 is not set
# CONFIG_ATH79_MACH_T830 is not set
# CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE is not set
# CONFIG_ATH79_MACH_TEW_632BRP is not set
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
index 1d0e3d910d42ab87af8481d6d13a79949d68e41b..7197dbd6fe063201f7358bce54b2c343ef1af1ac 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
@@ -1183,6 +1183,18 @@ config ATH79_MACH_SMART_300
select ATH79_DEV_M25P80
select ATH79_DEV_WMAC
+config ATH79_MACH_T740
+ bool "YunCore T740 support"
+ select SOC_QCA953X
+ select ATH79_DEV_AP9X_PCI if PCI
+ select ARH79_DEV_ETH
+ select ARH79_DEV_GPIO_BUTTONS
+ select ATH79_DEV_LEDS_GPIO
+ select ATH79_DEV_M25P80
+ select ATH79_DEV_USB
+ select ATH79_DEV_WMAC
+
+
config ATH79_MACH_T830
bool "YunCore T830 support"
select SOC_QCA953X
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/Makefile b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
index 8800a7de1020062cbf4f25cf507ed9b1fbe78da0..ba68d5476192de3d0172ef63d45bb4ea9fc3814d 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ath79/Makefile
@@ -200,6 +200,7 @@ obj-$(CONFIG_ATH79_MACH_SC450) += mach-sc450.o
obj-$(CONFIG_ATH79_MACH_SMART_300) += mach-smart-300.o
obj-$(CONFIG_ATH79_MACH_SOM9331) += mach-som9331.o
obj-$(CONFIG_ATH79_MACH_SR3200) += mach-sr3200.o
+obj-$(CONFIG_ATH79_MACH_T740) += mach-t740.o
obj-$(CONFIG_ATH79_MACH_T830) += mach-t830.o
obj-$(CONFIG_ATH79_MACH_TELLSTICK_ZNET_LITE) += mach-tellstick-znet-lite.o
obj-$(CONFIG_ATH79_MACH_TEW_632BRP) += mach-tew-632brp.o
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-t740.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-t740.c
new file mode 100644
index 0000000000000000000000000000000000000000..e2cf445e8d057c87c4dbf5e024ba1be49263c04f
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-t740.c
@@ -0,0 +1,103 @@
+/*
+ * YunCore T740 board support
+ *
+ * Copyright (C) 2019 Vincent Wiemann <vw@meshwrt.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.
+ */
+
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+
+#include <asm/mach-ath79/ath79.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-usb.h"
+#include "dev-wmac.h"
+#include "machtypes.h"
+
+#define T740_GPIO_LED_STATUS_GREEN 506
+#define T740_GPIO_LED_STATUS_RED 13
+
+#define T740_GPIO_BTN_RESET 17
+
+#define T740_KEYS_POLL_INTERVAL 20 /* msec */
+#define T740_KEYS_DEBOUNCE_INTERVAL (3 * T740_KEYS_POLL_INTERVAL)
+
+#define T740_WMAC2G_CALDATA_OFFSET 0x1000
+#define T740_WMAC5G_CALDATA_OFFSET 0x5000
+
+static struct gpio_led t740_gpio_leds[] __initdata = {
+ {
+ .name = "t740:green:status",
+ .gpio = T740_GPIO_LED_STATUS_GREEN,
+ .active_low = 1,
+ .default_state = 1,
+ }, {
+ .name = "t740:red:status",
+ .gpio = T740_GPIO_LED_STATUS_RED,
+ .active_low = 1,
+ .default_state = 0,
+ }
+};
+
+static struct gpio_keys_button t740_gpio_keys[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = T740_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = T740_GPIO_BTN_RESET,
+ .active_low = 1,
+ }
+};
+
+static void __init t740_setup(void)
+{
+ u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
+
+ ath79_register_m25p80(NULL);
+
+ ath79_setup_ar933x_phy4_switch(false, false);
+
+ ath79_register_mdio(0, 0x0);
+
+ ath79_switch_data.phy4_mii_en = 1;
+ ath79_switch_data.phy_poll_mask |= BIT(4);
+
+ /* LAN */
+ ath79_eth1_data.duplex = DUPLEX_FULL;
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
+ ath79_init_mac(ath79_eth1_data.mac_addr, art + 6, 0);
+ ath79_register_eth(1);
+
+ /* WAN */
+ ath79_eth0_data.duplex = DUPLEX_FULL;
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
+ ath79_eth0_data.phy_mask = BIT(4);
+ ath79_eth0_data.speed = SPEED_100;
+ ath79_init_mac(ath79_eth0_data.mac_addr, art, 0);
+ ath79_register_eth(0);
+
+ ath79_register_gpio_keys_polled(-1, T740_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(t740_gpio_keys),
+ t740_gpio_keys);
+
+ ath79_register_leds_gpio(-1, ARRAY_SIZE(t740_gpio_leds),
+ t740_gpio_leds);
+
+ ath79_register_usb();
+
+ ath79_register_wmac(art + T740_WMAC2G_CALDATA_OFFSET, NULL);
+ ap91_pci_init(art + T740_WMAC5G_CALDATA_OFFSET, NULL);
+}
+
+MIPS_MACHINE(ATH79_MACH_T740, "T740", "YunCore T740", t740_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 80f6e1d95b7a4e5559e7d5da041b32d962ad4e84..3ea6e2cea1fa79fbbe97bf1c76fc5a62216d204e 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -237,6 +237,7 @@ enum ath79_mach_type {
ATH79_MACH_SMART_300, /* NC-LINK SMART-300 */
ATH79_MACH_SOM9331, /* OpenEmbed SOM9331 */
ATH79_MACH_SR3200, /* YunCore SR3200 */
+ ATH79_MACH_T740, /* YunCore T740 */
ATH79_MACH_T830, /* YunCore T830 */
ATH79_MACH_TELLSTICK_ZNET_LITE, /* TellStick ZNet Lite */
ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */
diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 4568b656219419e9ca1156c6716bd2124074cb32..79ef57ca44b1648bfb38061aa3848d74aaa00ebd 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -1032,6 +1032,18 @@ define Device/xd3200
endef
TARGET_DEVICES += xd3200
+define Device/t740
+ DEVICE_TITLE := YunCore T740
+ DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct
+ BOARDNAME := T740
+ IMAGE_SIZE := 16000k
+ MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env),16000k(firmware),64k(art)ro
+ SUPPORTED_DEVICES := t740
+ IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) |\
+ append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += t740
+
define Device/t830
DEVICE_TITLE := YunCore T830
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport