Merge Official Source

Keep iptables for now.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-01-24 19:03:56 +08:00
commit 5b8437bf43
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
258 changed files with 8425 additions and 1082 deletions

View File

@ -14,7 +14,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir
world:
DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep -E '\/usr' | head -n 1)
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -E '\/usr' | head -n 1)
export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
ifneq ($(OPENWRT_BUILD),1)

View File

@ -296,7 +296,7 @@ menu "Target Images"
config TARGET_ROOTFS_PARTSIZE
int "Root filesystem partition size (in MiB)"
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS || TARGET_omap || TARGET_sunxi || TARGET_uml
depends on USES_ROOTFS_PART || TARGET_ROOTFS_EXT4FS
default 160
help
Select the root filesystem partition size.

View File

@ -10,7 +10,7 @@ ifneq ($(CONFIG_USE_LLVM_HOST),)
else
BPF_PATH:=$(PATH)
endif
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' command -v clang clang-13 clang-12 clang-11))
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
endif
ifneq ($(CONFIG_USE_LLVM_PREBUILT),)

View File

@ -24,7 +24,7 @@ MAKE_PATH = $(firstword $(CMAKE_BINARY_SUBDIR) .)
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
cmake_tool=$(TOOLCHAIN_DIR)/bin/$(1)
else
cmake_tool=$(shell which $(1))
cmake_tool=$(shell command -v $(1))
endif
ifeq ($(CONFIG_CCACHE),)

View File

@ -51,6 +51,7 @@ HOST_CONFIGURE_VARS = \
CFLAGS="$(HOST_CFLAGS)" \
CXX="$(HOSTCXX)" \
CPPFLAGS="$(HOST_CPPFLAGS)" \
CXXFLAGS="$(HOST_CXXFLAGS)" \
LDFLAGS="$(HOST_LDFLAGS)" \
CONFIG_SHELL="$(SHELL)"

View File

@ -196,6 +196,10 @@ define Build/check-size
}
endef
define Build/copy-file
cat "$(1)" > "$@"
endef
define Build/elecom-product-header
$(eval product=$(word 1,$(1)))
$(eval fw=$(if $(word 2,$(1)),$(word 2,$(1)),$@))

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.10 = .90
LINUX_KERNEL_HASH-5.10.90 = 945e4264c014a3d9dfc0a4639309dd1ec2fb545416556421f931b95da78c2725
LINUX_VERSION-5.10 = .92
LINUX_KERNEL_HASH-5.10.92 = d5750380a51d3f1d7ab1dd64451752e321c987e0b0099bcd452187d9a76ebb52

View File

@ -1,2 +1,2 @@
LINUX_VERSION-5.4 = .170
LINUX_KERNEL_HASH-5.4.170 = b09f74e0cf5fc7cf5de6aa932fe654c962cb10118bdbbdddb397022c6e6d382c
LINUX_VERSION-5.4 = .172
LINUX_KERNEL_HASH-5.4.172 = b19e890b67e8293008262d3518cab47be58462c63da43f2c9832d63644886ce4

View File

@ -49,7 +49,7 @@ endef
define RequireCommand
define Require/$(1)
which $(1)
command -v $(1)
endef
$$(eval $$(call Require,$(1),$(2)))
@ -103,7 +103,7 @@ define SetupHostCommand
$(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
if [ -n "$$$$$$$$cmd" ]; then \
bin="$$$$$$$$(PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
which "$$$$$$$${cmd%% *}")"; \
command -v "$$$$$$$${cmd%% *}")"; \
if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
mkdir -p "$(STAGING_DIR_HOST)/bin"; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \

View File

@ -103,6 +103,7 @@ netgear,wndr4300tn|\
netgear,wndr4300sw)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000"
;;
openmesh,om2p-v1|\
openmesh,om2p-v2|\
openmesh,om2p-v4|\
openmesh,om2p-hs-v1|\

View File

@ -17,6 +17,10 @@ bananapi,bpi-r2)
export_bootdevice
export_partdevice ubootpart 1
ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1"
;;
unielec,u7623-02)
ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1"
;;
esac
config_load ubootenv

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2021.10
PKG_HASH:=cde723e19262e646f2670d25e5ec4b1b368490de950d4e26275a988c36df0bd4
PKG_VERSION:=2022.01
PKG_HASH:=81b4543227db228c03f8a1bf5ddbc813b0bb8f6555ce46064ef721a6fc680413
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
include $(INCLUDE_DIR)/u-boot.mk
@ -78,7 +78,7 @@ endef
define U-Boot/mt7623a_unielec_u7623
NAME:=UniElec U7623 (mt7623)
BUILD_DEVICES:=unielec_u7623-emmc unielec_u7623-02-emmc-512m-legacy
BUILD_DEVICES:=unielec_u7623-02
BUILD_SUBTARGET:=mt7623
UBOOT_CONFIG:=mt7623a_unielec_u7623_02
endef

View File

