Merge Official Source

This commit is contained in:
AmadeusGhost 2020-07-09 11:53:09 +08:00
commit 08dadc6941
110 changed files with 6776 additions and 315 deletions

View File

@ -157,7 +157,7 @@ define BuildKernel
compile: $(LINUX_DIR)/.modules
$(MAKE) -C image compile TARGET_BUILD=
oldconfig menuconfig nconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
oldconfig menuconfig nconfig xconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
rm -f $(LINUX_DIR)/.config.prev
rm -f $(STAMP_CONFIGURED)
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config

View File

@ -177,8 +177,8 @@ ifeq ($(DUMP),1)
CPU_CFLAGS_octeonplus = -march=octeon+ -mabi=64
endif
ifeq ($(ARCH),i386)
CPU_TYPE ?= pentium
CPU_CFLAGS_pentium = -march=pentium-mmx
CPU_TYPE ?= pentium-mmx
CPU_CFLAGS_pentium-mmx = -march=pentium-mmx
CPU_CFLAGS_pentium4 = -march=pentium4
endif
ifneq ($(findstring arm,$(ARCH)),)
@ -226,7 +226,9 @@ ifeq ($(DUMP),1)
.PRECIOUS: $(TMP_CONFIG)
ifdef KERNEL_TESTING_PATCHVER
FEATURES += testing-kernel
ifneq ($(KERNEL_TESTING_PATCHVER),$(KERNEL_PATCHVER))
FEATURES += testing-kernel
endif
endif
ifneq ($(CONFIG_OF),)
FEATURES += dt

View File

@ -141,6 +141,13 @@ menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
[ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
$< Config.in
nconfig: scripts/config/nconf prepare-tmpinfo FORCE
if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
cp $(HOME)/.openwrt/defconfig .config; \
fi
[ -L .config ] && export KCONFIG_OVERWRITECONFIG=1; \
$< Config.in
xconfig: scripts/config/qconf prepare-tmpinfo FORCE
if [ \! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then \
cp $(HOME)/.openwrt/defconfig .config; \
@ -162,6 +169,7 @@ kernel_oldconfig: prepare_kernel_conf
ifneq ($(DISTRO_PKG_CONFIG),)
kernel_menuconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_nconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
kernel_xconfig: export PATH:=$(dir $(DISTRO_PKG_CONFIG)):$(PATH)
endif
kernel_menuconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
@ -169,6 +177,9 @@ kernel_menuconfig: prepare_kernel_conf
kernel_nconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux nconfig
kernel_xconfig: prepare_kernel_conf
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig
staging_dir/host/.prereq-build: include/prereq-build.mk
mkdir -p tmp
@$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \

View File

@ -152,10 +152,26 @@ macaddr_geteui() {
echo ${mac:9:2}$sep${mac:12:2}$sep${mac:15:2}
}
macaddr_setbit_la() {
macaddr_setbit() {
local mac=$1
local bit=${2:-0}
printf "%02x:%s" $((0x${mac%%:*} | 0x02)) ${mac#*:}
[ $bit -gt 0 -a $bit -le 48 ] || return
printf "%012x" $(( 0x${mac//:/} | 2**(48-bit) )) | sed -e 's/\(.\{2\}\)/\1:/g' -e 's/:$//'
}
macaddr_unsetbit() {
local mac=$1
local bit=${2:-0}
[ $bit -gt 0 -a $bit -le 48 ] || return
printf "%012x" $(( 0x${mac//:/} & ~(2**(48-bit)) )) | sed -e 's/\(.\{2\}\)/\1:/g' -e 's/:$//'
}
macaddr_setbit_la() {
macaddr_setbit $1 7
}
macaddr_2bin() {

View File

@ -0,0 +1,61 @@
#
# Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mt7623n-preloader
PKG_VERSION:=2020-03-11
PKG_RELEASE:=b27114e184449a33b5d875fda14198f5e6fee2bb
PKG_MAINTAINER:=David Woodhouse <dwmw2@infradead.org>
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_RELEASE)
PKG_FLAGS:=nonshared
include $(INCLUDE_DIR)/package.mk
BPI_PRELOADER_URL:=@GITHUB/BPI-SINOVOIP/BPI-files/$(PKG_RELEASE)/SD/100MB/
BPI_PRELOADER_PREFIX:=bpi-preloader-$(PKG_RELEASE)
define Download/BPI-R2-preloader-2k.img.gz
FILE:=$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz
URL:=$(BPI_PRELOADER_URL)
URL_FILE:=BPI-R2-preloader-DDR1600-20191024-2k.img.gz
HASH:=c731cc166c912c84846e2ed5faf727504e4dec1463754baa6328e9908c84a373
endef
$(eval $(call Download,BPI-R2-preloader-2k.img.gz))
define Package/mt7623n-preloader
SECTION:=boot
CATEGORY:=Boot Loaders
DEPENDS:=@TARGET_mediatek_mt7623
TITLE:=mt7623n-preloader
DEFAULT:=y if TARGET_mediatek
endef
define Package/mt7623n-preloader/description
Preloader image for mt7623n based boards like Banana Pi R2.
endef
define Build/Prepare
rm -rf $(PKG_BUILD_DIR)
mkdir -p $(PKG_BUILD_DIR)
cp $(DL_DIR)/$(BPI_PRELOADER_PREFIX)-BPI-R2-preloader-DDR1600-20191024-2k.img.gz $(PKG_BUILD_DIR)/mt7623n_bpir2-preloader.bin.gz
endef
define Build/Compile
true
endef
define Build/InstallDev
mkdir -p $(STAGING_DIR_IMAGE)
gunzip -c $(PKG_BUILD_DIR)/mt7623n_bpir2-preloader.bin.gz > $(STAGING_DIR_IMAGE)/mt7623n_bpir2-preloader.bin
endef
$(eval $(call BuildPackage,mt7623n-preloader))

View File

@ -14,6 +14,7 @@ board=$(board_name)
case "$board" in
alfa-network,ap121f|\
arduino,yun|\
buffalo,bhr-4grv2|\
devolo,magic-2-wifi|\
engenius,ecb1750|\

View File

@ -37,6 +37,9 @@ openmesh,a42 |\
openmesh,a62)
ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000"
;;
buffalo,wtr-m2133hp)
ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x40000" "0x20000"
;;
linksys,ea6350v3)
ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000"
;;

View File

@ -31,6 +31,7 @@ ubootenv_mtdinfo () {
}
case "$board" in
linksys,ea7500-v1 |\
linksys,ea8500)
ubootenv_add_uci_config "/dev/mtd10" "0x0" "0x20000" "0x20000"
;;

View File

@ -20,6 +20,7 @@ linksys,viper|\
raidsonic,ib-nas62x0|\
seagate,dockstar|\
zyxel,nsa310b|\
zyxel,nsa310s|\
zyxel,nsa325)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;;

View File

@ -34,6 +34,7 @@ zbtlink,zbt-wg2626)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000"
;;
linksys,ea7500-v2|\
xiaomi,mi-router-ac2100|\
xiaomi,mir3p|\
xiaomi,mir3g|\
xiaomi,redmi-router-ac2100)

View File

@ -59,6 +59,11 @@ define U-Boot/nsa310
BUILD_DEVICES:=zyxel_nsa310b
endef
define U-Boot/nsa310s
NAME:=Zyxel NSA310S
BUILD_DEVICES:=zyxel_nsa310s
endef
define U-Boot/nsa325
NAME:=Zyxel NSA325v1 and v2
BUILD_DEVICES:=zyxel_nsa325
@ -85,6 +90,7 @@ UBOOT_TARGETS := \
ib62x0 ib62x0_second_stage \
iconnect iconnect_second_stage \
nsa310 \
nsa310s \
nsa325 \
pogo_e02 pogo_e02_second_stage \
pogoplugv4

View File

@ -0,0 +1,54 @@
--- a/configs/nsa310s_defconfig
+++ b/configs/nsa310s_defconfig
@@ -5,7 +5,7 @@ CONFIG_KIRKWOOD=y
CONFIG_SYS_TEXT_BASE=0x600000
CONFIG_TARGET_NSA310S=y
CONFIG_ENV_SIZE=0x20000
-CONFIG_ENV_OFFSET=0xE0000
+CONFIG_ENV_OFFSET=0xC0000
CONFIG_NR_DRAM_BANKS=2
CONFIG_BOOTDELAY=3
CONFIG_USE_PREBOOT=y
@@ -25,7 +25,7 @@ CONFIG_CMD_EXT2=y
CONFIG_CMD_FAT=y
CONFIG_CMD_JFFS2=y
CONFIG_CMD_MTDPARTS=y
-CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xe0000@0x0(uboot),0x20000@0xe0000(uboot_env),0x100000@0x100000(second_stage_uboot),-@0x200000(root)"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0xc0000@0x0(uboot),0x80000@0xc0000(uboot_env),-@0x140000(ubi)"
CONFIG_CMD_UBI=y
CONFIG_ISO_PARTITION=y
CONFIG_ENV_IS_IN_NAND=y
--- a/include/configs/nsa310s.h
+++ b/include/configs/nsa310s.h
@@ -30,22 +30,17 @@
/* default environment variables */
#define CONFIG_BOOTCOMMAND \
- "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
- "ubi part root; " \
- "ubifsmount ubi:rootfs; " \
- "ubifsload 0x800000 ${kernel}; " \
- "ubifsload 0x700000 ${fdt}; " \
- "ubifsumount; " \
- "fdt addr 0x700000; fdt resize; fdt chosen; " \
- "bootz 0x800000 - 0x700000"
+ "setenv bootargs ${console} ${mtdparts} ${bootargs_root}; " \
+ "ubi part ubi; " \
+ "ubifsmount ubi:rootfs; " \
+ "ubi read 0x800000 kernel; " \
+ "bootm 0x800000"
#define CONFIG_EXTRA_ENV_SETTINGS \
- "console=console=ttyS0,115200\0" \
- "mtdids=nand0=orion_nand\0" \
- "mtdparts="CONFIG_MTDPARTS_DEFAULT \
- "kernel=/boot/zImage\0" \
- "fdt=/boot/nsa310s.dtb\0" \
- "bootargs_root=ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rw\0"
+ "console=console=ttyS0,115200\0" \
+ "mtdids=nand0=orion_nand\0" \
+ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \
+ "bootargs_root=\0"
/* Ethernet driver configuration */
#ifdef CONFIG_CMD_NET

View File

@ -162,3 +162,23 @@
+CONFIG_FIT_VERBOSE=y
+CONFIG_LZMA=y
+CONFIG_LZO=y
--- a/configs/nsa310s_defconfig
+++ b/configs/nsa310s_defconfig
@@ -40,5 +40,8 @@ CONFIG_SYS_NS16550=y
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_STORAGE=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
CONFIG_LZMA=y
+CONFIG_LZO=y
CONFIG_OF_LIBFDT=y
--- a/include/configs/nsa310s.h
+++ b/include/configs/nsa310s.h
@@ -63,4 +63,6 @@
#define CONFIG_RTC_MV
#endif /* CONFIG_CMD_DATE */
+#include "openwrt-kirkwood-common.h"
+
#endif /* _CONFIG_NSA310S_H */

View File

@ -27,7 +27,14 @@ define U-Boot/mt7622
UBOOT_CONFIG:=mt7622_rfb
endef
UBOOT_TARGETS := mt7629 mt7622
define U-Boot/mt7623n_bpir2
NAME:=Banana Pi R2 (mt7623)
BUILD_SUBTARGET:=mt7623
UBOOT_IMAGE:=u-boot.bin
UBOOT_CONFIG:=mt7623n_bpir2
endef
UBOOT_TARGETS := mt7629 mt7622 mt7623n_bpir2
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE)

View File

@ -0,0 +1,18 @@
diff --git a/configs/mt7623n_bpir2_defconfig b/configs/mt7623n_bpir2_defconfig
index 6b9fbd7e22..fb2a004803 100644
--- a/configs/mt7623n_bpir2_defconfig
+++ b/configs/mt7623n_bpir2_defconfig
@@ -52,3 +52,13 @@ CONFIG_TIMER=y
CONFIG_WDT_MTK=y
CONFIG_LZMA=y
# CONFIG_EFI_LOADER is not set
+CONFIG_CMD_BOOTZ=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+#enables savenenv-command
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_INTERFACE="mmc"
+CONFIG_ENV_FAT_DEVICE_AND_PART=":2"
+CONFIG_ENV_FAT_FILE="uboot.env"
+CONFIG_CMD_ASKENV=y
+CONFIG_ENV_SIZE=0x2000
+CONFIG_CMD_SETEXPR=y

View File

@ -0,0 +1,236 @@
From eca387ea507bde160558a0e5301bf2e0f1985b3b Mon Sep 17 00:00:00 2001
From: David Woodhouse <dwmw2@infradead.org>
Date: Fri, 19 Jun 2020 11:34:32 +0100
Subject: [PATCH] pinctrl: mediatek: add PUPD/R0/R1 support for MT7623
The pins for the MMC controller weren't being set up correctly because the
pinctrl driver only sets the GPIO pullup/pulldown config and doesn't
handle the special cases with PUPD/R0/R1 control.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
drivers/pinctrl/mediatek/pinctrl-mt7623.c | 129 ++++++++++++++++++
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 19 ++-
drivers/pinctrl/mediatek/pinctrl-mtk-common.h | 3 +
3 files changed, 146 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt7623.c b/drivers/pinctrl/mediatek/pinctrl-mt7623.c
index d58d840e08..0f5dcb2c63 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt7623.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7623.c
@@ -262,6 +262,132 @@ static const struct mtk_pin_field_calc mt7623_pin_drv_range[] = {
PIN_FIELD16(278, 278, 0xf70, 0x10, 8, 4),
};
+static const struct mtk_pin_field_calc mt7623_pin_pupd_range[] = {
+ /* MSDC0 */
+ PIN_FIELD16(111, 111, 0xd00, 0x10, 12, 1),
+ PIN_FIELD16(112, 112, 0xd00, 0x10, 8, 1),
+ PIN_FIELD16(113, 113, 0xd00, 0x10, 4, 1),
+ PIN_FIELD16(114, 114, 0xd00, 0x10, 0, 1),
+ PIN_FIELD16(115, 115, 0xd10, 0x10, 0, 1),
+ PIN_FIELD16(116, 116, 0xcd0, 0x10, 8, 1),
+ PIN_FIELD16(117, 117, 0xcc0, 0x10, 8, 1),
+ PIN_FIELD16(118, 118, 0xcf0, 0x10, 12, 1),
+ PIN_FIELD16(119, 119, 0xcf0, 0x10, 8, 1),
+ PIN_FIELD16(120, 120, 0xcf0, 0x10, 4, 1),
+ PIN_FIELD16(121, 121, 0xcf0, 0x10, 0, 1),
+ /* MSDC1 */
+ PIN_FIELD16(105, 105, 0xd40, 0x10, 8, 1),
+ PIN_FIELD16(106, 106, 0xd30, 0x10, 8, 1),
+ PIN_FIELD16(107, 107, 0xd60, 0x10, 0, 1),
+ PIN_FIELD16(108, 108, 0xd60, 0x10, 10, 1),
+ PIN_FIELD16(109, 109, 0xd60, 0x10, 4, 1),
+ PIN_FIELD16(110, 110, 0xc60, 0x10, 12, 1),
+ /* MSDC1 */
+ PIN_FIELD16(85, 85, 0xda0, 0x10, 8, 1),
+ PIN_FIELD16(86, 86, 0xd90, 0x10, 8, 1),
+ PIN_FIELD16(87, 87, 0xdc0, 0x10, 0, 1),
+ PIN_FIELD16(88, 88, 0xdc0, 0x10, 10, 1),
+ PIN_FIELD16(89, 89, 0xdc0, 0x10, 4, 1),
+ PIN_FIELD16(90, 90, 0xdc0, 0x10, 12, 1),
+ /* MSDC0E */
+ PIN_FIELD16(249, 249, 0x140, 0x10, 0, 1),
+ PIN_FIELD16(250, 250, 0x130, 0x10, 12, 1),
+ PIN_FIELD16(251, 251, 0x130, 0x10, 8, 1),
+ PIN_FIELD16(252, 252, 0x130, 0x10, 4, 1),
+ PIN_FIELD16(253, 253, 0x130, 0x10, 0, 1),
+ PIN_FIELD16(254, 254, 0xf40, 0x10, 12, 1),
+ PIN_FIELD16(255, 255, 0xf40, 0x10, 8, 1),
+ PIN_FIELD16(256, 256, 0xf40, 0x10, 4, 1),
+ PIN_FIELD16(257, 257, 0xf40, 0x10, 0, 1),
+ PIN_FIELD16(258, 258, 0xcb0, 0x10, 8, 1),
+ PIN_FIELD16(259, 259, 0xc90, 0x10, 8, 1),
+ PIN_FIELD16(261, 261, 0x140, 0x10, 8, 1),
+};
+
+static const struct mtk_pin_field_calc mt7623_pin_r1_range[] = {
+ /* MSDC0 */
+ PIN_FIELD16(111, 111, 0xd00, 0x10, 13, 1),
+ PIN_FIELD16(112, 112, 0xd00, 0x10, 9, 1),
+ PIN_FIELD16(113, 113, 0xd00, 0x10, 5, 1),
+ PIN_FIELD16(114, 114, 0xd00, 0x10, 1, 1),
+ PIN_FIELD16(115, 115, 0xd10, 0x10, 1, 1),
+ PIN_FIELD16(116, 116, 0xcd0, 0x10, 9, 1),
+ PIN_FIELD16(117, 117, 0xcc0, 0x10, 9, 1),
+ PIN_FIELD16(118, 118, 0xcf0, 0x10, 13, 1),
+ PIN_FIELD16(119, 119, 0xcf0, 0x10, 9, 1),
+ PIN_FIELD16(120, 120, 0xcf0, 0x10, 5, 1),
+ PIN_FIELD16(121, 121, 0xcf0, 0x10, 1, 1),
+ /* MSDC1 */
+ PIN_FIELD16(105, 105, 0xd40, 0x10, 9, 1),
+ PIN_FIELD16(106, 106, 0xd30, 0x10, 9, 1),
+ PIN_FIELD16(107, 107, 0xd60, 0x10, 1, 1),
+ PIN_FIELD16(108, 108, 0xd60, 0x10, 9, 1),
+ PIN_FIELD16(109, 109, 0xd60, 0x10, 5, 1),
+ PIN_FIELD16(110, 110, 0xc60, 0x10, 13, 1),
+ /* MSDC2 */
+ PIN_FIELD16(85, 85, 0xda0, 0x10, 9, 1),
+ PIN_FIELD16(86, 86, 0xd90, 0x10, 9, 1),
+ PIN_FIELD16(87, 87, 0xdc0, 0x10, 1, 1),
+ PIN_FIELD16(88, 88, 0xdc0, 0x10, 9, 1),
+ PIN_FIELD16(89, 89, 0xdc0, 0x10, 5, 1),
+ PIN_FIELD16(90, 90, 0xdc0, 0x10, 13, 1),
+ /* MSDC0E */
+ PIN_FIELD16(249, 249, 0x140, 0x10, 1, 1),
+ PIN_FIELD16(250, 250, 0x130, 0x10, 13, 1),
+ PIN_FIELD16(251, 251, 0x130, 0x10, 9, 1),
+ PIN_FIELD16(252, 252, 0x130, 0x10, 5, 1),
+ PIN_FIELD16(253, 253, 0x130, 0x10, 1, 1),
+ PIN_FIELD16(254, 254, 0xf40, 0x10, 13, 1),
+ PIN_FIELD16(255, 255, 0xf40, 0x10, 9, 1),
+ PIN_FIELD16(256, 256, 0xf40, 0x10, 5, 1),
+ PIN_FIELD16(257, 257, 0xf40, 0x10, 1, 1),
+ PIN_FIELD16(258, 258, 0xcb0, 0x10, 9, 1),
+ PIN_FIELD16(259, 259, 0xc90, 0x10, 9, 1),
+ PIN_FIELD16(261, 261, 0x140, 0x10, 9, 1),
+};
+
+static const struct mtk_pin_field_calc mt7623_pin_r0_range[] = {
+ /* MSDC0 */
+ PIN_FIELD16(111, 111, 0xd00, 0x10, 14, 1),
+ PIN_FIELD16(112, 112, 0xd00, 0x10, 10, 1),
+ PIN_FIELD16(113, 113, 0xd00, 0x10, 6, 1),
+ PIN_FIELD16(114, 114, 0xd00, 0x10, 2, 1),
+ PIN_FIELD16(115, 115, 0xd10, 0x10, 2, 1),
+ PIN_FIELD16(116, 116, 0xcd0, 0x10, 10, 1),
+ PIN_FIELD16(117, 117, 0xcc0, 0x10, 10, 1),
+ PIN_FIELD16(118, 118, 0xcf0, 0x10, 14, 1),
+ PIN_FIELD16(119, 119, 0xcf0, 0x10, 10, 1),
+ PIN_FIELD16(120, 120, 0xcf0, 0x10, 6, 1),
+ PIN_FIELD16(121, 121, 0xcf0, 0x10, 2, 1),
+ /* MSDC1 */
+ PIN_FIELD16(105, 105, 0xd40, 0x10, 10, 1),
+ PIN_FIELD16(106, 106, 0xd30, 0x10, 10, 1),
+ PIN_FIELD16(107, 107, 0xd60, 0x10, 2, 1),
+ PIN_FIELD16(108, 108, 0xd60, 0x10, 8, 1),
+ PIN_FIELD16(109, 109, 0xd60, 0x10, 6, 1),
+ PIN_FIELD16(110, 110, 0xc60, 0x10, 14, 1),
+ /* MSDC2 */
+ PIN_FIELD16(85, 85, 0xda0, 0x10, 10, 1),
+ PIN_FIELD16(86, 86, 0xd90, 0x10, 10, 1),
+ PIN_FIELD16(87, 87, 0xdc0, 0x10, 2, 1),
+ PIN_FIELD16(88, 88, 0xdc0, 0x10, 8, 1),
+ PIN_FIELD16(89, 89, 0xdc0, 0x10, 6, 1),
+ PIN_FIELD16(90, 90, 0xdc0, 0x10, 14, 1),
+ /* MSDC0E */
+ PIN_FIELD16(249, 249, 0x140, 0x10, 2, 1),
+ PIN_FIELD16(250, 250, 0x130, 0x10, 14, 1),
+ PIN_FIELD16(251, 251, 0x130, 0x10, 10, 1),
+ PIN_FIELD16(252, 252, 0x130, 0x10, 6, 1),
+ PIN_FIELD16(253, 253, 0x130, 0x10, 2, 1),
+ PIN_FIELD16(254, 254, 0xf40, 0x10, 14, 1),
+ PIN_FIELD16(255, 255, 0xf40, 0x10, 10, 1),
+ PIN_FIELD16(256, 256, 0xf40, 0x10, 6, 1),
+ PIN_FIELD16(257, 257, 0xf40, 0x10, 5, 1),
+ PIN_FIELD16(258, 258, 0xcb0, 0x10, 10, 1),
+ PIN_FIELD16(259, 259, 0xc90, 0x10, 10, 1),
+ PIN_FIELD16(261, 261, 0x140, 0x10, 10, 1),
+};
+
static const struct mtk_pin_reg_calc mt7623_reg_cals[] = {
[PINCTRL_PIN_REG_MODE] = MTK_RANGE(mt7623_pin_mode_range),
[PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt7623_pin_dir_range),
@@ -272,6 +398,9 @@ static const struct mtk_pin_reg_calc mt7623_reg_cals[] = {
[PINCTRL_PIN_REG_PULLSEL] = MTK_RANGE(mt7623_pin_pullsel_range),
[PINCTRL_PIN_REG_PULLEN] = MTK_RANGE(mt7623_pin_pullen_range),
[PINCTRL_PIN_REG_DRV] = MTK_RANGE(mt7623_pin_drv_range),
+ [PINCTRL_PIN_REG_PUPD] = MTK_RANGE(mt7623_pin_pupd_range),
+ [PINCTRL_PIN_REG_R0] = MTK_RANGE(mt7623_pin_r0_range),
+ [PINCTRL_PIN_REG_R1] = MTK_RANGE(mt7623_pin_r1_range),
};
static const struct mtk_pin_desc mt7623_pins[] = {
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 5fdc150295..f5199fc574 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -296,7 +296,7 @@ static const struct pinconf_param mtk_conf_params[] = {
};
-int mtk_pinconf_bias_set_v0(struct udevice *dev, u32 pin, u32 arg)
+int mtk_pinconf_bias_set_v0(struct udevice *dev, u32 pin, u32 arg, u32 val)
{
int err, disable, pullup;
@@ -323,12 +323,14 @@ int mtk_pinconf_bias_set_v0(struct udevice *dev, u32 pin, u32 arg)
return 0;
}
-int mtk_pinconf_bias_set_v1(struct udevice *dev, u32 pin, u32 arg)
+int mtk_pinconf_bias_set_v1(struct udevice *dev, u32 pin, u32 arg, u32 val)
{
- int err, disable, pullup;
+ int err, disable, pullup, r0, r1;
disable = (arg == PIN_CONFIG_BIAS_DISABLE);
pullup = (arg == PIN_CONFIG_BIAS_PULL_UP);
+ r0 = !!(val & 1);
+ r1 = !!(val & 2);
if (disable) {
err = mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_PULLEN, 0);
@@ -344,6 +346,13 @@ int mtk_pinconf_bias_set_v1(struct udevice *dev, u32 pin, u32 arg)
return err;
}
+ /* Also set PUPD/R0/R1 if the pin has them */
+ err = mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_PUPD, !pullup);
+ if (err != -EINVAL) {
+ mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R0, r0);
+ mtk_hw_set_value(dev, pin, PINCTRL_PIN_REG_R1, r1);
+ }
+
return 0;
}
@@ -419,9 +428,9 @@ static int mtk_pinconf_set(struct udevice *dev, unsigned int pin,
case PIN_CONFIG_BIAS_PULL_UP:
case PIN_CONFIG_BIAS_PULL_DOWN:
if (rev == MTK_PINCTRL_V0)
- err = mtk_pinconf_bias_set_v0(dev, pin, param);
+ err = mtk_pinconf_bias_set_v0(dev, pin, param, arg);
else
- err = mtk_pinconf_bias_set_v1(dev, pin, param);
+ err = mtk_pinconf_bias_set_v1(dev, pin, param, arg);
if (err)
goto err;
break;
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index e815761450..5e51a9a90c 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -51,6 +51,9 @@ enum {
PINCTRL_PIN_REG_PULLEN,
PINCTRL_PIN_REG_PULLSEL,
PINCTRL_PIN_REG_DRV,
+ PINCTRL_PIN_REG_PUPD,
+ PINCTRL_PIN_REG_R0,
+ PINCTRL_PIN_REG_R1,
PINCTRL_PIN_REG_MAX,
};
--
2.26.2

View File

@ -0,0 +1,88 @@
From fb2810b2c7209d4ed690e48e5bffa52d1af2eda3 Mon Sep 17 00:00:00 2001
From: David Woodhouse <dwmw2@infradead.org>
Date: Fri, 19 Jun 2020 22:57:04 +0100
Subject: [PATCH] env/fat.c: allow loading from a FAT partition on the MMC boot
device
I don't want to have to specify the device; only the partition.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
---
env/Kconfig | 4 ++++
env/fat.c | 31 +++++++++++++++++++++++++++++--
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/env/Kconfig b/env/Kconfig
index 0d6f559b39..a2020a8661 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -432,6 +432,10 @@ config ENV_FAT_DEVICE_AND_PART
If none, first valid partition in device D. If no
partition table then means device D.
+ If ENV_FAT_INTERFACE is set to "mmc" then device 'D' can be omitted,
+ leaving the string starting with a colon, and the boot device will
+ be used.
+
config ENV_FAT_FILE
string "Name of the FAT file to use for the environment"
depends on ENV_IS_IN_FAT
diff --git a/env/fat.c b/env/fat.c
index 1836556f36..1c32d17bd5 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -31,6 +31,33 @@
# endif
#endif
+#if defined(CMD_SAVEENV) || defined(CMD_LOADENV)
+__weak int mmc_get_env_dev(void)
+{
+ return CONFIG_SYS_MMC_ENV_DEV;
+}
+
+static char *env_fat_device_and_part(void)
+{
+#ifdef CONFIG_MMC
+ static char *part_str;
+
+ if (!part_str) {
+ part_str = CONFIG_ENV_FAT_DEVICE_AND_PART;
+ if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc")
+ && part_str[0] == ':') {
+ part_str = "0" CONFIG_ENV_FAT_DEVICE_AND_PART;
+ part_str[0] += mmc_get_env_dev();
+ }
+ }
+
+ return part_str;
+#else
+ return CONFIG_ENV_FAT_DEVICE_AND_PART;
+#endif
+}
+#endif
+
#ifdef CMD_SAVEENV
static int env_fat_save(void)
{
@@ -46,7 +73,7 @@ static int env_fat_save(void)
return err;
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- CONFIG_ENV_FAT_DEVICE_AND_PART,
+ env_fat_device_and_part(),
&dev_desc, &info, 1);
if (part < 0)
return 1;
@@ -93,7 +120,7 @@ static int env_fat_load(void)
#endif
part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
- CONFIG_ENV_FAT_DEVICE_AND_PART,
+ env_fat_device_and_part(),
&dev_desc, &info, 1);
if (part < 0)
goto err_env_relocate;
--
2.26.2

