From 40c2cd8bd0f7e7b6553d47c11dacb48acc533863 Mon Sep 17 00:00:00 2001 From: Tiago Gaspar Date: Thu, 23 Jun 2022 14:15:06 +0100 Subject: [PATCH 01/31] ath10k: enable encapsulation offload by default Enable ath10k offload by default. This improves wireless performance without requiring user configuration. This adds ath10k_core to the AUTOLOAD section so that the frame_mode paramter can be added to /etc/modules.d and passed to the driver. The frame_mode 2 enables ethernet mode on the firmware/driver. This parameter is set by passing a different value to the frame_mode value on kmod insmod. Link to the original patchset: https://patchwork.kernel.org/project/linux-wireless/cover/20220516032519.29831-1-ryazanov.s.a@gmail.com/ Signed-off-by: Tiago Gaspar --- package/kernel/mac80211/ath.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 50b1eed9c8..9af8c4665d 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -260,7 +260,8 @@ define KernelPackage/ath10k FILES:= \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \ $(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko - AUTOLOAD:=$(call AutoProbe,ath10k_pci) + AUTOLOAD:=$(call AutoProbe,ath10k_core ath10k_pci) + MODPARAMS.ath10k_core:=frame_mode=2 VARIANT:=regular endef From 6445415809ba8cb9863f513efd56b0a77f5fdd6d Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Mon, 27 Jun 2022 21:24:24 +0200 Subject: [PATCH 02/31] firmware-utils: bump to git HEAD The support-list partition for the EAP225-V3 board ID became larger than the allocated size, resulting in factory image generation for the EAP225-Outdoor v3 and EAP225 v3 to fail. The make directive Build/tplink-safeloader ignores this failure however, resulting in a seemingly successful build with empty factory images. Included changes: e609c5d75186 tplink-safeloader: drop unqualified EAP225-V3 IDs Signed-off-by: Sander Vanheule --- tools/firmware-utils/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 1a1f6e1c4f..7dc406e755 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -12,8 +12,8 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git PKG_SOURCE_DATE:=2022-04-25 -PKG_SOURCE_VERSION:=1e3d47292b2efbe2665072fa8322f44bd063be39 -PKG_MIRROR_HASH:=b1f8e89df4265fa65680a6e10bdd228aaa3dc736b0ee48e12c2debce6ab87c1b +PKG_SOURCE_VERSION:=e609c5d751868ae823c236332c76ce3c50acdd2e +PKG_MIRROR_HASH:=f1a5af565bff50ccc99471a2be71636ed685dd15bfb9b162be9acf8ee28033a6 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk From 7bf73e270e7f1704b21860712820dcf12b593e91 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Mon, 27 Jun 2022 20:36:32 +0200 Subject: [PATCH 03/31] kernel: backport RTL8211F clkout-disable patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In Linux v5.14 an extra feature was introduced for the RTL8211F phy, allowing to disable a clock output from the phy. Part of that patch is to always (soft) reset the phy upon initialisation. This phy reset is required to have a working ethernet on the TP-Link EAP225-Outdoor v3 and EAP225 v4 after a reboot. Otherwise the ethernet port will only function properly on cold boots. Tested-by: Andre Klärner # EAP225-Outdoor v3 Tested-by: Sven Hauer # EAP225 v4 Signed-off-by: Sander Vanheule --- ...add-dt-property-to-disable-CLKOUT-cl.patch | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 target/linux/generic/backport-5.10/796-v5.14-net-phy-realtek-add-dt-property-to-disable-CLKOUT-cl.patch diff --git a/target/linux/generic/backport-5.10/796-v5.14-net-phy-realtek-add-dt-property-to-disable-CLKOUT-cl.patch b/target/linux/generic/backport-5.10/796-v5.14-net-phy-realtek-add-dt-property-to-disable-CLKOUT-cl.patch new file mode 100644 index 0000000000..52a6f83500 --- /dev/null +++ b/target/linux/generic/backport-5.10/796-v5.14-net-phy-realtek-add-dt-property-to-disable-CLKOUT-cl.patch @@ -0,0 +1,119 @@ +From 0a4355c2b7f8ecd5e61cc262ecdbd4a2cce1ea7e Mon Sep 17 00:00:00 2001 +From: Joakim Zhang +Date: Tue, 8 Jun 2021 11:15:33 +0800 +Subject: [PATCH] net: phy: realtek: add dt property to disable CLKOUT clock + +CLKOUT is enabled by default after PHY hardware reset, this patch adds +"realtek,clkout-disable" property for user to disable CLKOUT clock +to save PHY power. + +Per RTL8211F guide, a PHY reset should be issued after setting these +bits in PHYCR2 register. After this patch, CLKOUT clock output to be +disabled. + +Signed-off-by: Joakim Zhang +Signed-off-by: David S. Miller +--- + drivers/net/phy/realtek.c | 42 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 41 insertions(+), 1 deletion(-) + +--- a/drivers/net/phy/realtek.c ++++ b/drivers/net/phy/realtek.c +@@ -8,6 +8,7 @@ + * Copyright (c) 2004 Freescale Semiconductor, Inc. + */ + #include ++#include + #include + #include + #include +@@ -27,6 +28,7 @@ + #define RTL821x_PAGE_SELECT 0x1f + + #define RTL8211F_PHYCR1 0x18 ++#define RTL8211F_PHYCR2 0x19 + #define RTL8211F_INSR 0x1d + + #define RTL8211F_TX_DELAY BIT(8) +@@ -40,6 +42,8 @@ + #define RTL8211E_TX_DELAY BIT(12) + #define RTL8211E_RX_DELAY BIT(11) + ++#define RTL8211F_CLKOUT_EN BIT(0) ++ + #define RTL8201F_ISR 0x1e + #define RTL8201F_IER 0x13 + +@@ -62,6 +66,10 @@ MODULE_DESCRIPTION("Realtek PHY driver") + MODULE_AUTHOR("Johnson Leung"); + MODULE_LICENSE("GPL"); + ++struct rtl821x_priv { ++ u16 phycr2; ++}; ++ + static int rtl821x_read_page(struct phy_device *phydev) + { + return __phy_read(phydev, RTL821x_PAGE_SELECT); +@@ -72,6 +80,28 @@ static int rtl821x_write_page(struct phy + return __phy_write(phydev, RTL821x_PAGE_SELECT, page); + } + ++static int rtl821x_probe(struct phy_device *phydev) ++{ ++ struct device *dev = &phydev->mdio.dev; ++ struct rtl821x_priv *priv; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->phycr2 = phy_read_paged(phydev, 0xa43, RTL8211F_PHYCR2); ++ if (priv->phycr2 < 0) ++ return priv->phycr2; ++ ++ priv->phycr2 &= RTL8211F_CLKOUT_EN; ++ if (of_property_read_bool(dev->of_node, "realtek,clkout-disable")) ++ priv->phycr2 &= ~RTL8211F_CLKOUT_EN; ++ ++ phydev->priv = priv; ++ ++ return 0; ++} ++ + static int rtl8201_ack_interrupt(struct phy_device *phydev) + { + int err; +@@ -180,6 +210,7 @@ static int rtl8211c_config_init(struct p + + static int rtl8211f_config_init(struct phy_device *phydev) + { ++ struct rtl821x_priv *priv = phydev->priv; + struct device *dev = &phydev->mdio.dev; + u16 val_txdly, val_rxdly; + u16 val; +@@ -243,7 +274,15 @@ static int rtl8211f_config_init(struct p + val_rxdly ? "enabled" : "disabled"); + } + +- return 0; ++ ret = phy_modify_paged(phydev, 0xa43, RTL8211F_PHYCR2, ++ RTL8211F_CLKOUT_EN, priv->phycr2); ++ if (ret < 0) { ++ dev_err(dev, "clkout configuration failed: %pe\n", ++ ERR_PTR(ret)); ++ return ret; ++ } ++ ++ return genphy_soft_reset(phydev); + } + + static int rtl821x_resume(struct phy_device *phydev) +@@ -633,6 +672,7 @@ static struct phy_driver realtek_drvs[] + }, { + PHY_ID_MATCH_EXACT(0x001cc916), + .name = "RTL8211F Gigabit Ethernet", ++ .probe = rtl821x_probe, + .config_init = &rtl8211f_config_init, + .ack_interrupt = &rtl8211f_ack_interrupt, + .config_intr = &rtl8211f_config_intr, From 48c321082c25f8312d3839e1df6d30822dc13fae Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 20 Jun 2022 19:23:18 +0300 Subject: [PATCH 04/31] hostapd: add config symbol to enable MBO Multi Band Operation aka Agile Multiband introduces new Transition and Transition Rejection Reason Codes that should improve client steering. Add a config symbol to enable it, and enable it by default for the full variants. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- package/network/services/hostapd/Config.in | 14 ++++++++++++++ package/network/services/hostapd/Makefile | 1 + 2 files changed, 15 insertions(+) diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index 5c00f3e24e..e22bbff83a 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -87,3 +87,17 @@ config WPA_ENABLE_WEP for anything anymore. The functionality needed to use WEP is available in the current hostapd release under this optional build parameter and completely removed in a future release. + +config WPA_MBO_SUPPORT + bool "Multi Band Operation (Agile Multiband)" + default PACKAGE_wpa-supplicant || \ + PACKAGE_wpa-supplicant-openssl || \ + PACKAGE_wpa-supplicant-wolfssl || \ + PACKAGE_wpad || \ + PACKAGE_wpad-openssl || \ + PACKAGE_wpad-wolfssl + help + Multi Band Operation aka (Agile Multiband) enables features + that facilitate efficient use of multiple frequency bands. + Enabling MBO on an AP using RSN requires 802.11w to be enabled. + Hostapd will refuse to start if MBO and RSN are enabled without 11w. diff --git a/package/network/services/hostapd/Makefile b/package/network/services/hostapd/Makefile index a3274c8d4d..c69d2a826b 100644 --- a/package/network/services/hostapd/Makefile +++ b/package/network/services/hostapd/Makefile @@ -91,6 +91,7 @@ DRIVER_MAKEOPTS= \ CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \ CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \ CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \ + CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT) ifeq ($(SSL_VARIANT),openssl) DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y From eaad8dfc2291f43b494dd2bb892b71466eeebb61 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 20 Jun 2022 19:25:22 +0300 Subject: [PATCH 05/31] hostapd: enable MBO if 802.11ax is enabled Multi Band Operation is required for 802.11ax certification, so let's enable it if 802.11ax support is enabled. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- package/network/services/hostapd/Config.in | 1 + 1 file changed, 1 insertion(+) diff --git a/package/network/services/hostapd/Config.in b/package/network/services/hostapd/Config.in index e22bbff83a..4cfcaafade 100644 --- a/package/network/services/hostapd/Config.in +++ b/package/network/services/hostapd/Config.in @@ -78,6 +78,7 @@ config DRIVER_11AC_SUPPORT config DRIVER_11AX_SUPPORT bool default n + select WPA_MBO_SUPPORT config WPA_ENABLE_WEP bool "Enable support for unsecure and obsolete WEP" From 6eee9836565cab127e084763cdae6e54284a3a3b Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 6 Jun 2022 16:54:00 +0300 Subject: [PATCH 06/31] hostapd: introduce mbo option Introduce a new option mbo to toggle Multi Band Operation aka Agile Multiband for a BSS. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- package/network/services/hostapd/files/hostapd.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index fa344bd2dd..be3993d4bd 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -304,7 +304,7 @@ hostapd_common_add_bss_config() { config_add_string wps_device_type wps_device_name wps_manufacturer wps_pin config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key - config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition + config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition mbo config_add_int time_advertisement config_add_string time_zone config_add_string vendor_elements @@ -825,11 +825,17 @@ hostapd_set_bss_options() { append bss_conf "iapp_interface=$ifname" "$N" } - json_get_vars time_advertisement time_zone wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition + json_get_vars time_advertisement time_zone wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition mbo set_default bss_transition 0 set_default wnm_sleep_mode 0 set_default wnm_sleep_mode_no_keys 0 + if [ "$enable_ax" -eq 1 ]; then + set_default mbo 1 + else + set_default mbo 0 + fi + [ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N" [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N" if [ "$wnm_sleep_mode" -eq "1" ]; then @@ -837,6 +843,7 @@ hostapd_set_bss_options() { [ "$wnm_sleep_mode_no_keys" -eq "1" ] && append bss_conf "wnm_sleep_mode_no_keys=1" "$N" fi [ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N" + [ "$mbo" -eq 1 ] && append bss_conf "mbo=1" "$N" json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report set_default ieee80211k 0 From 5c57f9bbea662e21cb2c7e8211ee5dbcc88700e2 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 3 Jun 2022 11:22:50 +0300 Subject: [PATCH 07/31] hostapd: support MBO in bss_transition_request Support the use of MBO in the bss_transition_request ubus method. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- package/network/services/hostapd/README.md | 3 + .../services/hostapd/src/src/ap/ubus.c | 61 ++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/package/network/services/hostapd/README.md b/package/network/services/hostapd/README.md index bd347c61dd..2150863306 100644 --- a/package/network/services/hostapd/README.md +++ b/package/network/services/hostapd/README.md @@ -29,6 +29,9 @@ Initiate an 802.11v transition request. | neighbors | array | no | BSS Transition Candidate List | | abridged | bool | no | prefer APs in the BSS Transition Candidate List | | dialog_token | int32 | no | identifier for the request/report transaction | +| mbo_reason | int32 | no | MBO Transition Reason Code Attribute | +| cell_pref | int32 | no | MBO Cellular Data Connection Preference Attribute | +| reassoc_delay | int32 | no | MBO Re-association retry delay | ### example `ubus call hostapd.wl5-fb bss_transition_request '{ "addr": "68:2F:67:8B:98:ED", "disassociation_imminent": false, "disassociation_timer": 0, "validity_period": 30, "neighbors": ["b6a7b9cbeebabf5900008064090603026a00"], "abridged": 1 }'` diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c index 1199098b1e..182aae7d05 100644 --- a/package/network/services/hostapd/src/src/ap/ubus.c +++ b/package/network/services/hostapd/src/src/ap/ubus.c @@ -1454,7 +1454,7 @@ void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *d static int hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged, u16 disassoc_timer, u8 validity_period, u8 dialog_token, - struct blob_attr *neighbors) + struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay) { struct blob_attr *cur; struct sta_info *sta; @@ -1462,6 +1462,8 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, int rem; u8 *nr = NULL; u8 req_mode = 0; + u8 mbo[10]; + size_t mbo_len = 0; sta = ap_get_sta(hapd, addr); if (!sta) @@ -1513,8 +1515,37 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, if (disassoc_imminent) req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT; +#ifdef CONFIG_MBO + u8 *mbo_pos = mbo; + + if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent)) + return UBUS_STATUS_INVALID_ARGUMENT; + + *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON; + *mbo_pos++ = 1; + *mbo_pos++ = mbo_reason; + *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF; + *mbo_pos++ = 1; + *mbo_pos++ = cell_pref; + + if (reassoc_delay) { + *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY; + *mbo_pos++ = 2; + WPA_PUT_LE16(mbo_pos, reassoc_delay); + mbo_pos += 2; + } + + mbo_len = mbo_pos - mbo; +#endif + if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL, - dialog_token, NULL, nr, nr_len, NULL, 0)) + dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len)) return UBUS_STATUS_UNKNOWN_ERROR; return 0; @@ -1528,6 +1559,11 @@ enum { BSS_TR_NEIGHBORS, BSS_TR_ABRIDGED, BSS_TR_DIALOG_TOKEN, +#ifdef CONFIG_MBO + BSS_TR_MBO_REASON, + BSS_TR_CELL_PREF, + BSS_TR_REASSOC_DELAY, +#endif __BSS_TR_DISASSOC_MAX }; @@ -1539,6 +1575,11 @@ static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = { [BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY }, [BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL }, [BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 }, +#ifdef CONFIG_MBO + [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 }, + [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 }, + [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 }, +#endif }; static int @@ -1555,6 +1596,9 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj u32 dialog_token = 1; bool abridged; bool da_imminent; + u8 mbo_reason; + u8 cell_pref; + u8 reassoc_delay; blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg)); @@ -1576,8 +1620,19 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT])); abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED])); +#ifdef CONFIG_MBO + if (tb[BSS_TR_MBO_REASON]) + mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]); + + if (tb[BSS_TR_CELL_PREF]) + cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]); + + if (tb[BSS_TR_REASSOC_DELAY]) + reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]); +#endif + return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period, - dialog_token, tb[BSS_TR_NEIGHBORS]); + dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay); } #endif From f2982bcc890d10f3a501b3a84fe18e99d1af1e2f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 6 Jun 2022 16:36:27 +0300 Subject: [PATCH 08/31] hostapd: introduce background_radar option Introduce a new option background_radar to toggle hostapd's background radar feature. Enabling this allows DFS CAC to run on dedicated radio RF chains while the radio(s) are otherwise running normal AP activities on other channels. As OpenWrt configures hostapd to use a channel list even when a single channel is configured, using this feature requires a list of channels in /etc/config/wireless. Alternatively, channel can be set to auto. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- .../kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 3d0afb261f..3ffe6de66b 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -29,7 +29,7 @@ drv_mac80211_init_device_config() { config_add_string distance config_add_int beacon_int chanbw frag rts config_add_int rxantenna txantenna antenna_gain txpower - config_add_boolean noscan ht_coex acs_exclude_dfs + config_add_boolean noscan ht_coex acs_exclude_dfs background_radar config_add_array ht_capab config_add_array channels config_add_array scan_list @@ -273,6 +273,11 @@ mac80211_hostapd_setup_base() { vht_center_seg0=$idx ;; esac + [ "$band" = "5g" ] && { + json_get_vars background_radar:0 + + [ "$background_radar" -eq 1 ] && append base_cfg "enable_background_radar=1" "$N" + } [ "$band" = "6g" ] && { op_class= case "$htmode" in From d2d5aabdbb947443b0d5f75c3847754c7c38a117 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 27 Jun 2022 17:06:34 +0300 Subject: [PATCH 09/31] hostapd: introduce min_tx_power option Introduce a new option min_tx_power to configure the minimum permitted max TX power (in dBm) for ACS and DFS channel selection. Imagine the following regulatory rules: * 5180 MHz [36] (21.0 dBm) * 5200 MHz [40] (21.0 dBm) * 5220 MHz [44] (21.0 dBm) * 5240 MHz [48] (21.0 dBm) * 5260 MHz [52] (20.0 dBm) (radar detection) * 5280 MHz [56] (20.0 dBm) (radar detection) * 5300 MHz [60] (20.0 dBm) (radar detection) * 5320 MHz [64] (20.0 dBm) (radar detection) * 5500 MHz [100] (21.0 dBm) (radar detection) * 5520 MHz [104] (21.0 dBm) (radar detection) * 5540 MHz [108] (21.0 dBm) (radar detection) * 5560 MHz [112] (21.0 dBm) (radar detection) * 5580 MHz [116] (21.0 dBm) (radar detection) * 5600 MHz [120] (21.0 dBm) (radar detection) * 5620 MHz [124] (21.0 dBm) (radar detection) * 5640 MHz [128] (21.0 dBm) (radar detection) * 5660 MHz [132] (21.0 dBm) (radar detection) * 5680 MHz [136] (21.0 dBm) (radar detection) * 5700 MHz [140] (21.0 dBm) (radar detection) * 5720 MHz [144] (13.0 dBm) (radar detection) * 5745 MHz [149] (13.0 dBm) * 5765 MHz [153] (13.0 dBm) * 5785 MHz [157] (13.0 dBm) * 5805 MHz [161] (13.0 dBm) * 5825 MHz [165] (13.0 dBm) * 5845 MHz [169] (13.0 dBm) * 5865 MHz [173] (13.0 dBm) When ACS or DFS end up selecting channel 144 or higher, some clients might no longer be able to communicate with the AP due to the TX power being limited to 13 dBm. Setting min_tx_power to 20 will result in hostapd not considering these channels during ACS or after a DFS event. Signed-off-by: Stijn Tintel Acked-by: David Bauer --- .../kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 3ffe6de66b..5d6ca7c0e3 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -28,7 +28,7 @@ drv_mac80211_init_device_config() { config_add_string tx_burst config_add_string distance config_add_int beacon_int chanbw frag rts - config_add_int rxantenna txantenna antenna_gain txpower + config_add_int rxantenna txantenna antenna_gain txpower min_tx_power config_add_boolean noscan ht_coex acs_exclude_dfs background_radar config_add_array ht_capab config_add_array channels @@ -137,13 +137,15 @@ mac80211_hostapd_setup_base() { [ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=1" "$N" - json_get_vars noscan ht_coex + json_get_vars noscan ht_coex min_tx_power:0 json_get_values ht_capab_list ht_capab tx_burst json_get_values channel_list channels [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ channel_list="$channel" + [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" + set_default noscan 0 [ "$noscan" -gt 0 ] && hostapd_noscan=1 From 7e21ce8e2b0b73f145af96958511f761544942d7 Mon Sep 17 00:00:00 2001 From: Sven Hauer Date: Mon, 27 Jun 2022 22:25:12 +0200 Subject: [PATCH 10/31] ath79: support for TP-Link EAP225 v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This model is almost identical to the EAP225 v3. Major difference is the RTL8211FS PHY Chipset. Device specifications: * SoC: QCA9563 @ 775MHz * RAM: 128MiB DDR2 * Flash: 16MiB SPI-NOR * Wireless 2.4GHz (SoC): b/g/n, 3x3 * Wireless 5Ghz (QCA9886): a/n/ac, 2x2 MU-MIMO * Ethernet (RTL8211FS): 1× 1GbE, 802.3at PoE Flashing instructions: * ssh into target device and run `cliclientd stopcs` * Upgrade with factory image via web interface Debricking: * Serial port can be soldered on PCB J4 (1: TXD, 2: RXD, 3: GND, 4: VCC) * Bridge unpopulated resistors R225 (TXD) and R237 (RXD). Do NOT bridge R230. * Use 3.3V, 115200 baud, 8n1 * Interrupt bootloader by holding CTRL+B during boot * tftp initramfs to flash via LuCI web interface setenv ipaddr 192.168.1.1 # default, change as required setenv serverip 192.168.1.10 # default, change as required tftp 0x80800000 initramfs.bin bootelf $fileaddr MAC addresses: MAC address (as on device label) is stored in device info partition at an offset of 8 bytes. ath9k device has same address as ethernet, ath10k uses address incremented by 1. Signed-off-by: Sven Hauer --- .../ath79/dts/qca9563_tplink_eap225-v4.dts | 59 +++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 1 + target/linux/ath79/image/generic-tp-link.mk | 11 ++++ 3 files changed, 71 insertions(+) create mode 100644 target/linux/ath79/dts/qca9563_tplink_eap225-v4.dts diff --git a/target/linux/ath79/dts/qca9563_tplink_eap225-v4.dts b/target/linux/ath79/dts/qca9563_tplink_eap225-v4.dts new file mode 100644 index 0000000000..ae27ff7068 --- /dev/null +++ b/target/linux/ath79/dts/qca9563_tplink_eap225-v4.dts @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9563_tplink_eap2x5-1port.dtsi" + +/ { + compatible = "tplink,eap225-v4", "qca,qca9563"; + model = "TP-Link EAP225 v4"; + + aliases { + led-boot = &led_status_green; + led-failsafe = &led_status_amber; + led-running = &led_status_green; + led-upgrade = &led_status_amber; + }; + + leds { + compatible = "gpio-leds"; + + led_status_green: status_green { + label = "green:status"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led_status_amber: status_amber { + label = "amber:status"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&art { + precalibration_ath10k: pre-calibration@5000 { + reg = <0x5000 0x2f20>; + }; +}; + +ð0 { + phy-handle = <&phy6>; + phy-mode = "sgmii"; +}; + +&mdio0 { + phy6: ethernet-phy@6 { + reg = <6>; + }; +}; + +&pcie { + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0 0 0 0 0>; + + mac-address-increment = <1>; + + nvmem-cells = <&macaddr_info_8>, <&precalibration_ath10k>; + nvmem-cell-names = "mac-address", "pre-calibration"; + }; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 42ab19b47a..7ba39c4c49 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -79,6 +79,7 @@ ath79_setup_interfaces() tplink,eap225-outdoor-v3|\ tplink,eap225-v1|\ tplink,eap225-v3|\ + tplink,eap225-v4|\ tplink,eap245-v1|\ tplink,re350k-v1|\ tplink,re355-v1|\ diff --git a/target/linux/ath79/image/generic-tp-link.mk b/target/linux/ath79/image/generic-tp-link.mk index ffe999660a..6d9ba2cd40 100644 --- a/target/linux/ath79/image/generic-tp-link.mk +++ b/target/linux/ath79/image/generic-tp-link.mk @@ -434,6 +434,17 @@ define Device/tplink_eap225-v3 endef TARGET_DEVICES += tplink_eap225-v3 +define Device/tplink_eap225-v4 + $(Device/tplink-eap2x5) + SOC := qca9563 + IMAGE_SIZE := 13824k + DEVICE_MODEL := EAP225 + DEVICE_VARIANT := v4 + DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9888-ct + TPLINK_BOARD_ID := EAP225-V3 +endef +TARGET_DEVICES += tplink_eap225-v4 + define Device/tplink_eap225-wall-v2 $(Device/tplink-eap2x5) SOC := qca9561 From 6556cad99dd9f017d7aadc96faa2c1975cba555f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 28 Jun 2022 22:14:29 +0300 Subject: [PATCH 11/31] hostapd: disable mbo by default Enabling mbo by default on 802.11ax devices breaks for encryption types that do not enable 802.11w by default. Disable mbo by default to fix this. Enabling mbo by default on 802.11ax devices was not explained in the commit message anyway. Fixes: 6eee9836565c ("hostapd: introduce mbo option") Signed-off-by: Stijn Tintel --- package/network/services/hostapd/files/hostapd.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index be3993d4bd..760b3ff792 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -829,12 +829,7 @@ hostapd_set_bss_options() { set_default bss_transition 0 set_default wnm_sleep_mode 0 set_default wnm_sleep_mode_no_keys 0 - - if [ "$enable_ax" -eq 1 ]; then - set_default mbo 1 - else - set_default mbo 0 - fi + set_default mbo 0 [ -n "$time_advertisement" ] && append bss_conf "time_advertisement=$time_advertisement" "$N" [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N" From 2fd66e058b0804b9c561d8d6858363fdf5bd7aea Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Fri, 24 Jun 2022 16:05:16 -0300 Subject: [PATCH 12/31] scripts: add cameo image header generator The cameo header is a 0x40-byte header used by D-Link DGS 1210 switches and Apresia ApresiaLightGS series. cameo-imghdr.py is a clean-room reimplementation of imghdr present in the DGS-1210-28-GPL package. Signed-off-by: Luiz Angelo Daros de Luca [fix board_version argument's help text] Signed-off-by: Sander Vanheule --- scripts/cameo-imghdr.py | 86 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 scripts/cameo-imghdr.py diff --git a/scripts/cameo-imghdr.py b/scripts/cameo-imghdr.py new file mode 100755 index 0000000000..1f8292b90a --- /dev/null +++ b/scripts/cameo-imghdr.py @@ -0,0 +1,86 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022 Luiz Angelo Daros de Luca +# +# Cameo Image header geneator, used by some D-Link DGS-1210 switches +# and APRESIA ApresiaLightGS series +# +import argparse +import pathlib +import socket +import struct + +MODEL_LEN = 20 +SIGNATURE_LEN = 16 +LINUXLOAD_LEN = 10 +BUFSIZE = 4096 + +parser = argparse.ArgumentParser(description='Generate Cameo firmware header.') +parser.add_argument('source_file', type=argparse.FileType('rb')) +parser.add_argument('dest_file', type=argparse.FileType('wb')) +parser.add_argument('model') +parser.add_argument('signature') +parser.add_argument('partition', type=int, choices=range(0,10), + metavar="partition=[0-9]",help="partition id") +parser.add_argument('customer_signature', type=int, choices=range(0,10), + metavar="customer_signature=[0-9]", + help="customer signature") +parser.add_argument('board_version', type=int, choices=range(0,2**32), + metavar="board_version=[0-4294967295]", + help="board version") +parser.add_argument('linux_loadaddr', nargs='?', + help="Kernel start address in 0xFFFFFFFF format") +args = parser.parse_args() + +if len(args.model) > MODEL_LEN: + raise ValueError(f"Model '{args.model}' is greater than {MODEL_LEN} bytes") + +if len(args.signature) > SIGNATURE_LEN: + raise ValueError(f"Signature '{args.signature}' is greater than" + f"{SIGNATURE_LEN} bytes") + +if args.signature == "os": + if args.linux_loadaddr: + if len(args.linux_loadaddr) > LINUXLOAD_LEN: + raise ValueError(f"linux_loadaddr '{args.linux_loadaddr}' is greater" + f"than {LINUXLOAD_LEN} bytes") + if (args.linux_loadaddr[0:2] != "0x"): + raise ValueError(f"linux_loadaddr '{args.linux_loadaddr}' must use" + f"the 0x789ABCDE format") + int(args.linux_loadaddr[2:],16) + else: + raise ValueError(f"linux_loadaddr is required for signature 'os'") +else: + args.linux_loadaddr = "" + +checksum = 0 +size = 0 +while True: + buf = args.source_file.read(BUFSIZE) + if not buf: + break + checksum = sum(iter(buf),checksum) % (1<<32) + size += len(buf) + +args.dest_file.write(struct.pack('!I', checksum)) +args.dest_file.write(struct.pack(f'{MODEL_LEN}s', + args.model.encode("ascii"))) +args.dest_file.write(struct.pack(f'{SIGNATURE_LEN}s', + args.signature.encode("ascii"))) +args.dest_file.write(struct.pack('!B', args.partition)) +args.dest_file.write(struct.pack('!B', 0x40)) # ??? This header size? +args.dest_file.write(struct.pack('!B', 0x00)) # ??? Encrypted? +args.dest_file.write(struct.pack('!B', args.customer_signature)) +args.dest_file.write(struct.pack('!I', args.board_version)) +args.dest_file.write(struct.pack('!I', size)) +args.dest_file.write(struct.pack(f'{LINUXLOAD_LEN}s', + args.linux_loadaddr.encode("ascii"))) +args.dest_file.write(struct.pack('!2x')) + +args.source_file.seek(0) +while True: + buf = args.source_file.read(BUFSIZE) + if not buf: + break + args.dest_file.write(buf) From 1005dc0a64587e954364ff3a64bbb38b2ca371cd Mon Sep 17 00:00:00 2001 From: Luiz Angelo Daros de Luca Date: Thu, 23 Jun 2022 17:50:03 -0300 Subject: [PATCH 13/31] realtek: add DGS-1210-28 factory image DGS-1210 switches support dual image, with each image composed of a kernel and a rootfs partition. For image1, kernel and rootfs are in sequence. The current OpenWrt image (written using a serial console), uses those partitions together as the firmware partition, ignoring the partition division. The current OEM u-boot fails to validate image1 but it will only trigger firmware recovery if both image1 and image2 fail, and it does not switch the boot image in case one of them fails the check. The OEM factory image is composed of concatenated blocks of data, each one prefixed with a 0x40-byte cameo header. A normal OEM firmware will have two of these blocks (kernel, rootfs). The OEM firmware only checks the header before writing unconditionally the data (except the header) to the correspoding partition. The OpenWrt factory image mimics the OEM image by cutting the kernel+rootfs firmware at the exact size of the OEM kernel partition and packing it as "the kernel partition" and the rest of the kernel and the rootfs as "the rootfs partition". It will only work if written to image1 because image2 has a sysinfo partition between kernel2 and rootfs2, cutting the kernel code in the middle. Steps to install: 1) switch to image2 (containing an OEM image), using web or these CLI commands: - config firmware image_id 2 boot_up - reboot 2) flash the factory_image1.bin to image1. OEM web (v6.30.016) is crashing for any upload (ssh keys, firmware), even applying OEM firmwares. These CLI commands can upload a new firmware to the other image location (not used to boot): - download firmware_fromTFTP factory_image1.bin - config firmware image_id 1 boot_up - reboot To debrick the device, you'll need serial access. If you want to recover to an OpenWrt, you can replay the serial installation instructions. For returning to the original firmware, press ESC during the boot to trigger the emergency firmware recovery procedure. After that, use D-Link Network Assistant v2.0.2.4 to flash a new firmware. The device documentation does describe that holding RESET for 12s trigger the firmware recovery. However, the latest shipped U-Boot "2011.12.(2.1.5.67086)-Candidate1" from "Aug 24 2021 - 17:33:09" cannot trigger that from a cold boot. In fact, any U-Boot procedure that relies on the RESET button, like reset settings, will only work if started from a running original firmware. That, in practice, cancels the benefit of having two images and a firmware recovery procedure (if you are not consider dual-booting OpenWrt). Signed-off-by: Luiz Angelo Daros de Luca --- target/linux/realtek/image/Makefile | 18 +++++++++++++++++- target/linux/realtek/image/rtl838x.mk | 8 ++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 026c6e0068..b54a1f0a8d 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -6,7 +6,8 @@ include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR = 0x80000000 KERNEL_ENTRY = 0x80000400 -DEVICE_VARS += ZYXEL_VERS +DEVICE_VARS += ZYXEL_VERS DLINK_KERNEL_PART_SIZE +DEVICE_VARS += CAMEO_KERNEL_PART CAMEO_ROOTFS_PART CAMEO_CUSTOMER_SIGNATURE CAMEO_BOARD_VERSION define Build/zyxel-vers ( echo VERS;\ @@ -16,6 +17,21 @@ define Build/zyxel-vers done ) >> $@ endef +define Build/dlink-headers + dd if=$@ bs=$(DLINK_KERNEL_PART_SIZE) count=1 of=$@.kernel_part; \ + dd if=$@ bs=$(DLINK_KERNEL_PART_SIZE) skip=1 of=$@.rootfs_part; \ + $(SCRIPT_DIR)/cameo-imghdr.py $@.kernel_part $@.kernel_part.hex \ + "$(DEVICE_MODEL)" os $(CAMEO_KERNEL_PART) \ + $(CAMEO_CUSTOMER_SIGNATURE) \ + $(CAMEO_BOARD_VERSION) \ + $(KERNEL_LOADADDR); \ + $(SCRIPT_DIR)/cameo-imghdr.py $@.rootfs_part $@.rootfs_part.hex \ + "$(DEVICE_MODEL)" squashfs $(CAMEO_ROOTFS_PART) \ + $(CAMEO_CUSTOMER_SIGNATURE) \ + $(CAMEO_BOARD_VERSION); \ + cat $@.kernel_part.hex $@.rootfs_part.hex > $@ +endef + define Device/Default PROFILES = Default KERNEL := kernel-bin | append-dtb | gzip | uImage gzip diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index f38e4977d2..c01acd10bc 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -15,6 +15,7 @@ define Device/d-link_dgs-1210 SOC := rtl8382 IMAGE_SIZE := 13824k DEVICE_VENDOR := D-Link + DLINK_KERNEL_PART_SIZE := 1572864 endef define Device/d-link_dgs-1210-10p @@ -39,6 +40,13 @@ TARGET_DEVICES += d-link_dgs-1210-20 define Device/d-link_dgs-1210-28 $(Device/d-link_dgs-1210) DEVICE_MODEL := DGS-1210-28 + CAMEO_KERNEL_PART := 2 + CAMEO_ROOTFS_PART := 3 + CAMEO_CUSTOMER_SIGNATURE := 2 + CAMEO_BOARD_VERSION := 32 + IMAGES += factory_image1.bin + IMAGE/factory_image1.bin := append-kernel | pad-to 64k | \ + append-rootfs | pad-rootfs | pad-to 16 | check-size | dlink-headers endef TARGET_DEVICES += d-link_dgs-1210-28 From f3caba679b812bdaa374929350548025e792eeec Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 29 Jun 2022 00:00:51 +0300 Subject: [PATCH 14/31] kernel: add missing symbol to 5.10 config Kernel 5.10.124 introduced a new symbol 'LIB_MEMNEQ'. Add it to the generic 5.10 config. Fixes: 9e5d743422ed ("kernel: bump 5.10 to 5.10.124") Signed-off-by: Stijn Tintel --- target/linux/generic/config-5.10 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index 4b9958ed41..a08b8c5686 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3058,6 +3058,7 @@ CONFIG_LEDS_TRIGGER_TIMER=y # CONFIG_LIBFCOE is not set # CONFIG_LIBIPW_DEBUG is not set # CONFIG_LIBNVDIMM is not set +CONFIG_LIB_MEMNEQ=y # CONFIG_LIDAR_LITE_V2 is not set CONFIG_LINEAR_RANGES=y # CONFIG_LIQUIDIO is not set From e02406e3cc949deeb3feee26dd6df8502f8c15a2 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 29 Jun 2022 00:08:39 +0300 Subject: [PATCH 15/31] kernel: add missing symbol to 5.15 config Kernel 5.15.49 introduced a new symbol 'LIB_MEMNEQ'. Add it to the generic 5.15 config. Fixes: f1cd14448221 ("kernel: bump 5.15 to 5.15.49") Signed-off-by: Stijn Tintel --- target/linux/generic/config-5.15 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index e0f412252a..15e69f8d01 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -3154,6 +3154,7 @@ CONFIG_LEDS_TRIGGER_TIMER=y # CONFIG_LIBFCOE is not set # CONFIG_LIBIPW_DEBUG is not set # CONFIG_LIBNVDIMM is not set +CONFIG_LIB_MEMNEQ=y # CONFIG_LIDAR_LITE_V2 is not set CONFIG_LINEAR_RANGES=y # CONFIG_LIQUIDIO is not set From 4ab421b81d383c127135716f56a1e18337575516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 14 Jun 2022 15:54:48 +0200 Subject: [PATCH 16/31] qoriq: define leds for Firebox M300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch provides support for the Firebox M300 only user-controllable bi-color LED, and makes the green "shield" LED act as the typical OpenWrt status led. Signed-off-by: Thibaut VARÈNE --- .../boot/dts/fsl/watchguard-firebox-m300.dts | 21 +++++++++++++++++++ target/linux/qoriq/image/generic.mk | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts index 54f7e06bc5..4ba30a3c0f 100644 --- a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts @@ -7,6 +7,8 @@ * Copyright 2020 - 2021 Stijn Tintel */ +#include + /include/ "t208xsi-pre.dtsi" /include/ "t208xqds.dtsi" @@ -31,6 +33,11 @@ ethernet2 = &enet1; ethernet3 = &enet2; ethernet4 = &enet3; + + led-boot = &led_shield; + led-failsafe = &led_shield; + led-running = &led_shield; + led-upgrade = &led_shield; }; }; @@ -325,4 +332,18 @@ status = "disabled"; }; }; + + leds { + compatible = "gpio-leds"; + + shield-red { + label = "red:shield"; + gpios = <&gpio0 28 GPIO_ACTIVE_HIGH>; + }; + + led_shield: shield-green { + label = "green:shield"; + gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>; + }; + }; }; diff --git a/target/linux/qoriq/image/generic.mk b/target/linux/qoriq/image/generic.mk index b8ffc69ba0..b2689850b3 100644 --- a/target/linux/qoriq/image/generic.mk +++ b/target/linux/qoriq/image/generic.mk @@ -6,7 +6,7 @@ define Device/watchguard_firebox-m300 DEVICE_COMPAT_VERSION := 1.1 DEVICE_DTS_DIR := $(DTS_DIR)/fsl DEVICE_PACKAGES := \ - kmod-hwmon-w83793 kmod-ptp-qoriq kmod-rtc-rs5c372a kmod-tpm-i2c-atmel + kmod-hwmon-w83793 kmod-leds-gpio kmod-ptp-qoriq kmod-rtc-rs5c372a kmod-tpm-i2c-atmel KERNEL := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_SUFFIX := -fit-uImage.itb IMAGES := sdcard.img.gz sysupgrade.img.gz From 19231cf83835db563ee7431b502fe1695ef1f559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 14 Jun 2022 15:54:48 +0200 Subject: [PATCH 17/31] qoriq: define reset button for Firebox M300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch provides support for the Firebox M300 reset button. Signed-off-by: Thibaut VARÈNE --- .../powerpc/boot/dts/fsl/watchguard-firebox-m300.dts | 11 +++++++++++ target/linux/qoriq/image/generic.mk | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts index 4ba30a3c0f..15dc5f445e 100644 --- a/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts +++ b/target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts @@ -8,6 +8,7 @@ */ #include +#include /include/ "t208xsi-pre.dtsi" /include/ "t208xqds.dtsi" @@ -333,6 +334,16 @@ }; }; + keys { + compatible = "gpio-keys"; + + reset { + linux,code = ; + gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + leds { compatible = "gpio-leds"; diff --git a/target/linux/qoriq/image/generic.mk b/target/linux/qoriq/image/generic.mk index b2689850b3..d2b60d2296 100644 --- a/target/linux/qoriq/image/generic.mk +++ b/target/linux/qoriq/image/generic.mk @@ -6,7 +6,8 @@ define Device/watchguard_firebox-m300 DEVICE_COMPAT_VERSION := 1.1 DEVICE_DTS_DIR := $(DTS_DIR)/fsl DEVICE_PACKAGES := \ - kmod-hwmon-w83793 kmod-leds-gpio kmod-ptp-qoriq kmod-rtc-rs5c372a kmod-tpm-i2c-atmel + kmod-gpio-button-hotplug kmod-hwmon-w83793 kmod-leds-gpio kmod-ptp-qoriq \ + kmod-rtc-rs5c372a kmod-tpm-i2c-atmel KERNEL := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb KERNEL_SUFFIX := -fit-uImage.itb IMAGES := sdcard.img.gz sysupgrade.img.gz From 5fdbae463c57fa48709d876abaadbbbd5938f84f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 28 Jun 2022 16:40:05 +0200 Subject: [PATCH 18/31] qoriq: 02_network fix sweth globbing logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prevents invalid configuration of non-existent sweth devices. Signed-off-by: Thibaut VARÈNE --- target/linux/qoriq/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/qoriq/base-files/etc/board.d/02_network b/target/linux/qoriq/base-files/etc/board.d/02_network index 35b7ce9f32..355c8d37a4 100644 --- a/target/linux/qoriq/base-files/etc/board.d/02_network +++ b/target/linux/qoriq/base-files/etc/board.d/02_network @@ -21,7 +21,7 @@ watchguard,firebox-m300) sweth_mac_offset=0x186d - for sweth in /sys/class/net/sweth*; do + for sweth in $(find /sys/class/net/ -name 'sweth*' -print); do device="$(basename "$sweth")" mac="$(mtd_get_mac_text wg_cfg0 "$sweth_mac_offset")" switchports="$switchports $device" From 3e1848ee0ff3b01461a9d2f772bde27a4101f3d9 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 29 Jun 2022 00:12:23 +0300 Subject: [PATCH 19/31] qoriq: disable CONFIG_COMPAT We do not need support for 32 bit applications, as we're building everything for 64 bit. Signed-off-by: Stijn Tintel --- target/linux/qoriq/config-5.10 | 8 -------- 1 file changed, 8 deletions(-) diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10 index 43402333c0..a20f00b545 100644 --- a/target/linux/qoriq/config-5.10 +++ b/target/linux/qoriq/config-5.10 @@ -9,7 +9,6 @@ CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y CONFIG_ARCH_MMAP_RND_BITS=18 CONFIG_ARCH_MMAP_RND_BITS_MAX=32 CONFIG_ARCH_MMAP_RND_BITS_MIN=18 -CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17 CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 CONFIG_ARCH_SELECT_MEMORY_MODEL=y @@ -23,18 +22,13 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_PM=y CONFIG_BLK_SCSI_REQUEST=y -CONFIG_BLOCK_COMPAT=y CONFIG_BOOKE=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLK_QORIQ=y CONFIG_CLONE_BACKWARDS=y CONFIG_CLZ_TAB=y CONFIG_COMMON_CLK=y -CONFIG_COMPAT=y # CONFIG_COMPAT_32BIT_TIME is not set -CONFIG_COMPAT_BINFMT_ELF=y -CONFIG_COMPAT_NETLINK_MESSAGES=y -CONFIG_COMPAT_OLD_SIGACTION=y CONFIG_CONSOLE_TRANSLATIONS=y CONFIG_CORENET_GENERIC=y # CONFIG_CPUFREQ_DT is not set @@ -360,7 +354,6 @@ CONFIG_SRCU=y CONFIG_SWIOTLB=y CONFIG_SWPHY=y CONFIG_SYSCTL_EXCEPTION_TRACE=y -CONFIG_SYSVIPC_COMPAT=y CONFIG_SYS_SUPPORTS_HUGETLBFS=y CONFIG_TARGET_CPU_BOOL=y CONFIG_THERMAL=y @@ -382,7 +375,6 @@ CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_SUPPORT=y CONFIG_USB_UAS=y -CONFIG_VDSO32=y CONFIG_VGA_CONSOLE=y CONFIG_VIRT_CPU_ACCOUNTING=y CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y From 61587c92425ecdcabb82a6c81cff698a23ffb049 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 29 Jun 2022 00:51:41 +0300 Subject: [PATCH 20/31] qoriq: enable HARDENED_USERCOPY The random crashes observed with HARDENED_USERCOPY enabled no longer seem to occur. Enable HARDENED_USERCOPY to improve security. Signed-off-by: Stijn Tintel --- target/linux/qoriq/config-5.10 | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10 index a20f00b545..835a90470a 100644 --- a/target/linux/qoriq/config-5.10 +++ b/target/linux/qoriq/config-5.10 @@ -163,7 +163,6 @@ CONFIG_GPIO_GENERIC=y CONFIG_GPIO_MPC8XXX=y CONFIG_GRO_CELLS=y # CONFIG_HANGCHECK_TIMER is not set -# CONFIG_HARDENED_USERCOPY is not set CONFIG_HAS_DMA=y CONFIG_HAS_IOMEM=y CONFIG_HAS_IOPORT_MAP=y From a5796a4db3d3b3bcb702988f6361ff17398993e1 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Mon, 28 Mar 2022 16:45:52 +0300 Subject: [PATCH 21/31] qoriq: add kernel 5.15 support Add support for kernel 5.15 as testing kernel for qoriq. Signed-off-by: Stijn Tintel --- target/linux/qoriq/Makefile | 1 + target/linux/qoriq/config-5.15 | 402 +++++++++++++++++++++++++++++++++ 2 files changed, 403 insertions(+) create mode 100644 target/linux/qoriq/config-5.15 diff --git a/target/linux/qoriq/Makefile b/target/linux/qoriq/Makefile index 2dc08afd8c..d6a84634e2 100644 --- a/target/linux/qoriq/Makefile +++ b/target/linux/qoriq/Makefile @@ -12,6 +12,7 @@ FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk root-part rtc sourc SUBTARGETS:=generic KERNEL_PATCHVER:=5.10 +KERNEL_TESTING_PATCHVER:=5.15 KERNELNAME:=zImage diff --git a/target/linux/qoriq/config-5.15 b/target/linux/qoriq/config-5.15 new file mode 100644 index 0000000000..258ac11aa2 --- /dev/null +++ b/target/linux/qoriq/config-5.15 @@ -0,0 +1,402 @@ +CONFIG_64BIT=y +CONFIG_ALTIVEC=y +CONFIG_ARCH_DMA_ADDR_T_64BIT=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_KEEP_MEMBLOCK=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y +CONFIG_ARCH_MMAP_RND_BITS=18 +CONFIG_ARCH_MMAP_RND_BITS_MAX=32 +CONFIG_ARCH_MMAP_RND_BITS_MIN=18 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17 +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11 +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_STACKWALK=y +CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y +CONFIG_ASN1=y +CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y +CONFIG_AUDIT_ARCH=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_PM=y +CONFIG_BOOKE=y +CONFIG_CLK_QORIQ=y +CONFIG_CLONE_BACKWARDS=y +CONFIG_CLZ_TAB=y +CONFIG_COMMON_CLK=y +# CONFIG_COMPAT_32BIT_TIME is not set +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_CORENET_GENERIC=y +# CONFIG_CPUFREQ_DT is not set +CONFIG_CPU_BIG_ENDIAN=y +CONFIG_CPU_FREQ=y +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL=y +CONFIG_CPU_FREQ_GOV_ATTR_SET=y +CONFIG_CPU_FREQ_GOV_COMMON=y +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_POWERSAVE=y +CONFIG_CPU_FREQ_GOV_SCHEDUTIL=y +CONFIG_CPU_FREQ_GOV_USERSPACE=y +# CONFIG_CPU_FREQ_STAT is not set +CONFIG_CPU_IDLE=y +CONFIG_CPU_IDLE_GOV_TEO=y +CONFIG_CPU_ISOLATION=y +CONFIG_CPU_RMAP=y +CONFIG_CRC16=y +CONFIG_CRYPTO_AUTHENC=y +CONFIG_CRYPTO_CRC32=y +CONFIG_CRYPTO_CRC32C=y +# CONFIG_CRYPTO_CRC32C_VPMSUM is not set +CONFIG_CRYPTO_DES=y +CONFIG_CRYPTO_DEV_FSL_CAAM=y +CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC=y +CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=y +CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=y +CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI=y +# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set +# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set +CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y +CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y +CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 +CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y +# CONFIG_CRYPTO_DEV_NX is not set +CONFIG_CRYPTO_ECB=y +CONFIG_CRYPTO_ENGINE=y +CONFIG_CRYPTO_HW=y +CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y +CONFIG_CRYPTO_LIB_DES=y +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 +# CONFIG_CRYPTO_MD5_PPC is not set +CONFIG_CRYPTO_RNG=y +CONFIG_CRYPTO_RNG2=y +CONFIG_CRYPTO_RSA=y +# CONFIG_CRYPTO_SHA1_PPC is not set +CONFIG_CRYPTO_XTS=y +CONFIG_DATA_SHIFT=12 +CONFIG_DEBUG_INFO=y +# CONFIG_DEBUG_INFO_REDUCED is not set +CONFIG_DEFAULT_UIMAGE=y +CONFIG_DMADEVICES=y +CONFIG_DMA_ENGINE=y +CONFIG_DMA_OF=y +CONFIG_DMA_OPS=y +CONFIG_DMA_OPS_BYPASS=y +CONFIG_DPAA_ERRATUM_A050385=y +CONFIG_DTC=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_DYNAMIC_DEBUG=y +CONFIG_E500=y +# CONFIG_E5500_CPU is not set +CONFIG_E6500_CPU=y +CONFIG_EARLY_PRINTK=y +CONFIG_EDAC=y +CONFIG_EDAC_ATOMIC_SCRUB=y +# CONFIG_EDAC_CPC925 is not set +# CONFIG_EDAC_DEBUG is not set +CONFIG_EDAC_LEGACY_SYSFS=y +CONFIG_EDAC_MPC85XX=y +CONFIG_EDAC_SUPPORT=y +CONFIG_EPAPR_PARAVIRT=y +CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_F2FS_FS=y +CONFIG_FIXED_PHY=y +CONFIG_FORCE_MAX_ZONEORDER=13 +# CONFIG_FSL_BMAN_TEST is not set +CONFIG_FSL_CORENET_CF=y +CONFIG_FSL_CORENET_RCPM=y +CONFIG_FSL_DMA=y +CONFIG_FSL_DPAA=y +# CONFIG_FSL_DPAA2_SWITCH is not set +# CONFIG_FSL_DPAA_CHECKING is not set +CONFIG_FSL_DPAA_ETH=y +CONFIG_FSL_EMB_PERFMON=y +CONFIG_FSL_FMAN=y +CONFIG_FSL_GUTS=y +CONFIG_FSL_IFC=y +CONFIG_FSL_LBC=y +CONFIG_FSL_MPIC_TIMER_WAKEUP=y +CONFIG_FSL_PAMU=y +CONFIG_FSL_PCI=y +# CONFIG_FSL_QMAN_TEST is not set +CONFIG_FSL_SOC=y +CONFIG_FSL_SOC_BOOKE=y +CONFIG_FSL_XGMAC_MDIO=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FS_POSIX_ACL=y +CONFIG_FTL=y +CONFIG_FUNCTION_ERROR_INJECTION=y +CONFIG_FWNODE_MDIO=y +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_BUG_RELATIVE_POINTERS=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_GENERIC_CMOS_UPDATE=y +# CONFIG_GENERIC_CPU is not set +CONFIG_GENERIC_CPU_AUTOPROBE=y +CONFIG_GENERIC_CPU_VULNERABILITIES=y +CONFIG_GENERIC_EARLY_IOREMAP=y +CONFIG_GENERIC_GETTIMEOFDAY=y +CONFIG_GENERIC_IRQ_MIGRATION=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_IRQ_SHOW_LEVEL=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_MSI_IRQ=y +CONFIG_GENERIC_MSI_IRQ_DOMAIN=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_PHY=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GENERIC_TIME_VSYSCALL=y +# CONFIG_GEN_RTC is not set +# CONFIG_GIANFAR is not set +CONFIG_GLOB=y +CONFIG_GPIOLIB=y +CONFIG_GPIO_CDEV=y +CONFIG_GPIO_GENERIC=y +CONFIG_GPIO_MPC8XXX=y +CONFIG_GRO_CELLS=y +# CONFIG_HANGCHECK_TIMER is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HWMON=y +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_I2C=y +CONFIG_I2C_BOARDINFO=y +CONFIG_I2C_MPC=y +CONFIG_ILLEGAL_POINTER_VALUE=0x5deadbeef0000000 +CONFIG_INITRAMFS_SOURCE="" +CONFIG_INPUT=y +CONFIG_IOMMU_API=y +# CONFIG_IOMMU_DEBUGFS is not set +# CONFIG_IOMMU_DEFAULT_DMA_LAZY is not set +CONFIG_IOMMU_DEFAULT_DMA_STRICT=y +# CONFIG_IOMMU_DEFAULT_PASSTHROUGH is not set +CONFIG_IOMMU_HELPER=y +CONFIG_IOMMU_SUPPORT=y +CONFIG_IRQCHIP=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_DOMAIN_HIERARCHY=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_ISA_DMA_API=y +CONFIG_JBD2=y +CONFIG_JUMP_LABEL=y +CONFIG_JUMP_LABEL_FEATURE_CHECKS=y +# CONFIG_JUMP_LABEL_FEATURE_CHECK_DEBUG is not set +CONFIG_KALLSYMS=y +CONFIG_KERNEL_GZIP=y +CONFIG_KERNEL_START=0xc000000000000000 +CONFIG_KPROBES=y +CONFIG_KRETPROBES=y +# CONFIG_LD_HEAD_STUB_CATCH is not set +CONFIG_LIBFDT=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOCK_SPIN_ON_OWNER=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MARVELL_PHY=y +CONFIG_MATH_EMULATION=y +# CONFIG_MATH_EMULATION_FULL is not set +CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y +CONFIG_MDIO_BUS=y +CONFIG_MDIO_DEVICE=y +CONFIG_MDIO_DEVRES=y +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY=y +CONFIG_MIGRATION=y +CONFIG_MMC=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_DEBUG=y +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_IO_ACCESSORS=y +CONFIG_MMC_SDHCI_OF_ESDHC=y +# CONFIG_MMC_SDHCI_PCI is not set +CONFIG_MMC_SDHCI_PLTFM=y +# CONFIG_MMC_WBSD is not set +CONFIG_MMIOWB=y +CONFIG_MMU_GATHER_PAGE_SIZE=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MPIC=y +CONFIG_MPIC_MSGR=y +CONFIG_MPIC_TIMER=y +CONFIG_MPILIB=y +CONFIG_MTD_NAND_CORE=y +CONFIG_MTD_NAND_ECC=y +CONFIG_MTD_NAND_ECC_SW_HAMMING=y +CONFIG_MTD_NAND_FSL_IFC=y +CONFIG_MTD_PHYSMAP=y +CONFIG_MTD_RAW_NAND=y +CONFIG_MUTEX_SPIN_ON_OWNER=y +CONFIG_NEED_DMA_MAP_STATE=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NET_DEVLINK=y +CONFIG_NET_DSA=y +CONFIG_NET_DSA_MV88E6XXX=y +CONFIG_NET_DSA_TAG_DSA=y +CONFIG_NET_DSA_TAG_DSA_COMMON=y +CONFIG_NET_DSA_TAG_EDSA=y +CONFIG_NET_DSA_TAG_OCELOT=y +CONFIG_NET_DSA_TAG_TRAILER=y +CONFIG_NET_FLOW_LIMIT=y +CONFIG_NET_PTP_CLASSIFY=y +CONFIG_NET_SELFTESTS=y +CONFIG_NET_SWITCHDEV=y +CONFIG_NLS=y +CONFIG_NONSTATIC_KERNEL=y +CONFIG_NO_HZ_COMMON=y +CONFIG_NO_HZ_IDLE=y +CONFIG_NR_CPUS=24 +CONFIG_NR_IRQS=512 +CONFIG_OF=y +CONFIG_OF_ADDRESS=y +CONFIG_OF_DMA_DEFAULT_COHERENT=y +CONFIG_OF_EARLY_FLATTREE=y +CONFIG_OF_FLATTREE=y +CONFIG_OF_GPIO=y +CONFIG_OF_IOMMU=y +CONFIG_OF_IRQ=y +CONFIG_OF_KOBJ=y +CONFIG_OF_MDIO=y +CONFIG_OLD_SIGSUSPEND=y +CONFIG_OPTPROBES=y +CONFIG_PACKING=y +CONFIG_PADATA=y +CONFIG_PAGE_OFFSET=0xc000000000000000 +CONFIG_PAHOLE_HAS_SPLIT_BTF=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCI_MSI=y +CONFIG_PCI_MSI_ARCH_FALLBACKS=y +CONFIG_PCI_MSI_IRQ_DOMAIN=y +CONFIG_PGTABLE_LEVELS=4 +CONFIG_PHYLIB=y +CONFIG_PHYLINK=y +CONFIG_PHYSICAL_START=0x00000000 +CONFIG_PHYS_64BIT=y +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_PM=y +# CONFIG_PMU_SYSFS is not set +CONFIG_PM_CLK=y +CONFIG_PPC=y +CONFIG_PPC64=y +CONFIG_PPC_ADV_DEBUG_DACS=2 +CONFIG_PPC_ADV_DEBUG_DVCS=0 +CONFIG_PPC_ADV_DEBUG_IACS=2 +CONFIG_PPC_ADV_DEBUG_REGS=y +CONFIG_PPC_BARRIER_NOSPEC=y +CONFIG_PPC_BOOK3E=y +CONFIG_PPC_BOOK3E_64=y +CONFIG_PPC_BOOK3E_MMU=y +# CONFIG_PPC_BOOK3S_64 is not set +CONFIG_PPC_DAWR=y +CONFIG_PPC_DOORBELL=y +CONFIG_PPC_E500MC=y +# CONFIG_PPC_EARLY_DEBUG is not set +CONFIG_PPC_EPAPR_HV_PIC=y +CONFIG_PPC_FPU=y +CONFIG_PPC_FPU_REGS=y +CONFIG_PPC_FSL_BOOK3E=y +CONFIG_PPC_INDIRECT_PCI=y +# CONFIG_PPC_IRQ_SOFT_MASK_DEBUG is not set +CONFIG_PPC_MMU_NOHASH=y +CONFIG_PPC_MSI_BITMAP=y +CONFIG_PPC_OF_BOOT_TRAMPOLINE=y +CONFIG_PPC_PAGE_SHIFT=12 +# CONFIG_PPC_QEMU_E500 is not set +CONFIG_PPC_QUEUED_SPINLOCKS=y +CONFIG_PPC_SMP_MUXED_IPI=y +CONFIG_PPC_UDBG_16550=y +CONFIG_PPC_WERROR=y +CONFIG_PPS=y +CONFIG_PTE_64BIT=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_PTP_1588_CLOCK_OPTIONAL=y +CONFIG_PTP_1588_CLOCK_QORIQ=y +CONFIG_QORIQ_CPUFREQ=y +CONFIG_QORIQ_THERMAL=y +CONFIG_QUEUED_RWLOCKS=y +CONFIG_QUEUED_SPINLOCKS=y +CONFIG_RAS=y +CONFIG_RATIONAL=y +# CONFIG_RAVE_SP_CORE is not set +CONFIG_REGMAP=y +CONFIG_REGMAP_MMIO=y +CONFIG_RELOCATABLE=y +# CONFIG_RELOCATABLE_TEST is not set +CONFIG_RFS_ACCEL=y +CONFIG_RPS=y +CONFIG_RWSEM_SPIN_ON_OWNER=y +# CONFIG_SCOM_DEBUGFS is not set +CONFIG_SCSI=y +CONFIG_SCSI_COMMON=y +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_FSL=y +CONFIG_SERIAL_8250_NR_UARTS=4 +CONFIG_SERIAL_8250_RUNTIME_UARTS=4 +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_DEV_BUS=y +CONFIG_SERIAL_DEV_CTRL_TTYPORT=y +CONFIG_SERIAL_FSL_LINFLEXUART=y +CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE=y +CONFIG_SERIAL_FSL_LPUART=y +CONFIG_SERIAL_FSL_LPUART_CONSOLE=y +CONFIG_SERIAL_MCTRL_GPIO=y +CONFIG_SG_POOL=y +CONFIG_SLUB_DEBUG=y +CONFIG_SMP=y +CONFIG_SOCK_RX_QUEUE_MAPPING=y +CONFIG_SOC_BUS=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_FSL_ESPI=y +CONFIG_SPI_MASTER=y +CONFIG_SRCU=y +CONFIG_SWIOTLB=y +CONFIG_SWPHY=y +CONFIG_SYSCTL_EXCEPTION_TRACE=y +CONFIG_TARGET_CPU_BOOL=y +CONFIG_THERMAL=y +CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE=y +CONFIG_THERMAL_EMERGENCY_POWEROFF_DELAY_MS=0 +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_OF=y +CONFIG_THREAD_INFO_IN_TASK=y +CONFIG_THREAD_SHIFT=14 +CONFIG_TREE_RCU=y +CONFIG_TREE_SRCU=y +# CONFIG_UACCE is not set +# CONFIG_UCLAMP_TASK is not set +CONFIG_USB=y +CONFIG_USB_COMMON=y +CONFIG_USB_EHCI_FSL=y +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_EHCI_HCD_PLATFORM is not set +CONFIG_USB_STORAGE=y +CONFIG_USB_SUPPORT=y +CONFIG_USB_UAS=y +CONFIG_VGA_CONSOLE=y +CONFIG_VIRT_CPU_ACCOUNTING=y +CONFIG_VIRT_CPU_ACCOUNTING_NATIVE=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_WQ_POWER_EFFICIENT_DEFAULT is not set +CONFIG_XPS=y +CONFIG_ZLIB_DEFLATE=y From 35fec487e30f05c81bd135326a993dad7f861812 Mon Sep 17 00:00:00 2001 From: Etienne Champetier Date: Sun, 26 Jun 2022 04:54:45 +0000 Subject: [PATCH 22/31] iptables: default to ip(6)tables-nft OpenWrt now uses firewall4 (nft) by default, so iptables should also default to nftables backend. When multiple packages provide the same virtual package, opkg pick the first one by alphabetical order, so we rename iptables-legacy to iptables-zz-legacy and add iptables-legacy in PROVIDES. We also need to remove IPTABLES_NFTABLES config as this cause recursive dependencies. Signed-off-by: Etienne Champetier --- package/network/utils/iptables/Makefile | 31 ++++++++++--------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/package/network/utils/iptables/Makefile b/package/network/utils/iptables/Makefile index ea9561b6b9..6546067553 100644 --- a/package/network/utils/iptables/Makefile +++ b/package/network/utils/iptables/Makefile @@ -10,7 +10,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=iptables PKG_VERSION:=1.8.7 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_SOURCE_URL:=https://netfilter.org/projects/iptables/files PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 @@ -50,18 +50,18 @@ $(call Package/iptables/Default) DEPENDS+= +kmod-ipt-core +libip4tc +IPV6:libip6tc +libiptext +IPV6:libiptext6 +libxtables endef -define Package/iptables-legacy +define Package/iptables-zz-legacy $(call Package/iptables/Default) TITLE:=IP firewall administration tool DEPENDS+= +xtables-legacy - PROVIDES:=iptables + PROVIDES:=iptables iptables-legacy ALTERNATIVES:=\ 200:/usr/sbin/iptables:/usr/sbin/xtables-legacy-multi \ 200:/usr/sbin/iptables-restore:/usr/sbin/xtables-legacy-multi \ 200:/usr/sbin/iptables-save:/usr/sbin/xtables-legacy-multi endef -define Package/iptables-legacy/description +define Package/iptables-zz-legacy/description IP firewall administration tool. Matches: @@ -104,7 +104,7 @@ endef define Package/xtables-nft $(call Package/iptables/Default) TITLE:=IP firewall administration tool nft - DEPENDS:=@IPTABLES_NFTABLES +libnftnl +libiptext +IPV6:libiptext6 +libiptext-nft +kmod-nft-compat + DEPENDS:=+libnftnl +libiptext +IPV6:libiptext6 +libiptext-nft +kmod-nft-compat endef define Package/arptables-nft @@ -483,12 +483,12 @@ define Package/iptables-mod-checksum/description iptables extension for the CHECKSUM calculation target endef -define Package/ip6tables-legacy +define Package/ip6tables-zz-legacy $(call Package/iptables/Default) DEPENDS:=@IPV6 +kmod-ip6tables +xtables-legacy CATEGORY:=Network TITLE:=IPv6 firewall administration tool - PROVIDES:=ip6tables + PROVIDES:=ip6tables ip6tables-legacy ALTERNATIVES:=\ 200:/usr/sbin/ip6tables:/usr/sbin/xtables-legacy-multi \ 200:/usr/sbin/ip6tables-restore:/usr/sbin/xtables-legacy-multi \ @@ -575,7 +575,7 @@ define Package/libiptext-nft CATEGORY:=Libraries TITLE:=IPv4/IPv6 firewall - shared libiptext nft library ABI_VERSION:=0 - DEPENDS:=@IPTABLES_NFTABLES +libxtables + DEPENDS:=+libxtables endef define Package/libxtables @@ -594,12 +594,6 @@ define Package/libxtables/config default n help This enable connlabel support in iptables. - - config IPTABLES_NFTABLES - bool "Enable Nftables support" - default y - help - This enable nftables support in iptables. endef TARGET_CPPFLAGS := \ @@ -624,7 +618,6 @@ CONFIGURE_ARGS += \ --with-xtlibdir=/usr/lib/iptables \ --with-xt-lock-name=/var/run/xtables.lock \ $(if $(CONFIG_IPTABLES_CONNLABEL),,--disable-connlabel) \ - $(if $(CONFIG_IPTABLES_NFTABLES),,--disable-nftables) \ $(if $(CONFIG_IPV6),,--disable-ipv6) MAKE_FLAGS := \ @@ -677,7 +670,7 @@ define Package/xtables-legacy/install $(CP) $(PKG_INSTALL_DIR)/usr/sbin/xtables-legacy-multi $(1)/usr/sbin/ endef -define Package/iptables-legacy/install +define Package/iptables-zz-legacy/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables-legacy{,-restore,-save} $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/usr/lib/iptables @@ -708,7 +701,7 @@ define Package/iptables-nft/install $(CP) $(PKG_INSTALL_DIR)/usr/sbin/iptables{,-restore}-translate $(1)/usr/sbin/ endef -define Package/ip6tables-legacy/install +define Package/ip6tables-zz-legacy/install $(INSTALL_DIR) $(1)/usr/sbin $(CP) $(PKG_INSTALL_DIR)/usr/sbin/ip6tables-legacy{,-restore,-save} $(1)/usr/sbin/ endef @@ -771,7 +764,7 @@ $(eval $(call BuildPackage,libiptext)) $(eval $(call BuildPackage,libiptext6)) $(eval $(call BuildPackage,libiptext-nft)) $(eval $(call BuildPackage,xtables-legacy)) -$(eval $(call BuildPackage,iptables-legacy)) +$(eval $(call BuildPackage,iptables-zz-legacy)) $(eval $(call BuildPackage,xtables-nft)) $(eval $(call BuildPackage,arptables-nft)) $(eval $(call BuildPackage,ebtables-nft)) @@ -799,7 +792,7 @@ $(eval $(call BuildPlugin,iptables-mod-nflog,$(IPT_NFLOG-m))) $(eval $(call BuildPlugin,iptables-mod-trace,$(IPT_DEBUG-m))) $(eval $(call BuildPlugin,iptables-mod-nfqueue,$(IPT_NFQUEUE-m))) $(eval $(call BuildPlugin,iptables-mod-checksum,$(IPT_CHECKSUM-m))) -$(eval $(call BuildPackage,ip6tables-legacy)) +$(eval $(call BuildPackage,ip6tables-zz-legacy)) $(eval $(call BuildPackage,ip6tables-nft)) $(eval $(call BuildPlugin,ip6tables-extra,$(IPT_IPV6_EXTRA-m))) $(eval $(call BuildPlugin,ip6tables-mod-nat,$(IPT_NAT6-m))) From 74dd7f9c36cbe4b87bfdfa0d55729d29d148be16 Mon Sep 17 00:00:00 2001 From: Tamas Balogh Date: Mon, 20 Jun 2022 11:02:15 +0200 Subject: [PATCH 23/31] ramips: add support for ASUS RP-AC87 Asus RP-AC87 ac2600 Repeater 2.4GHz 800Mbps 5GHz 1733Mbps Hardware specifications: SoC: MT7621A 2 cores 4 threads @880MHz WiFi2G: MT7615E 2G 4x4 b/g/n Wifi5G: MT7615E 5G 4x4 n/ac DRAM: 128MB DDR3 @1200mhz Flash: 16MB MX25L12805D SPI-NOR LAN/WAN: MT7530 1x1000M MAC addresses as verified by OEM firmware: use address source Lan/W5G *:B0 factory 0x8004 (label) W2G *:B4 factory 0x0 Installation: Asus windows recovery tool: install the Asus firmware restoration utility unplug the router, hold the reset button while powering it on release when the power LED flashes slowly specify a static IP on your computer: IP address: 192.168.1.75 Subnet mask 255.255.255.0 Start the Asus firmware restoration utility, specify the factory image and press upload Do not power off the device after OpenWrt has booted until the LED flashing. TFTP Recovery method: set computer to a static ip, 192.168.1.2 connect computer to the LAN 1 port of the router hold the reset button while powering on the router for a few seconds send firmware image using a tftp client; i.e from linux: $ tftp tftp> binary tftp> connect 192.168.1.1 tftp> put factory.bin tftp> quit Signed-off-by: Tamas Balogh --- .../linux/ramips/dts/mt7621_asus_rp-ac87.dts | 173 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 14 ++ .../mt7621/base-files/etc/board.d/01_leds | 12 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 4 files changed, 200 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_asus_rp-ac87.dts diff --git a/target/linux/ramips/dts/mt7621_asus_rp-ac87.dts b/target/linux/ramips/dts/mt7621_asus_rp-ac87.dts new file mode 100644 index 0000000000..98af875281 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_asus_rp-ac87.dts @@ -0,0 +1,173 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "asus,rp-ac87", "mediatek,mt7621-soc"; + model = "ASUS RP-AC87"; + + aliases { + led-boot = &led_wps; + led-failsafe = &led_wps; + led-running = &led_wps; + led-upgrade = &led_wps; + label-mac-device = &gmac0; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_wps: wps { + label = "green:wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + }; + + rssilow-wlan0 { + label = "green:rssilow-wlan0"; + gpios = <&gpio 42 GPIO_ACTIVE_LOW>; + }; + + rssimedlow-wlan0 { + label = "green:rssimedlow-wlan0"; + gpios = <&gpio 43 GPIO_ACTIVE_LOW>; + }; + + rssimed-wlan0 { + label = "green:rssimed-wlan0"; + gpios = <&gpio 41 GPIO_ACTIVE_LOW>; + }; + + rssihigh-wlan0 { + label = "green:rssihigh-wlan0"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + }; + + rssilow-wlan1 { + label = "green:rssilow-wlan1"; + gpios = <&gpio 45 GPIO_ACTIVE_LOW>; + }; + + rssimedlow-wlan1 { + label = "green:rssimedlow-wlan1"; + gpios = <&gpio 46 GPIO_ACTIVE_LOW>; + }; + + rssimed-wlan1 { + label = "green:rssimed-wlan1"; + gpios = <&gpio 47 GPIO_ACTIVE_LOW>; + }; + + rssihigh-wlan1 { + label = "green:rssihigh-wlan1"; + gpios = <&gpio 48 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_8004: macaddr@8004 { + reg = <0x8004 0x6>; + }; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_8004>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@4 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&xhci { + status = "disabled"; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index b2b6f6b4cd..aa7adeee60 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -175,6 +175,20 @@ define Device/asiarf_ap7621-nv1 endef TARGET_DEVICES += asiarf_ap7621-nv1 +define Device/asus_rp-ac87 + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + DEVICE_VENDOR := ASUS + DEVICE_MODEL := RP-AC87 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | check-size + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ + check-size | append-metadata + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware rssileds +endef +TARGET_DEVICES += asus_rp-ac87 + define Device/asus_rt-ac57u $(Device/dsa-migration) DEVICE_VENDOR := ASUS diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 2cb8fdb557..37207a52d3 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -7,6 +7,18 @@ board=$(board_name) board_config_update case $board in +asus,rp-ac87) + ucidef_set_rssimon "wlan0" "200000" "1" + ucidef_set_rssimon "wlan1" "200000" "1" + ucidef_set_led_rssi "rssilow-wlan0" "RSSILOW" "green:rssilow-wlan0" "wlan0" "1" "100" + ucidef_set_led_rssi "rssimedlow-wlan0" "RSSIMEDLOW" "green:rssimedlow-wlan0" "wlan0" "20" "100" + ucidef_set_led_rssi "rssimed-wlan0" "RSSIMED" "green:rssimed-wlan0" "wlan0" "40" "100" + ucidef_set_led_rssi "rssihigh-wlan0" "RSSIHIGH" "green:rssihigh-wlan0" "wlan0" "70" "100" + ucidef_set_led_rssi "rssilow-wlan1" "RSSILOW" "green:rssilow-wlan1" "wlan1" "1" "100" + ucidef_set_led_rssi "rssimedlow-wlan1" "RSSIMEDLOW" "green:rssimedlow-wlan1" "wlan1" "20" "100" + ucidef_set_led_rssi "rssimed-wlan1" "RSSIMED" "green:rssimed-wlan1" "wlan1" "40" "100" + ucidef_set_led_rssi "rssihigh-wlan1" "RSSIHIGH" "green:rssihigh-wlan1" "wlan1" "70" "100" + ;; asus,rt-n56u-b1) ucidef_set_led_netdev "lan" "LAN link" "blue:lan" "br-lan" ucidef_set_led_netdev "wan" "WAN link" "blue:wan" "wan" diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 0a139e0113..29336bad68 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -9,6 +9,7 @@ ramips_setup_interfaces() case $board in ampedwireless,ally-00x19k|\ + asus,rp-ac87|\ edimax,re23s|\ mikrotik,routerboard-m11g|\ netgear,ex6150|\ From aae3a8a254275f8be5c45d766ac7b5afb82a9fe6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 29 Jun 2022 00:15:36 +0200 Subject: [PATCH 24/31] x86: 64: Add kmod-igc to default packages This adds the igc driver for the Intel 2.5GBit Ethernet chip to the default packages. Fixes: #10064 Signed-off-by: Hauke Mehrtens --- target/linux/x86/image/64.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/x86/image/64.mk b/target/linux/x86/image/64.mk index 3e08497a57..5ec9978b66 100644 --- a/target/linux/x86/image/64.mk +++ b/target/linux/x86/image/64.mk @@ -3,7 +3,7 @@ define Device/generic DEVICE_MODEL := x86/64 DEVICE_PACKAGES += \ kmod-amazon-ena kmod-amd-xgbe kmod-bnx2 kmod-e1000e kmod-e1000 \ - kmod-forcedeth kmod-fs-vfat kmod-igb kmod-ixgbe kmod-r8169 \ + kmod-forcedeth kmod-fs-vfat kmod-igb kmod-igc kmod-ixgbe kmod-r8169 \ kmod-tg3 GRUB2_VARIANT := generic endef From ef69ab7a35a2ef5257aa2f718875b24856947c34 Mon Sep 17 00:00:00 2001 From: John Thomson Date: Tue, 28 Sep 2021 20:51:56 +1000 Subject: [PATCH 25/31] kernel: cut broken SPI_NOR 4K eraseblock LIMIT patch Since 4e0c54bc5bc8 ("kernel: add support for kernel 5.4"), the spi-nor limit 4k erasesize to spi-nor chips below a configured size patch has not functioned as intended. For uniform erasesize SPI-NOR devices, both nor->erase_opcode & mtd->erasesize are used in erase operations. These are set before, and not modified by, this CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT patch. Thus, an SPI-NOR device with CONFIG_MTD_SPI_NOR_USE_4K_SECTORS will always use 4k erasesize (where the device supports it). If this patch was fixed to function as intended, there would be cases where devices change from a 4K to a 64K erasesize. Signed-off-by: John Thomson --- target/linux/generic/config-5.10 | 1 - target/linux/generic/config-5.15 | 1 - ...ort-limiting-4K-sectors-support-base.patch | 71 ------------------- ...ort-limiting-4K-sectors-support-base.patch | 71 ------------------- target/linux/layerscape/armv8_64b/config-5.10 | 1 - target/linux/pistachio/config-5.10 | 1 - target/linux/ramips/mt7620/config-5.10 | 1 - target/linux/ramips/rt305x/config-5.10 | 1 - target/linux/ramips/rt3883/config-5.10 | 1 - 9 files changed, 149 deletions(-) delete mode 100644 target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch delete mode 100644 target/linux/generic/pending-5.15/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index a08b8c5686..2758479519 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3671,7 +3671,6 @@ CONFIG_MTD_ROOTFS_ROOT_DEV=y # CONFIG_MTD_SPI_NAND is not set # CONFIG_MTD_SPI_NOR is not set # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 # CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE is not set CONFIG_MTD_SPLIT=y # CONFIG_MTD_SPLIT_BCM63XX_FW is not set diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15 index 15e69f8d01..bd21e99356 100644 --- a/target/linux/generic/config-5.15 +++ b/target/linux/generic/config-5.15 @@ -3814,7 +3814,6 @@ CONFIG_MTD_ROOTFS_ROOT_DEV=y CONFIG_MTD_SPI_NOR_SWP_DISABLE_ON_VOLATILE=y # CONFIG_MTD_SPI_NOR_SWP_KEEP is not set # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 # CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE is not set CONFIG_MTD_SPLIT=y # CONFIG_MTD_SPLIT_BCM63XX_FW is not set diff --git a/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch deleted file mode 100644 index b79c6bb3de..0000000000 --- a/target/linux/generic/pending-5.10/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Felix Fietkau -Date: Sat, 4 Nov 2017 07:40:23 +0100 -Subject: [PATCH] mtd: spi-nor: support limiting 4K sectors support based on - flash size - -Some devices need 4K sectors to be able to deal with small flash chips. -For instance, w25x05 is 64 KiB in size, and without 4K sectors, the -entire chip is just one erase block. -On bigger flash chip sizes, using 4K sectors can significantly slow down -many operations, including using a writable filesystem. There are several -platforms where it makes sense to use a single kernel on both kinds of -devices. - -To support this properly, allow configuring an upper flash chip size -limit for 4K sectors support. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/Kconfig -+++ b/drivers/mtd/spi-nor/Kconfig -@@ -34,6 +34,17 @@ config MTD_SPI_NOR_USE_4K_SECTORS - Please note that some tools/drivers/filesystems may not work with - 4096 B erase size (e.g. UBIFS requires 15 KiB as a minimum). - -+config MTD_SPI_NOR_USE_4K_SECTORS_LIMIT -+ int "Maximum flash chip size to use 4K sectors on (in KiB)" -+ depends on MTD_SPI_NOR_USE_4K_SECTORS -+ default "4096" -+ help -+ There are many flash chips that support 4K sectors, but are so large -+ that using them significantly slows down writing large amounts of -+ data or using a writable filesystem. -+ Any flash chip larger than the size specified in this option will -+ not use 4K sectors. -+ - source "drivers/mtd/spi-nor/controllers/Kconfig" - - endif # MTD_SPI_NOR ---- a/drivers/mtd/spi-nor/core.c -+++ b/drivers/mtd/spi-nor/core.c -@@ -2801,6 +2801,21 @@ static void spi_nor_info_init_params(str - */ - erase_mask = 0; - i = 0; -+#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS -+ if ((info->flags & SECT_4K_PMC) && (params->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { -+ erase_mask |= BIT(i); -+ spi_nor_set_erase_type(&map->erase_type[i], 4096u, -+ SPINOR_OP_BE_4K_PMC); -+ i++; -+ } else if ((info->flags & SECT_4K) && (params->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { -+ erase_mask |= BIT(i); -+ spi_nor_set_erase_type(&map->erase_type[i], 4096u, -+ SPINOR_OP_BE_4K); -+ i++; -+ } -+#else - if (info->flags & SECT_4K_PMC) { - erase_mask |= BIT(i); - spi_nor_set_erase_type(&map->erase_type[i], 4096u, -@@ -2812,6 +2827,7 @@ static void spi_nor_info_init_params(str - SPINOR_OP_BE_4K); - i++; - } -+#endif - erase_mask |= BIT(i); - spi_nor_set_erase_type(&map->erase_type[i], info->sector_size, - SPINOR_OP_SE); diff --git a/target/linux/generic/pending-5.15/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch b/target/linux/generic/pending-5.15/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch deleted file mode 100644 index 1649a55c4f..0000000000 --- a/target/linux/generic/pending-5.15/470-mtd-spi-nor-support-limiting-4K-sectors-support-base.patch +++ /dev/null @@ -1,71 +0,0 @@ -From: Felix Fietkau -Date: Sat, 4 Nov 2017 07:40:23 +0100 -Subject: [PATCH] mtd: spi-nor: support limiting 4K sectors support based on - flash size - -Some devices need 4K sectors to be able to deal with small flash chips. -For instance, w25x05 is 64 KiB in size, and without 4K sectors, the -entire chip is just one erase block. -On bigger flash chip sizes, using 4K sectors can significantly slow down -many operations, including using a writable filesystem. There are several -platforms where it makes sense to use a single kernel on both kinds of -devices. - -To support this properly, allow configuring an upper flash chip size -limit for 4K sectors support. - -Signed-off-by: Felix Fietkau ---- - ---- a/drivers/mtd/spi-nor/Kconfig -+++ b/drivers/mtd/spi-nor/Kconfig -@@ -78,6 +78,17 @@ config MTD_SPI_NOR_SWP_KEEP - - endchoice - -+config MTD_SPI_NOR_USE_4K_SECTORS_LIMIT -+ int "Maximum flash chip size to use 4K sectors on (in KiB)" -+ depends on MTD_SPI_NOR_USE_4K_SECTORS -+ default "4096" -+ help -+ There are many flash chips that support 4K sectors, but are so large -+ that using them significantly slows down writing large amounts of -+ data or using a writable filesystem. -+ Any flash chip larger than the size specified in this option will -+ not use 4K sectors. -+ - source "drivers/mtd/spi-nor/controllers/Kconfig" - - endif # MTD_SPI_NOR ---- a/drivers/mtd/spi-nor/core.c -+++ b/drivers/mtd/spi-nor/core.c -@@ -2640,6 +2640,21 @@ static void spi_nor_info_init_params(str - */ - erase_mask = 0; - i = 0; -+#ifdef CONFIG_MTD_SPI_NOR_USE_4K_SECTORS -+ if ((info->flags & SECT_4K_PMC) && (params->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { -+ erase_mask |= BIT(i); -+ spi_nor_set_erase_type(&map->erase_type[i], 4096u, -+ SPINOR_OP_BE_4K_PMC); -+ i++; -+ } else if ((info->flags & SECT_4K) && (params->size <= -+ CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT * 1024)) { -+ erase_mask |= BIT(i); -+ spi_nor_set_erase_type(&map->erase_type[i], 4096u, -+ SPINOR_OP_BE_4K); -+ i++; -+ } -+#else - if (info->flags & SECT_4K_PMC) { - erase_mask |= BIT(i); - spi_nor_set_erase_type(&map->erase_type[i], 4096u, -@@ -2651,6 +2666,7 @@ static void spi_nor_info_init_params(str - SPINOR_OP_BE_4K); - i++; - } -+#endif - erase_mask |= BIT(i); - spi_nor_set_erase_type(&map->erase_type[i], info->sector_size, - SPINOR_OP_SE); diff --git a/target/linux/layerscape/armv8_64b/config-5.10 b/target/linux/layerscape/armv8_64b/config-5.10 index 149884a5f6..0f46d1cde9 100644 --- a/target/linux/layerscape/armv8_64b/config-5.10 +++ b/target/linux/layerscape/armv8_64b/config-5.10 @@ -511,7 +511,6 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384 CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y CONFIG_MTD_SST25L=y diff --git a/target/linux/pistachio/config-5.10 b/target/linux/pistachio/config-5.10 index d62c5e9021..9e43b64b0b 100644 --- a/target/linux/pistachio/config-5.10 +++ b/target/linux/pistachio/config-5.10 @@ -178,7 +178,6 @@ CONFIG_MTD_NAND_CORE=y CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384 CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y diff --git a/target/linux/ramips/mt7620/config-5.10 b/target/linux/ramips/mt7620/config-5.10 index bb7e50da5d..8fae1adc37 100644 --- a/target/linux/ramips/mt7620/config-5.10 +++ b/target/linux/ramips/mt7620/config-5.10 @@ -116,7 +116,6 @@ CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384 CONFIG_MTD_SPLIT_JIMAGE_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_TPLINK_FW=y diff --git a/target/linux/ramips/rt305x/config-5.10 b/target/linux/ramips/rt305x/config-5.10 index c3c4cf6b0d..b41ddb22ac 100644 --- a/target/linux/ramips/rt305x/config-5.10 +++ b/target/linux/ramips/rt305x/config-5.10 @@ -106,7 +106,6 @@ CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384 CONFIG_MTD_SPLIT_JIMAGE_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y diff --git a/target/linux/ramips/rt3883/config-5.10 b/target/linux/ramips/rt3883/config-5.10 index cb1db1ab82..b59ad98b60 100644 --- a/target/linux/ramips/rt3883/config-5.10 +++ b/target/linux/ramips/rt3883/config-5.10 @@ -104,7 +104,6 @@ CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y -CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=16384 CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_NEED_DMA_MAP_STATE=y From 4f7065ed250932d6ff725ba175e734ad4c782f14 Mon Sep 17 00:00:00 2001 From: John Thomson Date: Tue, 17 May 2022 11:15:45 +1000 Subject: [PATCH 26/31] kernel: fix variable erasesize patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update this pending patch to remove the untested (variable eraseregions) section, alongside simplifying the patch. Signed-off-by: John Thomson [refresh and split out unrelated refreshes] Signed-off-by: Thibaut VARÈNE --- ...support-for-minor-aligned-partitions.patch | 272 +++++------------- ...support-for-minor-aligned-partitions.patch | 272 +++++------------- 2 files changed, 128 insertions(+), 416 deletions(-) diff --git a/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch index f7ebedb44e..c634ae9aeb 100644 --- a/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch +++ b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch @@ -1,159 +1,10 @@ -From patchwork Tue Jun 8 04:07:19 2021 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: John Thomson -X-Patchwork-Id: 1489105 -X-Patchwork-Delegate: tudor.ambarus@gmail.com -Return-Path: - -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@bilbo.ozlabs.org -Authentication-Results: ozlabs.org; - spf=none (no SPF record) smtp.mailfrom=lists.infradead.org - (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; - envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; - receiver=) -Authentication-Results: ozlabs.org; - dkim=pass (2048-bit key; - secure) header.d=lists.infradead.org header.i=@lists.infradead.org - header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EMabhVoR; - dkim=fail reason="signature verification failed" (2048-bit key; - unprotected) header.d=fastmail.com.au header.i=@fastmail.com.au - header.a=rsa-sha256 header.s=fm3 header.b=dLzuZ6dB; - dkim=fail reason="signature verification failed" (2048-bit key; - unprotected) header.d=messagingengine.com header.i=@messagingengine.com - header.a=rsa-sha256 header.s=fm3 header.b=nSRGsW+C; - dkim-atps=neutral -Received: from bombadil.infradead.org (bombadil.infradead.org - [IPv6:2607:7c80:54:e::133]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest - SHA256) - (No client certificate requested) - by ozlabs.org (Postfix) with ESMTPS id 4FzcFN1j1nz9sW8 - for ; Tue, 8 Jun 2021 14:09:28 +1000 (AEST) -DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; - d=lists.infradead.org; s=bombadil.20210309; h=Sender: - Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: - List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc - :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: - Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: - List-Owner; bh=6mUWQd71FwsINycGYY1qOhKz+ecWJVNtwDkTebG3XkA=; b=EMabhVoRE3ad89 - o3L2AgyKrs+blSofUC3hoSsQe7gi3m4si8S9HW8Z+8SsS5TufUsvGwDl80qSYGlQOytQF+1yRUWvE - 6FJ/+bqv+TwjqZFibgJ6+9OVsQN9dZ/no1R0bBXIpmrf8ORUmv58QK4ZQquaFKbyXKpFeWOC2MSv4 - H2MAhyhTU8a3gtooH6G8+KvsJEfVgh6C+aDbwxyh2UY3chHKuw1kvL6AktbfUE2xl4zxi3x3kc70B - Wi3LiJBFokxVdgnROXxTU5tI0XboWYkQV64gLuQNV4XKClcuhVpzloDK8Iok6NTd7b32a7TdEFlCS - lGKsEKmxtUlW2FpfoduA==; -Received: from localhost ([::1] helo=bombadil.infradead.org) - by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) - id 1lqT1r-006OAW-DX; Tue, 08 Jun 2021 04:07:51 +0000 -Received: from new1-smtp.messagingengine.com ([66.111.4.221]) - by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) - id 1lqT1l-006O9b-Fq - for linux-mtd@lists.infradead.org; Tue, 08 Jun 2021 04:07:50 +0000 -Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) - by mailnew.nyi.internal (Postfix) with ESMTP id 4456B580622; - Tue, 8 Jun 2021 00:07:42 -0400 (EDT) -Received: from mailfrontend2 ([10.202.2.163]) - by compute2.internal (MEProxy); Tue, 08 Jun 2021 00:07:42 -0400 -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com.au; - h=from:to:cc:subject:date:message-id:mime-version - :content-transfer-encoding; s=fm3; bh=ZXRH+YluM1mHCS1EWUiCY/Sg8O - LccfHe1oW5iAay6y8=; b=dLzuZ6dBYf7ZA8tWLOBFZYLi7ERsGe/4vnMXG+ovvb - dNBO0+SaFGwoqYSFrfq/TeyHfKyvxrA7+LCdopIuT4abpLHxtRwtRiafQcDYCPat - qJIqOZO+wCZC5S9Jc1OP7+t1FviGpgevqIMotci37P+RWc5u3AweMzFljZk90E8C - uorV6rXagD+OssJQzllRnAIK88+rOAC9ZyXv2gWxy4d1HSCwSWgzx2vnV9CNp918 - YC/3tiHas9krbrPIaAsdBROr7Bvoe/ShRRzruKRuvZVgg5NN90vX+/5ZjI8u04GM - p2bWCbC62CP6wlcgDaz+c/Sgr5ITd2GPENJsHfqmLRBA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= - messagingengine.com; h=cc:content-transfer-encoding:date:from - :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy - :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ZXRH+YluM1mHCS1EW - UiCY/Sg8OLccfHe1oW5iAay6y8=; b=nSRGsW+CQ2Zx1RVpIUu8W/VD/k5P+32BW - 5k2ltd+UhI3dfldBPzHrYiOP/IJqGkNW+V+rHASacW/vFygnaZoxNjRYKnOsu+26 - wb2yK3jpl6lsNTg3N1Z4XJrYY2lf9H29DMFbhC67l0PTc050rcZk4XsKTLAlv14Q - VA4WREYSaX/4IN4O+ES4TMq0a/3gKZh6nvbbJXbsXfK0WlSHTGZtZmW3fyrqvbXa - t+R7L8vvqWvwls0pV+Sn8LeQqb7+A69w0UOnuznjkcA3sCc2YehcHbxcUEnMH+9N - bxOjmIDeg9/4X/829tUWUJiLhE5SFmQZ1P6oFtmbWoLrDz0ZJIVBw== -X-ME-Sender: - -X-ME-Received: - -X-ME-Proxy-Cause: - gggruggvucftvghtrhhoucdtuddrgeduledrfedtkedgjeduucetufdoteggodetrfdotf - fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen - uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne - cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeflohhhnhcuvfhh - ohhmshhonhcuoehgihhtsehjohhhnhhthhhomhhsohhnrdhfrghsthhmrghilhdrtghomh - drrghuqeenucggtffrrghtthgvrhhnpefffeeihfdukedtuedufeetieeuudfhhefhkefh - tefgtdeuffekffelleetveduieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh - epmhgrihhlfhhrohhmpehgihhtsehjohhhnhhthhhomhhsohhnrdhfrghsthhmrghilhdr - tghomhdrrghu -X-ME-Proxy: - - - -Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, - 8 Jun 2021 00:07:35 -0400 (EDT) +From cd13e2cd28bf7313b6ad6986bb8d63ea98b37a48 Mon Sep 17 00:00:00 2001 From: John Thomson -To: Miquel Raynal , - Richard Weinberger , Vignesh Raghavendra , - Tudor Ambarus , - Michael Walle , Pratyush Yadav , - linux-mtd@lists.infradead.org -Cc: linux-kernel@vger.kernel.org, - John Thomson , - kernel test robot , Dan Carpenter +Date: Fri, 25 Dec 2020 18:50:08 +1000 Subject: [PATCH] mtd: spi-nor: write support for minor aligned partitions -Date: Tue, 8 Jun 2021 14:07:19 +1000 -Message-Id: <20210608040719.14431-1-git@johnthomson.fastmail.com.au> -X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 -X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -X-CRM114-CacheID: sfid-20210607_210745_712053_67A7D864 -X-CRM114-Status: GOOD ( 26.99 ) -X-Spam-Score: -0.8 (/) -X-Spam-Report: Spam detection software, - running on the system "bombadil.infradead.org", - has NOT identified this incoming email as spam. The original - message has been attached to this so you can view it or label - similar future email. If you have any questions, see - the administrator of that system for details. - Content preview: Do not prevent writing to mtd partitions where a partition - boundary sits on a minor erasesize boundary. This addresses a FIXME that - has been present since the start of the linux git history: /* Doesn' [...] - Content analysis details: (-0.8 points, 5.0 required) - pts rule name description - ---- ---------------------- - -------------------------------------------------- - -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, - low trust [66.111.4.221 listed in list.dnswl.org] - -0.0 SPF_PASS SPF: sender matches SPF record - -0.0 SPF_HELO_PASS SPF: HELO matches SPF record - 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) - [66.111.4.221 listed in wl.mailspike.net] - -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature - 0.1 DKIM_SIGNED Message has a DKIM or DK signature, - not necessarily - valid - -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from - envelope-from domain - 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -X-BeenThere: linux-mtd@lists.infradead.org -X-Mailman-Version: 2.1.34 -Precedence: list -List-Id: Linux MTD discussion mailing list -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Sender: "linux-mtd" -Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Do not prevent writing to mtd partitions where a partition boundary sits on a minor erasesize boundary. @@ -197,26 +48,65 @@ user 0m 0.00s |0m 0.00s |0m 0.01s sys 0m 46.94s |0m 50.38s |2m 12.46s Signed-off-by: John Thomson +Signed-off-by: Thibaut VARÈNE + --- -Have not tested on variable erase regions device. checkpatch does not like the printk(KERN_WARNING these should be changed separately beforehand? +Changes v1 -> v2: +Added mtdcore sysfs for erasesize_minor +Removed finding minor erasesize for variable erase regions device, +as untested and no responses regarding it. +Moved IF_ENABLED for SPINOR variable erase to guard setting +erasesize_minor in spi-nor/core.c +Removed setting erasesize to minor where partition boundaries require +minor erase to be writable +Simplified minor boundary check by relying on minor being a factor of +major + Changes RFC -> v1: Fix uninitialized variable smatch warning Reported-by: kernel test robot Reported-by: Dan Carpenter --- - drivers/mtd/mtdpart.c | 52 ++++++++++++++++++++++++++++--------- - drivers/mtd/spi-nor/Kconfig | 10 +++++++ - drivers/mtd/spi-nor/core.c | 10 +++++-- + drivers/mtd/mtdcore.c | 10 ++++++++++ + drivers/mtd/mtdpart.c | 35 +++++++++++++++++++++++++---------- + drivers/mtd/spi-nor/Kconfig | 10 ++++++++++ + drivers/mtd/spi-nor/core.c | 11 +++++++++-- include/linux/mtd/mtd.h | 2 ++ - 4 files changed, 60 insertions(+), 14 deletions(-) + 5 files changed, 56 insertions(+), 12 deletions(-) +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -163,6 +163,15 @@ static ssize_t mtd_erasesize_show(struct + } + static DEVICE_ATTR(erasesize, S_IRUGO, mtd_erasesize_show, NULL); + ++static ssize_t mtd_erasesize_minor_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct mtd_info *mtd = dev_get_drvdata(dev); ++ ++ return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->erasesize_minor); ++} ++static DEVICE_ATTR(erasesize_minor, S_IRUGO, mtd_erasesize_minor_show, NULL); ++ + static ssize_t mtd_writesize_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -312,6 +321,7 @@ static struct attribute *mtd_attrs[] = { + &dev_attr_flags.attr, + &dev_attr_size.attr, + &dev_attr_erasesize.attr, ++ &dev_attr_erasesize_minor.attr, + &dev_attr_writesize.attr, + &dev_attr_subpagesize.attr, + &dev_attr_oobsize.attr, --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -40,10 +40,11 @@ static struct mtd_info *allocate_partiti +@@ -40,6 +40,7 @@ static struct mtd_info *allocate_partiti struct mtd_info *master = mtd_get_master(parent); int wr_alignment = (parent->flags & MTD_NO_ERASE) ? master->writesize : master->erasesize; @@ -224,54 +114,22 @@ Reported-by: Dan Carpenter u64 parent_size = mtd_is_partition(parent) ? parent->part.size : parent->size; struct mtd_info *child; -- u32 remainder; -+ u32 remainder, remainder_minor; - char *name; - u64 tmp; - -@@ -145,6 +146,7 @@ static struct mtd_info *allocate_partiti - int i, max = parent->numeraseregions; - u64 end = child->part.offset + child->part.size; - struct mtd_erase_region_info *regions = parent->eraseregions; -+ uint32_t erasesize_minor = child->erasesize; - - /* Find the first erase regions which is part of this - * partition. */ -@@ -155,15 +157,24 @@ static struct mtd_info *allocate_partiti - if (i > 0) - i--; - -- /* Pick biggest erasesize */ - for (; i < max && regions[i].offset < end; i++) { -+ /* Pick biggest erasesize */ - if (child->erasesize < regions[i].erasesize) - child->erasesize = regions[i].erasesize; -+ /* Pick smallest non-zero erasesize */ -+ if ((erasesize_minor > regions[i].erasesize) && (regions[i].erasesize > 0)) -+ erasesize_minor = regions[i].erasesize; - } -+ -+ if (erasesize_minor < child->erasesize) -+ child->erasesize_minor = erasesize_minor; -+ - BUG_ON(child->erasesize == 0); +@@ -164,6 +165,7 @@ static struct mtd_info *allocate_partiti } else { /* Single erase size */ child->erasesize = master->erasesize; -+ if (master->erasesize_minor) -+ child->erasesize_minor = master->erasesize_minor; ++ child->erasesize_minor = master->erasesize_minor; } /* -@@ -171,26 +182,43 @@ static struct mtd_info *allocate_partiti +@@ -171,26 +173,39 @@ static struct mtd_info *allocate_partiti * exposes several regions with different erasesize. Adjust * wr_alignment accordingly. */ - if (!(child->flags & MTD_NO_ERASE)) + if (!(child->flags & MTD_NO_ERASE)) { wr_alignment = child->erasesize; -+ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE) && child->erasesize_minor) -+ wr_alignment_minor = child->erasesize_minor; ++ wr_alignment_minor = child->erasesize_minor; + } tmp = mtd_get_master_ofs(child, 0); @@ -284,13 +142,11 @@ Reported-by: Dan Carpenter - printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", - part->name); + if (wr_alignment_minor) { -+ tmp = mtd_get_master_ofs(child, 0); -+ remainder_minor = do_div(tmp, wr_alignment_minor); -+ if (remainder_minor == 0) -+ child->erasesize = child->erasesize_minor; ++ /* rely on minor being a factor of major erasesize */ ++ tmp = remainder; ++ remainder = do_div(tmp, wr_alignment_minor); + } -+ -+ if ((!wr_alignment_minor) || (wr_alignment_minor && remainder_minor != 0)) { ++ if (remainder) { + child->flags &= ~MTD_WRITEABLE; + printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", + part->name); @@ -304,12 +160,11 @@ Reported-by: Dan Carpenter - printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", - part->name); + if (wr_alignment_minor) { -+ tmp = mtd_get_master_ofs(child, 0) + child->part.size; -+ remainder_minor = do_div(tmp, wr_alignment_minor); -+ if (remainder_minor == 0) -+ child->erasesize = child->erasesize_minor; ++ tmp = remainder; ++ remainder = do_div(tmp, wr_alignment_minor); + } -+ if ((!wr_alignment_minor) || (wr_alignment_minor && remainder_minor != 0)) { ++ ++ if (remainder) { + child->flags &= ~MTD_WRITEABLE; + printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", + part->name); @@ -367,11 +222,12 @@ Reported-by: Dan Carpenter } } -@@ -2610,6 +2614,8 @@ static int spi_nor_select_erase(struct s +@@ -2610,6 +2614,9 @@ static int spi_nor_select_erase(struct s return -EINVAL; mtd->erasesize = erase->size; -+ if (erase_minor && erase_minor->size < erase->size) ++ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE) && ++ erase_minor && erase_minor->size < erase->size) + mtd->erasesize_minor = erase_minor->size; return 0; } diff --git a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch index 4ec33a0b1f..43dcbdbbce 100644 --- a/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch +++ b/target/linux/generic/pending-5.15/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch @@ -1,159 +1,10 @@ -From patchwork Tue Jun 8 04:07:19 2021 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: John Thomson -X-Patchwork-Id: 1489105 -X-Patchwork-Delegate: tudor.ambarus@gmail.com -Return-Path: - -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@bilbo.ozlabs.org -Authentication-Results: ozlabs.org; - spf=none (no SPF record) smtp.mailfrom=lists.infradead.org - (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; - envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; - receiver=) -Authentication-Results: ozlabs.org; - dkim=pass (2048-bit key; - secure) header.d=lists.infradead.org header.i=@lists.infradead.org - header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EMabhVoR; - dkim=fail reason="signature verification failed" (2048-bit key; - unprotected) header.d=fastmail.com.au header.i=@fastmail.com.au - header.a=rsa-sha256 header.s=fm3 header.b=dLzuZ6dB; - dkim=fail reason="signature verification failed" (2048-bit key; - unprotected) header.d=messagingengine.com header.i=@messagingengine.com - header.a=rsa-sha256 header.s=fm3 header.b=nSRGsW+C; - dkim-atps=neutral -Received: from bombadil.infradead.org (bombadil.infradead.org - [IPv6:2607:7c80:54:e::133]) - (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) - key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest - SHA256) - (No client certificate requested) - by ozlabs.org (Postfix) with ESMTPS id 4FzcFN1j1nz9sW8 - for ; Tue, 8 Jun 2021 14:09:28 +1000 (AEST) -DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; - d=lists.infradead.org; s=bombadil.20210309; h=Sender: - Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: - List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc - :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: - Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: - List-Owner; bh=6mUWQd71FwsINycGYY1qOhKz+ecWJVNtwDkTebG3XkA=; b=EMabhVoRE3ad89 - o3L2AgyKrs+blSofUC3hoSsQe7gi3m4si8S9HW8Z+8SsS5TufUsvGwDl80qSYGlQOytQF+1yRUWvE - 6FJ/+bqv+TwjqZFibgJ6+9OVsQN9dZ/no1R0bBXIpmrf8ORUmv58QK4ZQquaFKbyXKpFeWOC2MSv4 - H2MAhyhTU8a3gtooH6G8+KvsJEfVgh6C+aDbwxyh2UY3chHKuw1kvL6AktbfUE2xl4zxi3x3kc70B - Wi3LiJBFokxVdgnROXxTU5tI0XboWYkQV64gLuQNV4XKClcuhVpzloDK8Iok6NTd7b32a7TdEFlCS - lGKsEKmxtUlW2FpfoduA==; -Received: from localhost ([::1] helo=bombadil.infradead.org) - by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) - id 1lqT1r-006OAW-DX; Tue, 08 Jun 2021 04:07:51 +0000 -Received: from new1-smtp.messagingengine.com ([66.111.4.221]) - by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) - id 1lqT1l-006O9b-Fq - for linux-mtd@lists.infradead.org; Tue, 08 Jun 2021 04:07:50 +0000 -Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) - by mailnew.nyi.internal (Postfix) with ESMTP id 4456B580622; - Tue, 8 Jun 2021 00:07:42 -0400 (EDT) -Received: from mailfrontend2 ([10.202.2.163]) - by compute2.internal (MEProxy); Tue, 08 Jun 2021 00:07:42 -0400 -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com.au; - h=from:to:cc:subject:date:message-id:mime-version - :content-transfer-encoding; s=fm3; bh=ZXRH+YluM1mHCS1EWUiCY/Sg8O - LccfHe1oW5iAay6y8=; b=dLzuZ6dBYf7ZA8tWLOBFZYLi7ERsGe/4vnMXG+ovvb - dNBO0+SaFGwoqYSFrfq/TeyHfKyvxrA7+LCdopIuT4abpLHxtRwtRiafQcDYCPat - qJIqOZO+wCZC5S9Jc1OP7+t1FviGpgevqIMotci37P+RWc5u3AweMzFljZk90E8C - uorV6rXagD+OssJQzllRnAIK88+rOAC9ZyXv2gWxy4d1HSCwSWgzx2vnV9CNp918 - YC/3tiHas9krbrPIaAsdBROr7Bvoe/ShRRzruKRuvZVgg5NN90vX+/5ZjI8u04GM - p2bWCbC62CP6wlcgDaz+c/Sgr5ITd2GPENJsHfqmLRBA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= - messagingengine.com; h=cc:content-transfer-encoding:date:from - :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy - :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=ZXRH+YluM1mHCS1EW - UiCY/Sg8OLccfHe1oW5iAay6y8=; b=nSRGsW+CQ2Zx1RVpIUu8W/VD/k5P+32BW - 5k2ltd+UhI3dfldBPzHrYiOP/IJqGkNW+V+rHASacW/vFygnaZoxNjRYKnOsu+26 - wb2yK3jpl6lsNTg3N1Z4XJrYY2lf9H29DMFbhC67l0PTc050rcZk4XsKTLAlv14Q - VA4WREYSaX/4IN4O+ES4TMq0a/3gKZh6nvbbJXbsXfK0WlSHTGZtZmW3fyrqvbXa - t+R7L8vvqWvwls0pV+Sn8LeQqb7+A69w0UOnuznjkcA3sCc2YehcHbxcUEnMH+9N - bxOjmIDeg9/4X/829tUWUJiLhE5SFmQZ1P6oFtmbWoLrDz0ZJIVBw== -X-ME-Sender: - -X-ME-Received: - -X-ME-Proxy-Cause: - gggruggvucftvghtrhhoucdtuddrgeduledrfedtkedgjeduucetufdoteggodetrfdotf - fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen - uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne - cujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpeflohhhnhcuvfhh - ohhmshhonhcuoehgihhtsehjohhhnhhthhhomhhsohhnrdhfrghsthhmrghilhdrtghomh - drrghuqeenucggtffrrghtthgvrhhnpefffeeihfdukedtuedufeetieeuudfhhefhkefh - tefgtdeuffekffelleetveduieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh - epmhgrihhlfhhrohhmpehgihhtsehjohhhnhhthhhomhhsohhnrdhfrghsthhmrghilhdr - tghomhdrrghu -X-ME-Proxy: - - - -Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, - 8 Jun 2021 00:07:35 -0400 (EDT) +From acacdac272927ae1d96e0bca51eb82899671eaea Mon Sep 17 00:00:00 2001 From: John Thomson -To: Miquel Raynal , - Richard Weinberger , Vignesh Raghavendra , - Tudor Ambarus , - Michael Walle , Pratyush Yadav , - linux-mtd@lists.infradead.org -Cc: linux-kernel@vger.kernel.org, - John Thomson , - kernel test robot , Dan Carpenter +Date: Fri, 25 Dec 2020 18:50:08 +1000 Subject: [PATCH] mtd: spi-nor: write support for minor aligned partitions -Date: Tue, 8 Jun 2021 14:07:19 +1000 -Message-Id: <20210608040719.14431-1-git@johnthomson.fastmail.com.au> -X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 -X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 -X-CRM114-CacheID: sfid-20210607_210745_712053_67A7D864 -X-CRM114-Status: GOOD ( 26.99 ) -X-Spam-Score: -0.8 (/) -X-Spam-Report: Spam detection software, - running on the system "bombadil.infradead.org", - has NOT identified this incoming email as spam. The original - message has been attached to this so you can view it or label - similar future email. If you have any questions, see - the administrator of that system for details. - Content preview: Do not prevent writing to mtd partitions where a partition - boundary sits on a minor erasesize boundary. This addresses a FIXME that - has been present since the start of the linux git history: /* Doesn' [...] - Content analysis details: (-0.8 points, 5.0 required) - pts rule name description - ---- ---------------------- - -------------------------------------------------- - -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, - low trust [66.111.4.221 listed in list.dnswl.org] - -0.0 SPF_PASS SPF: sender matches SPF record - -0.0 SPF_HELO_PASS SPF: HELO matches SPF record - 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) - [66.111.4.221 listed in wl.mailspike.net] - -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature - 0.1 DKIM_SIGNED Message has a DKIM or DK signature, - not necessarily - valid - -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from - envelope-from domain - 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -X-BeenThere: linux-mtd@lists.infradead.org -X-Mailman-Version: 2.1.34 -Precedence: list -List-Id: Linux MTD discussion mailing list -List-Unsubscribe: , - -List-Archive: -List-Post: -List-Help: -List-Subscribe: , - -Sender: "linux-mtd" -Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit Do not prevent writing to mtd partitions where a partition boundary sits on a minor erasesize boundary. @@ -197,26 +48,65 @@ user 0m 0.00s |0m 0.00s |0m 0.01s sys 0m 46.94s |0m 50.38s |2m 12.46s Signed-off-by: John Thomson +Signed-off-by: Thibaut VARÈNE + --- -Have not tested on variable erase regions device. checkpatch does not like the printk(KERN_WARNING these should be changed separately beforehand? +Changes v1 -> v2: +Added mtdcore sysfs for erasesize_minor +Removed finding minor erasesize for variable erase regions device, +as untested and no responses regarding it. +Moved IF_ENABLED for SPINOR variable erase to guard setting +erasesize_minor in spi-nor/core.c +Removed setting erasesize to minor where partition boundaries require +minor erase to be writable +Simplified minor boundary check by relying on minor being a factor of +major + Changes RFC -> v1: Fix uninitialized variable smatch warning Reported-by: kernel test robot Reported-by: Dan Carpenter --- - drivers/mtd/mtdpart.c | 52 ++++++++++++++++++++++++++++--------- - drivers/mtd/spi-nor/Kconfig | 10 +++++++ - drivers/mtd/spi-nor/core.c | 10 +++++-- + drivers/mtd/mtdcore.c | 10 ++++++++++ + drivers/mtd/mtdpart.c | 35 +++++++++++++++++++++++++---------- + drivers/mtd/spi-nor/Kconfig | 10 ++++++++++ + drivers/mtd/spi-nor/core.c | 11 +++++++++-- include/linux/mtd/mtd.h | 2 ++ - 4 files changed, 60 insertions(+), 14 deletions(-) + 5 files changed, 56 insertions(+), 12 deletions(-) +--- a/drivers/mtd/mtdcore.c ++++ b/drivers/mtd/mtdcore.c +@@ -168,6 +168,15 @@ static ssize_t mtd_erasesize_show(struct + } + MTD_DEVICE_ATTR_RO(erasesize); + ++static ssize_t mtd_erasesize_minor_show(struct device *dev, ++ struct device_attribute *attr, char *buf) ++{ ++ struct mtd_info *mtd = dev_get_drvdata(dev); ++ ++ return sysfs_emit(buf, "%lu\n", (unsigned long)mtd->erasesize_minor); ++} ++MTD_DEVICE_ATTR_RO(erasesize_minor); ++ + static ssize_t mtd_writesize_show(struct device *dev, + struct device_attribute *attr, char *buf) + { +@@ -313,6 +322,7 @@ static struct attribute *mtd_attrs[] = { + &dev_attr_flags.attr, + &dev_attr_size.attr, + &dev_attr_erasesize.attr, ++ &dev_attr_erasesize_minor.attr, + &dev_attr_writesize.attr, + &dev_attr_subpagesize.attr, + &dev_attr_oobsize.attr, --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c -@@ -40,10 +40,11 @@ static struct mtd_info *allocate_partiti +@@ -40,6 +40,7 @@ static struct mtd_info *allocate_partiti struct mtd_info *master = mtd_get_master(parent); int wr_alignment = (parent->flags & MTD_NO_ERASE) ? master->writesize : master->erasesize; @@ -224,54 +114,22 @@ Reported-by: Dan Carpenter u64 parent_size = mtd_is_partition(parent) ? parent->part.size : parent->size; struct mtd_info *child; -- u32 remainder; -+ u32 remainder, remainder_minor; - char *name; - u64 tmp; - -@@ -145,6 +146,7 @@ static struct mtd_info *allocate_partiti - int i, max = parent->numeraseregions; - u64 end = child->part.offset + child->part.size; - struct mtd_erase_region_info *regions = parent->eraseregions; -+ uint32_t erasesize_minor = child->erasesize; - - /* Find the first erase regions which is part of this - * partition. */ -@@ -155,15 +157,24 @@ static struct mtd_info *allocate_partiti - if (i > 0) - i--; - -- /* Pick biggest erasesize */ - for (; i < max && regions[i].offset < end; i++) { -+ /* Pick biggest erasesize */ - if (child->erasesize < regions[i].erasesize) - child->erasesize = regions[i].erasesize; -+ /* Pick smallest non-zero erasesize */ -+ if ((erasesize_minor > regions[i].erasesize) && (regions[i].erasesize > 0)) -+ erasesize_minor = regions[i].erasesize; - } -+ -+ if (erasesize_minor < child->erasesize) -+ child->erasesize_minor = erasesize_minor; -+ - BUG_ON(child->erasesize == 0); +@@ -164,6 +165,7 @@ static struct mtd_info *allocate_partiti } else { /* Single erase size */ child->erasesize = master->erasesize; -+ if (master->erasesize_minor) -+ child->erasesize_minor = master->erasesize_minor; ++ child->erasesize_minor = master->erasesize_minor; } /* -@@ -171,26 +182,43 @@ static struct mtd_info *allocate_partiti +@@ -171,26 +173,39 @@ static struct mtd_info *allocate_partiti * exposes several regions with different erasesize. Adjust * wr_alignment accordingly. */ - if (!(child->flags & MTD_NO_ERASE)) + if (!(child->flags & MTD_NO_ERASE)) { wr_alignment = child->erasesize; -+ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE) && child->erasesize_minor) -+ wr_alignment_minor = child->erasesize_minor; ++ wr_alignment_minor = child->erasesize_minor; + } tmp = mtd_get_master_ofs(child, 0); @@ -284,13 +142,11 @@ Reported-by: Dan Carpenter - printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", - part->name); + if (wr_alignment_minor) { -+ tmp = mtd_get_master_ofs(child, 0); -+ remainder_minor = do_div(tmp, wr_alignment_minor); -+ if (remainder_minor == 0) -+ child->erasesize = child->erasesize_minor; ++ /* rely on minor being a factor of major erasesize */ ++ tmp = remainder; ++ remainder = do_div(tmp, wr_alignment_minor); + } -+ -+ if ((!wr_alignment_minor) || (wr_alignment_minor && remainder_minor != 0)) { ++ if (remainder) { + child->flags &= ~MTD_WRITEABLE; + printk(KERN_WARNING"mtd: partition \"%s\" doesn't start on an erase/write block boundary -- force read-only\n", + part->name); @@ -304,12 +160,11 @@ Reported-by: Dan Carpenter - printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", - part->name); + if (wr_alignment_minor) { -+ tmp = mtd_get_master_ofs(child, 0) + child->part.size; -+ remainder_minor = do_div(tmp, wr_alignment_minor); -+ if (remainder_minor == 0) -+ child->erasesize = child->erasesize_minor; ++ tmp = remainder; ++ remainder = do_div(tmp, wr_alignment_minor); + } -+ if ((!wr_alignment_minor) || (wr_alignment_minor && remainder_minor != 0)) { ++ ++ if (remainder) { + child->flags &= ~MTD_WRITEABLE; + printk(KERN_WARNING"mtd: partition \"%s\" doesn't end on an erase/write block -- force read-only\n", + part->name); @@ -367,11 +222,12 @@ Reported-by: Dan Carpenter } } -@@ -2429,6 +2433,8 @@ static int spi_nor_select_erase(struct s +@@ -2429,6 +2433,9 @@ static int spi_nor_select_erase(struct s return -EINVAL; mtd->erasesize = erase->size; -+ if (erase_minor && erase_minor->size < erase->size) ++ if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE) && ++ erase_minor && erase_minor->size < erase->size) + mtd->erasesize_minor = erase_minor->size; return 0; } From 86fb287ad564e344d9630d8235104da144406d08 Mon Sep 17 00:00:00 2001 From: John Thomson Date: Wed, 18 May 2022 09:23:14 +1000 Subject: [PATCH 27/31] ath79: mikrotik: add rw soft_config to extra devices Linux MTD requires the parent partition be writable for a child partition to be allowed write permission. Signed-off-by: John Thomson --- target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi | 1 - target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi | 1 - 2 files changed, 2 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi index a1bb29b0f3..7cc4bb689c 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-16m-nor.dtsi @@ -18,7 +18,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x20000>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi index e1de96e40c..3cfc40cd86 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-96x.dtsi @@ -88,7 +88,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x20000>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; From bb929a0f9cbabef59eaced57d5162d112640c3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 17 Jun 2022 12:43:43 +0200 Subject: [PATCH 28/31] ipq40xx: mikrotik: make RouterBoot partition writeable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux MTD requires the parent partition be writable for a child partition to be allowed write permission. In order for soft_config to be writeable (and modifiable via sysfs), the parent RouterBoot partition must be writeable Signed-off-by: Thibaut VARÈNE --- .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts | 1 - .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-hap-ac2.dts | 1 - .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts | 1 - .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts | 1 - .../ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-lhgg-60ad.dts | 1 - 5 files changed, 5 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts index 1afbf97f39..b18ba4d46a 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-cap-ac.dts @@ -185,7 +185,6 @@ #size-cells = <1>; label = "RouterBoot"; reg = <0x80000 0x80000>; - read-only; hard_config { read-only; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-hap-ac2.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-hap-ac2.dts index d03409b556..b5818cef39 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-hap-ac2.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-hap-ac2.dts @@ -187,7 +187,6 @@ #size-cells = <1>; label = "RouterBoot"; reg = <0x80000 0x80000>; - read-only; hard_config { read-only; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts index fd11229dbb..87bceecbba 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts @@ -189,7 +189,6 @@ #size-cells = <1>; label = "RouterBoot"; reg = <0x80000 0x80000>; - read-only; hard_config { read-only; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts index 9aa58ffcb4..c8b7e202fd 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts @@ -249,7 +249,6 @@ #size-cells = <1>; label = "RouterBoot"; reg = <0x80000 0x80000>; - read-only; hard_config { read-only; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-lhgg-60ad.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-lhgg-60ad.dts index bd61f4b69f..aecbb673bf 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-lhgg-60ad.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-lhgg-60ad.dts @@ -209,7 +209,6 @@ #size-cells = <1>; label = "RouterBoot"; reg = <0x80000 0x80000>; - read-only; hard_config { read-only; From e1223dbee332b89caf71850eb909104529595c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 12 Jun 2022 21:48:40 +0200 Subject: [PATCH 29/31] ath79: add support for RouterBOARD mAP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MikroTik mAP-2nd (sold as mAP) is an indoor 2.4Ghz AP with 802.3af/at PoE input and passive PoE passthrough. See https://mikrotik.com/product/RBmAP2nD for more details. Specifications: - SoC: QCA9533 - RAM: 64MB - Storage: 16MB NOR - Wireless: QCA9533 802.11b/g/n 2x2 - Ethernet: 2x 10/100 ports, 802.3af/at PoE in port 1, 500 mA passive PoE out on port 2 - 7 user-controllable LEDs Note: the device is a tiny AP and does not distinguish between both ethernet ports roles, so they are both assigned to lan. With the current setup, ETH1 is connected to eth1 and ETH2 is connected to eth0 via the embedded switch port 2. Flashing: TFTP boot initramfs image and then perform sysupgrade. The "ETH1" port must be used to upload the TFTP image. Follow common MikroTik procedure as in https://openwrt.org/toh/mikrotik/common. Tested-By: Andrew Powers-Holmes Signed-off-by: Thibaut VARÈNE --- .../qca9533_mikrotik_routerboard-map-2nd.dts | 113 ++++++++++++++++++ target/linux/ath79/image/mikrotik.mk | 9 ++ .../mikrotik/base-files/etc/board.d/01_leds | 5 + .../base-files/etc/board.d/02_network | 4 + .../etc/hotplug.d/firmware/10-ath9k-eeprom | 3 + 5 files changed, 134 insertions(+) create mode 100644 target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts new file mode 100644 index 0000000000..25971e6f43 --- /dev/null +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts @@ -0,0 +1,113 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9533_mikrotik_routerboard-16m.dtsi" + +/ { + compatible = "mikrotik,routerboard-map-2nd", "qca,qca9533"; + model = "MikroTik RouterBOARD mAP-2nD (mAP)"; + + aliases { + led-boot = &led_user; + led-failsafe = &led_user; + led-running = &led_user; + led-upgrade = &led_user; + }; + + leds { + compatible = "gpio-leds"; + + power { + label = "green:power"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + eth_1 { + label = "green:eth_1"; + gpios = <&gpio_ext 0 GPIO_ACTIVE_LOW>; + }; + + eth_2 { + label = "green:eth_2"; + gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>; + }; + + poe_out { + label = "red:poe_out"; + gpios = <&gpio_ext 2 GPIO_ACTIVE_LOW>; + }; + + led_user: user { + label = "green:user"; + gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>; + }; + + wlan { + label = "green:wlan"; + gpios = <&gpio_ext 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + ap_cap { + label = "green:ap_cap"; + gpios = <&gpio_ext 6 GPIO_ACTIVE_LOW>; + }; + + }; + + gpio-export { + compatible = "gpio-export"; + + usb_power { + gpio-export,name = "usb-power"; + gpio-export,output = <1>; + gpios = <&gpio_ext 5 GPIO_ACTIVE_LOW>; + }; + + enable_poe_port5 { + gpio-export,name = "enable-poe"; + gpio-export,output = <0>; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&pin_spi_cs1>; + + gpio_ext: gpio_ext@1 { + compatible = "fairchild,74hc595"; + reg = <1>; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + spi-max-frequency = <25000000>; + }; +}; + + +&pinmux { + pin_spi_cs1: pinmux_spi_cs1 { + pinctrl-single,bits = <0x8 0x0a000000 0xff000000>; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy0>; + + gmac-config { + device = <&gmac>; + switch-phy-swap = <1>; + }; +}; + +&usb0 { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index d8ae726e87..c90579fbb5 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -85,6 +85,15 @@ define Device/mikrotik_routerboard-lhg-5nd endef TARGET_DEVICES += mikrotik_routerboard-lhg-5nd +define Device/mikrotik_routerboard-map-2nd + $(Device/mikrotik_nor) + SOC := qca9533 + DEVICE_MODEL := RouterBOARD mAP-2nD (mAP) + DEVICE_PACKAGES += kmod-usb2 kmod-ledtrig-gpio + IMAGE_SIZE := 16256k +endef +TARGET_DEVICES += mikrotik_routerboard-map-2nd + define Device/mikrotik_routerboard-mapl-2nd $(Device/mikrotik_nor) SOC := qca9533 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds index edb83b9baa..76b91a54a5 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds @@ -28,6 +28,11 @@ mikrotik,routerboard-lhg-5nd) ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100" ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100" ;; +mikrotik,routerboard-map-2nd) + ucidef_set_led_netdev "eth_1" "eth_1" "green:eth_1" "eth1" + ucidef_set_led_switch "eth_2" "eth_2" "green:eth_2" "switch0" "0x4" + ucidef_set_led_gpio "poe" "poe" "red:poe_out" "14" "0" + ;; mikrotik,routerboard-wapr-2nd) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index b05a41ec36..5646d8cf68 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -30,6 +30,9 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" ;; + mikrotik,routerboard-map-2nd) + ucidef_set_interface_lan "eth0 eth1" + ;; mikrotik,routerboard-962uigs-5hact2hnt) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" @@ -52,6 +55,7 @@ ath79_setup_macs() mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-map-2nd|\ mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wap-2nd|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 0baed0665c..aa5354bfdb 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -31,6 +31,9 @@ case "$FIRMWARE" in mikrotik,routerboard-wapr-2nd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 1) ;; + mikrotik,routerboard-map-2nd) + caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 3) + ;; mikrotik,routerboard-mapl-2nd|\ mikrotik,routerboard-wap-g-5hact2hnd) caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 2) From 7f73acade0cde61341cb77e0dc74de51ac059d4f Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Mon, 28 Mar 2022 14:26:47 +0200 Subject: [PATCH 30/31] mvebu: update and refactor uDPU DTS uDPU DTS has pending upstream fixups, so backport those as well as split the DTS into a DTSI and DTS in preparation for euroDPU support which uses uDPU as the base. Ethernet aliases have not yet been sent upstream but will be soon in order for U-boot to set the correct MAC on both ethernet interfaces instead of just one. Since U-boot environment now has its own partition, update the envtools config script to search for it instead. Patch hardcoding PHY mode is also not applicable anymore, so drop it and set in the uDPU DTS directly. Signed-off-by: Robert Marko --- package/boot/uboot-envtools/files/mvebu | 5 + .../boot/dts/marvell/armada-3720-uDPU.dts | 46 +++++ .../boot/dts/marvell/armada-3720-uDPU.dtsi | 165 ++++++++++++++++++ ...witch-PHY-operation-mode-to-2500base.patch | 34 ---- 4 files changed, 216 insertions(+), 34 deletions(-) create mode 100644 target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts create mode 100644 target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi delete mode 100644 target/linux/mvebu/patches-5.10/314-arm64-dts-uDPU-switch-PHY-operation-mode-to-2500base.patch diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index cffd396ae1..a90f74c517 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -59,7 +59,12 @@ linksys,wrt32x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; methode,udpu) + idx="$(find_mtd_index u-boot-env)" + if [ -n "$idx" ]; then + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" + else ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000" + fi ;; esac diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts new file mode 100644 index 0000000000..186a5e7d7d --- /dev/null +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "armada-3720-uDPU.dtsi" + +/ { + model = "Methode uDPU Board"; + compatible = "methode,udpu", "marvell,armada3720", "marvell,armada3710"; + + sfp_eth0: sfp-eth0 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpiosb 2 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpiosb 3 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpiosb 4 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&gpiosb 5 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + }; +}; + +&pinctrl_nb { + i2c1_recovery_pins: i2c1-recovery-pins { + groups = "i2c1"; + function = "gpio"; + }; +}; + +&i2c0 { + status = "okay"; + pinctrl-names = "default", "recovery"; + pinctrl-0 = <&i2c1_pins>; + pinctrl-1 = <&i2c1_recovery_pins>; + /delete-property/mrvl,i2c-fast-mode; + scl-gpios = <&gpionb 0 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpionb 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +}; + +ð0 { + phy-mode = "2500base-x"; + sfp = <&sfp_eth0>; +}; + +ð1 { + phy-mode = "2500base-x"; +}; diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi new file mode 100644 index 0000000000..bc8d1f1020 --- /dev/null +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dtsi @@ -0,0 +1,165 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device tree for the uDPU board. + * Based on Marvell Armada 3720 development board (DB-88F3720-DDR3) + * Copyright (C) 2016 Marvell + * Copyright (C) 2019 Methode Electronics + * Copyright (C) 2019 Telus + * + * Vladimir Vid + */ + +/dts-v1/; + +#include +#include "armada-372x.dtsi" + +/ { + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x00000000 0x00000000 0x20000000>; + }; + + aliases { + ethernet0 = ð0; + ethernet1 = ð1; + }; + + leds { + compatible = "gpio-leds"; + + led-power1 { + label = "udpu:green:power"; + gpios = <&gpionb 11 GPIO_ACTIVE_LOW>; + }; + + led-power2 { + label = "udpu:red:power"; + gpios = <&gpionb 12 GPIO_ACTIVE_LOW>; + }; + + led-network1 { + label = "udpu:green:network"; + gpios = <&gpionb 13 GPIO_ACTIVE_LOW>; + }; + + led-network2 { + label = "udpu:red:network"; + gpios = <&gpionb 14 GPIO_ACTIVE_LOW>; + }; + + led-alarm1 { + label = "udpu:green:alarm"; + gpios = <&gpionb 15 GPIO_ACTIVE_LOW>; + }; + + led-alarm2 { + label = "udpu:red:alarm"; + gpios = <&gpionb 16 GPIO_ACTIVE_LOW>; + }; + }; + + sfp_eth1: sfp-eth1 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpiosb 7 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpiosb 8 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpiosb 9 GPIO_ACTIVE_HIGH>; + tx-fault-gpio = <&gpiosb 10 GPIO_ACTIVE_HIGH>; + maximum-power-milliwatt = <3000>; + }; +}; + +&sdhci0 { + status = "okay"; + bus-width = <8>; + mmc-ddr-1_8v; + mmc-hs400-1_8v; + marvell,pad-type = "fixed-1-8v"; + non-removable; + no-sd; + no-sdio; +}; + +&spi0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi_quad_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <54000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "firmware"; + reg = <0x0 0x180000>; + }; + + partition@180000 { + label = "u-boot-env"; + reg = <0x180000 0x10000>; + }; + }; + }; +}; + +&pinctrl_nb { + i2c2_recovery_pins: i2c2-recovery-pins { + groups = "i2c2"; + function = "gpio"; + }; +}; + +&i2c1 { + status = "okay"; + pinctrl-names = "default", "recovery"; + pinctrl-0 = <&i2c2_pins>; + pinctrl-1 = <&i2c2_recovery_pins>; + /delete-property/mrvl,i2c-fast-mode; + scl-gpios = <&gpionb 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpionb 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + + temp-sensor@48 { + compatible = "ti,tmp75c"; + reg = <0x48>; + }; + + temp-sensor@49 { + compatible = "ti,tmp75c"; + reg = <0x49>; + }; +}; + +ð0 { + status = "okay"; + managed = "in-band-status"; + phys = <&comphy1 0>; +}; + +ð1 { + phy-mode = "sgmii"; + status = "okay"; + managed = "in-band-status"; + phys = <&comphy0 1>; + sfp = <&sfp_eth1>; +}; + +&usb3 { + status = "okay"; + phys = <&usb2_utmi_otg_phy>; + phy-names = "usb2-utmi-otg-phy"; +}; + +&uart0 { + status = "okay"; +}; diff --git a/target/linux/mvebu/patches-5.10/314-arm64-dts-uDPU-switch-PHY-operation-mode-to-2500base.patch b/target/linux/mvebu/patches-5.10/314-arm64-dts-uDPU-switch-PHY-operation-mode-to-2500base.patch deleted file mode 100644 index 2240d0b39e..0000000000 --- a/target/linux/mvebu/patches-5.10/314-arm64-dts-uDPU-switch-PHY-operation-mode-to-2500base.patch +++ /dev/null @@ -1,34 +0,0 @@ -Certain SFP modules (most notably Nokia GPON ones) first check -connectivity on 1000base-x, and switch to 2500base-x afterwards. This -is considered a quirk so the phylink switches the interface to -2500base-x as well. - -However, after power-cycling the uDPU device, network interface/SFP module -will not work correctly until the module is re-seated. This patch -resolves this issue by forcing the interface to be brought up in -2500base-x mode by default. - -Signed-off-by: Jakov Petrina -Signed-off-by: Vladimir Vid -Cc: Luka Perkov - ---- a/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts -+++ b/arch/arm64/boot/dts/marvell/armada-3720-uDPU.dts -@@ -162,7 +162,7 @@ - }; - - ð0 { -- phy-mode = "sgmii"; -+ phy-mode = "2500base-x"; - status = "okay"; - managed = "in-band-status"; - phys = <&comphy1 0>; -@@ -170,7 +170,7 @@ - }; - - ð1 { -- phy-mode = "sgmii"; -+ phy-mode = "2500base-x"; - status = "okay"; - managed = "in-band-status"; - phys = <&comphy0 1>; From 57a38c8d3e85dd94d4912febc3906db77a855b43 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 30 Mar 2022 14:04:10 +0200 Subject: [PATCH 31/31] mvebu: add Methode euroDPU support Add support for Methode euroDPU which is based on uDPU but does not have a second SFP cage, instead of which a Maxlinear G.hn IC is used. PHY mode is set to 1000Base-X despite Maxlinear IC being capable of 2500Base-X since until 5.15 support for mvebu is available trying to use 2500Base-X will cause buffer overruns for which the fix is not easily backportable. Installation instructions: 1. Boot the FIT initramfs image (openwrt-mvebu-cortexa53-methode_edpu-initramfs.itb) 2. sysupgrade using the openwrt-mvebu-cortexa53-methode_edpu-firmware.tgz Signed-off-by: Robert Marko --- package/boot/uboot-envtools/files/mvebu | 3 ++- .../base-files/etc/board.d/02_network | 3 ++- .../cortexa53/base-files/lib/preinit/82_uDPU | 3 ++- .../base-files/lib/upgrade/platform.sh | 6 ++++-- .../boot/dts/marvell/armada-3720-eDPU.dts | 19 +++++++++++++++++++ target/linux/mvebu/image/cortexa53.mk | 8 ++++++++ 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index a90f74c517..cc1c648f24 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -58,7 +58,8 @@ linksys,wrt3200acm|\ linksys,wrt32x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; -methode,udpu) +methode,udpu|\ +methode,edpu) idx="$(find_mtd_index u-boot-env)" if [ -n "$idx" ]; then ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" diff --git a/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network index 7da9de58c7..489090d77c 100644 --- a/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa53/base-files/etc/board.d/02_network @@ -21,7 +21,8 @@ globalscale,espressobin-ultra) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2 lan3" "wan" ;; marvell,armada-3720-db|\ -methode,udpu) +methode,udpu|\ +methode,edpu) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; *) diff --git a/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU b/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU index 12bbfc3725..8d5a482b82 100644 --- a/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU +++ b/target/linux/mvebu/cortexa53/base-files/lib/preinit/82_uDPU @@ -8,7 +8,8 @@ preinit_mount_udpu() { . /lib/upgrade/common.sh case $(board_name) in - methode,udpu) + methode,udpu|\ + methode,edpu) # Check which device is detected [ -b "/dev/mmcblk0" ] && mmcdev="/dev/mmcblk0" || mmcdev="/dev/mmcblk1" diff --git a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh index 0ee1d61506..cd41c39d7c 100755 --- a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh @@ -33,7 +33,8 @@ platform_do_upgrade() { globalscale,espressobin-v7-emmc) legacy_sdcard_do_upgrade "$1" ;; - methode,udpu) + methode,udpu|\ + methode,edpu) platform_do_upgrade_uDPU "$1" ;; *) @@ -51,7 +52,8 @@ platform_copy_config() { globalscale,espressobin-v7-emmc) legacy_sdcard_copy_config ;; - methode,udpu) + methode,udpu|\ + methode,edpu) platform_copy_config_uDPU ;; esac diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts new file mode 100644 index 0000000000..4db8b946df --- /dev/null +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-eDPU.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) + +/dts-v1/; + +#include "armada-3720-uDPU.dtsi" + +/ { + model = "Methode eDPU Board"; + compatible = "methode,edpu", "marvell,armada3720", "marvell,armada3710"; +}; + +/* PHY mode is set to 1000Base-X despite Maxlinear IC being capable of + * 2500Base-X since until 5.15 support for mvebu is available trying to + * use 2500Base-X will cause buffer overruns for which the fix is not + * easily backportable. + */ +ð0 { + phy-mode = "1000base-x"; +}; diff --git a/target/linux/mvebu/image/cortexa53.mk b/target/linux/mvebu/image/cortexa53.mk index bfaa597d9a..afe8d9ce21 100644 --- a/target/linux/mvebu/image/cortexa53.mk +++ b/target/linux/mvebu/image/cortexa53.mk @@ -92,3 +92,11 @@ define Device/methode_udpu BOOT_SCRIPT := udpu endef TARGET_DEVICES += methode_udpu + +define Device/methode_edpu + $(call Device/methode_udpu) + DEVICE_MODEL := eDPU + DEVICE_DTS := armada-3720-eDPU + KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(DEVICE_DTS).dtb +endef +TARGET_DEVICES += methode_edpu