@ -10,7 +10,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -87,7 +87,7 @@ static int clk_get_by_index_tail(int ret
@@ -88,7 +88,7 @@ static int clk_get_by_index_tail(int ret
if (ret) {
debug("%s: uclass_get_device_by_of_offset failed: err=%d\n",
__func__, ret);
@ -19,7 +19,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}
clk->dev = dev_clk;
@@ -100,15 +100,14 @@ static int clk_get_by_index_tail(int ret
@@ -101,15 +101,14 @@ static int clk_get_by_index_tail(int ret
ret = clk_of_xlate_default(clk, args);
if (ret) {
debug("of_xlate() failed: %d\n", ret);
@ -37,7 +37,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}
static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
@@ -127,7 +126,7 @@ static int clk_get_by_indexed_prop(struc
@@ -128,7 +127,7 @@ static int clk_get_by_indexed_prop(struc
if (ret) {
debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
__func__, ret);
@ -46,7 +46,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
}
@@ -502,7 +501,6 @@ int clk_free(struct clk *clk)
@@ -501,7 +500,6 @@ int clk_free(struct clk *clk)
ulong clk_get_rate(struct clk *clk)
{
const struct clk_ops *ops;
@ -54,7 +54,7 @@ This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
debug("%s(clk=%p)\n", __func__, clk);
if (!clk_valid(clk))
@@ -512,11 +510,7 @@ ulong clk_get_rate(struct clk *clk)
@@ -511,11 +509,7 @@ ulong clk_get_rate(struct clk *clk)
if (!ops->get_rate)
return -ENOSYS;

View File

@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/include/configs/mt7622.h
+++ b/include/configs/mt7622.h
@@ -36,6 +36,7 @@
@@ -30,6 +30,7 @@
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
@ -25,7 +25,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
#endif
--- a/include/configs/mt7623.h
+++ b/include/configs/mt7623.h
@@ -54,6 +54,7 @@
@@ -45,6 +45,7 @@
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2
@ -35,7 +35,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/include/configs/mt7629.h
+++ b/include/configs/mt7629.h
@@ -52,5 +52,6 @@
@@ -45,5 +45,6 @@
/* Ethernet */
#define CONFIG_IPADDR 192.168.1.1
#define CONFIG_SERVERIP 192.168.1.2

View File

@ -38,15 +38,15 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -109,6 +109,8 @@ config HBMC_AM654
This is the driver for HyperBus controller on TI's AM65x and
other SoCs
@@ -116,6 +116,8 @@ config STM32_FLASH
This is the driver of embedded flash for some STMicroelectronics
STM32 MCU.
+source "drivers/mtd/mtk-snand/Kconfig"
+
source "drivers/mtd/nand/Kconfig"
source "drivers/mtd/spi/Kconfig"
config SYS_NAND_MAX_CHIPS
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -39,3 +39,5 @@ obj-$(CONFIG_$(SPL_TPL_)SPI_FLASH_SUPPOR
@ -1145,7 +1145,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+}
--- /dev/null
+++ b/drivers/mtd/mtk-snand/mtk-snand-mtd.c
@@ -0,0 +1,526 @@
@@ -0,0 +1,524 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
@ -1225,9 +1225,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+ else
+ instr->state = MTD_ERASE_DONE;
+
+ if (!ret)
+ mtd_erase_callback(instr);
+ else
+ if (ret)
+ ret = -EIO;
+
+ return ret;

View File

@ -19,7 +19,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -50,6 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;
@@ -48,6 +48,7 @@ DECLARE_GLOBAL_DATA_PTR;
defined(CONFIG_ENV_IS_IN_MMC) || \
defined(CONFIG_ENV_IS_IN_FAT) || \
defined(CONFIG_ENV_IS_IN_EXT4) || \
@ -27,7 +27,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
defined(CONFIG_ENV_IS_IN_NAND) || \
defined(CONFIG_ENV_IS_IN_NVRAM) || \
defined(CONFIG_ENV_IS_IN_ONENAND) || \
@@ -64,7 +65,7 @@ DECLARE_GLOBAL_DATA_PTR;
@@ -62,7 +63,7 @@ DECLARE_GLOBAL_DATA_PTR;
#if !defined(ENV_IS_IN_DEVICE) && \
!defined(CONFIG_ENV_IS_NOWHERE)
@ -47,7 +47,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
help
Define this if you don't want to or can't have an environment stored
on a storage medium. In this case the environment will still exist
@@ -207,6 +207,27 @@ config ENV_IS_IN_MMC
@@ -208,6 +208,27 @@ config ENV_IS_IN_MMC
This value is also in units of bytes, but must also be aligned to
an MMC sector boundary.
@ -75,7 +75,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
config ENV_IS_IN_NAND
bool "Environment in a NAND device"
depends on !CHAIN_OF_TRUST
@@ -534,10 +555,16 @@ config ENV_ADDR_REDUND
@@ -535,10 +556,16 @@ config ENV_ADDR_REDUND
Offset from the start of the device (or partition) of the redundant
environment location.
@ -93,7 +93,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
default 0x88000 if ARCH_SUNXI
@@ -582,6 +609,12 @@ config ENV_SECT_SIZE
@@ -583,6 +610,12 @@ config ENV_SECT_SIZE
help
Size of the sector containing the environment.
@ -389,7 +389,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+};
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -131,6 +131,7 @@ enum env_location {
@@ -130,6 +130,7 @@ enum env_location {
ENVL_FAT,
ENVL_FLASH,
ENVL_MMC,

View File

@ -85,49 +85,6 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
snor: snor@11014000 {
compatible = "mediatek,mtk-snor";
reg = <0x11014000 0x1000>;
--- a/board/mediatek/mt7629/Kconfig
+++ b/board/mediatek/mt7629/Kconfig
@@ -12,6 +12,39 @@ config MTK_SPL_PAD_SIZE
config MTK_BROM_HEADER_INFO
string
- default "media=nor"
+ default "media=nor" if BOOT_FROM_SNOR
+ default "media=snand;nandinfo=2k+64" if BOOT_FROM_SNAND_2K_64
+ default "media=snand;nandinfo=2k+128" if BOOT_FROM_SNAND_2K_128
+ default "media=snand;nandinfo=4k+128" if BOOT_FROM_SNAND_4K_128
+ default "media=snand;nandinfo=4k+256" if BOOT_FROM_SNAND_4K_256
+
+choice
+ prompt "Boot device"
+ default BOOT_FROM_SNOR
+
+config BOOT_FROM_SNOR
+ bool "SPI-NOR"
+
+config BOOT_FROM_SNAND_2K_64
+ bool "SPI-NAND (2K+64)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_2K_128
+ bool "SPI-NAND (2K+128)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_4K_128
+ bool "SPI-NAND (4K+128)"
+ select MT7629_BOOT_FROM_SNAND
+
+config BOOT_FROM_SNAND_4K_256
+ bool "SPI-NAND (4K+256)"
+ select MT7629_BOOT_FROM_SNAND
+
+endchoice
+
+config MT7629_BOOT_FROM_SNAND
+ bool
+ default n
endif
--- /dev/null
+++ b/configs/mt7629_nand_rfb_defconfig
@@ -0,0 +1,111 @@
@ -244,7 +201,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
+# CONFIG_EFI_LOADER is not set
--- a/include/configs/mt7629.h
+++ b/include/configs/mt7629.h
@@ -30,12 +30,19 @@
@@ -25,12 +25,19 @@
/* Defines for SPL */
#define CONFIG_SPL_STACK 0x106000

View File

@ -55,7 +55,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
reg = <0x11014000 0x1000>;
--- a/configs/mt7622_rfb_defconfig
+++ b/configs/mt7622_rfb_defconfig
@@ -15,6 +15,7 @@ CONFIG_LOG=y
@@ -16,6 +16,7 @@ CONFIG_LOG=y
CONFIG_SYS_PROMPT="MT7622> "
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_MMC=y
@ -63,7 +63,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
CONFIG_CMD_PCI=y
CONFIG_CMD_SF_TEST=y
CONFIG_CMD_PING=y
@@ -27,6 +28,10 @@ CONFIG_SYSCON=y
@@ -28,6 +29,10 @@ CONFIG_SYSCON=y
CONFIG_CLK=y
CONFIG_MMC_HS200_SUPPORT=y
CONFIG_MMC_MTK=y

View File

@ -14,7 +14,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
--- a/configs/mt7629_rfb_defconfig
+++ b/configs/mt7629_rfb_defconfig
@@ -28,9 +28,14 @@ CONFIG_SPL_WATCHDOG=y
@@ -29,9 +29,14 @@ CONFIG_SPL_WATCHDOG=y
CONFIG_HUSH_PARSER=y
CONFIG_SYS_PROMPT="U-Boot> "
CONFIG_CMD_BOOTMENU=y

View File

@ -21,7 +21,7 @@ Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
CONFIG_DEBUG_UART_BASE=0x11002000
CONFIG_DEBUG_UART_CLOCK=25000000
CONFIG_DEBUG_UART=y
@@ -21,6 +23,9 @@ CONFIG_CMD_SF_TEST=y
@@ -22,6 +24,9 @@ CONFIG_CMD_SF_TEST=y
CONFIG_CMD_PING=y
CONFIG_CMD_SMC=y
CONFIG_ENV_OVERWRITE=y

View File

@ -1,6 +1,6 @@
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -118,7 +118,6 @@ dumpimage-mkimage-objs := aisimage.o \
@@ -119,7 +119,6 @@ dumpimage-mkimage-objs := aisimage.o \
imximage.o \
imx8image.o \
imx8mimage.o \

View File

@ -1,6 +1,6 @@
--- a/Makefile
+++ b/Makefile
@@ -1051,7 +1051,7 @@ quiet_cmd_pad_cat = CAT $@
@@ -1045,7 +1045,7 @@ quiet_cmd_pad_cat = CAT $@
cmd_pad_cat = $(cmd_objcopy) && $(append) || { rm -f $@; false; }
quiet_cmd_lzma = LZMA $@

View File

@ -66,9 +66,9 @@
static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1962,6 +1962,51 @@ static const char *fit_get_image_type_pr
--- a/boot/image-fit.c
+++ b/boot/image-fit.c
@@ -1993,6 +1993,51 @@ static const char *fit_get_image_type_pr
return "unknown";
}
@ -122,7 +122,7 @@
int arch, int image_type, int bootstage_id,
--- a/include/image.h
+++ b/include/image.h
@@ -996,6 +996,7 @@ int fit_parse_subimage(const char *spec,
@@ -952,6 +952,7 @@ int fit_parse_subimage(const char *spec,
ulong *addr, const char **image_name);
int fit_get_subimage_count(const void *fit, int images_noffset);

View File

@ -1,6 +1,6 @@
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -484,6 +484,12 @@ config CMD_ENV_EXISTS
@@ -483,6 +483,12 @@ config CMD_ENV_EXISTS
Check if a variable is defined in the environment for use in
shell scripting.
@ -15,7 +15,7 @@
help
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -473,6 +473,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in
@@ -408,6 +408,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in
}
#endif
@ -76,7 +76,7 @@
#if defined(CONFIG_CMD_ENV_CALLBACK)
static int print_static_binding(const char *var_name, const char *callback_name,
void *priv)
@@ -1377,6 +1431,9 @@ static struct cmd_tbl cmd_env_sub[] = {
@@ -1189,6 +1243,9 @@ static struct cmd_tbl cmd_env_sub[] = {
U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""),
#endif
U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""),
@ -86,7 +86,7 @@
#if defined(CONFIG_CMD_RUN)
U_BOOT_CMD_MKENT(run, CONFIG_SYS_MAXARGS, 1, do_run, "", ""),
#endif
@@ -1465,6 +1522,9 @@ static char env_help_text[] =
@@ -1277,6 +1334,9 @@ static char env_help_text[] =
#if defined(CONFIG_CMD_NVEDIT_EFI)
"env print -e [-guid guid] [-n] [name ...] - print UEFI environment\n"
#endif
@ -96,7 +96,7 @@
#if defined(CONFIG_CMD_RUN)
"env run var [...] - run commands in an environment variable\n"
#endif
@@ -1574,6 +1634,17 @@ U_BOOT_CMD(
@@ -1386,6 +1446,17 @@ U_BOOT_CMD(
);
#endif

View File

@ -17,13 +17,12 @@
DECLARE_GLOBAL_DATA_PTR;
@@ -20,7 +27,20 @@ int board_init(void)
@@ -20,7 +27,19 @@ int board_init(void)
int board_late_init(void)
{
- gd->env_valid = 1; //to load environment variable from persistent store
+ struct udevice *dev;
+ int ret;
+
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
+ puts("reset button found\n");
@ -39,11 +38,11 @@
env_relocate();
return 0;
}
--- a/board/mediatek/mt7622/Kconfig
+++ b/board/mediatek/mt7622/Kconfig
@@ -14,4 +14,8 @@ config MTK_BROM_HEADER_INFO
string
default "media=nor"
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -115,4 +115,8 @@ config MTK_BROM_HEADER_INFO
default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
default "lk=1" if TARGET_MT7623
+config RESET_BUTTON_LABEL
+ string "Button to trigger factory reset"

View File

@ -0,0 +1,43 @@
--- a/board/mediatek/mt7623/mt7623_rfb.c
+++ b/board/mediatek/mt7623/mt7623_rfb.c
@@ -4,8 +4,17 @@
*/
#include <common.h>
+#include <dm.h>
+#include <button.h>
+#include <env.h>
+#include <init.h>
#include <mmc.h>
#include <asm/global_data.h>
+#include <linux/delay.h>
+
+#ifndef CONFIG_RESET_BUTTON_LABEL
+#define CONFIG_RESET_BUTTON_LABEL "reset"
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -41,3 +50,22 @@ int mmc_get_env_dev(void)
return mmc_get_boot_dev();
}
#endif
+
+int board_late_init(void)
+{
+ struct udevice *dev;
+
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
+ puts("reset button found\n");
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
+#endif
+ if (button_get_state(dev) == BUTTON_ON) {
+ puts("button pushed, resetting environment\n");
+ gd->env_valid = ENV_INVALID;
+ }
+ }
+
+ env_relocate();
+ return 0;
+}

View File

@ -1,6 +1,6 @@
--- a/drivers/mtd/spi/spi-nor-ids.c
+++ b/drivers/mtd/spi/spi-nor-ids.c
@@ -353,6 +353,8 @@ const struct flash_info spi_nor_ids[] =
@@ -369,6 +369,8 @@ const struct flash_info spi_nor_ids[] =
SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB)
},
{ INFO("w25q256", 0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

View File

@ -1,6 +1,6 @@
--- a/configs/mt7623n_bpir2_defconfig
+++ b/configs/mt7623n_bpir2_defconfig
@@ -4,52 +4,137 @@ CONFIG_ARCH_MEDIATEK=y
@@ -4,53 +4,138 @@ CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x81e00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
CONFIG_NR_DRAM_BANKS=1
@ -12,6 +12,7 @@
+CONFIG_DEFAULT_DEVICE_TREE="mt7623n-bananapi-bpi-r2"
+CONFIG_USE_DEFAULT_ENV_FILE=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_SYS_LOAD_ADDR=0x84000000
CONFIG_FIT=y
-CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
@ -243,60 +244,3 @@
};
&eth {
--- a/board/mediatek/mt7623/mt7623_rfb.c
+++ b/board/mediatek/mt7623/mt7623_rfb.c
@@ -6,6 +6,17 @@
#include <common.h>
#include <mmc.h>
#include <asm/global_data.h>
+#include <config.h>
+#include <dm.h>
+#include <button.h>
+#include <env.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <linux/delay.h>
+
+#ifndef CONFIG_RESET_BUTTON_LABEL
+#define CONFIG_RESET_BUTTON_LABEL "reset"
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -17,6 +28,25 @@ int board_init(void)
return 0;
}
+int board_late_init(void)
+{
+ struct udevice *dev;
+
+ if (!button_get_by_label(CONFIG_RESET_BUTTON_LABEL, &dev)) {
+ puts("reset button found\n");
+#ifdef CONFIG_RESET_BUTTON_SETTLE_DELAY
+ mdelay(CONFIG_RESET_BUTTON_SETTLE_DELAY);
+#endif
+ if (button_get_state(dev) == BUTTON_ON) {
+ puts("button pushed, resetting environment\n");
+ gd->env_valid = ENV_INVALID;
+ }
+ }
+
+ env_relocate();
+ return 0;
+}
+
#ifdef CONFIG_MMC
int mmc_get_boot_dev(void)
{
--- a/board/mediatek/mt7623/Kconfig
+++ b/board/mediatek/mt7623/Kconfig
@@ -10,4 +10,8 @@ config MTK_BROM_HEADER_INFO
string
default "lk=1"
+config RESET_BUTTON_LABEL
+ string "Button to trigger factory reset"
+ default "reset"
+
endif

View File

@ -1,15 +1,202 @@
--- a/configs/mt7623a_unielec_u7623_02_defconfig
+++ b/configs/mt7623a_unielec_u7623_02_defconfig
@@ -51,3 +51,12 @@ CONFIG_TIMER=y
CONFIG_MTK_TIMER=y
CONFIG_WDT_MTK=y
CONFIG_LZMA=y
@@ -4,51 +4,135 @@ CONFIG_ARCH_MEDIATEK=y
CONFIG_SYS_TEXT_BASE=0x81e00000
CONFIG_SYS_MALLOC_F_LEN=0x4000
CONFIG_NR_DRAM_BANKS=1
-CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_SIZE=0x10000
CONFIG_ENV_OFFSET=0x100000
CONFIG_DEFAULT_DEVICE_TREE="mt7623a-unielec-u7623-02-emmc"
+CONFIG_USE_DEFAULT_ENV_FILE=y
CONFIG_TARGET_MT7623=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_SYS_LOAD_ADDR=0x84000000
CONFIG_FIT=y
-CONFIG_FIT_VERBOSE=y
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
+CONFIG_LED=y
+CONFIG_LED_BLINK=y
+CONFIG_LED_GPIO=y
+CONFIG_LOGLEVEL=7
+CONFIG_LOG=y
+CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
+CONFIG_BOARD_LATE_INIT=y
CONFIG_BOOTDELAY=3
+CONFIG_BOOTP_SEND_HOSTNAME=y
CONFIG_DEFAULT_FDT_FILE="mt7623a-unielec-u7623-02-emmc.dtb"
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
+CONFIG_DEFAULT_ENV_FILE="unielec_u7623-02_env"
+CONFIG_BUTTON=y
+CONFIG_BUTTON_GPIO=y
+CONFIG_RESET_BUTTON_LABEL="factory"
+CONFIG_CFB_CONSOLE_ANSI=y
+CONFIG_CMD_ENV_FLAGS=y
# CONFIG_DISPLAY_BOARDINFO is not set
-CONFIG_SYS_PROMPT="U-Boot> "
+CONFIG_SYS_PROMPT="MT7623> "
CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_BOOTP=y
+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="0:2"
+CONFIG_ENV_FAT_FILE="uboot.env"
+CONFIG_CMD_BUTTON=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_CDP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_DM=y
+CONFIG_CMD_DNS=y
+CONFIG_CMD_ECHO=y
+CONFIG_CMD_ENV_READMEM=y
+CONFIG_CMD_ERASEENV=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_FS_UUID=y
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_XIMG is not set
CONFIG_CMD_GPIO=y
-CONFIG_CMD_GPT=y
+# CONFIG_CMD_GPT is not set
+CONFIG_CMD_HASH=y
+CONFIG_CMD_ITEST=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_LINK_LOCAL=y
+CONFIG_CMD_MBR=y
CONFIG_CMD_MMC=y
-CONFIG_CMD_READ=y
-# CONFIG_CMD_SETEXPR is not set
# CONFIG_CMD_NFS is not set
-CONFIG_ENV_IS_IN_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_PXE=y
+CONFIG_CMD_PWM=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_TFTPBOOT=y
+CONFIG_CMD_TFTPSRV=y
+CONFIG_CMD_ASKENV=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_RARP=y
+CONFIG_CMD_SATA=y
+CONFIG_CMD_SETEXPR=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SNTP=y
+CONFIG_CMD_SOURCE=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_UUID=y
+CONFIG_CMD_READ=y
+CONFIG_CMD_SCSI=y
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DM_ETH=y
+CONFIG_DM_GPIO=y
+CONFIG_DM_SCSI=y
+CONFIG_DM_MMC=y
+CONFIG_DM_MTD=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_SERIAL=y
+CONFIG_DM_REGULATOR_GPIO=y
+CONFIG_DM_USB=y
+CONFIG_DM_PCI=y
+CONFIG_DM_PWM=y
+CONFIG_AHCI=y
+CONFIG_AHCI_PCI=y
+CONFIG_SCSI_AHCI=y
+CONFIG_SCSI=y
+CONFIG_PWM_MTK=y
+CONFIG_HUSH_PARSER=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SYS_MMC_ENV_DEV=0
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_IS_IN_MMC=y
CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_NETCONSOLE=y
CONFIG_REGMAP=y
CONFIG_SYSCON=y
CONFIG_CLK=y
+CONFIG_LZMA=y
+CONFIG_MEDIATEK_ETH=y
# CONFIG_MMC_QUIRKS is not set
CONFIG_SUPPORT_EMMC_BOOT=y
CONFIG_MMC_HS400_SUPPORT=y
CONFIG_MMC_MTK=y
+CONFIG_MTK_POWER_DOMAIN=y
+CONFIG_MTK_SERIAL=y
+CONFIG_MTK_TIMER=y
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_PARTITION_UUIDS=y
+CONFIG_PCI=y
+CONFIG_PCIE_MEDIATEK=y
+CONFIG_PHY=y
CONFIG_PHY_FIXED=y
-CONFIG_DM_ETH=y
-CONFIG_MEDIATEK_ETH=y
CONFIG_PINCTRL=y
CONFIG_PINCONF=y
CONFIG_PINCTRL_MT7623=y
CONFIG_POWER_DOMAIN=y
-CONFIG_MTK_POWER_DOMAIN=y
-CONFIG_DM_SERIAL=y
-CONFIG_MTK_SERIAL=y
+CONFIG_RANDOM_UUID=y
+CONFIG_REGEX=y
CONFIG_SYSRESET=y
CONFIG_SYSRESET_WATCHDOG=y
CONFIG_TIMER=y
-CONFIG_MTK_TIMER=y
+CONFIG_VERSION_VARIABLE=y
CONFIG_WDT_MTK=y
-CONFIG_LZMA=y
--- /dev/null
+++ b/unielec_u7623-02_env
@@ -0,0 +1,47 @@
+ipaddr=192.168.1.1
+serverip=192.168.1.254
+loadaddr=0x88000000
+dtaddr=0x83f00000
+console=earlycon=uart8250,mmio32,0x11004000 console=ttyS0,115200
+initrd_high=0xafffffff
+part_default=3
+part_recovery=2
+bootcmd=run boot_mmc
+bootdelay=0
+bootfile=openwrt-mediatek-mt7623-unielec_u7623-02-initramfs-recovery.itb
+bootfile_upg=openwrt-mediatek-mt7623-unielec_u7623-02-squashfs-sysupgrade.itb
+bootled_rec=u7623-01:green:led3
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
+bootmenu_default=0
+bootmenu_delay=0
+bootmenu_title= ( ( ( OpenWrt ) ) )
+bootmenu_0=Initialize environment.=run _firstboot
+bootmenu_0d=Run default boot command.=run boot_default
+bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
+bootmenu_2=Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
+bootmenu_3=Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
+bootmenu_4=Load production system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return
+bootmenu_6=Reboot.=reset
+bootmenu_7=Reset all settings to factory defaults.=run reset_factory ; reset
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever
+boot_first=if button factory ; then led $bootled_rec on ; run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu
+boot_production=run emmc_read_production && bootm $loadaddr
+boot_recovery=run emmc_read_recovery && bootm $loadaddr
+boot_tftp_forever=led bpi-r64:pio:blue on ; while true ; do run boot_tftp_recovery ; sleep 1 ; done
+boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run emmc_write_production ; if env exists noboot ; then else bootm $loadaddr ; fi
+boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run emmc_write_recovery ; if env exists noboot ; then else bootm $loadaddr ; fi
+boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr
+boot_mmc=run boot_production ; run boot_recovery
+emmc_write_production=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_write_vol
+emmc_write_recovery=mmc dev 0 0 ; iminfo $loadaddr && part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_write_vol
+emmc_read_production=mmc dev 0 0 ; part start mmc 0 $part_default part_addr && part size mmc 0 $part_default part_size && run mmc_read_vol
+emmc_read_recovery=mmc dev 0 0 ; part start mmc 0 $part_recovery part_addr && part size mmc 0 $part_recovery part_size && run mmc_read_vol
+mmc_write_vol=imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc erase 0x$part_addr 0x$part_size && mmc write $loadaddr 0x$part_addr 0x$image_size
+mmc_read_vol=mmc read $loadaddr $part_addr 0x8 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr 0x$part_addr 0x$image_size && setexpr filesize $image_size * 0x200
+reset_factory=eraseenv && reset
+_init_env=setenv _init_env ; saveenv ; saveenv
+_firstboot=setenv _firstboot ; run _switch_to_menu _update_bootdev _init_env boot_first
+_update_bootdev=setenv _update_bootdev ; setenv bootargs "$console root=/dev/mmcblk0p65"
+_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"

View File

@ -1,12 +1,13 @@
--- /dev/null
+++ b/configs/mt7622_bananapi_bpi-r64-sdmmc_defconfig
@@ -0,0 +1,158 @@
@@ -0,0 +1,159 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7622=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_LOAD_ADDR=0x40080000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOOTP_SEND_HOSTNAME=y
@ -246,13 +247,14 @@
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- /dev/null
+++ b/configs/mt7622_bananapi_bpi-r64-emmc_defconfig
@@ -0,0 +1,145 @@
@@ -0,0 +1,146 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7622=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_LOAD_ADDR=0x40080000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOOTP_SEND_HOSTNAME=y
@ -453,12 +455,13 @@
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- /dev/null
+++ b/configs/mt7622_bananapi_bpi-r64-snand_defconfig
@@ -0,0 +1,139 @@
@@ -0,0 +1,140 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_LOAD_ADDR=0x40080000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOOTP_SEND_HOSTNAME=y

View File

@ -1,12 +1,13 @@
--- /dev/null
+++ b/configs/mt7622_linksys_e8450_defconfig
@@ -0,0 +1,135 @@
@@ -0,0 +1,136 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7622=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_LOAD_ADDR=0x40080000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_BOARD_LATE_INIT=y
+CONFIG_BOOTP_SEND_HOSTNAME=y
@ -336,7 +337,7 @@
+};
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1104,6 +1104,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
@@ -1133,6 +1133,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7622-rfb.dtb \
mt7623a-unielec-u7623-02-emmc.dtb \
mt7622-bananapi-bpi-r64.dtb \

View File

@ -1,12 +1,13 @@
--- /dev/null
+++ b/configs/mt7622_ubnt_unifi-6-lr_defconfig
@@ -0,0 +1,140 @@
@@ -0,0 +1,141 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7622=y
+CONFIG_SYS_TEXT_BASE=0x41e00000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_LOAD_ADDR=0x40080000
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:128k(bl2),640k(fip),64k(u-boot-env),256k(factory),64k(eeprom),15232k(recovery),-(firmware)"
+CONFIG_ENV_IS_IN_MTD=y
@ -348,7 +349,7 @@
+};
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1105,6 +1105,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
@@ -1134,6 +1134,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7623a-unielec-u7623-02-emmc.dtb \
mt7622-bananapi-bpi-r64.dtb \
mt7622-linksys-e8450-ubi.dtb \
@ -411,7 +412,7 @@
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver"
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -77,6 +77,7 @@
@@ -78,6 +78,7 @@
#ifdef CONFIG_EFI_SETUP_EARLY
#include <efi_loader.h>
#endif
@ -419,7 +420,7 @@
DECLARE_GLOBAL_DATA_PTR;
@@ -416,6 +417,21 @@ static int initr_onenand(void)
@@ -417,6 +418,21 @@ static int initr_onenand(void)
}
#endif

View File

@ -0,0 +1,21 @@
--- a/board/mediatek/mt7623/mt7623_rfb.c
+++ b/board/mediatek/mt7623/mt7623_rfb.c
@@ -9,6 +9,7 @@
#include <env.h>
#include <init.h>
#include <mmc.h>
+#include <part.h>
#include <asm/global_data.h>
#include <linux/delay.h>
@@ -31,8 +32,9 @@ int mmc_get_boot_dev(void)
{
int g_mmc_devid = -1;
char *uflag = (char *)0x81DFFFF0;
+ struct blk_desc *desc;
- if (!find_mmc_device(1))
+ if (blk_get_device_by_str("mmc", "1", &desc) < 0)
return 0;
if (strncmp(uflag,"eMMC",4)==0) {

View File

@ -27,6 +27,7 @@ endef
ALLWIFIBOARDS:= \
8dev_habanero-dvk \
aruba_ap-303 \
asus_rt-ac42u \
avm_fritzrepeater-1200 \
buffalo_wtr-m2133hp \
cellc_rtl30vw \
@ -116,6 +117,7 @@ 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,asus_rt-ac42u,ASUS RT-AC42U))
$(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))

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,47 @@
This removes -static compile option. The -static option tells GCC to
link this statically with the libc, which we do not want in OpenWrt. We
want to link everything dynamically to the libc. This fixes a compile
problem with glibc.
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -198,10 +198,10 @@ AM_CFLAGS = -Wall -Wimplicit -Wunused -W
if IFXOS_ENABLE
AM_LDFLAGS= \
- -Bstatic -dn -static @IFXOS_LIBRARY_PATH@
+ -Bstatic -dn @IFXOS_LIBRARY_PATH@
else
AM_LDFLAGS= \
- -Bstatic -dn -static
+ -Bstatic -dn
endif
#
@@ -304,7 +304,7 @@ mei_cpe_appl_ldflags= $(ADD_APPL_LDFLAGS
else
if TARGET_ADM5120_MIPSEL
mei_cpe_appl_cflags = -O1 -g
-mei_cpe_appl_ldflags = -static
+mei_cpe_appl_ldflags =
else
mei_cpe_appl_cflags = -DPPC
endif
@@ -318,7 +318,7 @@ mei_cpe_drv_test_CPPFLAGS = -I@srcdir@\
mei_cpe_drv_test_CFLAGS = $(mei_cpe_app_common_cflags) \
$(mei_cpe_appl_cflags) $(MEI_DRV_TARGET_OPTIONS)
-mei_cpe_drv_test_LDFLAGS = $(mei_cpe_appl_ldflags) -Bstatic -dn -static @IFXOS_LIBRARY_PATH@
+mei_cpe_drv_test_LDFLAGS = $(mei_cpe_appl_ldflags) -Bstatic -dn @IFXOS_LIBRARY_PATH@
mei_cpe_drv_test_LDADD = -lifxos
endif
@@ -333,7 +333,7 @@ mei_cpe_drv_dbg_strm_dmp_CPPFLAGS = -I@s
-I@KERNEL_INCL_PATH@ $(IFXOS_INCLUDE_PATH)
mei_cpe_drv_dbg_strm_dmp_CFLAGS = $(mei_cpe_app_common_cflags) \
$(mei_cpe_appl_cflags) $(MEI_DRV_TARGET_OPTIONS)
-mei_cpe_drv_dbg_strm_dmp_LDFLAGS = $(mei_cpe_appl_ldflags) -Bstatic -dn -static @IFXOS_LIBRARY_PATH@
+mei_cpe_drv_dbg_strm_dmp_LDFLAGS = $(mei_cpe_appl_ldflags) -Bstatic -dn @IFXOS_LIBRARY_PATH@
mei_cpe_drv_dbg_strm_dmp_LDADD = -lifxos
# linux 2.6 kernel object - dummy to force dependencies

View File

@ -348,6 +348,21 @@ endef
$(eval $(call KernelPackage,hwmon-nct6775))
define KernelPackage/hwmon-nct7802
TITLE:=NCT7802Y and compatibles monitoring support
KCONFIG:=CONFIG_SENSORS_NCT7802
FILES:=$(LINUX_DIR)/drivers/hwmon/nct7802.ko
AUTOLOAD:=$(call AutoProbe,nct7802)
$(call AddDepends/hwmon,+kmod-regmap-i2c)
endef
define KernelPackage/hwmon-nct7802/description
Kernel module for NCT7802Y thermal monitor chip
endef
$(eval $(call KernelPackage,hwmon-nct7802))
define KernelPackage/hwmon-pc87360
TITLE:=PC87360 monitoring support
KCONFIG:=CONFIG_SENSORS_PC87360

View File

@ -1713,7 +1713,8 @@ define KernelPackage/usb3
+TARGET_bcm53xx:kmod-usb-bcma \
+TARGET_bcm53xx:kmod-phy-bcm-ns-usb3 \
+TARGET_ramips_mt7621:kmod-usb-xhci-mtk \
+(TARGET_apm821xx_nand&&LINUX_5_10):kmod-usb-xhci-pci-renesas
+(TARGET_apm821xx_nand&&LINUX_5_10):kmod-usb-xhci-pci-renesas \
+TARGET_mvebu_cortexa9:kmod-usb-xhci-pci-renesas
KCONFIG:= \
CONFIG_USB_PCI=y \
CONFIG_USB_XHCI_PCI \

View File

@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ustream-ssl
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustream-ssl.git
PKG_SOURCE_DATE:=2020-12-10
PKG_SOURCE_VERSION:=68d09243b6fd4473004b27ff6483352e76e6af1a
PKG_MIRROR_HASH:=a620090dee08c0624d167c10e9e45d54aa2b953a1f356eff7325a8fe53c622e6
PKG_SOURCE_DATE:=2022-01-16
PKG_SOURCE_VERSION:=868fd8812f477c110f9c6c5252c0bd172167b94c
PKG_MIRROR_HASH:=dd28d5e846b391917cf83d66176653bdfa4e8a0d5b11144b65a012fe7693ddeb
CMAKE_INSTALL:=1
PKG_LICENSE:=ISC

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ipip
PKG_RELEASE:=3
PKG_RELEASE:=4
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk

View File

@ -12,7 +12,7 @@ proto_ipip_setup() {
local remoteip
local df ipaddr peeraddr tunlink ttl tos zone mtu
json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu
json_get_vars df ipaddr peeraddr tunlink ttl tos zone mtu nohostroute
[ -z "$peeraddr" ] && {
proto_notify_error "$cfg" "MISSING_PEER_ADDRESS"
@ -32,7 +32,9 @@ proto_ipip_setup() {
break
done
( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
if [ "${nohostroute}" != "1" ]; then
( proto_add_host_dependency "$cfg" "$peeraddr" "$tunlink" )
fi
[ -z "$ipaddr" ] && {
local wanif="$tunlink"
@ -84,6 +86,7 @@ proto_ipip_init_config() {
proto_config_add_string "ipaddr"
proto_config_add_string "peeraddr"
proto_config_add_boolean "df"
proto_config_add_boolean "nohostroute"
}
[ -n "$INCLUDE_ONLY" ] || {

View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
PKG_SOURCE_DATE:=2022-01-14
PKG_SOURCE_VERSION:=3043206e94da412eb19dd72ea68edcaca545d84c
PKG_MIRROR_HASH:=2bf5a59e93968b00f69b8b7ebbdfd28353c36bc5e7f72225d725c24d0ac7265f
PKG_SOURCE_DATE:=2022-01-22
PKG_SOURCE_VERSION:=ed7187684685430ee6de49e551775badbee39761
PKG_MIRROR_HASH:=f26e968c79e61b1a4495b29f51e4adfb2238ede16c0d7349cce38ac009b72969
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=GPL-2.0

View File

@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mtd-utils
PKG_VERSION:=2.1.2
PKG_VERSION:=2.1.4
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=ftp://ftp.infradead.org/pub/mtd-utils/
PKG_HASH:=8ad4c5f34716d40646aa28724a2f5616d325a6f119254f914e26976f1f76e9d6
PKG_SOURCE_URL:=https://infraroot.at/pub/mtd/
PKG_HASH:=2c6711d15d282c47cb3867b6857340597e26d332c238465134c602e5eef71b99
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf

View File

@ -1,6 +1,6 @@
--- a/jffsX-utils/Makemodule.am
+++ b/jffsX-utils/Makemodule.am
@@ -4,11 +4,19 @@ mkfs_jffs2_SOURCES = \
@@ -4,7 +4,10 @@ mkfs_jffs2_SOURCES = \
jffsX-utils/compr_zlib.c \
jffsX-utils/compr.h \
jffsX-utils/rbtree.c \
@ -10,7 +10,12 @@
+ jffsX-utils/lzma/LzmaEnc.c \
+ jffsX-utils/lzma/LzmaDec.c \
jffsX-utils/compr.c \
jffsX-utils/compr_rtime.c
jffsX-utils/compr_rtime.c \
jffsX-utils/compr.h \
@@ -12,8 +15,13 @@ mkfs_jffs2_SOURCES = \
jffsX-utils/summary.h \
include/linux/jffs2.h \
include/mtd/jffs2-user.h
+
+if !WITHOUT_LZO
+mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c
@ -20,7 +25,7 @@
-mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS)
+mkfs_jffs2_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) -I./include/linux/lzma
jffs2reader_SOURCES = jffsX-utils/jffs2reader.c
jffs2reader_SOURCES = jffsX-utils/jffs2reader.c include/mtd/jffs2-user.h
jffs2reader_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS)
--- a/jffsX-utils/compr.c
+++ b/jffsX-utils/compr.c

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ucode
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git

View File

@ -0,0 +1,11 @@
--- a/lib.c
+++ b/lib.c
@@ -1438,7 +1438,7 @@ uc_printf_common(uc_vm_t *vm, size_t nar
switch (t) {
case UC_INTEGER:
- ucv_stringbuf_printf(buf, sfmt, arg.n);
+ ucv_stringbuf_printf(buf, sfmt, (int)arg.n);
break;
case UC_DOUBLE:

View File

@ -443,6 +443,15 @@ define Package/swap-utils/description
contains: mkswap, swaplabel
endef
define Package/taskset
$(call Package/util-linux/Default)
TITLE:=set or retrieve a process's CPU affinity
endef
define Package/taskset/description
contains: taskset
endef
define Package/unshare
$(call Package/util-linux/Default)
TITLE:=unshare userspace tool
@ -761,6 +770,11 @@ define Package/swap-utils/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/swaplabel $(1)/usr/sbin/
endef
define Package/taskset/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/taskset $(1)/usr/bin/
endef
define Package/unshare/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/unshare $(1)/usr/bin/
@ -829,6 +843,7 @@ $(eval $(call BuildPackage,script-utils))
$(eval $(call BuildPackage,setterm))
$(eval $(call BuildPackage,sfdisk))
$(eval $(call BuildPackage,swap-utils))
$(eval $(call BuildPackage,taskset))
$(eval $(call BuildPackage,unshare))
$(eval $(call BuildPackage,uuidd))
$(eval $(call BuildPackage,uuidgen))

View File

@ -240,6 +240,7 @@ export PKG_CONFIG
HOSTCC:=gcc
HOSTCXX:=g++
HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include)
HOST_CXXFLAGS:=
HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS)
HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib)

11
scripts/command_all.sh Executable file
View File

@ -0,0 +1,11 @@
#! /bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Reduced version of which -a using command utility
case $PATH in
(*[!:]:) PATH="$PATH:" ;;
esac
for ELEMENT in $(echo $PATH | tr ":" "\n"); do
PATH=$ELEMENT command -v "$@"
done

View File

@ -54,10 +54,8 @@ sub localmirrors {
sub which($) {
my $prog = shift;
my $res = `which $prog`;
my $res = `command -v $prog`;
$res or return undef;
$res =~ /^no / and return undef;
$res =~ /not found/ and return undef;
return $res;
}

View File

@ -14,7 +14,7 @@ chdir $ENV{TOPDIR};
$ENV{GIT_CONFIG_PARAMETERS}="'core.autocrlf=false'";
$ENV{GREP_OPTIONS}="";
my $mk=`which gmake 2>/dev/null`; # select the right 'make' program
my $mk=`command -v gmake 2>/dev/null`; # select the right 'make' program
chomp($mk); # trim trailing newline
$mk or $mk = "make"; # default to 'make'

View File

@ -134,7 +134,7 @@ if [ ! -r "$rootfs" -a ! -r "$kernel" -a ! "$outfile" ]; then
exit 1
fi
ubinize="$( which ubinize )"
ubinize="$( command -v ubinize )"
if [ ! -x "$ubinize" ]; then
echo "ubinize tool not found or not usable"
exit 1

View File

@ -28,10 +28,6 @@ define Build/boot-script
$@.scr
endef
define Build/copy-file
cat "$(1)" > "$@"
endef
define Build/dtb
$(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb,,--space $(DTB_SIZE))
endef

View File

@ -1,6 +0,0 @@
config defaults
option syn_flood 1
option input ACCEPT
option output ACCEPT
option forward REJECT

View File

@ -74,6 +74,7 @@ CONFIG_GPIO_74X164=y
CONFIG_GPIO_ATH79=y
CONFIG_GPIO_GENERIC=y
# CONFIG_GPIO_LATCH is not set
# CONFIG_GPIO_RB91X_KEY is not set
CONFIG_HANDLE_DOMAIN_IRQ=y
CONFIG_HARDWARE_WATCHPOINTS=y
CONFIG_HAS_DMA=y

View File

@ -0,0 +1,170 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar7240.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "openmesh,om2p-v1", "qca,ar7240";
model = "OpenMesh OM2P v1";
chosen {
/delete-property/ bootargs;
};
aliases {
led-boot = &led_power_blue;
led-failsafe = &led_power_blue;
led-running = &led_power_blue;
led-upgrade = &led_power_blue;
label-mac-device = &eth0;
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&switch_led_disable_pins>;
led_power_blue: power_blue {
label = "blue:power";
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
default-state = "on";
};
wifi_green {
label = "green:wifi";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wifi_red {
label = "red:wifi";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
wifi_yellow {
label = "yellow:wifi";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
lan_blue {
label = "blue:lan";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
};
wan_blue {
label = "blue:wan";
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
};
};
watchdog {
compatible = "linux,wdt-gpio";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
hw_algo = "toggle";
/* hw_margin_ms is actually 300s but driver limits it to 60s */
hw_margin_ms = <60000>;
always-running;
};
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <40000000>;
linux,mtd-name = "ar7240-nor0";
/* partitions are passed via bootloader */
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>;
};
partition@80000 {
label = "custom";
reg = <0x080000 0x140000>;
read-only;
};
partition@1c0000 {
label = "inactive";
reg = <0x1c0000 0x700000>;
};
partition@8c0000 {
label = "inactive2";
reg = <0x8c0000 0x700000>;
};
art: partition@fc0000 {
label = "ART";
reg = <0xfc0000 0x040000>;
read-only;
};
};
};
};
&eth0 {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
};
&eth1 {
status = "okay";
nvmem-cells = <&macaddr_art_6>;
nvmem-cell-names = "mac-address";
};
&pcie {
status = "okay";
wifi@0,0 {
compatible = "pci168c,002a";
reg = <0x0000 0 0 0 0>;
qca,no-eeprom;
#gpio-cells = <2>;
gpio-controller;
};
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
macaddr_art_6: macaddr@6 {
reg = <0x6 0x6>;
};
};

View File

@ -16,6 +16,13 @@
led-upgrade = &led_power;
};
gpio_key: gpio_key {
compatible = "mikrotik,gpio-rb91x-key";
gpio-controller;
#gpio-cells = <2>;
gpio = <&gpio 15 GPIO_ACTIVE_HIGH>;
};
gpio_latch: gpio_latch {
compatible = "gpio-latch";
gpio-controller;
@ -27,7 +34,7 @@
<0>, /* Not connected */
<&gpio 13 GPIO_ACTIVE_HIGH>,
<&gpio 14 GPIO_ACTIVE_HIGH>,
<&gpio 15 GPIO_ACTIVE_HIGH>,
<&gpio_key 0 GPIO_ACTIVE_HIGH>,
<&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */
};
@ -40,7 +47,8 @@
<&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */
<&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */
<&gpio 12 GPIO_ACTIVE_LOW>, /* Read/Write Enable (nRW) */
<&gpio_latch 8 GPIO_ACTIVE_LOW>; /* Latch Enable (nLE) */
<&gpio_latch 8 GPIO_ACTIVE_LOW>, /* Latch Enable (nLE) */
<&gpio_key 2 GPIO_ACTIVE_HIGH>; /* Key poll disable */
partitions {
compatible = "fixed-partitions";
@ -64,6 +72,17 @@
};
};
keys {
compatible = "gpio-keys-polled";
poll-interval = <20>;
button@0 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";

View File

@ -0,0 +1,168 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "qca953x.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "glinet,gl-xe300", "qca,qca9531";
model = "GL.iNet GL-XE300";
gpio-export {
compatible = "gpio-export";
gpio_lte_power {
gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
gpio-export,name = "lte_power";
gpio-export,output = <1>;
};
gpio_sd_detect {
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
gpio-export,name = "sd_detect";
gpio-export,output = <0>;
};
};
keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins>;
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
};
};
leds {
compatible = "gpio-leds";
lan {
gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
label = "green:lan";
};
wan {
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
label = "green:wan";
};
wlan {
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
label = "green:wlan";
linux,default-trigger = "phy0tpt";
};
lte {
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
label = "green:lte";
};
};
};
&pcie0 {
status = "okay";
};
&usb0 {
status = "okay";
};
&usb_phy {
status = "okay";
};
&spi {
status = "okay";
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
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>;
};
art: partition@50000 {
label = "art";
reg = <0x50000 0x10000>;
read-only;
};
partition@60000 {
label = "kernel";
reg = <0x60000 0x400000>;
};
partition@460000 {
label = "nor_reserved";
reg = <0x460000 0xba0000>;
};
};
};
flash@1 {
compatible = "spi-nand";
reg = <1>;
spi-max-frequency = <25000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "ubi";
reg = <0x0 0x8000000>;
};
};
};
};
&eth0 {
status = "okay";
phy-handle = <&swphy4>;
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mtd-mac-address-increment = <1>;
};
&eth1 {
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
};