View File

@ -28,12 +28,14 @@ ALLWIFIBOARDS:= \
8dev_habanero-dvk \
aruba_ap-303 \
avm_fritzrepeater-1200 \
buffalo_wtr-m2133hp \
cellc_rtl30vw \
dlink_dap2610 \
engenius_eap2200 \
engenius_emd1 \
engenius_emr3500 \
ezviz_cs-w3-wd1200g-eup \
glinet_gl-s1300 \
linksys_ea8300 \
mobipromo_cm520-79f \
p2w_r619ac \
@ -101,12 +103,14 @@ endef
$(eval $(call generate-ipq-wifi-package,8dev_habanero-dvk,8devices Habanero DVK))
$(eval $(call generate-ipq-wifi-package,aruba_ap-303,Aruba AP-303))
$(eval $(call generate-ipq-wifi-package,avm_fritzrepeater-1200,AVM FRITZRepeater 1200))
$(eval $(call generate-ipq-wifi-package,buffalo_wtr-m2133hp,Buffalo WTR-M2133HP))
$(eval $(call generate-ipq-wifi-package,cellc_rtl30vw, Cell C RTL30VW))
$(eval $(call generate-ipq-wifi-package,dlink_dap2610,D-Link DAP-2610))
$(eval $(call generate-ipq-wifi-package,engenius_eap2200,EnGenius EAP2200))
$(eval $(call generate-ipq-wifi-package,engenius_emd1,EnGenius EMD1))
$(eval $(call generate-ipq-wifi-package,engenius_emr3500,EnGenius EMR3500))
$(eval $(call generate-ipq-wifi-package,ezviz_cs-w3-wd1200g-eup,EZVIZ CS-W3-WD1200G EUP))
$(eval $(call generate-ipq-wifi-package,glinet_gl-s1300,GL.iNet GL-S1300))
$(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
$(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F))
$(eval $(call generate-ipq-wifi-package,p2w_r619ac,P&W R619AC))

View File

@ -270,6 +270,32 @@ endef
$(eval $(call KernelPackage,dm-raid))
define KernelPackage/iscsi-initiator
SUBMENU:=$(BLOCK_MENU)
TITLE:=iSCSI Initiator over TCP/IP
DEPENDS:=+kmod-scsi-core +kmod-crypto-hash
KCONFIG:= \
CONFIG_INET \
CONFIG_SCSI_LOWLEVEL \
CONFIG_ISCSI_TCP \
CONFIG_SCSI_ISCSI_ATTRS
FILES:= \
$(LINUX_DIR)/drivers/scsi/iscsi_tcp.ko \
$(LINUX_DIR)/drivers/scsi/libiscsi.ko \
$(LINUX_DIR)/drivers/scsi/libiscsi_tcp.ko \
$(LINUX_DIR)/drivers/scsi/scsi_transport_iscsi.ko
AUTOLOAD:=$(call AutoProbe,libiscsi libiscsi_tcp scsi_transport_iscsi iscsi_tcp)
endef
define KernelPackage/iscsi-initiator/description
The iSCSI Driver provides a host with the ability to access storage through an
IP network. The driver uses the iSCSI protocol to transport SCSI requests and
responses over a TCP/IP network between the host (the "initiator") and "targets".
endef
$(eval $(call KernelPackage,iscsi-initiator))
define KernelPackage/md-mod
SUBMENU:=$(BLOCK_MENU)
TITLE:=MD RAID

View File

@ -0,0 +1,45 @@
#
# Copyright (C) 2020 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mt7621-qtn-rgmii
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Bjørn Mork <bjorn@mork.no>
include $(INCLUDE_DIR)/package.mk
define KernelPackage/mt7621-qtn-rgmii
SECTION:=kernel
SUBMENU:=Other modules
TITLE:=Enable RGMII connected Quantenna module on MT7621
DEPENDS:=@TARGET_ramips_mt7621
HIDDEN:=1
FILES:=$(PKG_BUILD_DIR)/mt7621-qtn-rgmii.ko
AUTOLOAD:=$(call AutoLoad,30,mt7621-qtn-rgmii,1)
endef
define KernelPackage/mt7621-qtn-rgmii/description
Enable RGMII connected Quantenna module on MT7621.
The Mitrastar designed ZyXEL WAP6805 has a Quantenna QV840
module connected to the RGMII pins of the MT7621 SoC. For
unknown reasons, it is necessary to change the value of
the register at 0x1e110008 from default (usually 0xc000c)
to 0x9000c for this connection wo work.
This driver simply does that without much fuzz.
endef
define Build/Compile
$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
endef
$(eval $(call KernelPackage,mt7621-qtn-rgmii))

View File

@ -0,0 +1 @@
obj-m += mt7621-qtn-rgmii.o

View File

