Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
2de4490a61
@ -6,11 +6,11 @@ ifdef CONFIG_TESTING_KERNEL
|
||||
KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER)
|
||||
endif
|
||||
|
||||
LINUX_VERSION-5.4 = .102
|
||||
LINUX_VERSION-5.10 = .20
|
||||
LINUX_VERSION-5.4 = .105
|
||||
LINUX_VERSION-5.10 = .23
|
||||
|
||||
LINUX_KERNEL_HASH-5.4.102 = fd697ce1c3f6024d4ae77d4eb5a1552199407b60cb8e90bc621e23cbce639aed
|
||||
LINUX_KERNEL_HASH-5.10.20 = 9be37146feba42be05137cf900a7d9012990b5a1d5e59bc0c8da1f86952930a3
|
||||
LINUX_KERNEL_HASH-5.4.105 = 244e4cd16184285df55ec5a9501daba011aa8b85c5527ee05eab4592e70fb8b6
|
||||
LINUX_KERNEL_HASH-5.10.23 = f6e21c03ec6ff85b26d77c59fdab81e64707792a57593643307df192749edb6a
|
||||
|
||||
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
|
||||
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
|
||||
|
||||
@ -13,9 +13,9 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/mtk-openwrt/arm-trusted-firmware.git
|
||||
PKG_SOURCE_DATE:=2021-02-25
|
||||
PKG_SOURCE_VERSION:=1220acb044a9db9a201aba3be0bb4ce0c9ed3702
|
||||
PKG_MIRROR_HASH:=f2ca44b9b8acfbd3a6be30aba316c765f73bad6231a821f524c9f21a845e50a3
|
||||
PKG_SOURCE_DATE:=2021-03-10
|
||||
PKG_SOURCE_VERSION:=8b635f61091f2e5bce88269468c53fc30bb4cd64
|
||||
PKG_MIRROR_HASH:=ffe233a19b51504f605a90a88c7a1bb74303e4a7173a59b24a4dfa572ce99139
|
||||
|
||||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
|
||||
|
||||
@ -85,7 +85,11 @@ TFA_TARGETS:= \
|
||||
mt7622-sdmmc-1ddr \
|
||||
mt7622-sdmmc-2ddr
|
||||
|
||||
TFA_MAKE_FLAGS += BOOT_DEVICE=$(BOOT_DEVICE) $(if $(DDR3_FLYBY),DDR3_FLYBY=1) all
|
||||
TFA_MAKE_FLAGS += \
|
||||
BOOT_DEVICE=$(BOOT_DEVICE) \
|
||||
USE_MKIMAGE=1 MKIMAGE=$(STAGING_DIR_HOST)/bin/mkimage \
|
||||
$(if $(DDR3_FLYBY),DDR3_FLYBY=1) \
|
||||
all
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default)
|
||||
|
||||
@ -1,17 +0,0 @@
|
||||
Index: arm-trusted-firmware-mediatek-2021-02-25-1220acb0/plat/mediatek/mt7622/platform.mk
|
||||
===================================================================
|
||||
--- arm-trusted-firmware-mediatek-2021-02-25-1220acb0.orig/plat/mediatek/mt7622/platform.mk
|
||||
+++ arm-trusted-firmware-mediatek-2021-02-25-1220acb0/plat/mediatek/mt7622/platform.mk
|
||||
@@ -99,9 +99,9 @@ BL2_SOURCES += drivers/mmc/mmc.c \
|
||||
BROM_HEADER_TYPE := sdmmc
|
||||
CPPFLAGS += -DMSDC_INDEX=1
|
||||
DEVICE_HEADER_OFFSET ?= 0x80000
|
||||
-ifeq ($(BROM_SIGN_KEY),)
|
||||
-$(error BootROM signing key is required for SD booting. Please specify BROM_SIGN_KEY)
|
||||
-endif
|
||||
+#ifeq ($(BROM_SIGN_KEY),)
|
||||
+#$(error BootROM signing key is required for SD booting. Please specify BROM_SIGN_KEY)
|
||||
+#endif
|
||||
endif
|
||||
ifeq ($(BOOT_DEVICE),snand)
|
||||
include ${MTK_PLAT}/common/drivers/snfi/mtk-snand.mk
|
||||
@ -11,6 +11,7 @@ case "$board" in
|
||||
d-link,dgs-1210-16|\
|
||||
d-link,dgs-1210-28|\
|
||||
d-link,dgs-1210-10p|\
|
||||
zyxel,gs1900-8|\
|
||||
zyxel,gs1900-8hp-v1|\
|
||||
zyxel,gs1900-8hp-v2|\
|
||||
zyxel,gs1900-10hp)
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_VERSION:=2020.10
|
||||
PKG_HASH:=0d481bbdc05c0ee74908ec2f56a6daa53166cc6a78a0e4fac2ac5d025770a622
|
||||
PKG_VERSION:=2021.04-rc3
|
||||
PKG_HASH:=7c418e07f6065c8761eb2df890bb524d7109864325d8850ddb0c93eb345734f9
|
||||
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
|
||||
|
||||
include $(INCLUDE_DIR)/u-boot.mk
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
From 5efb7855a9d33ac897d6e2a7117e4e3d35d433a5 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 11 Mar 2021 10:28:53 +0000
|
||||
Subject: [PATCH 01/21] Revert "clk: Add debugging for return values"
|
||||
|
||||
This reverts commit 5c5992cb90cf9ca4d51e38d9a95a13c293904df5.
|
||||
---
|
||||
drivers/clk/clk-uclass.c | 16 +++++-----------
|
||||
1 file changed, 5 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/clk/clk-uclass.c
|
||||
+++ b/drivers/clk/clk-uclass.c
|
||||
@@ -84,7 +84,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);
|
||||
- return log_msg_ret("get", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
clk->dev = dev_clk;
|
||||
@@ -97,15 +97,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);
|
||||
- return log_msg_ret("xlate", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
return clk_request(dev_clk, clk);
|
||||
err:
|
||||
debug("%s: Node '%s', property '%s', failed to request CLK index %d: %d\n",
|
||||
__func__, ofnode_get_name(node), list_name, index, ret);
|
||||
-
|
||||
- return log_msg_ret("prop", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int clk_get_by_indexed_prop(struct udevice *dev, const char *prop_name,
|
||||
@@ -124,7 +123,7 @@ static int clk_get_by_indexed_prop(struc
|
||||
if (ret) {
|
||||
debug("%s: fdtdec_parse_phandle_with_args failed: err=%d\n",
|
||||
__func__, ret);
|
||||
- return log_ret(ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +471,6 @@ int clk_free(struct clk *clk)
|
||||
ulong clk_get_rate(struct clk *clk)
|
||||
{
|
||||
const struct clk_ops *ops;
|
||||
- int ret;
|
||||
|
||||
debug("%s(clk=%p)\n", __func__, clk);
|
||||
if (!clk_valid(clk))
|
||||
@@ -482,11 +480,7 @@ ulong clk_get_rate(struct clk *clk)
|
||||
if (!ops->get_rate)
|
||||
return -ENOSYS;
|
||||
|
||||
- ret = ops->get_rate(clk);
|
||||
- if (ret)
|
||||
- return log_ret(ret);
|
||||
-
|
||||
- return 0;
|
||||
+ return ops->get_rate(clk);
|
||||
}
|
||||
|
||||
struct clk *clk_get_parent(struct clk *clk)
|
||||
@ -0,0 +1,21 @@
|
||||
From 04815ef5a49a9996acacfcb5e18924569f5e1bf5 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Brugger <mbrugger@suse.com>
|
||||
Date: Tue, 16 Feb 2021 20:54:08 +0100
|
||||
Subject: [PATCH 02/21] configs: RPi2: Disable EFI Grub workaround
|
||||
|
||||
The EFI Grub workaround isn't needed with Grub version 2.04 or higher.
|
||||
This version was published over a year ago, so disable the workaround
|
||||
to reduce boot time.
|
||||
|
||||
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
|
||||
---
|
||||
configs/rpi_2_defconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/configs/rpi_2_defconfig
|
||||
+++ b/configs/rpi_2_defconfig
|
||||
@@ -42,3 +42,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
|
||||
CONFIG_CONSOLE_SCROLL_LINES=10
|
||||
CONFIG_PHYS_TO_BUS=y
|
||||
CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
|
||||
@ -0,0 +1,25 @@
|
||||
From 6f18e581a7e98db3675b4c111701263647b20781 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Thu, 17 Dec 2020 19:29:56 +0800
|
||||
Subject: [PATCH 03/21] pinctrl: mediatek: fix wrong assignment in
|
||||
mtk_get_pin_name
|
||||
|
||||
This is a bug fix for mtk pinctrl common part. Appearently pins should be
|
||||
used instead of grps in mtk_get_pin_name().
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -219,7 +219,7 @@ static const char *mtk_get_pin_name(stru
|
||||
{
|
||||
struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
|
||||
- if (!priv->soc->grps[selector].name)
|
||||
+ if (!priv->soc->pins[selector].name)
|
||||
return mtk_pinctrl_dummy_name;
|
||||
|
||||
return priv->soc->pins[selector].name;
|
||||
@ -0,0 +1,43 @@
|
||||
From ca73da39ff0c9f599f75d7ccac0196030aa946b9 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Thu, 17 Dec 2020 19:32:48 +0800
|
||||
Subject: [PATCH 04/21] pinctrl: mediatek: add get_pin_muxing ops for mediatek
|
||||
pinctrl
|
||||
|
||||
This patch add get_pin_muxing support for mediatek pinctrl drivers
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 14 ++++++++++++++
|
||||
1 file changed, 14 insertions(+)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -232,6 +232,19 @@ static int mtk_get_pins_count(struct ude
|
||||
return priv->soc->npins;
|
||||
}
|
||||
|
||||
+static int mtk_get_pin_muxing(struct udevice *dev,
|
||||
+ unsigned int selector,
|
||||
+ char *buf, int size)
|
||||
+{
|
||||
+ int val, err;
|
||||
+ err = mtk_hw_get_value(dev, selector, PINCTRL_PIN_REG_MODE, &val);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ snprintf(buf, size, "Aux Func.%d", val);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static const char *mtk_get_group_name(struct udevice *dev,
|
||||
unsigned int selector)
|
||||
{
|
||||
@@ -512,6 +525,7 @@ static int mtk_pinconf_group_set(struct
|
||||
const struct pinctrl_ops mtk_pinctrl_ops = {
|
||||
.get_pins_count = mtk_get_pins_count,
|
||||
.get_pin_name = mtk_get_pin_name,
|
||||
+ .get_pin_muxing = mtk_get_pin_muxing,
|
||||
.get_groups_count = mtk_get_groups_count,
|
||||
.get_group_name = mtk_get_group_name,
|
||||
.get_functions_count = mtk_get_functions_count,
|
||||
@ -0,0 +1,58 @@
|
||||
From d3fbbef13853a695cdea75a980a3d6bd150a68c1 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 11 Jan 2021 10:17:15 +0800
|
||||
Subject: [PATCH 05/21] pinctrl: mediatek: do not probe gpio driver if not
|
||||
enabled
|
||||
|
||||
The mtk pinctrl driver is a combination driver with support for both
|
||||
pinctrl and gpio. When this driver is used in SPL, gpio support may not be
|
||||
enabled, and this will result in a compilation error.
|
||||
|
||||
To fix this, macros are added to make sure gpio related code will only be
|
||||
compiled when gpio support is enabled.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
|
||||
@@ -540,6 +540,8 @@ const struct pinctrl_ops mtk_pinctrl_ops
|
||||
.set_state = pinctrl_generic_set_state,
|
||||
};
|
||||
|
||||
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
+ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
|
||||
static int mtk_gpio_get(struct udevice *dev, unsigned int off)
|
||||
{
|
||||
int val, err;
|
||||
@@ -647,12 +649,13 @@ static int mtk_gpiochip_register(struct
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
int mtk_pinctrl_common_probe(struct udevice *dev,
|
||||
struct mtk_pinctrl_soc *soc)
|
||||
{
|
||||
struct mtk_pinctrl_priv *priv = dev_get_priv(dev);
|
||||
- int ret;
|
||||
+ int ret = 0;
|
||||
|
||||
priv->base = dev_read_addr_ptr(dev);
|
||||
if (!priv->base)
|
||||
@@ -660,9 +663,10 @@ int mtk_pinctrl_common_probe(struct udev
|
||||
|
||||
priv->soc = soc;
|
||||
|
||||
+#if CONFIG_IS_ENABLED(DM_GPIO) || \
|
||||
+ (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_GPIO_SUPPORT))
|
||||
ret = mtk_gpiochip_register(dev);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
+#endif
|
||||
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
From 1c6d07abf7fc79bf3950dc9ac56e3b566c334d3d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 13 Jan 2021 16:29:23 +0800
|
||||
Subject: [PATCH 06/21] pinctrl: mt7629: add jtag function and pin group
|
||||
|
||||
The EPHY LEDs of mt7629 can be used as JTAG. This patch adds the jtag pin
|
||||
group to the pinctrl driver.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/pinctrl/mediatek/pinctrl-mt7629.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/pinctrl/mediatek/pinctrl-mt7629.c
|
||||
+++ b/drivers/pinctrl/mediatek/pinctrl-mt7629.c
|
||||
@@ -201,6 +201,10 @@ static int mt7629_wf2g_led_funcs[] = { 1
|
||||
static int mt7629_wf5g_led_pins[] = { 18, };
|
||||
static int mt7629_wf5g_led_funcs[] = { 1, };
|
||||
|
||||
+/* LED for EPHY used as JTAG */
|
||||
+static int mt7629_ephy_leds_jtag_pins[] = { 12, 13, 14, 15, 16, };
|
||||
+static int mt7629_ephy_leds_jtag_funcs[] = { 7, 7, 7, 7, 7, };
|
||||
+
|
||||
/* Watchdog */
|
||||
static int mt7629_watchdog_pins[] = { 11, };
|
||||
static int mt7629_watchdog_funcs[] = { 1, };
|
||||
@@ -297,6 +301,7 @@ static const struct mtk_group_desc mt762
|
||||
PINCTRL_PIN_GROUP("ephy_led2", mt7629_ephy_led2),
|
||||
PINCTRL_PIN_GROUP("ephy_led3", mt7629_ephy_led3),
|
||||
PINCTRL_PIN_GROUP("ephy_led4", mt7629_ephy_led4),
|
||||
+ PINCTRL_PIN_GROUP("ephy_leds_jtag", mt7629_ephy_leds_jtag),
|
||||
PINCTRL_PIN_GROUP("wf2g_led", mt7629_wf2g_led),
|
||||
PINCTRL_PIN_GROUP("wf5g_led", mt7629_wf5g_led),
|
||||
PINCTRL_PIN_GROUP("watchdog", mt7629_watchdog),
|
||||
@@ -364,6 +369,7 @@ static const char *const mt7629_uart_gro
|
||||
static const char *const mt7629_wdt_groups[] = { "watchdog", };
|
||||
static const char *const mt7629_wifi_groups[] = { "wf0_5g", "wf0_2g", };
|
||||
static const char *const mt7629_flash_groups[] = { "snfi", "spi_nor" };
|
||||
+static const char *const mt7629_jtag_groups[] = { "ephy_leds_jtag" };
|
||||
|
||||
static const struct mtk_function_desc mt7629_functions[] = {
|
||||
{"eth", mt7629_ethernet_groups, ARRAY_SIZE(mt7629_ethernet_groups)},
|
||||
@@ -376,6 +382,7 @@ static const struct mtk_function_desc mt
|
||||
{"watchdog", mt7629_wdt_groups, ARRAY_SIZE(mt7629_wdt_groups)},
|
||||
{"wifi", mt7629_wifi_groups, ARRAY_SIZE(mt7629_wifi_groups)},
|
||||
{"flash", mt7629_flash_groups, ARRAY_SIZE(mt7629_flash_groups)},
|
||||
+ {"jtag", mt7629_jtag_groups, ARRAY_SIZE(mt7629_jtag_groups)},
|
||||
};
|
||||
|
||||
static struct mtk_pinctrl_soc mt7629_data = {
|
||||
@ -0,0 +1,25 @@
|
||||
From c47a5b927787a463eff8f67339d91e60fe0381c4 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:02:50 +0800
|
||||
Subject: [PATCH 07/21] configs: mt7622: use ARMv8 Generic Timer instead of
|
||||
mtk_timer
|
||||
|
||||
It's better to use the generic timer which is correctly initialized by
|
||||
the ATF. The generic timer has higher resolution than the mtk_timer.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -51,8 +51,6 @@ CONFIG_SPI=y
|
||||
CONFIG_DM_SPI=y
|
||||
CONFIG_MTK_SNOR=y
|
||||
CONFIG_SYSRESET_WATCHDOG=y
|
||||
-CONFIG_TIMER=y
|
||||
-CONFIG_MTK_TIMER=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZO=y
|
||||
CONFIG_HEXDUMP=y
|
||||
@ -0,0 +1,50 @@
|
||||
From 4bee3f9e285007ccf77ca9916fff3d93fc4d8a80 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:43:27 +0800
|
||||
Subject: [PATCH 08/21] dts: mt7629: enable JTAG pins by default
|
||||
|
||||
The EPHY LEDs belongs to the built-in FE switch of MT7629, which is barely
|
||||
used. These LED pins on reference boards are used as JTAG socket. So it's
|
||||
a good idea to change the default state to JTAG, and this will make it
|
||||
convenience for debugging.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7629-rfb.dts | 10 ++++++++++
|
||||
arch/arm/dts/mt7629.dtsi | 6 ++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -36,6 +36,16 @@
|
||||
};
|
||||
|
||||
&pinctrl {
|
||||
+ state_default: pinmux_conf {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+
|
||||
+ mux {
|
||||
+ function = "jtag";
|
||||
+ groups = "ephy_leds_jtag";
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
snfi_pins: snfi-pins {
|
||||
mux {
|
||||
function = "flash";
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -152,6 +152,12 @@
|
||||
compatible = "mediatek,mt7629-pinctrl";
|
||||
reg = <0x10217000 0x8000>;
|
||||
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&state_default>;
|
||||
+
|
||||
+ state_default: pinmux_conf {
|
||||
+ };
|
||||
+
|
||||
gpio: gpio-controller {
|
||||
gpio-controller;
|
||||
#gpio-cells = <2>;
|
||||
@ -0,0 +1,44 @@
|
||||
From f3f320af7078a8c5647d870a31c1d3695dacd7cf Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:47:45 +0800
|
||||
Subject: [PATCH 09/21] board: mediatek: add more network configurations
|
||||
|
||||
Make the network configurations uniform for mediatek boards
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
include/configs/mt7622.h | 3 ++-
|
||||
include/configs/mt7623.h | 1 +
|
||||
include/configs/mt7629.h | 1 +
|
||||
3 files changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/include/configs/mt7622.h
|
||||
+++ b/include/configs/mt7622.h
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
-#define CONFIG_SERVERIP 192.168.1.3
|
||||
+#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#endif
|
||||
--- a/include/configs/mt7623.h
|
||||
+++ b/include/configs/mt7623.h
|
||||
@@ -54,6 +54,7 @@
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#ifdef CONFIG_DISTRO_DEFAULTS
|
||||
|
||||
--- a/include/configs/mt7629.h
|
||||
+++ b/include/configs/mt7629.h
|
||||
@@ -52,5 +52,6 @@
|
||||
/* Ethernet */
|
||||
#define CONFIG_IPADDR 192.168.1.1
|
||||
#define CONFIG_SERVERIP 192.168.1.2
|
||||
+#define CONFIG_NETMASK 255.255.255.0
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,38 @@
|
||||
From ed880b7572e1135e3bd8382d4670a375f7d9c91b Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 2 Mar 2021 15:56:17 +0800
|
||||
Subject: [PATCH 10/21] mmc: mtk-sd: increase the minimum bus frequency
|
||||
|
||||
With a 48MHz input clock, the lowest bus frequency can be as low as
|
||||
48000000 / (4 * 4095) = 2930Hz. Such an extremely low frequency will cause
|
||||
the mmc framework take seconds to finish the initialization.
|
||||
|
||||
Limiting the minimum bus frequency to a slightly higher value can solve the
|
||||
issue without any side effects.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mmc/mtk-sd.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/drivers/mmc/mtk-sd.c
|
||||
+++ b/drivers/mmc/mtk-sd.c
|
||||
@@ -232,6 +232,8 @@
|
||||
|
||||
#define SCLK_CYCLES_SHIFT 20
|
||||
|
||||
+#define MIN_BUS_CLK 260000
|
||||
+
|
||||
#define CMD_INTS_MASK \
|
||||
(MSDC_INT_CMDRDY | MSDC_INT_RSPCRCERR | MSDC_INT_CMDTMO)
|
||||
|
||||
@@ -1639,6 +1641,9 @@ static int msdc_drv_probe(struct udevice
|
||||
else
|
||||
cfg->f_min = host->src_clk_freq / (4 * 4095);
|
||||
|
||||
+ if (cfg->f_min < MIN_BUS_CLK)
|
||||
+ cfg->f_min = MIN_BUS_CLK;
|
||||
+
|
||||
cfg->f_max = host->src_clk_freq;
|
||||
|
||||
cfg->b_max = 1024;
|
||||
@ -0,0 +1,141 @@
|
||||
From d8bde59186dafdea5bbe8d29d3a6ae7cac98e9d0 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Mon, 25 Jan 2021 11:19:08 +0800
|
||||
Subject: [PATCH 11/21] serial: serial-mtk: rewrite the setbrg function
|
||||
|
||||
Currently the setbrg logic of serial-mtk is messy, and should be rewritten.
|
||||
Also an option is added to make it possible to use highspeed=3 mode for all
|
||||
bauds.
|
||||
|
||||
The new logic is:
|
||||
1. If baud clock > 12MHz
|
||||
a) If baud <= 115200, highspeed=0 mode will be used (ns16550 compatible)
|
||||
b) If baud <= 576000, highspeed=2 mode will be used
|
||||
c) any baud > 576000, highspeed=3 mode will be used
|
||||
2. If baud clock <= 12MHz
|
||||
Always uses highspeed=3 mode
|
||||
a) If baud <= 115200, calculates the divisor using DIV_ROUND_CLOSEST
|
||||
b) any baud > 115200, the same as 1. c)
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/serial/serial_mtk.c | 74 +++++++++++++++++--------------------
|
||||
1 file changed, 33 insertions(+), 41 deletions(-)
|
||||
|
||||
--- a/drivers/serial/serial_mtk.c
|
||||
+++ b/drivers/serial/serial_mtk.c
|
||||
@@ -73,74 +73,64 @@ struct mtk_serial_regs {
|
||||
struct mtk_serial_priv {
|
||||
struct mtk_serial_regs __iomem *regs;
|
||||
u32 clock;
|
||||
+ bool force_highspeed;
|
||||
};
|
||||
|
||||
static void _mtk_serial_setbrg(struct mtk_serial_priv *priv, int baud)
|
||||
{
|
||||
- bool support_clk12m_baud115200;
|
||||
- u32 quot, samplecount, realbaud;
|
||||
+ u32 quot, realbaud, samplecount = 1;
|
||||
|
||||
- if ((baud <= 115200) && (priv->clock == 12000000))
|
||||
- support_clk12m_baud115200 = true;
|
||||
- else
|
||||
- support_clk12m_baud115200 = false;
|
||||
+ /* Special case for low baud clock */
|
||||
+ if ((baud <= 115200) && (priv->clock == 12000000)) {
|
||||
+ writel(3, &priv->regs->highspeed);
|
||||
+
|
||||
+ quot = DIV_ROUND_CLOSEST(priv->clock, 256 * baud);
|
||||
+ if (quot == 0)
|
||||
+ quot = 1;
|
||||
+
|
||||
+ samplecount = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
+
|
||||
+ realbaud = priv->clock / samplecount / quot;
|
||||
+ if ((realbaud > BAUD_ALLOW_MAX(baud)) ||
|
||||
+ (realbaud < BAUD_ALLOW_MIX(baud))) {
|
||||
+ pr_info("baud %d can't be handled\n", baud);
|
||||
+ }
|
||||
+
|
||||
+ goto set_baud;
|
||||
+ }
|
||||
+
|
||||
+ if (priv->force_highspeed)
|
||||
+ goto use_hs3;
|
||||
|
||||
if (baud <= 115200) {
|
||||
writel(0, &priv->regs->highspeed);
|
||||
quot = DIV_ROUND_CLOSEST(priv->clock, 16 * baud);
|
||||
-
|
||||
- if (support_clk12m_baud115200) {
|
||||
- writel(3, &priv->regs->highspeed);
|
||||
- quot = DIV_ROUND_CLOSEST(priv->clock, 256 * baud);
|
||||
- if (quot == 0)
|
||||
- quot = 1;
|
||||
-
|
||||
- samplecount = DIV_ROUND_CLOSEST(priv->clock,
|
||||
- quot * baud);
|
||||
- if (samplecount != 0) {
|
||||
- realbaud = priv->clock / samplecount / quot;
|
||||
- if ((realbaud > BAUD_ALLOW_MAX(baud)) ||
|
||||
- (realbaud < BAUD_ALLOW_MIX(baud))) {
|
||||
- pr_info("baud %d can't be handled\n",
|
||||
- baud);
|
||||
- }
|
||||
- } else {
|
||||
- pr_info("samplecount is 0\n");
|
||||
- }
|
||||
- }
|
||||
} else if (baud <= 576000) {
|
||||
writel(2, &priv->regs->highspeed);
|
||||
|
||||
/* Set to next lower baudrate supported */
|
||||
if ((baud == 500000) || (baud == 576000))
|
||||
baud = 460800;
|
||||
+
|
||||
quot = DIV_ROUND_UP(priv->clock, 4 * baud);
|
||||
} else {
|
||||
+use_hs3:
|
||||
writel(3, &priv->regs->highspeed);
|
||||
+
|
||||
quot = DIV_ROUND_UP(priv->clock, 256 * baud);
|
||||
+ samplecount = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
}
|
||||
|
||||
+set_baud:
|
||||
/* set divisor */
|
||||
writel(UART_LCR_WLS_8 | UART_LCR_DLAB, &priv->regs->lcr);
|
||||
writel(quot & 0xff, &priv->regs->dll);
|
||||
writel((quot >> 8) & 0xff, &priv->regs->dlm);
|
||||
writel(UART_LCR_WLS_8, &priv->regs->lcr);
|
||||
|
||||
- if (baud > 460800) {
|
||||
- u32 tmp;
|
||||
-
|
||||
- tmp = DIV_ROUND_CLOSEST(priv->clock, quot * baud);
|
||||
- writel(tmp - 1, &priv->regs->sample_count);
|
||||
- writel((tmp - 2) >> 1, &priv->regs->sample_point);
|
||||
- } else {
|
||||
- writel(0, &priv->regs->sample_count);
|
||||
- writel(0xff, &priv->regs->sample_point);
|
||||
- }
|
||||
-
|
||||
- if (support_clk12m_baud115200) {
|
||||
- writel(samplecount - 1, &priv->regs->sample_count);
|
||||
- writel((samplecount - 2) >> 1, &priv->regs->sample_point);
|
||||
- }
|
||||
+ /* set highspeed mode sample count & point */
|
||||
+ writel(samplecount - 1, &priv->regs->sample_count);
|
||||
+ writel((samplecount - 2) >> 1, &priv->regs->sample_point);
|
||||
}
|
||||
|
||||
static int _mtk_serial_putc(struct mtk_serial_priv *priv, const char ch)
|
||||
@@ -248,6 +238,8 @@ static int mtk_serial_of_to_plat(struct
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+ priv->force_highspeed = dev_read_bool(dev, "mediatek,force-highspeed");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -0,0 +1,94 @@
|
||||
From a80ef99cb308904b82662deb66c5ed7a6ff59928 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 11:13:36 +0800
|
||||
Subject: [PATCH 12/21] board: mt7629: enable compression of u-boot to reduce
|
||||
the size of final image
|
||||
|
||||
This patch makes use of the decompression mechanism implemented for mt7628
|
||||
previously to reduce the total image size. Binman will be also removed.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
Makefile | 3 +++
|
||||
arch/arm/dts/mt7629-rfb-u-boot.dtsi | 18 ------------------
|
||||
arch/arm/mach-mediatek/Kconfig | 1 -
|
||||
configs/mt7629_rfb_defconfig | 6 ++++++
|
||||
4 files changed, 9 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1728,6 +1728,9 @@ u-boot-elf.lds: arch/u-boot-elf.lds prep
|
||||
|
||||
ifeq ($(CONFIG_SPL),y)
|
||||
spl/u-boot-spl-mtk.bin: spl/u-boot-spl
|
||||
+
|
||||
+u-boot-mtk.bin: u-boot-with-spl.bin
|
||||
+ $(call if_changed,copy)
|
||||
else
|
||||
MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
|
||||
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
|
||||
--- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
@@ -5,24 +5,6 @@
|
||||
* Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
*/
|
||||
|
||||
-#include <config.h>
|
||||
-/ {
|
||||
- binman {
|
||||
- filename = "u-boot-mtk.bin";
|
||||
- pad-byte = <0xff>;
|
||||
-
|
||||
-#ifdef CONFIG_SPL
|
||||
- blob {
|
||||
- filename = "spl/u-boot-spl-mtk.bin";
|
||||
- size = <CONFIG_SPL_PAD_TO>;
|
||||
- };
|
||||
-
|
||||
- u-boot-img {
|
||||
- };
|
||||
-#endif
|
||||
- };
|
||||
-};
|
||||
-
|
||||
&infracfg {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -36,7 +36,6 @@ config TARGET_MT7629
|
||||
bool "MediaTek MT7629 SoC"
|
||||
select CPU_V7A
|
||||
select SPL
|
||||
- select BINMAN
|
||||
help
|
||||
The MediaTek MT7629 is a ARM-based SoC with a dual-core Cortex-A7
|
||||
including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -10,7 +10,11 @@ CONFIG_SPL_TEXT_BASE=0x201000
|
||||
CONFIG_TARGET_MT7629=y
|
||||
CONFIG_SPL_SERIAL_SUPPORT=y
|
||||
CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
|
||||
+CONFIG_SPL_STACK_R_ADDR=0x40800000
|
||||
+CONFIG_SPL_PAYLOAD="u-boot-lzma.img"
|
||||
+CONFIG_BUILD_TARGET="u-boot-mtk.bin"
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
+CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_BOOTDELAY=3
|
||||
@@ -18,6 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+CONFIG_SPL_STACK_R=y
|
||||
CONFIG_SPL_NOR_SUPPORT=y
|
||||
CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
@@ -87,4 +92,5 @@ CONFIG_USB_STORAGE=y
|
||||
CONFIG_USB_KEYBOARD=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZMA=y
|
||||
+CONFIG_SPL_LZMA=y
|
||||
# CONFIG_EFI_LOADER is not set
|
||||
@ -0,0 +1,26 @@
|
||||
From acd49b1549ff52286aace5e841420aa750325f8b Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:53:14 +0800
|
||||
Subject: [PATCH 13/21] configs: mt7622: enable debug uart for
|
||||
mt7622_rfb_defconfig
|
||||
|
||||
Enable debug uart for mt7622_rfb_defconfig
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -4,7 +4,10 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
+CONFIG_DEBUG_UART=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_DEFAULT_FDT_FILE="mt7622-rfb"
|
||||
CONFIG_LOGLEVEL=7
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,174 @@
|
||||
From 0c857d4c9cd9dc8e8ebba18cf9e9b10513ccb35d Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 08:57:29 +0800
|
||||
Subject: [PATCH 15/21] mtd: mtk-snand: add support for SPL
|
||||
|
||||
Add support to initialize SPI-NAND in SPL.
|
||||
Add implementation for SPL NAND loader.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
drivers/mtd/mtk-snand/Kconfig | 6 ++
|
||||
drivers/mtd/mtk-snand/Makefile | 4 +
|
||||
drivers/mtd/mtk-snand/mtk-snand-spl.c | 132 ++++++++++++++++++++++++++
|
||||
3 files changed, 142 insertions(+)
|
||||
create mode 100644 drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
|
||||
--- a/drivers/mtd/mtk-snand/Kconfig
|
||||
+++ b/drivers/mtd/mtk-snand/Kconfig
|
||||
@@ -19,3 +19,9 @@ config MTK_SPI_NAND_MTD
|
||||
help
|
||||
This option enables access to SPI-NAND flashes through the
|
||||
MTD interface of MediaTek SPI NAND Flash Controller
|
||||
+
|
||||
+config SPL_MTK_SPI_NAND
|
||||
+ tristate "SPL support for MediaTek SPI NAND flash controller"
|
||||
+ depends on MTK_SPI_NAND
|
||||
+ help
|
||||
+ This option enables access to SPI-NAND flashes in the SPL stage
|
||||
--- a/drivers/mtd/mtk-snand/Makefile
|
||||
+++ b/drivers/mtd/mtk-snand/Makefile
|
||||
@@ -8,4 +8,8 @@
|
||||
obj-y += mtk-snand.o mtk-snand-ecc.o mtk-snand-ids.o mtk-snand-os.o
|
||||
obj-$(CONFIG_MTK_SPI_NAND_MTD) += mtk-snand-mtd.o
|
||||
|
||||
+ifdef CONFIG_SPL_BUILD
|
||||
+obj-$(CONFIG_SPL_MTK_SPI_NAND) += mtk-snand-spl.o
|
||||
+endif
|
||||
+
|
||||
ccflags-y += -DPRIVATE_MTK_SNAND_HEADER
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/mtk-snand/mtk-snand-spl.c
|
||||
@@ -0,0 +1,132 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <dm/uclass.h>
|
||||
+#include <malloc.h>
|
||||
+#include <mapmem.h>
|
||||
+#include <mtd.h>
|
||||
+#include <watchdog.h>
|
||||
+
|
||||
+#include "mtk-snand.h"
|
||||
+
|
||||
+static struct mtk_snand *snf;
|
||||
+static struct mtk_snand_chip_info cinfo;
|
||||
+static u32 oobavail;
|
||||
+
|
||||
+static u8 *page_cache;
|
||||
+
|
||||
+int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
|
||||
+{
|
||||
+ u32 sizeremain = size, chunksize, leading;
|
||||
+ uint32_t off = offs, writesize_mask = cinfo.pagesize - 1;
|
||||
+ uint8_t *ptr = dst;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!snf)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ while (sizeremain) {
|
||||
+ WATCHDOG_RESET();
|
||||
+
|
||||
+ leading = off & writesize_mask;
|
||||
+ chunksize = cinfo.pagesize - leading;
|
||||
+ if (chunksize > sizeremain)
|
||||
+ chunksize = sizeremain;
|
||||
+
|
||||
+ if (chunksize == cinfo.pagesize) {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading, ptr,
|
||||
+ NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+ } else {
|
||||
+ ret = mtk_snand_read_page(snf, off - leading,
|
||||
+ page_cache, NULL, false);
|
||||
+ if (ret)
|
||||
+ break;
|
||||
+
|
||||
+ memcpy(ptr, page_cache + leading, chunksize);
|
||||
+ }
|
||||
+
|
||||
+ off += chunksize;
|
||||
+ ptr += chunksize;
|
||||
+ sizeremain -= chunksize;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void nand_init(void)
|
||||
+{
|
||||
+ struct mtk_snand_platdata mtk_snand_pdata = {};
|
||||
+ struct udevice *dev;
|
||||
+ fdt_addr_t base;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = uclass_get_device_by_driver(UCLASS_MTD, DM_DRIVER_GET(mtk_snand),
|
||||
+ &dev);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: Device instance not found!\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "nfi");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: NFI base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.nfi_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ base = dev_read_addr_name(dev, "ecc");
|
||||
+ if (base == FDT_ADDR_T_NONE) {
|
||||
+ printf("mtk-snand-spl: ECC base not set\n");
|
||||
+ return;
|
||||
+ }
|
||||
+ mtk_snand_pdata.ecc_base = map_sysmem(base, 0);
|
||||
+
|
||||
+ mtk_snand_pdata.soc = dev_get_driver_data(dev);
|
||||
+ mtk_snand_pdata.quad_spi = dev_read_bool(dev, "quad-spi");
|
||||
+
|
||||
+ ret = mtk_snand_init(NULL, &mtk_snand_pdata, &snf);
|
||||
+ if (ret) {
|
||||
+ printf("mtk-snand-spl: failed to initialize SPI-NAND\n");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mtk_snand_get_chip_info(snf, &cinfo);
|
||||
+
|
||||
+ oobavail = cinfo.num_sectors * (cinfo.fdm_size - 1);
|
||||
+
|
||||
+ printf("SPI-NAND: %s (%uMB)\n", cinfo.model,
|
||||
+ (u32)(cinfo.chipsize >> 20));
|
||||
+
|
||||
+ page_cache = malloc(cinfo.pagesize + cinfo.sparesize);
|
||||
+ if (!page_cache) {
|
||||
+ mtk_snand_cleanup(snf);
|
||||
+ printf("mtk-snand-spl: failed to allocate page cache\n");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nand_deselect(void)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct udevice_id mtk_snand_ids[] = {
|
||||
+ { .compatible = "mediatek,mt7622-snand", .data = SNAND_SOC_MT7622 },
|
||||
+ { .compatible = "mediatek,mt7629-snand", .data = SNAND_SOC_MT7629 },
|
||||
+ { .compatible = "mediatek,mt7986-snand", .data = SNAND_SOC_MT7986 },
|
||||
+ { /* sentinel */ },
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DRIVER(mtk_snand) = {
|
||||
+ .name = "mtk-snand",
|
||||
+ .id = UCLASS_MTD,
|
||||
+ .of_match = mtk_snand_ids,
|
||||
+ .flags = DM_FLAG_PRE_RELOC,
|
||||
+};
|
||||
@ -0,0 +1,409 @@
|
||||
From eaa9bc597e0bf8bcd1486ea49c8c7c070a37a8aa Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:11:32 +0800
|
||||
Subject: [PATCH 16/21] env: add support for generic MTD device
|
||||
|
||||
Add an env driver for generic MTD device.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/nvedit.c | 3 +-
|
||||
env/Kconfig | 37 +++++-
|
||||
env/Makefile | 1 +
|
||||
env/env.c | 3 +
|
||||
env/mtd.c | 256 +++++++++++++++++++++++++++++++++++++++++
|
||||
include/env_internal.h | 1 +
|
||||
tools/Makefile | 1 +
|
||||
7 files changed, 299 insertions(+), 3 deletions(-)
|
||||
create mode 100644 env/mtd.c
|
||||
|
||||
--- a/cmd/nvedit.c
|
||||
+++ b/cmd/nvedit.c
|
||||
@@ -50,6 +50,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
defined(CONFIG_ENV_IS_IN_MMC) || \
|
||||
defined(CONFIG_ENV_IS_IN_FAT) || \
|
||||
defined(CONFIG_ENV_IS_IN_EXT4) || \
|
||||
+ defined(CONFIG_ENV_IS_IN_MTD) || \
|
||||
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;
|
||||
|
||||
#if !defined(ENV_IS_IN_DEVICE) && \
|
||||
!defined(CONFIG_ENV_IS_NOWHERE)
|
||||
-# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
|
||||
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|MTD|\
|
||||
NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
|
||||
#endif
|
||||
|
||||
--- a/env/Kconfig
|
||||
+++ b/env/Kconfig
|
||||
@@ -19,7 +19,7 @@ config ENV_IS_NOWHERE
|
||||
!ENV_IS_IN_MMC && !ENV_IS_IN_NAND && \
|
||||
!ENV_IS_IN_NVRAM && !ENV_IS_IN_ONENAND && \
|
||||
!ENV_IS_IN_REMOTE && !ENV_IS_IN_SPI_FLASH && \
|
||||
- !ENV_IS_IN_UBI
|
||||
+ !ENV_IS_IN_UBI && !ENV_IS_IN_MTD
|
||||
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
|
||||
This value is also in units of bytes, but must also be aligned to
|
||||
an MMC sector boundary.
|
||||
|
||||
+config ENV_IS_IN_MTD
|
||||
+ bool "Environment in a MTD device"
|
||||
+ depends on !CHAIN_OF_TRUST
|
||||
+ depends on MTD
|
||||
+ help
|
||||
+ Define this if you have a MTD device which you want to use for
|
||||
+ the environment.
|
||||
+
|
||||
+ - CONFIG_ENV_MTD_NAME:
|
||||
+ - CONFIG_ENV_OFFSET:
|
||||
+ - CONFIG_ENV_SIZE:
|
||||
+
|
||||
+ These three #defines specify the MTD device where the environment
|
||||
+ is stored, offset and size of the environment area within the MTD
|
||||
+ device. CONFIG_ENV_OFFSET must be aligned to an erase block boundary.
|
||||
+
|
||||
+ - CONFIG_ENV_SIZE_REDUND:
|
||||
+
|
||||
+ This #define specify the maximum size allowed for read/write/erase
|
||||
+ with skipped bad blocks starting from ENV_OFFSET.
|
||||
+
|
||||
config ENV_IS_IN_NAND
|
||||
bool "Environment in a NAND device"
|
||||
depends on !CHAIN_OF_TRUST
|
||||
@@ -513,10 +534,16 @@ config ENV_ADDR_REDUND
|
||||
Offset from the start of the device (or partition) of the redundant
|
||||
environment location.
|
||||
|
||||
+config ENV_MTD_NAME
|
||||
+ string "Name of the MTD device storing the environment"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ Name of the MTD device that stores the environment
|
||||
+
|
||||
config ENV_OFFSET
|
||||
hex "Environment offset"
|
||||
depends on ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
|
||||
- ENV_IS_IN_SPI_FLASH
|
||||
+ ENV_IS_IN_SPI_FLASH || ENV_IS_IN_MTD
|
||||
default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
|
||||
default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
|
||||
default 0x88000 if ARCH_SUNXI
|
||||
@@ -560,6 +587,12 @@ config ENV_SECT_SIZE
|
||||
help
|
||||
Size of the sector containing the environment.
|
||||
|
||||
+config ENV_SIZE_REDUND
|
||||
+ hex "Redundant environment size"
|
||||
+ depends on ENV_IS_IN_MTD
|
||||
+ help
|
||||
+ The maximum size allowed for read/write/erase with skipped bad blocks.
|
||||
+
|
||||
config ENV_UBI_PART
|
||||
string "UBI partition name"
|
||||
depends on ENV_IS_IN_UBI
|
||||
--- a/env/Makefile
|
||||
+++ b/env/Makefile
|
||||
@@ -26,6 +26,7 @@ obj-$(CONFIG_$(SPL_TPL_)ENV_IS_NOWHERE)
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MMC) += mmc.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FAT) += fat.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_EXT4) += ext4.o
|
||||
+obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_MTD) += mtd.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_NAND) += nand.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_SPI_FLASH) += sf.o
|
||||
obj-$(CONFIG_$(SPL_TPL_)ENV_IS_IN_FLASH) += flash.o
|
||||
--- a/env/env.c
|
||||
+++ b/env/env.c
|
||||
@@ -69,6 +69,9 @@ static enum env_location env_locations[]
|
||||
#ifdef CONFIG_ENV_IS_IN_MMC
|
||||
ENVL_MMC,
|
||||
#endif
|
||||
+#ifdef CONFIG_ENV_IS_IN_MTD
|
||||
+ ENVL_MTD,
|
||||
+#endif
|
||||
#ifdef CONFIG_ENV_IS_IN_NAND
|
||||
ENVL_NAND,
|
||||
#endif
|
||||
--- /dev/null
|
||||
+++ b/env/mtd.c
|
||||
@@ -0,0 +1,256 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+/*
|
||||
+ * Copyright (C) 2021 MediaTek Inc. All Rights Reserved.
|
||||
+ *
|
||||
+ * Author: Weijie Gao <weijie.gao@mediatek.com>
|
||||
+ */
|
||||
+
|
||||
+#include <command.h>
|
||||
+#include <env.h>
|
||||
+#include <env_internal.h>
|
||||
+#include <errno.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/stddef.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/mtd/mtd.h>
|
||||
+#include <malloc.h>
|
||||
+#include <memalign.h>
|
||||
+#include <mtd.h>
|
||||
+#include <search.h>
|
||||
+
|
||||
+#if CONFIG_ENV_SIZE_REDUND < CONFIG_ENV_SIZE
|
||||
+#undef CONFIG_ENV_SIZE_REDUND
|
||||
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
|
||||
+#endif
|
||||
+
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+env_t *env_ptr = &environment;
|
||||
+#else /* ! ENV_IS_EMBEDDED */
|
||||
+env_t *env_ptr;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static int env_mtd_init(void)
|
||||
+{
|
||||
+#if defined(ENV_IS_EMBEDDED)
|
||||
+ int crc1_ok = 0, crc2_ok = 0;
|
||||
+ env_t *tmp_env1;
|
||||
+
|
||||
+ tmp_env1 = env_ptr;
|
||||
+ crc1_ok = crc32(0, tmp_env1->data, ENV_SIZE) == tmp_env1->crc;
|
||||
+
|
||||
+ if (!crc1_ok && !crc2_ok) {
|
||||
+ gd->env_addr = 0;
|
||||
+ gd->env_valid = ENV_INVALID;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else if (crc1_ok && !crc2_ok) {
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+ }
|
||||
+
|
||||
+ if (gd->env_valid == ENV_VALID)
|
||||
+ env_ptr = tmp_env1;
|
||||
+
|
||||
+ gd->env_addr = (ulong)env_ptr->data;
|
||||
+
|
||||
+#else /* ENV_IS_EMBEDDED */
|
||||
+ gd->env_addr = (ulong)&default_environment[0];
|
||||
+ gd->env_valid = ENV_VALID;
|
||||
+#endif /* ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct mtd_info *env_mtd_get_dev(void)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+
|
||||
+ mtd_probe_devices();
|
||||
+
|
||||
+ mtd = get_mtd_device_nm(CONFIG_ENV_MTD_NAME);
|
||||
+ if (IS_ERR(mtd) || !mtd) {
|
||||
+ printf("MTD device '%s' not found\n", CONFIG_ENV_MTD_NAME);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return mtd;
|
||||
+}
|
||||
+
|
||||
+static inline bool mtd_addr_is_block_aligned(struct mtd_info *mtd, u64 addr)
|
||||
+{
|
||||
+ return (addr & mtd->erasesize_mask) == 0;
|
||||
+}
|
||||
+
|
||||
+static int mtd_io_skip_bad(struct mtd_info *mtd, bool read, loff_t offset,
|
||||
+ size_t length, size_t redund, u8 *buffer)
|
||||
+{
|
||||
+ struct mtd_oob_ops io_op = {};
|
||||
+ size_t remaining = length;
|
||||
+ loff_t off, end;
|
||||
+ int ret;
|
||||
+
|
||||
+ io_op.mode = MTD_OPS_PLACE_OOB;
|
||||
+ io_op.len = mtd->writesize;
|
||||
+ io_op.datbuf = (void *)buffer;
|
||||
+
|
||||
+ /* Search for the first good block after the given offset */
|
||||
+ off = offset;
|
||||
+ end = (off + redund) | (mtd->erasesize - 1);
|
||||
+ while (mtd_block_isbad(mtd, off) && off < end)
|
||||
+ off += mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+
|
||||
+ /* Loop over the pages to do the actual read/write */
|
||||
+ while (remaining) {
|
||||
+ /* Skip the block if it is bad */
|
||||
+ if (mtd_addr_is_block_aligned(mtd, off) &&
|
||||
+ mtd_block_isbad(mtd, off)) {
|
||||
+ off += mtd->erasesize;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (read)
|
||||
+ ret = mtd_read_oob(mtd, off, &io_op);
|
||||
+ else
|
||||
+ ret = mtd_write_oob(mtd, off, &io_op);
|
||||
+
|
||||
+ if (ret) {
|
||||
+ printf("Failure while %s at offset 0x%llx\n",
|
||||
+ read ? "reading" : "writing", off);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ off += io_op.retlen;
|
||||
+ remaining -= io_op.retlen;
|
||||
+ io_op.datbuf += io_op.retlen;
|
||||
+ io_op.oobbuf += io_op.oobretlen;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (off >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+#ifdef CONFIG_CMD_SAVEENV
|
||||
+static int mtd_erase_skip_bad(struct mtd_info *mtd, loff_t offset,
|
||||
+ size_t length, size_t redund)
|
||||
+{
|
||||
+ struct erase_info erase_op = {};
|
||||
+ loff_t end = (offset + redund) | (mtd->erasesize - 1);
|
||||
+ int ret;
|
||||
+
|
||||
+ erase_op.mtd = mtd;
|
||||
+ erase_op.addr = offset;
|
||||
+ erase_op.len = length;
|
||||
+
|
||||
+ while (erase_op.len) {
|
||||
+ ret = mtd_erase(mtd, &erase_op);
|
||||
+
|
||||
+ /* Abort if its not a bad block error */
|
||||
+ if (ret != -EIO)
|
||||
+ return ret;
|
||||
+
|
||||
+ printf("Skipping bad block at 0x%08llx\n", erase_op.fail_addr);
|
||||
+
|
||||
+ /* Skip bad block and continue behind it */
|
||||
+ erase_op.len -= erase_op.fail_addr - erase_op.addr;
|
||||
+ erase_op.len -= mtd->erasesize;
|
||||
+ erase_op.addr = erase_op.fail_addr + mtd->erasesize;
|
||||
+
|
||||
+ /* Reached end position */
|
||||
+ if (erase_op.addr >= end)
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_save(void)
|
||||
+{
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret = 0;
|
||||
+
|
||||
+ ret = env_export(env_new);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ printf("Erasing on MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_erase_skip_bad(mtd, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ if (ret) {
|
||||
+ put_mtd_device(mtd);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ printf("Writing to MTD device '%s'... ", mtd->name);
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, false, CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, (u8 *)env_new);
|
||||
+
|
||||
+ puts(ret ? "FAILED\n" : "OK\n");
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+#endif /* CONFIG_CMD_SAVEENV */
|
||||
+
|
||||
+static int readenv(size_t offset, u_char *buf)
|
||||
+{
|
||||
+ struct mtd_info *mtd;
|
||||
+ int ret;
|
||||
+
|
||||
+ mtd = env_mtd_get_dev();
|
||||
+ if (!mtd)
|
||||
+ return 1;
|
||||
+
|
||||
+ ret = mtd_io_skip_bad(mtd, true, offset, CONFIG_ENV_SIZE,
|
||||
+ CONFIG_ENV_SIZE_REDUND, buf);
|
||||
+
|
||||
+ put_mtd_device(mtd);
|
||||
+
|
||||
+ return !!ret;
|
||||
+}
|
||||
+
|
||||
+static int env_mtd_load(void)
|
||||
+{
|
||||
+#if !defined(ENV_IS_EMBEDDED)
|
||||
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = readenv(CONFIG_ENV_OFFSET, (u_char *)buf);
|
||||
+ if (ret) {
|
||||
+ env_set_default("readenv() failed", 0);
|
||||
+ return -EIO;
|
||||
+ }
|
||||
+
|
||||
+ return env_import(buf, 1, H_EXTERNAL);
|
||||
+#endif /* ! ENV_IS_EMBEDDED */
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+U_BOOT_ENV_LOCATION(mtd) = {
|
||||
+ .location = ENVL_MTD,
|
||||
+ ENV_NAME("MTD")
|
||||
+ .load = env_mtd_load,
|
||||
+#if defined(CONFIG_CMD_SAVEENV)
|
||||
+ .save = env_save_ptr(env_mtd_save),
|
||||
+#endif
|
||||
+ .init = env_mtd_init,
|
||||
+};
|
||||
--- a/include/env_internal.h
|
||||
+++ b/include/env_internal.h
|
||||
@@ -131,6 +131,7 @@ enum env_location {
|
||||
ENVL_FAT,
|
||||
ENVL_FLASH,
|
||||
ENVL_MMC,
|
||||
+ ENVL_MTD,
|
||||
ENVL_NAND,
|
||||
ENVL_NVRAM,
|
||||
ENVL_ONENAND,
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -22,6 +22,7 @@ ENVCRC-$(CONFIG_ENV_IS_EMBEDDED) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_EEPROM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_FLASH) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_ONENAND) = y
|
||||
+ENVCRC-$(CONFIG_ENV_IS_IN_MTD) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NAND) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
|
||||
ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
|
||||
@ -0,0 +1,266 @@
|
||||
From 47b386259625061b376f538055a4f3fbd0ab7fef Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:48:53 +0800
|
||||
Subject: [PATCH 17/21] board: mt7629: add support for booting from SPI-NAND
|
||||
|
||||
Add support for mt7629 to boot from SPI-NAND.
|
||||
Add a new defconfig for mt7629+spi-nand configuration.
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7629-rfb-u-boot.dtsi | 8 ++
|
||||
arch/arm/dts/mt7629-rfb.dts | 10 +++
|
||||
arch/arm/dts/mt7629.dtsi | 16 ++++
|
||||
board/mediatek/mt7629/Kconfig | 35 ++++++++-
|
||||
configs/mt7629_nand_rfb_defconfig | 111 ++++++++++++++++++++++++++++
|
||||
include/configs/mt7629.h | 7 ++
|
||||
6 files changed, 186 insertions(+), 1 deletion(-)
|
||||
create mode 100644 configs/mt7629_nand_rfb_defconfig
|
||||
|
||||
--- a/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
+++ b/arch/arm/dts/mt7629-rfb-u-boot.dtsi
|
||||
@@ -40,3 +40,11 @@
|
||||
&snfi {
|
||||
u-boot,dm-pre-reloc;
|
||||
};
|
||||
+
|
||||
+&pinctrl {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
+
|
||||
+&snand {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+};
|
||||
--- a/arch/arm/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7629-rfb.dts
|
||||
@@ -47,9 +47,12 @@
|
||||
};
|
||||
|
||||
snfi_pins: snfi-pins {
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+
|
||||
mux {
|
||||
function = "flash";
|
||||
groups = "snfi";
|
||||
+ u-boot,dm-pre-reloc;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -102,6 +105,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/dts/mt7629.dtsi
|
||||
@@ -229,6 +229,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7629-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
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 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_SYS_ARCH_TIMER=y
|
||||
+CONFIG_SYS_THUMB_BUILD=y
|
||||
+CONFIG_ARCH_MEDIATEK=y
|
||||
+CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x100000
|
||||
+CONFIG_SPL_TEXT_BASE=0x201000
|
||||
+CONFIG_TARGET_MT7629=y
|
||||
+CONFIG_BOOT_FROM_SNAND_2K_64=y
|
||||
+CONFIG_SPL_SERIAL_SUPPORT=y
|
||||
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
|
||||
+CONFIG_SPL_STACK_R_ADDR=0x40800000
|
||||
+CONFIG_SPL_PAYLOAD="u-boot.img"
|
||||
+CONFIG_BUILD_TARGET="u-boot-mtk.bin"
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
|
||||
+CONFIG_SPL_IMAGE="spl/u-boot-spl-mtk.bin"
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_VERBOSE=y
|
||||
+CONFIG_BOOTDELAY=3
|
||||
+CONFIG_DEFAULT_FDT_FILE="mt7629-rfb"
|
||||
+CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
+CONFIG_SYS_STDIO_DEREGISTER=y
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
|
||||
+CONFIG_SPL_STACK_R=y
|
||||
+CONFIG_SPL_MTD_SUPPORT=y
|
||||
+CONFIG_SPL_NAND_SUPPORT=y
|
||||
+CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_PROMPT="U-Boot> "
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
+# CONFIG_CMD_ELF is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_DM=y
|
||||
+# CONFIG_CMD_FLASH is not set
|
||||
+CONFIG_CMD_GPIO=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_USB=y
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+# CONFIG_CMD_NFS is not set
|
||||
+CONFIG_CMD_PING=y
|
||||
+CONFIG_CMD_FAT=y
|
||||
+CONFIG_CMD_FS_GENERIC=y
|
||||
+CONFIG_CMD_LOG=y
|
||||
+CONFIG_EFI_PARTITION=y
|
||||
+# CONFIG_SPL_PARTITION_UUIDS is not set
|
||||
+CONFIG_PARTITION_TYPE_GUID=y
|
||||
+CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-parents"
|
||||
+CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="spi-nand0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SPL_DM_SEQ_ALIAS=y
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SPL_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_SPL_SYSCON=y
|
||||
+CONFIG_BLK=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_SPL_CLK=y
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SPL_MTK_SPI_NAND=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PINCTRL=y
|
||||
+CONFIG_PINCONF=y
|
||||
+CONFIG_SPL_PINCTRL=y
|
||||
+CONFIG_SPL_PINCONF=y
|
||||
+CONFIG_PINCTRL_MT7629=y
|
||||
+CONFIG_POWER_DOMAIN=y
|
||||
+CONFIG_MTK_POWER_DOMAIN=y
|
||||
+CONFIG_DM_REGULATOR=y
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_RAM=y
|
||||
+CONFIG_SPL_RAM=y
|
||||
+CONFIG_DM_SERIAL=y
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_SPI_MEM=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_SYSRESET=y
|
||||
+CONFIG_SPL_SYSRESET=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_USB=y
|
||||
+CONFIG_DM_USB=y
|
||||
+# CONFIG_SPL_DM_USB is not set
|
||||
+CONFIG_USB_XHCI_HCD=y
|
||||
+CONFIG_USB_XHCI_MTK=y
|
||||
+CONFIG_USB_STORAGE=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+CONFIG_FAT_WRITE=y
|
||||
+CONFIG_LZMA=y
|
||||
+CONFIG_SPL_LZMA=y
|
||||
+# CONFIG_EFI_LOADER is not set
|
||||
--- a/include/configs/mt7629.h
|
||||
+++ b/include/configs/mt7629.h
|
||||
@@ -30,12 +30,19 @@
|
||||
|
||||
/* Defines for SPL */
|
||||
#define CONFIG_SPL_STACK 0x106000
|
||||
+#ifdef CONFIG_MT7629_BOOT_FROM_SNAND
|
||||
+#define CONFIG_SPL_MAX_SIZE SZ_128K
|
||||
+#define CONFIG_SPL_MAX_FOOTPRINT SZ_128K
|
||||
+#define CONFIG_SPL_PAD_TO 0x20000
|
||||
+#define CONFIG_SYS_NAND_U_BOOT_OFFS CONFIG_SPL_PAD_TO
|
||||
+#else
|
||||
#define CONFIG_SPL_MAX_SIZE SZ_64K
|
||||
#define CONFIG_SPL_MAX_FOOTPRINT SZ_64K
|
||||
#define CONFIG_SPL_PAD_TO 0x10000
|
||||
|
||||
#define CONFIG_SPI_ADDR 0x30000000
|
||||
#define CONFIG_SYS_UBOOT_BASE (CONFIG_SPI_ADDR + CONFIG_SPL_PAD_TO)
|
||||
+#endif
|
||||
|
||||
/* SPL -> Uboot */
|
||||
#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + SZ_2M - \
|
||||
@ -0,0 +1,76 @@
|
||||
From ec0d1899b035700a657721761ff6370b940450ab Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 10:51:43 +0800
|
||||
Subject: [PATCH 18/21] board: mt7622: use new spi-nand driver
|
||||
|
||||
Enable new spi-nand driver support for mt7622_rfb_defconfig
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7622-rfb.dts | 7 +++++++
|
||||
arch/arm/dts/mt7622.dtsi | 16 ++++++++++++++++
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
3 files changed, 28 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7622-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7622-rfb.dts
|
||||
@@ -188,6 +188,13 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7622.dtsi
|
||||
+++ b/arch/arm/dts/mt7622.dtsi
|
||||
@@ -53,6 +53,22 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ snand: snand@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-snand";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ reg-names = "nfi", "ecc";
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
|
||||
+ assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>;
|
||||
+ assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
snor: snor@11014000 {
|
||||
compatible = "mediatek,mtk-snor";
|
||||
reg = <0x11014000 0x1000>;
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -15,6 +15,7 @@ CONFIG_LOG=y
|
||||
CONFIG_SYS_PROMPT="MT7622> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_MTD=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
@@ -28,6 +29,10 @@ CONFIG_CLK=y
|
||||
CONFIG_DM_MMC=y
|
||||
CONFIG_MMC_HS200_SUPPORT=y
|
||||
CONFIG_MMC_MTK=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
CONFIG_DM_SPI_FLASH=y
|
||||
CONFIG_SPI_FLASH_EON=y
|
||||
CONFIG_SPI_FLASH_GIGADEVICE=y
|
||||
@ -0,0 +1,31 @@
|
||||
From 2f7aaf3c2c127bd53d5e8bfe39e808fdd6eb99be Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Wed, 3 Mar 2021 12:12:39 +0800
|
||||
Subject: [PATCH 19/21] configs: mt7629: remove unused options and add dm
|
||||
command
|
||||
|
||||
Remove unused bootm options
|
||||
Add dm command
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7629_rfb_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/configs/mt7629_rfb_defconfig
|
||||
+++ b/configs/mt7629_rfb_defconfig
|
||||
@@ -28,9 +28,14 @@ CONFIG_SPL_WATCHDOG_SUPPORT=y
|
||||
CONFIG_HUSH_PARSER=y
|
||||
CONFIG_SYS_PROMPT="U-Boot> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
+# CONFIG_BOOTM_NETBSD is not set
|
||||
+# CONFIG_BOOTM_PLAN9 is not set
|
||||
+# CONFIG_BOOTM_RTEMS is not set
|
||||
+# CONFIG_BOOTM_VXWORKS is not set
|
||||
# CONFIG_CMD_ELF is not set
|
||||
# CONFIG_CMD_XIMG is not set
|
||||
CONFIG_CMD_BIND=y
|
||||
+CONFIG_CMD_DM=y
|
||||
# CONFIG_CMD_FLASH is not set
|
||||
CONFIG_CMD_GPIO=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
@ -0,0 +1,33 @@
|
||||
From e5a71a0eebadfb3d75d8619a8b317eec58b2bca2 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Sat, 6 Mar 2021 16:29:33 +0800
|
||||
Subject: [PATCH 20/21] configs: mt7622: enable environment for mt7622_rfb
|
||||
|
||||
Enable environment vairables for mt7622_rfb
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -4,6 +4,8 @@ CONFIG_ARCH_MEDIATEK=y
|
||||
CONFIG_SYS_TEXT_BASE=0x41e00000
|
||||
CONFIG_SYS_MALLOC_F_LEN=0x4000
|
||||
CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_ENV_SIZE=0x20000
|
||||
+CONFIG_ENV_OFFSET=0x280000
|
||||
CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="mt7622-rfb"
|
||||
@@ -21,6 +23,9 @@ CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
CONFIG_CMD_SMC=y
|
||||
CONFIG_ENV_OVERWRITE=y
|
||||
+CONFIG_ENV_IS_IN_MTD=y
|
||||
+CONFIG_ENV_MTD_NAME="spi-nand0"
|
||||
+CONFIG_ENV_SIZE_REDUND=0x40000
|
||||
CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
CONFIG_REGMAP=y
|
||||
@ -0,0 +1,31 @@
|
||||
From 4bdab0ea008113dda4e001ab8d6863945000c1b2 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Thu, 11 Mar 2021 14:58:26 +0000
|
||||
Subject: [PATCH 21/21] mmc: mtk-sd: don't ignore max-frequency from device
|
||||
tree
|
||||
|
||||
commit e58e68d9 ("mmc: mtk-sd: assign plat->cfg.f_max with a correct value")
|
||||
wrongly assumed that plat->cfg.f_max is always unset at the time
|
||||
mscd_drv_probe() is run. This is not true in case max-frequency being
|
||||
defined in device tree, as it is then already set by mmc_of_parser()
|
||||
in msdc_of_to_plat().
|
||||
Only set plat->cfg.f_max to the default maximum value in case it is
|
||||
not already set to a sane value.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
drivers/mmc/mtk-sd.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mmc/mtk-sd.c
|
||||
+++ b/drivers/mmc/mtk-sd.c
|
||||
@@ -1644,7 +1644,8 @@ static int msdc_drv_probe(struct udevice
|
||||
if (cfg->f_min < MIN_BUS_CLK)
|
||||
cfg->f_min = MIN_BUS_CLK;
|
||||
|
||||
- cfg->f_max = host->src_clk_freq;
|
||||
+ if (cfg->f_max < cfg->f_min || cfg->f_max > host->src_clk_freq)
|
||||
+ cfg->f_max = host->src_clk_freq;
|
||||
|
||||
cfg->b_max = 1024;
|
||||
cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,57 +0,0 @@
|
||||
From b1b3c3d2ce62872c8dec4a7d645af6b3c565e094 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Mon, 20 Apr 2020 17:11:32 +0800
|
||||
Subject: [PATCH 2/3] mt7622 uboot: add dts and config for spi nand
|
||||
|
||||
This patch add dts and config for mt7622 spi nand
|
||||
|
||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
---
|
||||
arch/arm/dts/mt7622-rfb.dts | 6 ++++++
|
||||
arch/arm/dts/mt7622.dtsi | 20 ++++++++++++++++++++
|
||||
2 files changed, 26 insertions(+)
|
||||
|
||||
--- a/arch/arm/dts/mt7622-rfb.dts
|
||||
+++ b/arch/arm/dts/mt7622-rfb.dts
|
||||
@@ -174,6 +174,12 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&nandc {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_pins>;
|
||||
--- a/arch/arm/dts/mt7622.dtsi
|
||||
+++ b/arch/arm/dts/mt7622.dtsi
|
||||
@@ -53,6 +53,26 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ nandc: nfi@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-nfc";
|
||||
+ reg = <0x1100d000 0x1000>,
|
||||
+ <0x1100e000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>,
|
||||
+ <GIC_SPI 95 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_NFIECC_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>,
|
||||
+ <&topckgen CLK_TOP_NFI_INFRA_SEL>,
|
||||
+ <&topckgen CLK_TOP_UNIVPLL2_D8>;
|
||||
+ clock-names = "nfi_clk",
|
||||
+ "ecc_clk",
|
||||
+ "snfi_clk",
|
||||
+ "spinfi_sel",
|
||||
+ "spinfi_parent_50m";
|
||||
+ nand-ecc-mode = "hw";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
timer {
|
||||
compatible = "arm,armv8-timer";
|
||||
interrupt-parent = <&gic>;
|
||||
@ -1,22 +0,0 @@
|
||||
From e5745143a2984cf44fbfc0b3aedb49e57873f109 Mon Sep 17 00:00:00 2001
|
||||
From: Sam Shih <sam.shih@mediatek.com>
|
||||
Date: Mon, 20 Apr 2020 17:17:04 +0800
|
||||
Subject: [PATCH 3/3] configs: enable mtd and mtk_spi_nand in defconfig
|
||||
|
||||
This patch enable mtk and mtk_spi_nand in mt7622_rfb defconfig
|
||||
|
||||
Signed-off-by: Sam Shih <sam.shih@mediatek.com>
|
||||
---
|
||||
configs/mt7622_rfb_defconfig | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/configs/mt7622_rfb_defconfig
|
||||
+++ b/configs/mt7622_rfb_defconfig
|
||||
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_FDT_FILE="mt7622-rfb"
|
||||
CONFIG_SYS_PROMPT="MT7622> "
|
||||
CONFIG_CMD_BOOTMENU=y
|
||||
CONFIG_CMD_MMC=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
CONFIG_CMD_PCI=y
|
||||
CONFIG_CMD_SF_TEST=y
|
||||
CONFIG_CMD_PING=y
|
||||
@ -1,38 +0,0 @@
|
||||
From a6bfd71a96201127836d59736abcb54dc2d5e1a5 Mon Sep 17 00:00:00 2001
|
||||
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
Date: Mon, 14 Sep 2020 12:50:56 +0200
|
||||
Subject: [PATCH] cmd/button: return button status
|
||||
|
||||
To make the button command useful in a shell script it should return the
|
||||
status of the button:
|
||||
|
||||
* 0 (true) - pressed, on
|
||||
* 1 (false) - not pressed, off
|
||||
|
||||
The button command takes only one argument. Correct maxargs.
|
||||
|
||||
Adjust the Python unit test.
|
||||
|
||||
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>
|
||||
---
|
||||
cmd/button.c | 4 ++--
|
||||
test/py/tests/test_button.py | 34 ++++++++++++++++++++++++++--------
|
||||
2 files changed, 28 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/cmd/button.c
|
||||
+++ b/cmd/button.c
|
||||
@@ -75,11 +75,11 @@ int do_button(struct cmd_tbl *cmdtp, int
|
||||
|
||||
ret = show_button_state(dev);
|
||||
|
||||
- return 0;
|
||||
+ return !ret;
|
||||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
- button, 4, 1, do_button,
|
||||
+ button, 2, 1, do_button,
|
||||
"manage buttons",
|
||||
"<button_label> \tGet button state\n"
|
||||
"button list\t\tShow a list of buttons"
|
||||
@ -0,0 +1,24 @@
|
||||
From 7089c413216f1c0e374d71187030fe41ae4b3071 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Tue, 3 Nov 2020 19:45:30 +0100
|
||||
Subject: [PATCH] ahci: mediatek: fix missing dev_err definition
|
||||
|
||||
---
|
||||
drivers/ata/mtk_ahci.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c
|
||||
index 554175bc00..2c5227df30 100644
|
||||
--- a/drivers/ata/mtk_ahci.c
|
||||
+++ b/drivers/ata/mtk_ahci.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <sata.h>
|
||||
#include <scsi.h>
|
||||
#include <syscon.h>
|
||||
+#include <dm/device_compat.h>
|
||||
|
||||
#define SYS_CFG 0x14
|
||||
#define SYS_CFG_SATA_MSK GENMASK(31, 30)
|
||||
--
|
||||
2.30.2
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1716,6 +1716,10 @@ u-boot-elf.lds: arch/u-boot-elf.lds prep
|
||||
|
||||
ifeq ($(CONFIG_SPL),y)
|
||||
spl/u-boot-spl-mtk.bin: spl/u-boot-spl
|
||||
+OBJCOPYFLAGS_u-boot-mtk.bin = -I binary -O binary \
|
||||
+ --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
|
||||
+u-boot-mtk.bin: u-boot.img spl/u-boot-spl-mtk.bin FORCE
|
||||
+ $(call if_changed,pad_cat)
|
||||
else
|
||||
MKIMAGEFLAGS_u-boot-mtk.bin = -T mtk_image \
|
||||
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
|
||||
--- a/arch/arm/mach-mediatek/Kconfig
|
||||
+++ b/arch/arm/mach-mediatek/Kconfig
|
||||
@@ -36,7 +36,6 @@ config TARGET_MT7629
|
||||
bool "MediaTek MT7629 SoC"
|
||||
select CPU_V7A
|
||||
select SPL
|
||||
- select BINMAN
|
||||
help
|
||||
The MediaTek MT7629 is a ARM-based SoC with a dual-core Cortex-A7
|
||||
including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,
|
||||
@ -1,11 +0,0 @@
|
||||
--- a/include/configs/mt7622.h
|
||||
+++ b/include/configs/mt7622.h
|
||||
@@ -37,7 +37,7 @@
|
||||
#endif
|
||||
|
||||
#define CONFIG_SYS_MAXARGS 8
|
||||
-#define CONFIG_SYS_BOOTM_LEN SZ_64M
|
||||
+#define CONFIG_SYS_BOOTM_LEN SZ_128M
|
||||
#define CONFIG_SYS_CBSIZE SZ_1K
|
||||
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
|
||||
sizeof(CONFIG_SYS_PROMPT) + 16)
|
||||
@ -0,0 +1,24 @@
|
||||
From b137ca16b54c67d76714ea5a0138741959b0dc29 Mon Sep 17 00:00:00 2001
|
||||
From: David Bauer <mail@david-bauer.net>
|
||||
Date: Mon, 13 Jul 2020 23:37:37 +0200
|
||||
Subject: [PATCH] scripts: remove dependency on swig
|
||||
|
||||
Don't build the libfdt tool, as it has a dependency on swig (which
|
||||
OpenWrt does not ship).
|
||||
|
||||
This requires more hacks, as of-platdata generation does not work
|
||||
without it.
|
||||
|
||||
Signed-off-by: David Bauer <mail@david-bauer.net>
|
||||
---
|
||||
scripts/dtc/Makefile | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
--- a/scripts/dtc/Makefile
|
||||
+++ b/scripts/dtc/Makefile
|
||||
@@ -18,5 +18,3 @@ HOSTCFLAGS_dtc-parser.tab.o := -I$(src)
|
||||
# dependencies on generated files need to be listed explicitly
|
||||
$(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
|
||||
|
||||
-# Added for U-Boot
|
||||
-subdir-$(CONFIG_PYLIBFDT) += pylibfdt
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/cmd/bootm.c
|
||||
+++ b/cmd/bootm.c
|
||||
@@ -227,6 +227,65 @@ U_BOOT_CMD(
|
||||
@@ -228,6 +228,65 @@ U_BOOT_CMD(
|
||||
/* iminfo - print header info for a requested image */
|
||||
/*******************************************************************/
|
||||
#if defined(CONFIG_CMD_IMI)
|
||||
@ -10,7 +10,7 @@
|
||||
+{
|
||||
+ ulong addr;
|
||||
+ void *fit;
|
||||
+ int bsize, tsize, maxhdrsize;
|
||||
+ int bsize, tsize;
|
||||
+ char buf[16];
|
||||
+
|
||||
+ if (argc >= 2)
|
||||
@ -68,7 +68,7 @@
|
||||
{
|
||||
--- a/common/image-fit.c
|
||||
+++ b/common/image-fit.c
|
||||
@@ -1878,6 +1878,51 @@ static const char *fit_get_image_type_pr
|
||||
@@ -1970,6 +1970,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
|
||||
@@ -1027,6 +1027,7 @@ int fit_parse_subimage(const char *spec,
|
||||
@@ -1041,6 +1041,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);
|
||||
@ -0,0 +1,192 @@
|
||||
From 26d4e2e58bf0007db74b47c783785c3305ea1fa0 Mon Sep 17 00:00:00 2001
|
||||
From: Weijie Gao <weijie.gao@mediatek.com>
|
||||
Date: Tue, 19 Jan 2021 10:58:48 +0800
|
||||
Subject: [PATCH 17/23] cmd: bootmenu: add ability to select item by shortkey
|
||||
|
||||
Add ability to use shortkey to select item for bootmenu command
|
||||
|
||||
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
||||
---
|
||||
cmd/bootmenu.c | 77 +++++++++++++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 70 insertions(+), 7 deletions(-)
|
||||
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <menu.h>
|
||||
#include <watchdog.h>
|
||||
#include <malloc.h>
|
||||
+#include <linux/ctype.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
@@ -38,6 +39,7 @@ struct bootmenu_data {
|
||||
int active; /* active menu entry */
|
||||
int count; /* total count of menu entries */
|
||||
struct bootmenu_entry *first; /* first menu entry */
|
||||
+ bool last_choiced;
|
||||
};
|
||||
|
||||
enum bootmenu_key {
|
||||
@@ -46,8 +48,27 @@ enum bootmenu_key {
|
||||
KEY_DOWN,
|
||||
KEY_SELECT,
|
||||
KEY_QUIT,
|
||||
+ KEY_CHOICE,
|
||||
};
|
||||
|
||||
+static const char choice_chars[] = {
|
||||
+ '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
+ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
+ 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
|
||||
+ 'u', 'v', 'w', 'x', 'y', 'z'
|
||||
+};
|
||||
+
|
||||
+static int find_choice(char choice)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < ARRAY_SIZE(choice_chars); i++)
|
||||
+ if (tolower(choice) == choice_chars[i])
|
||||
+ return i;
|
||||
+
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
static char *bootmenu_getoption(unsigned short int n)
|
||||
{
|
||||
char name[MAX_ENV_SIZE];
|
||||
@@ -82,7 +103,7 @@ static void bootmenu_print_entry(void *d
|
||||
}
|
||||
|
||||
static void bootmenu_autoboot_loop(struct bootmenu_data *menu,
|
||||
- enum bootmenu_key *key, int *esc)
|
||||
+ enum bootmenu_key *key, int *esc, int *choice)
|
||||
{
|
||||
int i, c;
|
||||
|
||||
@@ -115,6 +136,19 @@ static void bootmenu_autoboot_loop(struc
|
||||
break;
|
||||
default:
|
||||
*key = KEY_NONE;
|
||||
+ if (*esc)
|
||||
+ break;
|
||||
+
|
||||
+ *choice = find_choice(c);
|
||||
+ if ((*choice >= 0 &&
|
||||
+ *choice < menu->count - 1)) {
|
||||
+ *key = KEY_CHOICE;
|
||||
+ } else if (c == '0') {
|
||||
+ *choice = menu->count - 1;
|
||||
+ *key = KEY_CHOICE;
|
||||
+ } else {
|
||||
+ *key = KEY_NONE;
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -136,10 +170,16 @@ static void bootmenu_autoboot_loop(struc
|
||||
}
|
||||
|
||||
static void bootmenu_loop(struct bootmenu_data *menu,
|
||||
- enum bootmenu_key *key, int *esc)
|
||||
+ enum bootmenu_key *key, int *esc, int *choice)
|
||||
{
|
||||
int c;
|
||||
|
||||
+ if (menu->last_choiced) {
|
||||
+ menu->last_choiced = false;
|
||||
+ *key = KEY_SELECT;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if (*esc == 1) {
|
||||
if (tstc()) {
|
||||
c = getchar();
|
||||
@@ -165,6 +205,14 @@ static void bootmenu_loop(struct bootmen
|
||||
if (c == '\e') {
|
||||
*esc = 1;
|
||||
*key = KEY_NONE;
|
||||
+ } else {
|
||||
+ *choice = find_choice(c);
|
||||
+ if ((*choice >= 0 && *choice < menu->count - 1)) {
|
||||
+ *key = KEY_CHOICE;
|
||||
+ } else if (c == '0') {
|
||||
+ *choice = menu->count - 1;
|
||||
+ *key = KEY_CHOICE;
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -216,16 +264,17 @@ static char *bootmenu_choice_entry(void
|
||||
struct bootmenu_data *menu = data;
|
||||
struct bootmenu_entry *iter;
|
||||
enum bootmenu_key key = KEY_NONE;
|
||||
+ int choice = -1;
|
||||
int esc = 0;
|
||||
int i;
|
||||
|
||||
while (1) {
|
||||
if (menu->delay >= 0) {
|
||||
/* Autoboot was not stopped */
|
||||
- bootmenu_autoboot_loop(menu, &key, &esc);
|
||||
+ bootmenu_autoboot_loop(menu, &key, &esc, &choice);
|
||||
} else {
|
||||
/* Some key was pressed, so autoboot was stopped */
|
||||
- bootmenu_loop(menu, &key, &esc);
|
||||
+ bootmenu_loop(menu, &key, &esc, &choice);
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
@@ -239,6 +288,12 @@ static char *bootmenu_choice_entry(void
|
||||
++menu->active;
|
||||
/* no menu key selected, regenerate menu */
|
||||
return NULL;
|
||||
+ case KEY_CHOICE:
|
||||
+ menu->active = choice;
|
||||
+ if (!menu->last_choiced) {
|
||||
+ menu->last_choiced = true;
|
||||
+ return NULL;
|
||||
+ }
|
||||
case KEY_SELECT:
|
||||
iter = menu->first;
|
||||
for (i = 0; i < menu->active; ++i)
|
||||
@@ -294,6 +349,7 @@ static struct bootmenu_data *bootmenu_cr
|
||||
menu->delay = delay;
|
||||
menu->active = 0;
|
||||
menu->first = NULL;
|
||||
+ menu->last_choiced = false;
|
||||
|
||||
default_str = env_get("bootmenu_default");
|
||||
if (default_str)
|
||||
@@ -311,12 +367,19 @@ static struct bootmenu_data *bootmenu_cr
|
||||
goto cleanup;
|
||||
|
||||
len = sep-option;
|
||||
- entry->title = malloc(len + 1);
|
||||
+ entry->title = malloc(len + 4);
|
||||
if (!entry->title) {
|
||||
free(entry);
|
||||
goto cleanup;
|
||||
}
|
||||
- memcpy(entry->title, option, len);
|
||||
+
|
||||
+ if (i < ARRAY_SIZE(choice_chars)) {
|
||||
+ len = sprintf(entry->title, "%c. %.*s", choice_chars[i],
|
||||
+ len, option);
|
||||
+ } else {
|
||||
+ len = sprintf(entry->title, " %.*s", len, option);
|
||||
+ }
|
||||
+
|
||||
entry->title[len] = 0;
|
||||
|
||||
len = strlen(sep + 1);
|
||||
@@ -353,7 +416,7 @@ static struct bootmenu_data *bootmenu_cr
|
||||
if (!entry)
|
||||
goto cleanup;
|
||||
|
||||
- entry->title = strdup("U-Boot console");
|
||||
+ entry->title = strdup("0. U-Boot console");
|
||||
if (!entry->title) {
|
||||
free(entry);
|
||||
goto cleanup;
|
||||
@ -1,14 +1,14 @@
|
||||
--- a/cmd/bootmenu.c
|
||||
+++ b/cmd/bootmenu.c
|
||||
@@ -38,6 +38,7 @@ struct bootmenu_data {
|
||||
@@ -39,6 +39,7 @@ struct bootmenu_data {
|
||||
int active; /* active menu entry */
|
||||
int count; /* total count of menu entries */
|
||||
struct bootmenu_entry *first; /* first menu entry */
|
||||
+ char *mtitle; /* custom menu title */
|
||||
bool last_choiced;
|
||||
};
|
||||
|
||||
enum bootmenu_key {
|
||||
@@ -380,7 +381,12 @@ static void menu_display_statusline(stru
|
||||
@@ -471,7 +472,12 @@ static void menu_display_statusline(stru
|
||||
printf(ANSI_CURSOR_POSITION, 1, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
printf(ANSI_CURSOR_POSITION, 2, 1);
|
||||
@ -22,7 +22,7 @@
|
||||
puts(ANSI_CLEAR_LINE_TO_END);
|
||||
printf(ANSI_CURSOR_POSITION, 3, 1);
|
||||
puts(ANSI_CLEAR_LINE);
|
||||
@@ -434,6 +440,7 @@ static void bootmenu_show(int delay)
|
||||
@@ -525,6 +531,7 @@ static void bootmenu_show(int delay)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/cmd/Kconfig
|
||||
+++ b/cmd/Kconfig
|
||||
@@ -571,6 +571,12 @@ config CMD_ENV_EXISTS
|
||||
@@ -465,6 +465,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
|
||||
@@ -469,6 +469,60 @@ int do_env_ask(struct cmd_tbl *cmdtp, in
|
||||
@@ -473,6 +473,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)
|
||||
@@ -1373,6 +1427,9 @@ static struct cmd_tbl cmd_env_sub[] = {
|
||||
@@ -1377,6 +1431,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
|
||||
@@ -1461,6 +1518,9 @@ static char env_help_text[] =
|
||||
@@ -1465,6 +1522,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
|
||||
@@ -1570,6 +1630,17 @@ U_BOOT_CMD(
|
||||
@@ -1574,6 +1634,17 @@ U_BOOT_CMD(
|
||||
);
|
||||
#endif
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
--- a/include/linux/types.h
|
||||
+++ b/include/linux/types.h
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef _LINUX_TYPES_H
|
||||
#define _LINUX_TYPES_H
|
||||
|
||||
+typedef unsigned long long __u64;
|
||||
#include <linux/posix_types.h>
|
||||
#include <asm/types.h>
|
||||
#include <stdbool.h>
|
||||
@ -1,13 +1,15 @@
|
||||
--- a/board/mediatek/mt7622/mt7622_rfb.c
|
||||
+++ b/board/mediatek/mt7622/mt7622_rfb.c
|
||||
@@ -6,9 +6,15 @@
|
||||
@@ -6,10 +6,17 @@
|
||||
|
||||
#include <common.h>
|
||||
#include <config.h>
|
||||
+#include <dm.h>
|
||||
+#include <button.h>
|
||||
+
|
||||
#include <env.h>
|
||||
#include <init.h>
|
||||
#include <asm/global_data.h>
|
||||
|
||||
+#ifndef CONFIG_RESET_BUTTON_LABEL
|
||||
+#define CONFIG_RESET_BUTTON_LABEL "reset"
|
||||
@ -16,7 +18,7 @@
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int board_init(void)
|
||||
@@ -19,7 +25,15 @@ int board_init(void)
|
||||
@@ -20,7 +27,15 @@ int board_init(void)
|
||||
|
||||
int board_late_init(void)
|
||||
{
|
||||
@ -1,6 +1,6 @@
|
||||
--- a/configs/mt7623n_bpir2_defconfig
|
||||
+++ b/configs/mt7623n_bpir2_defconfig
|
||||
@@ -51,5 +51,15 @@ CONFIG_SYSRESET=y
|
||||
@@ -51,6 +51,16 @@ CONFIG_SYSRESET=y
|
||||
CONFIG_SYSRESET_WATCHDOG=y
|
||||
CONFIG_TIMER=y
|
||||
CONFIG_MTK_TIMER=y
|
||||
@ -16,3 +16,4 @@
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
CONFIG_WDT_MTK=y
|
||||
CONFIG_LZMA=y
|
||||
# CONFIG_EFI_GRUB_ARM32_WORKAROUND is not set
|
||||
@ -8,7 +8,7 @@
|
||||
};
|
||||
|
||||
memory@40000000 {
|
||||
@@ -27,6 +29,42 @@
|
||||
@@ -27,6 +28,42 @@
|
||||
reg = <0x40000000 0x40000000>;
|
||||
};
|
||||
|
||||
@ -51,30 +51,7 @@
|
||||
reg_1p8v: regulator-1p8v {
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "fixed-1.8V";
|
||||
@@ -139,11 +177,12 @@
|
||||
|
||||
};
|
||||
|
||||
- mmc1_pins_default: mmc1default {
|
||||
+ sd0_pins_default: sd0-pins-default {
|
||||
mux {
|
||||
function = "sd";
|
||||
- groups = "sd_0";
|
||||
+ groups = "sd_0";
|
||||
};
|
||||
+
|
||||
/* "I2S2_OUT, "I2S4_IN"", "I2S3_IN", "I2S2_IN",
|
||||
* "I2S4_OUT", "I2S3_OUT" are used as DAT0, DAT1,
|
||||
* DAT2, DAT3, CMD, CLK for SD respectively.
|
||||
@@ -164,7 +203,6 @@
|
||||
pins = "TXD3";
|
||||
bias-pull-up;
|
||||
};
|
||||
-
|
||||
};
|
||||
};
|
||||
|
||||
@@ -199,7 +237,7 @@
|
||||
@@ -199,7 +236,7 @@
|
||||
status = "okay";
|
||||
bus-width = <8>;
|
||||
max-frequency = <50000000>;
|
||||
@ -83,21 +60,12 @@
|
||||
vmmc-supply = <®_3p3v>;
|
||||
vqmmc-supply = <®_3p3v>;
|
||||
non-removable;
|
||||
@@ -207,14 +245,15 @@
|
||||
|
||||
&mmc1 {
|
||||
pinctrl-names = "default";
|
||||
- pinctrl-0 = <&mmc1_pins_default>;
|
||||
+ pinctrl-0 = <&sd0_pins_default>;
|
||||
@@ -210,7 +247,7 @@
|
||||
pinctrl-0 = <&mmc1_pins_default>;
|
||||
status = "okay";
|
||||
bus-width = <4>;
|
||||
- max-frequency = <50000000>;
|
||||
+ max-frequency = <20000000>;
|
||||
+ max-frequency = <12000000>;
|
||||
cap-sd-highspeed;
|
||||
r_smpl = <1>;
|
||||
vmmc-supply = <®_3p3v>;
|
||||
vqmmc-supply = <®_3p3v>;
|
||||
+ cd-gpios = <&gpio 81 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
&watchdog {
|
||||
@ -1,16 +1,21 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_bananapi_bpi-r64-sdmmc_defconfig
|
||||
@@ -0,0 +1,123 @@
|
||||
@@ -0,0 +1,144 @@
|
||||
+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_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-sdmmc_env"
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
@ -20,6 +25,7 @@
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
|
||||
@ -33,6 +39,7 @@
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
@ -50,23 +57,25 @@
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MBR=y
|
||||
+# CONFIG_CMD_MBR is not set
|
||||
+CONFIG_CMD_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_PSTORE=y
|
||||
+# CONFIG_CMD_PSTORE is not set
|
||||
+CONFIG_CMD_RARP=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_DISPLAY_CPUINFO=y
|
||||
@ -75,6 +84,8 @@
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
@ -90,7 +101,17 @@
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_SCSI=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_CMD_SCSI=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCI=y
|
||||
@ -108,11 +129,11 @@
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_MMC=y
|
||||
+CONFIG_MMC_DEFAULT_DEV=1
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MMC_SUPPORTS_TUNING=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_TIMER=y
|
||||
+CONFIG_MTK_TIMER=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
@ -131,26 +152,26 @@
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x4007ff28
|
||||
+bootcmd=run boot_sdmmc
|
||||
+bootargs=earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk1p6
|
||||
+bootargs=root=/dev/mmcblk1p6
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
|
||||
+bootfile_emmcbl3=openwrt-mediatek-mt7622-bananapi_bpi-r64-boot-emmc.img
|
||||
+bootfile_emmcbl2=openwrt-mediatek-mt7622-bananapi_bpi-r64-bl2-emmc.bin
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[SD card][0m
|
||||
+bootmenu_0=0. Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=0. Run default boot command.=run boot_default
|
||||
+bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=2. Boot production system from SD card.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=3. Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=4. Load production system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=5. Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31m6. Install bootloader and recovery to eMMC.[0m=run emmc_init ; run bootmenu_confirm_return
|
||||
+bootmenu_7=7. Reboot.=reset
|
||||
+bootmenu_8=8. Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+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 SD card.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from SD card.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to SD card.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mInstall bootloader and recovery to eMMC.[0m=run emmc_init ; run bootmenu_confirm_return
|
||||
+bootmenu_7=Reboot.=reset
|
||||
+bootmenu_8=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 ; run boot_tftp_forever
|
||||
+boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu
|
||||
+boot_production=led bpi-r64:pio:green on ; run sdmmc_read_production && bootm $loadaddr
|
||||
@ -183,18 +204,23 @@
|
||||
+_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title [33m$ver[0m"
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_bananapi_bpi-r64-emmc_defconfig
|
||||
@@ -0,0 +1,123 @@
|
||||
@@ -0,0 +1,144 @@
|
||||
+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_USE_DEFAULT_ENV_FILE=y
|
||||
+CONFIG_BOARD_LATE_INIT=y
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-bananapi-bpi-r64"
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-emmc_env"
|
||||
+CONFIG_OF_LIBFDT_OVERLAY=y
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="bananapi_bpi-r64-sdmmc_env"
|
||||
+CONFIG_NET_RANDOM_ETHADDR=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
@ -203,6 +229,7 @@
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
|
||||
@ -216,6 +243,7 @@
|
||||
+CONFIG_CMD_BOOTMENU=y
|
||||
+CONFIG_CMD_BOOTP=y
|
||||
+CONFIG_CMD_BUTTON=y
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+CONFIG_CMD_CDP=y
|
||||
+CONFIG_CMD_DHCP=y
|
||||
+CONFIG_CMD_DNS=y
|
||||
@ -233,23 +261,25 @@
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MBR=y
|
||||
+# CONFIG_CMD_MBR is not set
|
||||
+CONFIG_CMD_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_PSTORE=y
|
||||
+# CONFIG_CMD_PSTORE is not set
|
||||
+CONFIG_CMD_RARP=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_DISPLAY_CPUINFO=y
|
||||
@ -258,6 +288,8 @@
|
||||
+CONFIG_DM_REGULATOR_FIXED=y
|
||||
+CONFIG_DM_REGULATOR_GPIO=y
|
||||
+CONFIG_DM_USB=y
|
||||
+CONFIG_DM_PWM=y
|
||||
+CONFIG_PWM_MTK=y
|
||||
+CONFIG_HUSH_PARSER=y
|
||||
+CONFIG_SYS_REDUNDAND_ENVIRONMENT=y
|
||||
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
|
||||
@ -273,7 +305,17 @@
|
||||
+CONFIG_REGMAP=y
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_DM_SCSI=y
|
||||
+CONFIG_AHCI=y
|
||||
+CONFIG_AHCI_PCI=y
|
||||
+CONFIG_SCSI_AHCI=y
|
||||
+CONFIG_SCSI=y
|
||||
+CONFIG_CMD_SCSI=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_MTK_AHCI=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCI=y
|
||||
@ -291,11 +333,11 @@
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_MMC=y
|
||||
+CONFIG_MMC_DEFAULT_DEV=0
|
||||
+CONFIG_MMC_HS200_SUPPORT=y
|
||||
+CONFIG_MMC_MTK=y
|
||||
+CONFIG_MMC_SUPPORTS_TUNING=y
|
||||
+CONFIG_SUPPORT_EMMC_BOOT=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_TIMER=y
|
||||
+CONFIG_MTK_TIMER=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
@ -314,23 +356,23 @@
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x4007ff28
|
||||
+bootcmd=run boot_emmc
|
||||
+bootargs=earlycon=uart8250,mmio32,0x11002000 console=ttyS0,115200n1 swiotlb=512 root=/dev/mmcblk0p5
|
||||
+bootargs=root=/dev/mmcblk0p5
|
||||
+bootdelay=0
|
||||
+bootfile=openwrt-mediatek-mt7622-bananapi_bpi-r64-initramfs-recovery.itb
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-bananapi_bpi-r64-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) ) [0;36m[eMMC][0m
|
||||
+bootmenu_0=0. Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=0. Run default boot command.=run boot_default
|
||||
+bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_2=2. Boot production system from eMMC.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=3. Boot recovery system from eMMC.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=4. Load production system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=5. Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_6=6. Reboot.=reset
|
||||
+bootmenu_7=7. Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+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 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to eMMC.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; 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 ; run boot_tftp_forever
|
||||
+boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu
|
||||
+boot_production=led bpi-r64:pio:green on ; run emmc_read_production && bootm $loadaddr
|
||||
@ -1,9 +1,10 @@
|
||||
--- /dev/null
|
||||
+++ b/configs/mt7622_linksys_e8450_defconfig
|
||||
@@ -0,0 +1,130 @@
|
||||
@@ -0,0 +1,133 @@
|
||||
+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_USE_DEFAULT_ENV_FILE=y
|
||||
@ -11,7 +12,10 @@
|
||||
+CONFIG_BOOTP_SEND_HOSTNAME=y
|
||||
+CONFIG_DEFAULT_ENV_FILE="linksys_e8450_env"
|
||||
+CONFIG_NR_DRAM_BANKS=1
|
||||
+CONFIG_DEBUG_UART_BASE=0x11002000
|
||||
+CONFIG_DEBUG_UART_CLOCK=25000000
|
||||
+CONFIG_DEFAULT_DEVICE_TREE="mt7622-linksys-e8450-ubi"
|
||||
+CONFIG_DEBUG_UART=y
|
||||
+CONFIG_SMBIOS_PRODUCT_NAME=""
|
||||
+CONFIG_AUTOBOOT_KEYED=y
|
||||
+CONFIG_BOOTDELAY=30
|
||||
@ -19,6 +23,7 @@
|
||||
+CONFIG_CFB_CONSOLE_ANSI=y
|
||||
+CONFIG_BUTTON=y
|
||||
+CONFIG_BUTTON_GPIO=y
|
||||
+CONFIG_GPIO_HOG=y
|
||||
+CONFIG_CMD_ENV_FLAGS=y
|
||||
+CONFIG_FIT=y
|
||||
+CONFIG_FIT_ENABLE_SHA256_SUPPORT=y
|
||||
@ -49,10 +54,9 @@
|
||||
+CONFIG_CMD_LED=y
|
||||
+CONFIG_CMD_LICENSE=y
|
||||
+CONFIG_CMD_LINK_LOCAL=y
|
||||
+CONFIG_CMD_MBR=y
|
||||
+# CONFIG_CMD_MBR is not set
|
||||
+CONFIG_CMD_MTD=y
|
||||
+CONFIG_CMD_MTDPART=y
|
||||
+CONFIG_CMD_NAND=y
|
||||
+CONFIG_CMD_PCI=y
|
||||
+CONFIG_CMD_SF_TEST=y
|
||||
+CONFIG_CMD_PING=y
|
||||
@ -65,7 +69,7 @@
|
||||
+CONFIG_CMD_UBIFS=y
|
||||
+CONFIG_CMD_ASKENV=y
|
||||
+CONFIG_CMD_PART=y
|
||||
+CONFIG_CMD_PSTORE=y
|
||||
+# CONFIG_CMD_PSTORE is not set
|
||||
+CONFIG_CMD_RARP=y
|
||||
+CONFIG_CMD_SETEXPR=y
|
||||
+CONFIG_CMD_SLEEP=y
|
||||
@ -93,12 +97,14 @@
|
||||
+CONFIG_SYSCON=y
|
||||
+CONFIG_CLK=y
|
||||
+CONFIG_DM_MTD=y
|
||||
+CONFIG_DM_GPIO=y
|
||||
+CONFIG_PHY=y
|
||||
+CONFIG_PHY_MTK_TPHY=y
|
||||
+CONFIG_PHY_FIXED=y
|
||||
+CONFIG_DM_ETH=y
|
||||
+CONFIG_MEDIATEK_ETH=y
|
||||
+CONFIG_PCI=y
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_MTD_RAW_NAND=y
|
||||
+CONFIG_MTD_UBI_FASTMAP=y
|
||||
+CONFIG_DM_PCI=y
|
||||
+CONFIG_PCIE_MEDIATEK=y
|
||||
@ -114,12 +120,9 @@
|
||||
+CONFIG_MTK_SERIAL=y
|
||||
+CONFIG_SPI=y
|
||||
+CONFIG_DM_SPI=y
|
||||
+CONFIG_MTK_SNFI_SPI=y
|
||||
+CONFIG_MTK_SPI_NAND=y
|
||||
+CONFIG_NAND_SUPPORT=y
|
||||
+CONFIG_MTK_SPI_NAND_MTD=y
|
||||
+CONFIG_SYSRESET_WATCHDOG=y
|
||||
+CONFIG_TIMER=y
|
||||
+CONFIG_MTK_TIMER=y
|
||||
+CONFIG_WDT_MTK=y
|
||||
+CONFIG_LZO=y
|
||||
+CONFIG_ZSTD=y
|
||||
@ -133,7 +136,7 @@
|
||||
+CONFIG_USB_STORAGE=y
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/dts/mt7622-linksys-e8450-ubi.dts
|
||||
@@ -0,0 +1,206 @@
|
||||
@@ -0,0 +1,195 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2019 MediaTek Inc.
|
||||
@ -155,7 +158,7 @@
|
||||
+ };
|
||||
+
|
||||
+ aliases {
|
||||
+ spi0 = &snfi;
|
||||
+ spi0 = &snand;
|
||||
+ };
|
||||
+
|
||||
+ gpio-keys {
|
||||
@ -288,22 +291,11 @@
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&snfi {
|
||||
+&snand {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&snfi_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ mediatek,bmt-v2;
|
||||
+
|
||||
+ spi-flash@0{
|
||||
+ compatible = "jedec,spi-nor";
|
||||
+ reg = <0>;
|
||||
+ u-boot,dm-pre-reloc;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&nandc {
|
||||
+ status = "okay";
|
||||
+ quad-spi;
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
@ -342,7 +334,7 @@
|
||||
+};
|
||||
--- a/arch/arm/dts/Makefile
|
||||
+++ b/arch/arm/dts/Makefile
|
||||
@@ -963,6 +963,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
@@ -996,6 +996,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
|
||||
mt7622-rfb.dtb \
|
||||
mt7623a-unielec-u7623-02-emmc.dtb \
|
||||
mt7622-bananapi-bpi-r64.dtb \
|
||||
@ -350,35 +342,11 @@
|
||||
mt7623n-bananapi-bpi-r2.dtb \
|
||||
mt7629-rfb.dtb \
|
||||
mt8512-bm1-emmc.dtb \
|
||||
--- a/drivers/mtd/nandx/core/nand/device_spi.c
|
||||
+++ b/drivers/mtd/nandx/core/nand/device_spi.c
|
||||
@@ -150,6 +150,21 @@ static struct device_spi spi_nand[] = {
|
||||
&spi_extend_cmds, 0xff, 0xff
|
||||
},
|
||||
{
|
||||
+ NAND_DEVICE("FM35X1GA",
|
||||
+ NAND_PACK_ID(0xe5, 0x71, 0, 0, 0, 0, 0, 0),
|
||||
+ 2, 0, 3, 3,
|
||||
+ 1, 1, 1, 1024, KB(128), KB(2), 64, 1,
|
||||
+ &spi_cmds, &spi_addressing, &spi_status[0],
|
||||
+ &spi_endurance, &spi_array_timing),
|
||||
+ {
|
||||
+ NAND_SPI_PROTECT(0xa0, 1, 2, 6),
|
||||
+ NAND_SPI_CONFIG(0xb0, 4, 6, 1),
|
||||
+ NAND_SPI_STATUS(0xc0, 4, 5),
|
||||
+ NAND_SPI_CHARACTER(0xff, 0xff, 0xff, 0xff)
|
||||
+ },
|
||||
+ &spi_extend_cmds, 0xff, 0xff
|
||||
+ },
|
||||
+ {
|
||||
NAND_DEVICE("NO-DEVICE",
|
||||
NAND_PACK_ID(0, 0, 0, 0, 0, 0, 0, 0), 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 1,
|
||||
--- /dev/null
|
||||
+++ b/linksys_e8450_env
|
||||
@@ -0,0 +1,57 @@
|
||||
+mtdparts=nand0:512k(bl2),1280k(fip),1024k(factory),256k(reserved),-(ubi)
|
||||
+ethaddr_factory=nand read 0x40080000 0x220000 0x20000 && env readmem -b ethaddr 0x4009fff4 0x6 ; setenv ethaddr_factory
|
||||
+mtdparts=spi-nand0:512k(bl2),1280k(fip),1024k(factory),256k(reserved),-(ubi)
|
||||
+ethaddr_factory=mtd read spi-nand0 0x40080000 0x220000 0x20000 && env readmem -b ethaddr 0x4009fff4 0x6 ; setenv ethaddr_factory
|
||||
+ipaddr=192.168.1.1
|
||||
+serverip=192.168.1.254
|
||||
+loadaddr=0x4007ff28
|
||||
@ -388,21 +356,21 @@
|
||||
+bootfile_bl2=openwrt-mediatek-mt7622-linksys_e8450-ubi-preloader.bin
|
||||
+bootfile_fip=openwrt-mediatek-mt7622-linksys_e8450-ubi-bl31-uboot.fip
|
||||
+bootfile_upg=openwrt-mediatek-mt7622-linksys_e8450-ubi-squashfs-sysupgrade.itb
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu
|
||||
+bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60
|
||||
+bootmenu_default=0
|
||||
+bootmenu_delay=0
|
||||
+bootmenu_title= [0;34m( ( ( [1;39mOpenWrt[0;34m ) ) )[0m
|
||||
+bootmenu_0=0. Initialize environment.=run _firstboot
|
||||
+bootmenu_0d=0. Run default boot command.=run boot_default
|
||||
+bootmenu_1=1. Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return
|
||||
+bootmenu_3=2. Boot production system from flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_2=3. Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_5=4. Load production system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_4=5. Load recovery system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31m6. Load BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31m7. Load BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_preloader ; run bootmenu_confirm_return
|
||||
+bootmenu_8=8. Reboot.=reset
|
||||
+bootmenu_9=9. Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+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 flash.=run boot_production ; run bootmenu_confirm_return
|
||||
+bootmenu_3=Boot recovery system from flash.=run boot_recovery ; run bootmenu_confirm_return
|
||||
+bootmenu_4=Load production system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_production ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_5=Load recovery system via TFTP then write to flash.=setenv noboot 1 ; run boot_tftp_recovery ; setenv noboot ; run bootmenu_confirm_return
|
||||
+bootmenu_6=[31mLoad BL31+U-Boot FIP via TFTP then write to flash.[0m=run boot_tftp_write_fip ; run bootmenu_confirm_return
|
||||
+bootmenu_7=[31mLoad BL2 preloader via TFTP then write to flash.[0m=run boot_tftp_write_preloader ; run bootmenu_confirm_return
|
||||
+bootmenu_8=Reboot.=reset
|
||||
+bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset
|
||||
+boot_first=if button reset ; then run boot_tftp_forever ; fi ; setenv flag_recover 1 ; bootmenu
|
||||
+boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; run boot_tftp_forever
|
||||
+boot_production=led power:blue on ; run ubi_read_production && bootm $loadaddr
|
||||
@ -417,18 +385,18 @@
|
||||
+boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run boot_write_fip
|
||||
+boot_tftp_write_preloader=tftpboot $loadaddr $bootfile_bl2 && run boot_write_preloader
|
||||
+boot_ubi=ubi part ubi && run boot_production_or_recovery
|
||||
+boot_write_fip=nand erase 0x80000 0x140000 && nand write $loadaddr 0x80000 0x140000
|
||||
+boot_write_preloader=nand erase 0x0 0x80000 && nand write $loadaddr 0x0 0x20000 && nand write $loadaddr 0x20000 0x20000 && nand write $loadaddr 0x40000 0x20000 && nand write $loadaddr 0x60000 0x20000
|
||||
+boot_write_fip=mtd erase spi-nand0 0x80000 0x140000 && mtd write spi-nand0 $loadaddr 0x80000 0x140000
|
||||
+boot_write_preloader=mtd erase spi-nand0 0x0 0x80000 && mtd write spi-nand0 $loadaddr 0x0 0x20000 && mtd write spi-nand0 $loadaddr 0x20000 0x20000 && mtd write spi-nand0 $loadaddr 0x40000 0x20000 && mtd write spi-nand0 $loadaddr 0x60000 0x20000
|
||||
+check_recovery=run ubi_read_recovery ; if iminfo $loadaddr ; then bootm $loadaddr ; else ubi remove recovery ; fi
|
||||
+check_ubi=ubi part ubi || run ubi_format
|
||||
+reset_factory=ubi part ubi ; ubi write 0x0 ubootenv 0x0 ; ubi write 0x0 ubootenv2 0x0 ; ubi remove rootfs_data
|
||||
+ubi_format=ubi detach ; nand erase 0x300000 0x7D00000 && ubi part ubi ; reset
|
||||
+ubi_format=ubi detach ; mtd erase spi-nand0 0x300000 0x7D00000 && ubi part ubi ; reset
|
||||
+ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi
|
||||
+ubi_read_production=ubi read $loadaddr fit && iminfo $loadaddr && run ubi_prepare_rootfs
|
||||
+ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery
|
||||
+ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data
|
||||
+ubi_write_production=run ubi_remove_rootfs ; ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=run ubi_remove_rootfs ; ubi check recovery && ubi remove recovery; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize
|
||||
+ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize
|
||||
+_create_env=ubi create ubootenv 0x100000 dynamic ; ubi create ubootenv2 0x100000 dynamic
|
||||
+_init_env=setenv _init_env ; if ubi check ubootenv && ubi check ubootenv2 ; then else run _create_env ; fi ; setenv _create_env ; saveenv || run ubi_format ; saveenv || run ubi_format
|
||||
+_firstboot=setenv _firstboot ; led power:orange on ; run _switch_to_menu ; run ethaddr_factory ; run check_ubi ; run _init_env ; run boot_first
|
||||
@ -25,7 +25,6 @@ PKG_USE_MIPS16:=0
|
||||
PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/elfutils/Default
|
||||
@ -99,4 +98,3 @@ endef
|
||||
$(eval $(call BuildPackage,libelf))
|
||||
$(eval $(call BuildPackage,libdw))
|
||||
$(eval $(call BuildPackage,libasm))
|
||||
$(eval $(call HostBuild))
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gre
|
||||
PKG_RELEASE:=12
|
||||
PKG_RELEASE:=13
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -291,8 +291,6 @@ proto_grev6tap_init_config() {
|
||||
}
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
[ -f /lib/modules/$(uname -r)/gre.ko ] && add_protocol gre
|
||||
[ -f /lib/modules/$(uname -r)/gre.ko ] && add_protocol gretap
|
||||
[ -f /lib/modules/$(uname -r)/ip6_gre.ko ] && add_protocol grev6
|
||||
[ -f /lib/modules/$(uname -r)/ip6_gre.ko ] && add_protocol grev6tap
|
||||
[ -d /sys/module/ip_gre ] && { add_protocol gre; add_protocol gretap; }
|
||||
[ -d /sys/module/ip6_gre ] && { add_protocol grev6; add_protocol grev6tap; }
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=vti
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -149,6 +149,6 @@ proto_vti6_init_config() {
|
||||
}
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
[ -f /lib/modules/$(uname -r)/ip_vti.ko ] && add_protocol vti
|
||||
[ -f /lib/modules/$(uname -r)/ip6_vti.ko ] && add_protocol vti6
|
||||
[ -d /sys/module/ip_vti ] && add_protocol vti
|
||||
[ -d /sys/module/ip6_vti ] && add_protocol vti6
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=xfrm
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -68,5 +68,5 @@ proto_xfrm_init_config() {
|
||||
|
||||
|
||||
[ -n "$INCLUDE_ONLY" ] || {
|
||||
[ -f /lib/modules/$(uname -r)/xfrm_interface.ko -o -d /sys/module/xfrm_interface ] && add_protocol xfrm
|
||||
[ -d /sys/module/xfrm_interface ] && add_protocol xfrm
|
||||
}
|
||||
|
||||
@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=selinux-policy
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://git.defensec.nl/selinux-policy.git
|
||||
PKG_VERSION:=0.7
|
||||
PKG_MIRROR_HASH:=f9c555dfa2bb16e6bfd86f1481aad26fce72e5aa45e297e1b39636b6dd0ce021
|
||||
PKG_VERSION:=0.8
|
||||
PKG_MIRROR_HASH:=3b58f751a21394e3aef47fd6c9fe9430fadde6427deb5c79f08478904837ec91
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_BUILD_DEPENDS:=secilc/host policycoreutils/host
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=busybox
|
||||
PKG_VERSION:=1.33.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_FLAGS:=essential
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
From 67cc582d4289c5de521d11b08307c8ab26ee1e28 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Sun, 3 Jan 2021 10:55:39 +0100
|
||||
Subject: ash: make a strdup copy of $HISTFILE for line editing
|
||||
|
||||
Otherwise if $HISTFILE is unset or reassigned, bad things can happen.
|
||||
|
||||
function old new delta
|
||||
ash_main 1210 1218 +8
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
---
|
||||
shell/ash.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/shell/ash.c b/shell/ash.c
|
||||
index f16d7fb6a..ecbfbf091 100644
|
||||
--- a/shell/ash.c
|
||||
+++ b/shell/ash.c
|
||||
@@ -14499,7 +14499,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
|
||||
|
||||
if (sflag || minusc == NULL) {
|
||||
#if MAX_HISTORY > 0 && ENABLE_FEATURE_EDITING_SAVEHISTORY
|
||||
- if (iflag) {
|
||||
+ if (line_input_state) {
|
||||
const char *hp = lookupvar("HISTFILE");
|
||||
if (!hp) {
|
||||
hp = lookupvar("HOME");
|
||||
@@ -14513,7 +14513,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
|
||||
}
|
||||
}
|
||||
if (hp)
|
||||
- line_input_state->hist_file = hp;
|
||||
+ line_input_state->hist_file = xstrdup(hp);
|
||||
# if ENABLE_FEATURE_SH_HISTFILESIZE
|
||||
hp = lookupvar("HISTFILESIZE");
|
||||
line_input_state->max_history = size_from_HISTFILESIZE(hp);
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 89358a7131d3e75c74af834bb117b4fad7914983 Mon Sep 17 00:00:00 2001
|
||||
From: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
Date: Tue, 2 Feb 2021 13:48:21 +0100
|
||||
Subject: traceroute: fix option parsing
|
||||
|
||||
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
|
||||
---
|
||||
networking/traceroute.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/networking/traceroute.c b/networking/traceroute.c
|
||||
index 3f1a9ab46..29f5e480b 100644
|
||||
--- a/networking/traceroute.c
|
||||
+++ b/networking/traceroute.c
|
||||
@@ -896,7 +896,7 @@ traceroute_init(int op, char **argv)
|
||||
|
||||
op |= getopt32(argv, "^"
|
||||
OPT_STRING
|
||||
- "\0" "-1:x-x" /* minimum 1 arg */
|
||||
+ "\0" "-1" /* minimum 1 arg */
|
||||
, &tos_str, &device, &max_ttl_str, &port_str, &nprobes_str
|
||||
, &source, &waittime_str, &pausemsecs_str, &first_ttl_str
|
||||
);
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
||||
@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
|
||||
#define USB_VENDOR_ID_BELKIN 0x050d
|
||||
#define USB_DEVICE_ID_FLIP_KVM 0x3201
|
||||
|
||||
@@ -1254,6 +1257,9 @@
|
||||
@@ -1257,6 +1260,9 @@
|
||||
#define USB_VENDOR_ID_XAT 0x2505
|
||||
#define USB_DEVICE_ID_XAT_CSR 0x0220
|
||||
|
||||
@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL },
|
||||
@@ -189,6 +190,7 @@ static const struct hid_device_id hid_qu
|
||||
@@ -190,6 +191,7 @@ static const struct hid_device_id hid_qu
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
|
||||
{ HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT },
|
||||
|
||||
@ -39,7 +39,7 @@ Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2422,6 +2428,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
@@ -2423,6 +2429,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
|
||||
elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header);
|
||||
break;
|
||||
@ -49,7 +49,7 @@ Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
default:
|
||||
if (type < V4L2_CTRL_COMPOUND_TYPES)
|
||||
elem_size = sizeof(s32);
|
||||
@@ -4086,6 +4095,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l
|
||||
@@ -4087,6 +4096,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l
|
||||
}
|
||||
EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string);
|
||||
|
||||
|
||||
@ -820,7 +820,7 @@ Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2433,6 +2531,15 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
@@ -2434,6 +2532,15 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
|
||||
elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header);
|
||||
break;
|
||||
|
||||
@ -106,7 +106,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
case V4L2_CTRL_TYPE_AREA:
|
||||
area = p;
|
||||
if (!area->width || !area->height)
|
||||
@@ -2540,6 +2547,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
@@ -2541,6 +2548,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(s
|
||||
case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS:
|
||||
elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params);
|
||||
break;
|
||||
|
||||
@ -29,7 +29,7 @@ Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||
|
||||
#define dprintk(vdev, fmt, arg...) do { \
|
||||
if (!WARN_ON(!(vdev)) && ((vdev)->dev_debug & V4L2_DEV_DEBUG_CTRL)) \
|
||||
@@ -4577,3 +4578,42 @@ __poll_t v4l2_ctrl_poll(struct file *fil
|
||||
@@ -4578,3 +4579,42 @@ __poll_t v4l2_ctrl_poll(struct file *fil
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(v4l2_ctrl_poll);
|
||||
|
||||
@ -250,28 +250,18 @@ out the configuration than the in kernel cfe config reader.
|
||||
+static int cfe_env;
|
||||
+extern char *cfe_env_get(char *nv_buf, const char *name);
|
||||
|
||||
static u32 find_nvram_size(void __iomem *end)
|
||||
{
|
||||
@@ -52,7 +54,9 @@ static u32 find_nvram_size(void __iomem
|
||||
static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
|
||||
{
|
||||
struct nvram_header __iomem *header;
|
||||
+ int i;
|
||||
u32 off;
|
||||
+ u32 *src, *dst;
|
||||
u32 size;
|
||||
|
||||
if (nvram_len) {
|
||||
@@ -60,6 +64,26 @@ static int nvram_find_and_copy(void __io
|
||||
/**
|
||||
* bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory
|
||||
@@ -80,6 +82,26 @@ static int bcm47xx_nvram_find_and_copy(v
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
+ cfe_env = 0;
|
||||
+
|
||||
+ /* XXX: hack for supporting the CFE environment stuff on WGT634U */
|
||||
+ if (lim >= 8 * 1024 * 1024) {
|
||||
+ src = (u32 *)(iobase + 8 * 1024 * 1024 - 0x2000);
|
||||
+ dst = (u32 *)nvram_buf;
|
||||
+ if (res_size >= 8 * 1024 * 1024) {
|
||||
+ u32 *src = (u32 *)(flash_start + 8 * 1024 * 1024 - 0x2000);
|
||||
+ u32 *dst = (u32 *)nvram_buf;
|
||||
+
|
||||
+ if ((*src & 0xff00ff) == 0x000001) {
|
||||
+ printk("early_nvram_init: WGT634U NVRAM found.\n");
|
||||
@ -287,9 +277,9 @@ out the configuration than the in kernel cfe config reader.
|
||||
+ }
|
||||
+
|
||||
/* TODO: when nvram is on nand flash check for bad blocks first. */
|
||||
off = FLASH_MIN;
|
||||
while (off <= lim) {
|
||||
@@ -170,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam
|
||||
|
||||
/* Try every possible flash size and check for NVRAM at its end */
|
||||
@@ -172,6 +194,13 @@ int bcm47xx_nvram_getenv(const char *nam
|
||||
if (!name)
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 11 Mar 2021 08:24:44 +0100
|
||||
Subject: [PATCH] firmware: bcm47xx_nvram: support init from IO memory
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 17 +++++++++++++++++
|
||||
include/linux/bcm47xx_nvram.h | 6 ++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
@@ -110,6 +110,23 @@ found:
|
||||
return 0;
|
||||
}
|
||||
|
||||
+int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size)
|
||||
+{
|
||||
+ if (nvram_len) {
|
||||
+ pr_warn("nvram already initialized\n");
|
||||
+ return -EEXIST;
|
||||
+ }
|
||||
+
|
||||
+ if (!bcm47xx_nvram_is_valid(nvram_start)) {
|
||||
+ pr_err("No valid NVRAM found\n");
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+
|
||||
+ bcm47xx_nvram_copy(nvram_start, res_size);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* On bcm47xx we need access to the NVRAM very early, so we can't use mtd
|
||||
* subsystem to access flash. We can't even use platform device / driver to
|
||||
--- a/include/linux/bcm47xx_nvram.h
|
||||
+++ b/include/linux/bcm47xx_nvram.h
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#ifdef CONFIG_BCM47XX_NVRAM
|
||||
+int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start, size_t res_size);
|
||||
int bcm47xx_nvram_init_from_mem(u32 base, u32 lim);
|
||||
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
|
||||
int bcm47xx_nvram_gpio_pin(const char *name);
|
||||
@@ -20,6 +21,11 @@ static inline void bcm47xx_nvram_release
|
||||
vfree(nvram);
|
||||
};
|
||||
#else
|
||||
+static inline int bcm47xx_nvram_init_from_iomem(void __iomem *nvram_start,
|
||||
+ size_t res_size)
|
||||
+{
|
||||
+ return -ENOTSUPP;
|
||||
+}
|
||||
static inline int bcm47xx_nvram_init_from_mem(u32 base, u32 lim)
|
||||
{
|
||||
return -ENOTSUPP;
|
||||
@ -0,0 +1,31 @@
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 11 Mar 2021 08:26:14 +0100
|
||||
Subject: [PATCH] nvmem: brcm_nvram: provide NVMEM content to the NVRAM driver
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/nvmem/brcm_nvram.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/nvmem/brcm_nvram.c
|
||||
+++ b/drivers/nvmem/brcm_nvram.c
|
||||
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
|
||||
*/
|
||||
|
||||
+#include <linux/bcm47xx_nvram.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
@@ -46,6 +47,8 @@ static int brcm_nvram_probe(struct platf
|
||||
if (IS_ERR(priv->base))
|
||||
return PTR_ERR(priv->base);
|
||||
|
||||
+ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
|
||||
+
|
||||
config.dev = dev;
|
||||
config.priv = priv;
|
||||
config.size = resource_size(res);
|
||||
@ -18,6 +18,6 @@ endef
|
||||
|
||||
include $(INCLUDE_DIR)/target.mk
|
||||
|
||||
DEFAULT_PACKAGES += kmod-gpio-button-hotplug
|
||||
DEFAULT_PACKAGES += ethtool kmod-gpio-button-hotplug
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
||||
@ -3,8 +3,15 @@ CONFIG_ARCH_HIBERNATION_POSSIBLE=y
|
||||
CONFIG_ARCH_MMAP_RND_BITS_MAX=15
|
||||
CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
|
||||
CONFIG_ARCH_SUSPEND_POSSIBLE=y
|
||||
CONFIG_B53=y
|
||||
# CONFIG_B53_MDIO_DRIVER is not set
|
||||
CONFIG_B53_MMAP_DRIVER=y
|
||||
# CONFIG_B53_SERDES is not set
|
||||
CONFIG_B53_SPI_DRIVER=y
|
||||
# CONFIG_B53_SRAB_DRIVER is not set
|
||||
CONFIG_BCM6345_EXT_IRQ=y
|
||||
CONFIG_BCM6345_L1_IRQ=y
|
||||
CONFIG_BCM6368_ENETSW=y
|
||||
CONFIG_BCM63XX_POWER=y
|
||||
CONFIG_BCM7038_L1_IRQ=y
|
||||
CONFIG_BCM7038_WDT=y
|
||||
@ -103,6 +110,7 @@ CONFIG_GPIOLIB=y
|
||||
# CONFIG_GPIO_BRCMSTB is not set
|
||||
CONFIG_GPIO_GENERIC=y
|
||||
CONFIG_GPIO_GENERIC_PLATFORM=y
|
||||
CONFIG_GRO_CELLS=y
|
||||
CONFIG_HANDLE_DOMAIN_IRQ=y
|
||||
CONFIG_HARDIRQS_SW_RESEND=y
|
||||
CONFIG_HAS_DMA=y
|
||||
@ -128,6 +136,8 @@ CONFIG_LOCK_DEBUGGING_SUPPORT=y
|
||||
CONFIG_LZO_COMPRESS=y
|
||||
CONFIG_LZO_DECOMPRESS=y
|
||||
CONFIG_MDIO_BUS=y
|
||||
CONFIG_MDIO_BUS_MUX=y
|
||||
CONFIG_MDIO_BUS_MUX_BCM6368=y
|
||||
CONFIG_MDIO_DEVICE=y
|
||||
CONFIG_MEMFD_CREATE=y
|
||||
CONFIG_MFD_SYSCON=y
|
||||
@ -163,7 +173,14 @@ CONFIG_MTD_CFI_STAA=y
|
||||
CONFIG_MTD_JEDECPROBE=y
|
||||
# CONFIG_MTD_PARSER_IMAGETAG is not set
|
||||
CONFIG_NEED_DMA_MAP_STATE=y
|
||||
CONFIG_NET_DEVLINK=y
|
||||
CONFIG_NET_DSA=y
|
||||
CONFIG_NET_DSA_TAG_BRCM=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_COMMON=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_LEGACY=y
|
||||
CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
|
||||
CONFIG_NET_FLOW_LIMIT=y
|
||||
CONFIG_NET_SWITCHDEV=y
|
||||
CONFIG_NO_EXCEPT_FILL=y
|
||||
CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y
|
||||
CONFIG_NR_CPUS=2
|
||||
@ -181,6 +198,7 @@ CONFIG_PCI_DRIVERS_LEGACY=y
|
||||
CONFIG_PERF_USE_VMALLOC=y
|
||||
CONFIG_PGTABLE_LEVELS=2
|
||||
CONFIG_PHYLIB=y
|
||||
CONFIG_PHYLINK=y
|
||||
CONFIG_PHYSICAL_START=0x80010000
|
||||
CONFIG_PHY_BCM63XX_USBH=y
|
||||
# CONFIG_PHY_BRCM_SATA is not set
|
||||
|
||||
@ -39,6 +39,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&cferom 0x6a0>;
|
||||
};
|
||||
|
||||
&leds {
|
||||
status = "okay";
|
||||
|
||||
@ -177,6 +183,38 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan2";
|
||||
|
||||
phy-handle = <&phy1>;
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
label = "lan3";
|
||||
|
||||
phy-handle = <&phy2>;
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
label = "lan4";
|
||||
|
||||
phy-handle = <&phy3>;
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
label = "lan1";
|
||||
|
||||
phy-handle = <&phy4>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@ -37,6 +37,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&cfe 0x6a0>;
|
||||
};
|
||||
|
||||
&hsspi {
|
||||
status = "okay";
|
||||
|
||||
@ -168,6 +174,38 @@
|
||||
};
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan4";
|
||||
|
||||
phy-handle = <&phy1>;
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
label = "lan3";
|
||||
|
||||
phy-handle = <&phy2>;
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
label = "lan2";
|
||||
|
||||
phy-handle = <&phy3>;
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
label = "lan1";
|
||||
|
||||
phy-handle = <&phy4>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@ -346,5 +346,103 @@
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
switch0: switch@10080000 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6328-switch";
|
||||
reg = <0x10080000 0x8000>;
|
||||
big-endian;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "cpu";
|
||||
|
||||
phy-mode = "internal";
|
||||
ethernet = <ðernet>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@100800b0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6368-mdio-mux";
|
||||
reg = <0x100800b0 0x8>;
|
||||
|
||||
mdio_int: mdio@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <2>;
|
||||
};
|
||||
|
||||
phy3: ethernet-phy@3 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <3>;
|
||||
};
|
||||
|
||||
phy4: ethernet-phy@4 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_ext: mdio@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
ethernet: ethernet@10088000 {
|
||||
compatible = "brcm,bcm6318-enetsw";
|
||||
reg = <0x10088000 0x80>,
|
||||
<0x10088200 0x80>,
|
||||
<0x10088400 0x80>;
|
||||
reg-names = "dma",
|
||||
"dma-channels",
|
||||
"dma-sram";
|
||||
|
||||
interrupt-parent = <&periph_intc>;
|
||||
interrupts = <BCM6318_IRQ_ENETSW_RX_DMA0>,
|
||||
<BCM6318_IRQ_ENETSW_TX_DMA0>;
|
||||
interrupt-names = "rx",
|
||||
"tx";
|
||||
|
||||
clocks = <&periph_clk BCM6318_CLK_ROBOSW250>,
|
||||
<&periph_clk BCM6318_CLK_ROBOSW025>,
|
||||
<&ubus_clk BCM6318_UCLK_ROBOSW>;
|
||||
|
||||
resets = <&periph_rst BCM6318_RST_ENETSW>,
|
||||
<&periph_rst BCM6318_RST_EPHY>;
|
||||
|
||||
power-domains = <&periph_pwr BCM6318_POWER_DOMAIN_EPHY0>,
|
||||
<&periph_pwr BCM6318_POWER_DOMAIN_EPHY1>,
|
||||
<&periph_pwr BCM6318_POWER_DOMAIN_EPHY2>,
|
||||
<&periph_pwr BCM6318_POWER_DOMAIN_EPHY3>;
|
||||
|
||||
dma-rx = <0>;
|
||||
dma-tx = <1>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -432,5 +432,105 @@
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
ethernet: ethernet@1000d800 {
|
||||
compatible = "brcm,bcm63268-enetsw";
|
||||
reg = <0x1000d800 0x80>,
|
||||
<0x1000da00 0x80>,
|
||||
<0x1000dc00 0x80>;
|
||||
reg-names = "dma",
|
||||
"dma-channels",
|
||||
"dma-sram";
|
||||
|
||||
interrupt-parent = <&periph_intc>;
|
||||
interrupts = <BCM63268_IRQ_ENETSW_RX_DMA0>,
|
||||
<BCM63268_IRQ_ENETSW_TX_DMA0>;
|
||||
interrupt-names = "rx",
|
||||
"tx";
|
||||
|
||||
clocks = <&periph_clk BCM63268_CLK_GMAC>,
|
||||
<&periph_clk BCM63268_CLK_ROBOSW>,
|
||||
<&periph_clk BCM63268_CLK_ROBOSW250>,
|
||||
<&timer_clk BCM63268_TCLK_EPHY1>,
|
||||
<&timer_clk BCM63268_TCLK_EPHY2>,
|
||||
<&timer_clk BCM63268_TCLK_EPHY3>,
|
||||
<&timer_clk BCM63268_TCLK_GPHY1>;
|
||||
|
||||
resets = <&periph_rst BCM63268_RST_ENETSW>,
|
||||
<&periph_rst BCM63268_RST_EPHY>,
|
||||
<&periph_rst BCM63268_RST_GPHY>;
|
||||
|
||||
power-domains = <&periph_pwr BCM63268_POWER_DOMAIN_ROBOSW>;
|
||||
|
||||
dma-rx = <0>;
|
||||
dma-tx = <1>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
switch0: switch@10700000 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6328-switch";
|
||||
reg = <0x10700000 0x8000>;
|
||||
big-endian;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "cpu";
|
||||
|
||||
phy-mode = "internal";
|
||||
ethernet = <ðernet>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@107000b0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6368-mdio-mux";
|
||||
reg = <0x107000b0 0x8>;
|
||||
|
||||
mdio_int: mdio@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <2>;
|
||||
};
|
||||
|
||||
phy3: ethernet-phy@3 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <3>;
|
||||
};
|
||||
|
||||
phy4: ethernet-phy@4 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_ext: mdio@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -30,6 +30,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&cfe 0x6a0>;
|
||||
};
|
||||
|
||||
&hsspi {
|
||||
status = "okay";
|
||||
|
||||
@ -113,6 +119,38 @@
|
||||
};
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan1";
|
||||
|
||||
phy-handle = <&phy1>;
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
label = "lan2";
|
||||
|
||||
phy-handle = <&phy2>;
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
label = "lan3";
|
||||
|
||||
phy-handle = <&phy3>;
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
label = "lan4";
|
||||
|
||||
phy-handle = <&phy4>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@ -368,5 +368,99 @@
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
ethernet: ethernet@1000d800 {
|
||||
compatible = "brcm,bcm6328-enetsw";
|
||||
reg = <0x1000d800 0x80>,
|
||||
<0x1000da00 0x80>,
|
||||
<0x1000dc00 0x80>;
|
||||
reg-names = "dma",
|
||||
"dma-channels",
|
||||
"dma-sram";
|
||||
|
||||
interrupt-parent = <&periph_intc>;
|
||||
interrupts = <BCM6328_IRQ_ENETSW_RX_DMA0>,
|
||||
<BCM6328_IRQ_ENETSW_TX_DMA0>;
|
||||
interrupt-names = "rx",
|
||||
"tx";
|
||||
|
||||
clocks = <&periph_clk BCM6328_CLK_ROBOSW>;
|
||||
|
||||
resets = <&periph_rst BCM6328_RST_ENETSW>,
|
||||
<&periph_rst BCM6328_RST_EPHY>;
|
||||
|
||||
power-domains = <&periph_pwr BCM6328_POWER_DOMAIN_ROBOSW>,
|
||||
<&periph_pwr BCM6328_POWER_DOMAIN_EPHY>;
|
||||
|
||||
dma-rx = <0>;
|
||||
dma-tx = <1>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
switch0: switch@10e00000 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6328-switch";
|
||||
reg = <0x10e00000 0x8000>;
|
||||
big-endian;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "cpu";
|
||||
|
||||
phy-mode = "internal";
|
||||
ethernet = <ðernet>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@10e000b0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6368-mdio-mux";
|
||||
reg = <0x10e000b0 0x8>;
|
||||
|
||||
mdio_int: mdio@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <2>;
|
||||
};
|
||||
|
||||
phy3: ethernet-phy@3 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <3>;
|
||||
};
|
||||
|
||||
phy4: ethernet-phy@4 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_ext: mdio@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -62,6 +62,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&cferom 0x6a0>;
|
||||
};
|
||||
|
||||
&leds {
|
||||
status = "okay";
|
||||
|
||||
|
||||
@ -465,5 +465,99 @@
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
ethernet: ethernet@1000d800 {
|
||||
compatible = "brcm,bcm6362-enetsw";
|
||||
reg = <0x1000d800 0x80>,
|
||||
<0x1000da00 0x80>,
|
||||
<0x1000dc00 0x80>;
|
||||
reg-names = "dma",
|
||||
"dma-channels",
|
||||
"dma-sram";
|
||||
|
||||
interrupt-parent = <&periph_intc>;
|
||||
interrupts = <BCM6362_IRQ_ENETSW_RX_DMA0>;
|
||||
interrupt-names = "rx";
|
||||
|
||||
clocks = <&periph_clk BCM6362_CLK_SWPKT_USB>,
|
||||
<&periph_clk BCM6362_CLK_SWPKT_SAR>,
|
||||
<&periph_clk BCM6362_CLK_ROBOSW>;
|
||||
|
||||
resets = <&periph_rst BCM6362_RST_ENETSW>,
|
||||
<&periph_rst BCM6362_RST_EPHY>;
|
||||
|
||||
power-domains = <&periph_pwr BCM6362_POWER_DOMAIN_ROBOSW>,
|
||||
<&periph_pwr BCM6362_POWER_DOMAIN_GMII_PADS>;
|
||||
|
||||
dma-rx = <0>;
|
||||
dma-tx = <1>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
switch0: switch@10e00000 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6328-switch";
|
||||
reg = <0x10e00000 0x8000>;
|
||||
big-endian;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "cpu";
|
||||
|
||||
phy-mode = "internal";
|
||||
ethernet = <ðernet>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@10e000b0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6368-mdio-mux";
|
||||
reg = <0x10e000b0 0x8>;
|
||||
|
||||
mdio_int: mdio@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <2>;
|
||||
};
|
||||
|
||||
phy3: ethernet-phy@3 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <3>;
|
||||
};
|
||||
|
||||
phy4: ethernet-phy@4 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_ext: mdio@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -59,6 +59,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
ðernet {
|
||||
status = "okay";
|
||||
|
||||
mtd-mac-address = <&cfe 0x6a0>;
|
||||
};
|
||||
|
||||
&ohci {
|
||||
status = "okay";
|
||||
};
|
||||
@ -96,6 +102,38 @@
|
||||
&pinctrl_ephy2_led &pinctrl_ephy3_led>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
label = "lan1";
|
||||
|
||||
phy-handle = <&phy1>;
|
||||
};
|
||||
|
||||
port@1 {
|
||||
reg = <1>;
|
||||
label = "lan2";
|
||||
|
||||
phy-handle = <&phy2>;
|
||||
};
|
||||
|
||||
port@2 {
|
||||
reg = <2>;
|
||||
label = "lan3";
|
||||
|
||||
phy-handle = <&phy3>;
|
||||
};
|
||||
|
||||
port@3 {
|
||||
reg = <3>;
|
||||
label = "lan4";
|
||||
|
||||
phy-handle = <&phy4>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@ -467,6 +467,99 @@
|
||||
|
||||
resets = <&periph_rst BCM6368_RST_IPSEC>;
|
||||
};
|
||||
|
||||
ethernet: ethernet@10006800 {
|
||||
compatible = "brcm,bcm6368-enetsw";
|
||||
reg = <0x10006800 0x80>,
|
||||
<0x10006a00 0x80>,
|
||||
<0x10006c00 0x80>;
|
||||
reg-names = "dma",
|
||||
"dma-channels",
|
||||
"dma-sram";
|
||||
|
||||
interrupt-parent = <&periph_intc>;
|
||||
interrupts = <BCM6368_IRQ_ENETSW_RX_DMA0>,
|
||||
<BCM6368_IRQ_ENETSW_TX_DMA0>;
|
||||
interrupt-names = "rx",
|
||||
"tx";
|
||||
|
||||
clocks = <&periph_clk BCM6368_CLK_SWPKT_USB>,
|
||||
<&periph_clk BCM6368_CLK_SWPKT_SAR>,
|
||||
<&periph_clk BCM6368_CLK_ROBOSW>;
|
||||
|
||||
resets = <&periph_rst BCM6368_RST_SWITCH>,
|
||||
<&periph_rst BCM6368_RST_EPHY>;
|
||||
|
||||
dma-rx = <0>;
|
||||
dma-tx = <1>;
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
switch0: switch@10f00000 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6328-switch";
|
||||
reg = <0x10f00000 0x8000>;
|
||||
big-endian;
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@8 {
|
||||
reg = <8>;
|
||||
label = "cpu";
|
||||
|
||||
phy-mode = "internal";
|
||||
ethernet = <ðernet>;
|
||||
|
||||
fixed-link {
|
||||
speed = <1000>;
|
||||
full-duplex;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mdio: mdio@10f000b0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "brcm,bcm6368-mdio-mux";
|
||||
reg = <0x10f000b0 0x8>;
|
||||
|
||||
mdio_int: mdio@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0>;
|
||||
|
||||
phy1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <1>;
|
||||
};
|
||||
|
||||
phy2: ethernet-phy@2 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <2>;
|
||||
};
|
||||
|
||||
phy3: ethernet-phy@3 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <3>;
|
||||
};
|
||||
|
||||
phy4: ethernet-phy@4 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <4>;
|
||||
};
|
||||
};
|
||||
|
||||
mdio_ext: mdio@1 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
pflash: nor@18000000 {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
17
target/linux/bmips/generic/base-files/etc/board.d/02_network
Normal file
17
target/linux/bmips/generic/base-files/etc/board.d/02_network
Normal file
@ -0,0 +1,17 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
case "$(board_name)" in
|
||||
comtrend,ar-5315u |\
|
||||
comtrend,ar-5387un |\
|
||||
comtrend,vr-3025u)
|
||||
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
15
target/linux/bmips/nand/base-files/etc/board.d/02_network
Normal file
15
target/linux/bmips/nand/base-files/etc/board.d/02_network
Normal file
@ -0,0 +1,15 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
case "$(board_name)" in
|
||||
comtrend,vr-3032u)
|
||||
ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
@ -0,0 +1,38 @@
|
||||
From 0618e07ea3e0981d7765b43d3f7db39e739842eb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Fri, 5 Mar 2021 08:01:30 +0100
|
||||
Subject: [PATCH 1/3] dt-bindings: rng: bcm2835: add clock constraints
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
brcm,bcm6368-rng controllers require enabling the IPSEC clock in order to get
|
||||
a functional RNG.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
.../devicetree/bindings/rng/brcm,bcm2835.yaml | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml
|
||||
+++ b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml
|
||||
@@ -35,6 +35,16 @@ required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
+if:
|
||||
+ properties:
|
||||
+ compatible:
|
||||
+ enum:
|
||||
+ - brcm,bcm6368-rng
|
||||
+then:
|
||||
+ required:
|
||||
+ - clocks
|
||||
+ - clock-names
|
||||
+
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
@ -0,0 +1,51 @@
|
||||
From 381345820db55bf8e7289de047c24c00a2e3690d Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Fri, 5 Mar 2021 08:01:31 +0100
|
||||
Subject: [PATCH 2/3] dt-bindings: rng: bcm2835: document reset support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
brcm,bcm6368-rng controllers require resetting the IPSEC clock in order to get
|
||||
a functional RNG.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
.../devicetree/bindings/rng/brcm,bcm2835.yaml | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
--- a/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml
|
||||
+++ b/Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml
|
||||
@@ -28,6 +28,12 @@ properties:
|
||||
clock-names:
|
||||
const: ipsec
|
||||
|
||||
+ resets:
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ reset-names:
|
||||
+ const: ipsec
|
||||
+
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
@@ -44,6 +50,8 @@ then:
|
||||
required:
|
||||
- clocks
|
||||
- clock-names
|
||||
+ - resets
|
||||
+ - reset-names
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
@@ -68,4 +76,7 @@ examples:
|
||||
|
||||
clocks = <&periph_clk 18>;
|
||||
clock-names = "ipsec";
|
||||
+
|
||||
+ resets = <&periph_rst 4>;
|
||||
+ reset-names = "ipsec";
|
||||
};
|
||||
@ -1,12 +1,14 @@
|
||||
From 846cd2c9eee7a99de29c743911cc047fdd56db02 Mon Sep 17 00:00:00 2001
|
||||
From e5f9f41d5e62004c913bfd4ddf06abe032f5ce1c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Mon, 22 Feb 2021 20:41:04 +0100
|
||||
Subject: [PATCH] hwrng: bcm2835: add reset support
|
||||
Date: Fri, 5 Mar 2021 08:01:32 +0100
|
||||
Subject: [PATCH 3/3] hwrng: bcm2835 - add reset support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM6368 devices need to reset the in order to generate true random numbers.
|
||||
BCM6368 devices need to reset the IPSEC controller in order to generate true
|
||||
random numbers.
|
||||
|
||||
This is what BCM6368 produces without a reset:
|
||||
root@OpenWrt:/# cat /dev/hwrng | rngtest -c 1000
|
||||
rngtest 6.10
|
||||
@ -25,9 +27,11 @@ rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
|
||||
rngtest: input channel speed: (min=37.253; avg=320.827; max=635.783)Mibits/s
|
||||
rngtest: FIPS tests speed: (min=12.141; avg=15.034; max=16.428)Mibits/s
|
||||
rngtest: Program run time: 1336176 microseconds
|
||||
cat: write error: Broken pipe
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
|
||||
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
---
|
||||
drivers/char/hw_random/bcm2835-rng.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
@ -0,0 +1,29 @@
|
||||
From cd6906754bbe3e0665ecaeca2cfb26d927fe9277 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 07:29:29 +0100
|
||||
Subject: [PATCH 1/3] net: dsa: b53: relax is63xx() condition
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM63xx switches are present on bcm63xx and bmips devices.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_priv.h | 4 ----
|
||||
1 file changed, 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_priv.h
|
||||
+++ b/drivers/net/dsa/b53/b53_priv.h
|
||||
@@ -185,11 +185,7 @@ static inline int is531x5(struct b53_dev
|
||||
|
||||
static inline int is63xx(struct b53_device *dev)
|
||||
{
|
||||
-#ifdef CONFIG_BCM63XX
|
||||
return dev->chip_id == BCM63XX_DEVICE_ID;
|
||||
-#else
|
||||
- return 0;
|
||||
-#endif
|
||||
}
|
||||
|
||||
static inline int is5301x(struct b53_device *dev)
|
||||
@ -0,0 +1,82 @@
|
||||
From f5419e7f362ae1c462baf28a2da7360267f8e4f9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 07:32:32 +0100
|
||||
Subject: [PATCH 2/3] net: dsa: b53: mmap: Add device tree support
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add device tree support to b53_mmap.c while keeping platform devices support.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
drivers/net/dsa/b53/b53_mmap.c | 36 ++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 36 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/b53/b53_mmap.c
|
||||
+++ b/drivers/net/dsa/b53/b53_mmap.c
|
||||
@@ -228,12 +228,64 @@ static const struct b53_io_ops b53_mmap_
|
||||
.write64 = b53_mmap_write64,
|
||||
};
|
||||
|
||||
+static int b53_mmap_probe_of(struct platform_device *pdev,
|
||||
+ struct b53_platform_data **ppdata)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *np = dev->of_node;
|
||||
+ struct device_node *of_ports, *of_port;
|
||||
+ struct b53_platform_data *pdata;
|
||||
+ void __iomem *mem;
|
||||
+
|
||||
+ mem = devm_platform_ioremap_resource(pdev, 0);
|
||||
+ if (IS_ERR(mem))
|
||||
+ return PTR_ERR(mem);
|
||||
+
|
||||
+ pdata = devm_kzalloc(dev, sizeof(struct b53_platform_data),
|
||||
+ GFP_KERNEL);
|
||||
+ if (!pdata)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ pdata->regs = mem;
|
||||
+ pdata->chip_id = BCM63XX_DEVICE_ID;
|
||||
+ pdata->big_endian = of_property_read_bool(np, "big-endian");
|
||||
+
|
||||
+ of_ports = of_get_child_by_name(np, "ports");
|
||||
+ if (!of_ports) {
|
||||
+ dev_err(dev, "no ports child node found\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ for_each_available_child_of_node(of_ports, of_port) {
|
||||
+ u32 reg;
|
||||
+
|
||||
+ if (of_property_read_u32(of_port, "reg", ®))
|
||||
+ continue;
|
||||
+
|
||||
+ if (reg < B53_CPU_PORT)
|
||||
+ pdata->enabled_ports |= BIT(reg);
|
||||
+ }
|
||||
+
|
||||
+ *ppdata = pdata;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int b53_mmap_probe(struct platform_device *pdev)
|
||||
{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
struct b53_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct b53_mmap_priv *priv;
|
||||
struct b53_device *dev;
|
||||
|
||||
+ if (np) {
|
||||
+ int ret = b53_mmap_probe_of(pdev, &pdata);
|
||||
+ if (ret) {
|
||||
+ dev_err(&pdev->dev, "OF probe error\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (!pdata)
|
||||
return -EINVAL;
|
||||
|
||||
@ -0,0 +1,209 @@
|
||||
From 3bc3d79efdff6e29b80bf35f7a56baaa36e4d8fe Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Fri, 12 Mar 2021 12:35:39 +0100
|
||||
Subject: [PATCH] net: dsa: b53: support tags for legacy switches
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
drivers/net/dsa/b53/Kconfig | 1 +
|
||||
drivers/net/dsa/b53/b53_common.c | 6 +++
|
||||
include/net/dsa.h | 2 +
|
||||
net/dsa/Kconfig | 7 +++
|
||||
net/dsa/tag_brcm.c | 93 ++++++++++++++++++++++++++++++++
|
||||
5 files changed, 109 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/b53/Kconfig
|
||||
+++ b/drivers/net/dsa/b53/Kconfig
|
||||
@@ -3,6 +3,7 @@ menuconfig B53
|
||||
tristate "Broadcom BCM53xx managed switch support"
|
||||
depends on NET_DSA
|
||||
select NET_DSA_TAG_BRCM
|
||||
+ select NET_DSA_TAG_BRCM_LEGACY
|
||||
select NET_DSA_TAG_BRCM_PREPEND
|
||||
help
|
||||
This driver adds support for Broadcom managed switch chips. It supports
|
||||
--- a/drivers/net/dsa/b53/b53_common.c
|
||||
+++ b/drivers/net/dsa/b53/b53_common.c
|
||||
@@ -1992,6 +1992,7 @@ static bool b53_can_enable_brcm_tags(str
|
||||
|
||||
switch (tag_protocol) {
|
||||
case DSA_TAG_PROTO_BRCM:
|
||||
+ case DSA_TAG_PROTO_BRCM_LEGACY:
|
||||
case DSA_TAG_PROTO_BRCM_PREPEND:
|
||||
dev_warn(ds->dev,
|
||||
"Port %d is stacked to Broadcom tag switch\n", port);
|
||||
@@ -2013,12 +2014,16 @@ enum dsa_tag_protocol b53_get_tag_protoc
|
||||
/* Older models (5325, 5365) support a different tag format that we do
|
||||
* not support in net/dsa/tag_brcm.c yet.
|
||||
*/
|
||||
- if (is5325(dev) || is5365(dev) ||
|
||||
- !b53_can_enable_brcm_tags(ds, port, mprot)) {
|
||||
+ if (!b53_can_enable_brcm_tags(ds, port, mprot)) {
|
||||
dev->tag_protocol = DSA_TAG_PROTO_NONE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
+ if (is5325(dev) || is5365(dev) || is63xx(dev)) {
|
||||
+ dev->tag_protocol = DSA_TAG_PROTO_BRCM_LEGACY;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
/* Broadcom BCM58xx chips have a flow accelerator on Port 8
|
||||
* which requires us to use the prepended Broadcom tag type
|
||||
*/
|
||||
--- a/include/net/dsa.h
|
||||
+++ b/include/net/dsa.h
|
||||
@@ -45,10 +45,12 @@ struct phylink_link_state;
|
||||
#define DSA_TAG_PROTO_OCELOT_VALUE 15
|
||||
#define DSA_TAG_PROTO_AR9331_VALUE 16
|
||||
#define DSA_TAG_PROTO_RTL4_A_VALUE 17
|
||||
+#define DSA_TAG_PROTO_BRCM_LEGACY_VALUE 22
|
||||
|
||||
enum dsa_tag_protocol {
|
||||
DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE,
|
||||
DSA_TAG_PROTO_BRCM = DSA_TAG_PROTO_BRCM_VALUE,
|
||||
+ DSA_TAG_PROTO_BRCM_LEGACY = DSA_TAG_PROTO_BRCM_LEGACY_VALUE,
|
||||
DSA_TAG_PROTO_BRCM_PREPEND = DSA_TAG_PROTO_BRCM_PREPEND_VALUE,
|
||||
DSA_TAG_PROTO_DSA = DSA_TAG_PROTO_DSA_VALUE,
|
||||
DSA_TAG_PROTO_EDSA = DSA_TAG_PROTO_EDSA_VALUE,
|
||||
--- a/net/dsa/Kconfig
|
||||
+++ b/net/dsa/Kconfig
|
||||
@@ -47,6 +47,13 @@ config NET_DSA_TAG_BRCM
|
||||
Say Y if you want to enable support for tagging frames for the
|
||||
Broadcom switches which place the tag after the MAC source address.
|
||||
|
||||
+config NET_DSA_TAG_BRCM_LEGACY
|
||||
+ tristate "Tag driver for Broadcom legacy switches using in-frame headers"
|
||||
+ select NET_DSA_TAG_BRCM_COMMON
|
||||
+ help
|
||||
+ Say Y if you want to enable support for tagging frames for the
|
||||
+ Broadcom legacy switches which place the tag after the MAC source
|
||||
+ address.
|
||||
|
||||
config NET_DSA_TAG_BRCM_PREPEND
|
||||
tristate "Tag driver for Broadcom switches using prepended headers"
|
||||
--- a/net/dsa/tag_brcm.c
|
||||
+++ b/net/dsa/tag_brcm.c
|
||||
@@ -8,9 +8,23 @@
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
+#include <linux/types.h>
|
||||
|
||||
#include "dsa_priv.h"
|
||||
|
||||
+struct bcm_legacy_tag {
|
||||
+ uint16_t type;
|
||||
+#define BRCM_LEG_TYPE 0x8874
|
||||
+
|
||||
+ uint32_t tag;
|
||||
+#define BRCM_LEG_TAG_PORT_ID (0xf)
|
||||
+#define BRCM_LEG_TAG_MULTICAST (1 << 29)
|
||||
+#define BRCM_LEG_TAG_EGRESS (2 << 29)
|
||||
+#define BRCM_LEG_TAG_INGRESS (3 << 29)
|
||||
+} __attribute__((packed));
|
||||
+
|
||||
+#define BRCM_LEG_TAG_LEN sizeof(struct bcm_legacy_tag)
|
||||
+
|
||||
/* This tag length is 4 bytes, older ones were 6 bytes, we do not
|
||||
* handle them
|
||||
*/
|
||||
@@ -197,6 +211,85 @@ DSA_TAG_DRIVER(brcm_netdev_ops);
|
||||
MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM);
|
||||
#endif
|
||||
|
||||
+#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
|
||||
+static struct sk_buff *brcm_leg_tag_xmit(struct sk_buff *skb,
|
||||
+ struct net_device *dev)
|
||||
+{
|
||||
+ struct dsa_port *dp = dsa_slave_to_port(dev);
|
||||
+ struct bcm_legacy_tag *brcm_tag;
|
||||
+
|
||||
+ if (skb_cow_head(skb, BRCM_LEG_TAG_LEN) < 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* The Ethernet switch we are interfaced with needs packets to be at
|
||||
+ * least 64 bytes (including FCS) otherwise they will be discarded when
|
||||
+ * they enter the switch port logic. When Broadcom tags are enabled, we
|
||||
+ * need to make sure that packets are at least 70 bytes
|
||||
+ * (including FCS and tag) because the length verification is done after
|
||||
+ * the Broadcom tag is stripped off the ingress packet.
|
||||
+ *
|
||||
+ * Let dsa_slave_xmit() free the SKB
|
||||
+ */
|
||||
+ if (__skb_put_padto(skb, ETH_ZLEN + BRCM_LEG_TAG_LEN, false))
|
||||
+ return NULL;
|
||||
+
|
||||
+ skb_push(skb, BRCM_LEG_TAG_LEN);
|
||||
+
|
||||
+ memmove(skb->data, skb->data + BRCM_LEG_TAG_LEN, 2 * ETH_ALEN);
|
||||
+
|
||||
+ brcm_tag = (struct bcm_legacy_tag *) (skb->data + 2 * ETH_ALEN);
|
||||
+
|
||||
+ brcm_tag->type = BRCM_LEG_TYPE;
|
||||
+ brcm_tag->tag = BRCM_LEG_TAG_EGRESS;
|
||||
+ brcm_tag->tag |= dp->index & BRCM_LEG_TAG_PORT_ID;
|
||||
+
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
|
||||
+ struct net_device *dev,
|
||||
+ struct packet_type *pt)
|
||||
+{
|
||||
+ int source_port;
|
||||
+ struct bcm_legacy_tag *brcm_tag;
|
||||
+
|
||||
+ if (unlikely(!pskb_may_pull(skb, BRCM_LEG_TAG_LEN)))
|
||||
+ return NULL;
|
||||
+
|
||||
+ brcm_tag = (struct bcm_legacy_tag *) (skb->data - 2);
|
||||
+
|
||||
+ source_port = brcm_tag->tag & BRCM_LEG_TAG_PORT_ID;
|
||||
+
|
||||
+ skb->dev = dsa_master_find_slave(dev, 0, source_port);
|
||||
+ if (!skb->dev)
|
||||
+ return NULL;
|
||||
+
|
||||
+ /* Remove Broadcom tag and update checksum */
|
||||
+ skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN);
|
||||
+
|
||||
+ skb->offload_fwd_mark = 1;
|
||||
+
|
||||
+ /* Move the Ethernet DA and SA */
|
||||
+ memmove(skb->data - ETH_HLEN,
|
||||
+ skb->data - ETH_HLEN - BRCM_LEG_TAG_LEN,
|
||||
+ 2 * ETH_ALEN);
|
||||
+
|
||||
+ return skb;
|
||||
+}
|
||||
+
|
||||
+static const struct dsa_device_ops brcm_legacy_netdev_ops = {
|
||||
+ .name = "brcm-legacy",
|
||||
+ .proto = DSA_TAG_PROTO_BRCM_LEGACY,
|
||||
+ .xmit = brcm_leg_tag_xmit,
|
||||
+ .rcv = brcm_leg_tag_rcv,
|
||||
+ .overhead = BRCM_LEG_TAG_LEN,
|
||||
+};
|
||||
+
|
||||
+DSA_TAG_DRIVER(brcm_legacy_netdev_ops);
|
||||
+MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_BRCM_LEGACY);
|
||||
+#endif /* CONFIG_NET_DSA_TAG_BRCM_LEGACY */
|
||||
+
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
|
||||
static struct sk_buff *brcm_tag_xmit_prepend(struct sk_buff *skb,
|
||||
struct net_device *dev)
|
||||
@@ -229,6 +322,9 @@ static struct dsa_tag_driver *dsa_tag_dr
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM)
|
||||
&DSA_TAG_DRIVER_NAME(brcm_netdev_ops),
|
||||
#endif
|
||||
+#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_LEGACY)
|
||||
+ &DSA_TAG_DRIVER_NAME(brcm_legacy_netdev_ops),
|
||||
+#endif
|
||||
#if IS_ENABLED(CONFIG_NET_DSA_TAG_BRCM_PREPEND)
|
||||
&DSA_TAG_DRIVER_NAME(brcm_prepend_netdev_ops),
|
||||
#endif
|
||||
@ -0,0 +1,46 @@
|
||||
From 590b60fb08cb1e70fe02d3f407c6b3dbe9ad06ff Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 07:34:39 +0100
|
||||
Subject: [PATCH 3/4] net: broadcom: add BCM6368 enetsw controller driver
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This controller is present on BCM6318, BCM6328, BCM6362, BCM6368 and BCM63268
|
||||
SoCs.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/Kconfig | 8 +
|
||||
drivers/net/ethernet/broadcom/Makefile | 1 +
|
||||
.../net/ethernet/broadcom/bcm6368-enetsw.c | 1111 +++++++++++++++++
|
||||
3 files changed, 1120 insertions(+)
|
||||
create mode 100644 drivers/net/ethernet/broadcom/bcm6368-enetsw.c
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/Kconfig
|
||||
+++ b/drivers/net/ethernet/broadcom/Kconfig
|
||||
@@ -60,6 +60,14 @@ config BCM63XX_ENET
|
||||
This driver supports the ethernet MACs in the Broadcom 63xx
|
||||
MIPS chipset family (BCM63XX).
|
||||
|
||||
+config BCM6368_ENETSW
|
||||
+ tristate "Broadcom BCM6368 internal mac support"
|
||||
+ depends on BMIPS_GENERIC || COMPILE_TEST
|
||||
+ default y
|
||||
+ help
|
||||
+ This driver supports Ethernet controller integrated into Broadcom
|
||||
+ BCM6368 family SoCs.
|
||||
+
|
||||
config BCMGENET
|
||||
tristate "Broadcom GENET internal MAC support"
|
||||
depends on HAS_IOMEM
|
||||
--- a/drivers/net/ethernet/broadcom/Makefile
|
||||
+++ b/drivers/net/ethernet/broadcom/Makefile
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
obj-$(CONFIG_B44) += b44.o
|
||||
obj-$(CONFIG_BCM63XX_ENET) += bcm63xx_enet.o
|
||||
+obj-$(CONFIG_BCM6368_ENETSW) += bcm6368-enetsw.o
|
||||
obj-$(CONFIG_BCMGENET) += genet/
|
||||
obj-$(CONFIG_BNX2) += bnx2.o
|
||||
obj-$(CONFIG_CNIC) += cnic.o
|
||||
@ -0,0 +1,231 @@
|
||||
From b6ecb2bca2b8ff80ae4b1b15f09dcf071f4ceaf4 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
|
||||
Date: Mon, 1 Mar 2021 16:42:12 +0100
|
||||
Subject: [PATCH] net: mdio: Add BCM6368 MDIO mux bus controller
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This controller is present on BCM6318, BCM6328, BCM6362, BCM6368 and BCM63268
|
||||
SoCs.
|
||||
|
||||
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
---
|
||||
drivers/net/mdio/Kconfig | 11 ++
|
||||
drivers/net/mdio/Makefile | 1 +
|
||||
drivers/net/mdio/mdio-mux-bcm6368.c | 179 ++++++++++++++++++++++++++++
|
||||
3 files changed, 191 insertions(+)
|
||||
create mode 100644 drivers/net/mdio/mdio-mux-bcm6368.c
|
||||
|
||||
--- a/drivers/net/mdio/Kconfig
|
||||
+++ b/drivers/net/mdio/Kconfig
|
||||
@@ -200,6 +200,17 @@ config MDIO_BUS_MUX_MESON_G12A
|
||||
the amlogic g12a SoC. The multiplexers connects either the external
|
||||
or the internal MDIO bus to the parent bus.
|
||||
|
||||
+config MDIO_BUS_MUX_BCM6368
|
||||
+ tristate "Broadcom BCM6368 MDIO bus multiplexers"
|
||||
+ depends on OF && OF_MDIO && (BMIPS_GENERIC || COMPILE_TEST)
|
||||
+ select MDIO_BUS_MUX
|
||||
+ default BMIPS_GENERIC
|
||||
+ help
|
||||
+ This module provides a driver for MDIO bus multiplexers found in
|
||||
+ BCM6368 based Broadcom SoCs. This multiplexer connects one of several
|
||||
+ child MDIO bus to a parent bus. Buses could be internal as well as
|
||||
+ external and selection logic lies inside the same multiplexer.
|
||||
+
|
||||
config MDIO_BUS_MUX_BCM_IPROC
|
||||
tristate "Broadcom iProc based MDIO bus multiplexers"
|
||||
depends on OF && OF_MDIO && (ARCH_BCM_IPROC || COMPILE_TEST)
|
||||
--- a/drivers/net/mdio/Makefile
|
||||
+++ b/drivers/net/mdio/Makefile
|
||||
@@ -22,6 +22,7 @@ obj-$(CONFIG_MDIO_THUNDER) += mdio-thun
|
||||
obj-$(CONFIG_MDIO_XGENE) += mdio-xgene.o
|
||||
|
||||
obj-$(CONFIG_MDIO_BUS_MUX) += mdio-mux.o
|
||||
+obj-$(CONFIG_MDIO_BUS_MUX_BCM6368) += mdio-mux-bcm6368.o
|
||||
obj-$(CONFIG_MDIO_BUS_MUX_BCM_IPROC) += mdio-mux-bcm-iproc.o
|
||||
obj-$(CONFIG_MDIO_BUS_MUX_GPIO) += mdio-mux-gpio.o
|
||||
obj-$(CONFIG_MDIO_BUS_MUX_MESON_G12A) += mdio-mux-meson-g12a.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/mdio/mdio-mux-bcm6368.c
|
||||
@@ -0,0 +1,179 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Broadcom BCM6368 mdiomux bus controller driver
|
||||
+ *
|
||||
+ * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mdio-mux.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/sched.h>
|
||||
+
|
||||
+#define MDIOC_REG 0x0
|
||||
+#define MDIOC_EXT_MASK BIT(16)
|
||||
+#define MDIOC_REG_SHIFT 20
|
||||
+#define MDIOC_PHYID_SHIFT 25
|
||||
+#define MDIOC_RD_MASK BIT(30)
|
||||
+#define MDIOC_WR_MASK BIT(31)
|
||||
+
|
||||
+#define MDIOD_REG 0x4
|
||||
+
|
||||
+struct bcm6368_mdiomux_desc {
|
||||
+ void *mux_handle;
|
||||
+ void __iomem *base;
|
||||
+ struct device *dev;
|
||||
+ struct mii_bus *mii_bus;
|
||||
+ int ext_phy;
|
||||
+};
|
||||
+
|
||||
+static int bcm6368_mdiomux_read(struct mii_bus *bus, int phy_id, int loc)
|
||||
+{
|
||||
+ struct bcm6368_mdiomux_desc *md = bus->priv;
|
||||
+ uint32_t reg;
|
||||
+ int ret;
|
||||
+
|
||||
+ __raw_writel(0, md->base + MDIOC_REG);
|
||||
+
|
||||
+ reg = MDIOC_RD_MASK |
|
||||
+ (phy_id << MDIOC_PHYID_SHIFT) |
|
||||
+ (loc << MDIOC_REG_SHIFT);
|
||||
+ if (md->ext_phy)
|
||||
+ reg |= MDIOC_EXT_MASK;
|
||||
+
|
||||
+ __raw_writel(reg, md->base + MDIOC_REG);
|
||||
+ udelay(50);
|
||||
+ ret = __raw_readw(md->base + MDIOD_REG);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int bcm6368_mdiomux_write(struct mii_bus *bus, int phy_id, int loc,
|
||||
+ uint16_t val)
|
||||
+{
|
||||
+ struct bcm6368_mdiomux_desc *md = bus->priv;
|
||||
+ uint32_t reg;
|
||||
+
|
||||
+ __raw_writel(0, md->base + MDIOC_REG);
|
||||
+
|
||||
+ reg = MDIOC_WR_MASK |
|
||||
+ (phy_id << MDIOC_PHYID_SHIFT) |
|
||||
+ (loc << MDIOC_REG_SHIFT);
|
||||
+ if (md->ext_phy)
|
||||
+ reg |= MDIOC_EXT_MASK;
|
||||
+ reg |= val;
|
||||
+
|
||||
+ __raw_writel(reg, md->base + MDIOC_REG);
|
||||
+ udelay(50);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm6368_mdiomux_switch_fn(int current_child, int desired_child,
|
||||
+ void *data)
|
||||
+{
|
||||
+ struct bcm6368_mdiomux_desc *md = data;
|
||||
+
|
||||
+ md->ext_phy = desired_child;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int bcm6368_mdiomux_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct bcm6368_mdiomux_desc *md;
|
||||
+ struct mii_bus *bus;
|
||||
+ struct resource *res;
|
||||
+ int rc;
|
||||
+
|
||||
+ md = devm_kzalloc(&pdev->dev, sizeof(*md), GFP_KERNEL);
|
||||
+ if (!md)
|
||||
+ return -ENOMEM;
|
||||
+ md->dev = &pdev->dev;
|
||||
+
|
||||
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
+ if (!res)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ /* Just ioremap, as this MDIO block is usually integrated into an
|
||||
+ * Ethernet MAC controller register range
|
||||
+ */
|
||||
+ md->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
|
||||
+ if (!md->base) {
|
||||
+ dev_err(&pdev->dev, "failed to ioremap register\n");
|
||||
+ return -ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ md->mii_bus = devm_mdiobus_alloc(&pdev->dev);
|
||||
+ if (!md->mii_bus) {
|
||||
+ dev_err(&pdev->dev, "mdiomux bus alloc failed\n");
|
||||
+ return ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ bus = md->mii_bus;
|
||||
+ bus->priv = md;
|
||||
+ bus->name = "BCM6368 MDIO mux bus";
|
||||
+ snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id);
|
||||
+ bus->parent = &pdev->dev;
|
||||
+ bus->read = bcm6368_mdiomux_read;
|
||||
+ bus->write = bcm6368_mdiomux_write;
|
||||
+ bus->phy_mask = 0x3f;
|
||||
+ bus->dev.of_node = pdev->dev.of_node;
|
||||
+
|
||||
+ rc = mdiobus_register(bus);
|
||||
+ if (rc) {
|
||||
+ dev_err(&pdev->dev, "mdiomux registration failed\n");
|
||||
+ return rc;
|
||||
+ }
|
||||
+
|
||||
+ platform_set_drvdata(pdev, md);
|
||||
+
|
||||
+ rc = mdio_mux_init(md->dev, md->dev->of_node,
|
||||
+ bcm6368_mdiomux_switch_fn, &md->mux_handle, md,
|
||||
+ md->mii_bus);
|
||||
+ if (rc) {
|
||||
+ dev_info(md->dev, "mdiomux initialization failed\n");
|
||||
+ goto out_register;
|
||||
+ }
|
||||
+
|
||||
+ dev_info(&pdev->dev, "Broadcom BCM6368 MDIO mux bus\n");
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+out_register:
|
||||
+ mdiobus_unregister(bus);
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static int bcm6368_mdiomux_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct bcm6368_mdiomux_desc *md = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ mdio_mux_uninit(md->mux_handle);
|
||||
+ mdiobus_unregister(md->mii_bus);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id bcm6368_mdiomux_ids[] = {
|
||||
+ { .compatible = "brcm,bcm6368-mdio-mux", },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, bcm6368_mdiomux_ids);
|
||||
+
|
||||
+static struct platform_driver bcm6368_mdiomux_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "bcm6368-mdio-mux",
|
||||
+ .of_match_table = bcm6368_mdiomux_ids,
|
||||
+ },
|
||||
+ .probe = bcm6368_mdiomux_probe,
|
||||
+ .remove = bcm6368_mdiomux_remove,
|
||||
+};
|
||||
+module_platform_driver(bcm6368_mdiomux_driver);
|
||||
@ -0,0 +1,115 @@
|
||||
From 6418522022c706fd867b00b2571edba48b8fa8c7 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 11 Feb 2021 23:04:25 +0100
|
||||
Subject: [PATCH] dt-bindings: mtd: move partition binding to its own file
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Single partition binding is quite common and may be:
|
||||
1. Used by multiple parsers
|
||||
2. Extended for more specific cases
|
||||
|
||||
Move it to separated file to avoid code duplication.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
---
|
||||
.../mtd/partitions/fixed-partitions.yaml | 33 +------------
|
||||
.../bindings/mtd/partitions/partition.yaml | 47 +++++++++++++++++++
|
||||
2 files changed, 48 insertions(+), 32 deletions(-)
|
||||
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/partition.yaml
|
||||
|
||||
--- a/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
|
||||
+++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
|
||||
@@ -27,38 +27,7 @@ properties:
|
||||
|
||||
patternProperties:
|
||||
"@[0-9a-f]+$":
|
||||
- description: node describing a single flash partition
|
||||
- type: object
|
||||
-
|
||||
- properties:
|
||||
- reg:
|
||||
- description: partition's offset and size within the flash
|
||||
- maxItems: 1
|
||||
-
|
||||
- label:
|
||||
- description: The label / name for this partition. If omitted, the label
|
||||
- is taken from the node name (excluding the unit address).
|
||||
-
|
||||
- read-only:
|
||||
- description: This parameter, if present, is a hint that this partition
|
||||
- should only be mounted read-only. This is usually used for flash
|
||||
- partitions containing early-boot firmware images or data which should
|
||||
- not be clobbered.
|
||||
- type: boolean
|
||||
-
|
||||
- lock:
|
||||
- description: Do not unlock the partition at initialization time (not
|
||||
- supported on all devices)
|
||||
- type: boolean
|
||||
-
|
||||
- slc-mode:
|
||||
- description: This parameter, if present, allows one to emulate SLC mode
|
||||
- on a partition attached to an MLC NAND thus making this partition
|
||||
- immune to paired-pages corruptions
|
||||
- type: boolean
|
||||
-
|
||||
- required:
|
||||
- - reg
|
||||
+ $ref: "partition.yaml#"
|
||||
|
||||
required:
|
||||
- "#address-cells"
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml
|
||||
@@ -0,0 +1,47 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/mtd/partitions/partition.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Partition
|
||||
+
|
||||
+description: |
|
||||
+ This binding describes a single flash partition. Each partition must have its
|
||||
+ relative offset and size specified. Depending on partition function extra
|
||||
+ properties can be used.
|
||||
+
|
||||
+maintainers:
|
||||
+ - Rafał Miłecki <rafal@milecki.pl>
|
||||
+
|
||||
+properties:
|
||||
+ reg:
|
||||
+ description: partition's offset and size within the flash
|
||||
+ maxItems: 1
|
||||
+
|
||||
+ label:
|
||||
+ description: The label / name for this partition. If omitted, the label
|
||||
+ is taken from the node name (excluding the unit address).
|
||||
+
|
||||
+ read-only:
|
||||
+ description: This parameter, if present, is a hint that this partition
|
||||
+ should only be mounted read-only. This is usually used for flash
|
||||
+ partitions containing early-boot firmware images or data which should
|
||||
+ not be clobbered.
|
||||
+ type: boolean
|
||||
+
|
||||
+ lock:
|
||||
+ description: Do not unlock the partition at initialization time (not
|
||||
+ supported on all devices)
|
||||
+ type: boolean
|
||||
+
|
||||
+ slc-mode:
|
||||
+ description: This parameter, if present, allows one to emulate SLC mode
|
||||
+ on a partition attached to an MLC NAND thus making this partition
|
||||
+ immune to paired-pages corruptions
|
||||
+ type: boolean
|
||||
+
|
||||
+required:
|
||||
+ - reg
|
||||
+
|
||||
+additionalProperties: true
|
||||
@ -0,0 +1,92 @@
|
||||
From 6e9dff6fe3fbc452f16566e4a7e293b0decefdba Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Thu, 11 Feb 2021 23:04:26 +0100
|
||||
Subject: [PATCH] dt-bindings: mtd: add binding for BCM4908 partitions
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
BCM4908 uses fixed partitions layout but function of some partitions may
|
||||
vary. Some devices use multiple firmware partitions and those partitions
|
||||
should be marked to let system discover their purpose.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
---
|
||||
.../partitions/brcm,bcm4908-partitions.yaml | 70 +++++++++++++++++++
|
||||
1 file changed, 70 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
|
||||
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
|
||||
@@ -0,0 +1,70 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/mtd/partitions/brcm,bcm4908-partitions.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Broadcom BCM4908 partitioning
|
||||
+
|
||||
+description: |
|
||||
+ Broadcom BCM4908 CFE bootloader supports two firmware partitions. One is used
|
||||
+ for regular booting, the other is treated as fallback.
|
||||
+
|
||||
+ This binding allows defining all fixed partitions and marking those containing
|
||||
+ firmware. System can use that information e.g. for booting or flashing
|
||||
+ purposes.
|
||||
+
|
||||
+maintainers:
|
||||
+ - Rafał Miłecki <rafal@milecki.pl>
|
||||
+
|
||||
+properties:
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908-partitions
|
||||
+
|
||||
+ "#address-cells":
|
||||
+ enum: [ 1, 2 ]
|
||||
+
|
||||
+ "#size-cells":
|
||||
+ enum: [ 1, 2 ]
|
||||
+
|
||||
+patternProperties:
|
||||
+ "^partition@[0-9a-f]+$":
|
||||
+ $ref: "partition.yaml#"
|
||||
+ properties:
|
||||
+ compatible:
|
||||
+ const: brcm,bcm4908-firmware
|
||||
+ unevaluatedProperties: false
|
||||
+
|
||||
+required:
|
||||
+ - "#address-cells"
|
||||
+ - "#size-cells"
|
||||
+
|
||||
+additionalProperties: false
|
||||
+
|
||||
+examples:
|
||||
+ - |
|
||||
+ partitions {
|
||||
+ compatible = "brcm,bcm4908-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "cferom";
|
||||
+ reg = <0x0 0x100000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ compatible = "brcm,bcm4908-firmware";
|
||||
+ reg = <0x100000 0xf00000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1000000 {
|
||||
+ compatible = "brcm,bcm4908-firmware";
|
||||
+ reg = <0x1000000 0xf00000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1f00000 {
|
||||
+ label = "calibration";
|
||||
+ reg = <0x1f00000 0x100000>;
|
||||
+ };
|
||||
+ };
|
||||
@ -0,0 +1,69 @@
|
||||
From 2d751203aacf86a1b301a188d8551c7da91043ab Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Tue, 2 Mar 2021 20:00:12 +0100
|
||||
Subject: [PATCH] mtd: parsers: ofpart: limit parsing of deprecated DT syntax
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
For backward compatibility ofpart still supports the old syntax like:
|
||||
spi-flash@0 {
|
||||
compatible = "jedec,spi-nor";
|
||||
reg = <0x0>;
|
||||
|
||||
partition@0 {
|
||||
label = "bootloader";
|
||||
reg = <0x0 0x100000>;
|
||||
};
|
||||
};
|
||||
(without "partitions" subnode).
|
||||
|
||||
There is no reason however to support nested partitions without a clear
|
||||
"compatible" string like:
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@0 {
|
||||
label = "bootloader";
|
||||
reg = <0x0 0x100000>;
|
||||
|
||||
partition@0 {
|
||||
label = "config";
|
||||
reg = <0x80000 0x80000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
(we never officially supported or documented that).
|
||||
|
||||
Make sure ofpart doesn't attempt to parse above.
|
||||
|
||||
Cc: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
Link: https://lore.kernel.org/linux-mtd/20210302190012.1255-1-zajec5@gmail.com
|
||||
---
|
||||
drivers/mtd/parsers/ofpart_core.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/mtd/parsers/ofpart_core.c
|
||||
+++ b/drivers/mtd/parsers/ofpart_core.c
|
||||
@@ -53,7 +53,7 @@ static int parse_fixed_partitions(struct
|
||||
return 0;
|
||||
|
||||
ofpart_node = of_get_child_by_name(mtd_node, "partitions");
|
||||
- if (!ofpart_node) {
|
||||
+ if (!ofpart_node && !master->parent) {
|
||||
/*
|
||||
* We might get here even when ofpart isn't used at all (e.g.,
|
||||
* when using another parser), so don't be louder than
|
||||
@@ -64,6 +64,8 @@ static int parse_fixed_partitions(struct
|
||||
ofpart_node = mtd_node;
|
||||
dedicated = false;
|
||||
}
|
||||
+ if (!ofpart_node)
|
||||
+ return 0;
|
||||
|
||||
of_id = of_match_node(parse_ofpart_match_table, ofpart_node);
|
||||
if (dedicated && !of_id) {
|
||||
@ -0,0 +1,80 @@
|
||||
From fb009cbdd0693bd633f11e99526617b3d392cfad Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Mar 2021 10:03:16 +0100
|
||||
Subject: [PATCH] firmware: bcm47xx_nvram: rename finding function and its
|
||||
variables
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
1. Use "bcm47xx_" function name prefix for consistency
|
||||
2. It takes flash start as argument so s/iobase/flash_start/
|
||||
3. "off" was used for finding flash end so just call it "flash_size"
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
|
||||
---
|
||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 24 ++++++++++++-----------
|
||||
1 file changed, 13 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
@@ -48,11 +48,13 @@ static u32 find_nvram_size(void __iomem
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/* Probe for NVRAM header */
|
||||
-static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
|
||||
+/**
|
||||
+ * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it
|
||||
+ */
|
||||
+static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size)
|
||||
{
|
||||
struct nvram_header __iomem *header;
|
||||
- u32 off;
|
||||
+ size_t flash_size;
|
||||
u32 size;
|
||||
|
||||
if (nvram_len) {
|
||||
@@ -61,25 +63,25 @@ static int nvram_find_and_copy(void __io
|
||||
}
|
||||
|
||||
/* TODO: when nvram is on nand flash check for bad blocks first. */
|
||||
- off = FLASH_MIN;
|
||||
- while (off <= lim) {
|
||||
+ flash_size = FLASH_MIN;
|
||||
+ while (flash_size <= res_size) {
|
||||
/* Windowed flash access */
|
||||
- size = find_nvram_size(iobase + off);
|
||||
+ size = find_nvram_size(flash_start + flash_size);
|
||||
if (size) {
|
||||
- header = (struct nvram_header *)(iobase + off - size);
|
||||
+ header = (struct nvram_header *)(flash_start + flash_size - size);
|
||||
goto found;
|
||||
}
|
||||
- off <<= 1;
|
||||
+ flash_size <<= 1;
|
||||
}
|
||||
|
||||
/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
|
||||
- header = (struct nvram_header *)(iobase + 4096);
|
||||
+ header = (struct nvram_header *)(flash_start + 4096);
|
||||
if (header->magic == NVRAM_MAGIC) {
|
||||
size = NVRAM_SPACE;
|
||||
goto found;
|
||||
}
|
||||
|
||||
- header = (struct nvram_header *)(iobase + 1024);
|
||||
+ header = (struct nvram_header *)(flash_start + 1024);
|
||||
if (header->magic == NVRAM_MAGIC) {
|
||||
size = NVRAM_SPACE;
|
||||
goto found;
|
||||
@@ -124,7 +126,7 @@ int bcm47xx_nvram_init_from_mem(u32 base
|
||||
if (!iobase)
|
||||
return -ENOMEM;
|
||||
|
||||
- err = nvram_find_and_copy(iobase, lim);
|
||||
+ err = bcm47xx_nvram_find_and_copy(iobase, lim);
|
||||
|
||||
iounmap(iobase);
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
From 0a24b51a3264a3f942a75025ea5ff6133c8989b0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Mar 2021 10:03:17 +0100
|
||||
Subject: [PATCH] firmware: bcm47xx_nvram: add helper checking for NVRAM
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This avoids duplicating code doing casting and checking for NVRAM magic.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
|
||||
---
|
||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 30 ++++++++++++++---------
|
||||
1 file changed, 18 insertions(+), 12 deletions(-)
|
||||
|
||||
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
@@ -34,14 +34,20 @@ static char nvram_buf[NVRAM_SPACE];
|
||||
static size_t nvram_len;
|
||||
static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x10000};
|
||||
|
||||
+/**
|
||||
+ * bcm47xx_nvram_is_valid - check for a valid NVRAM at specified memory
|
||||
+ */
|
||||
+static bool bcm47xx_nvram_is_valid(void __iomem *nvram)
|
||||
+{
|
||||
+ return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC;
|
||||
+}
|
||||
+
|
||||
static u32 find_nvram_size(void __iomem *end)
|
||||
{
|
||||
- struct nvram_header __iomem *header;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
|
||||
- header = (struct nvram_header *)(end - nvram_sizes[i]);
|
||||
- if (header->magic == NVRAM_MAGIC)
|
||||
+ if (bcm47xx_nvram_is_valid(end - nvram_sizes[i]))
|
||||
return nvram_sizes[i];
|
||||
}
|
||||
|
||||
@@ -55,6 +61,7 @@ static int bcm47xx_nvram_find_and_copy(v
|
||||
{
|
||||
struct nvram_header __iomem *header;
|
||||
size_t flash_size;
|
||||
+ size_t offset;
|
||||
u32 size;
|
||||
|
||||
if (nvram_len) {
|
||||
@@ -68,31 +75,30 @@ static int bcm47xx_nvram_find_and_copy(v
|
||||
/* Windowed flash access */
|
||||
size = find_nvram_size(flash_start + flash_size);
|
||||
if (size) {
|
||||
- header = (struct nvram_header *)(flash_start + flash_size - size);
|
||||
+ offset = flash_size - size;
|
||||
goto found;
|
||||
}
|
||||
flash_size <<= 1;
|
||||
}
|
||||
|
||||
/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
|
||||
- header = (struct nvram_header *)(flash_start + 4096);
|
||||
- if (header->magic == NVRAM_MAGIC) {
|
||||
- size = NVRAM_SPACE;
|
||||
+
|
||||
+ offset = 4096;
|
||||
+ if (bcm47xx_nvram_is_valid(flash_start + offset))
|
||||
goto found;
|
||||
- }
|
||||
|
||||
- header = (struct nvram_header *)(flash_start + 1024);
|
||||
- if (header->magic == NVRAM_MAGIC) {
|
||||
- size = NVRAM_SPACE;
|
||||
+ offset = 1024;
|
||||
+ if (bcm47xx_nvram_is_valid(flash_start + offset))
|
||||
goto found;
|
||||
- }
|
||||
|
||||
pr_err("no nvram found\n");
|
||||
return -ENXIO;
|
||||
|
||||
found:
|
||||
+ header = (struct nvram_header *)(flash_start + offset);
|
||||
__ioread32_copy(nvram_buf, header, sizeof(*header) / 4);
|
||||
nvram_len = ((struct nvram_header *)(nvram_buf))->len;
|
||||
+ size = res_size - offset;
|
||||
if (nvram_len > size) {
|
||||
pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n");
|
||||
nvram_len = size;
|
||||
@ -0,0 +1,80 @@
|
||||
From 298923cf999cecd2ef06df126f85a3d68da8c4d8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Mar 2021 10:03:18 +0100
|
||||
Subject: [PATCH] firmware: bcm47xx_nvram: extract code copying NVRAM
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This simplifies function finding NVRAM. It doesn't directly deal with
|
||||
NVRAM structure anymore and is a bit smaller.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
|
||||
---
|
||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 43 +++++++++++++----------
|
||||
1 file changed, 25 insertions(+), 18 deletions(-)
|
||||
|
||||
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
@@ -55,11 +55,34 @@ static u32 find_nvram_size(void __iomem
|
||||
}
|
||||
|
||||
/**
|
||||
+ * bcm47xx_nvram_copy - copy NVRAM to internal buffer
|
||||
+ */
|
||||
+static void bcm47xx_nvram_copy(void __iomem *nvram_start, size_t res_size)
|
||||
+{
|
||||
+ struct nvram_header __iomem *header = nvram_start;
|
||||
+ size_t copy_size;
|
||||
+
|
||||
+ copy_size = header->len;
|
||||
+ if (copy_size > res_size) {
|
||||
+ pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n");
|
||||
+ copy_size = res_size;
|
||||
+ }
|
||||
+ if (copy_size >= NVRAM_SPACE) {
|
||||
+ pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
|
||||
+ copy_size, NVRAM_SPACE - 1);
|
||||
+ copy_size = NVRAM_SPACE - 1;
|
||||
+ }
|
||||
+
|
||||
+ __ioread32_copy(nvram_buf, nvram_start, DIV_ROUND_UP(copy_size, 4));
|
||||
+ nvram_buf[NVRAM_SPACE - 1] = '\0';
|
||||
+ nvram_len = copy_size;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it
|
||||
*/
|
||||
static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t res_size)
|
||||
{
|
||||
- struct nvram_header __iomem *header;
|
||||
size_t flash_size;
|
||||
size_t offset;
|
||||
u32 size;
|
||||
@@ -95,23 +118,7 @@ static int bcm47xx_nvram_find_and_copy(v
|
||||
return -ENXIO;
|
||||
|
||||
found:
|
||||
- header = (struct nvram_header *)(flash_start + offset);
|
||||
- __ioread32_copy(nvram_buf, header, sizeof(*header) / 4);
|
||||
- nvram_len = ((struct nvram_header *)(nvram_buf))->len;
|
||||
- size = res_size - offset;
|
||||
- if (nvram_len > size) {
|
||||
- pr_err("The nvram size according to the header seems to be bigger than the partition on flash\n");
|
||||
- nvram_len = size;
|
||||
- }
|
||||
- if (nvram_len >= NVRAM_SPACE) {
|
||||
- pr_err("nvram on flash (%zu bytes) is bigger than the reserved space in memory, will just copy the first %i bytes\n",
|
||||
- nvram_len, NVRAM_SPACE - 1);
|
||||
- nvram_len = NVRAM_SPACE - 1;
|
||||
- }
|
||||
- /* proceed reading data after header */
|
||||
- __ioread32_copy(nvram_buf + sizeof(*header), header + 1,
|
||||
- DIV_ROUND_UP(nvram_len, 4));
|
||||
- nvram_buf[NVRAM_SPACE - 1] = '\0';
|
||||
+ bcm47xx_nvram_copy(flash_start + offset, res_size - offset);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
From 98b68324f67236e8c9152976535dc1f27fb67ba8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Mar 2021 10:03:19 +0100
|
||||
Subject: [PATCH] firmware: bcm47xx_nvram: look for NVRAM with for instead of
|
||||
while
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This loop requires variable initialization, stop condition and post
|
||||
iteration increment. It's pretty much a for loop definition.
|
||||
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
|
||||
---
|
||||
drivers/firmware/broadcom/bcm47xx_nvram.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
|
||||
@@ -93,15 +93,13 @@ static int bcm47xx_nvram_find_and_copy(v
|
||||
}
|
||||
|
||||
/* TODO: when nvram is on nand flash check for bad blocks first. */
|
||||
- flash_size = FLASH_MIN;
|
||||
- while (flash_size <= res_size) {
|
||||
+ for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) {
|
||||
/* Windowed flash access */
|
||||
size = find_nvram_size(flash_start + flash_size);
|
||||
if (size) {
|
||||
offset = flash_size - size;
|
||||
goto found;
|
||||
}
|
||||
- flash_size <<= 1;
|
||||
}
|
||||
|
||||
/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user