View File

@ -7,26 +7,34 @@
/ {
compatible = "openmesh,om5p-ac-v2", "qca,qca9558";
model = "OpenMesh OM5P-AC V2";
model = "OpenMesh OM5P-AC v2";
extosc: ref {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-output-names = "ref";
clock-frequency = <40000000>;
chosen {
/delete-property/ bootargs;
};
aliases {
serial0 = &uart;
led-boot = &led_power_blue;
led-failsafe = &led_power_blue;
led-running = &led_power_blue;
led-upgrade = &led_power_blue;
label-mac-device = &eth0;
};
leds {
compatible = "gpio-leds";
power {
label = "blue:power";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
wifi_green {
label = "green:wifi";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
led_power_blue: power_blue {
label = "blue:power";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
default-state = "on";
};
wifi_yellow {
@ -50,6 +58,32 @@
};
};
i2c {
compatible = "i2c-gpio";
gpios = <&gpio 19 GPIO_ACTIVE_HIGH /* sda */
&gpio 18 GPIO_ACTIVE_HIGH /* scl */
>;
#address-cells = <1>;
#size-cells = <0>;
i2c-gpio,scl-open-drain;
i2c-gpio,sda-open-drain;
tmp423a@4e {
compatible = "ti,tmp423";
reg = <0x4e>;
};
};
watchdog {
compatible = "linux,wdt-gpio";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
hw_algo = "toggle";
/* hw_margin_ms is actually 300s but driver limits it to 60s */
hw_margin_ms = <60000>;
always-running;
};
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
@ -69,11 +103,11 @@
&pinmux {
pinmux_pa_dcdc_pins {
pinctrl-single,bits = <0x0 0xff00 0x0>;
pinctrl-single,bits = <0x0 0x0 0xff0000>;
};
pinmux_pa_high_pins {
pinctrl-single,bits = <0x10 0xff 0x0>;
pinctrl-single,bits = <0x10 0x0 0xff>;
};
};
@ -81,10 +115,6 @@
status = "okay";
};
&pll {
clocks = <&extosc>;
};
&spi {
status = "okay";
@ -93,6 +123,7 @@
reg = <0>;
spi-max-frequency = <25000000>;
/* partitions are passed via bootloader */
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
@ -104,19 +135,29 @@
read-only;
};
partition@1 {
partition@40000 {
label = "u-boot-env";
reg = <0x040000 0x010000>;
};
partition@2 {
compatible = "denx,uimage";
label = "firmware";
partition@50000 {
label = "custom";
reg = <0x050000 0x060000>;
read-only;
};
partition@b0000 {
label = "inactive";
reg = <0x0b0000 0x7a0000>;
};
partition@850000 {
label = "inactive2";
reg = <0x850000 0x7a0000>;
};
partition@3 {
label = "art";
art: partition@ff0000 {
label = "ART";
reg = <0xff0000 0x010000>;
read-only;
};
@ -127,18 +168,25 @@
&mdio0 {
status = "okay";
phy-mask = <0x10>;
phy4: ethernet-phy@4 {
reg = <4>;
phy-mode = "rgmii-id";
eee-broken-100tx;
eee-broken-1000t;
};
};
&mdio1 {
status = "okay";
phy-mask = <0x2>;
phy1: ethernet-phy@1 {
reg = <1>;
phy-mode = "sgmii";
eee-broken-100tx;
eee-broken-1000t;
at803x-override-sgmii-link-check;
};
};
@ -147,7 +195,20 @@
pll-data = <0x82000101 0x80000101 0x80001313>;
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
phy-mode = "rgmii-id";
phy-handle = <&phy4>;
gmac-config {
device = <&gmac>;
rgmii-enabled = <1>;
rxd-delay = <2>;
rxdv-delay = <2>;
txd-delay = <0>;
txen-delay = <0>;
};
};
&eth1 {
@ -155,5 +216,33 @@
pll-data = <0x03000101 0x80000101 0x80001313>;
nvmem-cells = <&macaddr_art_6>;
nvmem-cell-names = "mac-address";
qca955x-sgmii-fixup;
phy-handle = <&phy1>;
};
&wmac {
status = "okay";
mtd-cal-data = <&art 0x1000>;
nvmem-cells = <&macaddr_art_0>;
nvmem-cell-names = "mac-address";
mac-address-increment = <2>;
};
&art {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;
macaddr_art_0: macaddr@0 {
reg = <0x0 0x6>;
};
macaddr_art_6: macaddr@6 {
reg = <0x6 0x6>;
};
};

View File

@ -15,6 +15,7 @@
led-failsafe = &led_orange;
led-running = &led_power;
led-upgrade = &led_orange;
label-mac-device = &eth0;
};
leds {

View File

@ -62,7 +62,7 @@ gpio_latch_get(struct gpio_chip *gc, unsigned offset)
int ret;
gpio_latch_lock(glc, false);
ret = gpiod_get_value(glc->gpios[offset]);
ret = gpiod_get_raw_value_cansleep(glc->gpios[offset]);
gpio_latch_unlock(glc, false);
return ret;
@ -81,7 +81,7 @@ gpio_latch_set(struct gpio_chip *gc, unsigned offset, int value)
}
gpio_latch_lock(glc, enable_latch);
gpiod_set_raw_value(glc->gpios[offset], value);
gpiod_set_raw_value_cansleep(glc->gpios[offset], value);
gpio_latch_unlock(glc, disable_latch);
}
@ -133,8 +133,10 @@ static int gpio_latch_probe(struct platform_device *pdev)
glc->gpios[i] = devm_gpiod_get_index_optional(dev, NULL, i,
GPIOD_OUT_LOW);
if (IS_ERR(glc->gpios[i])) {
dev_err(dev, "failed to get gpio %d: %d\n", i,
PTR_ERR(glc->gpios[i]));
if (PTR_ERR(glc->gpios[i]) != -EPROBE_DEFER) {
dev_err(dev, "failed to get gpio %d: %d\n", i,
PTR_ERR(glc->gpios[i]));
}
return PTR_ERR(glc->gpios[i]);
}
}

View File

@ -0,0 +1,218 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Driver for reset key gpio line on MikroTik RB91x board series.
* This line is shared between NAND ALE (goes through a latch),
* NAND IO7 and reset key. We make 3 virtual gpio lines from the
* single physical one:
* 1) Capable output one for NAND,
* 2) Capable input one for reset key,
* 3) And capable output one, aka "key-poll-disable",
* for NAND -- to syncronise NAND operation and key polling.
*
* Copyright (C) 2021 Denis Kalashnikov <denis281089@gmail.com>
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
#include <linux/platform_device.h>
#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <linux/delay.h>
#define GPIO_RB91X_KEY_DRIVER_NAME "gpio-rb91x-key"
enum gpio_rb91x_key_gpios {
GPIO_RB91X_KEY_NAND,
GPIO_RB91X_KEY_POLL,
GPIO_RB91X_KEY_PDIS,
GPIO_RB91X_KEY_NGPIOS,
};
struct gpio_rb91x_key {
struct gpio_chip gc;
struct mutex mutex;
struct mutex poll_mutex;
int polling_disabled;
struct gpio_desc *gpio;
};
static inline struct gpio_rb91x_key *to_gpio_rb91x_key(struct gpio_chip *gc)
{
return container_of(gc, struct gpio_rb91x_key, gc);
}
static int gpio_rb91x_key_get(struct gpio_chip *gc, unsigned offset)
{
struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc);
struct gpio_desc *gpio = drvdata->gpio;
int val, bak_val;
switch (offset) {
case GPIO_RB91X_KEY_NAND:
mutex_lock(&drvdata->mutex);
val = gpiod_get_value_cansleep(gpio);
mutex_unlock(&drvdata->mutex);
break;
case GPIO_RB91X_KEY_PDIS:
mutex_lock(&drvdata->mutex);
val = drvdata->polling_disabled;
mutex_unlock(&drvdata->mutex);
break;
case GPIO_RB91X_KEY_POLL:
mutex_lock(&drvdata->poll_mutex);
mutex_lock(&drvdata->mutex);
bak_val = gpiod_get_raw_value_cansleep(gpio);
gpiod_direction_input(gpio);
/*
* Without this delay nothing works. Get it
* from mikrotik RouterOS linux kernel patches.
*/
udelay(200);
val = gpiod_get_raw_value_cansleep(gpio);
gpiod_direction_output_raw(gpio, bak_val);
mutex_unlock(&drvdata->mutex);
mutex_unlock(&drvdata->poll_mutex);
break;
default:
return -EINVAL;
}
return val;
}
static int gpio_rb91x_key_direction_input(struct gpio_chip *gc, unsigned offset)
{
switch (offset) {
case GPIO_RB91X_KEY_POLL:
return 0;
default:
return -EINVAL;
}
}
static void gpio_rb91x_key_set(struct gpio_chip *gc, unsigned offset, int value)
{
struct gpio_rb91x_key *drvdata = to_gpio_rb91x_key(gc);
struct gpio_desc *gpio = drvdata->gpio;
mutex_lock(&drvdata->mutex);
switch (offset) {
case GPIO_RB91X_KEY_NAND:
gpiod_set_raw_value_cansleep(gpio, value);
break;
case GPIO_RB91X_KEY_PDIS:
if (value) {
if (!drvdata->polling_disabled) {
mutex_lock(&drvdata->poll_mutex);
drvdata->polling_disabled = 1;
}
} else {
if (drvdata->polling_disabled) {
mutex_unlock(&drvdata->poll_mutex);
drvdata->polling_disabled = 0;
}
}
break;
default:
break;
}
mutex_unlock(&drvdata->mutex);
}
static int gpio_rb91x_key_direction_output(struct gpio_chip *gc, unsigned offset,
int value)
{
switch (offset) {
case GPIO_RB91X_KEY_NAND:
case GPIO_RB91X_KEY_PDIS:
gpio_rb91x_key_set(gc, offset, value);
return 0;
default:
return -EINVAL;
}
}
static int gpio_rb91x_key_probe(struct platform_device *pdev)
{
struct gpio_rb91x_key *drvdata;
struct gpio_chip *gc;
struct device *dev = &pdev->dev;
struct device_node *of_node = dev->of_node;
int r;
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
mutex_init(&drvdata->mutex);
mutex_init(&drvdata->poll_mutex);
drvdata->gpio = devm_gpiod_get(dev, NULL, GPIOD_OUT_LOW);
if (IS_ERR(drvdata->gpio)) {
if (PTR_ERR(drvdata->gpio) != -EPROBE_DEFER) {
dev_err(dev, "failed to get gpio: %ld\n",
PTR_ERR(drvdata->gpio));
}
return PTR_ERR(drvdata->gpio);
}
gc = &drvdata->gc;
gc->label = GPIO_RB91X_KEY_DRIVER_NAME;
gc->can_sleep = 1;
gc->base = -1;
gc->ngpio = GPIO_RB91X_KEY_NGPIOS;
gc->get = gpio_rb91x_key_get;
gc->set = gpio_rb91x_key_set;
gc->direction_output = gpio_rb91x_key_direction_output;
gc->direction_input = gpio_rb91x_key_direction_input;
gc->of_node = of_node;
platform_set_drvdata(pdev, drvdata);
r = gpiochip_add(&drvdata->gc);
if (r) {
dev_err(dev, "gpiochip_add() failed: %d\n", r);
return r;
}
return 0;
}
static int gpio_rb91x_key_remove(struct platform_device *pdev)
{
struct gpio_rb91x_key *drvdata = platform_get_drvdata(pdev);
gpiochip_remove(&drvdata->gc);
return 0;
}
static const struct of_device_id gpio_rb91x_key_match[] = {
{ .compatible = "mikrotik,"GPIO_RB91X_KEY_DRIVER_NAME },
{},
};
MODULE_DEVICE_TABLE(of, gpio_rb91x_key_match);
static struct platform_driver gpio_rb91x_key_driver = {
.probe = gpio_rb91x_key_probe,
.remove = gpio_rb91x_key_remove,
.driver = {
.name = GPIO_RB91X_KEY_DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = gpio_rb91x_key_match,
},
};
module_platform_driver(gpio_rb91x_key_driver);
MODULE_DESCRIPTION("Driver for reset key gpio line shared with NAND for MikroTik RB91x board series.");
MODULE_AUTHOR("Denis Kalashnikov <denis281089@gmail.com>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:" GPIO_RB91X_KEY_DRIVER_NAME);