@ -0,0 +1,48 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020 Bjørn Mork <bjorn@mork.no>
*/
#include <linux/io.h>
#include <linux/module.h>
#define MODULE_NAME "mt7621-qtn-rgmii"
#define RGMII_REG_BASE 0x1e110008
#define RGMII_REG_SIZE 4
#define RGMII_REG_VALUE 0x9000c
static u32 oldval;
static int __init mt7621_qtn_rgmii_init(void)
{
void __iomem *base = ioremap(RGMII_REG_BASE, RGMII_REG_SIZE);
if (!base)
return -ENOMEM;
oldval = ioread32(base);
if (oldval != RGMII_REG_VALUE) {
iowrite32(RGMII_REG_VALUE, base);
pr_info(MODULE_NAME ": changed register 0x%08x value from 0x%08x to 0x%08x\n", RGMII_REG_BASE, oldval, RGMII_REG_VALUE);
}
iounmap(base);
return 0;
}
static void __exit mt7621_qtn_rgmii_exit(void)
{
void __iomem *base = ioremap(RGMII_REG_BASE, RGMII_REG_SIZE);
if (!base)
return;
if (oldval != RGMII_REG_VALUE) {
iowrite32(oldval, base);
pr_info(MODULE_NAME ": reset register 0x%08x back to 0x%08x\n", RGMII_REG_BASE, oldval);
}
iounmap(base);
}
module_init(mt7621_qtn_rgmii_init);
module_exit(mt7621_qtn_rgmii_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bjørn Mork <bjorn@mork.no>");
MODULE_DESCRIPTION("Enable RGMII connected Quantenna module on MT7621");

View File

@ -3,11 +3,11 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=nat46
PKG_MIRROR_HASH:=3f5ef0a56e9b02c3ec10ec95f3f81c0ed04b983b2d857c16304c379106d6beb6
PKG_MIRROR_HASH:=0627c7122ff7432aadb443e92e11a9ad7710add0ff512eebe17d7e3c041e0d2a
PKG_SOURCE_URL:=https://github.com/ayourtch/nat46.git
PKG_SOURCE_DATE:=2017-05-12
PKG_SOURCE_DATE:=2020-06-26
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=683fbd2b765506332a1af141545652bf58f03166
PKG_SOURCE_VERSION:=1182f30785e4274913f01a8c3d7e1b5437ae3819
PKG_MAINTAINER:=Hans Dedecker <dedeckeh@gmail.com>
PKG_LICENSE:=GPL-2.0

View File

@ -8,7 +8,7 @@
#include "nat46-glue.h"
#include "nat46-core.h"
@@ -1598,7 +1599,11 @@ void nat46_ipv6_input(struct sk_buff *ol
@@ -1601,7 +1602,11 @@ void nat46_ipv6_input(struct sk_buff *ol
/* Remove any debris in the socket control block */
memset(IPCB(new_skb), 0, sizeof(struct inet_skb_parm));
/* Remove netfilter references to IPv6 packet, new netfilter references will be created based on IPv4 packet */
@ -20,7 +20,7 @@
/* modify packet: actual IPv6->IPv4 transformation */
truncSize = v6packet_l3size - sizeof(struct iphdr); /* chop first 20 bytes */
@@ -1803,7 +1808,11 @@ void nat46_ipv4_input(struct sk_buff *ol
@@ -1806,7 +1811,11 @@ void nat46_ipv4_input(struct sk_buff *ol
/* Remove any debris in the socket control block */
memset(IPCB(new_skb), 0, sizeof(struct inet_skb_parm));
/* Remove netfilter references to IPv4 packet, new netfilter references will be created based on IPv6 packet */

View File

@ -36,6 +36,7 @@ TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
define KernelPackage/mt7603e
CATEGORY:=Kernel modules
TITLE:=MTK wifi AP driver
DEPENDS:=@TARGET_ramips
FILES:=$(PKG_BUILD_DIR)/mt7603_wifi_ap/mt7603e.ko
SUBMENU:=Wireless Drivers
MENU:=1

View File

@ -24,6 +24,7 @@ TAR_CMD=$(HOST_TAR) -C $(1)/ $(TAR_OPTIONS)
define KernelPackage/mt76x2e
CATEGORY:=Kernel modules
TITLE:=MTK MT76x2e wifi AP driver
DEPENDS:=@TARGET_ramips
FILES:=$(PKG_BUILD_DIR)/mt76x2_ap/mt76x2_ap.ko
SUBMENU:=Wireless Drivers
MENU:=1

View File

@ -55,6 +55,14 @@ ifeq ($(CONFIG_USE_MUSL),y)
SSP_LIB=-lssp_nonshared
endif
ifeq (${V}, s)
MAKE_VARS+= \
V=1
else ifeq (${V}, sc)
MAKE_VARS+= \
V=2
endif
MAKE_FLAGS:= \
$(TARGET_CONFIGURE_OPTS) \
CPU_CFLAGS="$(TARGET_CFLAGS)" \

View File

@ -0,0 +1,40 @@
From 667d9b75df86ec9ee1205f9101beb8dbbe4a00ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
Date: Wed, 1 Jul 2020 11:38:33 +0200
Subject: [PATCH] signkey: fix use of rsa-sha2-256 pubkeys
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 972d723484d8 ("split signkey_type and signature_type for RSA sha1
vs sha256") has added strict checking of pubkey algorithms which made
keys with SHA-256 hashing algorithm unusable as they still reuse the
`ssh-rsa` public key format. So fix this by disabling the check for
rsa-sha2-256 pubkeys.
Ref: https://tools.ietf.org/html/rfc8332#section-3
Fixes: 972d723484d8 ("split signkey_type and signature_type for RSA sha1 vs sha256")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
signkey.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/signkey.c b/signkey.c
index 92fe6a242cd0..d16ab174d83a 100644
--- a/signkey.c
+++ b/signkey.c
@@ -657,8 +657,12 @@ int buf_verify(buffer * buf, sign_key *key, enum signature_type expect_sigtype,
sigtype = signature_type_from_name(type_name, type_name_len);
m_free(type_name);
- if (expect_sigtype != sigtype) {
- dropbear_exit("Non-matching signing type");
+ if (sigtype == DROPBEAR_SIGNATURE_NONE) {
+ dropbear_exit("No signature type");
+ }
+
+ if ((expect_sigtype != DROPBEAR_SIGNATURE_RSA_SHA256) && (expect_sigtype != sigtype)) {
+ dropbear_exit("Non-matching signing type");
}
keytype = signkey_type_from_signature(sigtype);

View File

@ -0,0 +1,21 @@
opengt
set com 115200n81
set comecho off
set senddelay 0.02
waitquiet 0.2 0.2
flash 0.1
:start
send "AT+CUSD=1,"
send $env("ussd")
send ",15"
send "^m"
waitfor 120 "+CUSD:"
if % = -1 goto timeout
get 1 "^m" $s
print $s
exit 0
:timeout
print "ERROR: no USSD response, timeout.\n"
exit 1

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=curl
PKG_VERSION:=7.71.0
PKG_VERSION:=7.71.1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
@ -16,7 +16,7 @@ PKG_SOURCE_URL:=https://dl.uxnr.de/mirror/curl/ \
https://curl.mirror.anstey.ca/ \
https://curl.askapache.com/download/ \
https://curl.haxx.se/download/
PKG_HASH:=cdf18794393d8bead915312708a9e5d819c6e9919de14b20d5c8e7987abd9772
PKG_HASH:=40f83eda27cdbeb25cd4da48cefb639af1b9395d6026d2da1825bf059239658c
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=COPYING

View File

@ -12,9 +12,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git
PKG_MIRROR_HASH:=1b875efd7d675d74a56602f57dd27093e2feef8761ba28b567e2d2f43db14b48
PKG_SOURCE_DATE:=2020-05-12
PKG_SOURCE_VERSION:=84269037b75de93bdd4ea75b7f50ba77ba976377
PKG_MIRROR_HASH:=7ff4fae22bf518db200f0c4dd73bc32970678e39e3acc6e8dc98b65319c379cd
PKG_SOURCE_DATE:=2020-06-17
PKG_SOURCE_VERSION:=d34ea8eb1e12259a315cdef7aa0cd3ceaea68e00
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0

View File

@ -5,7 +5,7 @@
.PHONY: clean all
all: conf mconf
clean:
rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf
rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf nconf
# This clean-files definition is here to ensure that temporary files from the
# previous version are removed by make config-clean.
@ -52,6 +52,16 @@ HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src)
hostprogs-y += conf
conf-objs := conf.o $(common-objs)
# nconf: Used for the nconfig target based on ncurses
hostprogs-y += nconf
nconf-objs := nconf.o nconf.gui.o $(common-objs)
HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs)
HOSTCFLAGS_nconf.o = $(shell . $(obj)/nconf-cfg && echo $$cflags)
HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags)
$(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg
# mconf: Used for the menuconfig target based on lxdialog
hostprogs-y += mconf
lxdialog := $(addprefix lxdialog/, \
@ -123,5 +133,8 @@ conf: $(conf-objs)
mconf: mconf-cfg $(mconf-objs)
$(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf)
nconf: nconf-cfg $(nconf-objs)
$(CC) -o $@ $(filter-out nconf-cfg,$^) $(HOSTLDLIBS_nconf)
qconf: qconf-cfg $(qconf-cxxobjs) $(qconf-objs)
$(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf)

View File

@ -1,7 +1,7 @@
These files were taken from the Linux Kernel Configuration System at commit
089b7d890f972f6b649fedc9259f6b93a18fb970 (Feb 4, 2020) and modified for the
OpenWrt Buildroot:
- Removed nconf, gconf, tests and kernel configuration targets.
- Removed gconf, tests and kernel configuration targets.
- Adjusted the Makefile to compile outside the kernel.
- Always use default file when running make all{no,mod,yes}config.
- Added a 'reset' command to reset config when the target changes.

View File

@ -23,11 +23,14 @@
#include "lxdialog/dialog.h"
static const char mconf_readme[] =
"OpenWrt config is based on Kernel kconfig\n"
"so ipkg packages are referred here as modules.\n"
"\n"
"Overview\n"
"--------\n"
"Some OpenWrt features may be built directly into the image.\n"
"Some may be made into installable ipkg packages (referred here as\n"
"modules). Some features may be completely removed altogether.\n"
"This interface lets you select features and parameters for the build.\n"
"Features can either be built-in, modularized, or ignored. Parameters\n"
"must be entered in as decimal or hexadecimal numbers or text.\n"
"\n"
"Menu items beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"

50
scripts/config/nconf-cfg.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
PKG="ncursesw menuw panelw"
PKG2="ncurses menu panel"
if [ -n "$(command -v pkg-config)" ]; then
if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
fi
fi
# Check the default paths in case pkg-config is not installed.
# (Even if it is installed, some distributions such as openSUSE cannot
# find ncurses by pkg-config.)
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw -lmenuw -lpanelw\"
exit 0
fi
if [ -f /usr/include/ncurses/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
if [ -f /usr/include/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
echo >&2 "*"
echo >&2 "* Unable to find the ncurses package."
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
echo >&2 "* depending on your distribution)."
echo >&2 "*"
echo >&2 "* You may also need to install pkg-config to find the"
echo >&2 "* ncurses installed in a non-default location."
echo >&2 "*"
exit 1

1569
scripts/config/nconf.c Normal file

File diff suppressed because it is too large Load Diff

664
scripts/config/nconf.gui.c Normal file
View File

@ -0,0 +1,664 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
*
* Derived from menuconfig.
*/
#include "nconf.h"
#include "lkc.h"
/* a list of all the different widgets we use */
attributes_t attributes[ATTR_MAX+1] = {0};
/* available colors:
COLOR_BLACK 0
COLOR_RED 1
COLOR_GREEN 2
COLOR_YELLOW 3
COLOR_BLUE 4
COLOR_MAGENTA 5
COLOR_CYAN 6
COLOR_WHITE 7
*/
static void set_normal_colors(void)
{
init_pair(NORMAL, -1, -1);
init_pair(MAIN_HEADING, COLOR_MAGENTA, -1);
/* FORE is for the selected item */
init_pair(MAIN_MENU_FORE, -1, -1);
/* BACK for all the rest */
init_pair(MAIN_MENU_BACK, -1, -1);
init_pair(MAIN_MENU_GREY, -1, -1);
init_pair(MAIN_MENU_HEADING, COLOR_GREEN, -1);
init_pair(MAIN_MENU_BOX, COLOR_YELLOW, -1);
init_pair(SCROLLWIN_TEXT, -1, -1);
init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1);
init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_TEXT, -1, -1);
init_pair(DIALOG_BOX, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_BACK, COLOR_YELLOW, -1);
init_pair(DIALOG_MENU_FORE, COLOR_RED, -1);
init_pair(INPUT_BOX, COLOR_YELLOW, -1);
init_pair(INPUT_HEADING, COLOR_GREEN, -1);
init_pair(INPUT_TEXT, -1, -1);
init_pair(INPUT_FIELD, -1, -1);
init_pair(FUNCTION_HIGHLIGHT, -1, -1);
init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
}
/* available attributes:
A_NORMAL Normal display (no highlight)
A_STANDOUT Best highlighting mode of the terminal.
A_UNDERLINE Underlining
A_REVERSE Reverse video
A_BLINK Blinking
A_DIM Half bright
A_BOLD Extra bright or bold
A_PROTECT Protected mode
A_INVIS Invisible or blank mode
A_ALTCHARSET Alternate character set
A_CHARTEXT Bit-mask to extract a character
COLOR_PAIR(n) Color-pair number n
*/
static void normal_color_theme(void)
{
/* automatically add color... */
#define mkattr(name, attr) do { \
attributes[name] = attr | COLOR_PAIR(name); } while (0)
mkattr(NORMAL, NORMAL);
mkattr(MAIN_HEADING, A_BOLD | A_UNDERLINE);
mkattr(MAIN_MENU_FORE, A_REVERSE);
mkattr(MAIN_MENU_BACK, A_NORMAL);
mkattr(MAIN_MENU_GREY, A_NORMAL);
mkattr(MAIN_MENU_HEADING, A_BOLD);
mkattr(MAIN_MENU_BOX, A_NORMAL);
mkattr(SCROLLWIN_TEXT, A_NORMAL);
mkattr(SCROLLWIN_HEADING, A_BOLD);
mkattr(SCROLLWIN_BOX, A_BOLD);
mkattr(DIALOG_TEXT, A_BOLD);
mkattr(DIALOG_BOX, A_BOLD);
mkattr(DIALOG_MENU_FORE, A_STANDOUT);
mkattr(DIALOG_MENU_BACK, A_NORMAL);
mkattr(INPUT_BOX, A_NORMAL);
mkattr(INPUT_HEADING, A_BOLD);
mkattr(INPUT_TEXT, A_NORMAL);
mkattr(INPUT_FIELD, A_UNDERLINE);
mkattr(FUNCTION_HIGHLIGHT, A_BOLD);
mkattr(FUNCTION_TEXT, A_REVERSE);
}
static void no_colors_theme(void)
{
/* automatically add highlight, no color */
#define mkattrn(name, attr) { attributes[name] = attr; }
mkattrn(NORMAL, NORMAL);
mkattrn(MAIN_HEADING, A_BOLD | A_UNDERLINE);
mkattrn(MAIN_MENU_FORE, A_STANDOUT);
mkattrn(MAIN_MENU_BACK, A_NORMAL);
mkattrn(MAIN_MENU_GREY, A_NORMAL);
mkattrn(MAIN_MENU_HEADING, A_BOLD);
mkattrn(MAIN_MENU_BOX, A_NORMAL);
mkattrn(SCROLLWIN_TEXT, A_NORMAL);
mkattrn(SCROLLWIN_HEADING, A_BOLD);
mkattrn(SCROLLWIN_BOX, A_BOLD);
mkattrn(DIALOG_TEXT, A_NORMAL);
mkattrn(DIALOG_BOX, A_BOLD);
mkattrn(DIALOG_MENU_FORE, A_STANDOUT);
mkattrn(DIALOG_MENU_BACK, A_NORMAL);
mkattrn(INPUT_BOX, A_BOLD);
mkattrn(INPUT_HEADING, A_BOLD);
mkattrn(INPUT_TEXT, A_NORMAL);
mkattrn(INPUT_FIELD, A_UNDERLINE);
mkattrn(FUNCTION_HIGHLIGHT, A_BOLD);
mkattrn(FUNCTION_TEXT, A_REVERSE);
}
void set_colors(void)
{
start_color();
use_default_colors();
set_normal_colors();
if (has_colors()) {
normal_color_theme();
} else {
/* give defaults */
no_colors_theme();
}
}
/* this changes the windows attributes !!! */
void print_in_middle(WINDOW *win,
int starty,
int startx,
int width,
const char *string,
chtype color)
{ int length, x, y;
float temp;
if (win == NULL)
win = stdscr;
getyx(win, y, x);
if (startx != 0)
x = startx;
if (starty != 0)
y = starty;
if (width == 0)
width = 80;
length = strlen(string);
temp = (width - length) / 2;
x = startx + (int)temp;
(void) wattrset(win, color);
mvwprintw(win, y, x, "%s", string);
refresh();
}
int get_line_no(const char *text)
{
int i;
int total = 1;
if (!text)
return 0;
for (i = 0; text[i] != '\0'; i++)
if (text[i] == '\n')
total++;
return total;
}
const char *get_line(const char *text, int line_no)
{
int i;
int lines = 0;
if (!text)
return NULL;
for (i = 0; text[i] != '\0' && lines < line_no; i++)
if (text[i] == '\n')
lines++;
return text+i;
}
int get_line_length(const char *line)
{
int res = 0;
while (*line != '\0' && *line != '\n') {
line++;
res++;
}
return res;
}
/* print all lines to the window. */
void fill_window(WINDOW *win, const char *text)
{
int x, y;
int total_lines = get_line_no(text);
int i;
getmaxyx(win, y, x);
/* do not go over end of line */
total_lines = min(total_lines, y);
for (i = 0; i < total_lines; i++) {
char tmp[x+10];
const char *line = get_line(text, i);
int len = get_line_length(line);
strncpy(tmp, line, min(len, x));
tmp[len] = '\0';
mvwprintw(win, i, 0, "%s", tmp);
}
}
/* get the message, and buttons.
* each button must be a char*
* return the selected button
*
* this dialog is used for 2 different things:
* 1) show a text box, no buttons.
* 2) show a dialog, with horizontal buttons
*/
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
{
va_list ap;
char *btn;
int btns_width = 0;
int msg_lines = 0;
int msg_width = 0;
int total_width;
int win_rows = 0;
WINDOW *win;
WINDOW *msg_win;
WINDOW *menu_win;
MENU *menu;
ITEM *btns[btn_num+1];
int i, x, y;
int res = -1;
va_start(ap, btn_num);
for (i = 0; i < btn_num; i++) {
btn = va_arg(ap, char *);
btns[i] = new_item(btn, "");
btns_width += strlen(btn)+1;
}
va_end(ap);
btns[btn_num] = NULL;
/* find the widest line of msg: */
msg_lines = get_line_no(msg);
for (i = 0; i < msg_lines; i++) {
const char *line = get_line(msg, i);
int len = get_line_length(line);
if (msg_width < len)
msg_width = len;
}
total_width = max(msg_width, btns_width);
/* place dialog in middle of screen */
y = (getmaxy(stdscr)-(msg_lines+4))/2;
x = (getmaxx(stdscr)-(total_width+4))/2;
/* create the windows */
if (btn_num > 0)
win_rows = msg_lines+4;
else
win_rows = msg_lines+2;
win = newwin(win_rows, total_width+4, y, x);
keypad(win, TRUE);
menu_win = derwin(win, 1, btns_width, win_rows-2,
1+(total_width+2-btns_width)/2);
menu = new_menu(btns);
msg_win = derwin(win, win_rows-2, msg_width, 1,
1+(total_width+2-msg_width)/2);
set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
(void) wattrset(win, attributes[DIALOG_BOX]);
box(win, 0, 0);
/* print message */
(void) wattrset(msg_win, attributes[DIALOG_TEXT]);
fill_window(msg_win, msg);
set_menu_win(menu, win);
set_menu_sub(menu, menu_win);
set_menu_format(menu, 1, btn_num);
menu_opts_off(menu, O_SHOWDESC);
menu_opts_off(menu, O_SHOWMATCH);
menu_opts_on(menu, O_ONEVALUE);
menu_opts_on(menu, O_NONCYCLIC);
set_menu_mark(menu, "");
post_menu(menu);
touchwin(win);
refresh_all_windows(main_window);
while ((res = wgetch(win))) {
switch (res) {
case KEY_LEFT:
menu_driver(menu, REQ_LEFT_ITEM);
break;
case KEY_RIGHT:
menu_driver(menu, REQ_RIGHT_ITEM);
break;
case 10: /* ENTER */
case 27: /* ESCAPE */
case ' ':
case KEY_F(F_BACK):
case KEY_F(F_EXIT):
break;
}
touchwin(win);
refresh_all_windows(main_window);
if (res == 10 || res == ' ') {
res = item_index(current_item(menu));
break;
} else if (res == 27 || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT)) {
res = KEY_EXIT;
break;
}
}
unpost_menu(menu);
free_menu(menu);
for (i = 0; i < btn_num; i++)
free_item(btns[i]);
delwin(win);
return res;
}
int dialog_inputbox(WINDOW *main_window,
const char *title, const char *prompt,
const char *init, char **resultp, int *result_len)
{
int prompt_lines = 0;
int prompt_width = 0;
WINDOW *win;
WINDOW *prompt_win;
WINDOW *form_win;
PANEL *panel;
int i, x, y, lines, columns, win_lines, win_cols;
int res = -1;
int cursor_position = strlen(init);
int cursor_form_win;
char *result = *resultp;
getmaxyx(stdscr, lines, columns);
if (strlen(init)+1 > *result_len) {
*result_len = strlen(init)+1;
*resultp = result = xrealloc(result, *result_len);
}
/* find the widest line of msg: */
prompt_lines = get_line_no(prompt);
for (i = 0; i < prompt_lines; i++) {
const char *line = get_line(prompt, i);
int len = get_line_length(line);
prompt_width = max(prompt_width, len);
}
if (title)
prompt_width = max(prompt_width, strlen(title));
win_lines = min(prompt_lines+6, lines-2);
win_cols = min(prompt_width+7, columns-2);
prompt_lines = max(win_lines-6, 0);
prompt_width = max(win_cols-7, 0);
/* place dialog in middle of screen */
y = (lines-win_lines)/2;
x = (columns-win_cols)/2;
strncpy(result, init, *result_len);
/* create the windows */
win = newwin(win_lines, win_cols, y, x);
prompt_win = derwin(win, prompt_lines+1, prompt_width, 2, 2);
form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
keypad(form_win, TRUE);
(void) wattrset(form_win, attributes[INPUT_FIELD]);
(void) wattrset(win, attributes[INPUT_BOX]);
box(win, 0, 0);
(void) wattrset(win, attributes[INPUT_HEADING]);
if (title)
mvwprintw(win, 0, 3, "%s", title);
/* print message */
(void) wattrset(prompt_win, attributes[INPUT_TEXT]);
fill_window(prompt_win, prompt);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
cursor_form_win = min(cursor_position, prompt_width-1);
mvwprintw(form_win, 0, 0, "%s",
result + cursor_position-cursor_form_win);
/* create panels */
panel = new_panel(win);
/* show the cursor */
curs_set(1);
touchwin(win);
refresh_all_windows(main_window);
while ((res = wgetch(form_win))) {
int len = strlen(result);
switch (res) {
case 10: /* ENTER */
case 27: /* ESCAPE */
case KEY_F(F_HELP):
case KEY_F(F_EXIT):
case KEY_F(F_BACK):
break;
case 8: /* ^H */
case 127: /* ^? */
case KEY_BACKSPACE:
if (cursor_position > 0) {
memmove(&result[cursor_position-1],
&result[cursor_position],
len-cursor_position+1);
cursor_position--;
cursor_form_win--;
len--;
}
break;
case KEY_DC:
if (cursor_position >= 0 && cursor_position < len) {
memmove(&result[cursor_position],
&result[cursor_position+1],
len-cursor_position+1);
len--;
}
break;
case KEY_UP:
case KEY_RIGHT:
if (cursor_position < len) {
cursor_position++;
cursor_form_win++;
}
break;
case KEY_DOWN:
case KEY_LEFT:
if (cursor_position > 0) {
cursor_position--;
cursor_form_win--;
}
break;
case KEY_HOME:
cursor_position = 0;
cursor_form_win = 0;
break;
case KEY_END:
cursor_position = len;
cursor_form_win = min(cursor_position, prompt_width-1);
break;
default:
if ((isgraph(res) || isspace(res))) {
/* one for new char, one for '\0' */
if (len+2 > *result_len) {
*result_len = len+2;
*resultp = result = realloc(result,
*result_len);
}
/* insert the char at the proper position */
memmove(&result[cursor_position+1],
&result[cursor_position],
len-cursor_position+1);
result[cursor_position] = res;
cursor_position++;
cursor_form_win++;
len++;
} else {
mvprintw(0, 0, "unknown key: %d\n", res);
}
break;
}
if (cursor_form_win < 0)
cursor_form_win = 0;
else if (cursor_form_win > prompt_width-1)
cursor_form_win = prompt_width-1;
wmove(form_win, 0, 0);
wclrtoeol(form_win);
mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
mvwprintw(form_win, 0, 0, "%s",
result + cursor_position-cursor_form_win);
wmove(form_win, 0, cursor_form_win);
touchwin(win);
refresh_all_windows(main_window);
if (res == 10) {
res = 0;
break;
} else if (res == 27 || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT)) {
res = KEY_EXIT;
break;
} else if (res == KEY_F(F_HELP)) {
res = 1;
break;
}
}
/* hide the cursor */
curs_set(0);
del_panel(panel);
delwin(prompt_win);
delwin(form_win);
delwin(win);
return res;
}
/* refresh all windows in the correct order */
void refresh_all_windows(WINDOW *main_window)
{
update_panels();
touchwin(main_window);
refresh();
}
/* layman's scrollable window... */
void show_scroll_win(WINDOW *main_window,
const char *title,
const char *text)
{
int res;
int total_lines = get_line_no(text);
int x, y, lines, columns;
int start_x = 0, start_y = 0;
int text_lines = 0, text_cols = 0;
int total_cols = 0;
int win_cols = 0;
int win_lines = 0;
int i = 0;
WINDOW *win;
WINDOW *pad;
PANEL *panel;
getmaxyx(stdscr, lines, columns);
/* find the widest line of msg: */
total_lines = get_line_no(text);
for (i = 0; i < total_lines; i++) {
const char *line = get_line(text, i);
int len = get_line_length(line);
total_cols = max(total_cols, len+2);
}
/* create the pad */
pad = newpad(total_lines+10, total_cols+10);
(void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
fill_window(pad, text);
win_lines = min(total_lines+4, lines-2);
win_cols = min(total_cols+2, columns-2);
text_lines = max(win_lines-4, 0);
text_cols = max(win_cols-2, 0);
/* place window in middle of screen */
y = (lines-win_lines)/2;
x = (columns-win_cols)/2;
win = newwin(win_lines, win_cols, y, x);
keypad(win, TRUE);
/* show the help in the help window, and show the help panel */
(void) wattrset(win, attributes[SCROLLWIN_BOX]);
box(win, 0, 0);
(void) wattrset(win, attributes[SCROLLWIN_HEADING]);
mvwprintw(win, 0, 3, " %s ", title);
panel = new_panel(win);
/* handle scrolling */
do {
copywin(pad, win, start_y, start_x, 2, 2, text_lines,
text_cols, 0);
print_in_middle(win,
text_lines+2,
0,
text_cols,
"<OK>",
attributes[DIALOG_MENU_FORE]);
wrefresh(win);
res = wgetch(win);
switch (res) {
case KEY_NPAGE:
case ' ':
case 'd':
start_y += text_lines-2;
break;
case KEY_PPAGE:
case 'u':
start_y -= text_lines+2;
break;
case KEY_HOME:
start_y = 0;
break;
case KEY_END:
start_y = total_lines-text_lines;
break;
case KEY_DOWN:
case 'j':
start_y++;
break;
case KEY_UP:
case 'k':
start_y--;
break;
case KEY_LEFT:
case 'h':
start_x--;
break;
case KEY_RIGHT:
case 'l':
start_x++;
break;
}
if (res == 10 || res == 27 || res == 'q' ||
res == KEY_F(F_HELP) || res == KEY_F(F_BACK) ||
res == KEY_F(F_EXIT))
break;
if (start_y < 0)
start_y = 0;
if (start_y >= total_lines-text_lines)
start_y = total_lines-text_lines;
if (start_x < 0)
start_x = 0;
if (start_x >= total_cols-text_cols)
start_x = total_cols-text_cols;
} while (res);
del_panel(panel);
delwin(win);
refresh_all_windows(main_window);
}

92
scripts/config/nconf.h Normal file
View File

@ -0,0 +1,92 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
*
* Derived from menuconfig.
*/
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ncurses.h>
#include <menu.h>
#include <panel.h>
#include <form.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#define max(a, b) ({\
typeof(a) _a = a;\
typeof(b) _b = b;\
_a > _b ? _a : _b; })
#define min(a, b) ({\
typeof(a) _a = a;\
typeof(b) _b = b;\
_a < _b ? _a : _b; })
typedef enum {
NORMAL = 1,
MAIN_HEADING,
MAIN_MENU_BOX,
MAIN_MENU_FORE,
MAIN_MENU_BACK,
MAIN_MENU_GREY,
MAIN_MENU_HEADING,
SCROLLWIN_TEXT,
SCROLLWIN_HEADING,
SCROLLWIN_BOX,
DIALOG_TEXT,
DIALOG_MENU_FORE,
DIALOG_MENU_BACK,
DIALOG_BOX,
INPUT_BOX,
INPUT_HEADING,
INPUT_TEXT,
INPUT_FIELD,
FUNCTION_TEXT,
FUNCTION_HIGHLIGHT,
ATTR_MAX
} attributes_t;
extern attributes_t attributes[];
typedef enum {
F_HELP = 1,
F_SYMBOL = 2,
F_INSTS = 3,
F_CONF = 4,
F_BACK = 5,
F_SAVE = 6,
F_LOAD = 7,
F_SEARCH = 8,
F_EXIT = 9,
} function_key;
void set_colors(void);
/* this changes the windows attributes !!! */
void print_in_middle(WINDOW *win,
int starty,
int startx,
int width,
const char *string,
chtype color);
int get_line_length(const char *line);
int get_line_no(const char *text);
const char *get_line(const char *text, int line_no);
void fill_window(WINDOW *win, const char *text);
int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
int dialog_inputbox(WINDOW *main_window,
const char *title, const char *prompt,
const char *init, char **resultp, int *result_len);
void refresh_all_windows(WINDOW *main_window);
void show_scroll_win(WINDOW *main_window,
const char *title,
const char *text);

View File

@ -2,7 +2,7 @@
from os import getenv, environ
from pathlib import Path
from subprocess import run
from subprocess import run, PIPE
from sys import argv
import json
@ -42,10 +42,11 @@ if output:
"val.DEFAULT_PACKAGES",
"val.ARCH_PACKAGES",
],
capture_output=True,
stdout=PIPE,
stderr=PIPE,
check=True,
env=environ.copy().update({"TOPDIR": Path().cwd()}),
text=True,
universal_newlines=True,
).stdout.splitlines()
output["default_packages"] = default_packages.split()