View File

@ -40,6 +40,7 @@ enum rb91x_nand_gpios {
RB91X_NAND_ALE, /* Address Latch Enable */
RB91X_NAND_NRW, /* Read/Write. Active low */
RB91X_NAND_NLE, /* Latch Enable. Active low */
RB91X_NAND_PDIS, /* Reset Key Poll Disable. Active high */
RB91X_NAND_GPIOS,
};
@ -57,6 +58,12 @@ static inline void rb91x_nand_latch_lock(struct rb91x_nand_drvdata *drvdata,
gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_NLE], lock);
}
static inline void rb91x_nand_rst_key_poll_disable(struct rb91x_nand_drvdata *drvdata,
int disable)
{
gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_PDIS], disable);
}
static int rb91x_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *oobregion)
{
@ -115,6 +122,7 @@ static void rb91x_nand_write(struct rb91x_nand_drvdata *drvdata,
unsigned i;
rb91x_nand_latch_lock(drvdata, 1);
rb91x_nand_rst_key_poll_disable(drvdata, 1);
oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE);
out_reg = __raw_readl(base + AR71XX_GPIO_REG_OUT);
@ -146,6 +154,7 @@ static void rb91x_nand_write(struct rb91x_nand_drvdata *drvdata,
/* Flush write */
__raw_readl(base + AR71XX_GPIO_REG_OUT);
rb91x_nand_rst_key_poll_disable(drvdata, 0);
rb91x_nand_latch_lock(drvdata, 0);
}
@ -162,6 +171,7 @@ static void rb91x_nand_read(struct rb91x_nand_drvdata *drvdata,
gpiod_set_value_cansleep(drvdata->gpio[RB91X_NAND_READ], 1);
rb91x_nand_latch_lock(drvdata, 1);
rb91x_nand_rst_key_poll_disable(drvdata, 1);
/* Save registers */
oe_reg = __raw_readl(base + AR71XX_GPIO_REG_OE);
@ -199,6 +209,7 @@ static void rb91x_nand_read(struct rb91x_nand_drvdata *drvdata,
/* Flush write */
__raw_readl(base + AR71XX_GPIO_REG_OUT);
rb91x_nand_rst_key_poll_disable(drvdata, 0);
rb91x_nand_latch_lock(drvdata, 0);
/* Disable read mode */
@ -274,8 +285,11 @@ static int rb91x_nand_probe(struct platform_device *pdev)
gpios = gpiod_get_array(dev, NULL, GPIOD_OUT_LOW);
if (IS_ERR(gpios)) {
dev_err(dev, "failed to get gpios: %d\n", (int)gpios);
return -EINVAL;
if (PTR_ERR(gpios) != -EPROBE_DEFER) {
dev_err(dev, "failed to get gpios: %d\n",
PTR_ERR(gpios));
}
return PTR_ERR(gpios);
}
if (gpios->ndescs != RB91X_NAND_GPIOS) {

View File

@ -271,6 +271,10 @@ openmesh,om2p-hs-v4)
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0"
ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x02"
;;
openmesh,om2p-v1)
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth0"
ucidef_set_led_switch "lan" "LAN" "blue:lan" "switch0" "0x10"
;;
openmesh,om5p-ac-v1)
ucidef_set_led_netdev "lan" "LAN" "blue:lan" "eth0"
ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"

View File

@ -188,6 +188,7 @@ ath79_setup_interfaces()
compex,wpj531-16m|\
openmesh,a40|\
openmesh,a60|\
openmesh,om2p-v1|\
openmesh,om2p-v4|\
openmesh,om2p-hs-v4|\
plasmacloud,pa300|\
@ -535,10 +536,6 @@ ath79_setup_macs()
lan_mac=$(macaddr_setbit $base_mac 29)
[ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
;;
asus,rp-ac66)
lan_mac=$(mtd_get_mac_binary art 0x1002)
label_mac=$lan_mac
;;
avm,fritz1750e|\
avm,fritz450e|\
avm,fritzdvbc)

View File

@ -131,6 +131,9 @@ case "$FIRMWARE" in
openmesh,om5p-an)
caldata_extract "ART" 0x5000 0x440
;;
openmesh,om2p-v1)
caldata_extract "ART" 0x1000 0x440
;;
wd,mynet-n600|\
wd,mynet-n750)
caldata_extract "art" 0x5000 0x440

View File

@ -17,10 +17,6 @@ case "$FIRMWARE" in
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 2)
;;
avm,fritz1750e|\
avm,fritzdvbc)
caldata_extract "urlader" 0x198a 0x844
;;
asus,rp-ac66|\
comfast,cf-wr650ac-v1|\
comfast,cf-wr650ac-v2|\
@ -50,6 +46,10 @@ case "$FIRMWARE" in
yuncore,a770)
caldata_extract "art" 0x5000 0x844
;;
avm,fritz1750e|\
avm,fritzdvbc)
caldata_extract "urlader" 0x198a 0x844
;;
devolo,dvl1200e|\
devolo,dvl1200i|\
devolo,dvl1750c|\
@ -105,12 +105,9 @@ case "$FIRMWARE" in
openmesh,a40|\
openmesh,a60|\
openmesh,mr1750-v1|\
openmesh,mr1750-v2)
caldata_extract "ART" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 16)
;;
openmesh,mr1750-v2|\
openmesh,om5p-ac-v2)
caldata_extract "art" 0x5000 0x844
caldata_extract "ART" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) 16)
;;
qihoo,c301)

View File