View File

@ -9,5 +9,5 @@ include $(INCLUDE_DIR)/target.mk
export TARGET_BUILD=1
prereq clean download prepare compile install menuconfig nconfig oldconfig update refresh: FORCE
prereq clean download prepare compile install oldconfig menuconfig nconfig xconfig update refresh: FORCE
@+$(NO_TRACE_MAKE) -C $(BOARD) $@

View File

@ -442,7 +442,7 @@ static int rb91x_nand_remove(struct platform_device *pdev)
{
struct rb91x_nand_info *info = platform_get_drvdata(pdev);
nand_release(&rbni->chip);
nand_release(&info->chip);
return 0;
}

View File

@ -8,7 +8,7 @@ SUBTARGETS:=generic mikrotik nand tiny
FEATURES:=ramdisk
KERNEL_PATCHVER:=4.19
KERNEL_PATCHVER:=5.4
KERNEL_TESTING_PATCHVER:=5.4
include $(INCLUDE_DIR)/target.mk

View File

@ -18,6 +18,7 @@ CONFIG_ARCH_USE_BUILTIN_BSWAP=y
CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_AT803X_PHY=y
CONFIG_ATH79=y
CONFIG_ATH79_WDT=y
CONFIG_BLK_MQ_PCI=y

View File

@ -23,6 +23,7 @@ CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT=y
CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
CONFIG_AT803X_PHY=y
CONFIG_ATH79=y
CONFIG_ATH79_WDT=y
CONFIG_BLK_MQ_PCI=y

View File

@ -0,0 +1,223 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "ar9331.dtsi"
/ {
model = "Arduino Yun";
compatible = "arduino,yun", "qca,ar9331";
aliases {
serial0 = &uart;
};
chosen {
bootargs = "console=ttyATH0,250000";
};
ahb {
apb {
pinmux_extended: pinmux@18040030 {
compatible = "pinctrl-single";
reg = <0x18040030 0x4>;
pinctrl-single,bit-per-mux;
pinctrl-single,register-width = <32>;
pinctrl-single,function-mask = <0x1>;
#pinctrl-cells = <2>;
enable_gpio11: pinmux_enable_gpio11 {
pinctrl-single,bits = <0x0 0x200 0x200>;
};
};
pinmux_bootstrap: pinmux@180600ac {
compatible = "pinctrl-single";
reg = <0x180600ac 0x4>;
pinctrl-single,bit-per-mux;
pinctrl-single,register-width = <32>;
pinctrl-single,function-mask = <0x1>;
#pinctrl-cells = <2>;
enable_gpio26_gpio27: pinmux_enable_gpio26_gpio27 {
pinctrl-single,bits = <0x0 0x40000 0x40000>;
};
};
};
};
leds {
compatible = "gpio-leds";
wlan {
label = "yun:blue:wlan";
gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "phy0tpt";
};
usb {
label = "yun:white:usb";
gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
trigger-sources = <&hub_port1>;
linux,default-trigger = "usbport";
};
};
keys {
compatible = "gpio-keys";
config {
label = "config";
linux,code = <BTN_0>;
gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
};
};
gpio-export {
compatible = "gpio-export";
gpio_spi_enable {
gpio-export,name = "yun:oe:spi";
gpio-export,output = <0>;
gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
};
gpio_handshake_enable {
gpio-export,name = "yun:oe:hs";
gpio-export,output = <0>;
gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;
};
gpio_uart_enable {
gpio-export,name = "yun:oe:uart";
gpio-export,output = <0>;
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
};
};
reg_usb_vbus: reg_usb_vbus {
compatible = "regulator-fixed";
regulator-name = "usb_vbus";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
enable-active-high;
};
};
&uart {
status = "okay";
};
&gpio {
status = "okay";
};
&pinmux {
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins &switch_led_disable_pins>;
};
&switch_led_disable_pins {
pinctrl-single,bits = <0x0 0x80 0xf8>;
};
&pinmux_extended {
pinctrl-names = "default";
pinctrl-0 = <&enable_gpio11>;
};
&pinmux_bootstrap {
pinctrl-names = "default";
pinctrl-0 = <&enable_gpio26_gpio27>;
};
&usb {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
dr_mode = "host";
vbus-supply = <&reg_usb_vbus>;
port@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;
#trigger-source-cells = <0>;
hub_port1: port@1 {
reg = <1>;
#trigger-source-cells = <0>;
};
};
};
&usb_phy {
status = "okay";
};
&spi {
status = "okay";
num-cs = <1>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x40000>;
read-only;
};
partition@40000 {
label = "u-boot-env";
reg = <0x40000 0x10000>;
};
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x50000 0xf90000>;
};
partition@fe0000 {
label = "nvram";
reg = <0xfe0000 0x10000>;
};
art: partition@ff0000 {
label = "art";
reg = <0xff0000 0x10000>;
read-only;
};
};
};
};
&eth0 {
status = "okay";
};
&eth1 {
status = "okay";
compatible = "syscon", "simple-mfd";
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};

View File

@ -0,0 +1,116 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "qca953x.dtsi"
/ {
compatible = "8dev,lima", "qca,qca9531";
model = "8devices Lima";
keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux-code = "KEY_RESTART";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
};
};
&pcie0 {
status = "okay";
};
&uart {
status = "okay";
};
&usb0 {
status = "okay";
dr_mode = "host";
};
&usb_phy {
status = "okay";
};
&wdt {
status = "okay";
};
&spi {
status = "okay";
num-cs = <1>;
/* Winbond W25Q256 SPI flash */
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <45000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x040000>;
read-only;
};
partition@40000 {
label = "u-boot-env";
reg = <0x040000 0x040000>;
};
art: partition@80000 {
label = "art";
reg = <0x080000 0x040000>;
read-only;
};
partition@c0000 {
compatible = "denx,uimage";
label = "firmware";
reg = <0x0c0000 0xf40000>;
};
};
};
};
&mdio0 {
status = "okay";
};
&eth0 {
status = "okay";
phy-handle = <&swphy0>;
mtd-mac-address = <&art 0x6>;
gmac-config {
device = <&gmac>;
switch-phy-addr-swap = <1>;
switch-phy-swap = <1>;
};
};
&eth1 {
status = "okay";
mtd-mac-address = <&art 0x0>;
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};

View File

@ -0,0 +1,171 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "qca953x.dtsi"
/ {
compatible = "dlink,dch-g020-a1", "qca,qca9531";
model = "D-Link DCH-G020 A1";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
i2c {
compatible = "i2c-gpio";
#address-cells = <1>;
#size-cells = <1>;
sda-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
scl-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
gpio_ext: gpio_ext@38 {
compatible = "nxp,pca9554";
reg = <0x38 0x1>;
gpio-controller;
#gpio-cells = <2>;
};
rtc@30 {
compatible = "pericom,pt7c43390";
reg = <0x30 0x8>;
};
};
gpio-export {
compatible = "gpio-export";
usb_power {
label = "d-link:power:usb";
gpio-export,name = "d-link:power:usb";
gpio-export,output = <0>;
gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>;
};
zwave_power {
label = "d-link:power:zwave";
gpio-export,name = "d-link:power:zwave";
gpio-export,output = <0>;
gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
wps {
label = "wps";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "d-link:green:power";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
};
status {
label = "d-link:red:status";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
};
};
&spi {
status = "okay";
num-cs = <1>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x10000>;
read-only;
};
art: partition@10000 {
label = "art";
reg = <0x10000 0x10000>;
read-only;
};
partition@20000 {
label = "mp";
reg = <0x20000 0x10000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
read-only;
};
partition@40000 {
label = "bootarg";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "firmware";
reg = <0x50000 0xe70000>;
compatible = "denx,uimage";
};
partition@ec0000 {
label = "dlink";
reg = <0xec0000 0x140000>;
read-only;
};
};
};
};
&uart {
status = "okay";
};
&usb0 {
status = "okay";
};
&usb_phy {
status = "okay";
};
&eth0 {
status = "okay";
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};

View File

@ -0,0 +1,131 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "qca955x.dtsi"
/ {
compatible = "8dev,rambutan", "qca,qca9557";
model = "8devices Rambutan";
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
debounce-interval = <60>;
};
};
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x300000>;
read-only;
};
partition@300000 {
label = "u-boot-env";
reg = <0x300000 0x200000>;
};
art: partition@500000 {
label = "art";
reg = <0x500000 0x100000>;
read-only;
};
partition@600000 {
label = "ubi";
reg = <0x600000 0x7a00000>;
};
};
};
&mdio0 {
status = "okay";
phy0: ethernet-phy@0 {
reg = <0>;
reset-gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
};
&mdio1 {
status = "okay";
phy1: ethernet-phy@0 {
reg = <0>;
reset-gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
phy-mode = "sgmii";
at803x-override-sgmii-link-check;
};
};
&eth0 {
status = "okay";
mtd-mac-address = <&art 0x0>;
phy-mode = "mii";
phy-handle = <&phy0>;
};
&eth1 {
status = "okay";
pll-data = <0x17000000 0x101 0x1313>;
phy-handle = <&phy1>;
phy-mode = "sgmii";
qca955x-sgmii-fixup;
mtd-mac-address = <&art 0x6>;
};
&wmac {
status = "okay";
gpio-controller;
mtd-cal-data = <&art 0x1000>;
};
&pcie0 {
status = "okay";
};
&usb_phy0 {
status = "okay";
};
&usb0 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};
&usb_phy1 {
status = "okay";
};
&usb1 {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};
&uart {
status = "okay";
};

View File

@ -12,6 +12,7 @@ ath79_setup_interfaces()
adtran,bsap1800-v2|\
adtran,bsap1840|\
alfa-network,ap121f|\
arduino,yun|\
aruba,ap-105|\
avm,fritz1750e|\
avm,fritz300e|\
@ -147,6 +148,10 @@ ath79_setup_interfaces()
dlink,dap-2695-a1)
ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1"
;;
dlink,dch-g020-a1)
ucidef_add_switch "switch0" \
"0@eth0" "1:lan:2" "2:lan:1"
;;
dlink,dir-825-b1)
ucidef_set_interface_wan "eth1"
ucidef_add_switch "switch0" \
@ -357,6 +362,11 @@ ath79_setup_macs()
alfa-network,ap121f)
label_mac=$(mtd_get_mac_binary art 0x1002)
;;
arduino,yun)
base_mac=$(mtd_get_mac_binary art 0x1002)
lan_mac=$(macaddr_setbit $base_mac 29)
[ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
;;
avm,fritz1750e|\
avm,fritz450e|\
avm,fritzdvbc)
@ -379,6 +389,10 @@ ath79_setup_macs()
dlink,dap-2695-a1)
label_mac=$(mtd_get_mac_ascii bdcfg "wlanmac")
;;
dlink,dch-g020-a1)
lan_mac=$(mtd_get_mac_text "mp" 0x1)
label_mac=$lan_mac
;;
dlink,dir-825-b1)
lan_mac=$(mtd_get_mac_text "caldata" 0xffa0)
wan_mac=$(mtd_get_mac_text "caldata" 0xffb4)

View File

@ -9,6 +9,10 @@ board=$(board_name)
case "$FIRMWARE" in
"ath9k-eeprom-ahb-18100000.wmac.bin")
case $board in
8dev,lima|\
ubnt,unifi)
caldata_extract "art" 0x1000 0x800
;;
avm,fritz1750e|\
avm,fritz4020|\
avm,fritz450e|\
@ -110,9 +114,6 @@ case "$FIRMWARE" in
ubnt,rocket-m)
caldata_extract "art" 0x1000 0x1000
;;
ubnt,unifi)
caldata_extract "art" 0x1000 0x800
;;
wd,mynet-n750)
caldata_extract "art" 0x5000 0x440
ath9k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac")

View File

@ -17,6 +17,9 @@ case "$board" in
adtran,bsap1840)
macaddr_add "$(mtd_get_mac_binary 'Board data' 2)" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress
;;
dlink,dch-g020-a1)
mtd_get_mac_text "mp" 0x13 > /sys${DEVPATH}/macaddress
;;
iodata,wn-ac1600dgr)
# There is no eeprom data for 5 GHz wlan in "art" partition
# which would allow to patch the macaddress

View File

@ -5,6 +5,9 @@ board=$(board_name)
boardonly="${board##*,}"
case "$board" in
arduino,yun)
migrate_leds "arduino:=yun:"
;;
engenius,epg5000)
migrate_leds ":wlan-2g=:wlan2g" ":wlan-5g=:wlan5g"
;;

View File

@ -50,6 +50,17 @@ define Build/cybertan-trx
-rm $@-empty.bin
endef
define Build/mkdapimg2
$(STAGING_DIR_HOST)/bin/mkdapimg2 \
-i $@ -o $@.new \
-s $(DAP_SIGNATURE) \
-v $(VERSION_DIST)-$(firstword $(subst +, , \
$(firstword $(subst -, ,$(REVISION))))) \
-r Default \
$(if $(1),-k $(1))
mv $@.new $@
endef
define Build/mkmylofw_16m
$(eval device_id=$(word 1,$(1)))
$(eval revision=$(word 2,$(1)))
@ -152,6 +163,16 @@ define Device/8dev_carambola2
endef
TARGET_DEVICES += 8dev_carambola2
define Device/8dev_lima
SOC := qca9531
DEVICE_VENDOR := 8devices
DEVICE_MODEL := Lima
DEVICE_PACKAGES := kmod-usb2
IMAGE_SIZE := 15616k
SUPPORTED_DEVICES += lima
endef
TARGET_DEVICES += 8dev_lima
define Device/adtran_bsap1880
SOC := ar7161
DEVICE_VENDOR := Adtran/Bluesocket
@ -189,6 +210,17 @@ define Device/alfa-network_ap121f
endef
TARGET_DEVICES += alfa-network_ap121f
define Device/arduino_yun
SOC := ar9331
DEVICE_VENDOR := Arduino
DEVICE_MODEL := Yun
DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-ledtrig-usbport \
kmod-usb-storage block-mount -swconfig
IMAGE_SIZE := 15936k
SUPPORTED_DEVICES += arduino-yun
endef
TARGET_DEVICES += arduino_yun
define Device/aruba_ap-105
SOC := ar7161
DEVICE_VENDOR := Aruba
@ -553,6 +585,20 @@ define Device/dlink_dap-2695-a1
endef
TARGET_DEVICES += dlink_dap-2695-a1
define Device/dlink_dch-g020-a1
SOC := qca9531
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DCH-G020
DEVICE_VARIANT := A1
DEVICE_PACKAGES := kmod-gpio-pca953x kmod-i2c-gpio kmod-usb2 kmod-usb-acm
IMAGES += factory.bin
IMAGE_SIZE := 14784k
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
append-rootfs | pad-rootfs | check-size | mkdapimg2 0x20000
DAP_SIGNATURE := HONEYBEE-FIRMWARE-DCH-G020
endef
TARGET_DEVICES += dlink_dch-g020-a1
define Device/dlink_dir-505
SOC := ar9330
DEVICE_VENDOR := D-Link

View File

@ -30,6 +30,21 @@ define Build/zyxel-factory
fi
endef
define Device/8dev_rambutan
SOC := qca9557
DEVICE_VENDOR := 8devices
DEVICE_MODEL := Rambutan
DEVICE_PACKAGES := kmod-usb2
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL_SIZE := 4096k
KERNEL_IN_UBI := 1
IMAGES := factory.bin sysupgrade.tar
IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
IMAGE/factory.bin := append-ubi
endef
TARGET_DEVICES += 8dev_rambutan
define Device/aerohive_hiveap-121
SOC := ar9344
DEVICE_VENDOR := Aerohive
@ -119,6 +134,7 @@ define Device/glinet_gl-ar750s-nor-nand
append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
SUPPORTED_DEVICES += glinet,gl-ar750s-nor
DEFAULT := n
endef
TARGET_DEVICES += glinet_gl-ar750s-nor-nand
@ -127,6 +143,7 @@ define Device/glinet_gl-ar750s-nor
DEVICE_VARIANT := NOR
BLOCKSIZE := 64k
SUPPORTED_DEVICES += gl-ar750s glinet,gl-ar750s glinet,gl-ar750s-nor-nand
DEFAULT := n
endef
TARGET_DEVICES += glinet_gl-ar750s-nor

View File

@ -9,6 +9,9 @@ board=$(board_name)
case "$FIRMWARE" in
"ath9k-eeprom-ahb-18100000.wmac.bin")
case $board in
8dev,rambutan)
caldata_extract "caldata" 0x1000 0x800
;;
netgear,wndr3700-v4|\
netgear,wndr4300|\
netgear,wndr4300sw|\

View File

@ -0,0 +1,54 @@
From 4d3c17975c7814884a721fe693b3adf5c426d759 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Tue, 10 Nov 2015 22:18:39 +0100
Subject: [RFC] serial: core: add support for boot console with arbitrary
baud rates
The Arduino Yun uses a baud rate of 250000 by default. The serial is
going over the Atmel ATmega and is used to connect to this chip.
Without this patch Linux wants to switch the console to 9600 Baud.
With this patch Linux will use the configured baud rate and not a
default one specified in uart_register_driver().
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[rebased to 4.14, slightly reworded commit message]
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
drivers/tty/serial/serial_core.c | 6 +++++-
include/linux/console.h | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -219,6 +219,8 @@ static int uart_port_startup(struct tty_
if (retval == 0) {
if (uart_console(uport) && uport->cons->cflag) {
tty->termios.c_cflag = uport->cons->cflag;
+ tty->termios.c_ospeed = uport->cons->baud;
+ tty->termios.c_ispeed = uport->cons->baud;
uport->cons->cflag = 0;
}
/*
@@ -2058,8 +2060,10 @@ uart_set_options(struct uart_port *port,
* Allow the setting of the UART parameters with a NULL console
* too:
*/
- if (co)
+ if (co) {
co->cflag = termios.c_cflag;
+ co->baud = baud;
+ }
return 0;
}
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -153,6 +153,7 @@ struct console {
short flags;
short index;
int cflag;
+ int baud;
void *data;
struct console *next;
};

View File

@ -0,0 +1,54 @@
From 4d3c17975c7814884a721fe693b3adf5c426d759 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Tue, 10 Nov 2015 22:18:39 +0100
Subject: [RFC] serial: core: add support for boot console with arbitrary
baud rates
The Arduino Yun uses a baud rate of 250000 by default. The serial is
going over the Atmel ATmega and is used to connect to this chip.
Without this patch Linux wants to switch the console to 9600 Baud.
With this patch Linux will use the configured baud rate and not a
default one specified in uart_register_driver().
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[rebased to 4.14, slightly reworded commit message]
Signed-off-by: Sungbo Eo <mans0n@gorani.run>
---
drivers/tty/serial/serial_core.c | 6 +++++-
include/linux/console.h | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -220,6 +220,8 @@ static int uart_port_startup(struct tty_
if (retval == 0) {
if (uart_console(uport) && uport->cons->cflag) {
tty->termios.c_cflag = uport->cons->cflag;
+ tty->termios.c_ospeed = uport->cons->baud;
+ tty->termios.c_ispeed = uport->cons->baud;
uport->cons->cflag = 0;
}
/*
@@ -2104,8 +2106,10 @@ uart_set_options(struct uart_port *port,
* Allow the setting of the UART parameters with a NULL console
* too:
*/
- if (co)
+ if (co) {
co->cflag = termios.c_cflag;
+ co->baud = baud;
+ }
return 0;
}
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -153,6 +153,7 @@ struct console {
short flags;
short index;
int cflag;
+ int baud;
void *data;
struct console *next;
};

View File

@ -39,7 +39,7 @@
#include "routerboot.h"
#define RB_HARDCONFIG_VER "0.04"
#define RB_HARDCONFIG_VER "0.05"
#define RB_HC_PR_PFX "[rb_hardconfig] "
/* ID values for hardware settings */
@ -58,6 +58,7 @@
#define RB_ID_BOARD_IDENTIFIER 0x17
#define RB_ID_PRODUCT_NAME 0x21
#define RB_ID_DEFCONF 0x26
#define RB_ID_BOARD_REVISION 0x27
/* Bit definitions for hardware options */
#define RB_HW_OPT_NO_UART BIT(0)
@ -415,6 +416,10 @@ static struct hc_attr {
.tag_id = RB_ID_DEFCONF,
.tshow = routerboot_tag_show_string,
.kattr = __ATTR(defconf, S_IRUSR, hc_attr_show, NULL),
}, {
.tag_id = RB_ID_BOARD_REVISION,
.tshow = routerboot_tag_show_string,
.kattr = __ATTR(board_revision, S_IRUSR, hc_attr_show, NULL),
}
};

View File

@ -56,7 +56,7 @@
#include "routerboot.h"
#define RB_SOFTCONFIG_VER "0.02"
#define RB_SOFTCONFIG_VER "0.03"
#define RB_SC_PR_PFX "[rb_softconfig] "
/*
@ -121,22 +121,36 @@
#define RB_BOOT_DEVICE_FLSHONCE 8 // "boot in flash configuration mode once, then NAND"
/*
* ATH79 CPU frequency indices.
* ATH79 9xxx CPU frequency indices.
* It is unknown if they apply to all ATH79 RBs, and some do not seem to feature
* the up levels (QCA955x), while U3 is presumably AR9344-only.
* the upper levels (QCA955x), while F is presumably AR9344-only.
*/
#define RB_CPU_FREQ_IDX_ATH79_D2 (0 << 3)
#define RB_CPU_FREQ_IDX_ATH79_D1 (1 << 3) // 0x8
#define RB_CPU_FREQ_IDX_ATH79_N0 (2 << 3) // 0x10 - factory freq for many devices
#define RB_CPU_FREQ_IDX_ATH79_U1 (3 << 3) // 0x18
#define RB_CPU_FREQ_IDX_ATH79_U2 (4 << 3) // 0x20
#define RB_CPU_FREQ_IDX_ATH79_U3 (5 << 3) // 0x28
#define RB_CPU_FREQ_IDX_ATH79_9X_A (0 << 3)
#define RB_CPU_FREQ_IDX_ATH79_9X_B (1 << 3) // 0x8
#define RB_CPU_FREQ_IDX_ATH79_9X_C (2 << 3) // 0x10 - factory freq for many devices
#define RB_CPU_FREQ_IDX_ATH79_9X_D (3 << 3) // 0x18
#define RB_CPU_FREQ_IDX_ATH79_9X_E (4 << 3) // 0x20
#define RB_CPU_FREQ_IDX_ATH79_9X_F (5 << 3) // 0x28
#define RB_CPU_FREQ_IDX_ATH79_MIN 0 // all devices support lowest setting
#define RB_CPU_FREQ_IDX_ATH79_AR9334_MAX 5 // stops at U3
#define RB_CPU_FREQ_IDX_ATH79_QCA953X_MAX 4 // stops at U2
#define RB_CPU_FREQ_IDX_ATH79_QCA9556_MAX 2 // stops at N0
#define RB_CPU_FREQ_IDX_ATH79_QCA9558_MAX 3 // stops at U1
#define RB_CPU_FREQ_IDX_ATH79_9X_MIN 0 // all devices support lowest setting
#define RB_CPU_FREQ_IDX_ATH79_9X_AR9334_MAX 5 // stops at F
#define RB_CPU_FREQ_IDX_ATH79_9X_QCA953X_MAX 4 // stops at E
#define RB_CPU_FREQ_IDX_ATH79_9X_QCA9556_MAX 2 // stops at C
#define RB_CPU_FREQ_IDX_ATH79_9X_QCA9558_MAX 3 // stops at D
/* ATH79 7xxx CPU frequency indices. */
#define RB_CPU_FREQ_IDX_ATH79_7X_A ((0 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_B ((1 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_C ((2 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_D ((3 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_E ((4 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_F ((5 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_G ((6 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_H ((7 * 9) << 4)
#define RB_CPU_FREQ_IDX_ATH79_7X_MIN 0 // all devices support lowest setting
#define RB_CPU_FREQ_IDX_ATH79_7X_AR724X_MAX 3 // stops at D
#define RB_CPU_FREQ_IDX_ATH79_7X_AR7161_MAX 7 // stops at H - check if applies to all AR71xx devices
#define RB_SC_CRC32_OFFSET 4 // located right after magic
@ -168,8 +182,9 @@ static ssize_t sc_tag_show_u32tvs(const u8 *pld, u16 pld_len, char *buf,
u32 data; // cpu-endian
int i;
// fallback to raw hex output if we can't handle the input
if (tvselmts < 0)
return tvselmts;
return routerboot_tag_show_u32s(pld, pld_len, buf);
if (sizeof(data) != pld_len)
return -EINVAL;
@ -387,39 +402,71 @@ static ssize_t sc_tag_store_bootdelays(const u8 *pld, u16 pld_len, const char *b
/* Support CPU frequency accessors only when the tag format has been asserted */
#if defined(CONFIG_ATH79)
static struct sc_u32tvs const sc_cpufreq_indexes_ath79[] = {
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_D2, "-2"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_D1, "-1"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_N0, "0"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_U1, "+1"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_U2, "+2"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_U3, "+3"),
/* Use the same letter-based nomenclature as RouterBOOT */
static struct sc_u32tvs const sc_cpufreq_indexes_ath79_9x[] = {
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_A, "a"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_B, "b"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_C, "c"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_D, "d"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_E, "e"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_9X_F, "f"),
};
static int sc_tag_cpufreq_ath79_idxmax(void)
{
int idx_max = -EOPNOTSUPP;
static struct sc_u32tvs const sc_cpufreq_indexes_ath79_7x[] = {
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_A, "a"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_B, "b"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_C, "c"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_D, "d"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_E, "e"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_F, "f"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_G, "g"),
RB_SC_TVS(RB_CPU_FREQ_IDX_ATH79_7X_H, "h"),
};
if (soc_is_ar9344())
idx_max = RB_CPU_FREQ_IDX_ATH79_AR9334_MAX;
static int sc_tag_cpufreq_ath79_arraysize(void)
{
int idx_max;
if (ATH79_SOC_AR7161 == ath79_soc)
idx_max = RB_CPU_FREQ_IDX_ATH79_7X_AR7161_MAX+1;
else if (soc_is_ar724x())
idx_max = RB_CPU_FREQ_IDX_ATH79_7X_AR724X_MAX+1;
else if (soc_is_ar9344())
idx_max = RB_CPU_FREQ_IDX_ATH79_9X_AR9334_MAX+1;
else if (soc_is_qca953x())
idx_max = RB_CPU_FREQ_IDX_ATH79_QCA953X_MAX;
idx_max = RB_CPU_FREQ_IDX_ATH79_9X_QCA953X_MAX+1;
else if (soc_is_qca9556())
idx_max = RB_CPU_FREQ_IDX_ATH79_QCA9556_MAX;
idx_max = RB_CPU_FREQ_IDX_ATH79_9X_QCA9556_MAX+1;
else if (soc_is_qca9558())
idx_max = RB_CPU_FREQ_IDX_ATH79_QCA9558_MAX;
idx_max = RB_CPU_FREQ_IDX_ATH79_9X_QCA9558_MAX+1;
else
idx_max = -EOPNOTSUPP;
return idx_max;
}
static ssize_t sc_tag_show_cpufreq_indexes(const u8 *pld, u16 pld_len, char * buf)
static ssize_t sc_tag_show_cpufreq_indexes(const u8 *pld, u16 pld_len, char *buf)
{
return sc_tag_show_u32tvs(pld, pld_len, buf, sc_cpufreq_indexes_ath79, sc_tag_cpufreq_ath79_idxmax()+1);
const struct sc_u32tvs *tvs;
if (soc_is_ar71xx() || soc_is_ar724x())
tvs = sc_cpufreq_indexes_ath79_7x;
else
tvs = sc_cpufreq_indexes_ath79_9x;
return sc_tag_show_u32tvs(pld, pld_len, buf, tvs, sc_tag_cpufreq_ath79_arraysize());
}
static ssize_t sc_tag_store_cpufreq_indexes(const u8 *pld, u16 pld_len, const char *buf, size_t count)
{
return sc_tag_store_u32tvs(pld, pld_len, buf, count, sc_cpufreq_indexes_ath79, sc_tag_cpufreq_ath79_idxmax()+1);
const struct sc_u32tvs *tvs;
if (soc_is_ar71xx() || soc_is_ar724x())
tvs = sc_cpufreq_indexes_ath79_7x;
else
tvs = sc_cpufreq_indexes_ath79_9x;
return sc_tag_store_u32tvs(pld, pld_len, buf, count, tvs, sc_tag_cpufreq_ath79_arraysize());
}
#else
/* By default we only show the raw value to help with reverse-engineering */

View File

@ -194,18 +194,18 @@ ssize_t routerboot_tag_show_string(const u8 *pld, u16 pld_len, char *buf)
ssize_t routerboot_tag_show_u32s(const u8 *pld, u16 pld_len, char *buf)
{
char *out = buf;
u32 data; // cpu-endian
u32 *data; // cpu-endian
/* Caller ensures pld_len > 0 */
if (pld_len % sizeof(data))
if (pld_len % sizeof(*data))
return -EINVAL;
data = *(u32 *)pld;
data = (u32 *)pld;
do {
out += sprintf(out, "0x%08x\n", data);
out += sprintf(out, "0x%08x\n", *data);
data++;
} while ((pld_len -= sizeof(data)));
} while ((pld_len -= sizeof(*data)));
return out - buf;
}

View File

@ -67,6 +67,11 @@ ipq40xx_setup_interfaces()
engenius,eap2200)
ucidef_set_interface_lan "eth0 eth1"
;;
buffalo,wtr-m2133hp)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1"
;;
cellc,rtl30vw)
ucidef_set_interface_lan "eth0"
ucidef_add_switch "switch0" \
@ -77,7 +82,8 @@ ipq40xx_setup_interfaces()
ucidef_add_switch "switch0" \
"0u@eth0" "2:lan:3" "3:lan:2" "4:lan:1" "0u@eth1" "5:wan"
;;
glinet,gl-b1300)
glinet,gl-b1300 |\
glinet,gl-s1300)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
"0u@eth0" "3:lan" "4:lan"

View File

@ -31,6 +31,10 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x212 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
buffalo,wtr-m2133hp)
caldata_extract "ART" 0x9000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x32)
;;
engenius,eap2200 |\
openmesh,a62)
caldata_extract "0:ART" 0x9000 0x2f20
@ -53,6 +57,7 @@ case "$FIRMWARE" in
cilab,meshpoint-one |\
ezviz,cs-w3-wd1200g-eup |\
glinet,gl-b1300 |\
glinet,gl-s1300 |\
linksys,ea6350v3 |\
mobipromo,cm520-79f |\
p2w,r619ac |\
@ -86,6 +91,10 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3C800 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x207 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
buffalo,wtr-m2133hp)
caldata_extract "ART" 0x1000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x26)
;;
cellc,rtl30vw |\
compex,wpj419 |\
compex,wpj428 |\
@ -143,6 +152,7 @@ case "$FIRMWARE" in
cilab,meshpoint-one |\
ezviz,cs-w3-wd1200g-eup |\
glinet,gl-b1300 |\
glinet,gl-s1300 |\
linksys,ea6350v3 |\
mobipromo,cm520-79f |\
p2w,r619ac |\
@ -176,6 +186,10 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x3D000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x3C000 -e 0x208 -l 12064 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader1")
;;
buffalo,wtr-m2133hp)
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary ORGDATA 0x2c)
;;
cellc,rtl30vw |\
compex,wpj419 |\
compex,wpj428 |\

View File

@ -64,6 +64,7 @@ platform_do_upgrade() {
avm,fritzbox-7530 |\
avm,fritzrepeater-1200 |\
avm,fritzrepeater-3000 |\
buffalo,wtr-m2133hp |\
cilab,meshpoint-one |\
engenius,eap2200 |\
mobipromo,cm520-79f |\

View File

@ -0,0 +1,419 @@
// SPDX-License-Identifier: ISC
/*
* Copyright (c) 2015 - 2016, The Linux Foundation. All rights reserved.
* Copyright (c) 2020 Yanase Yuki <dev@zpc.sakura.ne.jp>
*/
#include "qcom-ipq4019.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/soc/qcom,tcsr.h>
/ {
model = "Buffalo WTR-M2133HP";
compatible = "buffalo,wtr-m2133hp", "qcom,ipq4019";
memory {
device_type = "memory";
reg = <0x80000000 0x20000000>;
};
chosen {
/*
* U-Boot adds "ubi.mtd=rootfs root=mtd:ubi_rootfs" to
* kernel command line. But we use different partition names,
* so we have to set correct parameters.
*/
bootargs-append = " ubi.mtd=ubi root=/dev/ubiblock0_1";
};
aliases {
led-boot = &led_power_blue;
led-failsafe = &led_power_orange;
led-running = &led_power_white;
led-upgrade = &led_power_blue;
label-mac-device = &gmac0;
};
soc {
rng@22000 {
status = "okay";
};
tcsr@1949000 {
compatible = "qcom,tcsr";
reg = <0x1949000 0x100>;
qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
};
tcsr@194b000 {
compatible = "qcom,tcsr";
reg = <0x194b000 0x100>;
qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
status = "okay";
};
ess_tcsr@1953000 {
compatible = "qcom,tcsr";
reg = <0x1953000 0x1000>;
qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
};
tcsr@1957000 {
compatible = "qcom,tcsr";
reg = <0x1957000 0x100>;
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
};
crypto@8e3a000 {
status = "okay";
};
watchdog@b017000 {
status = "okay";
};
ess-switch@c000000 {
status = "okay";
switch_lan_bmp = <0x1c>;
};
ess-psgmii@98000 {
status = "okay";
};
edma@c080000 {
status = "okay";
};
usb3@8af8800 {
status = "okay";
};
};
leds {
compatible = "gpio-leds";
led_power_white: power_white {
label = "wtr-m2133hp:white:power";
gpios = <&tlmm 40 GPIO_ACTIVE_HIGH>;
};
led_power_orange: power_orange {
label = "wtr-m2133hp:orange:power";
gpios = <&tlmm 25 GPIO_ACTIVE_HIGH>;
};
led_power_blue: power_blue {
label = "wtr-m2133hp:blue:power";
gpios = <&tlmm 43 GPIO_ACTIVE_HIGH>;
};
router_white {
label = "wtr-m2133hp:white:router";
gpios = <&tlmm 28 GPIO_ACTIVE_HIGH>;
};
router_orange {
label = "wtr-m2133hp:orange:router";
gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
};
internet_white {
label = "wtr-m2133hp:white:internet";
gpios = <&tlmm 27 GPIO_ACTIVE_HIGH>;
};
internet_orange {
label = "wtr-m2133hp:orange:internet";
gpios = <&tlmm 45 GPIO_ACTIVE_HIGH>;
};
wireless_white {
label = "wtr-m2133hp:white:wireless";
gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
};
wireless_orange {
label = "wtr-m2133hp:orange:wireless";
gpios = <&tlmm 44 GPIO_ACTIVE_HIGH>;
};
};
keys {
compatible = "gpio-keys";
auto_mode {
label = "auto_mode";
gpios = <&tlmm 9 GPIO_ACTIVE_LOW>;
linux,code = <BTN_0>;
linux,input-type = <EV_SW>;
};
router_mode {
label = "router_mode";
gpios = <&tlmm 10 GPIO_ACTIVE_LOW>;
linux,code = <BTN_1>;
linux,input-type = <EV_SW>;
};
ap_mode {
label = "ap_mode";
gpios = <&tlmm 11 GPIO_ACTIVE_LOW>;
linux,code = <BTN_2>;
linux,input-type = <EV_SW>;
};
reset {
label = "reset";
gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "AOSS Button";
gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};
&tlmm {
serial_0_pins: serial0_pinmux {
mux {
pins = "gpio16", "gpio17";
function = "blsp_uart0";
bias-disable;
};
};
mdio_pins: mdio_pinmux {
mux_1 {
pins = "gpio6";
function = "mdio";
bias-pull-up;
};
mux_2 {
pins = "gpio7";
function = "mdc";
bias-pull-up;
};
};
nand_pins: nand_pins {
pullups {
pins = "gpio52", "gpio53", "gpio58",
"gpio59";
function = "qpic";
bias-pull-up;
};
pulldowns {
pins = "gpio54", "gpio55", "gpio56",
"gpio57", "gpio60", "gpio61",
"gpio62", "gpio63", "gpio64",
"gpio65", "gpio66", "gpio67",
"gpio68", "gpio69";
function = "qpic";
bias-pull-down;
};
};
usb_power {
line-name = "USB power";
gpios = <34 GPIO_ACTIVE_HIGH>;
gpio-hog;
output-high;
};
};
&blsp_dma {
status = "okay";
};
&blsp1_uart1 {
pinctrl-0 = <&serial_0_pins>;
pinctrl-names = "default";
status = "okay";
};
&cryptobam {
status = "okay";
};
&pcie0 {
status = "okay";
bridge@0,0 {
reg = <0x00000000 0 0 0 0>;
#address-cells = <3>;
#size-cells = <2>;
ranges;
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0 0 0 0 0>;
qcom,ath10k-calibration-variant = "Buffalo-WTR-M2133HP";
};
};
};
&qpic_bam {
status = "okay";
};
&nand {
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
status = "okay";
nand@0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "SBL1";
reg = <0x0000000 0x0100000>;
read-only;
};
partition@100000 {
label = "MIBIB";
reg = <0x0100000 0x0100000>;
read-only;
};
partition@200000 {
label = "BOOTCONFIG";
reg = <0x0200000 0x0100000>;
read-only;
};
partition@300000 {
label = "QSEE";
reg = <0x0300000 0x0100000>;
read-only;
};
partition@400000 {
label = "QSEE_1";
reg = <0x0400000 0x0100000>;
read-only;
};
partition@500000 {
label = "CDT";
reg = <0x0500000 0x0080000>;
read-only;
};
partition@580000 {
label = "CDT_1";
reg = <0x0580000 0x0080000>;
read-only;
};
partition@600000 {
label = "BOOTCONFIG1";
reg = <0x0600000 0x0080000>;
read-only;
};
partition@680000 {
label = "APPSBLENV";
reg = <0x0680000 0x0080000>;
};
partition@700000 {
label = "APPSBL";
reg = <0x0700000 0x0200000>;
read-only;
};
partition@900000 {
label = "APPSBL_1";
reg = <0x0900000 0x0200000>;
read-only;
};
art: partition@b00000 {
label = "ART";
reg = <0x0b00000 0x0080000>;
read-only;
};
partition@b80000 {
label = "ART_1";
reg = <0x0b80000 0x0080000>;
read-only;
};
orgdata: partition@c00000 {
label = "ORGDATA";
reg = <0x0c00000 0x0080000>;
read-only;
};
partition@c80000 {
label = "ORGDATA_1";
reg = <0x0c80000 0x0080000>;
read-only;
};
partition@d00000 {
label = "ubi";
reg = <0x0d00000 0x2900000>;
};
partition@3600000 {
label = "rootfs_recover";
reg = <0x3600000 0x2900000>;
read-only;
};
partition@5f00000 {
label = "user_property";
reg = <0x5f00000 0x1a20000>;
read-only;
};
};
};
};
&wifi0 {
status = "okay";
qcom,ath10k-calibration-variant = "Buffalo-WTR-M2133HP";
ieee80211-freq-limit = <2400000 2483000>;
};
&wifi1 {
status = "okay";
qcom,ath10k-calibration-variant = "Buffalo-WTR-M2133HP";
};
&mdio {
status = "okay";
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
reset-gpios = <&tlmm 47 GPIO_ACTIVE_LOW>;
};
&gmac0 {
mtd-mac-address = <&orgdata 0x20>;
};
&gmac1 {
mtd-mac-address = <&orgdata 0x20>;
};
&usb3_ss_phy {
status = "okay";
};
&usb3_hs_phy {
status = "okay";
};