@ -73,6 +73,7 @@ platform_do_upgrade() {
openmesh,mr900-v2|\
openmesh,mr1750-v1|\
openmesh,mr1750-v2|\
openmesh,om2p-v1|\
openmesh,om2p-v2|\
openmesh,om2p-v4|\
openmesh,om2p-hs-v1|\
@ -82,6 +83,7 @@ platform_do_upgrade() {
openmesh,om2p-lc|\
openmesh,om5p|\
openmesh,om5p-ac-v1|\
openmesh,om5p-ac-v2|\
openmesh,om5p-an)
PART_NAME="inactive"
platform_do_upgrade_openmesh "$1"

View File

@ -361,6 +361,7 @@ define Device/asus_rp-ac66
SOC := qca9563
DEVICE_VENDOR := ASUS
DEVICE_MODEL := RP-AC66
IMAGE_SIZE := 15488k
IMAGES += factory.bin
IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
append-rootfs | pad-rootfs
@ -1871,6 +1872,16 @@ define Device/openmesh_mr1750-v2
endef
TARGET_DEVICES += openmesh_mr1750-v2
define Device/openmesh_om2p-v1
$(Device/openmesh_common_256k)
SOC := ar7240
DEVICE_MODEL := OM2P
DEVICE_VARIANT := v1
OPENMESH_CE_TYPE := OM2P
SUPPORTED_DEVICES += om2p
endef
TARGET_DEVICES += openmesh_om2p-v1
define Device/openmesh_om2p-v2
$(Device/openmesh_common_256k)
SOC := ar9330
@ -1961,12 +1972,12 @@ endef
TARGET_DEVICES += openmesh_om5p-ac-v1
define Device/openmesh_om5p-ac-v2
$(Device/openmesh_common_64k)
SOC := qca9558
DEVICE_VENDOR := OpenMesh
DEVICE_MODEL := OM5P-AC
DEVICE_VARIANT := v2
DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct om-watchdog
IMAGE_SIZE := 7808k
DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct
OPENMESH_CE_TYPE := OM5PAC
SUPPORTED_DEVICES += om5p-acv2
DEFAULT := n
endef

View File

@ -195,6 +195,22 @@ define Device/glinet_gl-e750
endef
TARGET_DEVICES += glinet_gl-e750
define Device/glinet_gl-xe300
SOC := qca9531
DEVICE_VENDOR := GL.iNet
DEVICE_MODEL := GL-XE300
DEVICE_PACKAGES := kmod-usb2 block-mount kmod-usb-serial-ch341
KERNEL_SIZE := 4096k
IMAGE_SIZE := 131072k
PAGESIZE := 2048
VID_HDR_OFFSET := 2048
BLOCKSIZE := 128k
IMAGES += factory.img
IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
TARGET_DEVICES += glinet_gl-xe300
# fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff)
define Device/netgear_ath79_nand
DEVICE_VENDOR := NETGEAR
@ -301,8 +317,9 @@ define Device/zyxel_nbg6716
KERNEL_SIZE := 4096k
BLOCKSIZE := 128k
PAGESIZE := 2048
KERNEL := kernel-bin | append-dtb | uImage none | zyxel-buildkerneljffs | \
check-size 4096k
LOADER_TYPE := bin
KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none | \
zyxel-buildkerneljffs | check-size 4096k
IMAGES := sysupgrade.tar sysupgrade-4M-Kernel.bin factory.bin
IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to $$$$(BLOCKSIZE) | \
sysupgrade-tar rootfs=$$$$@ | append-metadata
@ -311,6 +328,5 @@ define Device/zyxel_nbg6716
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
zyxel-factory
UBINIZE_OPTS := -E 5
DEFAULT := n
endef
TARGET_DEVICES += zyxel_nbg6716

View File

@ -1,6 +1,7 @@
CONFIG_CRC16=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_GPIO_LATCH=y
CONFIG_GPIO_RB91X_KEY=y
CONFIG_GPIO_RB4XX=y
CONFIG_GPIO_WATCHDOG=y
CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y

View File

@ -0,0 +1,54 @@
From f32bc2aa01edcba2f2ed5db151cf183eac9ef919 Mon Sep 17 00:00:00 2001
From: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
Date: Sat, 25 Feb 2017 16:42:50 +0000
Subject: mtd: nor: support mtd name from device tree
Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
---
drivers/mtd/spi-nor/spi-nor.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3189,6 +3189,7 @@ int spi_nor_scan(struct spi_nor *nor, co
struct device *dev = nor->dev;
struct mtd_info *mtd = &nor->mtd;
struct device_node *np = spi_nor_get_flash_node(nor);
+ const char __maybe_unused *of_mtd_name = NULL;
int ret;
int i;
@@ -3243,7 +3244,12 @@ int spi_nor_scan(struct spi_nor *nor, co
if (ret)
return ret;
- if (!mtd->name)
+#ifdef CONFIG_MTD_OF_PARTS
+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
+#endif
+ if (of_mtd_name)
+ mtd->name = of_mtd_name;
+ else if (!mtd->name)
mtd->name = dev_name(dev);
mtd->priv = nor;
mtd->type = MTD_NORFLASH;
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -778,6 +778,17 @@ out_error:
*/
static void mtd_set_dev_defaults(struct mtd_info *mtd)
{
+#ifdef CONFIG_MTD_OF_PARTS
+ const char __maybe_unused *of_mtd_name = NULL;
+ struct device_node *np;
+
+ np = mtd_get_of_node(mtd);
+ if (np && !mtd->name) {
+ of_property_read_string(np, "linux,mtd-name", &of_mtd_name);
+ if (of_mtd_name)
+ mtd->name = of_mtd_name;
+ } else
+#endif
if (mtd->dev.parent) {
if (!mtd->owner && mtd->dev.parent->driver)
mtd->owner = mtd->dev.parent->driver->owner;

View File

@ -14,6 +14,17 @@
config GPIO_LOGICVC
tristate "Xylon LogiCVC GPIO support"
depends on MFD_SYSCON && OF
@@ -495,6 +502,10 @@ config GPIO_REG
A 32-bit single register GPIO fixed in/out implementation. This
can be used to represent any register as a set of GPIO signals.
+config GPIO_RB91X_KEY
+ tristate "MikroTik RB91x board series reset key support"
+ depends on ATH79
+
config GPIO_SAMA5D2_PIOBU
tristate "SAMA5D2 PIOBU GPIO support"
depends on MFD_SYSCON
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -72,6 +72,7 @@ obj-$(CONFIG_GPIO_IT87) += gpio-it87.o
@ -24,6 +35,14 @@
obj-$(CONFIG_GPIO_LOGICVC) += gpio-logicvc.o
obj-$(CONFIG_GPIO_LOONGSON1) += gpio-loongson1.o
obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o
@@ -121,6 +122,7 @@ obj-$(CONFIG_GPIO_PMIC_EIC_SPRD) += gpio
obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
obj-$(CONFIG_GPIO_RASPBERRYPI_EXP) += gpio-raspberrypi-exp.o
obj-$(CONFIG_GPIO_RB4XX) += gpio-rb4xx.o
+obj-$(CONFIG_GPIO_RB91X_KEY) += gpio-rb91x-key.o
obj-$(CONFIG_GPIO_RC5T583) += gpio-rc5t583.o
obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
obj-$(CONFIG_GPIO_RDA) += gpio-rda.o
--- a/drivers/mtd/nand/raw/Kconfig
+++ b/drivers/mtd/nand/raw/Kconfig
@@ -571,4 +571,10 @@ config MTD_NAND_RB4XX

View File

@ -27,7 +27,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1945,6 +1945,16 @@ reset:
@@ -1952,6 +1952,16 @@ reset:
return ret;
}

View File

@ -55,7 +55,7 @@ Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
reg = <0x7e807000 0x100>;
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -488,14 +488,6 @@
@@ -490,14 +490,6 @@
status = "disabled";
};

View File

@ -23,7 +23,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.com>
status = "disabled";
};
@@ -1112,7 +1112,3 @@
@@ -1114,7 +1114,3 @@
&usb {
interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
};

View File

@ -19,7 +19,7 @@ it on BCM4708 family.
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -87,6 +87,8 @@ static int xhci_priv_resume_quirk(struct
@@ -77,6 +77,8 @@ static int xhci_priv_resume_quirk(struct
static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
{
struct xhci_plat_priv *priv = xhci_to_priv(xhci);
@ -28,7 +28,7 @@ it on BCM4708 family.
/*
* As of now platform drivers don't provide MSI support so we ensure
@@ -94,6 +96,9 @@ static void xhci_plat_quirks(struct devi
@@ -84,6 +86,9 @@ static void xhci_plat_quirks(struct devi
* dev struct in order to setup MSI
*/
xhci->quirks |= XHCI_PLAT | priv->quirks;

View File

@ -0,0 +1,44 @@
From 9319230ac147067652b58fe849ffe0ceec098665 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:03 +0100
Subject: [PATCH] PCI: pci-bridge-emul: Add description for class_revision
field
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The current assignment to the class_revision member
class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16);
can make the reader think that class is at high 16 bits of the member and
revision at low 16 bits.
In reality, class is at high 24 bits, but the class for PCI Bridge Normal
Decode is PCI_CLASS_BRIDGE_PCI << 8.
Change the assignment and add a comment to make this clearer.
Link: https://lore.kernel.org/r/20211130172913.9727-2-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/pci-bridge-emul.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -265,7 +265,11 @@ int pci_bridge_emul_init(struct pci_brid
{
BUILD_BUG_ON(sizeof(bridge->conf) != PCI_BRIDGE_CONF_END);
- bridge->conf.class_revision |= cpu_to_le32(PCI_CLASS_BRIDGE_PCI << 16);
+ /*
+ * class_revision: Class is high 24 bits and revision is low 8 bit of this member,
+ * while class for PCI Bridge Normal Decode has the 24-bit value: PCI_CLASS_BRIDGE_PCI << 8
+ */
+ bridge->conf.class_revision |= cpu_to_le32((PCI_CLASS_BRIDGE_PCI << 8) << 8);
bridge->conf.header_type = PCI_HEADER_TYPE_BRIDGE;
bridge->conf.cache_line_size = 0x10;
bridge->conf.status = cpu_to_le16(PCI_STATUS_CAP_LIST);

View File

@ -0,0 +1,73 @@
From 8ea673a8b30b4a32516b8adabb15e2a68ff02ec8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:04 +0100
Subject: [PATCH] PCI: pci-bridge-emul: Add definitions for missing
capabilities registers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
pci-bridge-emul driver already allocates buffer for capabilities up to the
PCI_EXP_SLTSTA2 register, but does not define bit access behavior for these
registers. Add these missing definitions.
Link: https://lore.kernel.org/r/20211130172913.9727-3-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/pci-bridge-emul.c | 43 +++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
--- a/drivers/pci/pci-bridge-emul.c
+++ b/drivers/pci/pci-bridge-emul.c
@@ -251,6 +251,49 @@ struct pci_bridge_reg_behavior pcie_cap_
.ro = GENMASK(15, 0) | PCI_EXP_RTSTA_PENDING,
.w1c = PCI_EXP_RTSTA_PME,
},
+
+ [PCI_EXP_DEVCAP2 / 4] = {
+ /*
+ * Device capabilities 2 register has reserved bits [30:27].
+ * Also bits [26:24] are reserved for non-upstream ports.
+ */
+ .ro = BIT(31) | GENMASK(23, 0),
+ },
+
+ [PCI_EXP_DEVCTL2 / 4] = {
+ /*
+ * Device control 2 register is RW. Bit 11 is reserved for
+ * non-upstream ports.
+ *
+ * Device status 2 register is reserved.
+ */
+ .rw = GENMASK(15, 12) | GENMASK(10, 0),
+ },
+
+ [PCI_EXP_LNKCAP2 / 4] = {
+ /* Link capabilities 2 register has reserved bits [30:25] and 0. */
+ .ro = BIT(31) | GENMASK(24, 1),
+ },
+
+ [PCI_EXP_LNKCTL2 / 4] = {
+ /*
+ * Link control 2 register is RW.
+ *
+ * Link status 2 register has bits 5, 15 W1C;
+ * bits 10, 11 reserved and others are RO.
+ */
+ .rw = GENMASK(15, 0),
+ .w1c = (BIT(15) | BIT(5)) << 16,
+ .ro = (GENMASK(14, 12) | GENMASK(9, 6) | GENMASK(4, 0)) << 16,
+ },
+
+ [PCI_EXP_SLTCAP2 / 4] = {
+ /* Slot capabilities 2 register is reserved. */
+ },
+
+ [PCI_EXP_SLTCTL2 / 4] = {
+ /* Both Slot control 2 and Slot status 2 registers are reserved. */
+ },
};
/*

View File

@ -0,0 +1,61 @@
From 1d3e170344dff2cef8827db6c09909b78cbc11d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:05 +0100
Subject: [PATCH] PCI: aardvark: Add support for DEVCAP2, DEVCTL2, LNKCAP2 and
LNKCTL2 registers on emulated bridge
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
PCI aardvark hardware supports access to DEVCAP2, DEVCTL2, LNKCAP2 and
LNKCTL2 configuration registers of PCIe core via PCIE_CORE_PCIEXP_CAP.
Export them via emulated software root bridge.
Link: https://lore.kernel.org/r/20211130172913.9727-4-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -882,8 +882,13 @@ advk_pci_bridge_emul_pcie_conf_read(stru
case PCI_CAP_LIST_ID:
case PCI_EXP_DEVCAP:
case PCI_EXP_DEVCTL:
+ case PCI_EXP_DEVCAP2:
+ case PCI_EXP_DEVCTL2:
+ case PCI_EXP_LNKCAP2:
+ case PCI_EXP_LNKCTL2:
*value = advk_readl(pcie, PCIE_CORE_PCIEXP_CAP + reg);
return PCI_BRIDGE_EMUL_HANDLED;
+
default:
return PCI_BRIDGE_EMUL_NOT_HANDLED;
}
@@ -897,10 +902,6 @@ advk_pci_bridge_emul_pcie_conf_write(str
struct advk_pcie *pcie = bridge->data;
switch (reg) {
- case PCI_EXP_DEVCTL:
- advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg);
- break;
-
case PCI_EXP_LNKCTL:
advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg);
if (new & PCI_EXP_LNKCTL_RL)
@@ -922,6 +923,12 @@ advk_pci_bridge_emul_pcie_conf_write(str
advk_writel(pcie, new, PCIE_ISR0_REG);
break;
+ case PCI_EXP_DEVCTL:
+ case PCI_EXP_DEVCTL2:
+ case PCI_EXP_LNKCTL2:
+ advk_writel(pcie, new, PCIE_CORE_PCIEXP_CAP + reg);
+ break;
+
default:
break;
}

View File

@ -0,0 +1,59 @@
From 7d8dc1f7cd007a7ce94c5b4c20d63a8b8d6d7751 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:06 +0100
Subject: [PATCH] PCI: aardvark: Clear all MSIs at setup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We already clear all the other interrupts (ISR0, ISR1, HOST_CTRL_INT).
Define a new macro PCIE_MSI_ALL_MASK and do the same clearing for MSIs,
to ensure that we don't start receiving spurious interrupts.
Use this new mask in advk_pcie_handle_msi();
Link: https://lore.kernel.org/r/20211130172913.9727-5-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -114,6 +114,7 @@
#define PCIE_MSI_ADDR_HIGH_REG (CONTROL_BASE_ADDR + 0x54)
#define PCIE_MSI_STATUS_REG (CONTROL_BASE_ADDR + 0x58)
#define PCIE_MSI_MASK_REG (CONTROL_BASE_ADDR + 0x5C)
+#define PCIE_MSI_ALL_MASK GENMASK(31, 0)
#define PCIE_MSI_PAYLOAD_REG (CONTROL_BASE_ADDR + 0x9C)
#define PCIE_MSI_DATA_MASK GENMASK(15, 0)
@@ -577,6 +578,7 @@ static void advk_pcie_setup_hw(struct ad
advk_writel(pcie, reg, PCIE_CORE_CTRL2_REG);
/* Clear all interrupts */
+ advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG);
advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG);
advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG);
advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG);
@@ -589,7 +591,7 @@ static void advk_pcie_setup_hw(struct ad
advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG);
/* Unmask all MSIs */
- advk_writel(pcie, 0, PCIE_MSI_MASK_REG);
+ advk_writel(pcie, ~(u32)PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG);
/* Enable summary interrupt for GIC SPI source */
reg = PCIE_IRQ_ALL_MASK & (~PCIE_IRQ_ENABLE_INTS_MASK);
@@ -1397,7 +1399,7 @@ static void advk_pcie_handle_msi(struct
msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG);
msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG);
- msi_status = msi_val & ~msi_mask;
+ msi_status = msi_val & ((~msi_mask) & PCIE_MSI_ALL_MASK);
for (msi_idx = 0; msi_idx < MSI_IRQ_NUM; msi_idx++) {
if (!(BIT(msi_idx) & msi_status))

View File

@ -0,0 +1,34 @@
From a4ca7948e1d47275f8f3e5023243440c40561916 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:07 +0100
Subject: [PATCH] PCI: aardvark: Comment actions in driver remove method
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add two more comments into the advk_pcie_remove() method.
Link: https://lore.kernel.org/r/20211130172913.9727-6-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1696,11 +1696,13 @@ static int advk_pcie_remove(struct platf
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
int i;
+ /* Remove PCI bus with all devices */
pci_lock_rescan_remove();
pci_stop_root_bus(bridge->bus);
pci_remove_root_bus(bridge->bus);
pci_unlock_rescan_remove();
+ /* Remove IRQ domains */
advk_pcie_remove_msi_irq_domain(pcie);
advk_pcie_remove_irq_domain(pcie);

View File

@ -0,0 +1,41 @@
From a46f2f6dd4093438d9615dfbf5c0fea2a9835dba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:08 +0100
Subject: [PATCH] PCI: aardvark: Disable bus mastering when unbinding driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ensure that after driver unbind PCIe cards are not able to forward
memory and I/O requests in the upstream direction.
Link: https://lore.kernel.org/r/20211130172913.9727-7-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1694,6 +1694,7 @@ static int advk_pcie_remove(struct platf
{
struct advk_pcie *pcie = platform_get_drvdata(pdev);
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie);
+ u32 val;
int i;
/* Remove PCI bus with all devices */
@@ -1702,6 +1703,11 @@ static int advk_pcie_remove(struct platf
pci_remove_root_bus(bridge->bus);
pci_unlock_rescan_remove();
+ /* Disable Root Bridge I/O space, memory space and bus mastering */
+ val = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
+ val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
+ advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG);
+
/* Remove IRQ domains */
advk_pcie_remove_msi_irq_domain(pcie);
advk_pcie_remove_irq_domain(pcie);

View File

@ -0,0 +1,48 @@
From 13bcdf07cb2ecff5d45d2c141df2539b15211448 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:09 +0100
Subject: [PATCH] PCI: aardvark: Mask all interrupts when unbinding driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ensure that no interrupt can be triggered after driver unbind.
Link: https://lore.kernel.org/r/20211130172913.9727-8-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1708,6 +1708,27 @@ static int advk_pcie_remove(struct platf
val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG);
+ /* Disable MSI */
+ val = advk_readl(pcie, PCIE_CORE_CTRL2_REG);
+ val &= ~PCIE_CORE_CTRL2_MSI_ENABLE;
+ advk_writel(pcie, val, PCIE_CORE_CTRL2_REG);
+
+ /* Clear MSI address */
+ advk_writel(pcie, 0, PCIE_MSI_ADDR_LOW_REG);
+ advk_writel(pcie, 0, PCIE_MSI_ADDR_HIGH_REG);
+
+ /* Mask all interrupts */
+ advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG);
+ advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_MASK_REG);
+ advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG);
+ advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_MASK_REG);
+
+ /* Clear all interrupts */
+ advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG);
+ advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG);
+ advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG);
+ advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG);
+
/* Remove IRQ domains */
advk_pcie_remove_msi_irq_domain(pcie);
advk_pcie_remove_irq_domain(pcie);