View File

@ -0,0 +1,356 @@
// SPDX-License-Identifier: GPL-2.0 OR MIT
#include "qcom-ipq4019.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/qcom,tcsr.h>
/ {
model = "GL.iNet GL-S1300";
compatible = "glinet,gl-s1300";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
memory {
device_type = "memory";
reg = <0x80000000 0x10000000>;
};
soc {
rng@22000 {
status = "okay";
};
mdio@90000 {
status = "okay";
};
ess-psgmii@98000 {
status = "okay";
};
tcsr@1949000 {
compatible = "qcom,tcsr";
reg = <0x1949000 0x100>;
qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
};
tcsr@194b000 {
/* select hostmode */
compatible = "qcom,tcsr";
reg = <0x194b000 0x100>;
qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
status = "okay";
};
ess_tcsr@1953000 {
compatible = "qcom,tcsr";
reg = <0x1953000 0x1000>;
qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
};
tcsr@1957000 {
compatible = "qcom,tcsr";
reg = <0x1957000 0x100>;
qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
};
usb2@60f8800 {
status = "okay";
};
usb3@8af8800 {
status = "okay";
};
crypto@8e3a000 {
status = "okay";
};
watchdog@b017000 {
status = "okay";
};
ess-switch@c000000 {
status = "okay";
switch_lan_bmp = <0x18>;
switch_wan_bmp = <0x20>;
};
edma@c080000 {
status = "okay";
};
};
keys {
compatible = "gpio-keys";
wps {
label = "wps";
gpios = <&tlmm 53 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
reset {
label = "reset";
gpios = <&tlmm 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "gl-s1300:green:power";
gpios = <&tlmm 57 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
mesh {
label = "gl-s1300:green:mesh";
gpios = <&tlmm 59 GPIO_ACTIVE_HIGH>;
};
wlan {
label = "gl-s1300:green:wlan";
gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "phy0tpt";
};
};
};
&vqmmc {
status = "okay";
};
&sdhci {
status = "okay";
pinctrl-0 = <&sd_pins>;
pinctrl-names = "default";
cd-gpios = <&tlmm 22 GPIO_ACTIVE_LOW>;
vqmmc-supply = <&vqmmc>;
};
&blsp_dma {
status = "okay";
};
&cryptobam {
status = "okay";
};
&blsp1_spi1 {
pinctrl-0 = <&spi_0_pins>;
pinctrl-names = "default";
status = "okay";
cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <24000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
SBL1@0 {
label = "SBL1";
reg = <0x0 0x40000>;
read-only;
};
MIBIB@40000 {
label = "MIBIB";
reg = <0x40000 0x20000>;
read-only;
};
QSEE@60000 {
label = "QSEE";
reg = <0x60000 0x60000>;
read-only;
};
CDT@c0000 {
label = "CDT";
reg = <0xc0000 0x10000>;
read-only;
};
DDRPARAMS@d0000 {
label = "DDRPARAMS";
reg = <0xd0000 0x10000>;
read-only;
};
APPSBLENV@e0000 {
label = "APPSBLENV";
reg = <0xe0000 0x10000>;
read-only;
};
APPSBL@f0000 {
label = "APPSBL";
reg = <0xf0000 0x80000>;
read-only;
};
ART@170000 {
label = "ART";
reg = <0x170000 0x10000>;
read-only;
};
firmware@180000 {
compatible = "denx,fit";
label = "firmware";
reg = <0x180000 0xe80000>;
};
};
};
};
&blsp1_spi2 {
pinctrl-0 = <&spi_1_pins>;
pinctrl-names = "default";
status = "okay";
spidev1: spi@1 {
compatible = "siliconlabs,si3210";
reg = <0>;
spi-max-frequency = <24000000>;
};
};
&blsp1_uart1 {
pinctrl-0 = <&serial_pins>;
pinctrl-names = "default";
status = "okay";
};
&blsp1_uart2 {
pinctrl-0 = <&serial_1_pins>;
pinctrl-names = "default";
status = "okay";
};
&tlmm {
serial_pins: serial_pinmux {
mux {
pins = "gpio16", "gpio17";
function = "blsp_uart0";
bias-disable;
};
};
serial_1_pins: serial1_pinmux {
mux {
pins = "gpio8", "gpio9",
"gpio10", "gpio11";
function = "blsp_uart1";
bias-disable;
};
};
spi_0_pins: spi_0_pinmux {
pinmux {
function = "blsp_spi0";
pins = "gpio13", "gpio14", "gpio15";
};
pinmux_cs {
function = "gpio";
pins = "gpio12";
};
pinconf {
pins = "gpio13", "gpio14", "gpio15";
drive-strength = <12>;
bias-disable;
};
pinconf_cs {
pins = "gpio12";
drive-strength = <2>;
bias-disable;
output-high;
};
};
spi_1_pins: spi_1_pinmux {
mux {
pins = "gpio44", "gpio46", "gpio47";
function = "blsp_spi1";
bias-disable;
};
host_int {
pins = "gpio42";
function = "gpio";
input;
};
cs {
pins = "gpio45";
function = "gpio";
bias-pull-up;
};
wake {
pins = "gpio40";
function = "gpio";
output-high;
};
reset {
pins = "gpio49";
function = "gpio";
output-high;
};
};
sd_pins: sd_pins {
pinmux {
function = "sdio";
pins = "gpio23", "gpio24", "gpio25", "gpio26",
"gpio28", "gpio29", "gpio30", "gpio31";
drive-strength = <10>;
};
pinmux_sd_clk {
function = "sdio";
pins = "gpio27";
drive-strength = <16>;
};
pinmux_sd7 {
function = "sdio";
pins = "gpio32";
drive-strength = <10>;
bias-disable;
};
};
};
&usb2_hs_phy {
status = "okay";
};
&usb3_hs_phy {
status = "okay";
};
&usb3_ss_phy {
status = "okay";
};
&wifi0 {
status = "okay";
qcom,ath10k-calibration-variant = "GL-S1300";
};
&wifi1 {
status = "okay";
qcom,ath10k-calibration-variant = "GL-S1300";
};

View File

@ -245,6 +245,18 @@ define Device/avm_fritzrepeater-3000
endef
TARGET_DEVICES += avm_fritzrepeater-3000
define Device/buffalo_wtr-m2133hp
$(call Device/FitImage)
$(call Device/UbiFit)
DEVICE_VENDOR := Buffalo
DEVICE_MODEL := WTR-M2133HP
SOC := qcom-ipq4019
DEVICE_PACKAGES := uboot-envtools ath10k-firmware-qca9984-ct ipq-wifi-buffalo_wtr-m2133hp
BLOCKSIZE := 128k
PAGESIZE := 2048
endef
TARGET_DEVICES += buffalo_wtr-m2133hp
define Device/cellc_rtl30vw
KERNEL_SUFFIX := -fit-uImage.itb
KERNEL_INITRAMFS = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
@ -437,6 +449,19 @@ define Device/glinet_gl-b1300
endef
TARGET_DEVICES += glinet_gl-b1300
define Device/glinet_gl-s1300
$(call Device/FitImage)
DEVICE_VENDOR := GL.iNet
DEVICE_MODEL := GL-S1300
SOC := qcom-ipq4029
KERNEL_SIZE := 4096k
IMAGE_SIZE := 26624k
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
DEVICE_PACKAGES := ipq-wifi-glinet_gl-s1300 kmod-fs-ext4 kmod-mmc kmod-spi-dev
endef
TARGET_DEVICES += glinet_gl-s1300
define Device/linksys_ea6350v3
# The Linksys EA6350v3 has a uboot bootloader that does not
# support either booting lzma kernel images nor booting UBI

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -785,11 +785,50 @@ dtb-$(CONFIG_ARCH_QCOM) += \
@@ -785,11 +785,52 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8074-dragonboard.dtb \
qcom-apq8084-ifc6540.dtb \
qcom-apq8084-mtp.dtb \
@ -52,11 +52,13 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq4019-rtl30vw.dtb \
+ qcom-ipq4019-u4019-32m.dtb \
+ qcom-ipq4019-wpj419.dtb \
+ qcom-ipq4019-wtr-m2133hp.dtb \
+ qcom-ipq4028-wpj428.dtb \
+ qcom-ipq4029-ap-303.dtb \
+ qcom-ipq4029-ap-303h.dtb \
+ qcom-ipq4029-ap-365.dtb \
+ qcom-ipq4029-gl-b1300.dtb \
+ qcom-ipq4029-gl-s1300.dtb \
+ qcom-ipq4029-mr33.dtb \
qcom-ipq8064-ap148.dtb \
qcom-msm8660-surf.dtb \

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -837,11 +837,50 @@ dtb-$(CONFIG_ARCH_QCOM) += \
@@ -837,11 +837,52 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-apq8074-dragonboard.dtb \
qcom-apq8084-ifc6540.dtb \
qcom-apq8084-mtp.dtb \
@ -52,11 +52,13 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq4019-rtl30vw.dtb \
+ qcom-ipq4019-u4019-32m.dtb \
+ qcom-ipq4019-wpj419.dtb \
+ qcom-ipq4019-wtr-m2133hp.dtb \
+ qcom-ipq4028-wpj428.dtb \
+ qcom-ipq4029-ap-303.dtb \
+ qcom-ipq4029-ap-303h.dtb \
+ qcom-ipq4029-ap-365.dtb \
+ qcom-ipq4029-gl-b1300.dtb \
+ qcom-ipq4029-gl-s1300.dtb \
+ qcom-ipq4029-mr33.dtb \
qcom-ipq8064-ap148.dtb \
qcom-msm8660-surf.dtb \

View File

@ -27,6 +27,13 @@ qcom,ipq8064-ap161)
ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3u@eth1" "6:wan" "4u@eth0"
;;
linksys,ea7500-v1)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_add_switch "switch0" \
"2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "6@eth1" "1:wan" "0@eth0"
ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
ucidef_set_interface_macaddr "wan" "$hw_mac_addr"
;;
linksys,ea8500)
hw_mac_addr=$(mtd_get_mac_ascii devinfo hw_mac_addr)
ucidef_add_switch "switch0" \

View File

@ -13,6 +13,7 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x1000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary ART 0x1e)
;;
linksys,ea7500-v1 |\
linksys,ea8500)
caldata_extract "art" 0x1000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1)
@ -47,6 +48,7 @@ case "$FIRMWARE" in
caldata_extract "ART" 0x5000 0x2f20
ath10k_patch_mac $(mtd_get_mac_binary ART 0x18)
;;
linksys,ea7500-v1 |\
linksys,ea8500)
caldata_extract "art" 0x5000 0x2f20
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2)

View File

@ -4,6 +4,7 @@ START=99
boot() {
case $(board_name) in
linksys,ea7500-v1 |\
linksys,ea8500)
mtd resetbc s_env || true
;;

View File

@ -27,6 +27,7 @@ platform_do_upgrade() {
zyxel,nbg6817)
zyxel_do_upgrade "$1"
;;
linksys,ea7500-v1 |\
linksys,ea8500)
platform_do_upgrade_linksys "$1"
;;

View File

@ -99,6 +99,7 @@ CONFIG_CPU_FREQ_GOV_COMMON=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y
# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_HAS_ASID=y
@ -503,6 +504,7 @@ CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ZSTD=y
# CONFIG_UCLAMP_TASK is not set
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UNCOMPRESS_INCLUDE="debug/uncompress.h"
CONFIG_UNWINDER_ARM=y

View File