View File

@ -0,0 +1,33 @@
From 2f040a17f5061457ae95035326d3159eddc1e5cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:10 +0100
Subject: [PATCH] PCI: aardvark: Fix memory leak in driver unbind
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Free config space for emulated root bridge when unbinding driver to fix
memory leak. Do it after disabling and masking all interrupts, since
aardvark interrupt handler accesses config space of emulated root
bridge.
Link: https://lore.kernel.org/r/20211130172913.9727-9-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1733,6 +1733,9 @@ static int advk_pcie_remove(struct platf
advk_pcie_remove_msi_irq_domain(pcie);
advk_pcie_remove_irq_domain(pcie);
+ /* Free config space for emulated root bridge */
+ pci_bridge_emul_cleanup(&pcie->bridge);
+
/* Disable outbound address windows mapping */
for (i = 0; i < OB_WIN_COUNT; i++)
advk_pcie_disable_ob_win(pcie, i);

View File

@ -0,0 +1,33 @@
From 1f54391be8ce0c981d312cb93acdc5608def576a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:11 +0100
Subject: [PATCH] PCI: aardvark: Assert PERST# when unbinding driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Put the PCIe card into reset by asserting PERST# signal when unbinding
driver. It doesn't make sense to leave the card working if it can't
communicate with the host. This should also save some power.
Link: https://lore.kernel.org/r/20211130172913.9727-10-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1736,6 +1736,10 @@ static int advk_pcie_remove(struct platf
/* Free config space for emulated root bridge */
pci_bridge_emul_cleanup(&pcie->bridge);
+ /* Assert PERST# signal which prepares PCIe card for power down */
+ if (pcie->reset_gpio)
+ gpiod_set_value_cansleep(pcie->reset_gpio, 1);
+
/* Disable outbound address windows mapping */
for (i = 0; i < OB_WIN_COUNT; i++)
advk_pcie_disable_ob_win(pcie, i);

View File

@ -0,0 +1,34 @@
From 759dec2e3dfdbd261c41d2279f04f2351c971a49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:12 +0100
Subject: [PATCH] PCI: aardvark: Disable link training when unbinding driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Disable link training circuit in driver unbind sequence. We want to
leave link training in the same state as it was before the driver was
probed.
Link: https://lore.kernel.org/r/20211130172913.9727-11-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1740,6 +1740,11 @@ static int advk_pcie_remove(struct platf
if (pcie->reset_gpio)
gpiod_set_value_cansleep(pcie->reset_gpio, 1);
+ /* Disable link training */
+ val = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
+ val &= ~LINK_TRAINING_EN;
+ advk_writel(pcie, val, PCIE_CORE_CTRL0_REG);
+
/* Disable outbound address windows mapping */
for (i = 0; i < OB_WIN_COUNT; i++)
advk_pcie_disable_ob_win(pcie, i);

View File

@ -0,0 +1,30 @@
From fdbbe242c15a8f2cd0e3ad8a56cd0a447b771d0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Tue, 30 Nov 2021 18:29:13 +0100
Subject: [PATCH] PCI: aardvark: Disable common PHY when unbinding driver
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Disable the PCIe PHY when unbinding driver. This should save some power.
Link: https://lore.kernel.org/r/20211130172913.9727-12-kabel@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
---
drivers/pci/controller/pci-aardvark.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1749,6 +1749,9 @@ static int advk_pcie_remove(struct platf
for (i = 0; i < OB_WIN_COUNT; i++)
advk_pcie_disable_ob_win(pcie, i);
+ /* Disable phy */
+ advk_pcie_disable_phy(pcie);
+
return 0;
}

View File

@ -0,0 +1,67 @@
From 40da06da15c1718b02072687bbfb2d08f5eb9399 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Fri, 27 Aug 2021 11:27:52 +0200
Subject: [PATCH] phy: marvell: phy-mvebu-a3700-comphy: Rename HS-SGMMI to
2500Base-X
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Comphy phy mode 0x3 is incorrectly named. It is not SGMII but rather
2500Base-X mode which runs at 3.125 Gbps speed.
Rename macro names and comments to 2500Base-X.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 9695375a3f4a ("phy: add A3700 COMPHY support")
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -29,7 +29,7 @@
#define COMPHY_FW_MODE_SATA 0x1
#define COMPHY_FW_MODE_SGMII 0x2
-#define COMPHY_FW_MODE_HS_SGMII 0x3
+#define COMPHY_FW_MODE_2500BASEX 0x3
#define COMPHY_FW_MODE_USB3H 0x4
#define COMPHY_FW_MODE_USB3D 0x5
#define COMPHY_FW_MODE_PCIE 0x6
@@ -40,7 +40,7 @@
#define COMPHY_FW_SPEED_1_25G 0 /* SGMII 1G */
#define COMPHY_FW_SPEED_2_5G 1
-#define COMPHY_FW_SPEED_3_125G 2 /* SGMII 2.5G */
+#define COMPHY_FW_SPEED_3_125G 2 /* 2500BASE-X */
#define COMPHY_FW_SPEED_5G 3
#define COMPHY_FW_SPEED_5_15625G 4 /* XFI 5G */
#define COMPHY_FW_SPEED_6G 5
@@ -84,14 +84,14 @@ static const struct mvebu_a3700_comphy_c
MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_SGMII, 1,
COMPHY_FW_MODE_SGMII),
MVEBU_A3700_COMPHY_CONF_ETH(0, PHY_INTERFACE_MODE_2500BASEX, 1,
- COMPHY_FW_MODE_HS_SGMII),
+ COMPHY_FW_MODE_2500BASEX),
/* lane 1 */
MVEBU_A3700_COMPHY_CONF_GEN(1, PHY_MODE_PCIE, 0,
COMPHY_FW_MODE_PCIE),
MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_SGMII, 0,
COMPHY_FW_MODE_SGMII),
MVEBU_A3700_COMPHY_CONF_ETH(1, PHY_INTERFACE_MODE_2500BASEX, 0,
- COMPHY_FW_MODE_HS_SGMII),
+ COMPHY_FW_MODE_2500BASEX),
/* lane 2 */
MVEBU_A3700_COMPHY_CONF_GEN(2, PHY_MODE_SATA, 0,
COMPHY_FW_MODE_SATA),
@@ -205,7 +205,7 @@ static int mvebu_a3700_comphy_power_on(s
COMPHY_FW_SPEED_1_25G);
break;
case PHY_INTERFACE_MODE_2500BASEX:
- dev_dbg(lane->dev, "set lane %d to HS SGMII mode\n",
+ dev_dbg(lane->dev, "set lane %d to 2500BASEX mode\n",
lane->id);
fw_param = COMPHY_FW_NET(fw_mode, lane->port,
COMPHY_FW_SPEED_3_125G);

View File

@ -0,0 +1,40 @@
From e1dbe9ecf621b6f71f3d2df3e50731d583f3d27f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Fri, 27 Aug 2021 11:27:53 +0200
Subject: [PATCH] phy: marvell: phy-mvebu-a3700-comphy: Remove unsupported
modes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Armada 3700 does not support RXAUI, XFI and neither SFI. Remove unused
macros for these unsupported modes.
Signed-off-by: Pali Rohár <pali@kernel.org>
Fixes: 9695375a3f4a ("phy: add A3700 COMPHY support")
Signed-off-by: David S. Miller <davem@davemloft.net>
---
drivers/phy/marvell/phy-mvebu-a3700-comphy.c | 6 ------
1 file changed, 6 deletions(-)
--- a/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-a3700-comphy.c
@@ -33,18 +33,12 @@
#define COMPHY_FW_MODE_USB3H 0x4
#define COMPHY_FW_MODE_USB3D 0x5
#define COMPHY_FW_MODE_PCIE 0x6
-#define COMPHY_FW_MODE_RXAUI 0x7
-#define COMPHY_FW_MODE_XFI 0x8
-#define COMPHY_FW_MODE_SFI 0x9
#define COMPHY_FW_MODE_USB3 0xa
#define COMPHY_FW_SPEED_1_25G 0 /* SGMII 1G */
#define COMPHY_FW_SPEED_2_5G 1
#define COMPHY_FW_SPEED_3_125G 2 /* 2500BASE-X */
#define COMPHY_FW_SPEED_5G 3
-#define COMPHY_FW_SPEED_5_15625G 4 /* XFI 5G */
-#define COMPHY_FW_SPEED_6G 5
-#define COMPHY_FW_SPEED_10_3125G 6 /* XFI 10G */
#define COMPHY_FW_SPEED_MAX 0x3F
#define COMPHY_FW_MODE(mode) ((mode) << 12)

View File

@ -214,11 +214,9 @@ Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
include/linux/mtd/mtd.h | 2 ++
4 files changed, 60 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 665fd9020b76..fe7626b5020e 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -38,10 +38,11 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
@@ -40,10 +40,11 @@ static struct mtd_info *allocate_partiti
struct mtd_info *master = mtd_get_master(parent);
int wr_alignment = (parent->flags & MTD_NO_ERASE) ?
master->writesize : master->erasesize;
@ -231,7 +229,7 @@ index 665fd9020b76..fe7626b5020e 100644
char *name;
u64 tmp;
@@ -143,6 +144,7 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
@@ -145,6 +146,7 @@ static struct mtd_info *allocate_partiti
int i, max = parent->numeraseregions;
u64 end = child->part.offset + child->part.size;
struct mtd_erase_region_info *regions = parent->eraseregions;
@ -239,7 +237,7 @@ index 665fd9020b76..fe7626b5020e 100644
/* Find the first erase regions which is part of this
* partition. */
@@ -153,15 +155,24 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
@@ -155,15 +157,24 @@ static struct mtd_info *allocate_partiti
if (i > 0)
i--;
@ -265,7 +263,7 @@ index 665fd9020b76..fe7626b5020e 100644
}
/*
@@ -169,26 +180,43 @@ static struct mtd_info *allocate_partition(struct mtd_info *parent,
@@ -171,26 +182,43 @@ static struct mtd_info *allocate_partiti
* exposes several regions with different erasesize. Adjust
* wr_alignment accordingly.
*/
@ -319,8 +317,6 @@ index 665fd9020b76..fe7626b5020e 100644
}
child->size = child->part.size;
diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 24cd25de2b8b..09df9f1a8127 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -10,6 +10,16 @@ menuconfig MTD_SPI_NOR
@ -340,11 +336,9 @@ index 24cd25de2b8b..09df9f1a8127 100644
config MTD_SPI_NOR_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
default y
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index bd2c7717eb10..43d9b54e7edd 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1262,6 +1262,8 @@ static u8 spi_nor_convert_3to4_erase(u8 opcode)
@@ -1075,6 +1075,8 @@ static u8 spi_nor_convert_3to4_erase(u8
static bool spi_nor_has_uniform_erase(const struct spi_nor *nor)
{
@ -353,7 +347,7 @@ index bd2c7717eb10..43d9b54e7edd 100644
return !!nor->params->erase_map.uniform_erase_type;
}
@@ -2381,6 +2383,7 @@ static int spi_nor_select_erase(struct spi_nor *nor)
@@ -2560,6 +2562,7 @@ static int spi_nor_select_erase(struct s
{
struct spi_nor_erase_map *map = &nor->params->erase_map;
const struct spi_nor_erase_type *erase = NULL;
@ -361,7 +355,7 @@ index bd2c7717eb10..43d9b54e7edd 100644
struct mtd_info *mtd = &nor->mtd;
u32 wanted_size = nor->info->sector_size;
int i;
@@ -2413,8 +2416,9 @@ static int spi_nor_select_erase(struct spi_nor *nor)
@@ -2592,8 +2595,9 @@ static int spi_nor_select_erase(struct s
*/
for (i = SNOR_ERASE_TYPE_MAX - 1; i >= 0; i--) {
if (map->erase_type[i].size) {
@ -373,7 +367,7 @@ index bd2c7717eb10..43d9b54e7edd 100644
}
}
@@ -2422,6 +2426,8 @@ static int spi_nor_select_erase(struct spi_nor *nor)
@@ -2601,6 +2605,8 @@ static int spi_nor_select_erase(struct s
return -EINVAL;
mtd->erasesize = erase->size;
@ -382,11 +376,9 @@ index bd2c7717eb10..43d9b54e7edd 100644
return 0;
}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a89955f3cbc8..33eafa27da50 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -243,6 +243,8 @@ struct mtd_info {
@@ -242,6 +242,8 @@ struct mtd_info {
* information below if they desire
*/
uint32_t erasesize;

View File

@ -19,7 +19,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -24,6 +24,17 @@ config MTD_SPI_NOR_USE_4K_SECTORS
@@ -34,6 +34,17 @@ config MTD_SPI_NOR_USE_4K_SECTORS
Please note that some tools/drivers/filesystems may not work with
4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum).
@ -39,7 +39,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
endif # MTD_SPI_NOR
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2786,6 +2786,21 @@ static void spi_nor_info_init_params(str
@@ -2792,6 +2792,21 @@ static void spi_nor_info_init_params(str
*/
erase_mask = 0;
i = 0;
@ -61,7 +61,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (info->flags & SECT_4K_PMC) {
erase_mask |= BIT(i);
spi_nor_set_erase_type(&map->erase_type[i], 4096u,
@@ -2797,6 +2812,7 @@ static void spi_nor_info_init_params(str
@@ -2803,6 +2818,7 @@ static void spi_nor_info_init_params(str
SPINOR_OP_BE_4K);
i++;
}

View File

@ -59,7 +59,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+};
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2026,6 +2026,7 @@ static const struct spi_nor_manufacturer
@@ -2028,6 +2028,7 @@ static const struct spi_nor_manufacturer
&spi_nor_winbond,
&spi_nor_xilinx,
&spi_nor_xmc,

View File

@ -19,7 +19,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1447,6 +1447,23 @@ destroy_erase_cmd_list:
@@ -1449,6 +1449,23 @@ destroy_erase_cmd_list:
return ret;
}
@ -43,7 +43,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
/*
* Erase an address range on the nor chip. The address range may extend
* one or more erase sectors. Return an error is there is a problem erasing.
@@ -1474,6 +1491,10 @@ static int spi_nor_erase(struct mtd_info
@@ -1476,6 +1493,10 @@ static int spi_nor_erase(struct mtd_info
if (ret)
return ret;
@ -54,7 +54,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
/* whole-chip erase? */
if (len == mtd->size && !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
unsigned long timeout;
@@ -1533,6 +1554,7 @@ static int spi_nor_erase(struct mtd_info
@@ -1535,6 +1556,7 @@ static int spi_nor_erase(struct mtd_info
ret = spi_nor_write_disable(nor);
erase_err:
@ -62,7 +62,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
@@ -1872,7 +1894,9 @@ static int spi_nor_lock(struct mtd_info
@@ -1874,7 +1896,9 @@ static int spi_nor_lock(struct mtd_info
if (ret)
return ret;
@ -72,7 +72,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
@@ -1887,7 +1911,9 @@ static int spi_nor_unlock(struct mtd_inf
@@ -1889,7 +1913,9 @@ static int spi_nor_unlock(struct mtd_inf
if (ret)
return ret;
@ -82,7 +82,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
@@ -1902,7 +1928,9 @@ static int spi_nor_is_locked(struct mtd_
@@ -1904,7 +1930,9 @@ static int spi_nor_is_locked(struct mtd_
if (ret)
return ret;
@ -92,7 +92,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
@@ -2095,6 +2123,10 @@ static int spi_nor_read(struct mtd_info
@@ -2097,6 +2125,10 @@ static int spi_nor_read(struct mtd_info
if (ret)
return ret;
@ -103,7 +103,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
while (len) {
loff_t addr = from;
@@ -2118,6 +2150,7 @@ static int spi_nor_read(struct mtd_info
@@ -2120,6 +2152,7 @@ static int spi_nor_read(struct mtd_info
ret = 0;
read_err:
@ -111,7 +111,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
}
@@ -2140,6 +2173,10 @@ static int spi_nor_write(struct mtd_info
@@ -2142,6 +2175,10 @@ static int spi_nor_write(struct mtd_info
if (ret)
return ret;
@ -122,7 +122,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
for (i = 0; i < len; ) {
ssize_t written;
loff_t addr = to + i;
@@ -2182,6 +2219,7 @@ static int spi_nor_write(struct mtd_info
@@ -2184,6 +2221,7 @@ static int spi_nor_write(struct mtd_info
}
write_err:
@ -130,7 +130,7 @@ Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
spi_nor_unlock_and_unprep(nor);
return ret;
}
@@ -2977,9 +3015,13 @@ static int spi_nor_init(struct spi_nor *
@@ -2983,9 +3021,13 @@ static int spi_nor_init(struct spi_nor *
* reboots (e.g., crashes). Warn the user (or hopefully, system
* designer) that this is bad.
*/

View File

@ -64,7 +64,7 @@ Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
mutex_lock(&mtd_table_mutex);
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -696,6 +696,8 @@ extern struct mtd_info *get_mtd_device(s
@@ -698,6 +698,8 @@ extern struct mtd_info *get_mtd_device(s
extern int __get_mtd_device(struct mtd_info *mtd);
extern void __put_mtd_device(struct mtd_info *mtd);
extern struct mtd_info *get_mtd_device_nm(const char *name);

View File

@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
cfg->fc_flags |= RTF_REJECT;
if (rtm->rtm_type == RTN_LOCAL)
@@ -6099,6 +6130,8 @@ static int ip6_route_dev_notify(struct n
@@ -6127,6 +6158,8 @@ static int ip6_route_dev_notify(struct n
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
net->ipv6.ip6_prohibit_entry->dst.dev = dev;
net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
#endif
@@ -6110,6 +6143,7 @@ static int ip6_route_dev_notify(struct n
@@ -6138,6 +6171,7 @@ static int ip6_route_dev_notify(struct n
in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev);
@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev);
#endif
}
@@ -6301,6 +6335,8 @@ static int __net_init ip6_route_net_init
@@ -6329,6 +6363,8 @@ static int __net_init ip6_route_net_init
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
net->ipv6.fib6_has_custom_rules = false;
@ -211,7 +211,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template,
sizeof(*net->ipv6.ip6_prohibit_entry),
GFP_KERNEL);
@@ -6311,11 +6347,21 @@ static int __net_init ip6_route_net_init
@@ -6339,11 +6375,21 @@ static int __net_init ip6_route_net_init
ip6_template_metrics, true);
INIT_LIST_HEAD(&net->ipv6.ip6_prohibit_entry->rt6i_uncached);
@ -234,7 +234,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
ip6_template_metrics, true);
@@ -6342,6 +6388,8 @@ out:
@@ -6370,6 +6416,8 @@ out:
return ret;
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
@ -243,7 +243,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
out_ip6_prohibit_entry:
kfree(net->ipv6.ip6_prohibit_entry);
out_ip6_null_entry:
@@ -6361,6 +6409,7 @@ static void __net_exit ip6_route_net_exi
@@ -6389,6 +6437,7 @@ static void __net_exit ip6_route_net_exi
kfree(net->ipv6.ip6_null_entry);
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
kfree(net->ipv6.ip6_prohibit_entry);
@ -251,7 +251,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
kfree(net->ipv6.ip6_blk_hole_entry);
#endif
dst_entries_destroy(&net->ipv6.ip6_dst_ops);
@@ -6438,6 +6487,9 @@ void __init ip6_route_init_special_entri
@@ -6466,6 +6515,9 @@ void __init ip6_route_init_special_entri
init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);

View File

@ -0,0 +1,40 @@
From 43f3f187e6f62ca40802afe39495c8a3e20b4bfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Mon, 10 Jan 2022 01:50:50 +0100
Subject: [PATCH] PCI: aardvark: Replace custom PCIE_CORE_INT_* macros with
PCI_INTERRUPT_*
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Header file linux/pci.h defines enum pci_interrupt_pin with corresponding
PCI_INTERRUPT_* values.
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/pci/controller/pci-aardvark.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -37,10 +37,6 @@
#define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX_EN BIT(6)
#define PCIE_CORE_ERR_CAPCTL_ECRC_CHCK BIT(7)
#define PCIE_CORE_ERR_CAPCTL_ECRC_CHCK_RCV BIT(8)
-#define PCIE_CORE_INT_A_ASSERT_ENABLE 1
-#define PCIE_CORE_INT_B_ASSERT_ENABLE 2
-#define PCIE_CORE_INT_C_ASSERT_ENABLE 3
-#define PCIE_CORE_INT_D_ASSERT_ENABLE 4
/* PIO registers base address and register offsets */
#define PIO_BASE_ADDR 0x4000
#define PIO_CTRL (PIO_BASE_ADDR + 0x0)
@@ -967,7 +963,7 @@ static int advk_sw_pci_bridge_init(struc
bridge->conf.pref_mem_limit = cpu_to_le16(PCI_PREF_RANGE_TYPE_64);
/* Support interrupt A for MSI feature */
- bridge->conf.intpin = PCIE_CORE_INT_A_ASSERT_ENABLE;
+ bridge->conf.intpin = PCI_INTERRUPT_INTA;
/* Indicates supports for Completion Retry Status */
bridge->pcie_conf.rootcap = cpu_to_le16(PCI_EXP_RTCAP_CRSVIS);

View File

@ -0,0 +1,57 @@
From a29a7d01cd778854e08108461cba321a63d98871 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Fri, 2 Jul 2021 16:39:47 +0200
Subject: [PATCH] PCI: aardvark: Fix reading MSI interrupt number
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In advk_pcie_handle_msi() the authors expect that when bit i in the W1C
register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is
updated to contain the MSI number corresponding to index i.
Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG
always contains the number of the last received MSI, overall.
Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt
number. Since Aardvark already forbids more than 32 interrupts and uses
own allocated hwirq numbers, the msi_idx already corresponds to the
received MSI number.
Fixes: 8c39d710363c ("PCI: aardvark: Add Aardvark PCI host controller driver")
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/pci/controller/pci-aardvark.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1391,7 +1391,7 @@ static void advk_pcie_remove_irq_domain(
static void advk_pcie_handle_msi(struct advk_pcie *pcie)
{
u32 msi_val, msi_mask, msi_status, msi_idx;
- u16 msi_data;
+ int virq;
msi_mask = advk_readl(pcie, PCIE_MSI_MASK_REG);
msi_val = advk_readl(pcie, PCIE_MSI_STATUS_REG);
@@ -1401,13 +1401,12 @@ static void advk_pcie_handle_msi(struct
if (!(BIT(msi_idx) & msi_status))
continue;
- /*
- * msi_idx contains bits [4:0] of the msi_data and msi_data
- * contains 16bit MSI interrupt number
- */
advk_writel(pcie, BIT(msi_idx), PCIE_MSI_STATUS_REG);
- msi_data = advk_readl(pcie, PCIE_MSI_PAYLOAD_REG) & PCIE_MSI_DATA_MASK;
- generic_handle_irq(msi_data);
+ virq = irq_find_mapping(pcie->msi_inner_domain, msi_idx);
+ if (virq)
+ generic_handle_irq(virq);
+ else
+ dev_err_ratelimited(&pcie->pdev->dev, "unexpected MSI 0x%02x\n", msi_idx);
}
advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,

View File

@ -0,0 +1,72 @@
From bb03b126ea6c9e57177b537dd022246fa5dbef16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
Date: Fri, 12 Feb 2021 16:24:07 +0100
Subject: [PATCH] PCI: aardvark: Fix support for MSI interrupts
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Aardvark hardware supports Multi-MSI and MSI_FLAG_MULTI_PCI_MSI is already
set for the MSI chip. But when allocating MSI interrupt numbers for
Multi-MSI, the numbers need to be properly aligned, otherwise endpoint
devices send MSI interrupt with incorrect numbers.
Fix this issue by using function bitmap_find_free_region() instead of
bitmap_find_next_zero_area().
To ensure that aligned MSI interrupt numbers are used by endpoint devices,
we cannot use Linux virtual irq numbers (as they are random and not
properly aligned). Instead we need to use the aligned hwirq numbers.
This change fixes receiving MSI interrupts on Armada 3720 boards and
allows using NVMe disks which use Multi-MSI feature with 3 interrupts.
Without this NVMe disks freeze booting as linux nvme-core.c is waiting
60s for an interrupt.
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Marek Behún <kabel@kernel.org>
---
drivers/pci/controller/pci-aardvark.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
--- a/drivers/pci/controller/pci-aardvark.c
+++ b/drivers/pci/controller/pci-aardvark.c
@@ -1187,7 +1187,7 @@ static void advk_msi_irq_compose_msi_msg
msg->address_lo = lower_32_bits(msi_msg);
msg->address_hi = upper_32_bits(msi_msg);
- msg->data = data->irq;
+ msg->data = data->hwirq;
}
static int advk_msi_set_affinity(struct irq_data *irq_data,
@@ -1204,15 +1204,11 @@ static int advk_msi_irq_domain_alloc(str
int hwirq, i;
mutex_lock(&pcie->msi_used_lock);
- hwirq = bitmap_find_next_zero_area(pcie->msi_used, MSI_IRQ_NUM,
- 0, nr_irqs, 0);
- if (hwirq >= MSI_IRQ_NUM) {
- mutex_unlock(&pcie->msi_used_lock);
- return -ENOSPC;
- }
-
- bitmap_set(pcie->msi_used, hwirq, nr_irqs);
+ hwirq = bitmap_find_free_region(pcie->msi_used, MSI_IRQ_NUM,
+ order_base_2(nr_irqs));
mutex_unlock(&pcie->msi_used_lock);
+ if (hwirq < 0)
+ return -ENOSPC;
for (i = 0; i < nr_irqs; i++)
irq_domain_set_info(domain, virq + i, hwirq + i,
@@ -1230,7 +1226,7 @@ static void advk_msi_irq_domain_free(str
struct advk_pcie *pcie = domain->host_data;
mutex_lock(&pcie->msi_used_lock);
- bitmap_clear(pcie->msi_used, d->hwirq, nr_irqs);
+ bitmap_release_region(pcie->msi_used, d->hwirq, order_base_2(nr_irqs));
mutex_unlock(&pcie->msi_used_lock);
}

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