@ -0,0 +1,302 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qcom-ipq8064-v2.0.dtsi"
#include <dt-bindings/input/input.h>
/ {
model = "Linksys EA7500 V1 WiFi Router";
compatible = "linksys,ea7500-v1", "qcom,ipq8064";
memory@0 {
reg = <0x42000000 0xe000000>;
device_type = "memory";
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
rsvd@41200000 {
reg = <0x41200000 0x300000>;
no-map;
};
};
aliases {
serial0 = &gsbi4_serial;
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
chosen {
bootargs = "console=ttyMSM0,115200n8";
stdout-path = "serial0:115200n8";
append-rootblock = "ubi.mtd="; /* append to bootargs adding the root deviceblock nbr from bootloader */
find-rootblock = "ubi.mtd="; /* look for root deviceblock nbr in this bootarg */
};
keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
gpios = <&qcom_pinmux 68 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&qcom_pinmux 65 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&led_pins>;
pinctrl-names = "default";
led_power: power {
label = "ea7500-v1:white:power";
gpios = <&qcom_pinmux 6 GPIO_ACTIVE_LOW>;
default-state = "keep";
};
};
};
&qcom_pinmux {
button_pins: button_pins {
mux {
pins = "gpio65", "gpio68";
function = "gpio";
drive-strength = <2>;
bias-pull-up;
};
};
led_pins: led_pins {
mux {
pins = "gpio6";
function = "gpio";
drive-strength = <2>;
bias-pull-up;
};
};
};
&gsbi4 {
qcom,mode = <GSBI_PROT_I2C_UART>;
status = "okay";
serial@16340000 {
status = "okay";
};
/*
* The i2c device on gsbi4 should not be enabled.
* On ipq806x designs gsbi4 i2c is meant for exclusive
* RPM usage. Turning this on in kernel manifests as
* i2c failure for the RPM.
*/
};
&usb3_0 {
status = "okay";
};
&usb3_1 {
status = "okay";
};
&pcie0 {
status = "okay";
force_gen1 = <1>;
};
&pcie1 {
status = "okay";
};
&pcie2 {
status = "okay";
};
&nand_controller {
status = "okay";
pinctrl-0 = <&nand_pins>;
pinctrl-names = "default";
nand@0 {
reg = <0>;
compatible = "qcom,nandcs";
nand-ecc-strength = <4>;
nand-bus-width = <8>;
nand-ecc-step-size = <512>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "SBL1";
reg = <0x0000000 0x0040000>;
read-only;
};
partition@40000 {
label = "MIBIB";
reg = <0x0040000 0x0140000>;
read-only;
};
partition@180000 {
label = "SBL2";
reg = <0x0180000 0x0140000>;
read-only;
};
partition@2c0000 {
label = "SBL3";
reg = <0x02c0000 0x0280000>;
read-only;
};
partition@540000 {
label = "DDRCONFIG";
reg = <0x0540000 0x0120000>;
read-only;
};
partition@660000 {
label = "SSD";
reg = <0x0660000 0x0120000>;
read-only;
};
partition@780000 {
label = "TZ";
reg = <0x0780000 0x0280000>;
read-only;
};
partition@a00000 {
label = "RPM";
reg = <0x0a00000 0x0280000>;
read-only;
};
art: partition@c80000 {
label = "art";
reg = <0x0c80000 0x0140000>;
read-only;
};
partition@dc0000 {
label = "APPSBL";
reg = <0x0dc0000 0x0100000>;
read-only;
};
partition@ec0000 {
label = "u_env";
reg = <0x0ec0000 0x0040000>;
};
partition@f00000 {
label = "s_env";
reg = <0x0f00000 0x0040000>;
};
partition@f40000 {
label = "devinfo";
reg = <0x0f40000 0x0040000>;
};
partition@f80000 {
label = "kernel1";
reg = <0x0f80000 0x2800000>; /* 3 MB spill to rootfs*/
};
partition@1280000 {
label = "rootfs1";
reg = <0x1280000 0x2500000>;
};
partition@3780000 {
label = "kernel2";
reg = <0x3780000 0x2800000>;
};
partition@3a80000 {
label = "rootfs2";
reg = <0x3a80000 0x2500000>;
};
partition@5f80000 {
label = "sysdiag";
reg = <0x5f80000 0x100000>;
};
partition@6080000 {
label = "syscfg";
reg = <0x6080000 0x1f80000>;
};
};
};
};
&mdio0 {
status = "okay";
pinctrl-0 = <&mdio0_pins>;
pinctrl-names = "default";
phy0: ethernet-phy@0 {
reg = <0>;
qca,ar8327-initvals = <
0x00004 0x7600000 /* PAD0_MODE */
0x00008 0x1000000 /* PAD5_MODE */
0x0000c 0x80 /* PAD6_MODE */
0x00010 0x2613a0 /* PWS_REG */
0x000e4 0x6a545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */
0x00094 0x4e /* PORT6_STATUS */
>;
};
};
&gmac1 {
status = "okay";
phy-mode = "rgmii";
qcom,id = <1>;
pinctrl-0 = <&rgmii2_pins>;
pinctrl-names = "default";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&gmac2 {
status = "okay";
phy-mode = "sgmii";
qcom,id = <2>;
fixed-link {
speed = <1000>;
full-duplex;
};
};
&adm_dma {
status = "okay";
};

View File

@ -109,6 +109,23 @@ define Device/compex_wpq864
endef
TARGET_DEVICES += compex_wpq864
define Device/linksys_ea7500-v1
$(call Device/LegacyImage)
DEVICE_VENDOR := Linksys
DEVICE_MODEL := EA7500
DEVICE_VARIANT := v1
SOC := qcom-ipq8064
PAGESIZE := 2048
BLOCKSIZE := 128k
KERNEL_SIZE := 3072k
KERNEL = kernel-bin | append-dtb | uImage none | append-uImage-fakehdr filesystem
UBINIZE_OPTS := -E 5
IMAGES := factory.bin sysupgrade.bin
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
DEVICE_PACKAGES := ath10k-firmware-qca99x0-ct
endef
TARGET_DEVICES += linksys_ea7500-v1
define Device/linksys_ea8500
$(call Device/LegacyImage)
DEVICE_VENDOR := Linksys

View File

@ -51,41 +51,62 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
#else
#define do_extend_cmdline 0
#endif
@@ -67,6 +69,59 @@ static uint32_t get_cell_size(const void
@@ -67,6 +69,80 @@ static uint32_t get_cell_size(const void
return cell_size;
}
+#if defined(CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_MANGLE)
+/**
+ * taken from arch/x86/boot/string.c
+ * local_strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+static char *local_strstr(const char *s1, const char *s2)
+{
+ size_t l1, l2;
+
+ l2 = strlen(s2);
+ if (!l2)
+ return (char *)s1;
+ l1 = strlen(s1);
+ while (l1 >= l2) {
+ l1--;
+ if (!memcmp(s1, s2, l2))
+ return (char *)s1;
+ s1++;
+ }
+ return NULL;
+}
+
+static char *append_rootblock(char *dest, const char *str, int len, void *fdt)
+{
+ char *ptr, *end;
+ char *ptr, *end, *tmp;
+ char *root="root=";
+ char *find_rootblock;
+ int i, l;
+ const char *rootblock;
+
+ //ARM doesn't have __HAVE_ARCH_STRSTR, so search manually
+ ptr = str - 1;
+ find_rootblock = getprop(fdt, "/chosen", "find-rootblock", &l);
+ if(!find_rootblock)
+ find_rootblock = root;
+
+ do {
+ //first find an 'r' at the begining or after a space
+ do {
+ ptr++;
+ ptr = strchr(ptr, 'r');
+ if(!ptr) return dest;
+ //ARM doesn't have __HAVE_ARCH_STRSTR, so it was copied from x86
+ ptr = local_strstr(str, find_rootblock);
+
+ } while (ptr != str && *(ptr-1) != ' ');
+
+ //then check for the rest
+ for(i = 1; i <= 4; i++)
+ if(*(ptr+i) != *(root+i)) break;
+
+ } while (i != 5);
+ if(!ptr)
+ return dest;
+
+ end = strchr(ptr, ' ');
+ end = end ? (end - 1) : (strchr(ptr, 0) - 1);
+
+ //find partition number (assumes format root=/dev/mtdXX | /dev/mtdblockXX | yy:XX )
+ // Some boards ubi.mtd=XX,ZZZZ, so let's check for '," too.
+ tmp = strchr(ptr, ',');
+
+ if(tmp)
+ end = end < tmp ? end : tmp - 1;
+
+ //find partition number (assumes format root=/dev/mtdXX | /dev/mtdblockXX | yy:XX | ubi.mtd=XX,ZZZZ )
+ for( i = 0; end >= ptr && *end >= '0' && *end <= '9'; end--, i++);
+ ptr = end + 1;
+
@ -111,7 +132,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
{
char cmdline[COMMAND_LINE_SIZE];
@@ -86,12 +141,21 @@ static void merge_fdt_bootargs(void *fdt
@@ -86,12 +162,21 @@ static void merge_fdt_bootargs(void *fdt
/* and append the ATAG_CMDLINE */
if (fdt_cmdline) {
@ -133,7 +154,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
}
*ptr = '\0';
@@ -166,7 +230,9 @@ int atags_to_fdt(void *atag_list, void *
@@ -166,7 +251,9 @@ int atags_to_fdt(void *atag_list, void *
else
setprop_string(fdt, "/chosen", "bootargs",
atag->u.cmdline.cmdline);
@ -144,7 +165,7 @@ Signed-off-by: Adrian Panella <ianchi74@outlook.com>
if (memcount >= sizeof(mem_reg_property)/4)
continue;
if (!atag->u.mem.size)
@@ -210,6 +276,10 @@ int atags_to_fdt(void *atag_list, void *
@@ -210,6 +297,10 @@ int atags_to_fdt(void *atag_list, void *
setprop(fdt, "/memory", "reg", mem_reg_property,
4 * memcount * memsize);
}

View File

@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -843,6 +843,18 @@ dtb-$(CONFIG_ARCH_QCOM) += \
@@ -843,6 +843,19 @@ dtb-$(CONFIG_ARCH_QCOM) += \
qcom-ipq4019-ap.dk07.1-c1.dtb \
qcom-ipq4019-ap.dk07.1-c2.dtb \
qcom-ipq8064-ap148.dtb \
@ -18,6 +18,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
+ qcom-ipq8064-d7800.dtb \
+ qcom-ipq8064-db149.dtb \
+ qcom-ipq8064-ap161.dtb \
+ qcom-ipq8064-ea7500-v1.dtb \
+ qcom-ipq8064-ea8500.dtb \
+ qcom-ipq8064-r7500.dtb \
+ qcom-ipq8064-r7500v2.dtb \

View File

@ -21,7 +21,8 @@ case "$board" in
"raidsonic,ib-nas62x0"|\
"seagate,dockstar"|\
"seagate,goflexhome"|\
"seagate,goflexnet")
"seagate,goflexnet"|\
"zyxel,nsa310s")
ucidef_set_interface_lan "eth0" "dhcp"
;;
"linksys,audi"|\

View File

@ -212,6 +212,7 @@ CONFIG_LZO_DECOMPRESS=y
CONFIG_MACH_KIRKWOOD=y
CONFIG_MACH_MVEBU_ANY=y
CONFIG_MANGLE_BOOTARGS=y
CONFIG_MARVELL_PHY=y
CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y
CONFIG_MEMFD_CREATE=y

View File

@ -0,0 +1,271 @@
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
#include "kirkwood.dtsi"
#include "kirkwood-6281.dtsi"
/ {
model = "ZyXEL NSA310S";
compatible = "zyxel,nsa310s", "marvell,kirkwood-88f6702", "marvell,kirkwood";
aliases {
led-boot = &led_green_sys;
led-failsafe = &led_red_sys;
led-running = &led_green_sys;
led-upgrade = &led_red_sys;
};
memory {
device_type = "memory";
reg = <0x00000000 0x10000000>;
};
chosen {
bootargs = "console=ttyS0,115200n8 earlyprintk";
stdout-path = &uart0;
};
ocp@f1000000 {
pinctrl: pin-controller@10000 {
pinctrl-names = "default";
pmx_usb_power: pmx-usb-power {
marvell,pins = "mpp21";
marvell,function = "gpio";
};
pmx_pwr_off: pmx-pwr-off {
marvell,pins = "mpp27";
marvell,function = "gpio";
};
pmx_btn_reset: pmx-btn-reset {
marvell,pins = "mpp24";
marvell,function = "gpio";
};
pmx_btn_copy: pmx-btn-copy {
marvell,pins = "mpp25";
marvell,function = "gpio";
};
pmx_btn_power: pmx-btn-power {
marvell,pins = "mpp26";
marvell,function = "gpio";
};
pmx_led_usb_green: pmx-led-usb-green {
marvell,pins = "mpp15";
marvell,function = "gpio";
};
pmx_led_copy_green: pmx-led-copy-green {
marvell,pins = "mpp22";
marvell,function = "gpio";
};
pmx_led_copy_red: pmx-led-copy-red {
marvell,pins = "mpp23";
marvell,function = "gpio";
};
pmx_led_sys_green: pmx-led-sys-green {
marvell,pins = "mpp28";
marvell,function = "gpio";
};
pmx_led_sys_red: pmx-led-sys-red {
marvell,pins = "mpp29";
marvell,function = "gpio";
};
pmx_led_hdd1_green: pmx-led-hdd1-green {
marvell,pins = "mpp16";
marvell,function = "gpio";
};
pmx_led_hdd1_red: pmx-led-hdd1-red {
marvell,pins = "mpp13";
marvell,function = "gpio";
};
pmx_pwr_sata1: pmx-pwr-sata1 {
marvell,pins = "mpp33";
marvell,function = "gpio";
};
};
i2c@11000 {
status = "okay";
rtc@68 {
compatible = "htk,ht1382";
reg = <0x68>;
};
};
serial@12000 {
status = "okay";
};
};
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pmx_usb_power &pmx_pwr_sata1>;
pinctrl-names = "default";
usb0_power: regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
regulator-name = "USB Power";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
};
sata1_power: regulator@2 {
compatible = "regulator-fixed";
reg = <2>;
regulator-name = "SATA1 Power";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
};
};
keys {
compatible = "gpio-keys";
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&pmx_btn_reset &pmx_btn_copy &pmx_btn_power>;
pinctrl-names = "default";
power {
label = "Power Button";
linux,code = <KEY_POWER>;
gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>;
};
copy {
label = "Copy Button";
linux,code = <KEY_COPY>;
gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
};
reset {
label = "Reset Button";
linux,code = <KEY_RESTART>;
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
led_green_sys: green-sys {
label = "nsa310s:green:sys";
gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "default-on";
};
led_red_sys: red-sys {
label = "nsa310s:red:sys";
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
};
green-hdd1 {
label = "nsa310s:green:hdd1";
gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "ata1";
};
red-hdd1 {
label = "nsa310s:red:hdd1";
gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
};
green-usb {
label = "nsa310s:green:usb";
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "usb-host";
};
green-copy {
label = "nsa310s:green:copy";
gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
};
red-copy {
label = "nsa310s:red:copy";
gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>;
};
};
gpio_poweroff {
compatible = "gpio-poweroff";
pinctrl-0 = <&pmx_pwr_off>;
pinctrl-names = "default";
gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
};
};
&eth0 {
status = "okay";
ethernet0-port@0 {
phy-handle = <&ethphy0>;
};
};
&mdio {
status = "okay";
ethphy0: ethernet-phy@1 {
reg = <1>;
phy-mode = "rgmii-id";
marvell,reg-init = <0x1 0x16 0x0 0x3>,
<0x1 0x10 0x0 0x1017>,
<0x1 0x11 0x0 0x4408>,
<0x1 0x16 0x0 0x0>;
};
};
&nand {
status = "okay";
chip-delay = <35>;
partition@0 {
label = "uboot";
reg = <0x0000000 0x00c0000>;
read-only;
};
partition@c0000 {
label = "uboot_env";
reg = <0x00c0000 0x0080000>;
};
partition@140000 {
label = "ubi";
reg = <0x0140000 0x7ec0000>;
};
};
&pciec {
status = "okay";
};
&pcie0 {
status = "okay";
};
&sata {
status = "okay";
nr-ports = <1>;
};

View File

@ -148,6 +148,14 @@ define Device/zyxel_nsa310b
endef
TARGET_DEVICES += zyxel_nsa310b
define Device/zyxel_nsa310s
DEVICE_VENDOR := ZyXEL
DEVICE_MODEL := NSA310S
DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug
DEVICE_DTS := kirkwood-nsa310s
endef
TARGET_DEVICES += zyxel_nsa310s
define Device/zyxel_nsa325
DEVICE_VENDOR := ZyXEL
DEVICE_MODEL := NSA325

View File

@ -0,0 +1,4 @@
config BANANA_PI_BOOT_PARTSIZE
int "Boot (SD Card) filesystem partition size (in MiB)"
depends on TARGET_mediatek_mt7623_DEVICE_bpi_bananapi-r2 || TARGET_DEVICE_mediatek_mt7623_DEVICE_bpi_bananapi-r2
default 32

View File

@ -0,0 +1,145 @@
#!/bin/sh
#
# Copyright © 2019 Alexey Loukianov <lx2@lexa2.ru>
# Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# Generates a bootable SD card image for Banana Pi R2 (and probably
# other similar boards) as documented at
# http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage
#
# The first sector must contain the SDMMC_BOOT header shown
# below, and also contains the MBR partition table in the end
# of the sector. The partition table must contain no active
# partitions.
#
# The second sector must contain the BRLYT header, and the
# special preloader image goes in sector 4; 2KiB into the image.
#
# The preloader loads U-Boot from sector 640; 320KiB into the image.
# The location and the size (512KiB) are fixed and not read from
# the partition table. We set up a partition for it merely for
# our own convenience for upgrades, etc.
#
# The second partition is a FAT file system containing the kernel
# image and a uboot.env file, which is provided to this script as
# $4 (bootfs image). Its size is configurable with the
# CONFIG_BANANA_PI_BOOT_PARTSIZE option; by default 32MiB.
#
# The root filesystem comes next in the third partition.
#
#
# ------------------------ Sector Offset
# | MBR + SDMMC_BOOT | 0 0x0
# |----------------------|
# | BRLYT header | 1 0x200
# |----------------------|
# . .
# . .
# |----------------------|
# | | 4 0x800
# | |
# | Preloader |
# . .
# . .
# | | 639
# |----------------------|
# | MBR partition #1 | 640 0x50000
# | |
# | U-Boot |
# . .
# . .
# | | 1663
# |----------------------|
# | MBR partition #2 |
# | |
# | FAT partition | ( BANANA_PI_BOOT_PARTSIZE
# . . default 32MiB )
# . (kernel, uEnv) .
# | |
# |----------------------|
# | MBR partition #3 |
# | |
# | Root partition |
# | | ( TARGET_ROOTFS_PARTSIZE
# | (squashfs+overlay | default 104MiB )
# . or ext4, etc.) .
# . .
# | |
# ------------------------
#
# For eMMC boot, everything up to and including the preloader must be
# written to /dev/mmcblk0boot0, with the SDMMC_BOOT header changed to
# read EMMC_BOOT\0 instead.
#
# The contents of the main eMMC are identical to the SD card layout,
# with the preloader loading 512KiB of U-Boot starting at 0x50000.
function usage() {
echo "SYNTAX: $0 sd <file> <preloader image> <u-boot image> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
echo " OR: $0 emmc <file> <preloader image>"
exit 1
}
set -e
PRELOADER_OFFSET=2 # 2KiB
SDMMC_BOOT="SDMMC_BOOT\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
EMMC_BOOT="EMMC_BOOT\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00"
BRLYT="BRLYT\x00\x00\x00\x01\x00\x00\x00\x00\x08\x00\x00\
\x00\x08\x00\x00\x42\x42\x42\x42\x08\x00\x01\x00\x00\x08\x00\x00\
\x00\x08\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
case $1 in
sd)
[ $# -eq 8 ] || usage
OUTPUT="$2"
PRELOADER="$3"
UBOOT="$4"
BOOTFS="$5"
ROOTFS="$6"
BOOTFSSIZE="$7"
ROOTFSSIZE="$8"
head=4
sect=63
set $(ptgen -o $OUTPUT -h $head -s $sect -a 0 -l 1024 \
-t 41 -p 512k@320k \
-t c -p ${BOOTFSSIZE}M \
-t 83 -p ${ROOTFSSIZE}M )
UBOOT_OFFSET="$(($1 / 512))"
UBOOT_SIZE="$(($2 / 512))"
BOOTFS_OFFSET="$(($3 / 512))"
BOOTFS_SIZE="$(($4 / 512))"
ROOTFS_OFFSET="$(($5 / 512))"
ROOTFS_SIZE="$(($6 / 512))"
echo -en "${SDMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0 conv=notrunc
echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
dd bs=512 if="${UBOOT}" of="${OUTPUT}" seek="${UBOOT_OFFSET}" conv=notrunc
dd bs=512 if="${BOOTFS}" of="${OUTPUT}" seek="${BOOTFS_OFFSET}" conv=notrunc
dd bs=512 if="${ROOTFS}" of="${OUTPUT}" seek="${ROOTFS_OFFSET}" conv=notrunc
dd bs=128k if=/dev/zero of="${OUTPUT}" count=1 oflag=append conv=notrunc
;;
emmc)
[ $# -eq 3 ] || usage
OUTPUT="$2"
PRELOADER="$3"
echo -en "${EMMC_BOOT}" | dd bs=1 of="${OUTPUT}" seek=0
echo -en "${BRLYT}" | dd bs=1 of="${OUTPUT}" seek=512 conv=notrunc
dd bs=1024 if="${PRELOADER}" of="${OUTPUT}" seek="${PRELOADER_OFFSET}" conv=notrunc
;;
*)
usage
;;
esac

View File

@ -1,10 +1,42 @@
KERNEL_LOADADDR := 0x80008000
ifneq ($(CONFIG_BANANA_PI_BOOT_PARTSIZE),)
BOOTFS_BLOCK_SIZE := 1024
BOOTFS_BLOCKS := $(shell echo $$(($(CONFIG_BANANA_PI_BOOT_PARTSIZE)*1024*1024/$(BOOTFS_BLOCK_SIZE))))
endif
define Build/banana-pi-sdcard
rm -f $@.boot
mkfs.fat -C $@.boot $(BOOTFS_BLOCKS)
./gen_banana_pi_img.sh emmc $@.emmc \
$(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-preloader.bin
mkenvimage -s 0x2000 -o $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-uboot.env $(UBOOT_TARGET)-uEnv.txt
mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-uboot.env ::uboot.env
mcopy -i $@.boot $(IMAGE_KERNEL) ::uImage
mcopy -i $@.boot $@.emmc ::eMMCboot.bin
./gen_banana_pi_img.sh sd $@ \
$(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-preloader.bin \
$(STAGING_DIR_IMAGE)/$(UBOOT_TARGET)-u-boot.bin \
$@.boot \
$(IMAGE_ROOTFS) \
$(CONFIG_BANANA_PI_BOOT_PARTSIZE) \
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
endef
define Device/bpi_bananapi-r2
DEVICE_VENDOR := Bpi
DEVICE_MODEL := Banana Pi R2
DEVICE_DTS := mt7623n-bananapi-bpi-r2
SUPPORTED_DEVICES := bananapi,bpi-r2
DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
UBOOT_TARGET := mt7623n_bpir2
IMAGES := img.gz
IMAGE/img.gz := banana-pi-sdcard | gzip | append-metadata
KERNEL := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL_INITRAMFS :=
endef
TARGET_DEVICES += bpi_bananapi-r2
@ -13,9 +45,9 @@ define Device/unielec_u7623-02-emmc-512m
DEVICE_MODEL := U7623-02
DEVICE_VARIANT := eMMC/512MB RAM
DEVICE_DTS := mt7623a-unielec-u7623-02-emmc-512m
DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
mkf2fs e2fsprogs
IMAGES := sysupgrade-emmc.bin.gz
IMAGE/sysupgrade-emmc.bin.gz := sysupgrade-emmc | gzip | append-metadata
DEVICE_PACKAGES := kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 kmod-mmc \
mkf2fs e2fsprogs kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
endef
TARGET_DEVICES += unielec_u7623-02-emmc-512m

View File

@ -0,0 +1,78 @@
# Boot menu for Banana Pi R2
# Copyright © 2020 David Woodhouse <dwmw2@infradead.org>
kernel=uImage
loadaddr=0x88000000
dtaddr=0x83f00000
fdt_high=0xffffffff
console=ttyS2,115200
bootopts=rootfstype=squashfs,ext4 rootwait
# Create the command line (with appropriate root=) and boot the Linux FIT image.
boot1=setenv bootargs "console=${console} root=${rootdev} ${bootopts}";printenv bootargs;\
fatload mmc ${partition} ${loadaddr} ${kernel}; bootm
# The preloader leaves a breadcrumb behind to say what it booted from.
checkbootedfrom=if itest.l *81dffff0 == 434d4d65 ; then setenv bootedfrom eMMC; else setenv bootedfrom SD; fi;
# Build the boot menu one item at a time
bm_count=0
checkkernel=test -e mmc ${bm_part} ${kernel}
addbm=if run checkkernel; then setenv bootmenu_${bm_count} "Boot from ${bm_dev}.=setenv partition ${bm_part};setenv rootdev ${bm_root};run boot1";if test "${bootedfrom}" = "${bm_dev}"; then setenv bootmenu_default ${bm_count};fi;setexpr bm_count ${bm_count} + 1; fi
# Here we assume that SD card id mmcblk1 and eMMC is mmcblk0 in linux. Swap them if your DTS define them in reverse order.
addeMMCbm=setenv bm_part 0:2;setenv bm_root /dev/mmcblk0p3;setenv bm_dev eMMC;run addbm
addSDbm=setenv bm_part 1:2;setenv bm_root /dev/mmcblk1p3;setenv bm_dev SD;run addbm
addinstallbm=if test "${bootedfrom}" = "SD";then run checkinstall; if run validparts; then setenv bootmenu_${bm_count} "Install OpenWrt from SD to internal eMMC.=run doinstall";setexpr bm_count ${bm_count} + 1;fi;fi
runbootmenu=if test "${bootedfrom}" = "";then run checkbootedfrom;fi;\
setenv bm_count 0;run addeMMCbm;run addSDbm;run addinstallbm;setenv bootmenu_${bm_count};\
bootmenu
bootdelay=0
bootcmd=run checkbootedfrom;run runbootmenu
# XX: Can we read this from the device, or must we trust they're all the same as mine?
# Probably not that important as we're unlikely ever to hit the limit anyway.
maxsect=0xe8ffff
validparts=false
# We could use 'part size' here but I'd like to check the types too.
checkinstall=mmc dev 1;\
mmc read 0x88000002 0 1;\
setenv validparts true;\
test -e mmc 1:2 eMMCboot.bin || setenv validparts false && echo "eMMCboot.bin not present on SD partition 2";\
if run validparts && itest.b *0x880001c4 != 0x41; then echo "SD partition 1 is not a PReP Boot partition"; setenv validparts false; fi;\
if run validparts && itest.l *0x880001c8 != 0x280; then echo "SD partition 1 does not start at 320KiB for U-Boot"; mmc part; exit; fi;\
if run validparts && itest.l *0x880001cc != 0x400; then echo "SD partition 1 is not 512KiB in size for U-Boot"; mmc part; exit; fi;\
if run validparts && itest.b *0x880001d4 != 0x0c; then echo "SD partition 2 is not a FAT32 partition"; setenv validparts false; fi;\
if run validparts && itest.b *0x880001e4 != 0x83; then echo "SD partition 3 is not a Linux partition"; setenv validparts false; fi;\
setexpr.l part2_start *0x880001d8;setexpr.l part2_len *0x880001dc;setexpr.l part3_start *0x880001e8;setexpr.l part3_len *0x880001ec;\
if run validparts && test 0x${part2_start} -gt ${maxsect}; then echo "SD partition 2 start too high"; setenv validparts false; fi;\
if run validparts && test 0x${part2_len} -gt ${maxsect}; then echo "SD partition 2 is too large"; setenv validparts false; fi;\
if run validparts && test 0x${part3_start} -gt ${maxsect}; then echo "SD partition 3 start too high"; setenv validparts false; fi;\
if run validparts && test 0x${part3_len} -gt ${maxsect}; then echo "SD partition 2 is too large"; setenv validparts false; fi;\
setexpr.l part2_end 0x$(part2_start} + 0x${part2_len};setexpr.l part3_end 0x${part3_start} + 0x${part3_len};\
if run validparts && test 0x${part2_end} -ge ${maxsect}; then echo "SD partition 2 end too high"; setenv validparts false; fi;\
if run validparts && test 0x${part3_end} -ge ${maxsect}; then echo "SD partition 3 end too high"; setenv validparts false; fi;
# Copy a single chunk, up to 0x8000 sectors / 16MiB, from SD to eMMC at the specified offset.
writechunk=setenv thislen 8000; if test 0x${partlen} -lt 0x${thislen}; then setenv thislen ${partlen};fi;\
mmc dev 1;mmc read ${loadaddr} 0x${partofs} 0x${thislen};\
mmc dev 0; mmc write ${loadaddr} 0x${partofs} 0x${thislen};\
setexpr partofs 0x${partofs} + 0x${thislen};setexpr partlen 0x${partlen} - 0x${thislen}
# Copy a partition defined by ${partofs} / ${partlen} from SD to eMMC
writepart=while test 0x${partlen} -ne 0; do run writechunk; done
# Configure the eMMC boot partition and write eMMCboot.bin to it
writeboot=mmc partconf 0 1 1 0;fatload mmc 1:2 ${loadaddr} eMMCboot.bin;\
setexpr filesize ${filesize} + 0x1ff;setexpr blocks ${filesize} / 0x200;\
mmc dev 0 1;mmc write ${loadaddr} 0 ${blocks}
# Install OpenWrt from the SD card to internal eMMC.
doinstall=run checkinstall;if run validparts;then run writeboot;\
echo "Copying preloader and U-Boot";setenv partofs 0;setenv partlen 680;run writepart;\
echo "Copying FAT boot partition";setenv partofs ${part2_start};setenv partlen ${part2_len};run writepart;\
echo "Copying root partition";setenv partofs ${part3_start};setenv partlen ${part3_len};run writepart;\
echo "Installed OpenWrt to eMMC";setenv bootedfrom eMMC;run runbootmenu;fi

View File

@ -6,7 +6,7 @@ define KernelPackage/ata-ahci-mtk
$(LINUX_DIR)/drivers/ata/libahci_platform.ko
AUTOLOAD:=$(call AutoLoad,40,libahci libahci_platform ahci_mtk,1)
$(call AddDepends/ata)
DEPENDS+=@TARGET_mediatek_mt7622
DEPENDS+=@(TARGET_mediatek_mt7622||TARGET_mediatek_mt7623)
endef
define KernelPackage/ata-ahci-mtk/description

View File

@ -1,23 +1,19 @@
# Copyright (C) 2018 OpenWrt.org
RECOVERY_PART=/dev/mmcblk0p1
. /lib/functions.sh
. /lib/functions/system.sh
preinit_set_mac_address() {
set_recovery_mac_address() {
local RECOVERY_PART="$1"
local mac
. /lib/functions.sh
. /lib/functions/system.sh
case $(board_name) in
unielec,u7623-02-emmc-512m)
if [ -b $RECOVERY_PART ]; then
insmod nls_cp437
insmod nls_iso8859-1
insmod fat
insmod vfat
mkdir -p /tmp/recovery
mount -o rw,noatime $RECOVERY_PART /tmp/recovery
if [ -b $RECOVERY_PART ]; then
insmod nls_cp437
insmod nls_iso8859-1
insmod fat
insmod vfat
mkdir -p /tmp/recovery
if mount -o rw,noatime $RECOVERY_PART -t vfat /tmp/recovery; then
if [ -f "/tmp/recovery/mac_addr" ];
then
mac=$(cat /tmp/recovery/mac_addr)
@ -28,17 +24,34 @@ preinit_set_mac_address() {
sync
umount /tmp/recovery
rm -rf /tmp/recovery
rmdir /tmp/recovery
ip link set dev wan address $mac 2> /dev/null
mac=$(macaddr_add $mac 1)
ip link set dev lan0 address $mac 2>/dev/null
ip link set dev lan1 address $mac 2>/dev/null
ip link set dev lan2 address $mac 2>/dev/null
ip link set dev lan3 address $mac 2>/dev/null
fi
fi
}
ip link set dev wan address $mac 2> /dev/null
preinit_set_mac_address() {
local rootpart
mac=$(macaddr_add $mac 1)
ip link set dev lan0 address $mac 2>/dev/null
ip link set dev lan1 address $mac 2>/dev/null
ip link set dev lan2 address $mac 2>/dev/null
ip link set dev lan3 address $mac 2>/dev/null
case $(board_name) in
bananapi,bpi-r2)
rootpart=$(cat /proc/cmdline)
rootpart="${rootpart##*root=}"
rootpart="${rootpart%%p3 *}"
if [ "$rootpart" = "/dev/mmcblk0" -o "$rootpart" = "/dev/mmcblk1" ]; then
set_recovery_mac_address ${rootpart}p2
fi
;;
unielec,u7623-02-emmc-512m)
set_recovery_mac_address /dev/mmcblk0p1
;;
esac
}

View File

@ -2,16 +2,28 @@
. /lib/upgrade/common.sh
RECOVERY_PART=/dev/mmcblk0p1
move_config() {
if [ -b $RECOVERY_PART ]; then
local partdev partnum
case $(board_name) in
bananapi,bpi-r2)
partnum=2
;;
unielec,u7623-02-emmc-512m)
partnum=1
;;
*)
return 1
;;
esac
if export_bootdevice && export_partdevice partdev $partnum; then
insmod nls_cp437
insmod nls_iso8859-1
insmod fat
insmod vfat
mkdir -p /recovery
mount -o rw,noatime $RECOVERY_PART /recovery
mount -o rw,noatime "/dev/$partdev" -t vfat /recovery
[ -f "/recovery/$BACKUP_FILE" ] && mv -f "/recovery/$BACKUP_FILE" /
umount /recovery
fi

View File

@ -2,6 +2,75 @@ platform_do_upgrade() {
local board=$(board_name)
case "$board" in
bananapi,bpi-r2)
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
#Keep the persistent random mac address (if it exists)
mkdir -p /tmp/recovery
export_partdevice recoverydev 2
if mount -o rw,noatime "/dev/$recoverydev" -tvfat /tmp/recovery; then
[ -f "/tmp/recovery/mac_addr" ] && cp /tmp/recovery/mac_addr /tmp/
umount /tmp/recovery
fi
sync
if [ "$SAVE_PARTITIONS" = "1" ]; then
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
else
diff=1
fi
if [ -n "$diff" ]; then
get_image "$@" | dd of="/dev/$diskdev" bs=4096 conv=fsync
# Separate removal and addtion is necessary; otherwise, partition 1
# will be missing if it overlaps with the old partition 2
partx -d - "/dev/$diskdev"
partx -a - "/dev/$diskdev"
else
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
part="$(($part - 2))"
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
else
echo "Unable to find partition $part device, skipped."
fi
done < /tmp/partmap.image
#copy partition uuid
echo "Writing new UUID to /dev/$diskdev..."
get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
fi
if mount -o rw,noatime "/dev/$recoverydev" -t vfat /tmp/recovery; then
[ -f "/tmp/mac_addr" ] && cp /tmp/mac_addr /tmp/recovery
if [ "$diskdev" = "mmcblk0" -a -r /tmp/recovery/eMMCboot.bin ]; then
echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=/tmp/recovery/eMMCboot.bin of=/dev/mmcblk0boot0 conv=fsync
sync
echo 1 > /sys/block/mmcblk0boot0/force_ro
fi
sync
umount /tmp/recovery
fi
;;
unielec,u7623-02-emmc-512m)
#Keep the persisten random mac address (if it exists)
mkdir -p /tmp/recovery
@ -30,11 +99,39 @@ PART_NAME=firmware
platform_check_image() {
local board=$(board_name)
local magic="$(get_magic_long "$1")"
local diskdev partdev diff
[ "$#" -gt 1 ] && return 1
case "$board" in
bananapi,bpi-r2|\
bananapi,bpi-r2)
[ "$magic" != "53444d4d" ] && {
echo "Invalid image type."
return 1
}
export_bootdevice && export_partdevice diskdev 0 || {
echo "Unable to determine upgrade device"
return 1
}
get_partitions "/dev/$diskdev" bootdisk
#extract the boot sector from the image
get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b 2>/dev/null
get_partitions /tmp/image.bs image
#compare tables
diff="$(grep -F -x -v -f /tmp/partmap.bootdisk /tmp/partmap.image)"
rm -f /tmp/image.bs /tmp/partmap.bootdisk /tmp/partmap.image
if [ -n "$diff" ]; then
echo "Partition layout has changed. Full image will be written."
ask_bool 0 "Abort" && exit 1
return 0
fi
;;
unielec,u7623-02-emmc-512m)
[ "$magic" != "27051956" ] && {
echo "Invalid image type."
@ -52,17 +149,24 @@ platform_check_image() {
}
platform_copy_config_emmc() {
mkdir -p /recovery
mount -o rw,noatime /dev/mmcblk0p1 /recovery
cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
sync
umount /recovery
local partdev
if export_bootdevice && export_partdevice partdev $1; then
mkdir -p /recovery
mount -o rw,noatime "/dev/$partdev" -t vfat /recovery
cp -af "$UPGRADE_BACKUP" "/recovery/$BACKUP_FILE"
sync
umount /recovery
fi
}
platform_copy_config() {
case "$(board_name)" in
bananapi,bpi-r2)
platform_copy_config_emmc 2
;;
unielec,u7623-02-emmc-512m)
platform_copy_config_emmc
platform_copy_config_emmc 1
;;
esac
}

View File

@ -295,6 +295,7 @@ CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_WORK=y
CONFIG_JBD2=y
CONFIG_KALLSYMS=y
# CONFIG_KEYBOARD_MTK_PMIC is not set
CONFIG_LEDS_MT6323=y
CONFIG_LIBFDT=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y
@ -465,6 +466,8 @@ CONFIG_SERIAL_MCTRL_GPIO=y
CONFIG_SGL_ALLOC=y
CONFIG_SMP=y
# CONFIG_SMP_ON_UP is not set
# CONFIG_SND_SOC_MT6797 is not set
# CONFIG_SND_SOC_MT8183 is not set
CONFIG_SPARSE_IRQ=y
CONFIG_SPI=y
CONFIG_SPI_BITBANG=y

View File

@ -7,8 +7,8 @@ SUBTARGET:=mt7623
BOARDNAME:=MT7623
CPU_TYPE:=cortex-a7
CPU_SUBTYPE:=neon-vfpv4
KERNELNAME:=Image dtbs zImage
FEATURES+=ext4 usb
define Target/Description
Build firmware images for MediaTek mt7623 ARM based boards.

View File

@ -0,0 +1,163 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "edimax,re23s", "mediatek,mt7621-soc";
model = "Edimax RE23S";
aliases {
led-boot = &led_power;
led-failsafe = &led_wifi_red;
led-running = &led_power;
led-upgrade = &led_power;
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,57600";
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "re23s:green:power";
gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
};
wifi_green {
label = "re23s:green:wifi";
gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
};
wifi_amber {
label = "re23s:amber:wifi";
gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
};
led_wifi_red: wifi_red {
label = "re23s:red:wifi";
gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};
&spi0 {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
m25p,fast-read;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x0 0x30000>;
read-only;
};
partition@30000 {
label = "config";
reg = <0x30000 0x10000>;
read-only;
};
factory: partition@40000 {
label = "factory";
reg = <0x40000 0x10000>;
read-only;
};
partition@50000 {
label = "cimage";
reg = <0x50000 0x20000>;
read-only;
};
partition@70000 {
compatible = "edimax,uimage";
label = "firmware";
reg = <0x70000 0xf50000>;
};
partition@fc0000 {
label = "freespace";
reg = <0xfc0000 0x40000>;
read-only;
};
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
ieee80211-freq-limit = <2400000 2500000>;
};
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0x8004>;
};
&switch0 {
ports {
port@4 {
status = "okay";
label = "lan";
};
};
};
&state_default {
gpio {
groups = "uart3", "uart2", "jtag", "wdt";
function = "gpio";
};
};
&xhci {
status = "disabled";
};

View File

@ -23,13 +23,15 @@
};
wifi2g {
label = "re650-v1:blue:wifi2G";
label = "re650-v1:blue:wifi2g";
gpios = <&gpio 23 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wifi5g {
label = "re650-v1:blue:wifi5G";
label = "re650-v1:blue:wifi5g";
gpios = <&gpio 24 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
wps_red {

View File

@ -0,0 +1,41 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621_xiaomi_router-ac2100.dtsi"
/ {
compatible = "xiaomi,mi-router-ac2100", "mediatek,mt7621-soc";
model = "Xiaomi Mi Router AC2100";
aliases {
led-boot = &led_status_yellow;
led-failsafe = &led_status_yellow;
led-running = &led_status_blue;
led-upgrade = &led_status_blue;
label-mac-device = &gmac0;
};
leds {
compatible = "gpio-leds";
wan_yellow {
label = "mi-router-ac2100:yellow:wan";
gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
};
wan_blue {
label = "mi-router-ac2100:blue:wan";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
};
led_status_yellow: status_yellow {
label = "mi-router-ac2100:yellow:status";
gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
};
led_status_blue: status_blue {
label = "mi-router-ac2100:blue:status";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
};
};

View File

@ -1,10 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "mt7621_xiaomi_router-ac2100.dtsi"
/ {
compatible = "xiaomi,redmi-router-ac2100", "mediatek,mt7621-soc";
@ -18,10 +15,6 @@
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,115200n8";
};
leds {
compatible = "gpio-leds";
@ -45,139 +38,4 @@
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "Config";
reg = <0x80000 0x40000>;
};
partition@c0000 {
label = "Bdata";
reg = <0xc0000 0x40000>;
read-only;
};
factory: partition@100000 {
label = "factory";
reg = <0x100000 0x40000>;
read-only;
};
partition@140000 {
label = "crash";
reg = <0x140000 0x40000>;
};
partition@180000 {
label = "crash_syslog";
reg = <0x180000 0x40000>;
};
partition@1c0000 {
label = "reserved0";
reg = <0x1c0000 0x40000>;
read-only;
};
/* We keep stock xiaomi firmware (kernel0) here */
partition@200000 {
label = "kernel_stock";
reg = <0x200000 0x400000>;
};
partition@600000 {
label = "kernel";
reg = <0x600000 0x400000>;
};
partition@a00000 {
label = "ubi";
reg = <0xa00000 0x7580000>;
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
port@2 {
status = "okay";
label = "lan1";
};
port@3 {
status = "okay";
label = "lan2";
};
port@4 {
status = "okay";
label = "lan3";
};
};
};
&state_default {
gpio {
groups = "uart2", "uart3", "wdt";
function = "gpio";
};
};

View File

@ -0,0 +1,146 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
chosen {
bootargs = "console=ttyS0,115200n8";
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "Config";
reg = <0x80000 0x40000>;
};
partition@c0000 {
label = "Bdata";
reg = <0xc0000 0x40000>;
read-only;
};
factory: partition@100000 {
label = "factory";
reg = <0x100000 0x40000>;
read-only;
};
partition@140000 {
label = "crash";
reg = <0x140000 0x40000>;
};
partition@180000 {
label = "crash_syslog";
reg = <0x180000 0x40000>;
};
partition@1c0000 {
label = "reserved0";
reg = <0x1c0000 0x40000>;
read-only;
};
/* We keep stock xiaomi firmware (kernel0) here */
partition@200000 {
label = "kernel_stock";
reg = <0x200000 0x400000>;
};
partition@600000 {
label = "kernel";
reg = <0x600000 0x400000>;
};
partition@a00000 {
label = "ubi";
reg = <0xa00000 0x7580000>;
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x8000>;
ieee80211-freq-limit = <5000000 6000000>;
};
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0000>;
ieee80211-freq-limit = <2400000 2500000>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
port@2 {
status = "okay";
label = "lan1";
};
port@3 {
status = "okay";
label = "lan2";
};
port@4 {
status = "okay";
label = "lan3";
};
};
};
&state_default {
gpio {
groups = "uart2", "uart3", "wdt";
function = "gpio";
};
};

View File

@ -0,0 +1,178 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "zyxel,wap6805", "mediatek,mt7621-soc";
model = "ZyXEL WAP6805";
aliases {
led-boot = &led_status_green;
led-failsafe = &led_status_red;
led-running = &led_status_green;
led-upgrade = &led_status_green;
label-mac-device = &gmac0;
};
chosen {
bootargs = "console=ttyS0,57600";
};
leds {
compatible = "gpio-leds";
led_status_red: status_red {
label = "wap6805:red:status";
gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
};
status_blink {
label = "wap6805:blink:status";
gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
};
led_status_green: status_green {
label = "wap6805:green:status";
gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
};
};
keys {
compatible = "gpio-keys";
wps {
label = "wps";
gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x100000>;
read-only;
};
partition@100000 {
label = "MRD";
reg = <0x100000 0x100000>;
read-only;
};
factory: partition@200000 {
label = "Factory";
reg = <0x200000 0x100000>;
read-only;
};
partition@300000 {
label = "Config";
reg = <0x300000 0x100000>;
};
partition@400000 {
label = "Kernel";
reg = <0x400000 0x2000000>;
};
partition@800000 {
label = "ubi";
reg = <0x800000 0x1c00000>;
};
partition@2400000 {
label = "Kernel2";
reg = <0x2400000 0x2000000>;
};
partition@4400000 {
label = "Private";
reg = <0x4400000 0x100000>;
};
partition@4500000 {
label = "Log";
reg = <0x4500000 0x1000000>;
};
partition@5500000 {
label = "App";
reg = <0x5500000 0x2b00000>;
};
};
};
&pcie {
status = "okay";
};
&pcie0 {
mt76@0,0 {
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&gmac1 {
status = "okay";
fixed-link {
speed = <1000>;
full-duplex;
};
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan4";
};
port@1 {
status = "okay";
label = "lan3";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
};
};
&xhci {
status = "disabled";
};
&state_default {
gpio {
groups = "i2c", "uart3", "jtag", "wdt";
function = "gpio";
};
};

Some files were not shown because too many files have changed in this diff Show More