From 44e07852856e65d4348185ed8042fa8a8c05530f Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 4 Jan 2023 14:53:54 +0100 Subject: [PATCH 01/49] realtek: Migrate to upstream generic MIPS addresses Upstream generic MIPS uses 0x80100000 and 0x80100400 for the LOADADDR and ENTRY addresses. As we do not want to diverge from upstream and patch upstream when not needed, adjust our addresses as well to be future proof. Signed-off-by: Olliver Schinagl Tested-by: Jan Hoffmann # HPE 1920-8G, HPE 1920-48G --- target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform | 2 +- target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform | 2 +- target/linux/realtek/image/Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform b/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform index 9d45d2ddd5b..98f18cac1be 100644 --- a/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-5.10/arch/mips/rtl838x/Platform @@ -2,4 +2,4 @@ # Realtek RTL838x SoCs # cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80000000 +load-$(CONFIG_RTL83XX) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform b/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform index 9d45d2ddd5b..98f18cac1be 100644 --- a/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-5.15/arch/mips/rtl838x/Platform @@ -2,4 +2,4 @@ # Realtek RTL838x SoCs # cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80000000 +load-$(CONFIG_RTL83XX) += 0xffffffff80100000 diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 7c5b67191cb..82390212e62 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -3,8 +3,8 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk -KERNEL_LOADADDR = 0x80000000 -KERNEL_ENTRY = 0x80000400 +KERNEL_LOADADDR = 0x80100000 +KERNEL_ENTRY = 0x80100400 DEVICE_VARS += \ CAMEO_BOARD_VERSION \ From de2dc3feaea7deefcc816fb09167211965fdde9b Mon Sep 17 00:00:00 2001 From: Pascal Ernster Date: Tue, 3 Jan 2023 23:01:11 +0100 Subject: [PATCH 02/49] realtek: return correct error value for phy ops A behavioural change was introduced with commit 758c88b96963 ("realtek: Whitespace and codestyle cleanup") causing rtl838x_read_phy() and rtl838x_write_phy() to unconditionally return -ETIMEDOUT. As a result, probing the device during boot fails: Error setting up netdev, freeing it again. rtl838x-eth: probe of 1b00a300.ethernet failed with error -5 Fix the bootloop caused by this regression with kernel 5.15 on rtl838x devices, by properly returning 0 on success. Tested on a Netgear GS108T v3, a Netgear GS310TP v1, a Zyxel GS1900-8HP v1 and an HPE 1920-8G. Fixes: 758c88b969639d0e6b684669d2e54dd1be3102f4 ("realtek: Whitespace and codestyle cleanup") Tested-by: Stijn Segers Tested-by: Jan Hoffmann Signed-off-by: Pascal Ernster --- .../realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index c1d6b0c554b..cbd4543db4c 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1832,7 +1832,7 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) timeout: mutex_unlock(&smi_lock); - return -ETIMEDOUT; + return err; } /* Write to a register in a page of the PHY */ @@ -1868,7 +1868,7 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) timeout: mutex_unlock(&smi_lock); - return -ETIMEDOUT; + return err; } /* Read an mmd register of a PHY */ From a188536ef6507e30cba218182e673349ea48cbe7 Mon Sep 17 00:00:00 2001 From: Pascal Ernster Date: Thu, 5 Jan 2023 06:35:35 +0100 Subject: [PATCH 03/49] realtek: 5.15: Improve rtl838x dsa driver error handling Make sure functions calling rtl838x_smi_wait_op() return its return value in target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c. This brings the code style in line with the rtl839x implementation. Suggested-by: Sander Vanheule Signed-off-by: Pascal Ernster --- .../drivers/net/dsa/rtl83xx/rtl838x.c | 56 +++++++++++-------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index cbd4543db4c..8a162df9a43 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1798,7 +1798,7 @@ int rtl838x_smi_wait_op(int timeout) /* Reads a register in a page from the PHY */ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) { - int err = -ETIMEDOUT; + int err; u32 v; u32 park_page; @@ -1812,8 +1812,9 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32_mask(0xffff0000, port << 16, RTL838X_SMI_ACCESS_PHY_CTRL_2); @@ -1822,14 +1823,15 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val) sw_w32(v | park_page, RTL838X_SMI_ACCESS_PHY_CTRL_1); sw_w32_mask(0, 1, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; *val = sw_r32(RTL838X_SMI_ACCESS_PHY_CTRL_2) & 0xffff; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; @@ -1838,7 +1840,7 @@ timeout: /* Write to a register in a page of the PHY */ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) { - int err = -ETIMEDOUT; + int err; u32 v; u32 park_page; @@ -1847,8 +1849,9 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) return -ENOTSUPP; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(BIT(port), RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1860,12 +1863,13 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val) sw_w32(v | park_page, RTL838X_SMI_ACCESS_PHY_CTRL_1); sw_w32_mask(0, 1, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; @@ -1874,13 +1878,14 @@ timeout: /* Read an mmd register of a PHY */ int rtl838x_read_mmd_phy(u32 port, u32 addr, u32 reg, u32 *val) { - int err = -ETIMEDOUT; + int err; u32 v; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(1 << port, RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1894,14 +1899,15 @@ int rtl838x_read_mmd_phy(u32 port, u32 addr, u32 reg, u32 *val) v = 1 << 1 | 0 << 2 | 1; sw_w32(v, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; *val = sw_r32(RTL838X_SMI_ACCESS_PHY_CTRL_2) & 0xffff; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; @@ -1910,15 +1916,16 @@ timeout: /* Write to an mmd register of a PHY */ int rtl838x_write_mmd_phy(u32 port, u32 addr, u32 reg, u32 val) { - int err = -ETIMEDOUT; + int err; u32 v; pr_debug("MMD write: port %d, dev %d, reg %d, val %x\n", port, addr, reg, val); val &= 0xffff; mutex_lock(&smi_lock); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; sw_w32(1 << port, RTL838X_SMI_ACCESS_PHY_CTRL_0); mdelay(10); @@ -1931,12 +1938,13 @@ int rtl838x_write_mmd_phy(u32 port, u32 addr, u32 reg, u32 val) v = 1 << 1 | 1 << 2 | 1; sw_w32(v, RTL838X_SMI_ACCESS_PHY_CTRL_1); - if (rtl838x_smi_wait_op(100000)) - goto timeout; + err = rtl838x_smi_wait_op(100000); + if (err) + goto errout; err = 0; -timeout: +errout: mutex_unlock(&smi_lock); return err; } From 720b2431716b16a93848e10788ae6d36856a34b2 Mon Sep 17 00:00:00 2001 From: Pascal Ernster Date: Thu, 5 Jan 2023 06:56:38 +0100 Subject: [PATCH 04/49] realtek: 5.15: Improve error handling in rtl838x_pie_rule_write() In target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c, make rtl838x_pie_rule_write() return non-zero value case of error. Signed-off-by: Pascal Ernster --- .../files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c index 8a162df9a43..504b29822a1 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.c @@ -1335,7 +1335,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str /* Access IACL table (1) via register 0 */ struct table_reg *q = rtl_table_get(RTL8380_TBL_0, 1); u32 r[18]; - int err = 0; + int err; int block = idx / PIE_BLOCK_SIZE; u32 t_select = sw_r32(RTL838X_ACL_BLK_TMPLTE_CTRL(block)); @@ -1344,17 +1344,21 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) r[i] = 0; - if (!pr->valid) - goto err_out; + if (!pr->valid) { + err = -EINVAL; + pr_err("Rule invalid\n"); + goto errout; + } rtl838x_write_pie_fixed_fields(r, pr); pr_debug("%s: template %d\n", __func__, (t_select >> (pr->tid * 3)) & 0x7); rtl838x_write_pie_templated(r, pr, fixed_templates[(t_select >> (pr->tid * 3)) & 0x7]); - if (rtl838x_write_pie_action(r, pr)) { + err = rtl838x_write_pie_action(r, pr); + if (err) { pr_err("Rule actions too complex\n"); - goto err_out; + goto errout; } /* rtl838x_pie_rule_dump_raw(r); */ @@ -1362,7 +1366,7 @@ static int rtl838x_pie_rule_write(struct rtl838x_switch_priv *priv, int idx, str for (int i = 0; i < 18; i++) sw_w32(r[i], rtl_table_data(q, i)); -err_out: +errout: rtl_table_write(q, idx); rtl_table_release(q); From 2621ddb0bef7f5f8eedc49437dfa23b66e810af6 Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 5 Jan 2023 05:51:15 -0500 Subject: [PATCH 05/49] kernel: bump 5.10 to 5.10.162 All patches automatically rebased. Build system: x86_64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Signed-off-by: John Audia --- include/kernel-5.10 | 4 ++-- .../linux/ath79/patches-5.10/910-unaligned_access_hacks.patch | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/kernel-5.10 b/include/kernel-5.10 index da007fc72dd..4a573acf8e9 100644 --- a/include/kernel-5.10 +++ b/include/kernel-5.10 @@ -1,2 +1,2 @@ -LINUX_VERSION-5.10 = .161 -LINUX_KERNEL_HASH-5.10.161 = 7aaaf6d0bcd8a2cfa14ad75f02ca62bb2de08aad3bee3eff198de49ea5254079 +LINUX_VERSION-5.10 = .162 +LINUX_KERNEL_HASH-5.10.162 = 2ec400fc50ffdfe4c836a3c02bf6e7aebcd7963dd2ac1425e6d41545c37dd217 diff --git a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch index 53ddcd46e50..1891a6425ec 100644 --- a/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.10/910-unaligned_access_hacks.patch @@ -326,7 +326,7 @@ SVN-Revision: 35130 #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1470,8 +1470,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1469,8 +1469,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; From 457cc597958748bd9a92bf2cb2e1f8b235124950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 6 Jan 2023 14:03:12 +0100 Subject: [PATCH 06/49] kernel: 5.10: update nvmem subsystem to the 5.15 state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows cleanly backporting more recent stuff that's important for OpenWrt. Signed-off-by: Rafał Miłecki --- ...core-Add-support-for-keepout-regions.patch | 267 ++++++++++++++++++ ...mem-qfprom-Don-t-touch-certain-fuses.patch | 87 ++++++ ...add-support-for-the-unaliged-word-co.patch | 105 +++++++ ...imx-iim-Use-of_device_get_match_data.patch | 41 +++ ...r-to-expose-reserved-memory-as-nvmem.patch | 160 +++++++++++ ...m-Kconfig-Correct-typo-in-NVMEM_RMEM.patch | 28 ++ ...001-nvmem-convert-comma-to-semicolon.patch | 39 +++ ...new-driver-exposing-Broadcom-s-NVRA.patch} | 16 +- ...unctions-to-make-number-reading-easy.patch | 174 ++++++++++++ ...x-unintentional-sign-extension-issue.patch | 34 +++ ...-fix-undefined-reference-to-memremap.patch | 29 ++ ...d-support-for-fuse-blowing-on-sc7280.patch | 102 +++++++ ...-nvmem-core-allow-specifying-of_node.patch | 80 ++++++ ...0002-nvmem-sprd-Fix-an-error-message.patch | 30 ++ ...0003-nvmem-sunxi_sid-Set-type-to-OTP.patch | 27 ++ ...14-0004-nvmem-qfprom-minor-nit-fixes.patch | 46 +++ ...ify-nvmem_cell_read_variable_common-.patch | 52 ++++ ...rove-the-comment-about-regulator-set.patch | 33 +++ ...v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch | 36 +++ ...280-Handle-the-additional-power-doma.patch | 89 ++++++ ...rror-handling-while-validating-keepo.patch | 36 +++ ...tp-Add-new-driver-for-the-Wii-and-Wi.patch | 191 +++++++++++++ ...EM_NINTENDO_OTP-should-depend-on-WII.patch | 29 ++ ...handling-U-Boot-environment-variabl.patch} | 14 +- ...find-Device-Tree-nodes-for-NVMEM-ce.patch} | 0 ...m-u-boot-env-fix-crc32-casting-type.patch} | 0 ...upport-passing-DT-node-in-cell-info.patch} | 2 +- ...fix-crc32_data_offset-on-redundant-.patch} | 0 ...nv-align-endianness-of-crc32-values.patch} | 0 ...oot-env-add-Broadcom-format-support.patch} | 0 target/linux/generic/config-5.10 | 1 + 31 files changed, 1733 insertions(+), 15 deletions(-) create mode 100644 target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch create mode 100644 target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch create mode 100644 target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch create mode 100644 target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch create mode 100644 target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch create mode 100644 target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch create mode 100644 target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch rename target/linux/{bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch => generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch} (86%) create mode 100644 target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch create mode 100644 target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch create mode 100644 target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch create mode 100644 target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch create mode 100644 target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch create mode 100644 target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch create mode 100644 target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch create mode 100644 target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch create mode 100644 target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch rename target/linux/generic/backport-5.10/{801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch => 823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch} (95%) rename target/linux/generic/backport-5.10/{801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch => 823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch} (100%) rename target/linux/generic/backport-5.10/{801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch => 823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch} (100%) rename target/linux/generic/backport-5.10/{802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch => 824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch} (95%) rename target/linux/generic/backport-5.10/{803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch => 825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch} (100%) rename target/linux/generic/backport-5.10/{803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch => 825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch} (100%) rename target/linux/generic/backport-5.10/{803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch => 825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch} (100%) diff --git a/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch new file mode 100644 index 00000000000..6fe5032f33d --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0001-nvmem-core-Add-support-for-keepout-regions.patch @@ -0,0 +1,267 @@ +From fd3bb8f54a88107570334c156efb0c724a261003 Mon Sep 17 00:00:00 2001 +From: Evan Green +Date: Fri, 27 Nov 2020 10:28:34 +0000 +Subject: [PATCH] nvmem: core: Add support for keepout regions + +Introduce support into the nvmem core for arrays of register ranges +that should not result in actual device access. For these regions a +constant byte (repeated) is returned instead on read, and writes are +quietly ignored and returned as successful. + +This is useful for instance if certain efuse regions are protected +from access by Linux because they contain secret info to another part +of the system (like an integrated modem). + +Signed-off-by: Evan Green +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 153 ++++++++++++++++++++++++++++++++- + include/linux/nvmem-provider.h | 17 ++++ + 2 files changed, 166 insertions(+), 4 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -34,6 +34,8 @@ struct nvmem_device { + struct bin_attribute eeprom; + struct device *base_dev; + struct list_head cells; ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; + struct gpio_desc *wp_gpio; +@@ -66,8 +68,8 @@ static LIST_HEAD(nvmem_lookup_list); + + static BLOCKING_NOTIFIER_HEAD(nvmem_notifier); + +-static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, +- void *val, size_t bytes) ++static int __nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) + { + if (nvmem->reg_read) + return nvmem->reg_read(nvmem->priv, offset, val, bytes); +@@ -75,8 +77,8 @@ static int nvmem_reg_read(struct nvmem_d + return -EINVAL; + } + +-static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, +- void *val, size_t bytes) ++static int __nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) + { + int ret; + +@@ -90,6 +92,88 @@ static int nvmem_reg_write(struct nvmem_ + return -EINVAL; + } + ++static int nvmem_access_with_keepouts(struct nvmem_device *nvmem, ++ unsigned int offset, void *val, ++ size_t bytes, int write) ++{ ++ ++ unsigned int end = offset + bytes; ++ unsigned int kend, ksize; ++ const struct nvmem_keepout *keepout = nvmem->keepout; ++ const struct nvmem_keepout *keepoutend = keepout + nvmem->nkeepout; ++ int rc; ++ ++ /* ++ * Skip all keepouts before the range being accessed. ++ * Keepouts are sorted. ++ */ ++ while ((keepout < keepoutend) && (keepout->end <= offset)) ++ keepout++; ++ ++ while ((offset < end) && (keepout < keepoutend)) { ++ /* Access the valid portion before the keepout. */ ++ if (offset < keepout->start) { ++ kend = min(end, keepout->start); ++ ksize = kend - offset; ++ if (write) ++ rc = __nvmem_reg_write(nvmem, offset, val, ksize); ++ else ++ rc = __nvmem_reg_read(nvmem, offset, val, ksize); ++ ++ if (rc) ++ return rc; ++ ++ offset += ksize; ++ val += ksize; ++ } ++ ++ /* ++ * Now we're aligned to the start of this keepout zone. Go ++ * through it. ++ */ ++ kend = min(end, keepout->end); ++ ksize = kend - offset; ++ if (!write) ++ memset(val, keepout->value, ksize); ++ ++ val += ksize; ++ offset += ksize; ++ keepout++; ++ } ++ ++ /* ++ * If we ran out of keepouts but there's still stuff to do, send it ++ * down directly ++ */ ++ if (offset < end) { ++ ksize = end - offset; ++ if (write) ++ return __nvmem_reg_write(nvmem, offset, val, ksize); ++ else ++ return __nvmem_reg_read(nvmem, offset, val, ksize); ++ } ++ ++ return 0; ++} ++ ++static int nvmem_reg_read(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ if (!nvmem->nkeepout) ++ return __nvmem_reg_read(nvmem, offset, val, bytes); ++ ++ return nvmem_access_with_keepouts(nvmem, offset, val, bytes, false); ++} ++ ++static int nvmem_reg_write(struct nvmem_device *nvmem, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ if (!nvmem->nkeepout) ++ return __nvmem_reg_write(nvmem, offset, val, bytes); ++ ++ return nvmem_access_with_keepouts(nvmem, offset, val, bytes, true); ++} ++ + #ifdef CONFIG_NVMEM_SYSFS + static const char * const nvmem_type_str[] = { + [NVMEM_TYPE_UNKNOWN] = "Unknown", +@@ -535,6 +619,59 @@ nvmem_find_cell_by_name(struct nvmem_dev + return cell; + } + ++static int nvmem_validate_keepouts(struct nvmem_device *nvmem) ++{ ++ unsigned int cur = 0; ++ const struct nvmem_keepout *keepout = nvmem->keepout; ++ const struct nvmem_keepout *keepoutend = keepout + nvmem->nkeepout; ++ ++ while (keepout < keepoutend) { ++ /* Ensure keepouts are sorted and don't overlap. */ ++ if (keepout->start < cur) { ++ dev_err(&nvmem->dev, ++ "Keepout regions aren't sorted or overlap.\n"); ++ ++ return -ERANGE; ++ } ++ ++ if (keepout->end < keepout->start) { ++ dev_err(&nvmem->dev, ++ "Invalid keepout region.\n"); ++ ++ return -EINVAL; ++ } ++ ++ /* ++ * Validate keepouts (and holes between) don't violate ++ * word_size constraints. ++ */ ++ if ((keepout->end - keepout->start < nvmem->word_size) || ++ ((keepout->start != cur) && ++ (keepout->start - cur < nvmem->word_size))) { ++ ++ dev_err(&nvmem->dev, ++ "Keepout regions violate word_size constraints.\n"); ++ ++ return -ERANGE; ++ } ++ ++ /* Validate keepouts don't violate stride (alignment). */ ++ if (!IS_ALIGNED(keepout->start, nvmem->stride) || ++ !IS_ALIGNED(keepout->end, nvmem->stride)) { ++ ++ dev_err(&nvmem->dev, ++ "Keepout regions violate stride.\n"); ++ ++ return -EINVAL; ++ } ++ ++ cur = keepout->end; ++ keepout++; ++ } ++ ++ return 0; ++} ++ + static int nvmem_add_cells_from_of(struct nvmem_device *nvmem) + { + struct device_node *parent, *child; +@@ -655,6 +792,8 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->keepout = config->keepout; ++ nvmem->nkeepout = config->nkeepout; + if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; + +@@ -679,6 +818,12 @@ struct nvmem_device *nvmem_register(cons + nvmem->dev.groups = nvmem_dev_groups; + #endif + ++ if (nvmem->nkeepout) { ++ rval = nvmem_validate_keepouts(nvmem); ++ if (rval) ++ goto err_put_device; ++ } ++ + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_register(&nvmem->dev); +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -31,6 +31,19 @@ enum nvmem_type { + #define NVMEM_DEVID_AUTO (-2) + + /** ++ * struct nvmem_keepout - NVMEM register keepout range. ++ * ++ * @start: The first byte offset to avoid. ++ * @end: One beyond the last byte offset to avoid. ++ * @value: The byte to fill reads with for this region. ++ */ ++struct nvmem_keepout { ++ unsigned int start; ++ unsigned int end; ++ unsigned char value; ++}; ++ ++/** + * struct nvmem_config - NVMEM device configuration + * + * @dev: Parent device. +@@ -39,6 +52,8 @@ enum nvmem_type { + * @owner: Pointer to exporter module. Used for refcounting. + * @cells: Optional array of pre-defined NVMEM cells. + * @ncells: Number of elements in cells. ++ * @keepout: Optional array of keepout ranges (sorted ascending by start). ++ * @nkeepout: Number of elements in the keepout array. + * @type: Type of the nvmem storage + * @read_only: Device is read-only. + * @root_only: Device is accessibly to root only. +@@ -66,6 +81,8 @@ struct nvmem_config { + struct gpio_desc *wp_gpio; + const struct nvmem_cell_info *cells; + int ncells; ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; + enum nvmem_type type; + bool read_only; + bool root_only; diff --git a/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch b/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch new file mode 100644 index 00000000000..ae499e74989 --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0002-nvmem-qfprom-Don-t-touch-certain-fuses.patch @@ -0,0 +1,87 @@ +From 044ee8f85267599a9b0112911f5c16d4548b4289 Mon Sep 17 00:00:00 2001 +From: Evan Green +Date: Fri, 27 Nov 2020 10:28:36 +0000 +Subject: [PATCH] nvmem: qfprom: Don't touch certain fuses + +Some fuse ranges are protected by the XPU such that the AP cannot +access them. Attempting to do so causes an SError. Use the newly +introduced per-soc compatible string, and the newly introduced +nvmem keepout support to attach the set of regions +we should not access. + +Reviewed-by: Douglas Anderson +Signed-off-by: Evan Green +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + + /* Blow timer clock frequency in Mhz */ +@@ -89,6 +90,28 @@ struct qfprom_touched_values { + }; + + /** ++ * struct qfprom_soc_compatible_data - Data matched against the SoC ++ * compatible string. ++ * ++ * @keepout: Array of keepout regions for this SoC. ++ * @nkeepout: Number of elements in the keepout array. ++ */ ++struct qfprom_soc_compatible_data { ++ const struct nvmem_keepout *keepout; ++ unsigned int nkeepout; ++}; ++ ++static const struct nvmem_keepout sc7180_qfprom_keepout[] = { ++ {.start = 0x128, .end = 0x148}, ++ {.start = 0x220, .end = 0x228} ++}; ++ ++static const struct qfprom_soc_compatible_data sc7180_qfprom = { ++ .keepout = sc7180_qfprom_keepout, ++ .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout) ++}; ++ ++/** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. + * @old: The data that was stashed from before fuse blowing. +@@ -302,6 +325,7 @@ static int qfprom_probe(struct platform_ + struct device *dev = &pdev->dev; + struct resource *res; + struct nvmem_device *nvmem; ++ const struct qfprom_soc_compatible_data *soc_data; + struct qfprom_priv *priv; + int ret; + +@@ -320,6 +344,11 @@ static int qfprom_probe(struct platform_ + econfig.priv = priv; + + priv->dev = dev; ++ soc_data = device_get_match_data(dev); ++ if (soc_data) { ++ econfig.keepout = soc_data->keepout; ++ econfig.nkeepout = soc_data->nkeepout; ++ } + + /* + * If more than one region is provided then the OS has the ability +@@ -375,6 +404,7 @@ static int qfprom_probe(struct platform_ + + static const struct of_device_id qfprom_of_match[] = { + { .compatible = "qcom,qfprom",}, ++ { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom}, + {/* sentinel */}, + }; + MODULE_DEVICE_TABLE(of, qfprom_of_match); diff --git a/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch b/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch new file mode 100644 index 00000000000..0a05e0a97f5 --- /dev/null +++ b/target/linux/generic/backport-5.10/801-v5.11-0003-nvmem-imx-ocotp-add-support-for-the-unaliged-word-co.patch @@ -0,0 +1,105 @@ +From 3311bf18467272388039922a5e29c4925b291f73 Mon Sep 17 00:00:00 2001 +From: Peng Fan +Date: Fri, 27 Nov 2020 10:28:37 +0000 +Subject: [PATCH] nvmem: imx-ocotp: add support for the unaliged word count + +When offset is not 4 bytes aligned, directly shift righty by 2 bits +will cause reading out wrong data. Since imx ocotp only supports +4 bytes reading once, we need handle offset is not 4 bytes aligned +and enlarge the bytes to 4 bytes aligned. After reading finished, +copy the needed data from buffer to caller and free buffer. + +Signed-off-by: Peng Fan +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20201127102837.19366-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 30 ++++++++++++++++++++++++------ + 1 file changed, 24 insertions(+), 6 deletions(-) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -4,6 +4,8 @@ + * + * Copyright (c) 2015 Pengutronix, Philipp Zabel + * ++ * Copyright 2019 NXP ++ * + * Based on the barebox ocotp driver, + * Copyright (c) 2010 Baruch Siach , + * Orex Computed Radiography +@@ -158,22 +160,30 @@ static int imx_ocotp_read(void *context, + { + struct ocotp_priv *priv = context; + unsigned int count; +- u32 *buf = val; ++ u8 *buf, *p; + int i, ret; +- u32 index; ++ u32 index, num_bytes; + + index = offset >> 2; +- count = bytes >> 2; ++ num_bytes = round_up((offset % 4) + bytes, 4); ++ count = num_bytes >> 2; + + if (count > (priv->params->nregs - index)) + count = priv->params->nregs - index; + ++ p = kzalloc(num_bytes, GFP_KERNEL); ++ if (!p) ++ return -ENOMEM; ++ + mutex_lock(&ocotp_mutex); + ++ buf = p; ++ + ret = clk_prepare_enable(priv->clk); + if (ret < 0) { + mutex_unlock(&ocotp_mutex); + dev_err(priv->dev, "failed to prepare/enable ocotp clk\n"); ++ kfree(p); + return ret; + } + +@@ -184,7 +194,7 @@ static int imx_ocotp_read(void *context, + } + + for (i = index; i < (index + count); i++) { +- *buf++ = readl(priv->base + IMX_OCOTP_OFFSET_B0W0 + ++ *(u32 *)buf = readl(priv->base + IMX_OCOTP_OFFSET_B0W0 + + i * IMX_OCOTP_OFFSET_PER_WORD); + + /* 47.3.1.2 +@@ -193,13 +203,21 @@ static int imx_ocotp_read(void *context, + * software before any new write, read or reload access can be + * issued + */ +- if (*(buf - 1) == IMX_OCOTP_READ_LOCKED_VAL) ++ if (*((u32 *)buf) == IMX_OCOTP_READ_LOCKED_VAL) + imx_ocotp_clr_err_if_set(priv); ++ ++ buf += 4; + } + ++ index = offset % 4; ++ memcpy(val, &p[index], bytes); ++ + read_end: + clk_disable_unprepare(priv->clk); + mutex_unlock(&ocotp_mutex); ++ ++ kfree(p); ++ + return ret; + } + +@@ -447,7 +465,7 @@ static struct nvmem_config imx_ocotp_nvm + .name = "imx-ocotp", + .read_only = false, + .word_size = 4, +- .stride = 4, ++ .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, + }; diff --git a/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch b/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch new file mode 100644 index 00000000000..9a7ba7f565c --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0002-nvmem-imx-iim-Use-of_device_get_match_data.patch @@ -0,0 +1,41 @@ +From 579db09c6106977c0496f2cca48606b289df4bdf Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Fri, 29 Jan 2021 17:14:27 +0000 +Subject: [PATCH] nvmem: imx-iim: Use of_device_get_match_data() + +The retrieval of driver data via of_device_get_match_data() can make +the code simpler. + +Use of_device_get_match_data() to simplify the code. + +Signed-off-by: Fabio Estevam +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210129171430.11328-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-iim.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +--- a/drivers/nvmem/imx-iim.c ++++ b/drivers/nvmem/imx-iim.c +@@ -96,7 +96,6 @@ MODULE_DEVICE_TABLE(of, imx_iim_dt_ids); + + static int imx_iim_probe(struct platform_device *pdev) + { +- const struct of_device_id *of_id; + struct device *dev = &pdev->dev; + struct iim_priv *iim; + struct nvmem_device *nvmem; +@@ -111,11 +110,7 @@ static int imx_iim_probe(struct platform + if (IS_ERR(iim->base)) + return PTR_ERR(iim->base); + +- of_id = of_match_device(imx_iim_dt_ids, dev); +- if (!of_id) +- return -ENODEV; +- +- drvdata = of_id->data; ++ drvdata = of_device_get_match_data(&pdev->dev); + + iim->clk = devm_clk_get(dev, NULL); + if (IS_ERR(iim->clk)) diff --git a/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch b/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch new file mode 100644 index 00000000000..f3ed563d201 --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0003-nvmem-Add-driver-to-expose-reserved-memory-as-nvmem.patch @@ -0,0 +1,160 @@ +From 5a3fa75a4d9cb6bcfc9081ef224a4cdcd4b3eafe Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Fri, 29 Jan 2021 17:14:29 +0000 +Subject: [PATCH] nvmem: Add driver to expose reserved memory as nvmem + +Firmware/co-processors might use reserved memory areas in order to pass +data stemming from an nvmem device otherwise non accessible to Linux. +For example an EEPROM memory only physically accessible to firmware, or +data only accessible early at boot time. + +In order to expose this data to other drivers and user-space, the driver +models the reserved memory area as an nvmem device. + +Tested-by: Tim Gover +Reviewed-by: Rob Herring +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210129171430.11328-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/rmem.c | 97 ++++++++++++++++++++++++++++++++++++++++++ + drivers/of/platform.c | 1 + + 4 files changed, 108 insertions(+) + create mode 100644 drivers/nvmem/rmem.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -270,4 +270,12 @@ config SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ help ++ This drivers maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o + obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o +--- /dev/null ++++ b/drivers/nvmem/rmem.c +@@ -0,0 +1,97 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2020 Nicolas Saenz Julienne ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct rmem { ++ struct device *dev; ++ struct nvmem_device *nvmem; ++ struct reserved_mem *mem; ++ ++ phys_addr_t size; ++}; ++ ++static int rmem_read(void *context, unsigned int offset, ++ void *val, size_t bytes) ++{ ++ struct rmem *priv = context; ++ size_t available = priv->mem->size; ++ loff_t off = offset; ++ void *addr; ++ int count; ++ ++ /* ++ * Only map the reserved memory at this point to avoid potential rogue ++ * kernel threads inadvertently modifying it. Based on the current ++ * uses-cases for this driver, the performance hit isn't a concern. ++ * Nor is likely to be, given the nature of the subsystem. Most nvmem ++ * devices operate over slow buses to begin with. ++ * ++ * An alternative would be setting the memory as RO, set_memory_ro(), ++ * but as of Dec 2020 this isn't possible on arm64. ++ */ ++ addr = memremap(priv->mem->base, available, MEMREMAP_WB); ++ if (IS_ERR(addr)) { ++ dev_err(priv->dev, "Failed to remap memory region\n"); ++ return PTR_ERR(addr); ++ } ++ ++ count = memory_read_from_buffer(val, bytes, &off, addr, available); ++ ++ memunmap(addr); ++ ++ return count; ++} ++ ++static int rmem_probe(struct platform_device *pdev) ++{ ++ struct nvmem_config config = { }; ++ struct device *dev = &pdev->dev; ++ struct reserved_mem *mem; ++ struct rmem *priv; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ priv->dev = dev; ++ ++ mem = of_reserved_mem_lookup(dev->of_node); ++ if (!mem) { ++ dev_err(dev, "Failed to lookup reserved memory\n"); ++ return -EINVAL; ++ } ++ priv->mem = mem; ++ ++ config.dev = dev; ++ config.priv = priv; ++ config.name = "rmem"; ++ config.size = mem->size; ++ config.reg_read = rmem_read; ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config)); ++} ++ ++static const struct of_device_id rmem_match[] = { ++ { .compatible = "nvmem-rmem", }, ++ { /* sentinel */ }, ++}; ++MODULE_DEVICE_TABLE(of, rmem_match); ++ ++static struct platform_driver rmem_driver = { ++ .probe = rmem_probe, ++ .driver = { ++ .name = "rmem", ++ .of_match_table = rmem_match, ++ }, ++}; ++module_platform_driver(rmem_driver); ++ ++MODULE_AUTHOR("Nicolas Saenz Julienne "); ++MODULE_DESCRIPTION("Reserved Memory Based nvmem Driver"); ++MODULE_LICENSE("GPL"); +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -511,6 +511,7 @@ static const struct of_device_id reserve + { .compatible = "qcom,rmtfs-mem" }, + { .compatible = "qcom,cmd-db" }, + { .compatible = "ramoops" }, ++ { .compatible = "nvmem-rmem" }, + {} + }; + diff --git a/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch b/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch new file mode 100644 index 00000000000..129d070a62b --- /dev/null +++ b/target/linux/generic/backport-5.10/802-v5.12-0005-nvmem-Kconfig-Correct-typo-in-NVMEM_RMEM.patch @@ -0,0 +1,28 @@ +From b31f1eb41c140d7979f855df73064b3a3ae8055a Mon Sep 17 00:00:00 2001 +From: Nicolas Saenz Julienne +Date: Fri, 5 Feb 2021 10:08:52 +0000 +Subject: [PATCH] nvmem: Kconfig: Correct typo in NVMEM_RMEM + +s/drivers/driver/ as the configuration selects a single driver. + +Suggested-by: Randy Dunlap +Acked-by: Randy Dunlap +Signed-off-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210205100853.32372-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -273,7 +273,7 @@ config SPRD_EFUSE + config NVMEM_RMEM + tristate "Reserved Memory Based Driver Support" + help +- This drivers maps reserved memory into an nvmem device. It might be ++ This driver maps reserved memory into an nvmem device. It might be + useful to expose information left by firmware in memory. + + This driver can also be built as a module. If so, the module diff --git a/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch b/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch new file mode 100644 index 00000000000..b611ffe645a --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0001-nvmem-convert-comma-to-semicolon.patch @@ -0,0 +1,39 @@ +From e050f160d4832ce5227fb6ca934969cec0fc48be Mon Sep 17 00:00:00 2001 +From: Zheng Yongjun +Date: Tue, 30 Mar 2021 12:12:33 +0100 +Subject: [PATCH] nvmem: convert comma to semicolon + +Replace a comma between expression statements by a semicolon. + +Reviewed-by: Bjorn Andersson +Signed-off-by: Zheng Yongjun +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qcom-spmi-sdam.c | 2 +- + drivers/nvmem/snvs_lpgpr.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qcom-spmi-sdam.c ++++ b/drivers/nvmem/qcom-spmi-sdam.c +@@ -141,7 +141,7 @@ static int sdam_probe(struct platform_de + sdam->sdam_config.dev = &pdev->dev; + sdam->sdam_config.name = "spmi_sdam"; + sdam->sdam_config.id = NVMEM_DEVID_AUTO; +- sdam->sdam_config.owner = THIS_MODULE, ++ sdam->sdam_config.owner = THIS_MODULE; + sdam->sdam_config.stride = 1; + sdam->sdam_config.word_size = 1; + sdam->sdam_config.reg_read = sdam_read; +--- a/drivers/nvmem/snvs_lpgpr.c ++++ b/drivers/nvmem/snvs_lpgpr.c +@@ -123,7 +123,7 @@ static int snvs_lpgpr_probe(struct platf + cfg->dev = dev; + cfg->stride = 4; + cfg->word_size = 4; +- cfg->size = dcfg->size, ++ cfg->size = dcfg->size; + cfg->owner = THIS_MODULE; + cfg->reg_read = snvs_lpgpr_read; + cfg->reg_write = snvs_lpgpr_write; diff --git a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch b/target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch similarity index 86% rename from target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch rename to target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch index 3a8940b36ae..17be01c14f1 100644 --- a/target/linux/bcm53xx/patches-5.10/080-v5.13-0002-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch +++ b/target/linux/generic/backport-5.10/803-v5.13-0003-nvmem-brcm_nvram-new-driver-exposing-Broadcom-s-NVRA.patch @@ -1,6 +1,6 @@ -From b152bbeb0282bfcf6f91d0d5befd7582c1c3fc23 Mon Sep 17 00:00:00 2001 +From 3fef9ed0627af30753a2404b8bd59d92cdb4c0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Fri, 5 Mar 2021 19:32:36 +0100 +Date: Tue, 30 Mar 2021 12:12:36 +0100 Subject: [PATCH] nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -10,6 +10,8 @@ This driver provides access to Broadcom's NVRAM. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/Kconfig | 9 +++++ drivers/nvmem/Makefile | 2 + @@ -19,10 +21,10 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -283,4 +283,13 @@ config NVMEM_U_BOOT_ENV - - If compiled as module it will be called nvmem_u-boot-env. +@@ -278,4 +278,13 @@ config NVMEM_RMEM + This driver can also be built as a module. If so, the module + will be called nvmem-rmem. + +config NVMEM_BRCM_NVRAM + tristate "Broadcom's NVRAM support" @@ -37,8 +39,8 @@ Signed-off-by: Srinivas Kandagatla +++ b/drivers/nvmem/Makefile @@ -57,3 +57,5 @@ obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_e nvmem_sprd_efuse-y := sprd-efuse.o - obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o - nvmem_u-boot-env-y := u-boot-env.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +nvmem_brcm_nvram-y := brcm_nvram.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch new file mode 100644 index 00000000000..ff2456722f9 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0004-nvmem-core-Add-functions-to-make-number-reading-easy.patch @@ -0,0 +1,174 @@ +From a28e824fb8270eda43fd0f65c2a5fdf33f55c5eb Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Tue, 30 Mar 2021 12:12:37 +0100 +Subject: [PATCH] nvmem: core: Add functions to make number reading easy + +Sometimes the clients of nvmem just want to get a number out of +nvmem. They don't want to think about exactly how many bytes the nvmem +cell took up. They just want the number. Let's make it easy. + +In general this concept is useful because nvmem space is precious and +usually the fewest bits are allocated that will hold a given value on +a given system. However, even though small numbers might be fine on +one system that doesn't mean that logically the number couldn't be +bigger. Imagine nvmem containing a max frequency for a component. On +one system perhaps that fits in 16 bits. On another system it might +fit in 32 bits. The code reading this number doesn't care--it just +wants the number. + +We'll provide two functions: nvmem_cell_read_variable_le_u32() and +nvmem_cell_read_variable_le_u64(). + +Comparing these to the existing functions like nvmem_cell_read_u32(): +* These new functions have no problems if the value was stored in + nvmem in fewer bytes. It's OK to use these function as long as the + value stored will fit in 32-bits (or 64-bits). +* These functions avoid problems that the earlier APIs had with bit + offsets. For instance, you can't use nvmem_cell_read_u32() to read a + value has nbits=32 and bit_offset=4 because the nvmem cell must be + at least 5 bytes big to hold this value. The new API accounts for + this and works fine. +* These functions make it very explicit that they assume that the + number was stored in little endian format. The old functions made + this assumption whenever bit_offset was non-zero (see + nvmem_shift_read_buffer_in_place()) but didn't whenever the + bit_offset was zero. + +NOTE: it's assumed that we don't need an 8-bit or 16-bit version of +this function. The 32-bit version of the function can be used to read +8-bit or 16-bit data. + +At the moment, I'm only adding the "unsigned" versions of these +functions, but if it ends up being useful someone could add a "signed" +version that did 2's complement sign extension. + +At the moment, I'm only adding the "little endian" versions of these +functions. Adding the "big endian" version would require adding "big +endian" support to nvmem_shift_read_buffer_in_place(). + +Signed-off-by: Douglas Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 95 ++++++++++++++++++++++++++++++++++ + include/linux/nvmem-consumer.h | 4 ++ + 2 files changed, 99 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1612,6 +1612,101 @@ int nvmem_cell_read_u64(struct device *d + } + EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); + ++static void *nvmem_cell_read_variable_common(struct device *dev, ++ const char *cell_id, ++ size_t max_len, size_t *len) ++{ ++ struct nvmem_cell *cell; ++ int nbits; ++ void *buf; ++ ++ cell = nvmem_cell_get(dev, cell_id); ++ if (IS_ERR(cell)) ++ return cell; ++ ++ nbits = cell->nbits; ++ buf = nvmem_cell_read(cell, len); ++ nvmem_cell_put(cell); ++ if (IS_ERR(buf)) ++ return buf; ++ ++ /* ++ * If nbits is set then nvmem_cell_read() can significantly exaggerate ++ * the length of the real data. Throw away the extra junk. ++ */ ++ if (nbits) ++ *len = DIV_ROUND_UP(nbits, 8); ++ ++ if (*len > max_len) { ++ kfree(buf); ++ return ERR_PTR(-ERANGE); ++ } ++ ++ return buf; ++} ++ ++/** ++ * nvmem_cell_read_variable_le_u32() - Read up to 32-bits of data as a little endian number. ++ * ++ * @dev: Device that requests the nvmem cell. ++ * @cell_id: Name of nvmem cell to read. ++ * @val: pointer to output value. ++ * ++ * Return: 0 on success or negative errno. ++ */ ++int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, ++ u32 *val) ++{ ++ size_t len; ++ u8 *buf; ++ int i; ++ ++ buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); ++ if (IS_ERR(buf)) ++ return PTR_ERR(buf); ++ ++ /* Copy w/ implicit endian conversion */ ++ *val = 0; ++ for (i = 0; i < len; i++) ++ *val |= buf[i] << (8 * i); ++ ++ kfree(buf); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(nvmem_cell_read_variable_le_u32); ++ ++/** ++ * nvmem_cell_read_variable_le_u64() - Read up to 64-bits of data as a little endian number. ++ * ++ * @dev: Device that requests the nvmem cell. ++ * @cell_id: Name of nvmem cell to read. ++ * @val: pointer to output value. ++ * ++ * Return: 0 on success or negative errno. ++ */ ++int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, ++ u64 *val) ++{ ++ size_t len; ++ u8 *buf; ++ int i; ++ ++ buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); ++ if (IS_ERR(buf)) ++ return PTR_ERR(buf); ++ ++ /* Copy w/ implicit endian conversion */ ++ *val = 0; ++ for (i = 0; i < len; i++) ++ *val |= buf[i] << (8 * i); ++ ++ kfree(buf); ++ ++ return 0; ++} ++EXPORT_SYMBOL_GPL(nvmem_cell_read_variable_le_u64); ++ + /** + * nvmem_device_cell_read() - Read a given nvmem device and cell + * +--- a/include/linux/nvmem-consumer.h ++++ b/include/linux/nvmem-consumer.h +@@ -65,6 +65,10 @@ int nvmem_cell_read_u8(struct device *de + int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); + int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); + int nvmem_cell_read_u64(struct device *dev, const char *cell_id, u64 *val); ++int nvmem_cell_read_variable_le_u32(struct device *dev, const char *cell_id, ++ u32 *val); ++int nvmem_cell_read_variable_le_u64(struct device *dev, const char *cell_id, ++ u64 *val); + + /* direct nvmem device read/write interface */ + struct nvmem_device *nvmem_device_get(struct device *dev, const char *name); diff --git a/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch new file mode 100644 index 00000000000..72133d3a350 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0005-nvmem-core-Fix-unintentional-sign-extension-issue.patch @@ -0,0 +1,34 @@ +From 55022fdeace8e432f008787ce03703bdcc9c3ca9 Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Tue, 30 Mar 2021 12:12:38 +0100 +Subject: [PATCH] nvmem: core: Fix unintentional sign extension issue + +The shifting of the u8 integer buf[3] by 24 bits to the left will +be promoted to a 32 bit signed int and then sign-extended to a +u64. In the event that the top bit of buf[3] is set then all +then all the upper 32 bits of the u64 end up as also being set +because of the sign-extension. Fix this by casting buf[i] to +a u64 before the shift. + +Fixes: a28e824fb827 ("nvmem: core: Add functions to make number reading easy") +Reviewed-by: Douglas Anderson +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Addresses-Coverity: ("Unintended sign extension") +Link: https://lore.kernel.org/r/20210330111241.19401-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1699,7 +1699,7 @@ int nvmem_cell_read_variable_le_u64(stru + /* Copy w/ implicit endian conversion */ + *val = 0; + for (i = 0; i < len; i++) +- *val |= buf[i] << (8 * i); ++ *val |= (uint64_t)buf[i] << (8 * i); + + kfree(buf); + diff --git a/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch b/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch new file mode 100644 index 00000000000..9e13fb67083 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0006-nvmem-rmem-fix-undefined-reference-to-memremap.patch @@ -0,0 +1,29 @@ +From cc1bc56fdc76a55bb8fae9a145a2e60bf22fb129 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Tue, 30 Mar 2021 12:12:39 +0100 +Subject: [PATCH] nvmem: rmem: fix undefined reference to memremap + +Fix below error reporte by kernel test robot +rmem.c:(.text+0x14e): undefined reference to memremap +s390x-linux-gnu-ld: rmem.c:(.text+0x1b6): undefined reference to memunmap + +Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") +Reported-by: kernel test robot +Reviewed-by: Nicolas Saenz Julienne +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -272,6 +272,7 @@ config SPRD_EFUSE + + config NVMEM_RMEM + tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM + help + This driver maps reserved memory into an nvmem device. It might be + useful to expose information left by firmware in memory. diff --git a/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch b/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch new file mode 100644 index 00000000000..0e75d4c93d7 --- /dev/null +++ b/target/linux/generic/backport-5.10/803-v5.13-0007-nvmem-qfprom-Add-support-for-fuse-blowing-on-sc7280.patch @@ -0,0 +1,102 @@ +From 5a1bea2a2572ce5eb4bdcf432a6929681ee381f2 Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Tue, 30 Mar 2021 12:12:41 +0100 +Subject: [PATCH] nvmem: qfprom: Add support for fuse blowing on sc7280 + +Handle the differences across LDO voltage needed for blowing fuses, +and the blow timer value, identified using a minor version of 15 +on sc7280. + +Signed-off-by: Rajendra Nayak +Signed-off-by: Ravi Kumar Bokka +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210330111241.19401-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -45,11 +45,13 @@ MODULE_PARM_DESC(read_raw_data, "Read ra + * @qfprom_blow_timer_value: The timer value of qfprom when doing efuse blow. + * @qfprom_blow_set_freq: The frequency required to set when we start the + * fuse blowing. ++ * @qfprom_blow_uV: LDO voltage to be set when doing efuse blow + */ + struct qfprom_soc_data { + u32 accel_value; + u32 qfprom_blow_timer_value; + u32 qfprom_blow_set_freq; ++ int qfprom_blow_uV; + }; + + /** +@@ -111,6 +113,15 @@ static const struct qfprom_soc_compatibl + .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout) + }; + ++static const struct nvmem_keepout sc7280_qfprom_keepout[] = { ++ {.start = 0x128, .end = 0x148}, ++ {.start = 0x238, .end = 0x248} ++}; ++ ++static const struct qfprom_soc_compatible_data sc7280_qfprom = { ++ .keepout = sc7280_qfprom_keepout, ++ .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout) ++}; + /** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. +@@ -168,6 +179,7 @@ static int qfprom_enable_fuse_blowing(co + struct qfprom_touched_values *old) + { + int ret; ++ int qfprom_blow_uV = priv->soc_data->qfprom_blow_uV; + + ret = clk_prepare_enable(priv->secclk); + if (ret) { +@@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(co + * a rail shared do don't specify a max--regulator constraints + * will handle. + */ +- ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX); ++ ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX); + if (ret) { +- dev_err(priv->dev, "Failed to set 1.8 voltage\n"); ++ dev_err(priv->dev, "Failed to set %duV\n", qfprom_blow_uV); + goto err_clk_rate_set; + } + +@@ -311,6 +323,14 @@ static const struct qfprom_soc_data qfpr + .accel_value = 0xD10, + .qfprom_blow_timer_value = 25, + .qfprom_blow_set_freq = 4800000, ++ .qfprom_blow_uV = 1800000, ++}; ++ ++static const struct qfprom_soc_data qfprom_7_15_data = { ++ .accel_value = 0xD08, ++ .qfprom_blow_timer_value = 24, ++ .qfprom_blow_set_freq = 4800000, ++ .qfprom_blow_uV = 1900000, + }; + + static int qfprom_probe(struct platform_device *pdev) +@@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_ + + if (major_version == 7 && minor_version == 8) + priv->soc_data = &qfprom_7_8_data; ++ if (major_version == 7 && minor_version == 15) ++ priv->soc_data = &qfprom_7_15_data; + + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); + if (IS_ERR(priv->vcc)) +@@ -405,6 +427,7 @@ static int qfprom_probe(struct platform_ + static const struct of_device_id qfprom_of_match[] = { + { .compatible = "qcom,qfprom",}, + { .compatible = "qcom,sc7180-qfprom", .data = &sc7180_qfprom}, ++ { .compatible = "qcom,sc7280-qfprom", .data = &sc7280_qfprom}, + {/* sentinel */}, + }; + MODULE_DEVICE_TABLE(of, qfprom_of_match); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch new file mode 100644 index 00000000000..8c5a55e3646 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0001-nvmem-core-allow-specifying-of_node.patch @@ -0,0 +1,80 @@ +From 1333a6779501f4cc662ff5c8b36b0a22f3a7ddc6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sat, 24 Apr 2021 13:06:04 +0200 +Subject: [PATCH] nvmem: core: allow specifying of_node + +Until now, the of_node of the parent device is used. Some devices +provide more than just the nvmem provider. To avoid name space clashes, +add a way to allow specifying the nvmem cells in subnodes. Consider the +following example: + + flash@0 { + compatible = "jedec,spi-nor"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x000000 0x010000>; + }; + }; + + otp { + compatible = "user-otp"; + #address-cells = <1>; + #size-cells = <1>; + + serial-number@0 { + reg = <0x0 0x8>; + }; + }; + }; + +There the nvmem provider might be the MTD partition or the OTP region of +the flash. + +Add a new config->of_node parameter, which if set, will be used instead +of the parent's of_node. + +Signed-off-by: Michael Walle +Acked-by: Srinivas Kandagatla +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210424110608.15748-2-michael@walle.cc +--- + drivers/nvmem/core.c | 4 +++- + include/linux/nvmem-provider.h | 2 ++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -794,7 +794,9 @@ struct nvmem_device *nvmem_register(cons + nvmem->reg_write = config->reg_write; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; +- if (!config->no_of_node) ++ if (config->of_node) ++ nvmem->dev.of_node = config->of_node; ++ else if (!config->no_of_node) + nvmem->dev.of_node = config->dev->of_node; + + switch (config->id) { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -57,6 +57,7 @@ struct nvmem_keepout { + * @type: Type of the nvmem storage + * @read_only: Device is read-only. + * @root_only: Device is accessibly to root only. ++ * @of_node: If given, this will be used instead of the parent's of_node. + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. +@@ -86,6 +87,7 @@ struct nvmem_config { + enum nvmem_type type; + bool read_only; + bool root_only; ++ struct device_node *of_node; + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; diff --git a/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch b/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch new file mode 100644 index 00000000000..db88328a118 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0002-nvmem-sprd-Fix-an-error-message.patch @@ -0,0 +1,30 @@ +From 20be064ec864086bca7a4eb62c772a397b44afb7 Mon Sep 17 00:00:00 2001 +From: Christophe JAILLET +Date: Fri, 7 May 2021 19:02:48 +0200 +Subject: [PATCH] nvmem: sprd: Fix an error message + +'ret' is known to be 0 here. +The expected error status is stored in 'status', so use it instead. + +Also change %d in %u, because status is an u32, not a int. + +Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support") +Acked-by: Chunyan Zhang +Signed-off-by: Christophe JAILLET +Link: https://lore.kernel.org/r/5bc44aace2fe7e1c91d8b35c8fe31e7134ceab2c.1620406852.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sprd-efuse.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sprd-efuse.c ++++ b/drivers/nvmem/sprd-efuse.c +@@ -234,7 +234,7 @@ static int sprd_efuse_raw_prog(struct sp + status = readl(efuse->base + SPRD_EFUSE_ERR_FLAG); + if (status) { + dev_err(efuse->dev, +- "write error status %d of block %d\n", ret, blk); ++ "write error status %u of block %d\n", status, blk); + + writel(SPRD_EFUSE_ERR_CLR_MASK, + efuse->base + SPRD_EFUSE_ERR_CLR); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch b/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch new file mode 100644 index 00000000000..37694e54242 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0003-nvmem-sunxi_sid-Set-type-to-OTP.patch @@ -0,0 +1,27 @@ +From 78a005a22d5608b266eafa011b093a33284c52ce Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 11 Jun 2021 09:33:45 +0100 +Subject: [PATCH] nvmem: sunxi_sid: Set type to OTP + +This device currently reports an "Unknown" type in sysfs. +Since it is an eFuse hardware device, set its type to OTP. + +Signed-off-by: Samuel Holland +Acked-by: Chen-Yu Tsai +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -142,6 +142,7 @@ static int sunxi_sid_probe(struct platfo + + nvmem_cfg->dev = dev; + nvmem_cfg->name = "sunxi-sid"; ++ nvmem_cfg->type = NVMEM_TYPE_OTP; + nvmem_cfg->read_only = true; + nvmem_cfg->size = cfg->size; + nvmem_cfg->word_size = 1; diff --git a/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch b/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch new file mode 100644 index 00000000000..bcab3e41fd7 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0004-nvmem-qfprom-minor-nit-fixes.patch @@ -0,0 +1,46 @@ +From c813bb37bd32cb967060a2c573fae4ea518d32eb Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Fri, 11 Jun 2021 09:33:46 +0100 +Subject: [PATCH] nvmem: qfprom: minor nit fixes + +Fix a missed newline, change an 'if' to 'else if' and update +a comment which is stale after the merge of '5a1bea2a: nvmem: +qfprom: Add support for fuseblowing on sc7280' + +Signed-off-by: Rajendra Nayak +Reviewed-by: Douglas Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -122,6 +122,7 @@ static const struct qfprom_soc_compatibl + .keepout = sc7280_qfprom_keepout, + .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout) + }; ++ + /** + * qfprom_disable_fuse_blowing() - Undo enabling of fuse blowing. + * @priv: Our driver data. +@@ -195,7 +196,7 @@ static int qfprom_enable_fuse_blowing(co + } + + /* +- * Hardware requires 1.8V min for fuse blowing; this may be ++ * Hardware requires a min voltage for fuse blowing; this may be + * a rail shared do don't specify a max--regulator constraints + * will handle. + */ +@@ -399,7 +400,7 @@ static int qfprom_probe(struct platform_ + + if (major_version == 7 && minor_version == 8) + priv->soc_data = &qfprom_7_8_data; +- if (major_version == 7 && minor_version == 15) ++ else if (major_version == 7 && minor_version == 15) + priv->soc_data = &qfprom_7_15_data; + + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch new file mode 100644 index 00000000000..55c3c5d6fe7 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0005-nvmem-core-constify-nvmem_cell_read_variable_common-.patch @@ -0,0 +1,52 @@ +From 1f7b4d87874624f4beb25253900a25306a193b8b Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Fri, 11 Jun 2021 09:33:47 +0100 +Subject: [PATCH] nvmem: core: constify nvmem_cell_read_variable_common() + return value + +The caller doesn't modify the memory pointed to by the pointer so it +can be const. + +Suggested-by: Stephen Boyd +Signed-off-by: Douglas Anderson +Reviewed-by: Stephen Boyd +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -1614,9 +1614,9 @@ int nvmem_cell_read_u64(struct device *d + } + EXPORT_SYMBOL_GPL(nvmem_cell_read_u64); + +-static void *nvmem_cell_read_variable_common(struct device *dev, +- const char *cell_id, +- size_t max_len, size_t *len) ++static const void *nvmem_cell_read_variable_common(struct device *dev, ++ const char *cell_id, ++ size_t max_len, size_t *len) + { + struct nvmem_cell *cell; + int nbits; +@@ -1660,7 +1660,7 @@ int nvmem_cell_read_variable_le_u32(stru + u32 *val) + { + size_t len; +- u8 *buf; ++ const u8 *buf; + int i; + + buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); +@@ -1691,7 +1691,7 @@ int nvmem_cell_read_variable_le_u64(stru + u64 *val) + { + size_t len; +- u8 *buf; ++ const u8 *buf; + int i; + + buf = nvmem_cell_read_variable_common(dev, cell_id, sizeof(*val), &len); diff --git a/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch b/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch new file mode 100644 index 00000000000..d7ef8e620f1 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0006-nvmem-qfprom-Improve-the-comment-about-regulator-set.patch @@ -0,0 +1,33 @@ +From 989f77e3fdee2e8f414dd1da9b6397d8763d414e Mon Sep 17 00:00:00 2001 +From: Douglas Anderson +Date: Fri, 11 Jun 2021 09:33:48 +0100 +Subject: [PATCH] nvmem: qfprom: Improve the comment about regulator setting + +In review feedback Joe Perches found the existing comment +confusing. Let's use something based on the wording proposed by Joe. + +Suggested-by: Joe Perches +Signed-off-by: Douglas Anderson +Reviewed-by: Stephen Boyd +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210611083348.20170-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -196,9 +196,9 @@ static int qfprom_enable_fuse_blowing(co + } + + /* +- * Hardware requires a min voltage for fuse blowing; this may be +- * a rail shared do don't specify a max--regulator constraints +- * will handle. ++ * Hardware requires a minimum voltage for fuse blowing. ++ * This may be a shared rail so don't specify a maximum. ++ * Regulator constraints will cap to the actual maximum. + */ + ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX); + if (ret) { diff --git a/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch b/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch new file mode 100644 index 00000000000..06c541b8e67 --- /dev/null +++ b/target/linux/generic/backport-5.10/804-v5.14-0007-nvmem-add-NVMEM_TYPE_FRAM.patch @@ -0,0 +1,36 @@ +From: Rafał Miłecki +Subject: [PATCH] nvmem: add NVMEM_TYPE_FRAM + +Signed-off-by: Rafał Miłecki +--- + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -180,6 +180,7 @@ static const char * const nvmem_type_str + [NVMEM_TYPE_EEPROM] = "EEPROM", + [NVMEM_TYPE_OTP] = "OTP", + [NVMEM_TYPE_BATTERY_BACKED] = "Battery backed", ++ [NVMEM_TYPE_FRAM] = "FRAM", + }; + + #ifdef CONFIG_DEBUG_LOCK_ALLOC +@@ -361,6 +362,9 @@ static int nvmem_sysfs_setup_compat(stru + if (!config->base_dev) + return -EINVAL; + ++ if (config->type == NVMEM_TYPE_FRAM) ++ bin_attr_nvmem_eeprom_compat.attr.name = "fram"; ++ + nvmem->eeprom = bin_attr_nvmem_eeprom_compat; + nvmem->eeprom.attr.mode = nvmem_bin_attr_get_umode(nvmem); + nvmem->eeprom.size = nvmem->size; +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -25,6 +25,7 @@ enum nvmem_type { + NVMEM_TYPE_EEPROM, + NVMEM_TYPE_OTP, + NVMEM_TYPE_BATTERY_BACKED, ++ NVMEM_TYPE_FRAM, + }; + + #define NVMEM_DEVID_NONE (-1) diff --git a/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch b/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch new file mode 100644 index 00000000000..b71edd0306d --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0002-nvmem-qfprom-sc7280-Handle-the-additional-power-doma.patch @@ -0,0 +1,89 @@ +From 7b808449f572d07bee840cd9da7e2fe6a1b8f4b5 Mon Sep 17 00:00:00 2001 +From: Rajendra Nayak +Date: Fri, 6 Aug 2021 09:59:46 +0100 +Subject: [PATCH] nvmem: qfprom: sc7280: Handle the additional power-domains + vote + +On sc7280, to reliably blow fuses, we need an additional vote +on max performance state of 'MX' power-domain. +Add support for power-domain performance state voting in the +driver. + +Reviewed-by: Douglas Anderson +Signed-off-by: Rajendra Nayak +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210806085947.22682-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -12,6 +12,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + +@@ -142,6 +144,9 @@ static void qfprom_disable_fuse_blowing( + writel(old->timer_val, priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); + writel(old->accel_val, priv->qfpconf + QFPROM_ACCEL_OFFSET); + ++ dev_pm_genpd_set_performance_state(priv->dev, 0); ++ pm_runtime_put(priv->dev); ++ + /* + * This may be a shared rail and may be able to run at a lower rate + * when we're not blowing fuses. At the moment, the regulator framework +@@ -212,6 +217,14 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + ++ ret = pm_runtime_get_sync(priv->dev); ++ if (ret < 0) { ++ pm_runtime_put_noidle(priv->dev); ++ dev_err(priv->dev, "Failed to enable power-domain\n"); ++ goto err_reg_enable; ++ } ++ dev_pm_genpd_set_performance_state(priv->dev, INT_MAX); ++ + old->timer_val = readl(priv->qfpconf + QFPROM_BLOW_TIMER_OFFSET); + old->accel_val = readl(priv->qfpconf + QFPROM_ACCEL_OFFSET); + writel(priv->soc_data->qfprom_blow_timer_value, +@@ -221,6 +234,8 @@ static int qfprom_enable_fuse_blowing(co + + return 0; + ++err_reg_enable: ++ regulator_disable(priv->vcc); + err_clk_rate_set: + clk_set_rate(priv->secclk, old->clk_rate); + err_clk_prepared: +@@ -320,6 +335,11 @@ static int qfprom_reg_read(void *context + return 0; + } + ++static void qfprom_runtime_disable(void *data) ++{ ++ pm_runtime_disable(data); ++} ++ + static const struct qfprom_soc_data qfprom_7_8_data = { + .accel_value = 0xD10, + .qfprom_blow_timer_value = 25, +@@ -420,6 +440,11 @@ static int qfprom_probe(struct platform_ + econfig.reg_write = qfprom_reg_write; + } + ++ pm_runtime_enable(dev); ++ ret = devm_add_action_or_reset(dev, qfprom_runtime_disable, dev); ++ if (ret) ++ return ret; ++ + nvmem = devm_nvmem_register(dev, &econfig); + + return PTR_ERR_OR_ZERO(nvmem); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch new file mode 100644 index 00000000000..59c9281cdb4 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0003-nvmem-core-fix-error-handling-while-validating-keepo.patch @@ -0,0 +1,36 @@ +From de0534df93474f268486c486ea7e01b44a478026 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Fri, 6 Aug 2021 09:59:47 +0100 +Subject: [PATCH] nvmem: core: fix error handling while validating keepout + regions + +Current error path on failure of validating keepout regions is calling +put_device, eventhough the device is not even registered at that point. + +Fix this by adding proper error handling of freeing ida and nvmem. + +Fixes: fd3bb8f54a88 ("nvmem: core: Add support for keepout regions") +Cc: +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210806085947.22682-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -826,8 +826,11 @@ struct nvmem_device *nvmem_register(cons + + if (nvmem->nkeepout) { + rval = nvmem_validate_keepouts(nvmem); +- if (rval) +- goto err_put_device; ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } + } + + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch b/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch new file mode 100644 index 00000000000..62d9e2aa0f0 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0004-nvmem-nintendo-otp-Add-new-driver-for-the-Wii-and-Wi.patch @@ -0,0 +1,191 @@ +From 3683b761fe3a10ad18515acd5368dd601268cfe5 Mon Sep 17 00:00:00 2001 +From: Emmanuel Gil Peyrot +Date: Tue, 10 Aug 2021 16:30:36 +0100 +Subject: [PATCH] nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This OTP is read-only and contains various keys used by the console to +decrypt, encrypt or verify various pieces of storage. + +Its size depends on the console, it is 128 bytes on the Wii and +1024 bytes on the Wii U (split into eight 128 bytes banks). + +It can be used directly by writing into one register and reading from +the other one, without any additional synchronisation. + +This driver was written based on reversed documentation, see: +https://wiiubrew.org/wiki/Hardware/OTP + +Tested-by: Jonathan Neuschäfer # on Wii +Tested-by: Emmanuel Gil Peyrot # on Wii U +Signed-off-by: Emmanuel Gil Peyrot +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20210810153036.1494-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 11 ++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/nintendo-otp.c | 124 +++++++++++++++++++++++++++++++++++ + 3 files changed, 137 insertions(+) + create mode 100644 drivers/nvmem/nintendo-otp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,17 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config NVMEM_NINTENDO_OTP ++ tristate "Nintendo Wii and Wii U OTP Support" ++ help ++ This is a driver exposing the OTP of a Nintendo Wii or Wii U console. ++ ++ This memory contains common and per-console keys, signatures and ++ related data required to access peripherals. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-nintendo-otp. ++ + config QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -23,6 +23,8 @@ obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem + nvmem_lpc18xx_otp-y := lpc18xx_otp.o + obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o + nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o + obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o + obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o +--- /dev/null ++++ b/drivers/nvmem/nintendo-otp.c +@@ -0,0 +1,124 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Nintendo Wii and Wii U OTP driver ++ * ++ * This is a driver exposing the OTP of a Nintendo Wii or Wii U console. ++ * ++ * This memory contains common and per-console keys, signatures and ++ * related data required to access peripherals. ++ * ++ * Based on reversed documentation from https://wiiubrew.org/wiki/Hardware/OTP ++ * ++ * Copyright (C) 2021 Emmanuel Gil Peyrot ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define HW_OTPCMD 0 ++#define HW_OTPDATA 4 ++#define OTP_READ 0x80000000 ++#define BANK_SIZE 128 ++#define WORD_SIZE 4 ++ ++struct nintendo_otp_priv { ++ void __iomem *regs; ++}; ++ ++struct nintendo_otp_devtype_data { ++ const char *name; ++ unsigned int num_banks; ++}; ++ ++static const struct nintendo_otp_devtype_data hollywood_otp_data = { ++ .name = "wii-otp", ++ .num_banks = 1, ++}; ++ ++static const struct nintendo_otp_devtype_data latte_otp_data = { ++ .name = "wiiu-otp", ++ .num_banks = 8, ++}; ++ ++static int nintendo_otp_reg_read(void *context, ++ unsigned int reg, void *_val, size_t bytes) ++{ ++ struct nintendo_otp_priv *priv = context; ++ u32 *val = _val; ++ int words = bytes / WORD_SIZE; ++ u32 bank, addr; ++ ++ while (words--) { ++ bank = (reg / BANK_SIZE) << 8; ++ addr = (reg / WORD_SIZE) % (BANK_SIZE / WORD_SIZE); ++ iowrite32be(OTP_READ | bank | addr, priv->regs + HW_OTPCMD); ++ *val++ = ioread32be(priv->regs + HW_OTPDATA); ++ reg += WORD_SIZE; ++ } ++ ++ return 0; ++} ++ ++static const struct of_device_id nintendo_otp_of_table[] = { ++ { .compatible = "nintendo,hollywood-otp", .data = &hollywood_otp_data }, ++ { .compatible = "nintendo,latte-otp", .data = &latte_otp_data }, ++ {/* sentinel */}, ++}; ++MODULE_DEVICE_TABLE(of, nintendo_otp_of_table); ++ ++static int nintendo_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ const struct of_device_id *of_id = ++ of_match_device(nintendo_otp_of_table, dev); ++ struct resource *res; ++ struct nvmem_device *nvmem; ++ struct nintendo_otp_priv *priv; ++ ++ struct nvmem_config config = { ++ .stride = WORD_SIZE, ++ .word_size = WORD_SIZE, ++ .reg_read = nintendo_otp_reg_read, ++ .read_only = true, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ priv->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(priv->regs)) ++ return PTR_ERR(priv->regs); ++ ++ if (of_id->data) { ++ const struct nintendo_otp_devtype_data *data = of_id->data; ++ config.name = data->name; ++ config.size = data->num_banks * BANK_SIZE; ++ } ++ ++ config.dev = dev; ++ config.priv = priv; ++ ++ nvmem = devm_nvmem_register(dev, &config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static struct platform_driver nintendo_otp_driver = { ++ .probe = nintendo_otp_probe, ++ .driver = { ++ .name = "nintendo-otp", ++ .of_match_table = nintendo_otp_of_table, ++ }, ++}; ++module_platform_driver(nintendo_otp_driver); ++MODULE_AUTHOR("Emmanuel Gil Peyrot "); ++MODULE_DESCRIPTION("Nintendo Wii and Wii U OTP driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch b/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch new file mode 100644 index 00000000000..02f8b6c5622 --- /dev/null +++ b/target/linux/generic/backport-5.10/805-v5.15-0005-nvmem-NVMEM_NINTENDO_OTP-should-depend-on-WII.patch @@ -0,0 +1,29 @@ +From 7af526c740bdbd5b4dcebba04ace5b3b0c07801f Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Tue, 14 Sep 2021 11:29:49 +0200 +Subject: [PATCH] nvmem: NVMEM_NINTENDO_OTP should depend on WII + +The Nintendo Wii and Wii U OTP is only present on Nintendo Wii and Wii U +consoles. Hence add a dependency on WII, to prevent asking the user +about this driver when configuring a kernel without Nintendo Wii and Wii +U console support. + +Fixes: 3683b761fe3a10ad ("nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP") +Reviewed-by: Emmanuel Gil Peyrot +Signed-off-by: Geert Uytterhoeven +Link: https://lore.kernel.org/r/01318920709dddc4d85fe895e2083ca0eee234d8.1631611652.git.geert+renesas@glider.be +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -109,6 +109,7 @@ config MTK_EFUSE + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" ++ depends on WII || COMPILE_TEST + help + This is a driver exposing the OTP of a Nintendo Wii or Wii U console. + diff --git a/target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch similarity index 95% rename from target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch rename to target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch index 1459d1184eb..a40c61f929e 100644 --- a/target/linux/generic/backport-5.10/801-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch +++ b/target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -29,9 +29,9 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -270,4 +270,17 @@ config SPRD_EFUSE - This driver can also be built as a module. If so, the module - will be called nvmem-sprd-efuse. +@@ -300,4 +300,17 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" @@ -49,10 +49,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -55,3 +55,5 @@ obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynq - nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o - obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o - nvmem_sprd_efuse-y := sprd-efuse.o +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 100% rename from target/linux/generic/backport-5.10/801-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch diff --git a/target/linux/generic/backport-5.10/801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch b/target/linux/generic/backport-5.10/823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch similarity index 100% rename from target/linux/generic/backport-5.10/801-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch rename to target/linux/generic/backport-5.10/823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch diff --git a/target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch b/target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch similarity index 95% rename from target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch rename to target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch index b7870eef4bd..1acc6947fe1 100644 --- a/target/linux/generic/backport-5.10/802-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch +++ b/target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -374,6 +374,7 @@ static int nvmem_cell_info_to_nvmem_cell +@@ -462,6 +462,7 @@ static int nvmem_cell_info_to_nvmem_cell cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; diff --git a/target/linux/generic/backport-5.10/803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.10/825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch similarity index 100% rename from target/linux/generic/backport-5.10/803-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch rename to target/linux/generic/backport-5.10/825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch diff --git a/target/linux/generic/backport-5.10/803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.10/825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch similarity index 100% rename from target/linux/generic/backport-5.10/803-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch rename to target/linux/generic/backport-5.10/825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch diff --git a/target/linux/generic/backport-5.10/803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch similarity index 100% rename from target/linux/generic/backport-5.10/803-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch rename to target/linux/generic/backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index a2dc9b90b1f..01bebbbab42 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -4244,6 +4244,7 @@ CONFIG_NMI_LOG_BUF_SHIFT=13 # CONFIG_NVMEM_BCM_OCOTP is not set # CONFIG_NVMEM_IMX_OCOTP is not set # CONFIG_NVMEM_REBOOT_MODE is not set +# CONFIG_NVMEM_RMEM is not set # CONFIG_NVMEM_SYSFS is not set # CONFIG_NVMEM_U_BOOT_ENV is not set # CONFIG_NVME_FC is not set From 169878a190c2d42ffb5f6d10017e627da852e467 Mon Sep 17 00:00:00 2001 From: Christian Schmidbauer Date: Mon, 2 Jan 2023 22:03:27 +0100 Subject: [PATCH 07/49] github: add command for device This adds a command to the issue template to simplify the "device" name reporting. Signed-off-by: Christian Schmidbauer --- .github/ISSUE_TEMPLATE/bug-report.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index d96591dc98d..fed2b8de7c9 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -32,7 +32,9 @@ body: id: device attributes: label: Device - description: The device exhibiting this bug. + description: | + The device exhibiting this bug (if unsure, use command below). + ```cat /tmp/sysinfo/model``` validations: required: true - type: dropdown From 8342c092a03caedbf160d4ac3982c6a9be91261f Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 9 Dec 2022 15:45:04 -0500 Subject: [PATCH 08/49] ath79: use lzma-loader for Senao initramfs images Some vendors of Senao boards have put a bootloader that cannot handle both large gzip or large lzma files. There is no disadvantage by doing this for all of them. Signed-off-by: Michael Pratt --- target/linux/ath79/image/common-senao.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/image/common-senao.mk b/target/linux/ath79/image/common-senao.mk index e0e60dbe277..9034aa28dbc 100644 --- a/target/linux/ath79/image/common-senao.mk +++ b/target/linux/ath79/image/common-senao.mk @@ -37,6 +37,7 @@ endef define Device/senao_loader_okli $(Device/loader-okli-uimage) KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x73714f4b + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none LOADER_KERNEL_MAGIC := 0x73714f4b IMAGES += factory.bin IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \ From 766de7013fcef2a9d759e056bb40c1cb58cfd65f Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Fri, 9 Dec 2022 17:47:11 -0500 Subject: [PATCH 09/49] ath79: allow skipping hash for Senao sysupgrade Some vendors of Senao boards have a similar flash layout situation that causes the need to split the firmware partition and use the lzma-loader, but do not store checksums of the partitions or otherwise do not even have a uboot environment partition. This adds simple shell logic to skip that part. Also, simplify some lines and variable usage. Signed-off-by: Michael Pratt --- .../lib/upgrade/failsafe_datachk.sh | 28 +++++++++---------- .../base-files/lib/upgrade/platform.sh | 1 + .../lib/upgrade/failsafe_datachk.sh | 28 +++++++++---------- .../tiny/base-files/lib/upgrade/platform.sh | 1 + 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh index de84233de10..23847a1aae4 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/failsafe_datachk.sh @@ -8,8 +8,6 @@ # So the kernel check is for the loader, the rootfs check is for kernel + rootfs platform_do_upgrade_failsafe_datachk() { - local setenv_script="/tmp/fw_env_upgrade" - local flash_base=0x9f000000 local kernel_mtd=$(find_mtd_index ${KERNEL_PART:-kernel}) @@ -34,31 +32,33 @@ platform_do_upgrade_failsafe_datachk() { local rootfs_md5=$($IMAGE_CMD $ROOTFS_FILE | dd bs=4k count=$rootfs_blocks iflag=fullblock | md5sum | cut -d ' ' -f1) # prepare new u-boot-env vars - printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $setenv_script - printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $setenv_script - printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script + printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $ENV_SCRIPT + printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $ENV_SCRIPT + printf "vmlinux_checksum %s\n" ${kernel_md5} >> $ENV_SCRIPT - printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $setenv_script - printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $setenv_script - printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script + printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $ENV_SCRIPT + printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $ENV_SCRIPT + printf "rootfs_checksum %s\n" ${rootfs_md5} >> $ENV_SCRIPT # store u-boot-env mkdir -p /var/lock - fw_setenv -s $setenv_script || { + [ -n "$SKIP_HASH" ] || fw_setenv -s $ENV_SCRIPT || { echo 'failed to update U-Boot environment' exit 1 } # sysupgrade - sleep 2 - sync - echo 3 > /proc/sys/vm/drop_caches + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + $IMAGE_CMD $KERNEL_FILE | mtd $MTD_ARGS write - ${KERNEL_PART:-kernel} - sleep 2 - sync + + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + if [ -n "$UPGRADE_BACKUP" ]; then $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j $UPGRADE_BACKUP write - ${ROOTFS_PART:-rootfs} else $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS write - ${ROOTFS_PART:-rootfs} fi + + sync } diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index c58e0053448..0de3dbf3b51 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -45,6 +45,7 @@ platform_do_upgrade() { watchguard,ap100|\ watchguard,ap200|\ watchguard,ap300) + ENV_SCRIPT="/tmp/fw_env" IMAGE_LIST="tar tzf $1" IMAGE_CMD="tar xzOf $1" KERNEL_PART="loader" diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh index de84233de10..23847a1aae4 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/failsafe_datachk.sh @@ -8,8 +8,6 @@ # So the kernel check is for the loader, the rootfs check is for kernel + rootfs platform_do_upgrade_failsafe_datachk() { - local setenv_script="/tmp/fw_env_upgrade" - local flash_base=0x9f000000 local kernel_mtd=$(find_mtd_index ${KERNEL_PART:-kernel}) @@ -34,31 +32,33 @@ platform_do_upgrade_failsafe_datachk() { local rootfs_md5=$($IMAGE_CMD $ROOTFS_FILE | dd bs=4k count=$rootfs_blocks iflag=fullblock | md5sum | cut -d ' ' -f1) # prepare new u-boot-env vars - printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $setenv_script - printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $setenv_script - printf "vmlinux_checksum %s\n" ${kernel_md5} >> $setenv_script + printf "vmlinux_start_addr 0x%08x\n" $((flash_base + kernel_offset)) >> $ENV_SCRIPT + printf "vmlinux_size 0x%08x\n" ${kernel_size} >> $ENV_SCRIPT + printf "vmlinux_checksum %s\n" ${kernel_md5} >> $ENV_SCRIPT - printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $setenv_script - printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $setenv_script - printf "rootfs_checksum %s\n" ${rootfs_md5} >> $setenv_script + printf "rootfs_start_addr 0x%08x\n" $((flash_base + rootfs_offset)) >> $ENV_SCRIPT + printf "rootfs_size 0x%08x\n" ${rootfs_size} >> $ENV_SCRIPT + printf "rootfs_checksum %s\n" ${rootfs_md5} >> $ENV_SCRIPT # store u-boot-env mkdir -p /var/lock - fw_setenv -s $setenv_script || { + [ -n "$SKIP_HASH" ] || fw_setenv -s $ENV_SCRIPT || { echo 'failed to update U-Boot environment' exit 1 } # sysupgrade - sleep 2 - sync - echo 3 > /proc/sys/vm/drop_caches + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + $IMAGE_CMD $KERNEL_FILE | mtd $MTD_ARGS write - ${KERNEL_PART:-kernel} - sleep 2 - sync + + sleep 2 && sync && echo 3 > /proc/sys/vm/drop_caches + if [ -n "$UPGRADE_BACKUP" ]; then $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j $UPGRADE_BACKUP write - ${ROOTFS_PART:-rootfs} else $IMAGE_CMD $ROOTFS_FILE | mtd $MTD_ARGS write - ${ROOTFS_PART:-rootfs} fi + + sync } diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh index 6d05b88d45c..eb8441c6d26 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh @@ -19,6 +19,7 @@ platform_do_upgrade() { engenius,eap350-v1|\ engenius,ecb350-v1|\ engenius,enh202-v1) + ENV_SCRIPT="/tmp/fw_env" IMAGE_LIST="tar tzf $1" IMAGE_CMD="tar xzOf $1" KERNEL_PART="loader" From 1e3a8f454e46e6c235b972571761a0c6b23a3bfd Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Sat, 10 Dec 2022 06:34:54 -0500 Subject: [PATCH 10/49] base-files: rework mtd_get_mac_text() It's necessary to be able to specify the length for MAC addresses that are stored in flash, for example, in a case where it is stored without any delimiter. Let both offset and length have default values. Add a sanity check related to partition size. Also, clean up syntax and unnecessary lines. Signed-off-by: Michael Pratt --- package/base-files/files/lib/functions/system.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 94ccc02bb8e..d06354b01f4 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -141,10 +141,10 @@ mtd_get_mac_uci_config_ubi() { } mtd_get_mac_text() { - local mtdname=$1 - local offset=$(($2)) + local mtdname="$1" + local offset=$((${2:-0})) + local length="${3:-17}" local part - local mac_dirty part=$(find_mtd_part "$mtdname") if [ -z "$part" ]; then @@ -152,15 +152,9 @@ mtd_get_mac_text() { return fi - if [ -z "$offset" ]; then - echo "mtd_get_mac_text: offset missing!" >&2 - return - fi + [ $((offset + length)) -le $(mtd_get_part_size "$mtdname") ] || return - mac_dirty=$(dd if="$part" bs=1 skip="$offset" count=17 2>/dev/null) - - # "canonicalize" mac - [ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty" + macaddr_canonicalize $(dd bs=1 if="$part" skip="$offset" count="$length" 2>/dev/null) } mtd_get_mac_binary() { From ee87dbb3fef2c0771b20967ec4a8638fdab9c9bf Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 21 Dec 2022 21:33:04 -0500 Subject: [PATCH 11/49] image: add gzip-filename build recipe Some vendors use basic gzip metadata (original filename and timestamp) to verify valid images, along with the size of it's contents. Also, add a new device profile variable FACTORY_IMG_NAME which would be ideal to use with this new recipe. Signed-off-by: Michael Pratt --- include/image-commands.mk | 9 +++++++++ include/image.mk | 2 ++ 2 files changed, 11 insertions(+) diff --git a/include/image-commands.mk b/include/image-commands.mk index 15084093d23..ff8acf96c4f 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -316,6 +316,15 @@ define Build/gzip @mv $@.new $@ endef +define Build/gzip-filename + @mkdir -p $@.tmp + @cp $@ $@.tmp/$(word 1,$(1)) + $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1))) + $(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new + @mv $@.new $@ + @rm -rf $@.tmp +endef + define Build/install-dtb $(call locked, \ $(foreach dts,$(DEVICE_DTS), \ diff --git a/include/image.mk b/include/image.mk index 5d9d4acb414..01bc3bda868 100644 --- a/include/image.mk +++ b/include/image.mk @@ -359,6 +359,7 @@ define Device/Init ARTIFACTS := DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) + FACTORY_IMG_NAME := IMAGE_SIZE := KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) KERNEL_SUFFIX := -kernel.bin @@ -418,6 +419,7 @@ DEFAULT_DEVICE_VARS := \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ + FACTORY_IMG_NAME \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ From e085812a7d7022c4bec948280efbcba738101636 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Mon, 12 Dec 2022 04:55:34 -0500 Subject: [PATCH 12/49] ath79: add support for Fortinet FAP-221-B FCC ID: U2M-CAP4100AG Fortinet FAP-221-B is an indoor access point with 1 Gb ethernet port, dual-band wireless, internal antenna plates, and 802.3at PoE+ Hardware and board design from Senao **Specification:** - AR9344 SOC 2G 2x2, 5G 2x2, 25 MHz CLK - AR9382 WLAN 2G 2x2 PCIe, 40 MHz CLK - AR8035-A PHY RGMII, PoE+ IN, 25 MHz CLK - 16 MB FLASH MX25L12845EMI-10G - 2x 32 MB RAM W9725G6JB-25 - UART at J11 populated, 9600 baud - 6 LEDs, 1 button power, ethernet, wlan, reset Note: ethernet LEDs are not enabled because a new netifd hotplug is required in order to operate like OEM. Board has 1 amber and 1 green for each of the 3 case viewports. **MAC addresses:** 1 MAC Address in flash at end of uboot ASCII encoded, no delimiters Labeled as "MAC Address" on case OEM firmware sets offsets 1 and 8 for wlan eth0 *:1e uboot 0x3ff80 phy0 *:1f uboot 0x3ff80 +1 phy1 *:26 uboot 0x3ff80 +8 **Serial Access:** Pinout: (arrow) VCC GND RX TX Pins are populated with a header and traces not blocked. Bootloader is set to 9600 baud, 8 data, 1 stop. **Console Access:** Bootloader: Interrupt boot with Ctrl+C Press "k" and enter password "1" OR Hold reset button for 5 sec during power on Interrupt the TFTP transfer with Ctrl+C to print commands available, enter "help" OEM: default username is "admin", password blank telnet is available at default address 192.168.1.2 serial is available with baud 9600 to print commands available, enter "help" or tab-tab (busybox list of commands) **Installation:** Use factory.bin with OEM upgrade procedures OR Use initramfs.bin with uboot TFTP commands. Then perform a sysupgrade with sysupgrade.bin **TFTP Recovery:** Using serial console, load initramfs.bin using TFTP to boot openwrt without touching the flash. TFTP is not reliable due to bugged bootloader, set MTU to 600 and try many times. If your TFTP server supports setting block size, higher block size is better. Splitting the file into 1 MB parts may be necessary example: $ tftpboot 0x80100000 image1.bin $ tftpboot 0x80200000 image2.bin $ tftpboot 0x80300000 image3.bin $ tftpboot 0x80400000 image4.bin $ tftpboot 0x80500000 image5.bin $ tftpboot 0x80600000 image6.bin $ bootm 0x80100000 **Return to OEM:** The best way to return to OEM firmware is to have a copy of the MTD partitions before flashing Openwrt. Backup copies should be made of partitions "fwconcat0", "loader", and "fwconcat1" which together is the same flash range as OEM's "rootfs" and "uimage" by loading an initramfs.bin and using LuCI to download the mtdblocks. It is also possible to extract from the OEM firmware upgrade image by splitting it up in parts of lengths that correspond to the partitions in openwrt and write them to flash, after gzip decompression. After writing to the firmware partitions, erase the "reserved" partition and reboot. **OEM firmware image format:** Images from Fortinet for this device ending with the suffix .out are actually a .gz file The gzip metadata stores the original filename before compression, which is a special string used to verify the image during OEM upgrade. After gzip decompression, the resulting file is an exact copy of the MTD partitions "rootfs" and "uimage" combined in the same order and size that they appear in /proc/mtd and as they are on flash. OEM upgrade is performed by a customized busybox with the command "upgrade". Another binary, "restore" is a wrapper for busybox's "tftp" and "upgrade". Signed-off-by: Michael Pratt --- .../ath79/dts/ar9344_fortinet_ap-dual.dtsi | 67 +++++++++++++++++ .../ath79/dts/ar9344_fortinet_fap-221-b.dts | 75 +++++++++++++++++++ .../ath79/dts/ar934x_fortinet_loader.dtsi | 72 ++++++++++++++++++ .../generic/base-files/etc/board.d/02_network | 5 ++ .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 3 + .../base-files/lib/preinit/10_fix_eth_mac.sh | 3 + .../base-files/lib/upgrade/platform.sh | 11 +++ target/linux/ath79/image/generic.mk | 16 ++++ 8 files changed, 252 insertions(+) create mode 100644 target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi create mode 100644 target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts create mode 100644 target/linux/ath79/dts/ar934x_fortinet_loader.dtsi diff --git a/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi new file mode 100644 index 00000000000..d5275c496e3 --- /dev/null +++ b/target/linux/ath79/dts/ar9344_fortinet_ap-dual.dtsi @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344.dtsi" +#include "ar934x_fortinet_loader.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,9600"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + linux,code = ; + }; + }; +}; + +&ref { + clock-frequency = <25000000>; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + eee-broken-100tx; + eee-broken-1000t; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&phy0>; + phy-mode = "rgmii-txid"; + + pll-data = <0x02000000 0x00000101 0x00001313>; +}; + +&pcie { + status = "okay"; + + ath9k: wifi@0,0,0 { + compatible = "pci168c,0030"; + reg = <0x0 0 0 0 0>; + }; +}; + +&wmac { + status = "okay"; +}; diff --git a/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts b/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts new file mode 100644 index 00000000000..b78a588f5cc --- /dev/null +++ b/target/linux/ath79/dts/ar9344_fortinet_fap-221-b.dts @@ -0,0 +1,75 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_fortinet_ap-dual.dtsi" + +/ { + compatible = "fortinet,fap-221-b", "qca,ar9344"; + model = "Fortinet FAP-221-B"; + + leds { + compatible = "gpio-leds"; + + led_power: power_green { + label = "green:power"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + power_amber { + label = "amber:power"; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; + }; + + eth_green { + label = "green:eth"; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + }; + + eth_amber { + label = "amber:eth"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + wifi5g { + label = "green:wifi5g"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi2g { + label = "amber:wifi2g"; + gpios = <&gpio 19 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + virtual_flash { + devices = <&fwconcat0 &fwconcat1 &fwconcat2>; + }; +}; + +&ath9k { + ieee80211-freq-limit = <2402000 2482000>; + + nvmem-cells = <&calibration_pcie>; + nvmem-cell-names = "calibration"; +}; + +&wmac { + ieee80211-freq-limit = <2402000 2482000 4900000 5990000>; + + nvmem-cells = <&calibration_wmac>; + nvmem-cell-names = "calibration"; +}; + +&art { + compatible = "nvmem-cells"; + + calibration_wmac: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_pcie: calibration@5000 { + reg = <0x5000 0x440>; + }; +}; diff --git a/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi b/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi new file mode 100644 index 00000000000..d7cbf2e7379 --- /dev/null +++ b/target/linux/ath79/dts/ar934x_fortinet_loader.dtsi @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include + +/ { + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "openwrt,uimage", "denx,uimage"; + openwrt,ih-magic = <0x73714f4b>; + label = "firmware"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x000000 0x040000>; + read-only; + }; + + fwconcat0: partition@40000 { + label = "fwconcat0"; + reg = <0x040000 0x900000>; + }; + + partition@940000 { + label = "loader"; + reg = <0x940000 0x010000>; + }; + + fwconcat1: partition@950000 { + label = "fwconcat1"; + reg = <0x950000 0x1a0000>; + }; + + fwconcat2: partition@af0000 { + label = "reserved"; + reg = <0xaf0000 0x500000>; + }; + + art: partition@ff0000 { + label = "art"; + reg = <0xff0000 0x010000>; + read-only; + }; + }; + }; +}; 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 92541cd9f8b..8b0fba7c69f 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 @@ -45,6 +45,7 @@ ath79_setup_interfaces() engenius,ecb600|\ enterasys,ws-ap3705i|\ extreme-networks,ws-ap3805i|\ + fortinet,fap-221-b|\ glinet,gl-ar300m-lite|\ glinet,gl-usb150|\ hak5,wifi-pineapple-nano|\ @@ -674,6 +675,10 @@ ath79_setup_macs() enterasys,ws-ap3705i) label_mac=$(mtd_get_mac_ascii u-boot-env0 ethaddr) ;; + fortinet,fap-221-b) + lan_mac=$(mtd_get_mac_text u-boot 0x3ff80 12) + label_mac=$lan_mac + ;; hak5,lan-turtle|\ hak5,packet-squirrel) label_mac=$(mtd_get_mac_binary u-boot 0x1fc00) diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 57458cdef07..74345843f55 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -35,6 +35,9 @@ case "$board" in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress ;; + fortinet,fap-221-b) + macaddr_add "$(mtd_get_mac_text u-boot 0x3ff80 12)" $((PHYNBR*7+1)) > /sys${DEVPATH}/macaddress + ;; iodata,wn-ac1600dgr) # There is no eeprom data for 5 GHz wlan in "art" partition # which would allow to patch the macaddress diff --git a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh index d06f043ad4e..bf40efe72b6 100644 --- a/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh +++ b/target/linux/ath79/generic/base-files/lib/preinit/10_fix_eth_mac.sh @@ -19,6 +19,9 @@ preinit_set_mac_address() { siemens,ws-ap3610) ip link set dev eth0 address $(mtd_get_mac_ascii cfg1 ethaddr) ;; + fortinet,fap-221-b) + ip link set dev eth0 address $(mtd_get_mac_text u-boot 0x3ff80 12) + ;; tplink,deco-s4-v2) base_mac=$(mtd_get_mac_encrypted_deco $(find_mtd_part config)) ip link set dev eth0 address $base_mac diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index 0de3dbf3b51..d03163a8eaf 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -54,6 +54,17 @@ platform_do_upgrade() { ROOTFS_FILE="root.squashfs" platform_do_upgrade_failsafe_datachk "$1" ;; + fortinet,fap-221-b) + SKIP_HASH="1" + ENV_SCRIPT="/dev/null" + IMAGE_LIST="tar tzf $1" + IMAGE_CMD="tar xzOf $1" + KERNEL_PART="loader" + ROOTFS_PART="fwconcat0" + KERNEL_FILE="uImage-lzma.bin" + ROOTFS_FILE="root.squashfs" + platform_do_upgrade_failsafe_datachk "$1" + ;; jjplus,ja76pf2) platform_do_upgrade_redboot_fis "$1" linux ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index a19412498a3..59bc449f125 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1324,6 +1324,22 @@ define Device/extreme-networks_ws-ap3805i endef TARGET_DEVICES += extreme-networks_ws-ap3805i +define Device/fortinet_fap-221-b + $(Device/senao_loader_okli) + SOC := ar9344 + DEVICE_VENDOR := Fortinet + DEVICE_MODEL := FAP-221-B + FACTORY_IMG_NAME := FP221B-9.99-AP-build999-999999-patch99 + IMAGE_SIZE := 9216k + LOADER_FLASH_OFFS := 0x040000 + IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | \ + check-size | pad-to $$$$(IMAGE_SIZE) | \ + append-loader-okli-uimage $(1) | pad-to 10944k | \ + gzip-filename $$$$(FACTORY_IMG_NAME) +endef +TARGET_DEVICES += fortinet_fap-221-b + define Device/glinet_6408 $(Device/tplink-8mlzma) SOC := ar9331 From 2fab942ce1171a7c5dbe08369b435e7fa9a7d56b Mon Sep 17 00:00:00 2001 From: Vincent Tremblay Date: Sun, 1 Jan 2023 14:16:08 -0500 Subject: [PATCH 13/49] generic: fix silicon labs spidev bindings Fix Silicon Labs bindings in the spidev driver Some bindings for Silicon Labs chips already exists upstream. These bindings can be found in trivial-devices.yaml. The existing bindings are using "silabs" instead of "siliconlabs" to identify the manufacturer. This commit add two submitted patches for silabs chips and rename the manufacturer in the different DTS for more coherence. Signed-off-by: Vincent Tremblay --- ...ompletely-disable-the-spidev-warning.patch | 2 +- ...ilicon-Labs-EM3581-device-compatible.patch | 21 ++++++++++++ ...ilicon-Labs-SI3210-device-compatible.patch | 22 +++++++++++++ ...0-add-linux-spidev-compatible-si3210.patch | 18 ----------- ...ilicon-Labs-EM3581-device-compatible.patch | 32 +++++++++++++++++++ ...ilicon-Labs-SI3210-device-compatible.patch | 32 +++++++++++++++++++ ...0-add-linux-spidev-compatible-si3210.patch | 18 ----------- .../arm/boot/dts/qcom-ipq4019-gl-b2200.dts | 2 +- .../arm/boot/dts/qcom-ipq4029-gl-s1300.dts | 2 +- .../ramips/dts/rt5350_dlink_dwr-512-b.dts | 2 +- 10 files changed, 111 insertions(+), 40 deletions(-) create mode 100644 target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch create mode 100644 target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch delete mode 100644 target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch create mode 100644 target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch create mode 100644 target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch delete mode 100644 target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch diff --git a/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch b/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch index d9eb7a03569..ff9a6b09a27 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0040-spi-spidev-Completely-disable-the-spidev-warning.patch @@ -13,7 +13,7 @@ Signed-off-by: Phil Elwell --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c -@@ -758,7 +758,7 @@ static int spidev_probe(struct spi_devic +@@ -761,7 +761,7 @@ static int spidev_probe(struct spi_devic * compatible string, it is a Linux implementation thing * rather than a description of the hardware. */ diff --git a/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch b/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch new file mode 100644 index 00000000000..cdb165e19df --- /dev/null +++ b/target/linux/generic/pending-5.10/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch @@ -0,0 +1,21 @@ +From f7982c726e02001afc19052fe48f642dfcbc00b2 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Mon, 26 Dec 2022 21:10:37 -0500 +Subject: [PATCH 1/2] spidev: Add Silicon Labs EM3581 device compatible + +Add compatible string for Silicon Labs EM3581 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -682,6 +682,7 @@ static const struct of_device_id spidev_ + { .compatible = "lwn,bk4" }, + { .compatible = "dh,dhcom-board" }, + { .compatible = "menlo,m53cpld" }, ++ { .compatible = "silabs,em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch b/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch new file mode 100644 index 00000000000..069e29255d2 --- /dev/null +++ b/target/linux/generic/pending-5.10/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch @@ -0,0 +1,22 @@ +From 536581825219e97fa2ae0c4de35605d2f6311416 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Tue, 27 Dec 2022 09:00:58 -0500 +Subject: [PATCH 2/2] spidev: Add Silicon Labs SI3210 device compatible + +Add compatible string for Silicon Labs SI3210 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -683,6 +683,7 @@ static const struct of_device_id spidev_ + { .compatible = "dh,dhcom-board" }, + { .compatible = "menlo,m53cpld" }, + { .compatible = "silabs,em3581" }, ++ { .compatible = "silabs,si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index 355e900a3b3..00000000000 --- a/target/linux/generic/pending-5.10/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -682,6 +682,7 @@ static const struct of_device_id spidev_ - { .compatible = "lwn,bk4" }, - { .compatible = "dh,dhcom-board" }, - { .compatible = "menlo,m53cpld" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch b/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch new file mode 100644 index 00000000000..f5e0c858b25 --- /dev/null +++ b/target/linux/generic/pending-5.15/110-v6.3-0001-spidev-Add-Silicon-Labs-EM3581-device-compatible.patch @@ -0,0 +1,32 @@ +From f7982c726e02001afc19052fe48f642dfcbc00b2 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Mon, 26 Dec 2022 21:10:37 -0500 +Subject: [PATCH 1/2] spidev: Add Silicon Labs EM3581 device compatible + +Add compatible string for Silicon Labs EM3581 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -693,6 +693,7 @@ static const struct spi_device_id spidev + { .name = "m53cpld" }, + { .name = "spi-petra" }, + { .name = "spi-authenta" }, ++ { .name = "em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(spi, spidev_spi_ids); +@@ -707,6 +708,7 @@ static const struct of_device_id spidev_ + { .compatible = "menlo,m53cpld" }, + { .compatible = "cisco,spi-petra" }, + { .compatible = "micron,spi-authenta" }, ++ { .compatible = "silabs,em3581" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch b/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch new file mode 100644 index 00000000000..575c893d508 --- /dev/null +++ b/target/linux/generic/pending-5.15/110-v6.3-0002-spidev-Add-Silicon-Labs-SI3210-device-compatible.patch @@ -0,0 +1,32 @@ +From 536581825219e97fa2ae0c4de35605d2f6311416 Mon Sep 17 00:00:00 2001 +From: Vincent Tremblay +Date: Tue, 27 Dec 2022 09:00:58 -0500 +Subject: [PATCH 2/2] spidev: Add Silicon Labs SI3210 device compatible + +Add compatible string for Silicon Labs SI3210 device. + +Note: This patch is adapted from a patch submitted to the for-next branch (v6.3). + +Signed-off-by: Vincent Tremblay +--- + drivers/spi/spidev.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -694,6 +694,7 @@ static const struct spi_device_id spidev + { .name = "spi-petra" }, + { .name = "spi-authenta" }, + { .name = "em3581" }, ++ { .name = "si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(spi, spidev_spi_ids); +@@ -709,6 +710,7 @@ static const struct of_device_id spidev_ + { .compatible = "cisco,spi-petra" }, + { .compatible = "micron,spi-authenta" }, + { .compatible = "silabs,em3581" }, ++ { .compatible = "silabs,si3210" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch b/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch deleted file mode 100644 index 69949a69ac4..00000000000 --- a/target/linux/generic/pending-5.15/130-add-linux-spidev-compatible-si3210.patch +++ /dev/null @@ -1,18 +0,0 @@ -From: Giuseppe Lippolis -Subject: Add the linux,spidev compatible in spidev Several device in ramips have this binding in the dts - -Signed-off-by: Giuseppe Lippolis ---- - drivers/spi/spidev.c | 1 + - 1 file changed, 1 insertion(+) - ---- a/drivers/spi/spidev.c -+++ b/drivers/spi/spidev.c -@@ -707,6 +707,7 @@ static const struct of_device_id spidev_ - { .compatible = "menlo,m53cpld" }, - { .compatible = "cisco,spi-petra" }, - { .compatible = "micron,spi-authenta" }, -+ { .compatible = "siliconlabs,si3210" }, - {}, - }; - MODULE_DEVICE_TABLE(of, spidev_dt_ids); diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts index e17609ff6fb..96ab73962e9 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-gl-b2200.dts @@ -211,7 +211,7 @@ status = "okay"; spidev1: spi@0 { - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <24000000>; }; diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts index 8ae8658a7ed..0e7f4c970f4 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-gl-s1300.dts @@ -221,7 +221,7 @@ status = "okay"; spidev1: spi@0 { - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <24000000>; }; diff --git a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts index a7fc4765b76..7bb1d81abf9 100644 --- a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts +++ b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts @@ -116,7 +116,7 @@ spidev@0 { #address-cells = <1>; #size-cells = <1>; - compatible = "siliconlabs,si3210"; + compatible = "silabs,si3210"; reg = <0>; spi-max-frequency = <1000000>; From b331ffe807e16ac723da5e92094b40bdd9bb06f5 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 22 Dec 2022 19:59:37 +0100 Subject: [PATCH 14/49] nftables: update to 1.0.6 Remove upstreamed patches: - 0001-fix-nft.patch Upstream switched to "tar.xz" archives. old ipkg size: 273678 bin/packages/mips_24kc/base/nftables-json_1.0.5-2_mips_24kc.ipk new ipkg size: 271624 bin/packages/mips_24kc/base/nftables-json_1.0.6-1_mips_24kc.ipk Release Information: https://netfilter.org/projects/nftables/files/changes-nftables-1.0.6.txt Signed-off-by: Nick Hainke --- package/network/utils/nftables/Makefile | 8 +++---- .../utils/nftables/patches/0001-fix-nft.patch | 23 ------------------- 2 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 package/network/utils/nftables/patches/0001-fix-nft.patch diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 9691151c7b0..2010aaf65c7 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables -PKG_VERSION:=1.0.5 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.6 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=8d1b4b18393af43698d10baa25d2b9b6397969beecac7816c35dd0714e4de50a +PKG_HASH:=2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/nftables/patches/0001-fix-nft.patch b/package/network/utils/nftables/patches/0001-fix-nft.patch deleted file mode 100644 index 2138e254e8f..00000000000 --- a/package/network/utils/nftables/patches/0001-fix-nft.patch +++ /dev/null @@ -1,23 +0,0 @@ -'rule inet dscpclassify dscp_match meta l4proto { udp } th dport { 3478 } th sport { 3478-3497, 16384-16387 } goto ct_set_ef' -works with 'nft add', but not 'nft insert', the latter yields: "BUG: unhandled op 4". - -Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge") -Signed-off-by: Florian Westphal ---- - src/evaluate.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/evaluate.c b/src/evaluate.c -index d9c9ca28a53a..edebd7bcd8ab 100644 ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -1520,6 +1520,7 @@ static int interval_set_eval(struct eval_ctx *ctx, struct set *set, - switch (ctx->cmd->op) { - case CMD_CREATE: - case CMD_ADD: -+ case CMD_INSERT: - if (set->automerge) { - ret = set_automerge(ctx->msgs, ctx->cmd, set, init, - ctx->nft->debug_mask); --- -2.35.1 From acbae4f23475386ca42061339510bd1dcbd7473f Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 5 Jan 2023 11:08:27 +0100 Subject: [PATCH 15/49] libpcap: update to 1.20.2 A huge rewrite in libpcap was introduced by dc14a7babca1 ("rpcap: have the server tell the client its byte order.") [0]. The patch "201-space_optimization.patch" does not apply at all anymore. So remove it. Refresh: - 100-no-openssl.patch - 102-skip-manpages.patch Update the "300-Add-support-for-B.A.T.M.A.N.-Advanced.patch" with latest PR [1]. old ipkg size: 90964 bin/packages/mips_24kc/base/libpcap1_1.10.1-5_mips_24kc.ipk new ipkg size: 93340 bin/packages/mips_24kc/base/libpcap1_1.10.2-1_mips_24kc.ipk [0] - https://github.com/the-tcpdump-group/libpcap/commit/dc14a7babca1471809bee6872539ff836937840e [1] - https://github.com/the-tcpdump-group/libpcap/pull/980 Signed-off-by: Nick Hainke --- package/libs/libpcap/Makefile | 6 ++-- .../libs/libpcap/patches/100-no-openssl.patch | 2 +- .../libpcap/patches/102-skip-manpages.patch | 2 +- .../patches/201-space_optimization.patch | 26 ---------------- ...dd-support-for-B.A.T.M.A.N.-Advanced.patch | 30 +++++++++---------- 5 files changed, 20 insertions(+), 46 deletions(-) delete mode 100644 package/libs/libpcap/patches/201-space_optimization.patch diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index a94a7076489..67525c23261 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=1.10.1 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.10.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4 +PKG_HASH:=db6d79d4ad03b8b15fb16c42447d093ad3520c0ec0ae3d331104dcfb1ce77560 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/libs/libpcap/patches/100-no-openssl.patch b/package/libs/libpcap/patches/100-no-openssl.patch index 56896ad8ba1..434f1ce006a 100644 --- a/package/libs/libpcap/patches/100-no-openssl.patch +++ b/package/libs/libpcap/patches/100-no-openssl.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1042,7 +1042,6 @@ endif() +@@ -1325,7 +1325,6 @@ endif() # # OpenSSL/libressl. # diff --git a/package/libs/libpcap/patches/102-skip-manpages.patch b/package/libs/libpcap/patches/102-skip-manpages.patch index 79a365643e2..43d393ac5f6 100644 --- a/package/libs/libpcap/patches/102-skip-manpages.patch +++ b/package/libs/libpcap/patches/102-skip-manpages.patch @@ -9,7 +9,7 @@ Subject: [PATCH] skip manpages --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -2732,57 +2732,6 @@ if(NOT MSVC) +@@ -3325,57 +3325,6 @@ if(NOT MSVC) if(MINGW) find_program(LINK_EXECUTABLE ln) endif(MINGW) diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch deleted file mode 100644 index bf9374dd542..00000000000 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/pcap-common.c -+++ b/pcap-common.c -@@ -1662,14 +1662,23 @@ swap_pseudo_headers(int linktype, struct - break; - - case DLT_USB_LINUX: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 0); - break; - - case DLT_USB_LINUX_MMAPPED: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 1); - break; - - case DLT_NFLOG: -+#ifndef PCAP_SUPPORT_NETFILTER -+ return; -+#endif - swap_nflog_header(hdr, data); - break; - } diff --git a/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch index ce810657037..0a6aa3c0b7b 100644 --- a/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch +++ b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch @@ -1,4 +1,4 @@ -From b86b960fbd5c215c9c0f43544935b9a25d9445c5 Mon Sep 17 00:00:00 2001 +From 3d8d268320d2381021a409ff8d03533698dd6242 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20L=C3=BCssing?= Date: Mon, 23 Nov 2020 00:38:22 +0100 Subject: [PATCH] Add support for B.A.T.M.A.N. Advanced @@ -220,16 +220,16 @@ Signed-off-by: Linus Lüssing #endif --- a/gencode.c +++ b/gencode.c -@@ -74,6 +74,8 @@ - #include "atmuni31.h" +@@ -60,6 +60,8 @@ #include "sunatmpos.h" + #include "pflog.h" #include "ppp.h" +#include "batadv_packet.h" +#include "batadv_legacy_packet.h" #include "pcap/sll.h" #include "pcap/ipnet.h" #include "arcnet.h" -@@ -9501,6 +9503,168 @@ gen_geneve(compiler_state_t *cstate, bpf +@@ -9436,6 +9438,168 @@ gen_geneve(compiler_state_t *cstate, bpf return b1; } @@ -400,7 +400,7 @@ Signed-off-by: Linus Lüssing static struct block * --- a/gencode.h +++ b/gencode.h -@@ -346,6 +346,9 @@ struct block *gen_pppoes(compiler_state_ +@@ -358,6 +358,9 @@ struct block *gen_pppoes(compiler_state_ struct block *gen_geneve(compiler_state_t *, bpf_u_int32, int); @@ -412,7 +412,7 @@ Signed-off-by: Linus Lüssing struct block *gen_atmtype_abbrev(compiler_state_t *, int); --- a/grammar.y.in +++ b/grammar.y.in -@@ -347,6 +347,7 @@ DIAG_OFF_BISON_BYACC +@@ -375,6 +375,7 @@ DIAG_OFF_BISON_BYACC %type mtp2type %type mtp3field %type mtp3fieldvalue mtp3value mtp3listvalue @@ -420,7 +420,7 @@ Signed-off-by: Linus Lüssing %token DST SRC HOST GATEWAY -@@ -365,7 +366,7 @@ DIAG_OFF_BISON_BYACC +@@ -393,7 +394,7 @@ DIAG_OFF_BISON_BYACC %token LEN %token IPV6 ICMPV6 AH ESP %token VLAN MPLS @@ -429,7 +429,7 @@ Signed-off-by: Linus Lüssing %token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP %token STP %token IPX -@@ -592,11 +593,40 @@ other: pqual TK_BROADCAST { CHECK_PTR_ +@@ -620,11 +621,40 @@ other: pqual TK_BROADCAST { CHECK_PTR_ | PPPOES { CHECK_PTR_VAL(($$ = gen_pppoes(cstate, 0, 0))); } | GENEVE pnum { CHECK_PTR_VAL(($$ = gen_geneve(cstate, $2, 1))); } | GENEVE { CHECK_PTR_VAL(($$ = gen_geneve(cstate, 0, 0))); } @@ -556,15 +556,15 @@ Signed-off-by: Linus Lüssing } --- a/pcap-filter.manmisc.in +++ b/pcap-filter.manmisc.in -@@ -98,6 +98,7 @@ protos are: +@@ -98,6 +98,7 @@ protocols are: .BR arp , .BR rarp , .BR decnet , +.BR batadv , + .BR sctp , .B tcp and - .BR udp . -@@ -361,7 +362,7 @@ True if the packet is an IPv6 multicast +@@ -400,7 +401,7 @@ True if the packet is an IPv6 multicast .IP "\fBether proto \fIprotocol\fR" True if the packet is of ether type \fIprotocol\fR. \fIProtocol\fP can be a number or one of the names @@ -573,7 +573,7 @@ Signed-off-by: Linus Lüssing \fBipx\fP, \fBiso\fP, \fBlat\fP, \fBloopback\fP, \fBmopdl\fP, \fBmoprc\fP, \fBnetbeui\fP, \fBrarp\fP, \fBsca\fP or \fBstp\fP. Note these identifiers (except \fBloopback\fP) are also keywords -@@ -415,7 +416,7 @@ the filter checks for the IPX etype in a +@@ -454,7 +455,7 @@ the filter checks for the IPX etype in a DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of IPX, and the IPX etype in a SNAP frame. .RE @@ -582,7 +582,7 @@ Signed-off-by: Linus Lüssing Abbreviations for: .in +.5i .nf -@@ -752,6 +753,36 @@ For example: +@@ -792,6 +793,36 @@ For example: filters IPv4 protocol encapsulated in Geneve with VNI 0xb. This will match both IPv4 directly encapsulated in Geneve as well as IPv4 contained inside an Ethernet frame. @@ -621,7 +621,7 @@ Signed-off-by: Linus Lüssing \fIProtocol\fP can be a number or one of the names --- a/pcap/namedb.h +++ b/pcap/namedb.h -@@ -69,6 +69,8 @@ PCAP_API int pcap_nametoportrange(const +@@ -70,6 +70,8 @@ PCAP_API int pcap_nametoportrange(const PCAP_API int pcap_nametoproto(const char *); PCAP_API int pcap_nametoeproto(const char *); PCAP_API int pcap_nametollc(const char *); @@ -632,7 +632,7 @@ Signed-off-by: Linus Lüssing * Also, pcap_nametoport() returns the protocol along with the port number. --- a/scanner.l +++ b/scanner.l -@@ -344,6 +344,7 @@ mpls return MPLS; +@@ -347,6 +347,7 @@ mpls return MPLS; pppoed return PPPOED; pppoes return PPPOES; geneve return GENEVE; From 5809fb4546eaf76d4d05a6e6fefb7ae0d8484681 Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 5 Jan 2023 15:45:38 +0100 Subject: [PATCH 16/49] tcpdump: update to 4.99.2 Update to latest version. For release information look into CHANGES file [0]. Automatically refreshed: - 001-remove_pcap_debug.patch Manually refreshed: - 100-tcpdump_mini.patch old ipkg sizes: 316554 bin/packages/mips_24kc/base/tcpdump_4.99.1-1_mips_24kc.ipk 141457 bin/packages/mips_24kc/base/tcpdump-mini_4.99.1-1_mips_24kc.ipk new ipkg sizes: 318089 bin/packages/mips_24kc/base/tcpdump_4.99.2-1_mips_24kc.ipk 141941 bin/packages/mips_24kc/base/tcpdump-mini_4.99.2-1_mips_24kc.ipk [0] - https://github.com/the-tcpdump-group/tcpdump/blob/master/CHANGES Signed-off-by: Nick Hainke --- package/network/utils/tcpdump/Makefile | 4 +- .../patches/001-remove_pcap_debug.patch | 2 +- .../tcpdump/patches/100-tcpdump_mini.patch | 67 ++++++++++--------- 3 files changed, 37 insertions(+), 36 deletions(-) diff --git a/package/network/utils/tcpdump/Makefile b/package/network/utils/tcpdump/Makefile index dc722f1ad4e..5019e0b3b67 100644 --- a/package/network/utils/tcpdump/Makefile +++ b/package/network/utils/tcpdump/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tcpdump -PKG_VERSION:=4.99.1 +PKG_VERSION:=4.99.2 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=79b36985fb2703146618d87c4acde3e068b91c553fb93f021a337f175fd10ebe +PKG_HASH:=f4304357d34b79d46f4e17e654f1f91f9ce4e3d5608a1badbd53295a26fb44d5 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch index e79de526a13..1988587029b 100644 --- a/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch +++ b/package/network/utils/tcpdump/patches/001-remove_pcap_debug.patch @@ -1,6 +1,6 @@ --- a/configure +++ b/configure -@@ -6230,97 +6230,6 @@ fi +@@ -6568,97 +6568,6 @@ fi diff --git a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch index ad7c3feb4ec..8a014cabf0b 100644 --- a/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch +++ b/package/network/utils/tcpdump/patches/100-tcpdump_mini.patch @@ -1,6 +1,6 @@ --- a/Makefile.in +++ b/Makefile.in -@@ -73,6 +73,85 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ +@@ -73,6 +73,86 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@ CSRC = fptype.c tcpdump.c @@ -77,6 +77,7 @@ + print-tftp.c \ + print-udp.c \ + print-unsupported.c \ ++ print-whois.c \ + signature.c \ + strtoaddr.c \ + util-print.c @@ -86,7 +87,7 @@ LIBNETDISSECT_SRC=\ addrtoname.c \ addrtostr.c \ -@@ -252,6 +331,8 @@ LIBNETDISSECT_SRC=\ +@@ -254,6 +334,8 @@ LIBNETDISSECT_SRC=\ strtoaddr.c \ util-print.c @@ -97,7 +98,7 @@ --- a/addrtoname.c +++ b/addrtoname.c -@@ -683,8 +683,10 @@ linkaddr_string(netdissect_options *ndo, +@@ -680,8 +680,10 @@ linkaddr_string(netdissect_options *ndo, if (type == LINKADDR_ETHER && len == MAC_ADDR_LEN) return (etheraddr_string(ndo, ep)); @@ -108,7 +109,7 @@ tp = lookup_bytestring(ndo, ep, len); if (tp->bs_name) -@@ -1263,6 +1265,7 @@ init_addrtoname(netdissect_options *ndo, +@@ -1260,6 +1262,7 @@ init_addrtoname(netdissect_options *ndo, init_ipxsaparray(ndo); } @@ -116,7 +117,7 @@ const char * dnaddr_string(netdissect_options *ndo, u_short dnaddr) { -@@ -1279,6 +1282,7 @@ dnaddr_string(netdissect_options *ndo, u +@@ -1276,6 +1279,7 @@ dnaddr_string(netdissect_options *ndo, u return(tp->name); } @@ -126,7 +127,7 @@ struct hnamemem * --- a/print-ether.c +++ b/print-ether.c -@@ -539,6 +539,7 @@ ethertype_print(netdissect_options *ndo, +@@ -545,6 +545,7 @@ ethertype_print(netdissect_options *ndo, arp_print(ndo, p, length, caplen); return (1); @@ -134,7 +135,7 @@ case ETHERTYPE_DN: decnet_print(ndo, p, length, caplen); return (1); -@@ -569,6 +570,7 @@ ethertype_print(netdissect_options *ndo, +@@ -575,6 +576,7 @@ ethertype_print(netdissect_options *ndo, ND_TCHECK_LEN(p, 1); isoclns_print(ndo, p + 1, length - 1); return(1); @@ -142,19 +143,19 @@ case ETHERTYPE_PPPOED: case ETHERTYPE_PPPOES: -@@ -581,9 +583,11 @@ ethertype_print(netdissect_options *ndo, +@@ -587,9 +589,11 @@ ethertype_print(netdissect_options *ndo, eapol_print(ndo, p); return (1); +#ifndef TCPDUMP_MINI - case ETHERTYPE_RRCP: - rrcp_print(ndo, p, length, src, dst); + case ETHERTYPE_REALTEK: + rtl_print(ndo, p, length, src, dst); return (1); +#endif case ETHERTYPE_PPP: if (length) { -@@ -592,6 +596,7 @@ ethertype_print(netdissect_options *ndo, +@@ -598,6 +602,7 @@ ethertype_print(netdissect_options *ndo, } return (1); @@ -162,7 +163,7 @@ case ETHERTYPE_MPCP: mpcp_print(ndo, p, length); return (1); -@@ -604,19 +609,23 @@ ethertype_print(netdissect_options *ndo, +@@ -610,19 +615,23 @@ ethertype_print(netdissect_options *ndo, case ETHERTYPE_CFM_OLD: cfm_print(ndo, p, length); return (1); @@ -186,7 +187,7 @@ case ETHERTYPE_MPLS: case ETHERTYPE_MPLS_MULTI: mpls_print(ndo, p, length); -@@ -646,6 +655,7 @@ ethertype_print(netdissect_options *ndo, +@@ -652,6 +661,7 @@ ethertype_print(netdissect_options *ndo, case ETHERTYPE_PTP: ptp_print(ndo, p, length); return (1); @@ -214,7 +215,7 @@ break; --- a/print-icmp6.c +++ b/print-icmp6.c -@@ -1384,7 +1384,7 @@ get_upperlayer(netdissect_options *ndo, +@@ -1371,7 +1371,7 @@ get_upperlayer(netdissect_options *ndo, nh = GET_U_1(fragh->ip6f_nxt); hlen = sizeof(struct ip6_frag); break; @@ -223,7 +224,7 @@ case IPPROTO_AH: ah = (const struct ah *)bp; if (!ND_TTEST_1(ah->ah_len)) -@@ -1392,7 +1392,7 @@ get_upperlayer(netdissect_options *ndo, +@@ -1379,7 +1379,7 @@ get_upperlayer(netdissect_options *ndo, nh = GET_U_1(ah->ah_nxt); hlen = (GET_U_1(ah->ah_len) + 2) << 2; break; @@ -336,7 +337,7 @@ default: /* * AH and ESP are, in the RFCs that describe them, -@@ -357,6 +358,7 @@ ip6_print(netdissect_options *ndo, const +@@ -375,6 +376,7 @@ ip6_print(netdissect_options *ndo, const nh = GET_U_1(cp); break; @@ -344,7 +345,7 @@ case IPPROTO_FRAGMENT: advance = frag6_print(ndo, cp, (const u_char *)ip6); if (advance < 0 || ndo->ndo_snapend <= cp + advance) { -@@ -387,7 +389,7 @@ ip6_print(netdissect_options *ndo, const +@@ -405,7 +407,7 @@ ip6_print(netdissect_options *ndo, const nh = GET_U_1(cp); nd_pop_packet_info(ndo); return; @@ -462,7 +463,7 @@ static void ppp_hdlc(netdissect_options *ndo, const u_char *p, u_int length) -@@ -1440,17 +1441,19 @@ trunc: +@@ -1451,17 +1452,19 @@ trunc: ndo->ndo_snapend = se; nd_print_trunc(ndo); } @@ -483,7 +484,7 @@ switch (proto) { case PPP_LCP: /* fall through */ -@@ -1483,6 +1486,7 @@ handle_ppp(netdissect_options *ndo, +@@ -1494,6 +1497,7 @@ handle_ppp(netdissect_options *ndo, case PPP_IPV6: ip6_print(ndo, p, length); break; @@ -491,7 +492,7 @@ case ETHERTYPE_IPX: /*XXX*/ case PPP_IPX: ipx_print(ndo, p, length); -@@ -1494,6 +1498,7 @@ handle_ppp(netdissect_options *ndo, +@@ -1505,6 +1509,7 @@ handle_ppp(netdissect_options *ndo, case PPP_MPLS_MCAST: mpls_print(ndo, p, length); break; @@ -499,7 +500,7 @@ case PPP_COMP: ND_PRINT("compressed PPP data"); break; -@@ -1634,6 +1639,7 @@ ppp_if_print(netdissect_options *ndo, +@@ -1652,6 +1657,7 @@ ppp_if_print(netdissect_options *ndo, ppp_print(ndo, p, length); } @@ -507,14 +508,14 @@ /* * PPP I/F printer to use if we know that RFC 1662-style PPP in HDLC-like * framing, or Cisco PPP with HDLC framing as per section 4.3.1 of RFC 1547, -@@ -1877,3 +1883,4 @@ printx: +@@ -1895,3 +1901,4 @@ printx: #endif /* __bsdi__ */ ndo->ndo_ll_hdr_len += hdrlength; } +#endif --- a/print-sll.c +++ b/print-sll.c -@@ -460,12 +460,14 @@ recurse: +@@ -465,12 +465,14 @@ recurse: */ switch (ether_type) { @@ -531,7 +532,7 @@ /* --- a/print-tcp.c +++ b/print-tcp.c -@@ -612,6 +612,7 @@ tcp_print(netdissect_options *ndo, +@@ -614,6 +614,7 @@ tcp_print(netdissect_options *ndo, ND_PRINT(" %u", utoval); break; @@ -539,7 +540,7 @@ case TCPOPT_MPTCP: { const u_char *snapend_save; -@@ -635,7 +636,7 @@ tcp_print(netdissect_options *ndo, +@@ -637,7 +638,7 @@ tcp_print(netdissect_options *ndo, goto bad; break; } @@ -548,7 +549,7 @@ case TCPOPT_FASTOPEN: datalen = len - 2; LENCHECK(datalen); -@@ -720,6 +721,7 @@ tcp_print(netdissect_options *ndo, +@@ -722,6 +723,7 @@ tcp_print(netdissect_options *ndo, return; } @@ -556,7 +557,7 @@ if (ndo->ndo_packettype) { switch (ndo->ndo_packettype) { case PT_ZMTP1: -@@ -735,6 +737,7 @@ tcp_print(netdissect_options *ndo, +@@ -737,6 +739,7 @@ tcp_print(netdissect_options *ndo, } return; } @@ -564,12 +565,12 @@ if (IS_SRC_OR_DST_PORT(TELNET_PORT)) { telnet_print(ndo, bp, length); -@@ -745,24 +748,31 @@ tcp_print(netdissect_options *ndo, +@@ -746,24 +749,31 @@ tcp_print(netdissect_options *ndo, + } else if (IS_SRC_OR_DST_PORT(WHOIS_PORT)) { ND_PRINT(": "); - ndo->ndo_protocol = "whois"; /* needed by txtproto_print() */ - txtproto_print(ndo, bp, length, NULL, 0); /* RFC 3912 */ + whois_print(ndo, bp, length); - } else if (IS_SRC_OR_DST_PORT(BGP_PORT)) -+ } ++ } +#ifndef TCPDUMP_MINI + else if (IS_SRC_OR_DST_PORT(BGP_PORT)) bgp_print(ndo, bp, length); @@ -597,7 +598,7 @@ else if (IS_SRC_OR_DST_PORT(FTP_PORT)) { ND_PRINT(": "); ftp_print(ndo, bp, length); -@@ -775,12 +785,14 @@ tcp_print(netdissect_options *ndo, +@@ -776,12 +786,14 @@ tcp_print(netdissect_options *ndo, } else if (IS_SRC_OR_DST_PORT(NAMESERVER_PORT)) { /* over_tcp: TRUE, is_mdns: FALSE */ domain_print(ndo, bp, length, TRUE, FALSE); @@ -831,7 +832,7 @@ { null_if_print, DLT_LOOP }, #endif +#ifndef TCPDUMP_MINI - #if defined(DLT_PFLOG) && defined(HAVE_NET_IF_PFLOG_H) + #ifdef DLT_PFLOG { pflog_if_print, DLT_PFLOG }, #endif @@ -200,6 +211,7 @@ static const struct printer printers[] = From 4eeecf41cf4a855a07b3df57890a6f6528f00e36 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 30 Dec 2022 15:29:30 +0300 Subject: [PATCH 17/49] ramips: enable mtd virtual concat support for mt76x8 subtarget This is required for upcoming Keenetic KN-1613 support Signed-off-by: Maxim Anisimov --- target/linux/ramips/mt76x8/config-5.10 | 1 + target/linux/ramips/mt76x8/config-5.15 | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/ramips/mt76x8/config-5.10 b/target/linux/ramips/mt76x8/config-5.10 index b6687f8949c..514c6746157 100644 --- a/target/linux/ramips/mt76x8/config-5.10 +++ b/target/linux/ramips/mt76x8/config-5.10 @@ -117,6 +117,7 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_RALINK_ESW_RT3050=y diff --git a/target/linux/ramips/mt76x8/config-5.15 b/target/linux/ramips/mt76x8/config-5.15 index 0734bee16e0..5a82edfb102 100644 --- a/target/linux/ramips/mt76x8/config-5.15 +++ b/target/linux/ramips/mt76x8/config-5.15 @@ -118,6 +118,7 @@ CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_RALINK_ESW_RT3050=y From dbebfb88b543fb1842e6af806d3bf2245fddff14 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Fri, 30 Dec 2022 15:30:52 +0300 Subject: [PATCH 18/49] ramips: add support for Keenetic KN-1613 Keenetic KN-1613 is a 2.4/5 Ghz band 11ac (Wi-Fi 5) router, based on MT7628AN. Specification: - System-On-Chip: MT7628AN - CPU/Speed: 580 MHz - Flash-Chip: Winbond w25q256 - Flash size: 32768 KiB - RAM: 128 MiB - 4x 10/100 Mbps Ethernet - 2x external, non-detachable antennas - UART (J1) header on PCB (115200 8n1) - Wireless No1 (2T2R): SoC Built-in 2.4 GHz 802.11bgn - Wireless No2 (2T2R): MT7613BE 5 GHz 802.11ac - 4x LED, 2x button, 1x mode switch Notes: - The device supports dual boot mode - The firmware partitions were concatinated into one - The FN button led indicator has been reassigned as the 2.4GHz wifi indicator. Flash instruction: The only way to flash OpenWrt image is to use tftp recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24 and tftp server. 2. Rename "openwrt-ramips-mt76x8-keenetic_kn-1613-squashfs-factory.bin" to "KN-1613_recovery.bin" and place it in tftp server directory. 3. Connect PC with one of LAN ports, press the reset button, power up the router and keep button pressed until power led start blinking. 4. Router will download file from server, write it to flash and reboot. Signed-off-by: Maxim Anisimov --- .../ramips/dts/mt7628an_keenetic_kn-1613.dts | 223 ++++++++++++++++++ target/linux/ramips/image/mt76x8.mk | 12 + .../mt76x8/base-files/etc/board.d/01_leds | 3 + .../mt76x8/base-files/etc/board.d/02_network | 12 +- 4 files changed, 246 insertions(+), 4 deletions(-) create mode 100644 target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts diff --git a/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts new file mode 100644 index 00000000000..4281682503a --- /dev/null +++ b/target/linux/ramips/dts/mt7628an_keenetic_kn-1613.dts @@ -0,0 +1,223 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7628an.dtsi" + +#include +#include + +/ { + compatible = "keenetic,kn-1613", "mediatek,mt7628an-soc"; + model = "Keenetic KN-1613"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 38 GPIO_ACTIVE_LOW>; + }; + + wifi2 { + label = "green:wifi2"; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + wifi5 { + label = "green:wifi5"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + keys { + compatible = "gpio-keys"; + + fn { + label = "fn"; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 44 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 37 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x0 0x1ec0000>; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "i2s", "i2c", "gpio", "refclk", "wdt", "wled_an"; + function = "gpio"; + }; +}; + +&usbphy { + status = "disabled"; +}; + +&ehci { + status = "disabled"; +}; + +&ohci { + status = "disabled"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <32000000>; + + partitions: partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "rf-eeprom"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware1: partition@50000 { + label = "firmware_1"; + reg = <0x50000 0xf60000>; + }; + + partition@fb0000 { + label = "config_1"; + reg = <0xfb0000 0x40000>; + read-only; + }; + + partition@ff0000 { + label = "dump"; + reg = <0xff0000 0x10000>; + read-only; + }; + + partition@1000000 { + label = "u-state"; + reg = <0x1000000 0x30000>; + read-only; + }; + + partition@1030000 { + label = "u-config_res"; + reg = <0x1030000 0x10000>; + read-only; + }; + + partition@1040000 { + label = "rf-eeprom_res"; + reg = <0x1040000 0x10000>; + read-only; + }; + + firmware2: partition@1050000 { + label = "firmware_2"; + reg = <0x1050000 0xf60000>; + }; + + partition@1fb0000 { + label = "config_2"; + reg = <0x1fb0000 0x40000>; + read-only; + }; + }; + }; +}; + +ðernet { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&esw { + mediatek,portmap = <0x3e>; +}; + +&wmac { + status = "okay"; + + mediatek,mtd-eeprom = <&factory 0x0>; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0400>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index a77f1c97e1e..9db2d9e60c2 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -320,6 +320,18 @@ define Device/jotale_js76x8-32m endef TARGET_DEVICES += jotale_js76x8-32m +define Device/keenetic_kn-1613 + BLOCKSIZE := 64k + IMAGE_SIZE := 31488k + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1613 + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7663-firmware-ap + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to $$$$(BLOCKSIZE) | \ + check-size | zyimage -d 0x801613 -v "KN-1613" +endef +TARGET_DEVICES += keenetic_kn-1613 + define Device/kroks_kndrt31r16 IMAGE_SIZE := 16064k DEVICE_VENDOR := Kroks diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds index 66628cea09f..d972762dadc 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds @@ -53,6 +53,9 @@ hiwifi,hc5661a|\ hiwifi,hc5761a) ucidef_set_led_switch "internet" "internet" "blue:internet" "switch0" "0x10" ;; +keenetic,kn-1613) + ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x01" + ;; mediatek,linkit-smart-7688) ucidef_set_led_wlan "wifi" "wifi" "orange:wifi" "phy0tpt" ;; diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network index 26415e0fa65..7570999a4ef 100644 --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network @@ -118,6 +118,11 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan" "1:lan" "2:lan" "6@eth0" ;; + keenetic,kn-1613|\ + motorola,mwr03) + ucidef_add_switch "switch0" \ + "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" + ;; kroks,kndrt31r19) ucidef_add_switch "switch0" \ "0:lan" "6@eth0" @@ -129,10 +134,6 @@ ramips_setup_interfaces() ucidef_add_switch "switch0" \ "0:lan:1" "1:lan:2" "2:lan:3" "3:lan:4" "4:wan" "6@eth0" ;; - motorola,mwr03) - ucidef_add_switch "switch0" \ - "1:lan" "2:lan" "3:lan" "0:wan" "6@eth0" - ;; netgear,r6020|\ netgear,r6080|\ netgear,r6120|\ @@ -252,6 +253,9 @@ ramips_setup_macs() totolink,lr1200) wan_mac=$(mtd_get_mac_binary factory 0x2e) ;; + keenetic,kn-1613) + wan_mac=$(mtd_get_mac_binary rf-eeprom 0x28) + ;; linksys,e5400) wan_mac=$(mtd_get_mac_binary factory 0x22) ;; From 4501f6f77c734978ef6e93084bf1c87f40a1e148 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Fri, 16 Dec 2022 09:41:53 +0800 Subject: [PATCH 19/49] tools/llvm: update to 15.0.6 Release Notes: https://discourse.llvm.org/t/llvm-15-0-0-release/65099 https://discourse.llvm.org/t/llvm-15-0-1-released/65380 https://discourse.llvm.org/t/llvm-15-0-2-released/65695 https://discourse.llvm.org/t/llvm-15-0-3-released/66036 https://discourse.llvm.org/t/llvm-15-0-4-released/66337 https://discourse.llvm.org/t/llvm-15-0-5-release/66616 https://discourse.llvm.org/t/llvm-15-0-6-released/66899 Remove HOST_BUILD_PARALLEL as it's default now. Signed-off-by: Linhui Liu --- tools/llvm-bpf/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 775e1af896b..2a0cc0ab336 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -7,17 +7,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=llvm-project -PKG_VERSION:=14.0.6 +PKG_VERSION:=15.0.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) -PKG_HASH:=8b3cfd7bc695bd6cea0f37f53f0981f34f87496e79e2529874fd03a2f9dd3a8a +PKG_HASH:=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src -HOST_BUILD_PARALLEL:=1 - CMAKE_BINARY_SUBDIR := build CMAKE_SOURCE_SUBDIR := llvm From f193f2d1a007f215b0c5619f14dc4ca6b579bfb6 Mon Sep 17 00:00:00 2001 From: Stefan Kalscheuer Date: Sun, 18 Dec 2022 12:32:42 +0100 Subject: [PATCH 20/49] ath79: convert UBNT Aircube AC WiFis to nvmem-cells Pull the calibration data from the nvmem subsystem. This allows us to move userspace caldata extraction into the device-tree definition. Merge art into partition node. Signed-off-by: Stefan Kalscheuer --- .../ath79/dts/ar9342_ubnt_aircube-ac.dts | 38 +++++++++++++------ .../etc/hotplug.d/firmware/11-ath10k-caldata | 1 - 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts b/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts index e93c1b8dabc..49cf39062a2 100644 --- a/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts +++ b/target/linux/ath79/dts/ar9342_ubnt_aircube-ac.dts @@ -58,10 +58,26 @@ read-only; }; - art: partition@ff0000 { + partition@ff0000 { label = "art"; reg = <0xff0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; }; }; }; @@ -73,6 +89,13 @@ &pcie { status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0 0 0 0 0>; + nvmem-cells = <&calibration_art_5000>; + nvmem-cell-names = "calibration"; + }; }; &mdio0 { @@ -109,15 +132,6 @@ &wmac { status = "okay"; - mtd-cal-data = <&art 0x1000>; -}; - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; + nvmem-cells = <&calibration_art_1000>; + nvmem-cell-names = "calibration"; }; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index d03e88041ae..74e6738162f 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -35,7 +35,6 @@ case "$FIRMWARE" in sophos,ap55c|\ sophos,ap100|\ sophos,ap100c|\ - ubnt,aircube-ac|\ ubnt,bullet-ac|\ ubnt,unifiac-lite|\ ubnt,unifiac-lr|\ From 7b60dba954e310261aef7da3fe252e841721c88d Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 18 Aug 2021 17:19:15 +0200 Subject: [PATCH 21/49] target/imagebuilder: add depends target to show all package that gets installed This commits adds the makefile targets `depends` this wrapper is a call to `opkg depends`. This command shows which runtime dependencies exist if this package is installed into the image. Signed-off-by: Florian Eckert --- target/imagebuilder/files/Makefile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 3329fe70aa1..79e6826c106 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -35,6 +35,7 @@ Available Commands: info: Show a list of available target profiles clean: Remove images and temporary build files image: Build an image (see below for more information). + package_depends: Show installation dependency of the package Building images: By default 'make image' will create an image with the default @@ -57,6 +58,12 @@ Print manifest: make manifest PACKAGES=" [ [ ...]]" # include extra packages make manifest STRIP_ABI=1 # remove ABI version from printed package names +package_depends: + List "all" packages dependency of the package + You can use the following parameters: + + make package_depends PACKAGE="" + endef $(eval $(call shexport,Helptext)) @@ -263,4 +270,13 @@ endif @$(MAKE) -s package_reload @$(OPKG) whatdepends -A $(PACKAGE) -.SILENT: help info image manifest whatdepends +package_depends: FORCE +ifeq ($(PACKAGE),) + @echo 'Variable `PACKAGE` is not set but required by `package_depends`' + @exit 1 +endif + @$(MAKE) -s package_reload + @$(OPKG) depends -A $(PACKAGE) + + +.SILENT: help info image manifest whatdepends package_depends From e1cf4688ec084d5902584bd163d1809e260274a5 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 19 Aug 2021 08:39:42 +0200 Subject: [PATCH 22/49] target/imagebuilder: change help text for image build Using command `image` to unify help text. Signed-off-by: Florian Eckert --- target/imagebuilder/files/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 79e6826c106..03a9a3c4ee9 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -37,7 +37,7 @@ Available Commands: image: Build an image (see below for more information). package_depends: Show installation dependency of the package -Building images: +image: By default 'make image' will create an image with the default target profile and package set. You can use the following parameters to change that: From c75a565d2c377e0b54623b5a9aae26fa63e48098 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 19 Aug 2021 08:42:50 +0200 Subject: [PATCH 23/49] target/imagebuilder: update help text for manifest target - Add a help text for the manifest command. - Unify command detail help text to use `manifest`. Signed-off-by: Florian Eckert --- target/imagebuilder/files/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 03a9a3c4ee9..acf07a55186 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -35,6 +35,7 @@ Available Commands: info: Show a list of available target profiles clean: Remove images and temporary build files image: Build an image (see below for more information). + manifest: Show all package that will be installed into the image package_depends: Show installation dependency of the package image: @@ -50,7 +51,7 @@ image: make image DISABLED_SERVICES=" [ [ ..]]" # Which services in /etc/init.d/ should be disabled make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images -Print manifest: +manifest: List "all" packages which get installed into the image. You can use the following parameters: From 744a5ab9ce7b911df9ef73a514b8fa716c037f4b Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Thu, 19 Aug 2021 08:48:08 +0200 Subject: [PATCH 24/49] target/imagebuilder: add help text and rename whatdepends to package_whatdepens Add the command `package_whatdepends` to show all package that have a dependency to this packages. Signed-off-by: Florian Eckert --- target/imagebuilder/files/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index acf07a55186..275932577b4 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -36,6 +36,7 @@ Available Commands: clean: Remove images and temporary build files image: Build an image (see below for more information). manifest: Show all package that will be installed into the image + package_whatdepends: Show which packages have a dependency on this package_depends: Show installation dependency of the package image: @@ -59,6 +60,13 @@ manifest: make manifest PACKAGES=" [ [ ...]]" # include extra packages make manifest STRIP_ABI=1 # remove ABI version from printed package names + +package_whatdepends: + List "all" packages that have a dependency on this package + You can use the following parameters: + + make package_whatdepends PACKAGE="" + package_depends: List "all" packages dependency of the package You can use the following parameters: @@ -263,7 +271,7 @@ manifest: FORCE $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")) -whatdepends: FORCE +package_whatdepends: FORCE ifeq ($(PACKAGE),) @echo 'Variable `PACKAGE` is not set but required by `whatdepends`' @exit 1 @@ -280,4 +288,4 @@ endif @$(OPKG) depends -A $(PACKAGE) -.SILENT: help info image manifest whatdepends package_depends +.SILENT: help info image manifest package_whatdepends package_depends From 4965cbd259bb9001e8724f53520f4be1e4723212 Mon Sep 17 00:00:00 2001 From: Joe Mullally Date: Mon, 28 Nov 2022 20:35:39 +0000 Subject: [PATCH 25/49] ath79: tiny: Do not build TPLink WPA8630Pv2 by default 22.03.1+ and snapshot builds no longer fit the 6M flash space available for these models. This disables failing buildbot image builds for these devices. Images can still be built manually with ImageBuilder. Signed-off-by: Joe Mullally --- target/linux/ath79/image/tiny-tp-link.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk index 30474149d3a..93cbc7d148c 100644 --- a/target/linux/ath79/image/tiny-tp-link.mk +++ b/target/linux/ath79/image/tiny-tp-link.mk @@ -234,6 +234,7 @@ define Device/tplink_tl-wpa8630p-v2 so the JFFS2 settings partition MUST be reformatted to avoid data corruption. \ Backup your settings before upgrading, then during sysupgrade, \ de-select "Keep settings" and select "Force" to continue (equivilant to "sysupgrade -n -F"). + DEFAULT := n endef define Device/tplink_tl-wpa8630p-v2-int From ed7c1a504eae6b220e01da330c62c47d299e2c5d Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sat, 12 Nov 2022 19:31:32 +0100 Subject: [PATCH 26/49] kernel: add patch to support en25qh256a The EN25QH256A variant of the EN25QH256 doesn't initialize correctly from SFDP alone and only accesses memory below 8m (addr_width is 4 but read_opcode takes only 3 bytes). Set SNOR_F_4B_OPCODES if the flash chip variant was detected using hwcaps. The fix submitted upstream uses the PARSE_SFDP initializer that is not available in the kernel used with Openwrt. Signed-off-by: Leon M. Busch-George --- ...9-mtd-spi-nor-support-eon-en25qh256a.patch | 49 +++++++++++++++++++ ...9-mtd-spi-nor-support-eon-en25qh256a.patch | 49 +++++++++++++++++++ .../476-mtd-spi-nor-add-eon-en25q128.patch | 2 +- .../477-mtd-spi-nor-add-eon-en25qx128a.patch | 2 +- .../476-mtd-spi-nor-add-eon-en25q128.patch | 2 +- .../477-mtd-spi-nor-add-eon-en25qx128a.patch | 2 +- 6 files changed, 102 insertions(+), 4 deletions(-) create mode 100644 target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch create mode 100644 target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch diff --git a/target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch b/target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch new file mode 100644 index 00000000000..2358352e93c --- /dev/null +++ b/target/linux/generic/backport-5.10/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch @@ -0,0 +1,49 @@ +From 6abef37d16d0c570ef5a149e63762fba2a30804b Mon Sep 17 00:00:00 2001 +From: "Leon M. George" +Date: Wed, 30 Mar 2022 16:16:56 +0200 +Subject: [PATCH] mtd: spi-nor: support eon en25qh256a variant + +The EN25QH256A variant of the EN25QH256 doesn't initialize correctly from SFDP +alone and only accesses memory below 8m (addr_width is 4 but read_opcode takes +only 3 bytes). + +Set SNOR_F_4B_OPCODES if the flash chip variant was detected using hwcaps. + +The fix submitted upstream uses the PARSE_SFDP initializer that is not +available in the kernel used with Openwrt. + +Signed-off-by: Leon M. George +--- + drivers/mtd/spi-nor/eon.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/mtd/spi-nor/eon.c ++++ b/drivers/mtd/spi-nor/eon.c +@@ -8,6 +8,16 @@ + + #include "core.h" + ++static void en25qh256_post_sfdp_fixups(struct spi_nor *nor) ++{ ++ if (nor->params->hwcaps.mask & SNOR_HWCAPS_READ_1_1_4) ++ nor->flags |= SNOR_F_4B_OPCODES; ++} ++ ++static const struct spi_nor_fixups en25qh256_fixups = { ++ .post_sfdp = en25qh256_post_sfdp_fixups, ++}; ++ + static const struct flash_info eon_parts[] = { + /* EON -- en25xxx */ + { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) }, +@@ -23,7 +33,9 @@ static const struct flash_info eon_parts + { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128, + SECT_4K | SPI_NOR_DUAL_READ) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, +- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, ++ SPI_NOR_DUAL_READ) ++ .fixups = &en25qh256_fixups }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, + }; + diff --git a/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch b/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch new file mode 100644 index 00000000000..2358352e93c --- /dev/null +++ b/target/linux/generic/backport-5.15/422-v5.19-mtd-spi-nor-support-eon-en25qh256a.patch @@ -0,0 +1,49 @@ +From 6abef37d16d0c570ef5a149e63762fba2a30804b Mon Sep 17 00:00:00 2001 +From: "Leon M. George" +Date: Wed, 30 Mar 2022 16:16:56 +0200 +Subject: [PATCH] mtd: spi-nor: support eon en25qh256a variant + +The EN25QH256A variant of the EN25QH256 doesn't initialize correctly from SFDP +alone and only accesses memory below 8m (addr_width is 4 but read_opcode takes +only 3 bytes). + +Set SNOR_F_4B_OPCODES if the flash chip variant was detected using hwcaps. + +The fix submitted upstream uses the PARSE_SFDP initializer that is not +available in the kernel used with Openwrt. + +Signed-off-by: Leon M. George +--- + drivers/mtd/spi-nor/eon.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/mtd/spi-nor/eon.c ++++ b/drivers/mtd/spi-nor/eon.c +@@ -8,6 +8,16 @@ + + #include "core.h" + ++static void en25qh256_post_sfdp_fixups(struct spi_nor *nor) ++{ ++ if (nor->params->hwcaps.mask & SNOR_HWCAPS_READ_1_1_4) ++ nor->flags |= SNOR_F_4B_OPCODES; ++} ++ ++static const struct spi_nor_fixups en25qh256_fixups = { ++ .post_sfdp = en25qh256_post_sfdp_fixups, ++}; ++ + static const struct flash_info eon_parts[] = { + /* EON -- en25xxx */ + { "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) }, +@@ -23,7 +33,9 @@ static const struct flash_info eon_parts + { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128, + SECT_4K | SPI_NOR_DUAL_READ) }, + { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) }, +- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) }, ++ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, ++ SPI_NOR_DUAL_READ) ++ .fixups = &en25qh256_fixups }, + { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) }, + }; + diff --git a/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch index 325fca62f3e..9383e48856d 100644 --- a/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/pending-5.10/476-mtd-spi-nor-add-eon-en25q128.patch @@ -8,7 +8,7 @@ Signed-off-by: Piotr Dymacz --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -15,6 +15,7 @@ static const struct flash_info eon_parts +@@ -25,6 +25,7 @@ static const struct flash_info eon_parts { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch b/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch index adddf82ac8f..3c579e55e34 100644 --- a/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch +++ b/target/linux/generic/pending-5.10/477-mtd-spi-nor-add-eon-en25qx128a.patch @@ -11,7 +11,7 @@ Signed-off-by: Christian Marangi --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -16,6 +16,7 @@ static const struct flash_info eon_parts +@@ -26,6 +26,7 @@ static const struct flash_info eon_parts { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, diff --git a/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch b/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch index 325fca62f3e..9383e48856d 100644 --- a/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch +++ b/target/linux/generic/pending-5.15/476-mtd-spi-nor-add-eon-en25q128.patch @@ -8,7 +8,7 @@ Signed-off-by: Piotr Dymacz --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -15,6 +15,7 @@ static const struct flash_info eon_parts +@@ -25,6 +25,7 @@ static const struct flash_info eon_parts { "en25q32b", INFO(0x1c3016, 0, 64 * 1024, 64, 0) }, { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, diff --git a/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch b/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch index adddf82ac8f..3c579e55e34 100644 --- a/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch +++ b/target/linux/generic/pending-5.15/477-mtd-spi-nor-add-eon-en25qx128a.patch @@ -11,7 +11,7 @@ Signed-off-by: Christian Marangi --- a/drivers/mtd/spi-nor/eon.c +++ b/drivers/mtd/spi-nor/eon.c -@@ -16,6 +16,7 @@ static const struct flash_info eon_parts +@@ -26,6 +26,7 @@ static const struct flash_info eon_parts { "en25p64", INFO(0x1c2017, 0, 64 * 1024, 128, 0) }, { "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) }, { "en25q128", INFO(0x1c3018, 0, 64 * 1024, 256, SECT_4K) }, From f6d394e9f2fd41547236c092ac914322220eb77c Mon Sep 17 00:00:00 2001 From: "Leon M. Busch-George" Date: Sat, 12 Nov 2022 19:31:41 +0100 Subject: [PATCH 27/49] ramips: add support for Cudy M1800 Specifications SoC: MT7621 CPU: 880 MHz Flash: 32 MiB RAM: 256 MiB WLAN: MT7915 WiFi 6 (2.4/5 GHz) Ethernet: 2x Gbit ports MAC LAN b4:4b:d6:2e:c7:b0 (label) WAN b4:4b:d6:2e:c7:b1 WiFi 2.4 00:0c:43:26:46:08 WiFi 5 00:0c:43:26:59:97 Installation There are two known options: 1) The Luci-based UI. 2) Press and hold the reset button during power up. The router will request 'recovery.bin' from a TFTP server at 192.168.1.88. Both options require a signed firmware binary. The openwrt image supplied by cudy is signed and can be used to install unsigned images. Signed-off-by: Leon M. Busch-George --- target/linux/ramips/dts/mt7621_cudy_m1800.dts | 177 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 10 + .../mt7621/base-files/etc/board.d/02_network | 9 +- 3 files changed, 192 insertions(+), 4 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_cudy_m1800.dts diff --git a/target/linux/ramips/dts/mt7621_cudy_m1800.dts b/target/linux/ramips/dts/mt7621_cudy_m1800.dts new file mode 100644 index 00000000000..314fdb206ca --- /dev/null +++ b/target/linux/ramips/dts/mt7621_cudy_m1800.dts @@ -0,0 +1,177 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "cudy,m1800", "mediatek,mt7621-soc"; + model = "Cudy M1800"; + + aliases { + led-boot = &led_internet_white; + led-failsafe = &led_internet_white; + led-running = &led_internet_white; + led-upgrade = &led_internet_white; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_internet_white: internet-white { + label = "white:internet"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + internet-red { + label = "red:internet"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&gmac1 { + status = "okay"; + label = "lan"; + phy-handle = <ðphy4>; + + nvmem-cells = <&macaddr_bdinfo_de00>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy4: ethernet-phy@4 { + reg = <4>; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0000>; + mediatek,disable-radar-background; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <50000000>; + m25p,fast-read; + broken-flash-reset; + + 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; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + + partition@1000000 { + label = "app"; + reg = <0x1000000 0xfd0000>; + read-only; + }; + + partition@1fd0000 { + label = "debug"; + reg = <0x1fd0000 0x10000>; + read-only; + }; + + partition@1fe0000 { + label = "backup"; + reg = <0x1fe0000 0x10000>; + read-only; + }; + + partition@1ff0000 { + label = "bdinfo"; + reg = <0x1ff0000 0x10000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_de00: macaddr@de00 { + reg = <0xde00 0x6>; + }; + }; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "uart3"; + function = "gpio"; + }; +}; + +&switch0 { + ports { + port@3 { + status = "okay"; + label = "wan"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1b4e1dc0398..2fc193634b0 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -426,6 +426,16 @@ define Device/bolt_arion endef TARGET_DEVICES += bolt_arion +define Device/cudy_m1800 + $(Device/dsa-migration) + DEVICE_VENDOR := Cudy + DEVICE_MODEL := M1800 + IMAGE_SIZE := 16064k + UIMAGE_NAME := R17 + DEVICE_PACKAGES := kmod-mt7915e +endef +TARGET_DEVICES += cudy_m1800 + define Device/cudy_wr1300-v1 $(Device/dsa-migration) IMAGE_SIZE := 15872k 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 f0ac4f1c4fd..dea433dec42 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 @@ -78,6 +78,11 @@ ramips_setup_interfaces() uci add_list firewall.@zone[1].network='eth_data' uci add_list firewall.@zone[1].network='eth_om' ;; + cudy,m1800|\ + yuncore,ax820|\ + zyxel,nt7101) + ucidef_set_interfaces_lan_wan "lan" "wan" + ;; gnubee,gb-pc1) ucidef_set_interface_lan "ethblack ethblue" ;; @@ -117,10 +122,6 @@ ramips_setup_interfaces() ubnt,usw-flex) ucidef_set_interface_lan "lan1 lan2 lan3 lan4 lan5" ;; - yuncore,ax820|\ - zyxel,nr7101) - ucidef_set_interfaces_lan_wan "lan" "wan" - ;; zyxel,wap6805) ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface "qtn" ifname "eth1" protocol "static" ipaddr "1.1.1.1" netmask "255.255.255.0" From af5635e6ca12d3be275560a58ac6e2793e218fcd Mon Sep 17 00:00:00 2001 From: Tim Harvey Date: Wed, 28 Dec 2022 13:38:15 -0800 Subject: [PATCH 28/49] octeontx: add sqaushfs and ramdisk to features Add squashfs and ramdisk to features as these are commonly used images for the octeontx. Signed-off-by: Tim Harvey --- target/linux/octeontx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/octeontx/Makefile b/target/linux/octeontx/Makefile index 9b29e567589..50c5cd6d217 100644 --- a/target/linux/octeontx/Makefile +++ b/target/linux/octeontx/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk ARCH:=aarch64 BOARD:=octeontx BOARDNAME:=Octeon-TX -FEATURES:=targz pcie gpio rtc usb fpu +FEATURES:=squashfs ramdisk targz pcie gpio rtc usb fpu SUBTARGETS:=generic KERNEL_PATCHVER:=5.10 From d3e89e69c52115d1c02f5c16a4aa6b721e003578 Mon Sep 17 00:00:00 2001 From: Enrico Mioso Date: Sun, 20 Nov 2022 05:19:06 +0100 Subject: [PATCH 29/49] mvebu: harmonize GL.iNet GL-MV1000 MTD partitions layout with vendor The GL-MV1000 ships with a 16MB spi-nor flash, containing a copy of the stock GL.iNet firmware. Add the corresponding flash areas, so our view matches the one of the in-flash stock firmware. Signed-off-by: Enrico Mioso --- .../dts/marvell/armada-3720-gl-mv1000.dts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts index acf15e8ca96..72d7267ccd0 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-3720-gl-mv1000.dts @@ -96,7 +96,7 @@ partition@f0000 { label = "u-boot-env"; - reg = <0Xf0000 0x8000>; + reg = <0xf0000 0x8000>; read-only; }; @@ -105,6 +105,24 @@ reg = <0xf8000 0x8000>; read-only; }; + + partition@100000 { + label = "gl-firmware-dtb"; + reg = <0x100000 0x10000>; + read-only; + }; + + partition@110000 { + label = "gl-firmware"; + reg = <0x110000 0xef0000>; + read-only; + }; + + partition@ef0000 { + label = "gl-firmware-jffs2"; + reg = <0xef0000 0x110000>; + read-only; + }; }; }; }; From 8dfe69cdfc5c943f946faa873ff330b47125011d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 6 Jan 2023 19:37:37 +0100 Subject: [PATCH 30/49] kernel: update nvmem subsystem to the latest upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- target/linux/at91/sam9x/config-5.10 | 1 + target/linux/at91/sama5/config-5.10 | 1 + target/linux/at91/sama7/config-5.10 | 1 + ...-rework-nvmem-cell-instance-creation.patch | 456 +++++++++++++++ ...-nvmem-cell-post-processing-callback.patch | 82 +++ ...cotp-add-support-for-post-processing.patch | 92 +++ ...upport-minimum-one-byte-access-stri.patch} | 0 ...-conflict-between-MTD-and-NVMEM-on-w.patch | 68 +++ ...-Remove-unused-devm_nvmem_unregister.patch | 72 +++ ...em-core-Use-devm_add_action_or_reset.patch | 58 ++ ...-input-parameter-for-NULL-in-nvmem_u.patch | 30 + ...4-nvmem-qfprom-fix-kerneldoc-warning.patch | 29 + ...sunxi_sid-Add-support-for-D1-variant.patch | 38 ++ ...fuse-replace-unnecessary-devm_kstrdu.patch | 28 + ...-for-Layerscape-SFP-Security-Fuse-Pr.patch | 139 +++++ ...rease-fuse-blow-timeout-to-prevent-w.patch | 32 ++ ...d-driver-for-OCOTP-in-Sunplus-SP7021.patch | 277 +++++++++ ...parse-NVRAM-content-into-NVMEM-cell.patch} | 0 ...mark-ACPI-device-ID-table-as-maybe-u.patch | 32 ++ ...em-sunplus-ocotp-staticize-sp_otp_v0.patch | 30 + ...cotp-drop-useless-probe-confirmation.patch | 27 + ...upport-passing-DT-node-in-cell-info.patch} | 2 +- ...find-Device-Tree-nodes-for-NVMEM-ce.patch} | 0 ...19-0006-nvmem-Add-Apple-eFuse-driver.patch | 130 +++++ ...ng-pm_runtime_resume_and_get-instead.patch | 31 + .../809-v5.19-0008-nvmem-sfp-Use-regmap.patch | 109 ++++ ...m-sfp-Add-support-for-TA-2.1-devices.patch | 38 ++ ...001-nvmem-microchip-otpc-add-support.patch | 389 +++++++++++++ ...Simplify-with-devm_platform_get_and_.patch | 32 ++ ...m-core-Fix-memleak-in-nvmem_register.patch | 52 ++ ...handling-U-Boot-environment-variabl.patch} | 28 +- ...-add-error-handling-for-dev_set_name.patch | 47 ++ ...-Use-kzalloc-for-allocating-only-one.patch | 29 + ...nvmem-prefix-all-symbols-with-NVMEM_.patch | 270 +++++++++ ...m-sort-config-symbols-alphabetically.patch | 535 ++++++++++++++++++ ...find-Device-Tree-nodes-for-NVMEM-ce.patch} | 6 +- ...1-0008-nvmem-lan9662-otp-add-support.patch | 274 +++++++++ ...m-u-boot-env-fix-crc32-casting-type.patch} | 8 +- ...em-lan9662-otp-Fix-compatible-string.patch | 34 ++ ...fix-crc32_data_offset-on-redundant-.patch} | 5 +- ...-Fix-return-value-check-in-rmem_read.patch | 36 ++ ...p-Change-return-type-of-lan9662_otp_.patch | 35 ++ ...e-STM32MP15_BSEC_NUM_LOWER-in-config.patch | 82 +++ ...-warning-when-upper-OTPs-are-updated.patch | 34 ++ ...nvmem-stm32-add-nvmem-type-attribute.patch | 26 + ...m-stm32-fix-spelling-typo-in-comment.patch | 27 + ...x-spelling-mistake-controlls-control.patch | 27 + ...oot-env-add-Broadcom-format-support.patch} | 6 +- ...nv-align-endianness-of-crc32-values.patch} | 2 +- ...ious-flag-to-disable-overcurrent-ch.patch} | 0 ...platform-add-spurious_oc-DT-support.patch} | 0 ...-rework-nvmem-cell-instance-creation.patch | 456 +++++++++++++++ ...-nvmem-cell-post-processing-callback.patch | 82 +++ ...cotp-add-support-for-post-processing.patch | 92 +++ ...support-minimum-one-byte-access-stri.patch | 47 ++ ...-Remove-unused-devm_nvmem_unregister.patch | 72 +++ ...em-core-Use-devm_add_action_or_reset.patch | 58 ++ ...-input-parameter-for-NULL-in-nvmem_u.patch | 30 + ...4-nvmem-qfprom-fix-kerneldoc-warning.patch | 29 + ...sunxi_sid-Add-support-for-D1-variant.patch | 38 ++ ...fuse-replace-unnecessary-devm_kstrdu.patch | 28 + ...-for-Layerscape-SFP-Security-Fuse-Pr.patch | 139 +++++ ...rease-fuse-blow-timeout-to-prevent-w.patch | 32 ++ ...d-driver-for-OCOTP-in-Sunplus-SP7021.patch | 291 ++++++++++ ...parse-NVRAM-content-into-NVMEM-cell.patch} | 0 ...mark-ACPI-device-ID-table-as-maybe-u.patch | 32 ++ ...em-sunplus-ocotp-staticize-sp_otp_v0.patch | 30 + ...cotp-drop-useless-probe-confirmation.patch | 27 + ...upport-passing-DT-node-in-cell-info.patch} | 2 +- ...find-Device-Tree-nodes-for-NVMEM-ce.patch} | 0 ...19-0006-nvmem-Add-Apple-eFuse-driver.patch | 130 +++++ ...ng-pm_runtime_resume_and_get-instead.patch | 31 + .../805-v5.19-0008-nvmem-sfp-Use-regmap.patch | 109 ++++ ...m-sfp-Add-support-for-TA-2.1-devices.patch | 38 ++ ...001-nvmem-microchip-otpc-add-support.patch | 389 +++++++++++++ ...Simplify-with-devm_platform_get_and_.patch | 32 ++ ...handling-U-Boot-environment-variabl.patch} | 28 +- ...-add-error-handling-for-dev_set_name.patch | 47 ++ ...-Use-kzalloc-for-allocating-only-one.patch | 29 + ...nvmem-prefix-all-symbols-with-NVMEM_.patch | 281 +++++++++ ...m-sort-config-symbols-alphabetically.patch | 535 ++++++++++++++++++ ...find-Device-Tree-nodes-for-NVMEM-ce.patch} | 6 +- ...1-0008-nvmem-lan9662-otp-add-support.patch | 274 +++++++++ ...m-u-boot-env-fix-crc32-casting-type.patch} | 8 +- ...em-lan9662-otp-Fix-compatible-string.patch | 34 ++ ...fix-crc32_data_offset-on-redundant-.patch} | 5 +- ...p-Change-return-type-of-lan9662_otp_.patch | 35 ++ ...e-STM32MP15_BSEC_NUM_LOWER-in-config.patch | 82 +++ ...-warning-when-upper-OTPs-are-updated.patch | 34 ++ ...nvmem-stm32-add-nvmem-type-attribute.patch | 26 + ...m-stm32-fix-spelling-typo-in-comment.patch | 27 + ...x-spelling-mistake-controlls-control.patch | 27 + ...oot-env-add-Broadcom-format-support.patch} | 6 +- ...nv-align-endianness-of-crc32-values.patch} | 2 +- target/linux/layerscape/armv8_64b/config-5.10 | 1 + 95 files changed, 7448 insertions(+), 40 deletions(-) create mode 100644 target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch create mode 100644 target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch create mode 100644 target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch rename target/linux/{mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch => generic/backport-5.10/807-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch} (100%) create mode 100644 target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch create mode 100644 target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch rename target/linux/{bcm53xx/patches-5.10/081-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch => generic/backport-5.10/808-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch} (100%) create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch rename target/linux/generic/{backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch => backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch} (95%) rename target/linux/{bcm53xx/patches-5.10/082-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch => generic/backport-5.10/809-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch} (100%) create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch create mode 100644 target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch create mode 100644 target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch create mode 100644 target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch rename target/linux/generic/backport-5.10/{823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch => 811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch} (89%) create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch rename target/linux/generic/{backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch => backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch} (79%) create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch rename target/linux/generic/backport-5.10/{823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch => 811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch} (74%) create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch rename target/linux/generic/backport-5.10/{825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch => 811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch} (89%) create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch create mode 100644 target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch create mode 100644 target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch create mode 100644 target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch create mode 100644 target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch create mode 100644 target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch create mode 100644 target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch rename target/linux/generic/{backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch => backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch} (90%) rename target/linux/generic/backport-5.10/{825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch => 813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch} (96%) rename target/linux/generic/backport-5.10/{810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch => 818-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch} (100%) rename target/linux/generic/backport-5.10/{811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch => 819-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch} (100%) create mode 100644 target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch create mode 100644 target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch create mode 100644 target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch create mode 100644 target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch create mode 100644 target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch rename target/linux/{bcm53xx/patches-5.15/080-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch => generic/backport-5.15/804-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch} (100%) create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch rename target/linux/generic/{backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch => backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch} (95%) rename target/linux/{bcm53xx/patches-5.15/081-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch => generic/backport-5.15/805-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch} (100%) create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch create mode 100644 target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch create mode 100644 target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch create mode 100644 target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch rename target/linux/generic/backport-5.15/{802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch => 807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch} (89%) create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch rename target/linux/generic/{backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch => backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch} (79%) create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch rename target/linux/generic/backport-5.15/{802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch => 807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch} (74%) create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch rename target/linux/generic/backport-5.15/{804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch => 807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch} (89%) create mode 100644 target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch create mode 100644 target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch create mode 100644 target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch create mode 100644 target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch create mode 100644 target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch create mode 100644 target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch rename target/linux/generic/{backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch => backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch} (90%) rename target/linux/generic/backport-5.15/{804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch => 809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch} (96%) diff --git a/target/linux/at91/sam9x/config-5.10 b/target/linux/at91/sam9x/config-5.10 index 021231d3dfd..73ee93f2ae1 100644 --- a/target/linux/at91/sam9x/config-5.10 +++ b/target/linux/at91/sam9x/config-5.10 @@ -197,6 +197,7 @@ CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NLS=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/at91/sama5/config-5.10 b/target/linux/at91/sama5/config-5.10 index ee607b484fb..42db74c621a 100644 --- a/target/linux/at91/sama5/config-5.10 +++ b/target/linux/at91/sama5/config-5.10 @@ -303,6 +303,7 @@ CONFIG_NLS_UTF8=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/at91/sama7/config-5.10 b/target/linux/at91/sama7/config-5.10 index 45568112e47..dbf7914a6a8 100644 --- a/target/linux/at91/sama7/config-5.10 +++ b/target/linux/at91/sama7/config-5.10 @@ -265,6 +265,7 @@ CONFIG_NLS_UTF8=y CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NVMEM=y +# CONFIG_NVMEM_MICROCHIP_OTPC is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch new file mode 100644 index 00000000000..fca7c5f848c --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch @@ -0,0 +1,456 @@ +From 7ae6478b304bc004c3139b422665b0e23b57f05c Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:55 +0100 +Subject: [PATCH] nvmem: core: rework nvmem cell instance creation + +In the existing design, we do not create a instance per nvmem cell consumer +but we directly refer cell from nvmem cell list that are added to provider. + +However this design has some limitations when consumers want to assign name +or connection id the nvmem cell instance, ex: via "nvmem-cell-names" or +id in nvmem_cell_get(id). + +Having a name associated with nvmem cell consumer instance will help +provider drivers in performing post processing of nvmem cell data if required +before data is seen by the consumers. This is pretty normal with some vendors +storing nvmem cells like mac-address in a vendor specific data layouts that +are not directly usable by the consumer drivers. + +With this patch nvmem cell will be created dynamically during nvmem_cell_get +and destroyed in nvmem_cell_put, allowing consumers to associate name with +nvmem cell consumer instance. + +With this patch a new struct nvmem_cell_entry replaces struct nvmem_cell +for storing nvmem cell information within the core. +This patch does not change nvmem-consumer interface based on nvmem_cell. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 165 +++++++++++++++++++++++++++---------------- + 1 file changed, 105 insertions(+), 60 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -45,8 +45,7 @@ struct nvmem_device { + #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) + + #define FLAG_COMPAT BIT(0) +- +-struct nvmem_cell { ++struct nvmem_cell_entry { + const char *name; + int offset; + int bytes; +@@ -57,6 +56,11 @@ struct nvmem_cell { + struct list_head node; + }; + ++struct nvmem_cell { ++ struct nvmem_cell_entry *entry; ++ const char *id; ++}; ++ + static DEFINE_MUTEX(nvmem_mutex); + static DEFINE_IDA(nvmem_ida); + +@@ -424,7 +428,7 @@ static struct bus_type nvmem_bus_type = + .name = "nvmem", + }; + +-static void nvmem_cell_drop(struct nvmem_cell *cell) ++static void nvmem_cell_entry_drop(struct nvmem_cell_entry *cell) + { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_REMOVE, cell); + mutex_lock(&nvmem_mutex); +@@ -437,13 +441,13 @@ static void nvmem_cell_drop(struct nvmem + + static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) + { +- struct nvmem_cell *cell, *p; ++ struct nvmem_cell_entry *cell, *p; + + list_for_each_entry_safe(cell, p, &nvmem->cells, node) +- nvmem_cell_drop(cell); ++ nvmem_cell_entry_drop(cell); + } + +-static void nvmem_cell_add(struct nvmem_cell *cell) ++static void nvmem_cell_entry_add(struct nvmem_cell_entry *cell) + { + mutex_lock(&nvmem_mutex); + list_add_tail(&cell->node, &cell->nvmem->cells); +@@ -451,9 +455,9 @@ static void nvmem_cell_add(struct nvmem_ + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_ADD, cell); + } + +-static int nvmem_cell_info_to_nvmem_cell_nodup(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + cell->nvmem = nvmem; + cell->offset = info->offset; +@@ -477,13 +481,13 @@ static int nvmem_cell_info_to_nvmem_cell + return 0; + } + +-static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + int err; + +- err = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, cell); ++ err = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, cell); + if (err) + return err; + +@@ -507,7 +511,7 @@ static int nvmem_add_cells(struct nvmem_ + const struct nvmem_cell_info *info, + int ncells) + { +- struct nvmem_cell **cells; ++ struct nvmem_cell_entry **cells; + int i, rval; + + cells = kcalloc(ncells, sizeof(*cells), GFP_KERNEL); +@@ -521,13 +525,13 @@ static int nvmem_add_cells(struct nvmem_ + goto err; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, &info[i], cells[i]); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, &info[i], cells[i]); + if (rval) { + kfree(cells[i]); + goto err; + } + +- nvmem_cell_add(cells[i]); ++ nvmem_cell_entry_add(cells[i]); + } + + /* remove tmp array */ +@@ -536,7 +540,7 @@ static int nvmem_add_cells(struct nvmem_ + return 0; + err: + while (i--) +- nvmem_cell_drop(cells[i]); ++ nvmem_cell_entry_drop(cells[i]); + + kfree(cells); + +@@ -573,7 +577,7 @@ static int nvmem_add_cells_from_table(st + { + const struct nvmem_cell_info *info; + struct nvmem_cell_table *table; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + int rval = 0, i; + + mutex_lock(&nvmem_cell_mutex); +@@ -588,15 +592,13 @@ static int nvmem_add_cells_from_table(st + goto out; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, +- info, +- cell); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, info, cell); + if (rval) { + kfree(cell); + goto out; + } + +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + } + } +@@ -606,10 +608,10 @@ out: + return rval; + } + +-static struct nvmem_cell * +-nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_name(struct nvmem_device *nvmem, const char *cell_id) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -680,7 +682,7 @@ static int nvmem_add_cells_from_of(struc + { + struct device_node *parent, *child; + struct device *dev = &nvmem->dev; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + const __be32 *addr; + int len; + +@@ -729,7 +731,7 @@ static int nvmem_add_cells_from_of(struc + } + + cell->np = of_node_get(child); +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + + return 0; +@@ -1144,9 +1146,33 @@ struct nvmem_device *devm_nvmem_device_g + } + EXPORT_SYMBOL_GPL(devm_nvmem_device_get); + ++static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry, const char *id) ++{ ++ struct nvmem_cell *cell; ++ const char *name = NULL; ++ ++ cell = kzalloc(sizeof(*cell), GFP_KERNEL); ++ if (!cell) ++ return ERR_PTR(-ENOMEM); ++ ++ if (id) { ++ name = kstrdup_const(id, GFP_KERNEL); ++ if (!name) { ++ kfree(cell); ++ return ERR_PTR(-ENOMEM); ++ } ++ } ++ ++ cell->id = name; ++ cell->entry = entry; ++ ++ return cell; ++} ++ + static struct nvmem_cell * + nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) + { ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; + struct nvmem_device *nvmem; +@@ -1171,11 +1197,15 @@ nvmem_cell_get_from_lookup(struct device + break; + } + +- cell = nvmem_find_cell_by_name(nvmem, +- lookup->cell_name); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_name(nvmem, ++ lookup->cell_name); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + cell = ERR_PTR(-ENOENT); ++ } else { ++ cell = nvmem_create_cell(cell_entry, con_id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); + } + break; + } +@@ -1186,10 +1216,10 @@ nvmem_cell_get_from_lookup(struct device + } + + #if IS_ENABLED(CONFIG_OF) +-static struct nvmem_cell * +-nvmem_find_cell_by_node(struct nvmem_device *nvmem, struct device_node *np) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_node(struct nvmem_device *nvmem, struct device_node *np) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -1219,6 +1249,7 @@ struct nvmem_cell *of_nvmem_cell_get(str + { + struct device_node *cell_np, *nvmem_np; + struct nvmem_device *nvmem; ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell; + int index = 0; + +@@ -1239,12 +1270,16 @@ struct nvmem_cell *of_nvmem_cell_get(str + if (IS_ERR(nvmem)) + return ERR_CAST(nvmem); + +- cell = nvmem_find_cell_by_node(nvmem, cell_np); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_node(nvmem, cell_np); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + return ERR_PTR(-ENOENT); + } + ++ cell = nvmem_create_cell(cell_entry, id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); ++ + return cell; + } + EXPORT_SYMBOL_GPL(of_nvmem_cell_get); +@@ -1350,13 +1385,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); + */ + void nvmem_cell_put(struct nvmem_cell *cell) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; ++ ++ if (cell->id) ++ kfree_const(cell->id); + ++ kfree(cell); + __nvmem_device_put(nvmem); + } + EXPORT_SYMBOL_GPL(nvmem_cell_put); + +-static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) ++static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void *buf) + { + u8 *p, *b; + int i, extra, bit_offset = cell->bit_offset; +@@ -1390,8 +1429,8 @@ static void nvmem_shift_read_buffer_in_p + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +- struct nvmem_cell *cell, +- void *buf, size_t *len) ++ struct nvmem_cell_entry *cell, ++ void *buf, size_t *len, const char *id) + { + int rc; + +@@ -1422,18 +1461,18 @@ static int __nvmem_cell_read(struct nvme + */ + void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; + u8 *buf; + int rc; + + if (!nvmem) + return ERR_PTR(-EINVAL); + +- buf = kzalloc(cell->bytes, GFP_KERNEL); ++ buf = kzalloc(cell->entry->bytes, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + +- rc = __nvmem_cell_read(nvmem, cell, buf, len); ++ rc = __nvmem_cell_read(nvmem, cell->entry, buf, len, cell->id); + if (rc) { + kfree(buf); + return ERR_PTR(rc); +@@ -1443,7 +1482,7 @@ void *nvmem_cell_read(struct nvmem_cell + } + EXPORT_SYMBOL_GPL(nvmem_cell_read); + +-static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, ++static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell_entry *cell, + u8 *_buf, int len) + { + struct nvmem_device *nvmem = cell->nvmem; +@@ -1496,16 +1535,7 @@ err: + return ERR_PTR(rc); + } + +-/** +- * nvmem_cell_write() - Write to a given nvmem cell +- * +- * @cell: nvmem cell to be written. +- * @buf: Buffer to be written. +- * @len: length of buffer to be written to nvmem cell. +- * +- * Return: length of bytes written or negative on failure. +- */ +-int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++static int __nvmem_cell_entry_write(struct nvmem_cell_entry *cell, void *buf, size_t len) + { + struct nvmem_device *nvmem = cell->nvmem; + int rc; +@@ -1531,6 +1561,21 @@ int nvmem_cell_write(struct nvmem_cell * + + return len; + } ++ ++/** ++ * nvmem_cell_write() - Write to a given nvmem cell ++ * ++ * @cell: nvmem cell to be written. ++ * @buf: Buffer to be written. ++ * @len: length of buffer to be written to nvmem cell. ++ * ++ * Return: length of bytes written or negative on failure. ++ */ ++int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++{ ++ return __nvmem_cell_entry_write(cell->entry, buf, len); ++} ++ + EXPORT_SYMBOL_GPL(nvmem_cell_write); + + static int nvmem_cell_read_common(struct device *dev, const char *cell_id, +@@ -1633,7 +1678,7 @@ static const void *nvmem_cell_read_varia + if (IS_ERR(cell)) + return cell; + +- nbits = cell->nbits; ++ nbits = cell->entry->nbits; + buf = nvmem_cell_read(cell, len); + nvmem_cell_put(cell); + if (IS_ERR(buf)) +@@ -1729,18 +1774,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab + ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + ssize_t len; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- rc = __nvmem_cell_read(nvmem, &cell, buf, &len); ++ rc = __nvmem_cell_read(nvmem, &cell, buf, &len, NULL); + if (rc) + return rc; + +@@ -1760,17 +1805,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read + int nvmem_device_cell_write(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- return nvmem_cell_write(&cell, buf, cell.bytes); ++ return __nvmem_cell_entry_write(&cell, buf, cell.bytes); + } + EXPORT_SYMBOL_GPL(nvmem_device_cell_write); + diff --git a/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch new file mode 100644 index 00000000000..787fea30375 --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch @@ -0,0 +1,82 @@ +From 5008062f1c3f5af3acf86164aa6fcc77b0c7bdce Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:56 +0100 +Subject: [PATCH] nvmem: core: add nvmem cell post processing callback + +Some NVMEM providers have certain nvmem cells encoded, which requires +post processing before actually using it. + +For example mac-address is stored in either in ascii or delimited or reverse-order. + +Having a post-process callback hook to provider drivers would enable them to +do this vendor specific post processing before nvmem consumers see it. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 9 +++++++++ + include/linux/nvmem-provider.h | 5 +++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -38,6 +38,7 @@ struct nvmem_device { + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + struct gpio_desc *wp_gpio; + void *priv; + }; +@@ -798,6 +799,7 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->cell_post_process = config->cell_post_process; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; + if (config->of_node) +@@ -1443,6 +1445,13 @@ static int __nvmem_cell_read(struct nvme + if (cell->bit_offset || cell->nbits) + nvmem_shift_read_buffer_in_place(cell, buf); + ++ if (nvmem->cell_post_process) { ++ rc = nvmem->cell_post_process(nvmem->priv, id, ++ cell->offset, buf, cell->bytes); ++ if (rc) ++ return rc; ++ } ++ + if (len) + *len = cell->bytes; + +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *pr + void *val, size_t bytes); + typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, + void *val, size_t bytes); ++/* used for vendor specific post processing of cell data */ ++typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, unsigned int offset, ++ void *buf, size_t bytes); + + enum nvmem_type { + NVMEM_TYPE_UNKNOWN = 0, +@@ -62,6 +65,7 @@ struct nvmem_keepout { + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. ++ * @cell_post_process: Callback for vendor specific post processing of cell data + * @size: Device size. + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. +@@ -92,6 +96,7 @@ struct nvmem_config { + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + int size; + int word_size; + int stride; diff --git a/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch b/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch new file mode 100644 index 00000000000..ee19228270d --- /dev/null +++ b/target/linux/generic/backport-5.10/806-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch @@ -0,0 +1,92 @@ +From d0221a780cbc99fec6c27a98dba2828dc5735c00 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:57 +0100 +Subject: [PATCH] nvmem: imx-ocotp: add support for post processing + +Add .cell_post_process callback for imx-ocotp to deal with MAC address, +since MAC address need to be reversed byte for some i.MX SoCs. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -97,6 +97,7 @@ struct ocotp_params { + unsigned int bank_address_words; + void (*set_timing)(struct ocotp_priv *priv); + struct ocotp_ctrl_reg ctrl; ++ bool reverse_mac_address; + }; + + static int imx_ocotp_wait_for_busy(struct ocotp_priv *priv, u32 flags) +@@ -221,6 +222,25 @@ read_end: + return ret; + } + ++static int imx_ocotp_cell_pp(void *context, const char *id, unsigned int offset, ++ void *data, size_t bytes) ++{ ++ struct ocotp_priv *priv = context; ++ ++ /* Deal with some post processing of nvmem cell data */ ++ if (id && !strcmp(id, "mac-address")) { ++ if (priv->params->reverse_mac_address) { ++ u8 *buf = data; ++ int i; ++ ++ for (i = 0; i < bytes/2; i++) ++ swap(buf[i], buf[bytes - i - 1]); ++ } ++ } ++ ++ return 0; ++} ++ + static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) + { + unsigned long clk_rate; +@@ -468,6 +488,7 @@ static struct nvmem_config imx_ocotp_nvm + .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, ++ .cell_post_process = imx_ocotp_cell_pp, + }; + + static const struct ocotp_params imx6q_params = { +@@ -530,6 +551,7 @@ static const struct ocotp_params imx8mq_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mm_params = { +@@ -537,6 +559,7 @@ static const struct ocotp_params imx8mm_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mn_params = { +@@ -544,6 +567,7 @@ static const struct ocotp_params imx8mn_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mp_params = { +@@ -551,6 +575,7 @@ static const struct ocotp_params imx8mp_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_8MP, ++ .reverse_mac_address = true, + }; + + static const struct of_device_id imx_ocotp_dt_ids[] = { diff --git a/target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/generic/backport-5.10/807-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch similarity index 100% rename from target/linux/mediatek/patches-5.15/800-v5.17-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch rename to target/linux/generic/backport-5.10/807-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch diff --git a/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch b/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch new file mode 100644 index 00000000000..a9ef3e27e03 --- /dev/null +++ b/target/linux/generic/backport-5.10/807-v5.17-0003-nvmem-core-Fix-a-conflict-between-MTD-and-NVMEM-on-w.patch @@ -0,0 +1,68 @@ +From f6c052afe6f802d87c74153b7a57c43b2e9faf07 Mon Sep 17 00:00:00 2001 +From: Christophe Kerello +Date: Sun, 20 Feb 2022 15:14:31 +0000 +Subject: [PATCH] nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios + property + +Wp-gpios property can be used on NVMEM nodes and the same property can +be also used on MTD NAND nodes. In case of the wp-gpios property is +defined at NAND level node, the GPIO management is done at NAND driver +level. Write protect is disabled when the driver is probed or resumed +and is enabled when the driver is released or suspended. + +When no partitions are defined in the NAND DT node, then the NAND DT node +will be passed to NVMEM framework. If wp-gpios property is defined in +this node, the GPIO resource is taken twice and the NAND controller +driver fails to probe. + +It would be possible to set config->wp_gpio at MTD level before calling +nvmem_register function but NVMEM framework will toggle this GPIO on +each write when this GPIO should only be controlled at NAND level driver +to ensure that the Write Protect has not been enabled. + +A way to fix this conflict is to add a new boolean flag in nvmem_config +named ignore_wp. In case ignore_wp is set, the GPIO resource will +be managed by the provider. + +Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin") +Cc: stable@vger.kernel.org +Signed-off-by: Christophe Kerello +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151432.16605-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 2 +- + include/linux/nvmem-provider.h | 4 +++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(cons + + if (config->wp_gpio) + nvmem->wp_gpio = config->wp_gpio; +- else ++ else if (!config->ignore_wp) + nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp", + GPIOD_OUT_HIGH); + if (IS_ERR(nvmem->wp_gpio)) { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -70,7 +70,8 @@ struct nvmem_keepout { + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. + * @priv: User context passed to read/write callbacks. +- * @wp-gpio: Write protect pin ++ * @wp-gpio: Write protect pin ++ * @ignore_wp: Write Protect pin is managed by the provider. + * + * Note: A default "nvmem" name will be assigned to the device if + * no name is specified in its configuration. In such case "" is +@@ -92,6 +93,7 @@ struct nvmem_config { + enum nvmem_type type; + bool read_only; + bool root_only; ++ bool ignore_wp; + struct device_node *of_node; + bool no_of_node; + nvmem_reg_read_t reg_read; diff --git a/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch new file mode 100644 index 00000000000..2005493dc06 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch @@ -0,0 +1,72 @@ +From 190fae468592bc2f0efc8b928920f8f712b5831e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:15 +0000 +Subject: [PATCH] nvmem: core: Remove unused devm_nvmem_unregister() + +There are no users and seems no will come of the devm_nvmem_unregister(). +Remove the function and remove the unused devm_nvmem_match() along with it. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 ---------------------- + include/linux/nvmem-provider.h | 8 -------- + 2 files changed, 30 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -945,28 +945,6 @@ struct nvmem_device *devm_nvmem_register + } + EXPORT_SYMBOL_GPL(devm_nvmem_register); + +-static int devm_nvmem_match(struct device *dev, void *res, void *data) +-{ +- struct nvmem_device **r = res; +- +- return *r == data; +-} +- +-/** +- * devm_nvmem_unregister() - Unregister previously registered managed nvmem +- * device. +- * +- * @dev: Device that uses the nvmem device. +- * @nvmem: Pointer to previously registered nvmem device. +- * +- * Return: Will be negative on error or zero on success. +- */ +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return devres_release(dev, devm_nvmem_release, devm_nvmem_match, nvmem); +-} +-EXPORT_SYMBOL(devm_nvmem_unregister); +- + static struct nvmem_device *__nvmem_device_get(void *data, + int (*match)(struct device *dev, const void *data)) + { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *cfg); + +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); +- + void nvmem_add_cell_table(struct nvmem_cell_table *table); + void nvmem_del_cell_table(struct nvmem_cell_table *table); + +@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev, + return nvmem_register(c); + } + +-static inline int +-devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return -EOPNOTSUPP; +-} +- + static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} + static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} + diff --git a/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch new file mode 100644 index 00000000000..01a1cdb2b34 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch @@ -0,0 +1,58 @@ +From 5825b2c6762611e67ccaf3ccf64485365a120f0b Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:16 +0000 +Subject: [PATCH] nvmem: core: Use devm_add_action_or_reset() + +Slightly simplify the devm_nvmem_register() by using the +devm_add_action_or_reset(). + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -907,9 +907,9 @@ void nvmem_unregister(struct nvmem_devic + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + +-static void devm_nvmem_release(struct device *dev, void *res) ++static void devm_nvmem_unregister(void *nvmem) + { +- nvmem_unregister(*(struct nvmem_device **)res); ++ nvmem_unregister(nvmem); + } + + /** +@@ -926,20 +926,16 @@ static void devm_nvmem_release(struct de + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *config) + { +- struct nvmem_device **ptr, *nvmem; +- +- ptr = devres_alloc(devm_nvmem_release, sizeof(*ptr), GFP_KERNEL); +- if (!ptr) +- return ERR_PTR(-ENOMEM); ++ struct nvmem_device *nvmem; ++ int ret; + + nvmem = nvmem_register(config); ++ if (IS_ERR(nvmem)) ++ return nvmem; + +- if (!IS_ERR(nvmem)) { +- *ptr = nvmem; +- devres_add(dev, ptr); +- } else { +- devres_free(ptr); +- } ++ ret = devm_add_action_or_reset(dev, devm_nvmem_unregister, nvmem); ++ if (ret) ++ return ERR_PTR(ret); + + return nvmem; + } diff --git a/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch new file mode 100644 index 00000000000..3a806fe6223 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch @@ -0,0 +1,30 @@ +From 8c751e0d9a5264376935a84429a2d468c8877d99 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:17 +0000 +Subject: [PATCH] nvmem: core: Check input parameter for NULL in + nvmem_unregister() + +nvmem_unregister() frees resources and standard pattern is to allow +caller to not care if it's NULL or not. This will reduce burden on +the callers to perform this check. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -903,7 +903,8 @@ static void nvmem_device_release(struct + */ + void nvmem_unregister(struct nvmem_device *nvmem) + { +- kref_put(&nvmem->refcnt, nvmem_device_release); ++ if (nvmem) ++ kref_put(&nvmem->refcnt, nvmem_device_release); + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + diff --git a/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch b/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch new file mode 100644 index 00000000000..c98f8e9d545 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch @@ -0,0 +1,29 @@ +From 05196facc052385960028ac634447ecf6c764ec3 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Sun, 20 Feb 2022 15:15:18 +0000 +Subject: [PATCH] nvmem: qfprom: fix kerneldoc warning + +This patch fixes below kernel doc warning, +warning: expecting prototype for qfprom_efuse_reg_write(). +Prototype was for qfprom_reg_write() instead + +No code changes. + +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -244,7 +244,7 @@ err_clk_prepared: + } + + /** +- * qfprom_efuse_reg_write() - Write to fuses. ++ * qfprom_reg_write() - Write to fuses. + * @context: Our driver data. + * @reg: The offset to write at. + * @_val: Pointer to data to write. diff --git a/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch b/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch new file mode 100644 index 00000000000..6aad6af0800 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch @@ -0,0 +1,38 @@ +From 07ae4fde9efada7878e1383d6ccc7da70315ca23 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 20 Feb 2022 15:15:20 +0000 +Subject: [PATCH] nvmem: sunxi_sid: Add support for D1 variant + +D1 has a smaller eFuse block than some other recent SoCs, and it no +longer requires a workaround to read the eFuse data. + +Signed-off-by: Samuel Holland +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -184,6 +184,11 @@ static const struct sunxi_sid_cfg sun8i_ + .need_register_readout = true, + }; + ++static const struct sunxi_sid_cfg sun20i_d1_cfg = { ++ .value_offset = 0x200, ++ .size = 0x100, ++}; ++ + static const struct sunxi_sid_cfg sun50i_a64_cfg = { + .value_offset = 0x200, + .size = 0x100, +@@ -200,6 +205,7 @@ static const struct of_device_id sunxi_s + { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg }, + { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg }, ++ { .compatible = "allwinner,sun20i-d1-sid", .data = &sun20i_d1_cfg }, + { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg }, diff --git a/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch b/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch new file mode 100644 index 00000000000..a73b42c5de3 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch @@ -0,0 +1,28 @@ +From 4dc8d89faed9bb05f116fa1794fc955b14910386 Mon Sep 17 00:00:00 2001 +From: Xiaoke Wang +Date: Sun, 20 Feb 2022 15:15:21 +0000 +Subject: [PATCH] nvmem: meson-mx-efuse: replace unnecessary devm_kstrdup() + +Replace unnecessary devm_kstrdup() so to avoid redundant memory allocation. + +Suggested-by: Martin Blumenstingl +Signed-off-by: Xiaoke Wang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/meson-mx-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -209,8 +209,7 @@ static int meson_mx_efuse_probe(struct p + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + +- efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, +- GFP_KERNEL); ++ efuse->config.name = drvdata->name; + efuse->config.owner = THIS_MODULE; + efuse->config.dev = &pdev->dev; + efuse->config.priv = efuse; diff --git a/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch b/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch new file mode 100644 index 00000000000..6afb68b3f91 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch @@ -0,0 +1,139 @@ +From f78451012b9e159afdba31c3eb69f223a9f42adc Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sun, 20 Feb 2022 15:15:23 +0000 +Subject: [PATCH] nvmem: add driver for Layerscape SFP (Security Fuse + Processor) + +Add support for the Security Fuse Processor found on Layerscape SoCs. +This driver implements basic read access. + +Signed-off-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 +++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/layerscape-sfp.c | 89 ++++++++++++++++++++++++++++++++++ + 3 files changed, 103 insertions(+) + create mode 100644 drivers/nvmem/layerscape-sfp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -300,4 +300,16 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o +--- /dev/null ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -0,0 +1,89 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Layerscape SFP driver ++ * ++ * Copyright (c) 2022 Michael Walle ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 ++ ++struct layerscape_sfp_priv { ++ void __iomem *base; ++}; ++ ++struct layerscape_sfp_data { ++ int size; ++}; ++ ++static int layerscape_sfp_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct layerscape_sfp_priv *priv = context; ++ ++ memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, ++ bytes); ++ ++ return 0; ++} ++ ++static struct nvmem_config layerscape_sfp_nvmem_config = { ++ .name = "fsl-sfp", ++ .reg_read = layerscape_sfp_read, ++}; ++ ++static int layerscape_sfp_probe(struct platform_device *pdev) ++{ ++ const struct layerscape_sfp_data *data; ++ struct layerscape_sfp_priv *priv; ++ struct nvmem_device *nvmem; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ data = device_get_match_data(&pdev->dev); ++ ++ layerscape_sfp_nvmem_config.size = data->size; ++ layerscape_sfp_nvmem_config.dev = &pdev->dev; ++ layerscape_sfp_nvmem_config.priv = priv; ++ ++ nvmem = devm_nvmem_register(&pdev->dev, &layerscape_sfp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct layerscape_sfp_data ls1028a_data = { ++ .size = 0x88, ++}; ++ ++static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, layerscape_sfp_dt_ids); ++ ++static struct platform_driver layerscape_sfp_driver = { ++ .probe = layerscape_sfp_probe, ++ .driver = { ++ .name = "layerscape_sfp", ++ .of_match_table = layerscape_sfp_dt_ids, ++ }, ++}; ++module_platform_driver(layerscape_sfp_driver); ++ ++MODULE_AUTHOR("Michael Walle "); ++MODULE_DESCRIPTION("Layerscape Security Fuse Processor driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch b/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch new file mode 100644 index 00000000000..74bd4a7eb67 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch @@ -0,0 +1,32 @@ +From bc5c75e0a5a9400f81a987cc720100ac475fa4d8 Mon Sep 17 00:00:00 2001 +From: Knox Chiou +Date: Wed, 23 Feb 2022 22:35:00 +0000 +Subject: [PATCH] nvmem: qfprom: Increase fuse blow timeout to prevent write + fail + +sc7180 blow fuses got slightly chances to hit qfprom_reg_write timeout. +Current timeout is simply too low. Since blowing fuses is a +very rare operation, so the risk associated with overestimating this +number is low. +Increase fuse blow timeout from 1ms to 10ms. + +Reviewed-by: Douglas Anderson +Signed-off-by: Knox Chiou +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -22,7 +22,7 @@ + + /* Amount of time required to hold charge to blow fuse in micro-seconds */ + #define QFPROM_FUSE_BLOW_POLL_US 100 +-#define QFPROM_FUSE_BLOW_TIMEOUT_US 1000 ++#define QFPROM_FUSE_BLOW_TIMEOUT_US 10000 + + #define QFPROM_BLOW_STATUS_OFFSET 0x048 + #define QFPROM_BLOW_STATUS_BUSY 0x1 diff --git a/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch new file mode 100644 index 00000000000..9520140a673 --- /dev/null +++ b/target/linux/generic/backport-5.10/808-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -0,0 +1,277 @@ +From 8747ec2e9762ed9ae53b3a590938f454b6a1abdf Mon Sep 17 00:00:00 2001 +From: Vincent Shih +Date: Wed, 23 Feb 2022 22:35:01 +0000 +Subject: [PATCH] nvmem: Add driver for OCOTP in Sunplus SP7021 + +Add driver for OCOTP in Sunplus SP7021 + +Signed-off-by: Vincent Shih +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 5 + + drivers/nvmem/Kconfig | 12 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/sunplus-ocotp.c | 228 ++++++++++++++++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 drivers/nvmem/sunplus-ocotp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -312,4 +312,16 @@ config NVMEM_LAYERSCAPE_SFP + This driver can also be built as a module. If so, the module + will be called layerscape-sfp. + ++config NVMEM_SUNPLUS_OCOTP ++ tristate "Sunplus SoC OTP support" ++ depends on SOC_SP7021 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the On-chip OTP controller (OCOTP) available ++ on Sunplus SoCs. It provides access to 128 bytes of one-time ++ programmable eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-sunplus-ocotp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -63,3 +63,5 @@ obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_ + nvmem_brcm_nvram-y := brcm_nvram.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o ++obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o +--- /dev/null ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -0,0 +1,228 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/* ++ * The OCOTP driver for Sunplus SP7021 ++ * ++ * Copyright (C) 2019 Sunplus Technology Inc., All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * OTP memory ++ * Each bank contains 4 words (32 bits). ++ * Bank 0 starts at offset 0 from the base. ++ */ ++ ++#define OTP_WORDS_PER_BANK 4 ++#define OTP_WORD_SIZE sizeof(u32) ++#define OTP_BIT_ADDR_OF_BANK (8 * OTP_WORD_SIZE * OTP_WORDS_PER_BANK) ++#define QAC628_OTP_NUM_BANKS 8 ++#define QAC628_OTP_SIZE (QAC628_OTP_NUM_BANKS * OTP_WORDS_PER_BANK * OTP_WORD_SIZE) ++#define OTP_READ_TIMEOUT_US 200000 ++ ++/* HB_GPIO */ ++#define ADDRESS_8_DATA 0x20 ++ ++/* OTP_RX */ ++#define OTP_CONTROL_2 0x48 ++#define OTP_RD_PERIOD GENMASK(15, 8) ++#define OTP_RD_PERIOD_MASK ~GENMASK(15, 8) ++#define CPU_CLOCK FIELD_PREP(OTP_RD_PERIOD, 30) ++#define SEL_BAK_KEY2 BIT(5) ++#define SEL_BAK_KEY2_MASK ~BIT(5) ++#define SW_TRIM_EN BIT(4) ++#define SW_TRIM_EN_MASK ~BIT(4) ++#define SEL_BAK_KEY BIT(3) ++#define SEL_BAK_KEY_MASK ~BIT(3) ++#define OTP_READ BIT(2) ++#define OTP_LOAD_SECURE_DATA BIT(1) ++#define OTP_LOAD_SECURE_DATA_MASK ~BIT(1) ++#define OTP_DO_CRC BIT(0) ++#define OTP_DO_CRC_MASK ~BIT(0) ++#define OTP_STATUS 0x4c ++#define OTP_READ_DONE BIT(4) ++#define OTP_READ_DONE_MASK ~BIT(4) ++#define OTP_LOAD_SECURE_DONE_MASK ~BIT(2) ++#define OTP_READ_ADDRESS 0x50 ++ ++enum base_type { ++ HB_GPIO, ++ OTPRX, ++ BASEMAX, ++}; ++ ++struct sp_ocotp_priv { ++ struct device *dev; ++ void __iomem *base[BASEMAX]; ++ struct clk *clk; ++}; ++ ++struct sp_ocotp_data { ++ int size; ++}; ++ ++const struct sp_ocotp_data sp_otp_v0 = { ++ .size = QAC628_OTP_SIZE, ++}; ++ ++static int sp_otp_read_real(struct sp_ocotp_priv *otp, int addr, char *value) ++{ ++ unsigned int addr_data; ++ unsigned int byte_shift; ++ unsigned int status; ++ int ret; ++ ++ addr_data = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr_data = addr_data / OTP_WORD_SIZE; ++ ++ byte_shift = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ byte_shift = byte_shift % OTP_WORD_SIZE; ++ ++ addr = addr / (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr = addr * OTP_BIT_ADDR_OF_BANK; ++ ++ writel(readl(otp->base[OTPRX] + OTP_STATUS) & OTP_READ_DONE_MASK & ++ OTP_LOAD_SECURE_DONE_MASK, otp->base[OTPRX] + OTP_STATUS); ++ writel(addr, otp->base[OTPRX] + OTP_READ_ADDRESS); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) | OTP_READ, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) & SEL_BAK_KEY2_MASK & SW_TRIM_EN_MASK ++ & SEL_BAK_KEY_MASK & OTP_LOAD_SECURE_DATA_MASK & OTP_DO_CRC_MASK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel((readl(otp->base[OTPRX] + OTP_CONTROL_2) & OTP_RD_PERIOD_MASK) | CPU_CLOCK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ ++ ret = readl_poll_timeout(otp->base[OTPRX] + OTP_STATUS, status, ++ status & OTP_READ_DONE, 10, OTP_READ_TIMEOUT_US); ++ ++ if (ret < 0) ++ return ret; ++ ++ *value = (readl(otp->base[HB_GPIO] + ADDRESS_8_DATA + addr_data * OTP_WORD_SIZE) ++ >> (8 * byte_shift)) & 0xff; ++ ++ return ret; ++} ++ ++static int sp_ocotp_read(void *priv, unsigned int offset, void *value, size_t bytes) ++{ ++ struct sp_ocotp_priv *otp = priv; ++ unsigned int addr; ++ char *buf = value; ++ char val[4]; ++ int ret; ++ ++ ret = clk_enable(otp->clk); ++ if (ret) ++ return ret; ++ ++ *buf = 0; ++ for (addr = offset; addr < (offset + bytes); addr++) { ++ ret = sp_otp_read_real(otp, addr, val); ++ if (ret < 0) { ++ dev_err(otp->dev, "OTP read fail:%d at %d", ret, addr); ++ goto disable_clk; ++ } ++ ++ *buf++ = *val; ++ } ++ ++disable_clk: ++ clk_disable(otp->clk); ++ ++ return ret; ++} ++ ++static struct nvmem_config sp_ocotp_nvmem_config = { ++ .name = "sp-ocotp", ++ .read_only = true, ++ .word_size = 1, ++ .size = QAC628_OTP_SIZE, ++ .stride = 1, ++ .reg_read = sp_ocotp_read, ++ .owner = THIS_MODULE, ++}; ++ ++static int sp_ocotp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct sp_ocotp_priv *otp; ++ struct resource *res; ++ int ret; ++ ++ otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio"); ++ otp->base[HB_GPIO] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[HB_GPIO])) ++ return PTR_ERR(otp->base[HB_GPIO]); ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx"); ++ otp->base[OTPRX] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[OTPRX])) ++ return PTR_ERR(otp->base[OTPRX]); ++ ++ otp->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(otp->clk)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(otp->clk), ++ "devm_clk_get fail\n"); ++ ++ ret = clk_prepare(otp->clk); ++ if (ret < 0) { ++ dev_err(dev, "failed to prepare clk: %d\n", ret); ++ return ret; ++ } ++ ++ sp_ocotp_nvmem_config.priv = otp; ++ sp_ocotp_nvmem_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &sp_ocotp_nvmem_config); ++ if (IS_ERR(nvmem)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(nvmem), ++ "register nvmem device fail\n"); ++ ++ platform_set_drvdata(pdev, nvmem); ++ ++ dev_dbg(dev, "banks:%d x wpb:%d x wsize:%d = %d", ++ (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, ++ (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); ++ ++ dev_info(dev, "by Sunplus (C) 2020"); ++ ++ return 0; ++} ++ ++static const struct of_device_id sp_ocotp_dt_ids[] = { ++ { .compatible = "sunplus,sp7021-ocotp", .data = &sp_otp_v0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sp_ocotp_dt_ids); ++ ++static struct platform_driver sp_otp_driver = { ++ .probe = sp_ocotp_probe, ++ .driver = { ++ .name = "sunplus,sp7021-ocotp", ++ .of_match_table = sp_ocotp_dt_ids, ++ } ++}; ++module_platform_driver(sp_otp_driver); ++ ++MODULE_AUTHOR("Vincent Shih "); ++MODULE_DESCRIPTION("Sunplus On-Chip OTP driver"); ++MODULE_LICENSE("GPL"); ++ diff --git a/target/linux/bcm53xx/patches-5.10/081-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch b/target/linux/generic/backport-5.10/808-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.10/081-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch rename to target/linux/generic/backport-5.10/808-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch diff --git a/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch b/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch new file mode 100644 index 00000000000..ef3107db946 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch @@ -0,0 +1,32 @@ +From 6bd0ffeaa389866089e9573b2298ae58d6359b75 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:24 +0100 +Subject: [PATCH] nvmem: bcm-ocotp: mark ACPI device ID table as maybe unused +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +"bcm_otpc_acpi_ids" is used with ACPI_PTR, so a build with !CONFIG_ACPI +has a warning: + + drivers/nvmem/bcm-ocotp.c:247:36: error: + ‘bcm_otpc_acpi_ids’ defined but not used [-Werror=unused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-1-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/bcm-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/bcm-ocotp.c ++++ b/drivers/nvmem/bcm-ocotp.c +@@ -244,7 +244,7 @@ static const struct of_device_id bcm_otp + }; + MODULE_DEVICE_TABLE(of, bcm_otpc_dt_ids); + +-static const struct acpi_device_id bcm_otpc_acpi_ids[] = { ++static const struct acpi_device_id bcm_otpc_acpi_ids[] __maybe_unused = { + { .id = "BRCM0700", .driver_data = (kernel_ulong_t)&otp_map }, + { .id = "BRCM0701", .driver_data = (kernel_ulong_t)&otp_map_v2 }, + { /* sentinel */ } diff --git a/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch b/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch new file mode 100644 index 00000000000..a84d2316f0c --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch @@ -0,0 +1,30 @@ +From 1066f8156351fcd997125257cea47cf805ba4f6d Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:25 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: staticize sp_otp_v0 + +The "sp_otp_v0" file scope variable is not used outside, so make it +static to fix warning: + + drivers/nvmem/sunplus-ocotp.c:74:29: sparse: + sparse: symbol 'sp_otp_v0' was not declared. Should it be static? + +Reported-by: kernel test robot +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-2-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -71,7 +71,7 @@ struct sp_ocotp_data { + int size; + }; + +-const struct sp_ocotp_data sp_otp_v0 = { ++static const struct sp_ocotp_data sp_otp_v0 = { + .size = QAC628_OTP_SIZE, + }; + diff --git a/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch b/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch new file mode 100644 index 00000000000..886ebc12a9c --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch @@ -0,0 +1,27 @@ +From 874dfbcf219ccc42a2cbd187d087c7db82c3024b Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:26 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: drop useless probe confirmation + +Printing probe success is discouraged, because we can use tracing for +this purpose. Remove useless print message after Sunplus OCOTP driver +probe. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-3-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -202,8 +202,6 @@ static int sp_ocotp_probe(struct platfor + (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, + (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); + +- dev_info(dev, "by Sunplus (C) 2020"); +- + return 0; + } + diff --git a/target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch b/target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch similarity index 95% rename from target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch rename to target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch index 1acc6947fe1..3b1e76147a8 100644 --- a/target/linux/generic/backport-5.15/803-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch +++ b/target/linux/generic/backport-5.10/809-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -462,6 +462,7 @@ static int nvmem_cell_info_to_nvmem_cell +@@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; diff --git a/target/linux/bcm53xx/patches-5.10/082-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.10/809-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.10/082-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.10/809-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch diff --git a/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch b/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch new file mode 100644 index 00000000000..ebeb6f5ad39 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch @@ -0,0 +1,130 @@ +From b6b7ef932ae838209254f016ecf8862d716a5ced Mon Sep 17 00:00:00 2001 +From: Sven Peter +Date: Fri, 29 Apr 2022 17:26:50 +0100 +Subject: [PATCH] nvmem: Add Apple eFuse driver + +Apple SoCs contain eFuses used to store factory-programmed data such +as calibration values for the PCIe or the Type-C PHY. They are organized +as 32bit values exposed as MMIO. + +Signed-off-by: Sven Peter +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/apple-efuses.c | 80 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 94 insertions(+) + create mode 100644 drivers/nvmem/apple-efuses.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -324,4 +324,16 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -65,3 +65,5 @@ obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nv + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o + nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o +--- /dev/null ++++ b/drivers/nvmem/apple-efuses.c +@@ -0,0 +1,80 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Apple SoC eFuse driver ++ * ++ * Copyright (C) The Asahi Linux Contributors ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct apple_efuses_priv { ++ void __iomem *fuses; ++}; ++ ++static int apple_efuses_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct apple_efuses_priv *priv = context; ++ u32 *dst = val; ++ ++ while (bytes >= sizeof(u32)) { ++ *dst++ = readl_relaxed(priv->fuses + offset); ++ bytes -= sizeof(u32); ++ offset += sizeof(u32); ++ } ++ ++ return 0; ++} ++ ++static int apple_efuses_probe(struct platform_device *pdev) ++{ ++ struct apple_efuses_priv *priv; ++ struct resource *res; ++ struct nvmem_config config = { ++ .dev = &pdev->dev, ++ .read_only = true, ++ .reg_read = apple_efuses_read, ++ .stride = sizeof(u32), ++ .word_size = sizeof(u32), ++ .name = "apple_efuses_nvmem", ++ .id = NVMEM_DEVID_AUTO, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->fuses = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(priv->fuses)) ++ return PTR_ERR(priv->fuses); ++ ++ config.priv = priv; ++ config.size = resource_size(res); ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(config.dev, &config)); ++} ++ ++static const struct of_device_id apple_efuses_of_match[] = { ++ { .compatible = "apple,efuses", }, ++ {} ++}; ++ ++MODULE_DEVICE_TABLE(of, apple_efuses_of_match); ++ ++static struct platform_driver apple_efuses_driver = { ++ .driver = { ++ .name = "apple_efuses", ++ .of_match_table = apple_efuses_of_match, ++ }, ++ .probe = apple_efuses_probe, ++}; ++ ++module_platform_driver(apple_efuses_driver); ++ ++MODULE_AUTHOR("Sven Peter "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch b/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch new file mode 100644 index 00000000000..cd51d970069 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch @@ -0,0 +1,31 @@ +From 517f6e2641a2802dce5a5aa0d18c7d37a35678d2 Mon Sep 17 00:00:00 2001 +From: Minghao Chi +Date: Fri, 29 Apr 2022 17:26:54 +0100 +Subject: [PATCH] nvmem: qfprom: using pm_runtime_resume_and_get instead of + pm_runtime_get_sync + +Using pm_runtime_resume_and_get is more appropriate +for simplifing code + +Reported-by: Zeal Robot +Signed-off-by: Minghao Chi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -217,9 +217,8 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + +- ret = pm_runtime_get_sync(priv->dev); ++ ret = pm_runtime_resume_and_get(priv->dev); + if (ret < 0) { +- pm_runtime_put_noidle(priv->dev); + dev_err(priv->dev, "Failed to enable power-domain\n"); + goto err_reg_enable; + } diff --git a/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch b/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch new file mode 100644 index 00000000000..e187238ca38 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0008-nvmem-sfp-Use-regmap.patch @@ -0,0 +1,109 @@ +From 943eadbdb11314b41eacbcc484dfb7f93e271ff4 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:00 +0100 +Subject: [PATCH] nvmem: sfp: Use regmap + +This converts the SFP driver to use regmap. This will allow easily +supporting devices with different endians. We disallow byte-level +access, as regmap_bulk_read doesn't support it (and it's unclear what +the correct result would be when we have an endianness difference). + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-16-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + drivers/nvmem/layerscape-sfp.c | 30 ++++++++++++++++++++++-------- + 2 files changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -304,6 +304,7 @@ config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST + depends on HAS_IOMEM ++ select REGMAP_MMIO + help + This driver provides support to read the eFuses on Freescale + Layerscape SoC's. For example, the vendor provides a per part +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -13,15 +13,17 @@ + #include + #include + #include ++#include + + #define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 + + struct layerscape_sfp_priv { +- void __iomem *base; ++ struct regmap *regmap; + }; + + struct layerscape_sfp_data { + int size; ++ enum regmap_endian endian; + }; + + static int layerscape_sfp_read(void *context, unsigned int offset, void *val, +@@ -29,15 +31,16 @@ static int layerscape_sfp_read(void *con + { + struct layerscape_sfp_priv *priv = context; + +- memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, +- bytes); +- +- return 0; ++ return regmap_bulk_read(priv->regmap, ++ LAYERSCAPE_SFP_OTP_OFFSET + offset, val, ++ bytes / 4); + } + + static struct nvmem_config layerscape_sfp_nvmem_config = { + .name = "fsl-sfp", + .reg_read = layerscape_sfp_read, ++ .word_size = 4, ++ .stride = 4, + }; + + static int layerscape_sfp_probe(struct platform_device *pdev) +@@ -45,16 +48,26 @@ static int layerscape_sfp_probe(struct p + const struct layerscape_sfp_data *data; + struct layerscape_sfp_priv *priv; + struct nvmem_device *nvmem; ++ struct regmap_config config = { 0 }; ++ void __iomem *base; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->base = devm_platform_ioremap_resource(pdev, 0); +- if (IS_ERR(priv->base)) +- return PTR_ERR(priv->base); ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + + data = device_get_match_data(&pdev->dev); ++ config.reg_bits = 32; ++ config.reg_stride = 4; ++ config.val_bits = 32; ++ config.val_format_endian = data->endian; ++ config.max_register = LAYERSCAPE_SFP_OTP_OFFSET + data->size - 4; ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); + + layerscape_sfp_nvmem_config.size = data->size; + layerscape_sfp_nvmem_config.dev = &pdev->dev; +@@ -67,6 +80,7 @@ static int layerscape_sfp_probe(struct p + + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, ++ .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch b/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch new file mode 100644 index 00000000000..ee000986181 --- /dev/null +++ b/target/linux/generic/backport-5.10/809-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch @@ -0,0 +1,38 @@ +From 33a1c6618677fe33f8e84cb7bedc45abbce89a50 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:01 +0100 +Subject: [PATCH] nvmem: sfp: Add support for TA 2.1 devices + +This adds support for Trust Architecture (TA) 2.1 devices to the SFP driver. +There are few differences between TA 2.1 and TA 3.0, especially for +read-only support, so just re-use the existing data. + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-17-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/layerscape-sfp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -78,12 +78,18 @@ static int layerscape_sfp_probe(struct p + return PTR_ERR_OR_ZERO(nvmem); + } + ++static const struct layerscape_sfp_data ls1021a_data = { ++ .size = 0x88, ++ .endian = REGMAP_ENDIAN_BIG, ++}; ++ + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, + .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1021a-sfp", .data = &ls1021a_data }, + { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, + {}, + }; diff --git a/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch new file mode 100644 index 00000000000..eb99ec190cb --- /dev/null +++ b/target/linux/generic/backport-5.10/810-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -0,0 +1,389 @@ +From 98830350d3fc824c1ff5c338140fe20f041a5916 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Wed, 6 Jul 2022 11:06:22 +0100 +Subject: [PATCH] nvmem: microchip-otpc: add support + +Add support for Microchip OTP controller available on SAMA7G5. The OTPC +controls the access to a non-volatile memory. The memory behind OTPC is +organized into packets, packets are composed by a fixed length header +(4 bytes long) and a variable length payload (payload length is available +in the header). When software request the data at an offset in memory +the OTPC will return (via header + data registers) the whole packet that +has a word at that offset. For the OTP memory layout like below: + +offset OTP Memory layout + + . . + . ... . + . . +0x0E +-----------+ <--- packet X + | header X | +0x12 +-----------+ + | payload X | +0x16 | | + | | +0x1A | | + +-----------+ + . . + . ... . + . . + +if user requests data at address 0x16 the data started at 0x0E will be +returned by controller. User will be able to fetch the whole packet +starting at 0x0E (or parts of the packet) via proper registers. The same +packet will be returned if software request the data at offset 0x0E or +0x12 or 0x1A. + +The OTP will be populated by Microchip with at least 2 packets first one +being boot configuration packet and the 2nd one being temperature +calibration packet. The packet order will be preserved b/w different chip +revisions but the packet sizes may change. + +For the above reasons and to keep the same software able to work on all +chip variants the read function of the driver is working with a packet +id instead of an offset in OTP memory. + +Signed-off-by: Claudiu Beznea +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 8 + + drivers/nvmem/Kconfig | 7 + + drivers/nvmem/Makefile | 2 + + drivers/nvmem/microchip-otpc.c | 288 +++++++++++++++++++++++++++++++++ + 4 files changed, 305 insertions(+) + create mode 100644 drivers/nvmem/microchip-otpc.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -11565,6 +11565,14 @@ S: Supported + F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + F: drivers/mtd/nand/raw/atmel/* + ++MICROCHIP OTPC DRIVER ++M: Claudiu Beznea ++L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ++S: Supported ++F: Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml ++F: drivers/nvmem/microchip-otpc.c ++F: dt-bindings/nvmem/microchip,sama7g5-otpc.h ++ + MICROCHIP PWM DRIVER + M: Claudiu Beznea + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,13 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. ++ + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" + depends on WII || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -67,3 +67,5 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o +--- /dev/null ++++ b/drivers/nvmem/microchip-otpc.c +@@ -0,0 +1,288 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * OTP Memory controller ++ * ++ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries ++ * ++ * Author: Claudiu Beznea ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MCHP_OTPC_CR (0x0) ++#define MCHP_OTPC_CR_READ BIT(6) ++#define MCHP_OTPC_MR (0x4) ++#define MCHP_OTPC_MR_ADDR GENMASK(31, 16) ++#define MCHP_OTPC_AR (0x8) ++#define MCHP_OTPC_SR (0xc) ++#define MCHP_OTPC_SR_READ BIT(6) ++#define MCHP_OTPC_HR (0x20) ++#define MCHP_OTPC_HR_SIZE GENMASK(15, 8) ++#define MCHP_OTPC_DR (0x24) ++ ++#define MCHP_OTPC_NAME "mchp-otpc" ++#define MCHP_OTPC_SIZE (11 * 1024) ++ ++/** ++ * struct mchp_otpc - OTPC private data structure ++ * @base: base address ++ * @dev: struct device pointer ++ * @packets: list of packets in OTP memory ++ * @npackets: number of packets in OTP memory ++ */ ++struct mchp_otpc { ++ void __iomem *base; ++ struct device *dev; ++ struct list_head packets; ++ u32 npackets; ++}; ++ ++/** ++ * struct mchp_otpc_packet - OTPC packet data structure ++ * @list: list head ++ * @id: packet ID ++ * @offset: packet offset (in words) in OTP memory ++ */ ++struct mchp_otpc_packet { ++ struct list_head list; ++ u32 id; ++ u32 offset; ++}; ++ ++static struct mchp_otpc_packet *mchp_otpc_id_to_packet(struct mchp_otpc *otpc, ++ u32 id) ++{ ++ struct mchp_otpc_packet *packet; ++ ++ if (id >= otpc->npackets) ++ return NULL; ++ ++ list_for_each_entry(packet, &otpc->packets, list) { ++ if (packet->id == id) ++ return packet; ++ } ++ ++ return NULL; ++} ++ ++static int mchp_otpc_prepare_read(struct mchp_otpc *otpc, ++ unsigned int offset) ++{ ++ u32 tmp; ++ ++ /* Set address. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_MR); ++ tmp &= ~MCHP_OTPC_MR_ADDR; ++ tmp |= FIELD_PREP(MCHP_OTPC_MR_ADDR, offset); ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR); ++ ++ /* Set read. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR); ++ tmp |= MCHP_OTPC_CR_READ; ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR); ++ ++ /* Wait for packet to be transferred into temporary buffers. */ ++ return read_poll_timeout(readl_relaxed, tmp, !(tmp & MCHP_OTPC_SR_READ), ++ 10000, 2000, false, otpc->base + MCHP_OTPC_SR); ++} ++ ++/* ++ * OTPC memory is organized into packets. Each packets contains a header and ++ * a payload. Header is 4 bytes long and contains the size of the payload. ++ * Payload size varies. The memory footprint is something as follows: ++ * ++ * Memory offset Memory footprint Packet ID ++ * ------------- ---------------- --------- ++ * ++ * 0x0 +------------+ <-- packet 0 ++ * | header 0 | ++ * 0x4 +------------+ ++ * | payload 0 | ++ * . . ++ * . ... . ++ * . . ++ * offset1 +------------+ <-- packet 1 ++ * | header 1 | ++ * offset1 + 0x4 +------------+ ++ * | payload 1 | ++ * . . ++ * . ... . ++ * . . ++ * offset2 +------------+ <-- packet 2 ++ * . . ++ * . ... . ++ * . . ++ * offsetN +------------+ <-- packet N ++ * | header N | ++ * offsetN + 0x4 +------------+ ++ * | payload N | ++ * . . ++ * . ... . ++ * . . ++ * +------------+ ++ * ++ * where offset1, offset2, offsetN depends on the size of payload 0, payload 1, ++ * payload N-1. ++ * ++ * The access to memory is done on a per packet basis: the control registers ++ * need to be updated with an offset address (within a packet range) and the ++ * data registers will be update by controller with information contained by ++ * that packet. E.g. if control registers are updated with any address within ++ * the range [offset1, offset2) the data registers are updated by controller ++ * with packet 1. Header data is accessible though MCHP_OTPC_HR register. ++ * Payload data is accessible though MCHP_OTPC_DR and MCHP_OTPC_AR registers. ++ * There is no direct mapping b/w the offset requested by software and the ++ * offset returned by hardware. ++ * ++ * For this, the read function will return the first requested bytes in the ++ * packet. The user will have to be aware of the memory footprint before doing ++ * the read request. ++ */ ++static int mchp_otpc_read(void *priv, unsigned int off, void *val, ++ size_t bytes) ++{ ++ struct mchp_otpc *otpc = priv; ++ struct mchp_otpc_packet *packet; ++ u32 *buf = val; ++ u32 offset; ++ size_t len = 0; ++ int ret, payload_size; ++ ++ /* ++ * We reach this point with off being multiple of stride = 4 to ++ * be able to cross the subsystem. Inside the driver we use continuous ++ * unsigned integer numbers for packet id, thus devide off by 4 ++ * before passing it to mchp_otpc_id_to_packet(). ++ */ ++ packet = mchp_otpc_id_to_packet(otpc, off / 4); ++ if (!packet) ++ return -EINVAL; ++ offset = packet->offset; ++ ++ while (len < bytes) { ++ ret = mchp_otpc_prepare_read(otpc, offset); ++ if (ret) ++ return ret; ++ ++ /* Read and save header content. */ ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ len += sizeof(*buf); ++ offset++; ++ if (len >= bytes) ++ break; ++ ++ /* Read and save payload content. */ ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, *(buf - 1)); ++ writel_relaxed(0UL, otpc->base + MCHP_OTPC_AR); ++ do { ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_DR); ++ len += sizeof(*buf); ++ offset++; ++ payload_size--; ++ } while (payload_size >= 0 && len < bytes); ++ } ++ ++ return 0; ++} ++ ++static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) ++{ ++ struct mchp_otpc_packet *packet; ++ u32 word, word_pos = 0, id = 0, npackets = 0, payload_size; ++ int ret; ++ ++ INIT_LIST_HEAD(&otpc->packets); ++ *size = 0; ++ ++ while (*size < MCHP_OTPC_SIZE) { ++ ret = mchp_otpc_prepare_read(otpc, word_pos); ++ if (ret) ++ return ret; ++ ++ word = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, word); ++ if (!payload_size) ++ break; ++ ++ packet = devm_kzalloc(otpc->dev, sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ ++ packet->id = id++; ++ packet->offset = word_pos; ++ INIT_LIST_HEAD(&packet->list); ++ list_add_tail(&packet->list, &otpc->packets); ++ ++ /* Count size by adding header and paload sizes. */ ++ *size += 4 * (payload_size + 1); ++ /* Next word: this packet (header, payload) position + 1. */ ++ word_pos += payload_size + 2; ++ ++ npackets++; ++ } ++ ++ otpc->npackets = npackets; ++ ++ return 0; ++} ++ ++static struct nvmem_config mchp_nvmem_config = { ++ .name = MCHP_OTPC_NAME, ++ .type = NVMEM_TYPE_OTP, ++ .read_only = true, ++ .word_size = 4, ++ .stride = 4, ++ .reg_read = mchp_otpc_read, ++}; ++ ++static int mchp_otpc_probe(struct platform_device *pdev) ++{ ++ struct nvmem_device *nvmem; ++ struct mchp_otpc *otpc; ++ u32 size; ++ int ret; ++ ++ otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); ++ if (!otpc) ++ return -ENOMEM; ++ ++ otpc->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otpc->base)) ++ return PTR_ERR(otpc->base); ++ ++ otpc->dev = &pdev->dev; ++ ret = mchp_otpc_init_packets_list(otpc, &size); ++ if (ret) ++ return ret; ++ ++ mchp_nvmem_config.dev = otpc->dev; ++ mchp_nvmem_config.size = size; ++ mchp_nvmem_config.priv = otpc; ++ nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id __maybe_unused mchp_otpc_ids[] = { ++ { .compatible = "microchip,sama7g5-otpc", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, mchp_otpc_ids); ++ ++static struct platform_driver mchp_otpc_driver = { ++ .probe = mchp_otpc_probe, ++ .driver = { ++ .name = MCHP_OTPC_NAME, ++ .of_match_table = of_match_ptr(mchp_otpc_ids), ++ }, ++}; ++module_platform_driver(mchp_otpc_driver); ++ ++MODULE_AUTHOR("Claudiu Beznea "); ++MODULE_DESCRIPTION("Microchip SAMA7G5 OTPC driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch b/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch new file mode 100644 index 00000000000..6a4126b9ded --- /dev/null +++ b/target/linux/generic/backport-5.10/810-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch @@ -0,0 +1,32 @@ +From f5c97da8037b18d1256a58459fa96ed68e50fb41 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 6 Jul 2022 11:06:27 +0100 +Subject: [PATCH] nvmem: mtk-efuse: Simplify with + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +No functional changes. + +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -41,8 +41,7 @@ static int mtk_efuse_probe(struct platfo + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch new file mode 100644 index 00000000000..4d7ad9bba75 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0001-nvmem-core-Fix-memleak-in-nvmem_register.patch @@ -0,0 +1,52 @@ +From bd1244561fa2a4531ded40dbf09c9599084f8b29 Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:04:02 +0100 +Subject: [PATCH] nvmem: core: Fix memleak in nvmem_register() + +dev_set_name will alloc memory for nvmem->dev.kobj.name in +nvmem_register, when nvmem_validate_keepouts failed, nvmem's +memory will be freed and return, but nobody will free memory +for nvmem->dev.kobj.name, there will be memleak, so moving +nvmem_validate_keepouts() after device_register() and let +the device core deal with cleaning name in error cases. + +Fixes: de0534df9347 ("nvmem: core: fix error handling while validating keepout regions") +Cc: stable@vger.kernel.org +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916120402.38753-1-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 15 ++++++--------- + 1 file changed, 6 insertions(+), 9 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -829,21 +829,18 @@ struct nvmem_device *nvmem_register(cons + nvmem->dev.groups = nvmem_dev_groups; + #endif + +- if (nvmem->nkeepout) { +- rval = nvmem_validate_keepouts(nvmem); +- if (rval) { +- ida_free(&nvmem_ida, nvmem->id); +- kfree(nvmem); +- return ERR_PTR(rval); +- } +- } +- + dev_dbg(&nvmem->dev, "Registering nvmem device %s\n", config->name); + + rval = device_register(&nvmem->dev); + if (rval) + goto err_put_device; + ++ if (nvmem->nkeepout) { ++ rval = nvmem_validate_keepouts(nvmem); ++ if (rval) ++ goto err_device_del; ++ } ++ + if (config->compat) { + rval = nvmem_sysfs_setup_compat(nvmem, config); + if (rval) diff --git a/target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch similarity index 89% rename from target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch rename to target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch index a40c61f929e..9138807bc91 100644 --- a/target/linux/generic/backport-5.10/823-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -1,6 +1,6 @@ -From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From d5542923f200f95bddf524f36fd495f78aa28e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 15 Jun 2022 21:43:00 +0200 +Date: Fri, 16 Sep 2022 13:20:48 +0100 Subject: [PATCH] nvmem: add driver handling U-Boot environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -22,16 +22,24 @@ Kernel-parsed NVMEM cells can be read however by Linux drivers. This may be useful for Ethernet drivers for reading device MAC address which is often stored as U-Boot env variable. -Signed-off-by: Rafał Miłecki Reviewed-by: Ahmad Fatoum +Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- + MAINTAINERS | 1 + + drivers/nvmem/Kconfig | 13 +++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/u-boot-env.c | 218 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 234 insertions(+) + create mode 100644 drivers/nvmem/u-boot-env.c --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -300,4 +300,17 @@ config NVMEM_BRCM_NVRAM - This driver provides support for Broadcom's NVRAM that can be accessed - using I/O mapping. +@@ -344,4 +344,17 @@ config NVMEM_APPLE_EFUSES + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" @@ -49,10 +57,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. - nvmem-rmem-y := rmem.o - obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o - nvmem_brcm_nvram-y := brcm_nvram.o +@@ -69,3 +69,5 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvme + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o --- /dev/null diff --git a/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch b/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch new file mode 100644 index 00000000000..34a28fa6fe3 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch @@ -0,0 +1,47 @@ +From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:20:50 +0100 +Subject: [PATCH] nvmem: core: add error handling for dev_set_name + +The type of return value of dev_set_name is int, which may return +wrong result, so we add error handling for it to reclaim memory +of nvmem resource, and return early when an error occurs. + +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -810,18 +810,24 @@ struct nvmem_device *nvmem_register(cons + + switch (config->id) { + case NVMEM_DEVID_NONE: +- dev_set_name(&nvmem->dev, "%s", config->name); ++ rval = dev_set_name(&nvmem->dev, "%s", config->name); + break; + case NVMEM_DEVID_AUTO: +- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); ++ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); + break; + default: +- dev_set_name(&nvmem->dev, "%s%d", ++ rval = dev_set_name(&nvmem->dev, "%s%d", + config->name ? : "nvmem", + config->name ? config->id : nvmem->id); + break; + } + ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } ++ + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch b/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch new file mode 100644 index 00000000000..48ad63fab5f --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch @@ -0,0 +1,29 @@ +From d3524bb5b9a0c567b853a0024526afe87dde01ed Mon Sep 17 00:00:00 2001 +From: Kenneth Lee +Date: Fri, 16 Sep 2022 13:20:52 +0100 +Subject: [PATCH] nvmem: brcm_nvram: Use kzalloc for allocating only one + element + +Use kzalloc(...) rather than kcalloc(1, ...) because the number of +elements we are specifying in this case is 1, so kzalloc would +accomplish the same thing and we can simplify. + +Signed-off-by: Kenneth Lee +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/brcm_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -96,7 +96,7 @@ static int brcm_nvram_parse(struct brcm_ + + len = le32_to_cpu(header.len); + +- data = kcalloc(1, len, GFP_KERNEL); ++ data = kzalloc(len, GFP_KERNEL); + memcpy_fromio(data, priv->base, len); + data[len - 1] = '\0'; + diff --git a/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch b/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch new file mode 100644 index 00000000000..a3d256d5c7a --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch @@ -0,0 +1,270 @@ +From 28fc7c986f01fdcfd28af648be2597624cac0e27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:54 +0100 +Subject: [PATCH] nvmem: prefix all symbols with NVMEM_ +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This unifies all NVMEM symbols. They follow one style now. + +Reviewed-by: Matthias Brugger +Acked-by: Arnd Bergmann +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/configs/multi_v7_defconfig | 6 +++--- + arch/arm/configs/qcom_defconfig | 2 +- + arch/arm64/configs/defconfig | 10 +++++----- + arch/mips/configs/ci20_defconfig | 2 +- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/nvmem/Kconfig | 24 ++++++++++++------------ + drivers/nvmem/Makefile | 24 ++++++++++++------------ + drivers/soc/mediatek/Kconfig | 2 +- + drivers/thermal/qcom/Kconfig | 2 +- + 9 files changed, 37 insertions(+), 37 deletions(-) + +--- a/arch/arm/configs/multi_v7_defconfig ++++ b/arch/arm/configs/multi_v7_defconfig +@@ -1085,10 +1085,10 @@ CONFIG_OMAP_USB2=y + CONFIG_TI_PIPE3=y + CONFIG_TWL4030_USB=m + CONFIG_NVMEM_IMX_OCOTP=y +-CONFIG_ROCKCHIP_EFUSE=m ++CONFIG_NVMEM_ROCKCHIP_EFUSE=m + CONFIG_NVMEM_SUNXI_SID=y + CONFIG_NVMEM_VF610_OCOTP=y +-CONFIG_MESON_MX_EFUSE=m ++CONFIG_NVMEM_MESON_MX_EFUSE=m + CONFIG_FSI=m + CONFIG_FSI_MASTER_GPIO=m + CONFIG_FSI_MASTER_HUB=m +--- a/arch/arm/configs/qcom_defconfig ++++ b/arch/arm/configs/qcom_defconfig +@@ -257,7 +257,7 @@ CONFIG_PHY_QCOM_APQ8064_SATA=y + CONFIG_PHY_QCOM_IPQ806X_SATA=y + CONFIG_PHY_QCOM_USB_HS=y + CONFIG_PHY_QCOM_USB_HSIC=y +-CONFIG_QCOM_QFPROM=y ++CONFIG_NVMEM_QCOM_QFPROM=y + CONFIG_INTERCONNECT=y + CONFIG_INTERCONNECT_QCOM=y + CONFIG_INTERCONNECT_QCOM_MSM8974=m +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -1022,11 +1022,11 @@ CONFIG_QCOM_L2_PMU=y + CONFIG_QCOM_L3_PMU=y + CONFIG_NVMEM_IMX_OCOTP=y + CONFIG_NVMEM_IMX_OCOTP_SCU=y +-CONFIG_QCOM_QFPROM=y +-CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_NVMEM_QCOM_QFPROM=y ++CONFIG_NVMEM_ROCKCHIP_EFUSE=y + CONFIG_NVMEM_SUNXI_SID=y +-CONFIG_UNIPHIER_EFUSE=y +-CONFIG_MESON_EFUSE=m ++CONFIG_NVMEM_UNIPHIER_EFUSE=y ++CONFIG_NVMEM_MESON_EFUSE=m + CONFIG_FPGA=y + CONFIG_FPGA_MGR_STRATIX10_SOC=m + CONFIG_FPGA_BRIDGE=m +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -131,7 +131,7 @@ config ARM_OMAP2PLUS_CPUFREQ + config ARM_QCOM_CPUFREQ_NVMEM + tristate "Qualcomm nvmem based CPUFreq" + depends on ARCH_QCOM +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on QCOM_SMEM + select PM_OPP + help +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -52,7 +52,7 @@ config NVMEM_IMX_OCOTP_SCU + This is a driver for the SCU On-Chip OTP Controller (OCOTP) + available on i.MX8 SoCs. + +-config JZ4780_EFUSE ++config NVMEM_JZ4780_EFUSE + tristate "JZ4780 EFUSE Memory Support" + depends on MACH_INGENIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -96,7 +96,7 @@ config NVMEM_MXS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-mxs-ocotp. + +-config MTK_EFUSE ++config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on HAS_IOMEM +@@ -107,7 +107,7 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config MICROCHIP_OTPC ++config NVMEM_MICROCHIP_OTPC + tristate "Microchip OTPC support" + depends on ARCH_AT91 || COMPILE_TEST + help +@@ -126,7 +126,7 @@ config NVMEM_NINTENDO_OTP + This driver can also be built as a module. If so, the module + will be called nvmem-nintendo-otp. + +-config QCOM_QFPROM ++config NVMEM_QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST + depends on HAS_IOMEM +@@ -145,7 +145,7 @@ config NVMEM_SPMI_SDAM + Qualcomm Technologies, Inc. PMICs. It provides the clients + an interface to read/write to the SDAM module's shared memory. + +-config ROCKCHIP_EFUSE ++config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -156,7 +156,7 @@ config ROCKCHIP_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_efuse. + +-config ROCKCHIP_OTP ++config NVMEM_ROCKCHIP_OTP + tristate "Rockchip OTP controller support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -199,7 +199,7 @@ config NVMEM_SUNXI_SID + This driver can also be built as a module. If so, the module + will be called nvmem_sunxi_sid. + +-config UNIPHIER_EFUSE ++config NVMEM_UNIPHIER_EFUSE + tristate "UniPhier SoCs eFuse support" + depends on ARCH_UNIPHIER || COMPILE_TEST + depends on HAS_IOMEM +@@ -221,7 +221,7 @@ config NVMEM_VF610_OCOTP + This driver can also be build as a module. If so, the module will + be called nvmem-vf610-ocotp. + +-config MESON_EFUSE ++config NVMEM_MESON_EFUSE + tristate "Amlogic Meson GX eFuse Support" + depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +@@ -231,7 +231,7 @@ config MESON_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_meson_efuse. + +-config MESON_MX_EFUSE ++config NVMEM_MESON_MX_EFUSE + tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" + depends on ARCH_MESON || COMPILE_TEST + help +@@ -251,13 +251,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config RAVE_SP_EEPROM ++config NVMEM_RAVE_SP_EEPROM + tristate "Rave SP EEPROM Support" + depends on RAVE_SP_CORE + help + Say y here to enable Rave SP EEPROM support. + +-config SC27XX_EFUSE ++config NVMEM_SC27XX_EFUSE + tristate "Spreadtrum SC27XX eFuse Support" + depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -278,7 +278,7 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + +-config SPRD_EFUSE ++config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" + depends on ARCH_SPRD || COMPILE_TEST + depends on HAS_IOMEM +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-i + nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o + nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +@@ -25,37 +25,37 @@ obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-m + nvmem-mxs-ocotp-y := mxs-ocotp.o + obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o + nvmem-nintendo-otp-y := nintendo-otp.o +-obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o ++obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o + nvmem_qfprom-y := qfprom.o + obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o + nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o +-obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o + nvmem_rockchip_efuse-y := rockchip-efuse.o +-obj-$(CONFIG_ROCKCHIP_OTP) += nvmem-rockchip-otp.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o + nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o + nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o + nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o + nvmem-uniphier-efuse-y := uniphier-efuse.o + obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o + nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_MESON_EFUSE) += nvmem_meson_efuse.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o + nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o + nvmem_meson_mx_efuse-y := meson-mx-efuse.o + obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o + nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o + nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o +-obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o + nvmem-sc27xx-efuse-y := sc27xx-efuse.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +@@ -67,7 +67,7 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o + nvmem_u-boot-env-y := u-boot-env.o +--- a/drivers/thermal/qcom/Kconfig ++++ b/drivers/thermal/qcom/Kconfig +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config QCOM_TSENS + tristate "Qualcomm TSENS Temperature Alarm" +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on ARCH_QCOM || COMPILE_TEST + help + This enables the thermal sysfs driver for the TSENS device. It shows diff --git a/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch b/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch new file mode 100644 index 00000000000..4e45524bffc --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch @@ -0,0 +1,535 @@ +From a06d9e5a63b7c2f622c908cd9600ce735e70f7c6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:55 +0100 +Subject: [PATCH] nvmem: sort config symbols alphabetically +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Match what most subsystems do +2. Simplify maintenance a bit +3. Reduce amount of conflicts for new drivers patches + +While at it unify indent level in Makefile. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 300 +++++++++++++++++++++-------------------- + drivers/nvmem/Makefile | 114 ++++++++-------- + 2 files changed, 208 insertions(+), 206 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -21,6 +21,40 @@ config NVMEM_SYSFS + This interface is mostly used by userspace applications to + read/write directly into nvmem. + ++# Devices ++ ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ ++config NVMEM_BCM_OCOTP ++ tristate "Broadcom On-Chip OTP Controller support" ++ depends on ARCH_BCM_IPROC || COMPILE_TEST ++ depends on HAS_IOMEM ++ default ARCH_BCM_IPROC ++ help ++ Say y here to enable read/write access to the Broadcom OTP ++ controller. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-bcm-ocotp. ++ ++config NVMEM_BRCM_NVRAM ++ tristate "Broadcom's NVRAM support" ++ depends on ARCH_BCM_5301X || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support for Broadcom's NVRAM that can be accessed ++ using I/O mapping. ++ + config NVMEM_IMX_IIM + tristate "i.MX IC Identification Module support" + depends on ARCH_MXC || COMPILE_TEST +@@ -64,6 +98,19 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ select REGMAP_MMIO ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST +@@ -84,17 +131,32 @@ config NVMEM_LPC18XX_OTP + To compile this driver as a module, choose M here: the module + will be called nvmem_lpc18xx_otp. + +-config NVMEM_MXS_OCOTP +- tristate "Freescale MXS On-Chip OTP Memory Support" +- depends on ARCH_MXS || COMPILE_TEST +- depends on HAS_IOMEM ++config NVMEM_MESON_EFUSE ++ tristate "Amlogic Meson GX eFuse Support" ++ depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +- If you say Y here, you will get readonly access to the +- One Time Programmable memory pages that are stored +- on the Freescale i.MX23/i.MX28 processor. ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson GX SoCs. + + This driver can also be built as a module. If so, the module +- will be called nvmem-mxs-ocotp. ++ will be called nvmem_meson_efuse. ++ ++config NVMEM_MESON_MX_EFUSE ++ tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" ++ depends on ARCH_MESON || COMPILE_TEST ++ help ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_meson_mx_efuse. ++ ++config NVMEM_MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" +@@ -107,12 +169,17 @@ config NVMEM_MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config NVMEM_MICROCHIP_OTPC +- tristate "Microchip OTPC support" +- depends on ARCH_AT91 || COMPILE_TEST ++config NVMEM_MXS_OCOTP ++ tristate "Freescale MXS On-Chip OTP Memory Support" ++ depends on ARCH_MXS || COMPILE_TEST ++ depends on HAS_IOMEM + help +- This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ If you say Y here, you will get readonly access to the ++ One Time Programmable memory pages that are stored ++ on the Freescale i.MX23/i.MX28 processor. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-mxs-ocotp. + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" +@@ -137,13 +204,21 @@ config NVMEM_QCOM_QFPROM + This driver can also be built as a module. If so, the module + will be called nvmem_qfprom. + +-config NVMEM_SPMI_SDAM +- tristate "SPMI SDAM Support" +- depends on SPMI ++config NVMEM_RAVE_SP_EEPROM ++ tristate "Rave SP EEPROM Support" ++ depends on RAVE_SP_CORE + help +- This driver supports the Shared Direct Access Memory Module on +- Qualcomm Technologies, Inc. PMICs. It provides the clients +- an interface to read/write to the SDAM module's shared memory. ++ Say y here to enable Rave SP EEPROM support. ++ ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM ++ help ++ This driver maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + + config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" +@@ -167,79 +242,16 @@ config NVMEM_ROCKCHIP_OTP + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_otp. + +-config NVMEM_BCM_OCOTP +- tristate "Broadcom On-Chip OTP Controller support" +- depends on ARCH_BCM_IPROC || COMPILE_TEST +- depends on HAS_IOMEM +- default ARCH_BCM_IPROC +- help +- Say y here to enable read/write access to the Broadcom OTP +- controller. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-bcm-ocotp. +- +-config NVMEM_STM32_ROMEM +- tristate "STMicroelectronics STM32 factory-programmed memory support" +- depends on ARCH_STM32 || COMPILE_TEST +- help +- Say y here to enable read-only access for STMicroelectronics STM32 +- factory-programmed memory area. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-stm32-romem. +- +-config NVMEM_SUNXI_SID +- tristate "Allwinner SoCs SID support" +- depends on ARCH_SUNXI +- help +- This is a driver for the 'security ID' available on various Allwinner +- devices. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_sunxi_sid. +- +-config NVMEM_UNIPHIER_EFUSE +- tristate "UniPhier SoCs eFuse support" +- depends on ARCH_UNIPHIER || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of UniPhier SoC +- from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-uniphier-efuse. +- +-config NVMEM_VF610_OCOTP +- tristate "VF610 SoC OCOTP support" +- depends on SOC_VF610 || COMPILE_TEST ++config NVMEM_SC27XX_EFUSE ++ tristate "Spreadtrum SC27XX eFuse Support" ++ depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a driver for the 'OCOTP' peripheral available on Vybrid +- devices like VF5xx and VF6xx. +- +- This driver can also be build as a module. If so, the module will +- be called nvmem-vf610-ocotp. +- +-config NVMEM_MESON_EFUSE +- tristate "Amlogic Meson GX eFuse Support" +- depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson GX SoCs. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_meson_efuse. +- +-config NVMEM_MESON_MX_EFUSE +- tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" +- depends on ARCH_MESON || COMPILE_TEST +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ This is a simple driver to dump specified values of Spreadtrum ++ SC27XX PMICs from eFuse. + + This driver can also be built as a module. If so, the module +- will be called nvmem_meson_mx_efuse. ++ will be called nvmem-sc27xx-efuse. + + config NVMEM_SNVS_LPGPR + tristate "Support for Low Power General Purpose Register" +@@ -251,32 +263,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config NVMEM_RAVE_SP_EEPROM +- tristate "Rave SP EEPROM Support" +- depends on RAVE_SP_CORE +- help +- Say y here to enable Rave SP EEPROM support. +- +-config NVMEM_SC27XX_EFUSE +- tristate "Spreadtrum SC27XX eFuse Support" +- depends on MFD_SC27XX_PMIC || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of Spreadtrum +- SC27XX PMICs from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-sc27xx-efuse. +- +-config NVMEM_ZYNQMP +- bool "Xilinx ZYNQMP SoC nvmem firmware support" +- depends on ARCH_ZYNQMP ++config NVMEM_SPMI_SDAM ++ tristate "SPMI SDAM Support" ++ depends on SPMI + help +- This is a driver to access hardware related data like +- soc revision, IDCODE... etc by using the firmware +- interface. +- +- If sure, say yes. If unsure, say no. ++ This driver supports the Shared Direct Access Memory Module on ++ Qualcomm Technologies, Inc. PMICs. It provides the clients ++ an interface to read/write to the SDAM module's shared memory. + + config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" +@@ -289,36 +282,15 @@ config NVMEM_SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + +-config NVMEM_RMEM +- tristate "Reserved Memory Based Driver Support" +- depends on HAS_IOMEM +- help +- This driver maps reserved memory into an nvmem device. It might be +- useful to expose information left by firmware in memory. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-rmem. +- +-config NVMEM_BRCM_NVRAM +- tristate "Broadcom's NVRAM support" +- depends on ARCH_BCM_5301X || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This driver provides support for Broadcom's NVRAM that can be accessed +- using I/O mapping. +- +-config NVMEM_LAYERSCAPE_SFP +- tristate "Layerscape SFP (Security Fuse Processor) support" +- depends on ARCH_LAYERSCAPE || COMPILE_TEST +- depends on HAS_IOMEM +- select REGMAP_MMIO ++config NVMEM_STM32_ROMEM ++ tristate "STMicroelectronics STM32 factory-programmed memory support" ++ depends on ARCH_STM32 || COMPILE_TEST + help +- This driver provides support to read the eFuses on Freescale +- Layerscape SoC's. For example, the vendor provides a per part +- unique ID there. ++ Say y here to enable read-only access for STMicroelectronics STM32 ++ factory-programmed memory area. + + This driver can also be built as a module. If so, the module +- will be called layerscape-sfp. ++ will be called nvmem-stm32-romem. + + config NVMEM_SUNPLUS_OCOTP + tristate "Sunplus SoC OTP support" +@@ -332,17 +304,15 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + +-config NVMEM_APPLE_EFUSES +- tristate "Apple eFuse support" +- depends on ARCH_APPLE || COMPILE_TEST +- default ARCH_APPLE ++config NVMEM_SUNXI_SID ++ tristate "Allwinner SoCs SID support" ++ depends on ARCH_SUNXI + help +- Say y here to enable support for reading eFuses on Apple SoCs +- such as the M1. These are e.g. used to store factory programmed +- calibration data required for the PCIe or the USB-C PHY. ++ This is a driver for the 'security ID' available on various Allwinner ++ devices. + +- This driver can also be built as a module. If so, the module will +- be called nvmem-apple-efuses. ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_sunxi_sid. + + config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" +@@ -357,4 +327,36 @@ config NVMEM_U_BOOT_ENV + + If compiled as module it will be called nvmem_u-boot-env. + ++config NVMEM_UNIPHIER_EFUSE ++ tristate "UniPhier SoCs eFuse support" ++ depends on ARCH_UNIPHIER || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a simple driver to dump specified values of UniPhier SoC ++ from eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-uniphier-efuse. ++ ++config NVMEM_VF610_OCOTP ++ tristate "VF610 SoC OCOTP support" ++ depends on SOC_VF610 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the 'OCOTP' peripheral available on Vybrid ++ devices like VF5xx and VF6xx. ++ ++ This driver can also be build as a module. If so, the module will ++ be called nvmem-vf610-ocotp. ++ ++config NVMEM_ZYNQMP ++ bool "Xilinx ZYNQMP SoC nvmem firmware support" ++ depends on ARCH_ZYNQMP ++ help ++ This is a driver to access hardware related data like ++ soc revision, IDCODE... etc by using the firmware ++ interface. ++ ++ If sure, say yes. If unsure, say no. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -7,67 +7,67 @@ obj-$(CONFIG_NVMEM) += nvmem_core.o + nvmem_core-y := core.o + + # Devices +-obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o +-nvmem-bcm-ocotp-y := bcm-ocotp.o +-obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o +-nvmem-imx-iim-y := imx-iim.o +-obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o +-nvmem-imx-ocotp-y := imx-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o ++nvmem-bcm-ocotp-y := bcm-ocotp.o ++obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o ++nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o ++nvmem-imx-iim-y := imx-iim.o ++obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o ++nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o +-nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o +-nvmem_jz4780_efuse-y := jz4780-efuse.o ++nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +-nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +-obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o +-nvmem_lpc18xx_otp-y := lpc18xx_otp.o +-obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o +-nvmem-mxs-ocotp-y := mxs-ocotp.o +-obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o +-nvmem-nintendo-otp-y := nintendo-otp.o ++nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o ++obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o ++nvmem_lpc18xx_otp-y := lpc18xx_otp.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o ++nvmem_meson_efuse-y := meson-efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++nvmem_meson_mx_efuse-y := meson-mx-efuse.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o +-nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o +-nvmem_qfprom-y := qfprom.o +-obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o +-nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++nvmem_mtk-efuse-y := mtk-efuse.o ++obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o ++nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o ++nvmem_qfprom-y := qfprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o +-nvmem_rockchip_efuse-y := rockchip-efuse.o ++nvmem_rockchip_efuse-y := rockchip-efuse.o + obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o +-nvmem-rockchip-otp-y := rockchip-otp.o +-obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o +-nvmem_stm32_romem-y := stm32-romem.o +-obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o +-nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o +-nvmem-uniphier-efuse-y := uniphier-efuse.o +-obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +-nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o +-nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o +-nvmem_meson_mx_efuse-y := meson-mx-efuse.o +-obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o +-nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o +-nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o +-nvmem-sc27xx-efuse-y := sc27xx-efuse.o +-obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o +-nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o +-nvmem_sprd_efuse-y := sprd-efuse.o +-obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o +-nvmem-rmem-y := rmem.o +-obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +-nvmem_brcm_nvram-y := brcm_nvram.o +-obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o +-nvmem-layerscape-sfp-y := layerscape-sfp.o ++nvmem-sc27xx-efuse-y := sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o ++nvmem_snvs_lpgpr-y := snvs_lpgpr.o ++obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o ++nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o ++nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o ++nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o +-nvmem_sunplus_ocotp-y := sunplus-ocotp.o +-obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o +-nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o +-nvmem-microchip-otpc-y := microchip-otpc.o +-obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +-nvmem_u-boot-env-y := u-boot-env.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o ++nvmem_sunxi_sid-y := sunxi_sid.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++nvmem-uniphier-efuse-y := uniphier-efuse.o ++obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o ++nvmem-vf610-ocotp-y := vf610-ocotp.o ++obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o ++nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o diff --git a/target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 79% rename from target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch index 3a6b76a221e..e0a082adc45 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch @@ -1,6 +1,6 @@ -From d69efcf951df4dcc74a0e1554969c533aec8aa9b Mon Sep 17 00:00:00 2001 +From d4d432670f7dee0a5432fcffcfc8699b25181ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 15 Sep 2022 22:06:29 +0200 +Date: Fri, 16 Sep 2022 13:20:57 +0100 Subject: [PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -13,6 +13,8 @@ This allows NVMEM consumers to use U-Boot environment variables. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch b/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch new file mode 100644 index 00000000000..945c6128ff4 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0008-nvmem-lan9662-otp-add-support.patch @@ -0,0 +1,274 @@ +From 9e8f208ad5229ddda97cd4a83ecf89c735d99592 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 16 Sep 2022 13:20:59 +0100 +Subject: [PATCH] nvmem: lan9662-otp: add support + +Add support for OTP controller available on LAN9662. The OTPC controls +the access to a non-volatile memory. The size of the memory is 8KB. +The OTPC can access the memory based on an offset. +Implement both the read and the write functionality. + +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/lan9662-otpc.c | 222 +++++++++++++++++++++++++++++++++++ + 3 files changed, 232 insertions(+) + create mode 100644 drivers/nvmem/lan9662-otpc.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -98,6 +98,14 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAN9662_OTPC ++ tristate "Microchip LAN9662 OTP controller support" ++ depends on SOC_LAN966 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver enables the OTP controller available on Microchip LAN9662 ++ SoCs. It controls the access to the OTP memory connected to it. ++ + config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -21,6 +21,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvm + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAN9662_OTPC) += nvmem-lan9662-otpc.o ++nvmem-lan9662-otpc-y := lan9662-otpc.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +--- /dev/null ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -0,0 +1,222 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define OTP_OTP_PWR_DN(t) (t + 0x00) ++#define OTP_OTP_PWR_DN_OTP_PWRDN_N BIT(0) ++#define OTP_OTP_ADDR_HI(t) (t + 0x04) ++#define OTP_OTP_ADDR_LO(t) (t + 0x08) ++#define OTP_OTP_PRGM_DATA(t) (t + 0x10) ++#define OTP_OTP_PRGM_MODE(t) (t + 0x14) ++#define OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE BIT(0) ++#define OTP_OTP_RD_DATA(t) (t + 0x18) ++#define OTP_OTP_FUNC_CMD(t) (t + 0x20) ++#define OTP_OTP_FUNC_CMD_OTP_PROGRAM BIT(1) ++#define OTP_OTP_FUNC_CMD_OTP_READ BIT(0) ++#define OTP_OTP_CMD_GO(t) (t + 0x28) ++#define OTP_OTP_CMD_GO_OTP_GO BIT(0) ++#define OTP_OTP_PASS_FAIL(t) (t + 0x2c) ++#define OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED BIT(3) ++#define OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED BIT(2) ++#define OTP_OTP_PASS_FAIL_OTP_FAIL BIT(0) ++#define OTP_OTP_STATUS(t) (t + 0x30) ++#define OTP_OTP_STATUS_OTP_CPUMPEN BIT(1) ++#define OTP_OTP_STATUS_OTP_BUSY BIT(0) ++ ++#define OTP_MEM_SIZE 8192 ++#define OTP_SLEEP_US 10 ++#define OTP_TIMEOUT_US 500000 ++ ++struct lan9662_otp { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++{ ++ u32 val; ++ ++ return readl_poll_timeout(reg, val, !(val & flag), ++ OTP_SLEEP_US, OTP_TIMEOUT_US); ++} ++ ++static int lan9662_otp_power(struct lan9662_otp *otp, bool up) ++{ ++ void __iomem *pwrdn = OTP_OTP_PWR_DN(otp->base); ++ ++ if (up) { ++ writel(readl(pwrdn) & ~OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_CPUMPEN)) ++ return -ETIMEDOUT; ++ } else { ++ writel(readl(pwrdn) | OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ } ++ ++ return 0; ++} ++ ++static int lan9662_otp_execute(struct lan9662_otp *otp) ++{ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_CMD_GO(otp->base), ++ OTP_OTP_CMD_GO_OTP_GO)) ++ return -ETIMEDOUT; ++ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_BUSY)) ++ return -ETIMEDOUT; ++ ++ return 0; ++} ++ ++static void lan9662_otp_set_address(struct lan9662_otp *otp, u32 offset) ++{ ++ writel(0xff & (offset >> 8), OTP_OTP_ADDR_HI(otp->base)); ++ writel(0xff & offset, OTP_OTP_ADDR_LO(otp->base)); ++} ++ ++static int lan9662_otp_read_byte(struct lan9662_otp *otp, u32 offset, u8 *dst) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_FUNC_CMD_OTP_READ, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED) ++ return -EACCES; ++ *dst = (u8) readl(OTP_OTP_RD_DATA(otp->base)); ++ } ++ return rc; ++} ++ ++static int lan9662_otp_write_byte(struct lan9662_otp *otp, u32 offset, u8 data) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE, OTP_OTP_PRGM_MODE(otp->base)); ++ writel(data, OTP_OTP_PRGM_DATA(otp->base)); ++ writel(OTP_OTP_FUNC_CMD_OTP_PROGRAM, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED) ++ return -EACCES; ++ if (pass & OTP_OTP_PASS_FAIL_OTP_FAIL) ++ return -EIO; ++ } ++ return rc; ++} ++ ++static int lan9662_otp_read(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ uint8_t data; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ *val++ = data; ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static int lan9662_otp_write(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ u8 data, newdata; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ /* Skip zero bytes */ ++ if (val[i]) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ ++ newdata = data | val[i]; ++ if (newdata == data) ++ continue; ++ ++ rc = lan9662_otp_write_byte(otp, offset + i, ++ newdata); ++ if (rc < 0) ++ break; ++ } ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static struct nvmem_config otp_config = { ++ .name = "lan9662-otp", ++ .stride = 1, ++ .word_size = 1, ++ .reg_read = lan9662_otp_read, ++ .reg_write = lan9662_otp_write, ++ .size = OTP_MEM_SIZE, ++}; ++ ++static int lan9662_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct lan9662_otp *otp; ++ ++ otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ otp->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otp->base)) ++ return PTR_ERR(otp->base); ++ ++ otp_config.priv = otp; ++ otp_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &otp_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id lan9662_otp_match[] = { ++ { .compatible = "microchip,lan9662-otp", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, lan9662_otp_match); ++ ++static struct platform_driver lan9662_otp_driver = { ++ .probe = lan9662_otp_probe, ++ .driver = { ++ .name = "lan9662-otp", ++ .of_match_table = lan9662_otp_match, ++ }, ++}; ++module_platform_driver(lan9662_otp_driver); ++ ++MODULE_AUTHOR("Horatiu Vultur "); ++MODULE_DESCRIPTION("lan9662 OTP driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.10/823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch b/target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch similarity index 74% rename from target/linux/generic/backport-5.10/823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch rename to target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch index 6b405571160..633a668a962 100644 --- a/target/linux/generic/backport-5.10/823-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch @@ -1,6 +1,6 @@ -From 60bbaad38109684b156e21112322e0a922f92cde Mon Sep 17 00:00:00 2001 +From 3717ca3e0cc8683f93b41d3f06ca79631eb58715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 18 Aug 2022 06:38:37 +0200 +Date: Fri, 16 Sep 2022 13:21:00 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32 casting type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,10 +9,12 @@ Content-Transfer-Encoding: 8bit This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 +Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Reported-by: kernel test robot -Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch b/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch new file mode 100644 index 00000000000..b663a1328df --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch @@ -0,0 +1,34 @@ +From 1aeb122d214b92474c86fde00a03d6e2d69381b5 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Wed, 28 Sep 2022 21:51:12 +0200 +Subject: [PATCH] nvmem: lan9662-otp: Fix compatible string + +The device tree bindings for lan9662-otp expects the compatible string +to be one of following compatible strings: +microchip,lan9662-otpc +microchip,lan9668-otpc + +The problem is that the lan9662-otp driver contains the +microchip,lan9662-otp compatible string instead of +microchip,lan9662-otpc. +Fix this by updating the compatible string in the driver. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Signed-off-by: Horatiu Vultur +Link: https://lore.kernel.org/r/20220928195112.630351-1-horatiu.vultur@microchip.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -203,7 +203,7 @@ static int lan9662_otp_probe(struct plat + } + + static const struct of_device_id lan9662_otp_match[] = { +- { .compatible = "microchip,lan9662-otp", }, ++ { .compatible = "microchip,lan9662-otpc", }, + { }, + }; + MODULE_DEVICE_TABLE(of, lan9662_otp_match); diff --git a/target/linux/generic/backport-5.10/825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch similarity index 89% rename from target/linux/generic/backport-5.10/825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch rename to target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch index 69d5a1b8459..967e891dbd9 100644 --- a/target/linux/generic/backport-5.10/825-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch +++ b/target/linux/generic/backport-5.10/811-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch @@ -1,4 +1,4 @@ -From 7a69ff9c9bde03a690ea783970f664782fc303d8 Mon Sep 17 00:00:00 2001 +From ee424f7d3960152f5f862bbb6943e59828dc7917 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 4 Nov 2022 17:52:03 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32_data_offset on redundant @@ -37,8 +37,11 @@ crc32 sum... which is unfortunate :( | [0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951 + Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/70a16eae113e08db2390b76e174f4837caa135c3.1667580636.git.chunkeey@gmail.com +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch b/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch new file mode 100644 index 00000000000..b0e1b0c2196 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0012-nvmem-rmem-Fix-return-value-check-in-rmem_read.patch @@ -0,0 +1,36 @@ +From 58e92c4a496b27156020a59a98c7f4a92c2b1533 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Fri, 18 Nov 2022 06:38:38 +0000 +Subject: [PATCH] nvmem: rmem: Fix return value check in rmem_read() + +In case of error, the function memremap() returns NULL pointer +not ERR_PTR(). The IS_ERR() test in the return value check +should be replaced with NULL test. + +Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") +Cc: Srinivas Kandagatla +Cc: Nicolas Saenz Julienne +Signed-off-by: Wei Yongjun +Acked-by: Nicolas Saenz Julienne +Signed-off-by: Yang Yingliang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/rmem.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/nvmem/rmem.c ++++ b/drivers/nvmem/rmem.c +@@ -37,9 +37,9 @@ static int rmem_read(void *context, unsi + * but as of Dec 2020 this isn't possible on arm64. + */ + addr = memremap(priv->mem->base, available, MEMREMAP_WB); +- if (IS_ERR(addr)) { ++ if (!addr) { + dev_err(priv->dev, "Failed to remap memory region\n"); +- return PTR_ERR(addr); ++ return -ENOMEM; + } + + count = memory_read_from_buffer(val, bytes, &off, addr, available); diff --git a/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch b/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch new file mode 100644 index 00000000000..0c842f07932 --- /dev/null +++ b/target/linux/generic/backport-5.10/811-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch @@ -0,0 +1,35 @@ +From 022b68f271de0e53024e6d5e96fee8e76d25eb95 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 18 Nov 2022 06:38:40 +0000 +Subject: [PATCH] nvmem: lan9662-otp: Change return type of + lan9662_otp_wait_flag_clear() + +The blamed commit introduced the following smatch warning in the +function lan9662_otp_wait_flag_clear: +drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)' + +Fix this by changing the return type of the function +lan9662_otp_wait_flag_clear() to be int instead of bool. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -36,7 +36,7 @@ struct lan9662_otp { + void __iomem *base; + }; + +-static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++static int lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) + { + u32 val; + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch b/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch new file mode 100644 index 00000000000..33759632ebe --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch @@ -0,0 +1,82 @@ +From fbfc4ca465a1f8d81bf2d67d95bf7fc67c3cf0c2 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:20 +0000 +Subject: [PATCH] nvmem: stm32: move STM32MP15_BSEC_NUM_LOWER in config + +Support STM32MP15_BSEC_NUM_LOWER in stm32 romem config to prepare +the next SoC in STM32MP family. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -22,16 +22,15 @@ + /* shadow registers offest */ + #define STM32MP15_BSEC_DATA0 0x200 + +-/* 32 (x 32-bits) lower shadow registers */ +-#define STM32MP15_BSEC_NUM_LOWER 32 +- + struct stm32_romem_cfg { + int size; ++ u8 lower; + }; + + struct stm32_romem_priv { + void __iomem *base; + struct nvmem_config cfg; ++ u8 lower; + }; + + static int stm32_romem_read(void *context, unsigned int offset, void *buf, +@@ -85,7 +84,7 @@ static int stm32_bsec_read(void *context + for (i = roffset; (i < roffset + rbytes); i += 4) { + u32 otp = i >> 2; + +- if (otp < STM32MP15_BSEC_NUM_LOWER) { ++ if (otp < priv->lower) { + /* read lower data from shadow registers */ + val = readl_relaxed( + priv->base + STM32MP15_BSEC_DATA0 + i); +@@ -159,6 +158,8 @@ static int stm32_romem_probe(struct plat + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; + ++ priv->lower = 0; ++ + cfg = (const struct stm32_romem_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; + if (!cfg) { +@@ -167,6 +168,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.reg_read = stm32_romem_read; + } else { + priv->cfg.size = cfg->size; ++ priv->lower = cfg->lower; + priv->cfg.reg_read = stm32_bsec_read; + priv->cfg.reg_write = stm32_bsec_write; + } +@@ -174,8 +176,17 @@ static int stm32_romem_probe(struct plat + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &priv->cfg)); + } + ++/* ++ * STM32MP15 BSEC OTP regions: 4096 OTP bits (with 3072 effective bits) ++ * => 96 x 32-bits data words ++ * - Lower: 1K bits, 2:1 redundancy, incremental bit programming ++ * => 32 (x 32-bits) lower shadow registers = words 0 to 31 ++ * - Upper: 2K bits, ECC protection, word programming only ++ * => 64 (x 32-bits) = words 32 to 95 ++ */ + static const struct stm32_romem_cfg stm32mp15_bsec_cfg = { +- .size = 384, /* 96 x 32-bits data words */ ++ .size = 384, ++ .lower = 32, + }; + + static const struct of_device_id stm32_romem_of_match[] = { diff --git a/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch b/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch new file mode 100644 index 00000000000..5791df2606f --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch @@ -0,0 +1,34 @@ +From d61784e6410f3df2028e6eb91b06ffed37a660e0 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:21 +0000 +Subject: [PATCH] nvmem: stm32: add warning when upper OTPs are updated + +As the upper OTPs are ECC protected, they support only one 32 bits word +programming. +For a second modification of this word, these ECC become invalid and +this OTP will be no more accessible, the shadowed value is invalid. + +This patch adds a warning to indicate an upper OTP update, because this +operation is dangerous as OTP is not locked by the driver after the first +update to avoid a second update. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -132,6 +132,9 @@ static int stm32_bsec_write(void *contex + } + } + ++ if (offset + bytes >= priv->lower * 4) ++ dev_warn(dev, "Update of upper OTPs with ECC protection (word programming, only once)\n"); ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch b/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch new file mode 100644 index 00000000000..b83ad69c6b4 --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch @@ -0,0 +1,26 @@ +From a3816a7d7c097c1da46aad5f5d1e229b607dce04 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:22 +0000 +Subject: [PATCH] nvmem: stm32: add nvmem type attribute + +Inform NVMEM framework of type attribute for stm32-romem as NVMEM_TYPE_OTP +so userspace is able to know how the data is stored in BSEC. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -160,6 +160,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.dev = dev; + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; ++ priv->cfg.type = NVMEM_TYPE_OTP; + + priv->lower = 0; + diff --git a/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch b/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch new file mode 100644 index 00000000000..52ba1e65b56 --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch @@ -0,0 +1,27 @@ +From 06aac0e11960a7ddccc1888326b5906d017e0f24 Mon Sep 17 00:00:00 2001 +From: Jiangshan Yi +Date: Fri, 18 Nov 2022 06:39:24 +0000 +Subject: [PATCH] nvmem: stm32: fix spelling typo in comment + +Fix spelling typo in comment. + +Reported-by: k2ci +Signed-off-by: Jiangshan Yi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -19,7 +19,7 @@ + #define STM32_SMC_WRITE_SHADOW 0x03 + #define STM32_SMC_READ_OTP 0x04 + +-/* shadow registers offest */ ++/* shadow registers offset */ + #define STM32MP15_BSEC_DATA0 0x200 + + struct stm32_romem_cfg { diff --git a/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch b/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch new file mode 100644 index 00000000000..8f024f4c1ac --- /dev/null +++ b/target/linux/generic/backport-5.10/812-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch @@ -0,0 +1,27 @@ +From fb817c4ef63e8cfb6e77ae4a2875ae854c80708f Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 18 Nov 2022 06:39:26 +0000 +Subject: [PATCH] nvmem: Kconfig: Fix spelling mistake "controlls" -> + "controls" + +There is a spelling mistake in a Kconfig description. Fix it. + +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -164,7 +164,7 @@ config NVMEM_MICROCHIP_OTPC + depends on ARCH_AT91 || COMPILE_TEST + help + This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ SoCs. It controls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" diff --git a/target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch similarity index 90% rename from target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch rename to target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch index 429b24f0f3a..861386ad310 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch +++ b/target/linux/generic/backport-5.10/812-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch @@ -1,6 +1,6 @@ -From 5b4eaafbeac472fc19049152f18e88aecb2b2829 Mon Sep 17 00:00:00 2001 +From ada84d07af6097b2addd18262668ce6cb9e15206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 17 Oct 2022 09:17:22 +0200 +Date: Fri, 18 Nov 2022 06:39:27 +0000 Subject: [PATCH] nvmem: u-boot-env: add Broadcom format support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -15,6 +15,8 @@ Add support for Broadcom's specific binding and their custom format. Ref: 6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/linux/generic/backport-5.10/825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch similarity index 96% rename from target/linux/generic/backport-5.10/825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch rename to target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 7d6723bb8e9..4010232300c 100644 --- a/target/linux/generic/backport-5.10/825-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/backport-5.10/813-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,7 +36,7 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -143,7 +143,7 @@ static int u_boot_env_parse(struct u_boo +@@ -156,7 +156,7 @@ static int u_boot_env_parse(struct u_boo crc32_data_len = priv->mtd->size - crc32_data_offset; data_len = priv->mtd->size - data_offset; diff --git a/target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch b/target/linux/generic/backport-5.10/818-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch similarity index 100% rename from target/linux/generic/backport-5.10/810-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch rename to target/linux/generic/backport-5.10/818-v5.13-usb-ehci-add-spurious-flag-to-disable-overcurrent-ch.patch diff --git a/target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch b/target/linux/generic/backport-5.10/819-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch similarity index 100% rename from target/linux/generic/backport-5.10/811-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch rename to target/linux/generic/backport-5.10/819-v5.13-usb-host-ehci-platform-add-spurious_oc-DT-support.patch diff --git a/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch b/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch new file mode 100644 index 00000000000..d90c28cb4b8 --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0001-nvmem-core-rework-nvmem-cell-instance-creation.patch @@ -0,0 +1,456 @@ +From 7ae6478b304bc004c3139b422665b0e23b57f05c Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:55 +0100 +Subject: [PATCH] nvmem: core: rework nvmem cell instance creation + +In the existing design, we do not create a instance per nvmem cell consumer +but we directly refer cell from nvmem cell list that are added to provider. + +However this design has some limitations when consumers want to assign name +or connection id the nvmem cell instance, ex: via "nvmem-cell-names" or +id in nvmem_cell_get(id). + +Having a name associated with nvmem cell consumer instance will help +provider drivers in performing post processing of nvmem cell data if required +before data is seen by the consumers. This is pretty normal with some vendors +storing nvmem cells like mac-address in a vendor specific data layouts that +are not directly usable by the consumer drivers. + +With this patch nvmem cell will be created dynamically during nvmem_cell_get +and destroyed in nvmem_cell_put, allowing consumers to associate name with +nvmem cell consumer instance. + +With this patch a new struct nvmem_cell_entry replaces struct nvmem_cell +for storing nvmem cell information within the core. +This patch does not change nvmem-consumer interface based on nvmem_cell. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 165 +++++++++++++++++++++++++++---------------- + 1 file changed, 105 insertions(+), 60 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -45,8 +45,7 @@ struct nvmem_device { + #define to_nvmem_device(d) container_of(d, struct nvmem_device, dev) + + #define FLAG_COMPAT BIT(0) +- +-struct nvmem_cell { ++struct nvmem_cell_entry { + const char *name; + int offset; + int bytes; +@@ -57,6 +56,11 @@ struct nvmem_cell { + struct list_head node; + }; + ++struct nvmem_cell { ++ struct nvmem_cell_entry *entry; ++ const char *id; ++}; ++ + static DEFINE_MUTEX(nvmem_mutex); + static DEFINE_IDA(nvmem_ida); + +@@ -424,7 +428,7 @@ static struct bus_type nvmem_bus_type = + .name = "nvmem", + }; + +-static void nvmem_cell_drop(struct nvmem_cell *cell) ++static void nvmem_cell_entry_drop(struct nvmem_cell_entry *cell) + { + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_REMOVE, cell); + mutex_lock(&nvmem_mutex); +@@ -437,13 +441,13 @@ static void nvmem_cell_drop(struct nvmem + + static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) + { +- struct nvmem_cell *cell, *p; ++ struct nvmem_cell_entry *cell, *p; + + list_for_each_entry_safe(cell, p, &nvmem->cells, node) +- nvmem_cell_drop(cell); ++ nvmem_cell_entry_drop(cell); + } + +-static void nvmem_cell_add(struct nvmem_cell *cell) ++static void nvmem_cell_entry_add(struct nvmem_cell_entry *cell) + { + mutex_lock(&nvmem_mutex); + list_add_tail(&cell->node, &cell->nvmem->cells); +@@ -451,9 +455,9 @@ static void nvmem_cell_add(struct nvmem_ + blocking_notifier_call_chain(&nvmem_notifier, NVMEM_CELL_ADD, cell); + } + +-static int nvmem_cell_info_to_nvmem_cell_nodup(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry_nodup(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + cell->nvmem = nvmem; + cell->offset = info->offset; +@@ -477,13 +481,13 @@ static int nvmem_cell_info_to_nvmem_cell + return 0; + } + +-static int nvmem_cell_info_to_nvmem_cell(struct nvmem_device *nvmem, +- const struct nvmem_cell_info *info, +- struct nvmem_cell *cell) ++static int nvmem_cell_info_to_nvmem_cell_entry(struct nvmem_device *nvmem, ++ const struct nvmem_cell_info *info, ++ struct nvmem_cell_entry *cell) + { + int err; + +- err = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, cell); ++ err = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, cell); + if (err) + return err; + +@@ -507,7 +511,7 @@ static int nvmem_add_cells(struct nvmem_ + const struct nvmem_cell_info *info, + int ncells) + { +- struct nvmem_cell **cells; ++ struct nvmem_cell_entry **cells; + int i, rval; + + cells = kcalloc(ncells, sizeof(*cells), GFP_KERNEL); +@@ -521,13 +525,13 @@ static int nvmem_add_cells(struct nvmem_ + goto err; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, &info[i], cells[i]); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, &info[i], cells[i]); + if (rval) { + kfree(cells[i]); + goto err; + } + +- nvmem_cell_add(cells[i]); ++ nvmem_cell_entry_add(cells[i]); + } + + /* remove tmp array */ +@@ -536,7 +540,7 @@ static int nvmem_add_cells(struct nvmem_ + return 0; + err: + while (i--) +- nvmem_cell_drop(cells[i]); ++ nvmem_cell_entry_drop(cells[i]); + + kfree(cells); + +@@ -573,7 +577,7 @@ static int nvmem_add_cells_from_table(st + { + const struct nvmem_cell_info *info; + struct nvmem_cell_table *table; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + int rval = 0, i; + + mutex_lock(&nvmem_cell_mutex); +@@ -588,15 +592,13 @@ static int nvmem_add_cells_from_table(st + goto out; + } + +- rval = nvmem_cell_info_to_nvmem_cell(nvmem, +- info, +- cell); ++ rval = nvmem_cell_info_to_nvmem_cell_entry(nvmem, info, cell); + if (rval) { + kfree(cell); + goto out; + } + +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + } + } +@@ -606,10 +608,10 @@ out: + return rval; + } + +-static struct nvmem_cell * +-nvmem_find_cell_by_name(struct nvmem_device *nvmem, const char *cell_id) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_name(struct nvmem_device *nvmem, const char *cell_id) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -680,7 +682,7 @@ static int nvmem_add_cells_from_of(struc + { + struct device_node *parent, *child; + struct device *dev = &nvmem->dev; +- struct nvmem_cell *cell; ++ struct nvmem_cell_entry *cell; + const __be32 *addr; + int len; + +@@ -729,7 +731,7 @@ static int nvmem_add_cells_from_of(struc + } + + cell->np = of_node_get(child); +- nvmem_cell_add(cell); ++ nvmem_cell_entry_add(cell); + } + + return 0; +@@ -1141,9 +1143,33 @@ struct nvmem_device *devm_nvmem_device_g + } + EXPORT_SYMBOL_GPL(devm_nvmem_device_get); + ++static struct nvmem_cell *nvmem_create_cell(struct nvmem_cell_entry *entry, const char *id) ++{ ++ struct nvmem_cell *cell; ++ const char *name = NULL; ++ ++ cell = kzalloc(sizeof(*cell), GFP_KERNEL); ++ if (!cell) ++ return ERR_PTR(-ENOMEM); ++ ++ if (id) { ++ name = kstrdup_const(id, GFP_KERNEL); ++ if (!name) { ++ kfree(cell); ++ return ERR_PTR(-ENOMEM); ++ } ++ } ++ ++ cell->id = name; ++ cell->entry = entry; ++ ++ return cell; ++} ++ + static struct nvmem_cell * + nvmem_cell_get_from_lookup(struct device *dev, const char *con_id) + { ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell = ERR_PTR(-ENOENT); + struct nvmem_cell_lookup *lookup; + struct nvmem_device *nvmem; +@@ -1168,11 +1194,15 @@ nvmem_cell_get_from_lookup(struct device + break; + } + +- cell = nvmem_find_cell_by_name(nvmem, +- lookup->cell_name); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_name(nvmem, ++ lookup->cell_name); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + cell = ERR_PTR(-ENOENT); ++ } else { ++ cell = nvmem_create_cell(cell_entry, con_id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); + } + break; + } +@@ -1183,10 +1213,10 @@ nvmem_cell_get_from_lookup(struct device + } + + #if IS_ENABLED(CONFIG_OF) +-static struct nvmem_cell * +-nvmem_find_cell_by_node(struct nvmem_device *nvmem, struct device_node *np) ++static struct nvmem_cell_entry * ++nvmem_find_cell_entry_by_node(struct nvmem_device *nvmem, struct device_node *np) + { +- struct nvmem_cell *iter, *cell = NULL; ++ struct nvmem_cell_entry *iter, *cell = NULL; + + mutex_lock(&nvmem_mutex); + list_for_each_entry(iter, &nvmem->cells, node) { +@@ -1216,6 +1246,7 @@ struct nvmem_cell *of_nvmem_cell_get(str + { + struct device_node *cell_np, *nvmem_np; + struct nvmem_device *nvmem; ++ struct nvmem_cell_entry *cell_entry; + struct nvmem_cell *cell; + int index = 0; + +@@ -1236,12 +1267,16 @@ struct nvmem_cell *of_nvmem_cell_get(str + if (IS_ERR(nvmem)) + return ERR_CAST(nvmem); + +- cell = nvmem_find_cell_by_node(nvmem, cell_np); +- if (!cell) { ++ cell_entry = nvmem_find_cell_entry_by_node(nvmem, cell_np); ++ if (!cell_entry) { + __nvmem_device_put(nvmem); + return ERR_PTR(-ENOENT); + } + ++ cell = nvmem_create_cell(cell_entry, id); ++ if (IS_ERR(cell)) ++ __nvmem_device_put(nvmem); ++ + return cell; + } + EXPORT_SYMBOL_GPL(of_nvmem_cell_get); +@@ -1347,13 +1382,17 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); + */ + void nvmem_cell_put(struct nvmem_cell *cell) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; ++ ++ if (cell->id) ++ kfree_const(cell->id); + ++ kfree(cell); + __nvmem_device_put(nvmem); + } + EXPORT_SYMBOL_GPL(nvmem_cell_put); + +-static void nvmem_shift_read_buffer_in_place(struct nvmem_cell *cell, void *buf) ++static void nvmem_shift_read_buffer_in_place(struct nvmem_cell_entry *cell, void *buf) + { + u8 *p, *b; + int i, extra, bit_offset = cell->bit_offset; +@@ -1387,8 +1426,8 @@ static void nvmem_shift_read_buffer_in_p + } + + static int __nvmem_cell_read(struct nvmem_device *nvmem, +- struct nvmem_cell *cell, +- void *buf, size_t *len) ++ struct nvmem_cell_entry *cell, ++ void *buf, size_t *len, const char *id) + { + int rc; + +@@ -1419,18 +1458,18 @@ static int __nvmem_cell_read(struct nvme + */ + void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len) + { +- struct nvmem_device *nvmem = cell->nvmem; ++ struct nvmem_device *nvmem = cell->entry->nvmem; + u8 *buf; + int rc; + + if (!nvmem) + return ERR_PTR(-EINVAL); + +- buf = kzalloc(cell->bytes, GFP_KERNEL); ++ buf = kzalloc(cell->entry->bytes, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + +- rc = __nvmem_cell_read(nvmem, cell, buf, len); ++ rc = __nvmem_cell_read(nvmem, cell->entry, buf, len, cell->id); + if (rc) { + kfree(buf); + return ERR_PTR(rc); +@@ -1440,7 +1479,7 @@ void *nvmem_cell_read(struct nvmem_cell + } + EXPORT_SYMBOL_GPL(nvmem_cell_read); + +-static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell *cell, ++static void *nvmem_cell_prepare_write_buffer(struct nvmem_cell_entry *cell, + u8 *_buf, int len) + { + struct nvmem_device *nvmem = cell->nvmem; +@@ -1493,16 +1532,7 @@ err: + return ERR_PTR(rc); + } + +-/** +- * nvmem_cell_write() - Write to a given nvmem cell +- * +- * @cell: nvmem cell to be written. +- * @buf: Buffer to be written. +- * @len: length of buffer to be written to nvmem cell. +- * +- * Return: length of bytes written or negative on failure. +- */ +-int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++static int __nvmem_cell_entry_write(struct nvmem_cell_entry *cell, void *buf, size_t len) + { + struct nvmem_device *nvmem = cell->nvmem; + int rc; +@@ -1528,6 +1558,21 @@ int nvmem_cell_write(struct nvmem_cell * + + return len; + } ++ ++/** ++ * nvmem_cell_write() - Write to a given nvmem cell ++ * ++ * @cell: nvmem cell to be written. ++ * @buf: Buffer to be written. ++ * @len: length of buffer to be written to nvmem cell. ++ * ++ * Return: length of bytes written or negative on failure. ++ */ ++int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) ++{ ++ return __nvmem_cell_entry_write(cell->entry, buf, len); ++} ++ + EXPORT_SYMBOL_GPL(nvmem_cell_write); + + static int nvmem_cell_read_common(struct device *dev, const char *cell_id, +@@ -1630,7 +1675,7 @@ static const void *nvmem_cell_read_varia + if (IS_ERR(cell)) + return cell; + +- nbits = cell->nbits; ++ nbits = cell->entry->nbits; + buf = nvmem_cell_read(cell, len); + nvmem_cell_put(cell); + if (IS_ERR(buf)) +@@ -1726,18 +1771,18 @@ EXPORT_SYMBOL_GPL(nvmem_cell_read_variab + ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + ssize_t len; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- rc = __nvmem_cell_read(nvmem, &cell, buf, &len); ++ rc = __nvmem_cell_read(nvmem, &cell, buf, &len, NULL); + if (rc) + return rc; + +@@ -1757,17 +1802,17 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read + int nvmem_device_cell_write(struct nvmem_device *nvmem, + struct nvmem_cell_info *info, void *buf) + { +- struct nvmem_cell cell; ++ struct nvmem_cell_entry cell; + int rc; + + if (!nvmem) + return -EINVAL; + +- rc = nvmem_cell_info_to_nvmem_cell_nodup(nvmem, info, &cell); ++ rc = nvmem_cell_info_to_nvmem_cell_entry_nodup(nvmem, info, &cell); + if (rc) + return rc; + +- return nvmem_cell_write(&cell, buf, cell.bytes); ++ return __nvmem_cell_entry_write(&cell, buf, cell.bytes); + } + EXPORT_SYMBOL_GPL(nvmem_device_cell_write); + diff --git a/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch b/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch new file mode 100644 index 00000000000..93a540c2b14 --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0002-nvmem-core-add-nvmem-cell-post-processing-callback.patch @@ -0,0 +1,82 @@ +From 5008062f1c3f5af3acf86164aa6fcc77b0c7bdce Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:56 +0100 +Subject: [PATCH] nvmem: core: add nvmem cell post processing callback + +Some NVMEM providers have certain nvmem cells encoded, which requires +post processing before actually using it. + +For example mac-address is stored in either in ascii or delimited or reverse-order. + +Having a post-process callback hook to provider drivers would enable them to +do this vendor specific post processing before nvmem consumers see it. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 9 +++++++++ + include/linux/nvmem-provider.h | 5 +++++ + 2 files changed, 14 insertions(+) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -38,6 +38,7 @@ struct nvmem_device { + unsigned int nkeepout; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + struct gpio_desc *wp_gpio; + void *priv; + }; +@@ -798,6 +799,7 @@ struct nvmem_device *nvmem_register(cons + nvmem->type = config->type; + nvmem->reg_read = config->reg_read; + nvmem->reg_write = config->reg_write; ++ nvmem->cell_post_process = config->cell_post_process; + nvmem->keepout = config->keepout; + nvmem->nkeepout = config->nkeepout; + if (config->of_node) +@@ -1440,6 +1442,13 @@ static int __nvmem_cell_read(struct nvme + if (cell->bit_offset || cell->nbits) + nvmem_shift_read_buffer_in_place(cell, buf); + ++ if (nvmem->cell_post_process) { ++ rc = nvmem->cell_post_process(nvmem->priv, id, ++ cell->offset, buf, cell->bytes); ++ if (rc) ++ return rc; ++ } ++ + if (len) + *len = cell->bytes; + +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -19,6 +19,9 @@ typedef int (*nvmem_reg_read_t)(void *pr + void *val, size_t bytes); + typedef int (*nvmem_reg_write_t)(void *priv, unsigned int offset, + void *val, size_t bytes); ++/* used for vendor specific post processing of cell data */ ++typedef int (*nvmem_cell_post_process_t)(void *priv, const char *id, unsigned int offset, ++ void *buf, size_t bytes); + + enum nvmem_type { + NVMEM_TYPE_UNKNOWN = 0, +@@ -62,6 +65,7 @@ struct nvmem_keepout { + * @no_of_node: Device should not use the parent's of_node even if it's !NULL. + * @reg_read: Callback to read data. + * @reg_write: Callback to write data. ++ * @cell_post_process: Callback for vendor specific post processing of cell data + * @size: Device size. + * @word_size: Minimum read/write access granularity. + * @stride: Minimum read/write access stride. +@@ -94,6 +98,7 @@ struct nvmem_config { + bool no_of_node; + nvmem_reg_read_t reg_read; + nvmem_reg_write_t reg_write; ++ nvmem_cell_post_process_t cell_post_process; + int size; + int word_size; + int stride; diff --git a/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch b/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch new file mode 100644 index 00000000000..ee19228270d --- /dev/null +++ b/target/linux/generic/backport-5.15/802-v5.16-0003-nvmem-imx-ocotp-add-support-for-post-processing.patch @@ -0,0 +1,92 @@ +From d0221a780cbc99fec6c27a98dba2828dc5735c00 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Wed, 13 Oct 2021 14:19:57 +0100 +Subject: [PATCH] nvmem: imx-ocotp: add support for post processing + +Add .cell_post_process callback for imx-ocotp to deal with MAC address, +since MAC address need to be reversed byte for some i.MX SoCs. + +Tested-by: Joakim Zhang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211013131957.30271-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/imx-ocotp.c | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/drivers/nvmem/imx-ocotp.c ++++ b/drivers/nvmem/imx-ocotp.c +@@ -97,6 +97,7 @@ struct ocotp_params { + unsigned int bank_address_words; + void (*set_timing)(struct ocotp_priv *priv); + struct ocotp_ctrl_reg ctrl; ++ bool reverse_mac_address; + }; + + static int imx_ocotp_wait_for_busy(struct ocotp_priv *priv, u32 flags) +@@ -221,6 +222,25 @@ read_end: + return ret; + } + ++static int imx_ocotp_cell_pp(void *context, const char *id, unsigned int offset, ++ void *data, size_t bytes) ++{ ++ struct ocotp_priv *priv = context; ++ ++ /* Deal with some post processing of nvmem cell data */ ++ if (id && !strcmp(id, "mac-address")) { ++ if (priv->params->reverse_mac_address) { ++ u8 *buf = data; ++ int i; ++ ++ for (i = 0; i < bytes/2; i++) ++ swap(buf[i], buf[bytes - i - 1]); ++ } ++ } ++ ++ return 0; ++} ++ + static void imx_ocotp_set_imx6_timing(struct ocotp_priv *priv) + { + unsigned long clk_rate; +@@ -468,6 +488,7 @@ static struct nvmem_config imx_ocotp_nvm + .stride = 1, + .reg_read = imx_ocotp_read, + .reg_write = imx_ocotp_write, ++ .cell_post_process = imx_ocotp_cell_pp, + }; + + static const struct ocotp_params imx6q_params = { +@@ -530,6 +551,7 @@ static const struct ocotp_params imx8mq_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mm_params = { +@@ -537,6 +559,7 @@ static const struct ocotp_params imx8mm_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mn_params = { +@@ -544,6 +567,7 @@ static const struct ocotp_params imx8mn_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_DEFAULT, ++ .reverse_mac_address = true, + }; + + static const struct ocotp_params imx8mp_params = { +@@ -551,6 +575,7 @@ static const struct ocotp_params imx8mp_ + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, + .ctrl = IMX_OCOTP_BM_CTRL_8MP, ++ .reverse_mac_address = true, + }; + + static const struct of_device_id imx_ocotp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch new file mode 100644 index 00000000000..785bfe53f54 --- /dev/null +++ b/target/linux/generic/backport-5.15/803-v5.17-0002-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch @@ -0,0 +1,47 @@ +From 98e2c4efae214fb7086cac9117616eb6ea11475d Mon Sep 17 00:00:00 2001 +From: Chunfeng Yun +Date: Thu, 9 Dec 2021 17:42:34 +0000 +Subject: [PATCH] nvmem: mtk-efuse: support minimum one byte access stride and + granularity + +In order to support nvmem bits property, should support minimum 1 byte +read stride and minimum 1 byte read granularity at the same time. + +Signed-off-by: Chunfeng Yun +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20211209174235.14049-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -19,11 +19,12 @@ static int mtk_reg_read(void *context, + unsigned int reg, void *_val, size_t bytes) + { + struct mtk_efuse_priv *priv = context; +- u32 *val = _val; +- int i = 0, words = bytes / 4; ++ void __iomem *addr = priv->base + reg; ++ u8 *val = _val; ++ int i; + +- while (words--) +- *val++ = readl(priv->base + reg + (i++ * 4)); ++ for (i = 0; i < bytes; i++, val++) ++ *val = readb(addr + i); + + return 0; + } +@@ -45,8 +46,8 @@ static int mtk_efuse_probe(struct platfo + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + +- econfig.stride = 4; +- econfig.word_size = 4; ++ econfig.stride = 1; ++ econfig.word_size = 1; + econfig.reg_read = mtk_reg_read; + econfig.size = resource_size(res); + econfig.priv = priv; diff --git a/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch b/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch new file mode 100644 index 00000000000..efa380288a4 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0001-nvmem-core-Remove-unused-devm_nvmem_unregister.patch @@ -0,0 +1,72 @@ +From 190fae468592bc2f0efc8b928920f8f712b5831e Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:15 +0000 +Subject: [PATCH] nvmem: core: Remove unused devm_nvmem_unregister() + +There are no users and seems no will come of the devm_nvmem_unregister(). +Remove the function and remove the unused devm_nvmem_match() along with it. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 ---------------------- + include/linux/nvmem-provider.h | 8 -------- + 2 files changed, 30 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -942,28 +942,6 @@ struct nvmem_device *devm_nvmem_register + } + EXPORT_SYMBOL_GPL(devm_nvmem_register); + +-static int devm_nvmem_match(struct device *dev, void *res, void *data) +-{ +- struct nvmem_device **r = res; +- +- return *r == data; +-} +- +-/** +- * devm_nvmem_unregister() - Unregister previously registered managed nvmem +- * device. +- * +- * @dev: Device that uses the nvmem device. +- * @nvmem: Pointer to previously registered nvmem device. +- * +- * Return: Will be negative on error or zero on success. +- */ +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return devres_release(dev, devm_nvmem_release, devm_nvmem_match, nvmem); +-} +-EXPORT_SYMBOL(devm_nvmem_unregister); +- + static struct nvmem_device *__nvmem_device_get(void *data, + int (*match)(struct device *dev, const void *data)) + { +--- a/include/linux/nvmem-provider.h ++++ b/include/linux/nvmem-provider.h +@@ -135,8 +135,6 @@ void nvmem_unregister(struct nvmem_devic + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *cfg); + +-int devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem); +- + void nvmem_add_cell_table(struct nvmem_cell_table *table); + void nvmem_del_cell_table(struct nvmem_cell_table *table); + +@@ -155,12 +153,6 @@ devm_nvmem_register(struct device *dev, + return nvmem_register(c); + } + +-static inline int +-devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem) +-{ +- return -EOPNOTSUPP; +-} +- + static inline void nvmem_add_cell_table(struct nvmem_cell_table *table) {} + static inline void nvmem_del_cell_table(struct nvmem_cell_table *table) {} + diff --git a/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch b/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch new file mode 100644 index 00000000000..28e8ba465d5 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0002-nvmem-core-Use-devm_add_action_or_reset.patch @@ -0,0 +1,58 @@ +From 5825b2c6762611e67ccaf3ccf64485365a120f0b Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:16 +0000 +Subject: [PATCH] nvmem: core: Use devm_add_action_or_reset() + +Slightly simplify the devm_nvmem_register() by using the +devm_add_action_or_reset(). + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -904,9 +904,9 @@ void nvmem_unregister(struct nvmem_devic + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + +-static void devm_nvmem_release(struct device *dev, void *res) ++static void devm_nvmem_unregister(void *nvmem) + { +- nvmem_unregister(*(struct nvmem_device **)res); ++ nvmem_unregister(nvmem); + } + + /** +@@ -923,20 +923,16 @@ static void devm_nvmem_release(struct de + struct nvmem_device *devm_nvmem_register(struct device *dev, + const struct nvmem_config *config) + { +- struct nvmem_device **ptr, *nvmem; +- +- ptr = devres_alloc(devm_nvmem_release, sizeof(*ptr), GFP_KERNEL); +- if (!ptr) +- return ERR_PTR(-ENOMEM); ++ struct nvmem_device *nvmem; ++ int ret; + + nvmem = nvmem_register(config); ++ if (IS_ERR(nvmem)) ++ return nvmem; + +- if (!IS_ERR(nvmem)) { +- *ptr = nvmem; +- devres_add(dev, ptr); +- } else { +- devres_free(ptr); +- } ++ ret = devm_add_action_or_reset(dev, devm_nvmem_unregister, nvmem); ++ if (ret) ++ return ERR_PTR(ret); + + return nvmem; + } diff --git a/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch b/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch new file mode 100644 index 00000000000..d7933094261 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0003-nvmem-core-Check-input-parameter-for-NULL-in-nvmem_u.patch @@ -0,0 +1,30 @@ +From 8c751e0d9a5264376935a84429a2d468c8877d99 Mon Sep 17 00:00:00 2001 +From: Andy Shevchenko +Date: Sun, 20 Feb 2022 15:15:17 +0000 +Subject: [PATCH] nvmem: core: Check input parameter for NULL in + nvmem_unregister() + +nvmem_unregister() frees resources and standard pattern is to allow +caller to not care if it's NULL or not. This will reduce burden on +the callers to perform this check. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -900,7 +900,8 @@ static void nvmem_device_release(struct + */ + void nvmem_unregister(struct nvmem_device *nvmem) + { +- kref_put(&nvmem->refcnt, nvmem_device_release); ++ if (nvmem) ++ kref_put(&nvmem->refcnt, nvmem_device_release); + } + EXPORT_SYMBOL_GPL(nvmem_unregister); + diff --git a/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch b/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch new file mode 100644 index 00000000000..c98f8e9d545 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0004-nvmem-qfprom-fix-kerneldoc-warning.patch @@ -0,0 +1,29 @@ +From 05196facc052385960028ac634447ecf6c764ec3 Mon Sep 17 00:00:00 2001 +From: Srinivas Kandagatla +Date: Sun, 20 Feb 2022 15:15:18 +0000 +Subject: [PATCH] nvmem: qfprom: fix kerneldoc warning + +This patch fixes below kernel doc warning, +warning: expecting prototype for qfprom_efuse_reg_write(). +Prototype was for qfprom_reg_write() instead + +No code changes. + +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -244,7 +244,7 @@ err_clk_prepared: + } + + /** +- * qfprom_efuse_reg_write() - Write to fuses. ++ * qfprom_reg_write() - Write to fuses. + * @context: Our driver data. + * @reg: The offset to write at. + * @_val: Pointer to data to write. diff --git a/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch b/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch new file mode 100644 index 00000000000..6aad6af0800 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0005-nvmem-sunxi_sid-Add-support-for-D1-variant.patch @@ -0,0 +1,38 @@ +From 07ae4fde9efada7878e1383d6ccc7da70315ca23 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Sun, 20 Feb 2022 15:15:20 +0000 +Subject: [PATCH] nvmem: sunxi_sid: Add support for D1 variant + +D1 has a smaller eFuse block than some other recent SoCs, and it no +longer requires a workaround to read the eFuse data. + +Signed-off-by: Samuel Holland +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-7-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunxi_sid.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/sunxi_sid.c ++++ b/drivers/nvmem/sunxi_sid.c +@@ -184,6 +184,11 @@ static const struct sunxi_sid_cfg sun8i_ + .need_register_readout = true, + }; + ++static const struct sunxi_sid_cfg sun20i_d1_cfg = { ++ .value_offset = 0x200, ++ .size = 0x100, ++}; ++ + static const struct sunxi_sid_cfg sun50i_a64_cfg = { + .value_offset = 0x200, + .size = 0x100, +@@ -200,6 +205,7 @@ static const struct of_device_id sunxi_s + { .compatible = "allwinner,sun7i-a20-sid", .data = &sun7i_a20_cfg }, + { .compatible = "allwinner,sun8i-a83t-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun8i-h3-sid", .data = &sun8i_h3_cfg }, ++ { .compatible = "allwinner,sun20i-d1-sid", .data = &sun20i_d1_cfg }, + { .compatible = "allwinner,sun50i-a64-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h5-sid", .data = &sun50i_a64_cfg }, + { .compatible = "allwinner,sun50i-h6-sid", .data = &sun50i_h6_cfg }, diff --git a/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch b/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch new file mode 100644 index 00000000000..a73b42c5de3 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0006-nvmem-meson-mx-efuse-replace-unnecessary-devm_kstrdu.patch @@ -0,0 +1,28 @@ +From 4dc8d89faed9bb05f116fa1794fc955b14910386 Mon Sep 17 00:00:00 2001 +From: Xiaoke Wang +Date: Sun, 20 Feb 2022 15:15:21 +0000 +Subject: [PATCH] nvmem: meson-mx-efuse: replace unnecessary devm_kstrdup() + +Replace unnecessary devm_kstrdup() so to avoid redundant memory allocation. + +Suggested-by: Martin Blumenstingl +Signed-off-by: Xiaoke Wang +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/meson-mx-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/meson-mx-efuse.c ++++ b/drivers/nvmem/meson-mx-efuse.c +@@ -209,8 +209,7 @@ static int meson_mx_efuse_probe(struct p + if (IS_ERR(efuse->base)) + return PTR_ERR(efuse->base); + +- efuse->config.name = devm_kstrdup(&pdev->dev, drvdata->name, +- GFP_KERNEL); ++ efuse->config.name = drvdata->name; + efuse->config.owner = THIS_MODULE; + efuse->config.dev = &pdev->dev; + efuse->config.priv = efuse; diff --git a/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch b/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch new file mode 100644 index 00000000000..6afb68b3f91 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0007-nvmem-add-driver-for-Layerscape-SFP-Security-Fuse-Pr.patch @@ -0,0 +1,139 @@ +From f78451012b9e159afdba31c3eb69f223a9f42adc Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Sun, 20 Feb 2022 15:15:23 +0000 +Subject: [PATCH] nvmem: add driver for Layerscape SFP (Security Fuse + Processor) + +Add support for the Security Fuse Processor found on Layerscape SoCs. +This driver implements basic read access. + +Signed-off-by: Michael Walle +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220220151527.17216-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 +++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/layerscape-sfp.c | 89 ++++++++++++++++++++++++++++++++++ + 3 files changed, 103 insertions(+) + create mode 100644 drivers/nvmem/layerscape-sfp.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -300,4 +300,16 @@ config NVMEM_BRCM_NVRAM + This driver provides support for Broadcom's NVRAM that can be accessed + using I/O mapping. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. + nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o + nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o +--- /dev/null ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -0,0 +1,89 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Layerscape SFP driver ++ * ++ * Copyright (c) 2022 Michael Walle ++ * ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 ++ ++struct layerscape_sfp_priv { ++ void __iomem *base; ++}; ++ ++struct layerscape_sfp_data { ++ int size; ++}; ++ ++static int layerscape_sfp_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct layerscape_sfp_priv *priv = context; ++ ++ memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, ++ bytes); ++ ++ return 0; ++} ++ ++static struct nvmem_config layerscape_sfp_nvmem_config = { ++ .name = "fsl-sfp", ++ .reg_read = layerscape_sfp_read, ++}; ++ ++static int layerscape_sfp_probe(struct platform_device *pdev) ++{ ++ const struct layerscape_sfp_data *data; ++ struct layerscape_sfp_priv *priv; ++ struct nvmem_device *nvmem; ++ ++ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(priv->base)) ++ return PTR_ERR(priv->base); ++ ++ data = device_get_match_data(&pdev->dev); ++ ++ layerscape_sfp_nvmem_config.size = data->size; ++ layerscape_sfp_nvmem_config.dev = &pdev->dev; ++ layerscape_sfp_nvmem_config.priv = priv; ++ ++ nvmem = devm_nvmem_register(&pdev->dev, &layerscape_sfp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct layerscape_sfp_data ls1028a_data = { ++ .size = 0x88, ++}; ++ ++static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, layerscape_sfp_dt_ids); ++ ++static struct platform_driver layerscape_sfp_driver = { ++ .probe = layerscape_sfp_probe, ++ .driver = { ++ .name = "layerscape_sfp", ++ .of_match_table = layerscape_sfp_dt_ids, ++ }, ++}; ++module_platform_driver(layerscape_sfp_driver); ++ ++MODULE_AUTHOR("Michael Walle "); ++MODULE_DESCRIPTION("Layerscape Security Fuse Processor driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch b/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch new file mode 100644 index 00000000000..74bd4a7eb67 --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0008-nvmem-qfprom-Increase-fuse-blow-timeout-to-prevent-w.patch @@ -0,0 +1,32 @@ +From bc5c75e0a5a9400f81a987cc720100ac475fa4d8 Mon Sep 17 00:00:00 2001 +From: Knox Chiou +Date: Wed, 23 Feb 2022 22:35:00 +0000 +Subject: [PATCH] nvmem: qfprom: Increase fuse blow timeout to prevent write + fail + +sc7180 blow fuses got slightly chances to hit qfprom_reg_write timeout. +Current timeout is simply too low. Since blowing fuses is a +very rare operation, so the risk associated with overestimating this +number is low. +Increase fuse blow timeout from 1ms to 10ms. + +Reviewed-by: Douglas Anderson +Signed-off-by: Knox Chiou +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -22,7 +22,7 @@ + + /* Amount of time required to hold charge to blow fuse in micro-seconds */ + #define QFPROM_FUSE_BLOW_POLL_US 100 +-#define QFPROM_FUSE_BLOW_TIMEOUT_US 1000 ++#define QFPROM_FUSE_BLOW_TIMEOUT_US 10000 + + #define QFPROM_BLOW_STATUS_OFFSET 0x048 + #define QFPROM_BLOW_STATUS_BUSY 0x1 diff --git a/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch new file mode 100644 index 00000000000..07c5808403b --- /dev/null +++ b/target/linux/generic/backport-5.15/804-v5.18-0009-nvmem-Add-driver-for-OCOTP-in-Sunplus-SP7021.patch @@ -0,0 +1,291 @@ +From 8747ec2e9762ed9ae53b3a590938f454b6a1abdf Mon Sep 17 00:00:00 2001 +From: Vincent Shih +Date: Wed, 23 Feb 2022 22:35:01 +0000 +Subject: [PATCH] nvmem: Add driver for OCOTP in Sunplus SP7021 + +Add driver for OCOTP in Sunplus SP7021 + +Signed-off-by: Vincent Shih +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220223223502.29454-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 5 + + drivers/nvmem/Kconfig | 12 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/sunplus-ocotp.c | 228 ++++++++++++++++++++++++++++++++++ + 4 files changed, 247 insertions(+) + create mode 100644 drivers/nvmem/sunplus-ocotp.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -17953,6 +17953,11 @@ L: netdev@vger.kernel.org + S: Maintained + F: drivers/net/ethernet/dlink/sundance.c + ++SUNPLUS OCOTP DRIVER ++M: Vincent Shih ++S: Maintained ++F: drivers/nvmem/sunplus-ocotp.c ++ + SUPERH + M: Yoshinori Sato + M: Rich Felker +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -312,4 +312,16 @@ config NVMEM_LAYERSCAPE_SFP + This driver can also be built as a module. If so, the module + will be called layerscape-sfp. + ++config NVMEM_SUNPLUS_OCOTP ++ tristate "Sunplus SoC OTP support" ++ depends on SOC_SP7021 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the On-chip OTP controller (OCOTP) available ++ on Sunplus SoCs. It provides access to 128 bytes of one-time ++ programmable eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-sunplus-ocotp. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -63,3 +63,5 @@ obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_ + nvmem_brcm_nvram-y := brcm_nvram.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o ++obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o +--- /dev/null ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -0,0 +1,228 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/* ++ * The OCOTP driver for Sunplus SP7021 ++ * ++ * Copyright (C) 2019 Sunplus Technology Inc., All rights reserved. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* ++ * OTP memory ++ * Each bank contains 4 words (32 bits). ++ * Bank 0 starts at offset 0 from the base. ++ */ ++ ++#define OTP_WORDS_PER_BANK 4 ++#define OTP_WORD_SIZE sizeof(u32) ++#define OTP_BIT_ADDR_OF_BANK (8 * OTP_WORD_SIZE * OTP_WORDS_PER_BANK) ++#define QAC628_OTP_NUM_BANKS 8 ++#define QAC628_OTP_SIZE (QAC628_OTP_NUM_BANKS * OTP_WORDS_PER_BANK * OTP_WORD_SIZE) ++#define OTP_READ_TIMEOUT_US 200000 ++ ++/* HB_GPIO */ ++#define ADDRESS_8_DATA 0x20 ++ ++/* OTP_RX */ ++#define OTP_CONTROL_2 0x48 ++#define OTP_RD_PERIOD GENMASK(15, 8) ++#define OTP_RD_PERIOD_MASK ~GENMASK(15, 8) ++#define CPU_CLOCK FIELD_PREP(OTP_RD_PERIOD, 30) ++#define SEL_BAK_KEY2 BIT(5) ++#define SEL_BAK_KEY2_MASK ~BIT(5) ++#define SW_TRIM_EN BIT(4) ++#define SW_TRIM_EN_MASK ~BIT(4) ++#define SEL_BAK_KEY BIT(3) ++#define SEL_BAK_KEY_MASK ~BIT(3) ++#define OTP_READ BIT(2) ++#define OTP_LOAD_SECURE_DATA BIT(1) ++#define OTP_LOAD_SECURE_DATA_MASK ~BIT(1) ++#define OTP_DO_CRC BIT(0) ++#define OTP_DO_CRC_MASK ~BIT(0) ++#define OTP_STATUS 0x4c ++#define OTP_READ_DONE BIT(4) ++#define OTP_READ_DONE_MASK ~BIT(4) ++#define OTP_LOAD_SECURE_DONE_MASK ~BIT(2) ++#define OTP_READ_ADDRESS 0x50 ++ ++enum base_type { ++ HB_GPIO, ++ OTPRX, ++ BASEMAX, ++}; ++ ++struct sp_ocotp_priv { ++ struct device *dev; ++ void __iomem *base[BASEMAX]; ++ struct clk *clk; ++}; ++ ++struct sp_ocotp_data { ++ int size; ++}; ++ ++const struct sp_ocotp_data sp_otp_v0 = { ++ .size = QAC628_OTP_SIZE, ++}; ++ ++static int sp_otp_read_real(struct sp_ocotp_priv *otp, int addr, char *value) ++{ ++ unsigned int addr_data; ++ unsigned int byte_shift; ++ unsigned int status; ++ int ret; ++ ++ addr_data = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr_data = addr_data / OTP_WORD_SIZE; ++ ++ byte_shift = addr % (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ byte_shift = byte_shift % OTP_WORD_SIZE; ++ ++ addr = addr / (OTP_WORD_SIZE * OTP_WORDS_PER_BANK); ++ addr = addr * OTP_BIT_ADDR_OF_BANK; ++ ++ writel(readl(otp->base[OTPRX] + OTP_STATUS) & OTP_READ_DONE_MASK & ++ OTP_LOAD_SECURE_DONE_MASK, otp->base[OTPRX] + OTP_STATUS); ++ writel(addr, otp->base[OTPRX] + OTP_READ_ADDRESS); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) | OTP_READ, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel(readl(otp->base[OTPRX] + OTP_CONTROL_2) & SEL_BAK_KEY2_MASK & SW_TRIM_EN_MASK ++ & SEL_BAK_KEY_MASK & OTP_LOAD_SECURE_DATA_MASK & OTP_DO_CRC_MASK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ writel((readl(otp->base[OTPRX] + OTP_CONTROL_2) & OTP_RD_PERIOD_MASK) | CPU_CLOCK, ++ otp->base[OTPRX] + OTP_CONTROL_2); ++ ++ ret = readl_poll_timeout(otp->base[OTPRX] + OTP_STATUS, status, ++ status & OTP_READ_DONE, 10, OTP_READ_TIMEOUT_US); ++ ++ if (ret < 0) ++ return ret; ++ ++ *value = (readl(otp->base[HB_GPIO] + ADDRESS_8_DATA + addr_data * OTP_WORD_SIZE) ++ >> (8 * byte_shift)) & 0xff; ++ ++ return ret; ++} ++ ++static int sp_ocotp_read(void *priv, unsigned int offset, void *value, size_t bytes) ++{ ++ struct sp_ocotp_priv *otp = priv; ++ unsigned int addr; ++ char *buf = value; ++ char val[4]; ++ int ret; ++ ++ ret = clk_enable(otp->clk); ++ if (ret) ++ return ret; ++ ++ *buf = 0; ++ for (addr = offset; addr < (offset + bytes); addr++) { ++ ret = sp_otp_read_real(otp, addr, val); ++ if (ret < 0) { ++ dev_err(otp->dev, "OTP read fail:%d at %d", ret, addr); ++ goto disable_clk; ++ } ++ ++ *buf++ = *val; ++ } ++ ++disable_clk: ++ clk_disable(otp->clk); ++ ++ return ret; ++} ++ ++static struct nvmem_config sp_ocotp_nvmem_config = { ++ .name = "sp-ocotp", ++ .read_only = true, ++ .word_size = 1, ++ .size = QAC628_OTP_SIZE, ++ .stride = 1, ++ .reg_read = sp_ocotp_read, ++ .owner = THIS_MODULE, ++}; ++ ++static int sp_ocotp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct sp_ocotp_priv *otp; ++ struct resource *res; ++ int ret; ++ ++ otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio"); ++ otp->base[HB_GPIO] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[HB_GPIO])) ++ return PTR_ERR(otp->base[HB_GPIO]); ++ ++ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx"); ++ otp->base[OTPRX] = devm_ioremap_resource(dev, res); ++ if (IS_ERR(otp->base[OTPRX])) ++ return PTR_ERR(otp->base[OTPRX]); ++ ++ otp->clk = devm_clk_get(&pdev->dev, NULL); ++ if (IS_ERR(otp->clk)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(otp->clk), ++ "devm_clk_get fail\n"); ++ ++ ret = clk_prepare(otp->clk); ++ if (ret < 0) { ++ dev_err(dev, "failed to prepare clk: %d\n", ret); ++ return ret; ++ } ++ ++ sp_ocotp_nvmem_config.priv = otp; ++ sp_ocotp_nvmem_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &sp_ocotp_nvmem_config); ++ if (IS_ERR(nvmem)) ++ return dev_err_probe(&pdev->dev, PTR_ERR(nvmem), ++ "register nvmem device fail\n"); ++ ++ platform_set_drvdata(pdev, nvmem); ++ ++ dev_dbg(dev, "banks:%d x wpb:%d x wsize:%d = %d", ++ (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, ++ (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); ++ ++ dev_info(dev, "by Sunplus (C) 2020"); ++ ++ return 0; ++} ++ ++static const struct of_device_id sp_ocotp_dt_ids[] = { ++ { .compatible = "sunplus,sp7021-ocotp", .data = &sp_otp_v0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, sp_ocotp_dt_ids); ++ ++static struct platform_driver sp_otp_driver = { ++ .probe = sp_ocotp_probe, ++ .driver = { ++ .name = "sunplus,sp7021-ocotp", ++ .of_match_table = sp_ocotp_dt_ids, ++ } ++}; ++module_platform_driver(sp_otp_driver); ++ ++MODULE_AUTHOR("Vincent Shih "); ++MODULE_DESCRIPTION("Sunplus On-Chip OTP driver"); ++MODULE_LICENSE("GPL"); ++ diff --git a/target/linux/bcm53xx/patches-5.15/080-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch b/target/linux/generic/backport-5.15/804-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/080-v5.18-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch rename to target/linux/generic/backport-5.15/804-v5.18-0010-nvmem-brcm_nvram-parse-NVRAM-content-into-NVMEM-cell.patch diff --git a/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch b/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch new file mode 100644 index 00000000000..ef3107db946 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0001-nvmem-bcm-ocotp-mark-ACPI-device-ID-table-as-maybe-u.patch @@ -0,0 +1,32 @@ +From 6bd0ffeaa389866089e9573b2298ae58d6359b75 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:24 +0100 +Subject: [PATCH] nvmem: bcm-ocotp: mark ACPI device ID table as maybe unused +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +"bcm_otpc_acpi_ids" is used with ACPI_PTR, so a build with !CONFIG_ACPI +has a warning: + + drivers/nvmem/bcm-ocotp.c:247:36: error: + ‘bcm_otpc_acpi_ids’ defined but not used [-Werror=unused-const-variable=] + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-1-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/bcm-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/bcm-ocotp.c ++++ b/drivers/nvmem/bcm-ocotp.c +@@ -244,7 +244,7 @@ static const struct of_device_id bcm_otp + }; + MODULE_DEVICE_TABLE(of, bcm_otpc_dt_ids); + +-static const struct acpi_device_id bcm_otpc_acpi_ids[] = { ++static const struct acpi_device_id bcm_otpc_acpi_ids[] __maybe_unused = { + { .id = "BRCM0700", .driver_data = (kernel_ulong_t)&otp_map }, + { .id = "BRCM0701", .driver_data = (kernel_ulong_t)&otp_map_v2 }, + { /* sentinel */ } diff --git a/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch b/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch new file mode 100644 index 00000000000..a84d2316f0c --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0002-nvmem-sunplus-ocotp-staticize-sp_otp_v0.patch @@ -0,0 +1,30 @@ +From 1066f8156351fcd997125257cea47cf805ba4f6d Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:25 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: staticize sp_otp_v0 + +The "sp_otp_v0" file scope variable is not used outside, so make it +static to fix warning: + + drivers/nvmem/sunplus-ocotp.c:74:29: sparse: + sparse: symbol 'sp_otp_v0' was not declared. Should it be static? + +Reported-by: kernel test robot +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-2-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -71,7 +71,7 @@ struct sp_ocotp_data { + int size; + }; + +-const struct sp_ocotp_data sp_otp_v0 = { ++static const struct sp_ocotp_data sp_otp_v0 = { + .size = QAC628_OTP_SIZE, + }; + diff --git a/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch b/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch new file mode 100644 index 00000000000..886ebc12a9c --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0003-nvmem-sunplus-ocotp-drop-useless-probe-confirmation.patch @@ -0,0 +1,27 @@ +From 874dfbcf219ccc42a2cbd187d087c7db82c3024b Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Mon, 21 Mar 2022 12:03:26 +0100 +Subject: [PATCH] nvmem: sunplus-ocotp: drop useless probe confirmation + +Printing probe success is discouraged, because we can use tracing for +this purpose. Remove useless print message after Sunplus OCOTP driver +probe. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220321110326.44652-3-krzk@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/sunplus-ocotp.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/nvmem/sunplus-ocotp.c ++++ b/drivers/nvmem/sunplus-ocotp.c +@@ -202,8 +202,6 @@ static int sp_ocotp_probe(struct platfor + (int)QAC628_OTP_NUM_BANKS, (int)OTP_WORDS_PER_BANK, + (int)OTP_WORD_SIZE, (int)QAC628_OTP_SIZE); + +- dev_info(dev, "by Sunplus (C) 2020"); +- + return 0; + } + diff --git a/target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch b/target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch similarity index 95% rename from target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch rename to target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch index 1acc6947fe1..3b1e76147a8 100644 --- a/target/linux/generic/backport-5.10/824-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch +++ b/target/linux/generic/backport-5.15/805-v5.19-0004-nvmem-core-support-passing-DT-node-in-cell-info.patch @@ -21,7 +21,7 @@ Signed-off-by: Greg Kroah-Hartman --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c -@@ -462,6 +462,7 @@ static int nvmem_cell_info_to_nvmem_cell +@@ -467,6 +467,7 @@ static int nvmem_cell_info_to_nvmem_cell cell->bit_offset = info->bit_offset; cell->nbits = info->nbits; diff --git a/target/linux/bcm53xx/patches-5.15/081-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.15/805-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 100% rename from target/linux/bcm53xx/patches-5.15/081-v5.19-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.15/805-v5.19-0005-nvmem-brcm_nvram-find-Device-Tree-nodes-for-NVMEM-ce.patch diff --git a/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch b/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch new file mode 100644 index 00000000000..ebeb6f5ad39 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0006-nvmem-Add-Apple-eFuse-driver.patch @@ -0,0 +1,130 @@ +From b6b7ef932ae838209254f016ecf8862d716a5ced Mon Sep 17 00:00:00 2001 +From: Sven Peter +Date: Fri, 29 Apr 2022 17:26:50 +0100 +Subject: [PATCH] nvmem: Add Apple eFuse driver + +Apple SoCs contain eFuses used to store factory-programmed data such +as calibration values for the PCIe or the Type-C PHY. They are organized +as 32bit values exposed as MMIO. + +Signed-off-by: Sven Peter +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 12 ++++++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/apple-efuses.c | 80 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 94 insertions(+) + create mode 100644 drivers/nvmem/apple-efuses.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -324,4 +324,16 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -65,3 +65,5 @@ obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nv + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o + nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o +--- /dev/null ++++ b/drivers/nvmem/apple-efuses.c +@@ -0,0 +1,80 @@ ++// SPDX-License-Identifier: GPL-2.0-only ++/* ++ * Apple SoC eFuse driver ++ * ++ * Copyright (C) The Asahi Linux Contributors ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++struct apple_efuses_priv { ++ void __iomem *fuses; ++}; ++ ++static int apple_efuses_read(void *context, unsigned int offset, void *val, ++ size_t bytes) ++{ ++ struct apple_efuses_priv *priv = context; ++ u32 *dst = val; ++ ++ while (bytes >= sizeof(u32)) { ++ *dst++ = readl_relaxed(priv->fuses + offset); ++ bytes -= sizeof(u32); ++ offset += sizeof(u32); ++ } ++ ++ return 0; ++} ++ ++static int apple_efuses_probe(struct platform_device *pdev) ++{ ++ struct apple_efuses_priv *priv; ++ struct resource *res; ++ struct nvmem_config config = { ++ .dev = &pdev->dev, ++ .read_only = true, ++ .reg_read = apple_efuses_read, ++ .stride = sizeof(u32), ++ .word_size = sizeof(u32), ++ .name = "apple_efuses_nvmem", ++ .id = NVMEM_DEVID_AUTO, ++ .root_only = true, ++ }; ++ ++ priv = devm_kzalloc(config.dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->fuses = devm_platform_get_and_ioremap_resource(pdev, 0, &res); ++ if (IS_ERR(priv->fuses)) ++ return PTR_ERR(priv->fuses); ++ ++ config.priv = priv; ++ config.size = resource_size(res); ++ ++ return PTR_ERR_OR_ZERO(devm_nvmem_register(config.dev, &config)); ++} ++ ++static const struct of_device_id apple_efuses_of_match[] = { ++ { .compatible = "apple,efuses", }, ++ {} ++}; ++ ++MODULE_DEVICE_TABLE(of, apple_efuses_of_match); ++ ++static struct platform_driver apple_efuses_driver = { ++ .driver = { ++ .name = "apple_efuses", ++ .of_match_table = apple_efuses_of_match, ++ }, ++ .probe = apple_efuses_probe, ++}; ++ ++module_platform_driver(apple_efuses_driver); ++ ++MODULE_AUTHOR("Sven Peter "); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch b/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch new file mode 100644 index 00000000000..cd51d970069 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0007-nvmem-qfprom-using-pm_runtime_resume_and_get-instead.patch @@ -0,0 +1,31 @@ +From 517f6e2641a2802dce5a5aa0d18c7d37a35678d2 Mon Sep 17 00:00:00 2001 +From: Minghao Chi +Date: Fri, 29 Apr 2022 17:26:54 +0100 +Subject: [PATCH] nvmem: qfprom: using pm_runtime_resume_and_get instead of + pm_runtime_get_sync + +Using pm_runtime_resume_and_get is more appropriate +for simplifing code + +Reported-by: Zeal Robot +Signed-off-by: Minghao Chi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-10-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qfprom.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/qfprom.c ++++ b/drivers/nvmem/qfprom.c +@@ -217,9 +217,8 @@ static int qfprom_enable_fuse_blowing(co + goto err_clk_rate_set; + } + +- ret = pm_runtime_get_sync(priv->dev); ++ ret = pm_runtime_resume_and_get(priv->dev); + if (ret < 0) { +- pm_runtime_put_noidle(priv->dev); + dev_err(priv->dev, "Failed to enable power-domain\n"); + goto err_reg_enable; + } diff --git a/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch b/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch new file mode 100644 index 00000000000..e187238ca38 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0008-nvmem-sfp-Use-regmap.patch @@ -0,0 +1,109 @@ +From 943eadbdb11314b41eacbcc484dfb7f93e271ff4 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:00 +0100 +Subject: [PATCH] nvmem: sfp: Use regmap + +This converts the SFP driver to use regmap. This will allow easily +supporting devices with different endians. We disallow byte-level +access, as regmap_bulk_read doesn't support it (and it's unclear what +the correct result would be when we have an endianness difference). + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-16-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 1 + + drivers/nvmem/layerscape-sfp.c | 30 ++++++++++++++++++++++-------- + 2 files changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -304,6 +304,7 @@ config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST + depends on HAS_IOMEM ++ select REGMAP_MMIO + help + This driver provides support to read the eFuses on Freescale + Layerscape SoC's. For example, the vendor provides a per part +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -13,15 +13,17 @@ + #include + #include + #include ++#include + + #define LAYERSCAPE_SFP_OTP_OFFSET 0x0200 + + struct layerscape_sfp_priv { +- void __iomem *base; ++ struct regmap *regmap; + }; + + struct layerscape_sfp_data { + int size; ++ enum regmap_endian endian; + }; + + static int layerscape_sfp_read(void *context, unsigned int offset, void *val, +@@ -29,15 +31,16 @@ static int layerscape_sfp_read(void *con + { + struct layerscape_sfp_priv *priv = context; + +- memcpy_fromio(val, priv->base + LAYERSCAPE_SFP_OTP_OFFSET + offset, +- bytes); +- +- return 0; ++ return regmap_bulk_read(priv->regmap, ++ LAYERSCAPE_SFP_OTP_OFFSET + offset, val, ++ bytes / 4); + } + + static struct nvmem_config layerscape_sfp_nvmem_config = { + .name = "fsl-sfp", + .reg_read = layerscape_sfp_read, ++ .word_size = 4, ++ .stride = 4, + }; + + static int layerscape_sfp_probe(struct platform_device *pdev) +@@ -45,16 +48,26 @@ static int layerscape_sfp_probe(struct p + const struct layerscape_sfp_data *data; + struct layerscape_sfp_priv *priv; + struct nvmem_device *nvmem; ++ struct regmap_config config = { 0 }; ++ void __iomem *base; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->base = devm_platform_ioremap_resource(pdev, 0); +- if (IS_ERR(priv->base)) +- return PTR_ERR(priv->base); ++ base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(base)) ++ return PTR_ERR(base); + + data = device_get_match_data(&pdev->dev); ++ config.reg_bits = 32; ++ config.reg_stride = 4; ++ config.val_bits = 32; ++ config.val_format_endian = data->endian; ++ config.max_register = LAYERSCAPE_SFP_OTP_OFFSET + data->size - 4; ++ priv->regmap = devm_regmap_init_mmio(&pdev->dev, base, &config); ++ if (IS_ERR(priv->regmap)) ++ return PTR_ERR(priv->regmap); + + layerscape_sfp_nvmem_config.size = data->size; + layerscape_sfp_nvmem_config.dev = &pdev->dev; +@@ -67,6 +80,7 @@ static int layerscape_sfp_probe(struct p + + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, ++ .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { diff --git a/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch b/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch new file mode 100644 index 00000000000..ee000986181 --- /dev/null +++ b/target/linux/generic/backport-5.15/805-v5.19-0009-nvmem-sfp-Add-support-for-TA-2.1-devices.patch @@ -0,0 +1,38 @@ +From 33a1c6618677fe33f8e84cb7bedc45abbce89a50 Mon Sep 17 00:00:00 2001 +From: Sean Anderson +Date: Fri, 29 Apr 2022 17:27:01 +0100 +Subject: [PATCH] nvmem: sfp: Add support for TA 2.1 devices + +This adds support for Trust Architecture (TA) 2.1 devices to the SFP driver. +There are few differences between TA 2.1 and TA 3.0, especially for +read-only support, so just re-use the existing data. + +Signed-off-by: Sean Anderson +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220429162701.2222-17-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/layerscape-sfp.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/nvmem/layerscape-sfp.c ++++ b/drivers/nvmem/layerscape-sfp.c +@@ -78,12 +78,18 @@ static int layerscape_sfp_probe(struct p + return PTR_ERR_OR_ZERO(nvmem); + } + ++static const struct layerscape_sfp_data ls1021a_data = { ++ .size = 0x88, ++ .endian = REGMAP_ENDIAN_BIG, ++}; ++ + static const struct layerscape_sfp_data ls1028a_data = { + .size = 0x88, + .endian = REGMAP_ENDIAN_LITTLE, + }; + + static const struct of_device_id layerscape_sfp_dt_ids[] = { ++ { .compatible = "fsl,ls1021a-sfp", .data = &ls1021a_data }, + { .compatible = "fsl,ls1028a-sfp", .data = &ls1028a_data }, + {}, + }; diff --git a/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch new file mode 100644 index 00000000000..eeffbdaf527 --- /dev/null +++ b/target/linux/generic/backport-5.15/806-v6.0-0001-nvmem-microchip-otpc-add-support.patch @@ -0,0 +1,389 @@ +From 98830350d3fc824c1ff5c338140fe20f041a5916 Mon Sep 17 00:00:00 2001 +From: Claudiu Beznea +Date: Wed, 6 Jul 2022 11:06:22 +0100 +Subject: [PATCH] nvmem: microchip-otpc: add support + +Add support for Microchip OTP controller available on SAMA7G5. The OTPC +controls the access to a non-volatile memory. The memory behind OTPC is +organized into packets, packets are composed by a fixed length header +(4 bytes long) and a variable length payload (payload length is available +in the header). When software request the data at an offset in memory +the OTPC will return (via header + data registers) the whole packet that +has a word at that offset. For the OTP memory layout like below: + +offset OTP Memory layout + + . . + . ... . + . . +0x0E +-----------+ <--- packet X + | header X | +0x12 +-----------+ + | payload X | +0x16 | | + | | +0x1A | | + +-----------+ + . . + . ... . + . . + +if user requests data at address 0x16 the data started at 0x0E will be +returned by controller. User will be able to fetch the whole packet +starting at 0x0E (or parts of the packet) via proper registers. The same +packet will be returned if software request the data at offset 0x0E or +0x12 or 0x1A. + +The OTP will be populated by Microchip with at least 2 packets first one +being boot configuration packet and the 2nd one being temperature +calibration packet. The packet order will be preserved b/w different chip +revisions but the packet sizes may change. + +For the above reasons and to keep the same software able to work on all +chip variants the read function of the driver is working with a packet +id instead of an offset in OTP memory. + +Signed-off-by: Claudiu Beznea +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + MAINTAINERS | 8 + + drivers/nvmem/Kconfig | 7 + + drivers/nvmem/Makefile | 2 + + drivers/nvmem/microchip-otpc.c | 288 +++++++++++++++++++++++++++++++++ + 4 files changed, 305 insertions(+) + create mode 100644 drivers/nvmem/microchip-otpc.c + +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -12353,6 +12353,14 @@ S: Supported + F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + F: drivers/mtd/nand/raw/atmel/* + ++MICROCHIP OTPC DRIVER ++M: Claudiu Beznea ++L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ++S: Supported ++F: Documentation/devicetree/bindings/nvmem/microchip,sama7g5-otpc.yaml ++F: drivers/nvmem/microchip-otpc.c ++F: dt-bindings/nvmem/microchip,sama7g5-otpc.h ++ + MICROCHIP PWM DRIVER + M: Claudiu Beznea + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -107,6 +107,13 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + ++config MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. ++ + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" + depends on WII || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -67,3 +67,5 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o +--- /dev/null ++++ b/drivers/nvmem/microchip-otpc.c +@@ -0,0 +1,288 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * OTP Memory controller ++ * ++ * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries ++ * ++ * Author: Claudiu Beznea ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MCHP_OTPC_CR (0x0) ++#define MCHP_OTPC_CR_READ BIT(6) ++#define MCHP_OTPC_MR (0x4) ++#define MCHP_OTPC_MR_ADDR GENMASK(31, 16) ++#define MCHP_OTPC_AR (0x8) ++#define MCHP_OTPC_SR (0xc) ++#define MCHP_OTPC_SR_READ BIT(6) ++#define MCHP_OTPC_HR (0x20) ++#define MCHP_OTPC_HR_SIZE GENMASK(15, 8) ++#define MCHP_OTPC_DR (0x24) ++ ++#define MCHP_OTPC_NAME "mchp-otpc" ++#define MCHP_OTPC_SIZE (11 * 1024) ++ ++/** ++ * struct mchp_otpc - OTPC private data structure ++ * @base: base address ++ * @dev: struct device pointer ++ * @packets: list of packets in OTP memory ++ * @npackets: number of packets in OTP memory ++ */ ++struct mchp_otpc { ++ void __iomem *base; ++ struct device *dev; ++ struct list_head packets; ++ u32 npackets; ++}; ++ ++/** ++ * struct mchp_otpc_packet - OTPC packet data structure ++ * @list: list head ++ * @id: packet ID ++ * @offset: packet offset (in words) in OTP memory ++ */ ++struct mchp_otpc_packet { ++ struct list_head list; ++ u32 id; ++ u32 offset; ++}; ++ ++static struct mchp_otpc_packet *mchp_otpc_id_to_packet(struct mchp_otpc *otpc, ++ u32 id) ++{ ++ struct mchp_otpc_packet *packet; ++ ++ if (id >= otpc->npackets) ++ return NULL; ++ ++ list_for_each_entry(packet, &otpc->packets, list) { ++ if (packet->id == id) ++ return packet; ++ } ++ ++ return NULL; ++} ++ ++static int mchp_otpc_prepare_read(struct mchp_otpc *otpc, ++ unsigned int offset) ++{ ++ u32 tmp; ++ ++ /* Set address. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_MR); ++ tmp &= ~MCHP_OTPC_MR_ADDR; ++ tmp |= FIELD_PREP(MCHP_OTPC_MR_ADDR, offset); ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_MR); ++ ++ /* Set read. */ ++ tmp = readl_relaxed(otpc->base + MCHP_OTPC_CR); ++ tmp |= MCHP_OTPC_CR_READ; ++ writel_relaxed(tmp, otpc->base + MCHP_OTPC_CR); ++ ++ /* Wait for packet to be transferred into temporary buffers. */ ++ return read_poll_timeout(readl_relaxed, tmp, !(tmp & MCHP_OTPC_SR_READ), ++ 10000, 2000, false, otpc->base + MCHP_OTPC_SR); ++} ++ ++/* ++ * OTPC memory is organized into packets. Each packets contains a header and ++ * a payload. Header is 4 bytes long and contains the size of the payload. ++ * Payload size varies. The memory footprint is something as follows: ++ * ++ * Memory offset Memory footprint Packet ID ++ * ------------- ---------------- --------- ++ * ++ * 0x0 +------------+ <-- packet 0 ++ * | header 0 | ++ * 0x4 +------------+ ++ * | payload 0 | ++ * . . ++ * . ... . ++ * . . ++ * offset1 +------------+ <-- packet 1 ++ * | header 1 | ++ * offset1 + 0x4 +------------+ ++ * | payload 1 | ++ * . . ++ * . ... . ++ * . . ++ * offset2 +------------+ <-- packet 2 ++ * . . ++ * . ... . ++ * . . ++ * offsetN +------------+ <-- packet N ++ * | header N | ++ * offsetN + 0x4 +------------+ ++ * | payload N | ++ * . . ++ * . ... . ++ * . . ++ * +------------+ ++ * ++ * where offset1, offset2, offsetN depends on the size of payload 0, payload 1, ++ * payload N-1. ++ * ++ * The access to memory is done on a per packet basis: the control registers ++ * need to be updated with an offset address (within a packet range) and the ++ * data registers will be update by controller with information contained by ++ * that packet. E.g. if control registers are updated with any address within ++ * the range [offset1, offset2) the data registers are updated by controller ++ * with packet 1. Header data is accessible though MCHP_OTPC_HR register. ++ * Payload data is accessible though MCHP_OTPC_DR and MCHP_OTPC_AR registers. ++ * There is no direct mapping b/w the offset requested by software and the ++ * offset returned by hardware. ++ * ++ * For this, the read function will return the first requested bytes in the ++ * packet. The user will have to be aware of the memory footprint before doing ++ * the read request. ++ */ ++static int mchp_otpc_read(void *priv, unsigned int off, void *val, ++ size_t bytes) ++{ ++ struct mchp_otpc *otpc = priv; ++ struct mchp_otpc_packet *packet; ++ u32 *buf = val; ++ u32 offset; ++ size_t len = 0; ++ int ret, payload_size; ++ ++ /* ++ * We reach this point with off being multiple of stride = 4 to ++ * be able to cross the subsystem. Inside the driver we use continuous ++ * unsigned integer numbers for packet id, thus devide off by 4 ++ * before passing it to mchp_otpc_id_to_packet(). ++ */ ++ packet = mchp_otpc_id_to_packet(otpc, off / 4); ++ if (!packet) ++ return -EINVAL; ++ offset = packet->offset; ++ ++ while (len < bytes) { ++ ret = mchp_otpc_prepare_read(otpc, offset); ++ if (ret) ++ return ret; ++ ++ /* Read and save header content. */ ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ len += sizeof(*buf); ++ offset++; ++ if (len >= bytes) ++ break; ++ ++ /* Read and save payload content. */ ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, *(buf - 1)); ++ writel_relaxed(0UL, otpc->base + MCHP_OTPC_AR); ++ do { ++ *buf++ = readl_relaxed(otpc->base + MCHP_OTPC_DR); ++ len += sizeof(*buf); ++ offset++; ++ payload_size--; ++ } while (payload_size >= 0 && len < bytes); ++ } ++ ++ return 0; ++} ++ ++static int mchp_otpc_init_packets_list(struct mchp_otpc *otpc, u32 *size) ++{ ++ struct mchp_otpc_packet *packet; ++ u32 word, word_pos = 0, id = 0, npackets = 0, payload_size; ++ int ret; ++ ++ INIT_LIST_HEAD(&otpc->packets); ++ *size = 0; ++ ++ while (*size < MCHP_OTPC_SIZE) { ++ ret = mchp_otpc_prepare_read(otpc, word_pos); ++ if (ret) ++ return ret; ++ ++ word = readl_relaxed(otpc->base + MCHP_OTPC_HR); ++ payload_size = FIELD_GET(MCHP_OTPC_HR_SIZE, word); ++ if (!payload_size) ++ break; ++ ++ packet = devm_kzalloc(otpc->dev, sizeof(*packet), GFP_KERNEL); ++ if (!packet) ++ return -ENOMEM; ++ ++ packet->id = id++; ++ packet->offset = word_pos; ++ INIT_LIST_HEAD(&packet->list); ++ list_add_tail(&packet->list, &otpc->packets); ++ ++ /* Count size by adding header and paload sizes. */ ++ *size += 4 * (payload_size + 1); ++ /* Next word: this packet (header, payload) position + 1. */ ++ word_pos += payload_size + 2; ++ ++ npackets++; ++ } ++ ++ otpc->npackets = npackets; ++ ++ return 0; ++} ++ ++static struct nvmem_config mchp_nvmem_config = { ++ .name = MCHP_OTPC_NAME, ++ .type = NVMEM_TYPE_OTP, ++ .read_only = true, ++ .word_size = 4, ++ .stride = 4, ++ .reg_read = mchp_otpc_read, ++}; ++ ++static int mchp_otpc_probe(struct platform_device *pdev) ++{ ++ struct nvmem_device *nvmem; ++ struct mchp_otpc *otpc; ++ u32 size; ++ int ret; ++ ++ otpc = devm_kzalloc(&pdev->dev, sizeof(*otpc), GFP_KERNEL); ++ if (!otpc) ++ return -ENOMEM; ++ ++ otpc->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otpc->base)) ++ return PTR_ERR(otpc->base); ++ ++ otpc->dev = &pdev->dev; ++ ret = mchp_otpc_init_packets_list(otpc, &size); ++ if (ret) ++ return ret; ++ ++ mchp_nvmem_config.dev = otpc->dev; ++ mchp_nvmem_config.size = size; ++ mchp_nvmem_config.priv = otpc; ++ nvmem = devm_nvmem_register(&pdev->dev, &mchp_nvmem_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id __maybe_unused mchp_otpc_ids[] = { ++ { .compatible = "microchip,sama7g5-otpc", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, mchp_otpc_ids); ++ ++static struct platform_driver mchp_otpc_driver = { ++ .probe = mchp_otpc_probe, ++ .driver = { ++ .name = MCHP_OTPC_NAME, ++ .of_match_table = of_match_ptr(mchp_otpc_ids), ++ }, ++}; ++module_platform_driver(mchp_otpc_driver); ++ ++MODULE_AUTHOR("Claudiu Beznea "); ++MODULE_DESCRIPTION("Microchip SAMA7G5 OTPC driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch b/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch new file mode 100644 index 00000000000..6a4126b9ded --- /dev/null +++ b/target/linux/generic/backport-5.15/806-v6.0-0002-nvmem-mtk-efuse-Simplify-with-devm_platform_get_and_.patch @@ -0,0 +1,32 @@ +From f5c97da8037b18d1256a58459fa96ed68e50fb41 Mon Sep 17 00:00:00 2001 +From: AngeloGioacchino Del Regno +Date: Wed, 6 Jul 2022 11:06:27 +0100 +Subject: [PATCH] nvmem: mtk-efuse: Simplify with + devm_platform_get_and_ioremap_resource() + +Convert platform_get_resource(), devm_ioremap_resource() to a single +call to devm_platform_get_and_ioremap_resource(), as this is exactly +what this function does. + +No functional changes. + +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220706100627.6534-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/mtk-efuse.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/drivers/nvmem/mtk-efuse.c ++++ b/drivers/nvmem/mtk-efuse.c +@@ -41,8 +41,7 @@ static int mtk_efuse_probe(struct platfo + if (!priv) + return -ENOMEM; + +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- priv->base = devm_ioremap_resource(dev, res); ++ priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + diff --git a/target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch b/target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch similarity index 89% rename from target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch rename to target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch index a40c61f929e..9138807bc91 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0001-nvmem-add-driver-handling-U-Boot-environment-variabl.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0002-nvmem-add-driver-handling-U-Boot-environment-variabl.patch @@ -1,6 +1,6 @@ -From f955dc14450695564926711cf9fa8e1d5d854302 Mon Sep 17 00:00:00 2001 +From d5542923f200f95bddf524f36fd495f78aa28e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Wed, 15 Jun 2022 21:43:00 +0200 +Date: Fri, 16 Sep 2022 13:20:48 +0100 Subject: [PATCH] nvmem: add driver handling U-Boot environment variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -22,16 +22,24 @@ Kernel-parsed NVMEM cells can be read however by Linux drivers. This may be useful for Ethernet drivers for reading device MAC address which is often stored as U-Boot env variable. -Signed-off-by: Rafał Miłecki Reviewed-by: Ahmad Fatoum +Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- + MAINTAINERS | 1 + + drivers/nvmem/Kconfig | 13 +++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/u-boot-env.c | 218 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 234 insertions(+) + create mode 100644 drivers/nvmem/u-boot-env.c --- a/drivers/nvmem/Kconfig +++ b/drivers/nvmem/Kconfig -@@ -300,4 +300,17 @@ config NVMEM_BRCM_NVRAM - This driver provides support for Broadcom's NVRAM that can be accessed - using I/O mapping. +@@ -344,4 +344,17 @@ config NVMEM_APPLE_EFUSES + This driver can also be built as a module. If so, the module will + be called nvmem-apple-efuses. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" @@ -49,10 +57,10 @@ Signed-off-by: Srinivas Kandagatla endif --- a/drivers/nvmem/Makefile +++ b/drivers/nvmem/Makefile -@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem. - nvmem-rmem-y := rmem.o - obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o - nvmem_brcm_nvram-y := brcm_nvram.o +@@ -69,3 +69,5 @@ obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvme + nvmem-apple-efuses-y := apple-efuses.o + obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o --- /dev/null diff --git a/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch b/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch new file mode 100644 index 00000000000..34a28fa6fe3 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0003-nvmem-core-add-error-handling-for-dev_set_name.patch @@ -0,0 +1,47 @@ +From 5544e90c81261e82e02bbf7c6015a4b9c8c825ef Mon Sep 17 00:00:00 2001 +From: Gaosheng Cui +Date: Fri, 16 Sep 2022 13:20:50 +0100 +Subject: [PATCH] nvmem: core: add error handling for dev_set_name + +The type of return value of dev_set_name is int, which may return +wrong result, so we add error handling for it to reclaim memory +of nvmem resource, and return early when an error occurs. + +Signed-off-by: Gaosheng Cui +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/core.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +--- a/drivers/nvmem/core.c ++++ b/drivers/nvmem/core.c +@@ -810,18 +810,24 @@ struct nvmem_device *nvmem_register(cons + + switch (config->id) { + case NVMEM_DEVID_NONE: +- dev_set_name(&nvmem->dev, "%s", config->name); ++ rval = dev_set_name(&nvmem->dev, "%s", config->name); + break; + case NVMEM_DEVID_AUTO: +- dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); ++ rval = dev_set_name(&nvmem->dev, "%s%d", config->name, nvmem->id); + break; + default: +- dev_set_name(&nvmem->dev, "%s%d", ++ rval = dev_set_name(&nvmem->dev, "%s%d", + config->name ? : "nvmem", + config->name ? config->id : nvmem->id); + break; + } + ++ if (rval) { ++ ida_free(&nvmem_ida, nvmem->id); ++ kfree(nvmem); ++ return ERR_PTR(rval); ++ } ++ + nvmem->read_only = device_property_present(config->dev, "read-only") || + config->read_only || !nvmem->reg_write; + diff --git a/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch b/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch new file mode 100644 index 00000000000..48ad63fab5f --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0004-nvmem-brcm_nvram-Use-kzalloc-for-allocating-only-one.patch @@ -0,0 +1,29 @@ +From d3524bb5b9a0c567b853a0024526afe87dde01ed Mon Sep 17 00:00:00 2001 +From: Kenneth Lee +Date: Fri, 16 Sep 2022 13:20:52 +0100 +Subject: [PATCH] nvmem: brcm_nvram: Use kzalloc for allocating only one + element + +Use kzalloc(...) rather than kcalloc(1, ...) because the number of +elements we are specifying in this case is 1, so kzalloc would +accomplish the same thing and we can simplify. + +Signed-off-by: Kenneth Lee +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/brcm_nvram.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/brcm_nvram.c ++++ b/drivers/nvmem/brcm_nvram.c +@@ -96,7 +96,7 @@ static int brcm_nvram_parse(struct brcm_ + + len = le32_to_cpu(header.len); + +- data = kcalloc(1, len, GFP_KERNEL); ++ data = kzalloc(len, GFP_KERNEL); + memcpy_fromio(data, priv->base, len); + data[len - 1] = '\0'; + diff --git a/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch new file mode 100644 index 00000000000..ae02439bd73 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0005-nvmem-prefix-all-symbols-with-NVMEM_.patch @@ -0,0 +1,281 @@ +From 28fc7c986f01fdcfd28af648be2597624cac0e27 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:54 +0100 +Subject: [PATCH] nvmem: prefix all symbols with NVMEM_ +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This unifies all NVMEM symbols. They follow one style now. + +Reviewed-by: Matthias Brugger +Acked-by: Arnd Bergmann +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + arch/arm/configs/multi_v7_defconfig | 6 +++--- + arch/arm/configs/qcom_defconfig | 2 +- + arch/arm64/configs/defconfig | 10 +++++----- + arch/mips/configs/ci20_defconfig | 2 +- + drivers/cpufreq/Kconfig.arm | 2 +- + drivers/nvmem/Kconfig | 24 ++++++++++++------------ + drivers/nvmem/Makefile | 24 ++++++++++++------------ + drivers/soc/mediatek/Kconfig | 2 +- + drivers/thermal/qcom/Kconfig | 2 +- + 9 files changed, 37 insertions(+), 37 deletions(-) + +--- a/arch/arm/configs/multi_v7_defconfig ++++ b/arch/arm/configs/multi_v7_defconfig +@@ -1125,10 +1125,10 @@ CONFIG_TI_PIPE3=y + CONFIG_TWL4030_USB=m + CONFIG_RAS=y + CONFIG_NVMEM_IMX_OCOTP=y +-CONFIG_ROCKCHIP_EFUSE=m ++CONFIG_NVMEM_ROCKCHIP_EFUSE=m + CONFIG_NVMEM_SUNXI_SID=y + CONFIG_NVMEM_VF610_OCOTP=y +-CONFIG_MESON_MX_EFUSE=m ++CONFIG_NVMEM_MESON_MX_EFUSE=m + CONFIG_NVMEM_RMEM=m + CONFIG_FSI=m + CONFIG_FSI_MASTER_GPIO=m +--- a/arch/arm/configs/qcom_defconfig ++++ b/arch/arm/configs/qcom_defconfig +@@ -274,7 +274,7 @@ CONFIG_PHY_QCOM_USB_HS=y + CONFIG_PHY_QCOM_USB_HSIC=y + CONFIG_PHY_QCOM_QMP=y + CONFIG_PHY_QCOM_USB_SNPS_FEMTO_V2=y +-CONFIG_QCOM_QFPROM=y ++CONFIG_NVMEM_QCOM_QFPROM=y + CONFIG_INTERCONNECT=y + CONFIG_INTERCONNECT_QCOM=y + CONFIG_INTERCONNECT_QCOM_MSM8974=m +--- a/arch/arm64/configs/defconfig ++++ b/arch/arm64/configs/defconfig +@@ -1135,11 +1135,11 @@ CONFIG_QCOM_L3_PMU=y + CONFIG_NVMEM_IMX_OCOTP=y + CONFIG_NVMEM_IMX_OCOTP_SCU=y + CONFIG_QCOM_QFPROM=y +-CONFIG_MTK_EFUSE=y +-CONFIG_ROCKCHIP_EFUSE=y ++CONFIG_NVMEM_MTK_EFUSE=y ++CONFIG_NVMEM_ROCKCHIP_EFUSE=y + CONFIG_NVMEM_SUNXI_SID=y +-CONFIG_UNIPHIER_EFUSE=y +-CONFIG_MESON_EFUSE=m ++CONFIG_NVMEM_UNIPHIER_EFUSE=y ++CONFIG_NVMEM_MESON_EFUSE=m + CONFIG_NVMEM_RMEM=m + CONFIG_FPGA=y + CONFIG_FPGA_MGR_STRATIX10_SOC=m +--- a/arch/mips/configs/ci20_defconfig ++++ b/arch/mips/configs/ci20_defconfig +@@ -137,7 +137,7 @@ CONFIG_MEMORY=y + CONFIG_JZ4780_NEMC=y + CONFIG_PWM=y + CONFIG_PWM_JZ4740=m +-CONFIG_JZ4780_EFUSE=y ++CONFIG_NVMEM_JZ4780_EFUSE=y + CONFIG_JZ4770_PHY=y + CONFIG_EXT4_FS=y + # CONFIG_DNOTIFY is not set +--- a/drivers/cpufreq/Kconfig.arm ++++ b/drivers/cpufreq/Kconfig.arm +@@ -153,7 +153,7 @@ config ARM_OMAP2PLUS_CPUFREQ + config ARM_QCOM_CPUFREQ_NVMEM + tristate "Qualcomm nvmem based CPUFreq" + depends on ARCH_QCOM +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on QCOM_SMEM + select PM_OPP + help +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -52,7 +52,7 @@ config NVMEM_IMX_OCOTP_SCU + This is a driver for the SCU On-Chip OTP Controller (OCOTP) + available on i.MX8 SoCs. + +-config JZ4780_EFUSE ++config NVMEM_JZ4780_EFUSE + tristate "JZ4780 EFUSE Memory Support" + depends on MACH_INGENIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -96,7 +96,7 @@ config NVMEM_MXS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-mxs-ocotp. + +-config MTK_EFUSE ++config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" + depends on ARCH_MEDIATEK || COMPILE_TEST + depends on HAS_IOMEM +@@ -107,7 +107,7 @@ config MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config MICROCHIP_OTPC ++config NVMEM_MICROCHIP_OTPC + tristate "Microchip OTPC support" + depends on ARCH_AT91 || COMPILE_TEST + help +@@ -126,7 +126,7 @@ config NVMEM_NINTENDO_OTP + This driver can also be built as a module. If so, the module + will be called nvmem-nintendo-otp. + +-config QCOM_QFPROM ++config NVMEM_QCOM_QFPROM + tristate "QCOM QFPROM Support" + depends on ARCH_QCOM || COMPILE_TEST + depends on HAS_IOMEM +@@ -145,7 +145,7 @@ config NVMEM_SPMI_SDAM + Qualcomm Technologies, Inc. PMICs. It provides the clients + an interface to read/write to the SDAM module's shared memory. + +-config ROCKCHIP_EFUSE ++config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -156,7 +156,7 @@ config ROCKCHIP_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_efuse. + +-config ROCKCHIP_OTP ++config NVMEM_ROCKCHIP_OTP + tristate "Rockchip OTP controller support" + depends on ARCH_ROCKCHIP || COMPILE_TEST + depends on HAS_IOMEM +@@ -199,7 +199,7 @@ config NVMEM_SUNXI_SID + This driver can also be built as a module. If so, the module + will be called nvmem_sunxi_sid. + +-config UNIPHIER_EFUSE ++config NVMEM_UNIPHIER_EFUSE + tristate "UniPhier SoCs eFuse support" + depends on ARCH_UNIPHIER || COMPILE_TEST + depends on HAS_IOMEM +@@ -221,7 +221,7 @@ config NVMEM_VF610_OCOTP + This driver can also be build as a module. If so, the module will + be called nvmem-vf610-ocotp. + +-config MESON_EFUSE ++config NVMEM_MESON_EFUSE + tristate "Amlogic Meson GX eFuse Support" + depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +@@ -231,7 +231,7 @@ config MESON_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem_meson_efuse. + +-config MESON_MX_EFUSE ++config NVMEM_MESON_MX_EFUSE + tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" + depends on ARCH_MESON || COMPILE_TEST + help +@@ -251,13 +251,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config RAVE_SP_EEPROM ++config NVMEM_RAVE_SP_EEPROM + tristate "Rave SP EEPROM Support" + depends on RAVE_SP_CORE + help + Say y here to enable Rave SP EEPROM support. + +-config SC27XX_EFUSE ++config NVMEM_SC27XX_EFUSE + tristate "Spreadtrum SC27XX eFuse Support" + depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM +@@ -278,7 +278,7 @@ config NVMEM_ZYNQMP + + If sure, say yes. If unsure, say no. + +-config SPRD_EFUSE ++config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" + depends on ARCH_SPRD || COMPILE_TEST + depends on HAS_IOMEM +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -15,7 +15,7 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-i + nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o + nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +@@ -25,37 +25,37 @@ obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-m + nvmem-mxs-ocotp-y := mxs-ocotp.o + obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o + nvmem-nintendo-otp-y := nintendo-otp.o +-obj-$(CONFIG_MTK_EFUSE) += nvmem_mtk-efuse.o ++obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o + nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_QCOM_QFPROM) += nvmem_qfprom.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o + nvmem_qfprom-y := qfprom.o + obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o + nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o +-obj-$(CONFIG_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o + nvmem_rockchip_efuse-y := rockchip-efuse.o +-obj-$(CONFIG_ROCKCHIP_OTP) += nvmem-rockchip-otp.o ++obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o + nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o + nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o + nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o + nvmem-uniphier-efuse-y := uniphier-efuse.o + obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o + nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_MESON_EFUSE) += nvmem_meson_efuse.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o + nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o + nvmem_meson_mx_efuse-y := meson-mx-efuse.o + obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o + nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o + nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o +-obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o + nvmem-sc27xx-efuse-y := sc27xx-efuse.o + obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o + nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_SPRD_EFUSE) += nvmem_sprd_efuse.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o + nvmem_sprd_efuse-y := sprd-efuse.o + obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o + nvmem-rmem-y := rmem.o +@@ -67,7 +67,7 @@ obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvm + nvmem_sunplus_ocotp-y := sunplus-ocotp.o + obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o + nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o + nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o + nvmem_u-boot-env-y := u-boot-env.o +--- a/drivers/thermal/qcom/Kconfig ++++ b/drivers/thermal/qcom/Kconfig +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0-only + config QCOM_TSENS + tristate "Qualcomm TSENS Temperature Alarm" +- depends on QCOM_QFPROM ++ depends on NVMEM_QCOM_QFPROM + depends on ARCH_QCOM || COMPILE_TEST + help + This enables the thermal sysfs driver for the TSENS device. It shows diff --git a/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch b/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch new file mode 100644 index 00000000000..4e45524bffc --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0006-nvmem-sort-config-symbols-alphabetically.patch @@ -0,0 +1,535 @@ +From a06d9e5a63b7c2f622c908cd9600ce735e70f7c6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 16 Sep 2022 13:20:55 +0100 +Subject: [PATCH] nvmem: sort config symbols alphabetically +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +1. Match what most subsystems do +2. Simplify maintenance a bit +3. Reduce amount of conflicts for new drivers patches + +While at it unify indent level in Makefile. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 300 +++++++++++++++++++++-------------------- + drivers/nvmem/Makefile | 114 ++++++++-------- + 2 files changed, 208 insertions(+), 206 deletions(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -21,6 +21,40 @@ config NVMEM_SYSFS + This interface is mostly used by userspace applications to + read/write directly into nvmem. + ++# Devices ++ ++config NVMEM_APPLE_EFUSES ++ tristate "Apple eFuse support" ++ depends on ARCH_APPLE || COMPILE_TEST ++ default ARCH_APPLE ++ help ++ Say y here to enable support for reading eFuses on Apple SoCs ++ such as the M1. These are e.g. used to store factory programmed ++ calibration data required for the PCIe or the USB-C PHY. ++ ++ This driver can also be built as a module. If so, the module will ++ be called nvmem-apple-efuses. ++ ++config NVMEM_BCM_OCOTP ++ tristate "Broadcom On-Chip OTP Controller support" ++ depends on ARCH_BCM_IPROC || COMPILE_TEST ++ depends on HAS_IOMEM ++ default ARCH_BCM_IPROC ++ help ++ Say y here to enable read/write access to the Broadcom OTP ++ controller. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-bcm-ocotp. ++ ++config NVMEM_BRCM_NVRAM ++ tristate "Broadcom's NVRAM support" ++ depends on ARCH_BCM_5301X || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver provides support for Broadcom's NVRAM that can be accessed ++ using I/O mapping. ++ + config NVMEM_IMX_IIM + tristate "i.MX IC Identification Module support" + depends on ARCH_MXC || COMPILE_TEST +@@ -64,6 +98,19 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAYERSCAPE_SFP ++ tristate "Layerscape SFP (Security Fuse Processor) support" ++ depends on ARCH_LAYERSCAPE || COMPILE_TEST ++ depends on HAS_IOMEM ++ select REGMAP_MMIO ++ help ++ This driver provides support to read the eFuses on Freescale ++ Layerscape SoC's. For example, the vendor provides a per part ++ unique ID there. ++ ++ This driver can also be built as a module. If so, the module ++ will be called layerscape-sfp. ++ + config NVMEM_LPC18XX_EEPROM + tristate "NXP LPC18XX EEPROM Memory Support" + depends on ARCH_LPC18XX || COMPILE_TEST +@@ -84,17 +131,32 @@ config NVMEM_LPC18XX_OTP + To compile this driver as a module, choose M here: the module + will be called nvmem_lpc18xx_otp. + +-config NVMEM_MXS_OCOTP +- tristate "Freescale MXS On-Chip OTP Memory Support" +- depends on ARCH_MXS || COMPILE_TEST +- depends on HAS_IOMEM ++config NVMEM_MESON_EFUSE ++ tristate "Amlogic Meson GX eFuse Support" ++ depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM + help +- If you say Y here, you will get readonly access to the +- One Time Programmable memory pages that are stored +- on the Freescale i.MX23/i.MX28 processor. ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson GX SoCs. + + This driver can also be built as a module. If so, the module +- will be called nvmem-mxs-ocotp. ++ will be called nvmem_meson_efuse. ++ ++config NVMEM_MESON_MX_EFUSE ++ tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" ++ depends on ARCH_MESON || COMPILE_TEST ++ help ++ This is a driver to retrieve specific values from the eFuse found on ++ the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_meson_mx_efuse. ++ ++config NVMEM_MICROCHIP_OTPC ++ tristate "Microchip OTPC support" ++ depends on ARCH_AT91 || COMPILE_TEST ++ help ++ This driver enable the OTP controller available on Microchip SAMA7G5 ++ SoCs. It controlls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" +@@ -107,12 +169,17 @@ config NVMEM_MTK_EFUSE + This driver can also be built as a module. If so, the module + will be called efuse-mtk. + +-config NVMEM_MICROCHIP_OTPC +- tristate "Microchip OTPC support" +- depends on ARCH_AT91 || COMPILE_TEST ++config NVMEM_MXS_OCOTP ++ tristate "Freescale MXS On-Chip OTP Memory Support" ++ depends on ARCH_MXS || COMPILE_TEST ++ depends on HAS_IOMEM + help +- This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ If you say Y here, you will get readonly access to the ++ One Time Programmable memory pages that are stored ++ on the Freescale i.MX23/i.MX28 processor. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-mxs-ocotp. + + config NVMEM_NINTENDO_OTP + tristate "Nintendo Wii and Wii U OTP Support" +@@ -137,13 +204,21 @@ config NVMEM_QCOM_QFPROM + This driver can also be built as a module. If so, the module + will be called nvmem_qfprom. + +-config NVMEM_SPMI_SDAM +- tristate "SPMI SDAM Support" +- depends on SPMI ++config NVMEM_RAVE_SP_EEPROM ++ tristate "Rave SP EEPROM Support" ++ depends on RAVE_SP_CORE + help +- This driver supports the Shared Direct Access Memory Module on +- Qualcomm Technologies, Inc. PMICs. It provides the clients +- an interface to read/write to the SDAM module's shared memory. ++ Say y here to enable Rave SP EEPROM support. ++ ++config NVMEM_RMEM ++ tristate "Reserved Memory Based Driver Support" ++ depends on HAS_IOMEM ++ help ++ This driver maps reserved memory into an nvmem device. It might be ++ useful to expose information left by firmware in memory. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-rmem. + + config NVMEM_ROCKCHIP_EFUSE + tristate "Rockchip eFuse Support" +@@ -167,79 +242,16 @@ config NVMEM_ROCKCHIP_OTP + This driver can also be built as a module. If so, the module + will be called nvmem_rockchip_otp. + +-config NVMEM_BCM_OCOTP +- tristate "Broadcom On-Chip OTP Controller support" +- depends on ARCH_BCM_IPROC || COMPILE_TEST +- depends on HAS_IOMEM +- default ARCH_BCM_IPROC +- help +- Say y here to enable read/write access to the Broadcom OTP +- controller. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-bcm-ocotp. +- +-config NVMEM_STM32_ROMEM +- tristate "STMicroelectronics STM32 factory-programmed memory support" +- depends on ARCH_STM32 || COMPILE_TEST +- help +- Say y here to enable read-only access for STMicroelectronics STM32 +- factory-programmed memory area. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-stm32-romem. +- +-config NVMEM_SUNXI_SID +- tristate "Allwinner SoCs SID support" +- depends on ARCH_SUNXI +- help +- This is a driver for the 'security ID' available on various Allwinner +- devices. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_sunxi_sid. +- +-config NVMEM_UNIPHIER_EFUSE +- tristate "UniPhier SoCs eFuse support" +- depends on ARCH_UNIPHIER || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of UniPhier SoC +- from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-uniphier-efuse. +- +-config NVMEM_VF610_OCOTP +- tristate "VF610 SoC OCOTP support" +- depends on SOC_VF610 || COMPILE_TEST ++config NVMEM_SC27XX_EFUSE ++ tristate "Spreadtrum SC27XX eFuse Support" ++ depends on MFD_SC27XX_PMIC || COMPILE_TEST + depends on HAS_IOMEM + help +- This is a driver for the 'OCOTP' peripheral available on Vybrid +- devices like VF5xx and VF6xx. +- +- This driver can also be build as a module. If so, the module will +- be called nvmem-vf610-ocotp. +- +-config NVMEM_MESON_EFUSE +- tristate "Amlogic Meson GX eFuse Support" +- depends on (ARCH_MESON || COMPILE_TEST) && MESON_SM +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson GX SoCs. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem_meson_efuse. +- +-config NVMEM_MESON_MX_EFUSE +- tristate "Amlogic Meson6/Meson8/Meson8b eFuse Support" +- depends on ARCH_MESON || COMPILE_TEST +- help +- This is a driver to retrieve specific values from the eFuse found on +- the Amlogic Meson6, Meson8 and Meson8b SoCs. ++ This is a simple driver to dump specified values of Spreadtrum ++ SC27XX PMICs from eFuse. + + This driver can also be built as a module. If so, the module +- will be called nvmem_meson_mx_efuse. ++ will be called nvmem-sc27xx-efuse. + + config NVMEM_SNVS_LPGPR + tristate "Support for Low Power General Purpose Register" +@@ -251,32 +263,13 @@ config NVMEM_SNVS_LPGPR + This driver can also be built as a module. If so, the module + will be called nvmem-snvs-lpgpr. + +-config NVMEM_RAVE_SP_EEPROM +- tristate "Rave SP EEPROM Support" +- depends on RAVE_SP_CORE +- help +- Say y here to enable Rave SP EEPROM support. +- +-config NVMEM_SC27XX_EFUSE +- tristate "Spreadtrum SC27XX eFuse Support" +- depends on MFD_SC27XX_PMIC || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This is a simple driver to dump specified values of Spreadtrum +- SC27XX PMICs from eFuse. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-sc27xx-efuse. +- +-config NVMEM_ZYNQMP +- bool "Xilinx ZYNQMP SoC nvmem firmware support" +- depends on ARCH_ZYNQMP ++config NVMEM_SPMI_SDAM ++ tristate "SPMI SDAM Support" ++ depends on SPMI + help +- This is a driver to access hardware related data like +- soc revision, IDCODE... etc by using the firmware +- interface. +- +- If sure, say yes. If unsure, say no. ++ This driver supports the Shared Direct Access Memory Module on ++ Qualcomm Technologies, Inc. PMICs. It provides the clients ++ an interface to read/write to the SDAM module's shared memory. + + config NVMEM_SPRD_EFUSE + tristate "Spreadtrum SoC eFuse Support" +@@ -289,36 +282,15 @@ config NVMEM_SPRD_EFUSE + This driver can also be built as a module. If so, the module + will be called nvmem-sprd-efuse. + +-config NVMEM_RMEM +- tristate "Reserved Memory Based Driver Support" +- depends on HAS_IOMEM +- help +- This driver maps reserved memory into an nvmem device. It might be +- useful to expose information left by firmware in memory. +- +- This driver can also be built as a module. If so, the module +- will be called nvmem-rmem. +- +-config NVMEM_BRCM_NVRAM +- tristate "Broadcom's NVRAM support" +- depends on ARCH_BCM_5301X || COMPILE_TEST +- depends on HAS_IOMEM +- help +- This driver provides support for Broadcom's NVRAM that can be accessed +- using I/O mapping. +- +-config NVMEM_LAYERSCAPE_SFP +- tristate "Layerscape SFP (Security Fuse Processor) support" +- depends on ARCH_LAYERSCAPE || COMPILE_TEST +- depends on HAS_IOMEM +- select REGMAP_MMIO ++config NVMEM_STM32_ROMEM ++ tristate "STMicroelectronics STM32 factory-programmed memory support" ++ depends on ARCH_STM32 || COMPILE_TEST + help +- This driver provides support to read the eFuses on Freescale +- Layerscape SoC's. For example, the vendor provides a per part +- unique ID there. ++ Say y here to enable read-only access for STMicroelectronics STM32 ++ factory-programmed memory area. + + This driver can also be built as a module. If so, the module +- will be called layerscape-sfp. ++ will be called nvmem-stm32-romem. + + config NVMEM_SUNPLUS_OCOTP + tristate "Sunplus SoC OTP support" +@@ -332,17 +304,15 @@ config NVMEM_SUNPLUS_OCOTP + This driver can also be built as a module. If so, the module + will be called nvmem-sunplus-ocotp. + +-config NVMEM_APPLE_EFUSES +- tristate "Apple eFuse support" +- depends on ARCH_APPLE || COMPILE_TEST +- default ARCH_APPLE ++config NVMEM_SUNXI_SID ++ tristate "Allwinner SoCs SID support" ++ depends on ARCH_SUNXI + help +- Say y here to enable support for reading eFuses on Apple SoCs +- such as the M1. These are e.g. used to store factory programmed +- calibration data required for the PCIe or the USB-C PHY. ++ This is a driver for the 'security ID' available on various Allwinner ++ devices. + +- This driver can also be built as a module. If so, the module will +- be called nvmem-apple-efuses. ++ This driver can also be built as a module. If so, the module ++ will be called nvmem_sunxi_sid. + + config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" +@@ -357,4 +327,36 @@ config NVMEM_U_BOOT_ENV + + If compiled as module it will be called nvmem_u-boot-env. + ++config NVMEM_UNIPHIER_EFUSE ++ tristate "UniPhier SoCs eFuse support" ++ depends on ARCH_UNIPHIER || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a simple driver to dump specified values of UniPhier SoC ++ from eFuse. ++ ++ This driver can also be built as a module. If so, the module ++ will be called nvmem-uniphier-efuse. ++ ++config NVMEM_VF610_OCOTP ++ tristate "VF610 SoC OCOTP support" ++ depends on SOC_VF610 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This is a driver for the 'OCOTP' peripheral available on Vybrid ++ devices like VF5xx and VF6xx. ++ ++ This driver can also be build as a module. If so, the module will ++ be called nvmem-vf610-ocotp. ++ ++config NVMEM_ZYNQMP ++ bool "Xilinx ZYNQMP SoC nvmem firmware support" ++ depends on ARCH_ZYNQMP ++ help ++ This is a driver to access hardware related data like ++ soc revision, IDCODE... etc by using the firmware ++ interface. ++ ++ If sure, say yes. If unsure, say no. ++ + endif +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -7,67 +7,67 @@ obj-$(CONFIG_NVMEM) += nvmem_core.o + nvmem_core-y := core.o + + # Devices +-obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o +-nvmem-bcm-ocotp-y := bcm-ocotp.o +-obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o +-nvmem-imx-iim-y := imx-iim.o +-obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o +-nvmem-imx-ocotp-y := imx-ocotp.o ++obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o ++nvmem-apple-efuses-y := apple-efuses.o ++obj-$(CONFIG_NVMEM_BCM_OCOTP) += nvmem-bcm-ocotp.o ++nvmem-bcm-ocotp-y := bcm-ocotp.o ++obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o ++nvmem_brcm_nvram-y := brcm_nvram.o ++obj-$(CONFIG_NVMEM_IMX_IIM) += nvmem-imx-iim.o ++nvmem-imx-iim-y := imx-iim.o ++obj-$(CONFIG_NVMEM_IMX_OCOTP) += nvmem-imx-ocotp.o ++nvmem-imx-ocotp-y := imx-ocotp.o + obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvmem-imx-ocotp-scu.o +-nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o +-obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o +-nvmem_jz4780_efuse-y := jz4780-efuse.o ++nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o ++obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o ++nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o ++nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +-nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o +-obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o +-nvmem_lpc18xx_otp-y := lpc18xx_otp.o +-obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o +-nvmem-mxs-ocotp-y := mxs-ocotp.o +-obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o +-nvmem-nintendo-otp-y := nintendo-otp.o ++nvmem_lpc18xx_eeprom-y := lpc18xx_eeprom.o ++obj-$(CONFIG_NVMEM_LPC18XX_OTP) += nvmem_lpc18xx_otp.o ++nvmem_lpc18xx_otp-y := lpc18xx_otp.o ++obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o ++nvmem_meson_efuse-y := meson-efuse.o ++obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o ++nvmem_meson_mx_efuse-y := meson-mx-efuse.o ++obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o ++nvmem-microchip-otpc-y := microchip-otpc.o + obj-$(CONFIG_NVMEM_MTK_EFUSE) += nvmem_mtk-efuse.o +-nvmem_mtk-efuse-y := mtk-efuse.o +-obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o +-nvmem_qfprom-y := qfprom.o +-obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o +-nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++nvmem_mtk-efuse-y := mtk-efuse.o ++obj-$(CONFIG_NVMEM_MXS_OCOTP) += nvmem-mxs-ocotp.o ++nvmem-mxs-ocotp-y := mxs-ocotp.o ++obj-$(CONFIG_NVMEM_NINTENDO_OTP) += nvmem-nintendo-otp.o ++nvmem-nintendo-otp-y := nintendo-otp.o ++obj-$(CONFIG_NVMEM_QCOM_QFPROM) += nvmem_qfprom.o ++nvmem_qfprom-y := qfprom.o ++obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o ++nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o ++nvmem-rmem-y := rmem.o + obj-$(CONFIG_NVMEM_ROCKCHIP_EFUSE) += nvmem_rockchip_efuse.o +-nvmem_rockchip_efuse-y := rockchip-efuse.o ++nvmem_rockchip_efuse-y := rockchip-efuse.o + obj-$(CONFIG_NVMEM_ROCKCHIP_OTP) += nvmem-rockchip-otp.o +-nvmem-rockchip-otp-y := rockchip-otp.o +-obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o +-nvmem_stm32_romem-y := stm32-romem.o +-obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o +-nvmem_sunxi_sid-y := sunxi_sid.o +-obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o +-nvmem-uniphier-efuse-y := uniphier-efuse.o +-obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o +-nvmem-vf610-ocotp-y := vf610-ocotp.o +-obj-$(CONFIG_NVMEM_MESON_EFUSE) += nvmem_meson_efuse.o +-nvmem_meson_efuse-y := meson-efuse.o +-obj-$(CONFIG_NVMEM_MESON_MX_EFUSE) += nvmem_meson_mx_efuse.o +-nvmem_meson_mx_efuse-y := meson-mx-efuse.o +-obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o +-nvmem_snvs_lpgpr-y := snvs_lpgpr.o +-obj-$(CONFIG_NVMEM_RAVE_SP_EEPROM) += nvmem-rave-sp-eeprom.o +-nvmem-rave-sp-eeprom-y := rave-sp-eeprom.o ++nvmem-rockchip-otp-y := rockchip-otp.o + obj-$(CONFIG_NVMEM_SC27XX_EFUSE) += nvmem-sc27xx-efuse.o +-nvmem-sc27xx-efuse-y := sc27xx-efuse.o +-obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o +-nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o +-obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o +-nvmem_sprd_efuse-y := sprd-efuse.o +-obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o +-nvmem-rmem-y := rmem.o +-obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o +-nvmem_brcm_nvram-y := brcm_nvram.o +-obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o +-nvmem-layerscape-sfp-y := layerscape-sfp.o ++nvmem-sc27xx-efuse-y := sc27xx-efuse.o ++obj-$(CONFIG_NVMEM_SNVS_LPGPR) += nvmem_snvs_lpgpr.o ++nvmem_snvs_lpgpr-y := snvs_lpgpr.o ++obj-$(CONFIG_NVMEM_SPMI_SDAM) += nvmem_qcom-spmi-sdam.o ++nvmem_qcom-spmi-sdam-y += qcom-spmi-sdam.o ++obj-$(CONFIG_NVMEM_SPRD_EFUSE) += nvmem_sprd_efuse.o ++nvmem_sprd_efuse-y := sprd-efuse.o ++obj-$(CONFIG_NVMEM_STM32_ROMEM) += nvmem_stm32_romem.o ++nvmem_stm32_romem-y := stm32-romem.o + obj-$(CONFIG_NVMEM_SUNPLUS_OCOTP) += nvmem_sunplus_ocotp.o +-nvmem_sunplus_ocotp-y := sunplus-ocotp.o +-obj-$(CONFIG_NVMEM_APPLE_EFUSES) += nvmem-apple-efuses.o +-nvmem-apple-efuses-y := apple-efuses.o +-obj-$(CONFIG_NVMEM_MICROCHIP_OTPC) += nvmem-microchip-otpc.o +-nvmem-microchip-otpc-y := microchip-otpc.o +-obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +-nvmem_u-boot-env-y := u-boot-env.o ++nvmem_sunplus_ocotp-y := sunplus-ocotp.o ++obj-$(CONFIG_NVMEM_SUNXI_SID) += nvmem_sunxi_sid.o ++nvmem_sunxi_sid-y := sunxi_sid.o ++obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o ++nvmem_u-boot-env-y := u-boot-env.o ++obj-$(CONFIG_NVMEM_UNIPHIER_EFUSE) += nvmem-uniphier-efuse.o ++nvmem-uniphier-efuse-y := uniphier-efuse.o ++obj-$(CONFIG_NVMEM_VF610_OCOTP) += nvmem-vf610-ocotp.o ++nvmem-vf610-ocotp-y := vf610-ocotp.o ++obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o ++nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o diff --git a/target/linux/generic/backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch b/target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch similarity index 79% rename from target/linux/generic/backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch rename to target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch index 3a6b76a221e..e0a082adc45 100644 --- a/target/linux/generic/backport-5.10/823-v6.1-0002-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0007-nvmem-u-boot-env-find-Device-Tree-nodes-for-NVMEM-ce.patch @@ -1,6 +1,6 @@ -From d69efcf951df4dcc74a0e1554969c533aec8aa9b Mon Sep 17 00:00:00 2001 +From d4d432670f7dee0a5432fcffcfc8699b25181ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 15 Sep 2022 22:06:29 +0200 +Date: Fri, 16 Sep 2022 13:20:57 +0100 Subject: [PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -13,6 +13,8 @@ This allows NVMEM consumers to use U-Boot environment variables. Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch b/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch new file mode 100644 index 00000000000..945c6128ff4 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0008-nvmem-lan9662-otp-add-support.patch @@ -0,0 +1,274 @@ +From 9e8f208ad5229ddda97cd4a83ecf89c735d99592 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 16 Sep 2022 13:20:59 +0100 +Subject: [PATCH] nvmem: lan9662-otp: add support + +Add support for OTP controller available on LAN9662. The OTPC controls +the access to a non-volatile memory. The size of the memory is 8KB. +The OTPC can access the memory based on an offset. +Implement both the read and the write functionality. + +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-13-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 8 ++ + drivers/nvmem/Makefile | 2 + + drivers/nvmem/lan9662-otpc.c | 222 +++++++++++++++++++++++++++++++++++ + 3 files changed, 232 insertions(+) + create mode 100644 drivers/nvmem/lan9662-otpc.c + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -98,6 +98,14 @@ config NVMEM_JZ4780_EFUSE + To compile this driver as a module, choose M here: the module + will be called nvmem_jz4780_efuse. + ++config NVMEM_LAN9662_OTPC ++ tristate "Microchip LAN9662 OTP controller support" ++ depends on SOC_LAN966 || COMPILE_TEST ++ depends on HAS_IOMEM ++ help ++ This driver enables the OTP controller available on Microchip LAN9662 ++ SoCs. It controls the access to the OTP memory connected to it. ++ + config NVMEM_LAYERSCAPE_SFP + tristate "Layerscape SFP (Security Fuse Processor) support" + depends on ARCH_LAYERSCAPE || COMPILE_TEST +--- a/drivers/nvmem/Makefile ++++ b/drivers/nvmem/Makefile +@@ -21,6 +21,8 @@ obj-$(CONFIG_NVMEM_IMX_OCOTP_SCU) += nvm + nvmem-imx-ocotp-scu-y := imx-ocotp-scu.o + obj-$(CONFIG_NVMEM_JZ4780_EFUSE) += nvmem_jz4780_efuse.o + nvmem_jz4780_efuse-y := jz4780-efuse.o ++obj-$(CONFIG_NVMEM_LAN9662_OTPC) += nvmem-lan9662-otpc.o ++nvmem-lan9662-otpc-y := lan9662-otpc.o + obj-$(CONFIG_NVMEM_LAYERSCAPE_SFP) += nvmem-layerscape-sfp.o + nvmem-layerscape-sfp-y := layerscape-sfp.o + obj-$(CONFIG_NVMEM_LPC18XX_EEPROM) += nvmem_lpc18xx_eeprom.o +--- /dev/null ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -0,0 +1,222 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define OTP_OTP_PWR_DN(t) (t + 0x00) ++#define OTP_OTP_PWR_DN_OTP_PWRDN_N BIT(0) ++#define OTP_OTP_ADDR_HI(t) (t + 0x04) ++#define OTP_OTP_ADDR_LO(t) (t + 0x08) ++#define OTP_OTP_PRGM_DATA(t) (t + 0x10) ++#define OTP_OTP_PRGM_MODE(t) (t + 0x14) ++#define OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE BIT(0) ++#define OTP_OTP_RD_DATA(t) (t + 0x18) ++#define OTP_OTP_FUNC_CMD(t) (t + 0x20) ++#define OTP_OTP_FUNC_CMD_OTP_PROGRAM BIT(1) ++#define OTP_OTP_FUNC_CMD_OTP_READ BIT(0) ++#define OTP_OTP_CMD_GO(t) (t + 0x28) ++#define OTP_OTP_CMD_GO_OTP_GO BIT(0) ++#define OTP_OTP_PASS_FAIL(t) (t + 0x2c) ++#define OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED BIT(3) ++#define OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED BIT(2) ++#define OTP_OTP_PASS_FAIL_OTP_FAIL BIT(0) ++#define OTP_OTP_STATUS(t) (t + 0x30) ++#define OTP_OTP_STATUS_OTP_CPUMPEN BIT(1) ++#define OTP_OTP_STATUS_OTP_BUSY BIT(0) ++ ++#define OTP_MEM_SIZE 8192 ++#define OTP_SLEEP_US 10 ++#define OTP_TIMEOUT_US 500000 ++ ++struct lan9662_otp { ++ struct device *dev; ++ void __iomem *base; ++}; ++ ++static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++{ ++ u32 val; ++ ++ return readl_poll_timeout(reg, val, !(val & flag), ++ OTP_SLEEP_US, OTP_TIMEOUT_US); ++} ++ ++static int lan9662_otp_power(struct lan9662_otp *otp, bool up) ++{ ++ void __iomem *pwrdn = OTP_OTP_PWR_DN(otp->base); ++ ++ if (up) { ++ writel(readl(pwrdn) & ~OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_CPUMPEN)) ++ return -ETIMEDOUT; ++ } else { ++ writel(readl(pwrdn) | OTP_OTP_PWR_DN_OTP_PWRDN_N, pwrdn); ++ } ++ ++ return 0; ++} ++ ++static int lan9662_otp_execute(struct lan9662_otp *otp) ++{ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_CMD_GO(otp->base), ++ OTP_OTP_CMD_GO_OTP_GO)) ++ return -ETIMEDOUT; ++ ++ if (lan9662_otp_wait_flag_clear(OTP_OTP_STATUS(otp->base), ++ OTP_OTP_STATUS_OTP_BUSY)) ++ return -ETIMEDOUT; ++ ++ return 0; ++} ++ ++static void lan9662_otp_set_address(struct lan9662_otp *otp, u32 offset) ++{ ++ writel(0xff & (offset >> 8), OTP_OTP_ADDR_HI(otp->base)); ++ writel(0xff & offset, OTP_OTP_ADDR_LO(otp->base)); ++} ++ ++static int lan9662_otp_read_byte(struct lan9662_otp *otp, u32 offset, u8 *dst) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_FUNC_CMD_OTP_READ, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_READ_PROHIBITED) ++ return -EACCES; ++ *dst = (u8) readl(OTP_OTP_RD_DATA(otp->base)); ++ } ++ return rc; ++} ++ ++static int lan9662_otp_write_byte(struct lan9662_otp *otp, u32 offset, u8 data) ++{ ++ u32 pass; ++ int rc; ++ ++ lan9662_otp_set_address(otp, offset); ++ writel(OTP_OTP_PRGM_MODE_OTP_PGM_MODE_BYTE, OTP_OTP_PRGM_MODE(otp->base)); ++ writel(data, OTP_OTP_PRGM_DATA(otp->base)); ++ writel(OTP_OTP_FUNC_CMD_OTP_PROGRAM, OTP_OTP_FUNC_CMD(otp->base)); ++ writel(OTP_OTP_CMD_GO_OTP_GO, OTP_OTP_CMD_GO(otp->base)); ++ ++ rc = lan9662_otp_execute(otp); ++ if (!rc) { ++ pass = readl(OTP_OTP_PASS_FAIL(otp->base)); ++ if (pass & OTP_OTP_PASS_FAIL_OTP_WRITE_PROHIBITED) ++ return -EACCES; ++ if (pass & OTP_OTP_PASS_FAIL_OTP_FAIL) ++ return -EIO; ++ } ++ return rc; ++} ++ ++static int lan9662_otp_read(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ uint8_t data; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ *val++ = data; ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static int lan9662_otp_write(void *context, unsigned int offset, ++ void *_val, size_t bytes) ++{ ++ struct lan9662_otp *otp = context; ++ u8 *val = _val; ++ u8 data, newdata; ++ int i, rc = 0; ++ ++ lan9662_otp_power(otp, true); ++ for (i = 0; i < bytes; i++) { ++ /* Skip zero bytes */ ++ if (val[i]) { ++ rc = lan9662_otp_read_byte(otp, offset + i, &data); ++ if (rc < 0) ++ break; ++ ++ newdata = data | val[i]; ++ if (newdata == data) ++ continue; ++ ++ rc = lan9662_otp_write_byte(otp, offset + i, ++ newdata); ++ if (rc < 0) ++ break; ++ } ++ } ++ lan9662_otp_power(otp, false); ++ ++ return rc; ++} ++ ++static struct nvmem_config otp_config = { ++ .name = "lan9662-otp", ++ .stride = 1, ++ .word_size = 1, ++ .reg_read = lan9662_otp_read, ++ .reg_write = lan9662_otp_write, ++ .size = OTP_MEM_SIZE, ++}; ++ ++static int lan9662_otp_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct nvmem_device *nvmem; ++ struct lan9662_otp *otp; ++ ++ otp = devm_kzalloc(&pdev->dev, sizeof(*otp), GFP_KERNEL); ++ if (!otp) ++ return -ENOMEM; ++ ++ otp->dev = dev; ++ otp->base = devm_platform_ioremap_resource(pdev, 0); ++ if (IS_ERR(otp->base)) ++ return PTR_ERR(otp->base); ++ ++ otp_config.priv = otp; ++ otp_config.dev = dev; ++ ++ nvmem = devm_nvmem_register(dev, &otp_config); ++ ++ return PTR_ERR_OR_ZERO(nvmem); ++} ++ ++static const struct of_device_id lan9662_otp_match[] = { ++ { .compatible = "microchip,lan9662-otp", }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, lan9662_otp_match); ++ ++static struct platform_driver lan9662_otp_driver = { ++ .probe = lan9662_otp_probe, ++ .driver = { ++ .name = "lan9662-otp", ++ .of_match_table = lan9662_otp_match, ++ }, ++}; ++module_platform_driver(lan9662_otp_driver); ++ ++MODULE_AUTHOR("Horatiu Vultur "); ++MODULE_DESCRIPTION("lan9662 OTP driver"); ++MODULE_LICENSE("GPL"); diff --git a/target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch b/target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch similarity index 74% rename from target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch rename to target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch index 6b405571160..633a668a962 100644 --- a/target/linux/generic/backport-5.15/802-v6.1-0003-nvmem-u-boot-env-fix-crc32-casting-type.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0009-nvmem-u-boot-env-fix-crc32-casting-type.patch @@ -1,6 +1,6 @@ -From 60bbaad38109684b156e21112322e0a922f92cde Mon Sep 17 00:00:00 2001 +From 3717ca3e0cc8683f93b41d3f06ca79631eb58715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Thu, 18 Aug 2022 06:38:37 +0200 +Date: Fri, 16 Sep 2022 13:21:00 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32 casting type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -9,10 +9,12 @@ Content-Transfer-Encoding: 8bit This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 +Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Reported-by: kernel test robot -Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20220916122100.170016-14-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch b/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch new file mode 100644 index 00000000000..b663a1328df --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0010-nvmem-lan9662-otp-Fix-compatible-string.patch @@ -0,0 +1,34 @@ +From 1aeb122d214b92474c86fde00a03d6e2d69381b5 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Wed, 28 Sep 2022 21:51:12 +0200 +Subject: [PATCH] nvmem: lan9662-otp: Fix compatible string + +The device tree bindings for lan9662-otp expects the compatible string +to be one of following compatible strings: +microchip,lan9662-otpc +microchip,lan9668-otpc + +The problem is that the lan9662-otp driver contains the +microchip,lan9662-otp compatible string instead of +microchip,lan9662-otpc. +Fix this by updating the compatible string in the driver. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Signed-off-by: Horatiu Vultur +Link: https://lore.kernel.org/r/20220928195112.630351-1-horatiu.vultur@microchip.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -203,7 +203,7 @@ static int lan9662_otp_probe(struct plat + } + + static const struct of_device_id lan9662_otp_match[] = { +- { .compatible = "microchip,lan9662-otp", }, ++ { .compatible = "microchip,lan9662-otpc", }, + { }, + }; + MODULE_DEVICE_TABLE(of, lan9662_otp_match); diff --git a/target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch b/target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch similarity index 89% rename from target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch rename to target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch index 69d5a1b8459..967e891dbd9 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0001-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch +++ b/target/linux/generic/backport-5.15/807-v6.1-0011-nvmem-u-boot-env-fix-crc32_data_offset-on-redundant-.patch @@ -1,4 +1,4 @@ -From 7a69ff9c9bde03a690ea783970f664782fc303d8 Mon Sep 17 00:00:00 2001 +From ee424f7d3960152f5f862bbb6943e59828dc7917 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 4 Nov 2022 17:52:03 +0100 Subject: [PATCH] nvmem: u-boot-env: fix crc32_data_offset on redundant @@ -37,8 +37,11 @@ crc32 sum... which is unfortunate :( | [0] https://github.com/sbabic/libubootenv/blob/master/src/uboot_env.c#L951 + Fixes: d5542923f200 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Christian Lamparter +Link: https://lore.kernel.org/r/70a16eae113e08db2390b76e174f4837caa135c3.1667580636.git.chunkeey@gmail.com +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch b/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch new file mode 100644 index 00000000000..0c842f07932 --- /dev/null +++ b/target/linux/generic/backport-5.15/807-v6.1-0013-nvmem-lan9662-otp-Change-return-type-of-lan9662_otp_.patch @@ -0,0 +1,35 @@ +From 022b68f271de0e53024e6d5e96fee8e76d25eb95 Mon Sep 17 00:00:00 2001 +From: Horatiu Vultur +Date: Fri, 18 Nov 2022 06:38:40 +0000 +Subject: [PATCH] nvmem: lan9662-otp: Change return type of + lan9662_otp_wait_flag_clear() + +The blamed commit introduced the following smatch warning in the +function lan9662_otp_wait_flag_clear: +drivers/nvmem/lan9662-otpc.c:43 lan9662_otp_wait_flag_clear() warn: signedness bug returning '(-110)' + +Fix this by changing the return type of the function +lan9662_otp_wait_flag_clear() to be int instead of bool. + +Fixes: 9e8f208ad5229d ("nvmem: lan9662-otp: add support") +Reported-by: kernel test robot +Reported-by: Dan Carpenter +Signed-off-by: Horatiu Vultur +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063840.6357-5-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/lan9662-otpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/lan9662-otpc.c ++++ b/drivers/nvmem/lan9662-otpc.c +@@ -36,7 +36,7 @@ struct lan9662_otp { + void __iomem *base; + }; + +-static bool lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) ++static int lan9662_otp_wait_flag_clear(void __iomem *reg, u32 flag) + { + u32 val; + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch b/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch new file mode 100644 index 00000000000..33759632ebe --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0001-nvmem-stm32-move-STM32MP15_BSEC_NUM_LOWER-in-config.patch @@ -0,0 +1,82 @@ +From fbfc4ca465a1f8d81bf2d67d95bf7fc67c3cf0c2 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:20 +0000 +Subject: [PATCH] nvmem: stm32: move STM32MP15_BSEC_NUM_LOWER in config + +Support STM32MP15_BSEC_NUM_LOWER in stm32 romem config to prepare +the next SoC in STM32MP family. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-2-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -22,16 +22,15 @@ + /* shadow registers offest */ + #define STM32MP15_BSEC_DATA0 0x200 + +-/* 32 (x 32-bits) lower shadow registers */ +-#define STM32MP15_BSEC_NUM_LOWER 32 +- + struct stm32_romem_cfg { + int size; ++ u8 lower; + }; + + struct stm32_romem_priv { + void __iomem *base; + struct nvmem_config cfg; ++ u8 lower; + }; + + static int stm32_romem_read(void *context, unsigned int offset, void *buf, +@@ -85,7 +84,7 @@ static int stm32_bsec_read(void *context + for (i = roffset; (i < roffset + rbytes); i += 4) { + u32 otp = i >> 2; + +- if (otp < STM32MP15_BSEC_NUM_LOWER) { ++ if (otp < priv->lower) { + /* read lower data from shadow registers */ + val = readl_relaxed( + priv->base + STM32MP15_BSEC_DATA0 + i); +@@ -159,6 +158,8 @@ static int stm32_romem_probe(struct plat + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; + ++ priv->lower = 0; ++ + cfg = (const struct stm32_romem_cfg *) + of_match_device(dev->driver->of_match_table, dev)->data; + if (!cfg) { +@@ -167,6 +168,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.reg_read = stm32_romem_read; + } else { + priv->cfg.size = cfg->size; ++ priv->lower = cfg->lower; + priv->cfg.reg_read = stm32_bsec_read; + priv->cfg.reg_write = stm32_bsec_write; + } +@@ -174,8 +176,17 @@ static int stm32_romem_probe(struct plat + return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &priv->cfg)); + } + ++/* ++ * STM32MP15 BSEC OTP regions: 4096 OTP bits (with 3072 effective bits) ++ * => 96 x 32-bits data words ++ * - Lower: 1K bits, 2:1 redundancy, incremental bit programming ++ * => 32 (x 32-bits) lower shadow registers = words 0 to 31 ++ * - Upper: 2K bits, ECC protection, word programming only ++ * => 64 (x 32-bits) = words 32 to 95 ++ */ + static const struct stm32_romem_cfg stm32mp15_bsec_cfg = { +- .size = 384, /* 96 x 32-bits data words */ ++ .size = 384, ++ .lower = 32, + }; + + static const struct of_device_id stm32_romem_of_match[] = { diff --git a/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch b/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch new file mode 100644 index 00000000000..5791df2606f --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0002-nvmem-stm32-add-warning-when-upper-OTPs-are-updated.patch @@ -0,0 +1,34 @@ +From d61784e6410f3df2028e6eb91b06ffed37a660e0 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:21 +0000 +Subject: [PATCH] nvmem: stm32: add warning when upper OTPs are updated + +As the upper OTPs are ECC protected, they support only one 32 bits word +programming. +For a second modification of this word, these ECC become invalid and +this OTP will be no more accessible, the shadowed value is invalid. + +This patch adds a warning to indicate an upper OTP update, because this +operation is dangerous as OTP is not locked by the driver after the first +update to avoid a second update. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-3-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -132,6 +132,9 @@ static int stm32_bsec_write(void *contex + } + } + ++ if (offset + bytes >= priv->lower * 4) ++ dev_warn(dev, "Update of upper OTPs with ECC protection (word programming, only once)\n"); ++ + return 0; + } + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch b/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch new file mode 100644 index 00000000000..b83ad69c6b4 --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0003-nvmem-stm32-add-nvmem-type-attribute.patch @@ -0,0 +1,26 @@ +From a3816a7d7c097c1da46aad5f5d1e229b607dce04 Mon Sep 17 00:00:00 2001 +From: Patrick Delaunay +Date: Fri, 18 Nov 2022 06:39:22 +0000 +Subject: [PATCH] nvmem: stm32: add nvmem type attribute + +Inform NVMEM framework of type attribute for stm32-romem as NVMEM_TYPE_OTP +so userspace is able to know how the data is stored in BSEC. + +Signed-off-by: Patrick Delaunay +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-4-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -160,6 +160,7 @@ static int stm32_romem_probe(struct plat + priv->cfg.dev = dev; + priv->cfg.priv = priv; + priv->cfg.owner = THIS_MODULE; ++ priv->cfg.type = NVMEM_TYPE_OTP; + + priv->lower = 0; + diff --git a/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch b/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch new file mode 100644 index 00000000000..52ba1e65b56 --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0004-nvmem-stm32-fix-spelling-typo-in-comment.patch @@ -0,0 +1,27 @@ +From 06aac0e11960a7ddccc1888326b5906d017e0f24 Mon Sep 17 00:00:00 2001 +From: Jiangshan Yi +Date: Fri, 18 Nov 2022 06:39:24 +0000 +Subject: [PATCH] nvmem: stm32: fix spelling typo in comment + +Fix spelling typo in comment. + +Reported-by: k2ci +Signed-off-by: Jiangshan Yi +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-6-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/stm32-romem.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/stm32-romem.c ++++ b/drivers/nvmem/stm32-romem.c +@@ -19,7 +19,7 @@ + #define STM32_SMC_WRITE_SHADOW 0x03 + #define STM32_SMC_READ_OTP 0x04 + +-/* shadow registers offest */ ++/* shadow registers offset */ + #define STM32MP15_BSEC_DATA0 0x200 + + struct stm32_romem_cfg { diff --git a/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch b/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch new file mode 100644 index 00000000000..8f024f4c1ac --- /dev/null +++ b/target/linux/generic/backport-5.15/808-v6.2-0005-nvmem-Kconfig-Fix-spelling-mistake-controlls-control.patch @@ -0,0 +1,27 @@ +From fb817c4ef63e8cfb6e77ae4a2875ae854c80708f Mon Sep 17 00:00:00 2001 +From: Colin Ian King +Date: Fri, 18 Nov 2022 06:39:26 +0000 +Subject: [PATCH] nvmem: Kconfig: Fix spelling mistake "controlls" -> + "controls" + +There is a spelling mistake in a Kconfig description. Fix it. + +Signed-off-by: Colin Ian King +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-8-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/nvmem/Kconfig ++++ b/drivers/nvmem/Kconfig +@@ -164,7 +164,7 @@ config NVMEM_MICROCHIP_OTPC + depends on ARCH_AT91 || COMPILE_TEST + help + This driver enable the OTP controller available on Microchip SAMA7G5 +- SoCs. It controlls the access to the OTP memory connected to it. ++ SoCs. It controls the access to the OTP memory connected to it. + + config NVMEM_MTK_EFUSE + tristate "Mediatek SoCs EFUSE support" diff --git a/target/linux/generic/backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch b/target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch similarity index 90% rename from target/linux/generic/backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch rename to target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch index 429b24f0f3a..861386ad310 100644 --- a/target/linux/generic/backport-5.10/825-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch +++ b/target/linux/generic/backport-5.15/808-v6.2-0006-nvmem-u-boot-env-add-Broadcom-format-support.patch @@ -1,6 +1,6 @@ -From 5b4eaafbeac472fc19049152f18e88aecb2b2829 Mon Sep 17 00:00:00 2001 +From ada84d07af6097b2addd18262668ce6cb9e15206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Mon, 17 Oct 2022 09:17:22 +0200 +Date: Fri, 18 Nov 2022 06:39:27 +0000 Subject: [PATCH] nvmem: u-boot-env: add Broadcom format support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -15,6 +15,8 @@ Add support for Broadcom's specific binding and their custom format. Ref: 6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding") Signed-off-by: Rafał Miłecki Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20221118063932.6418-9-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/u-boot-env.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch b/target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch similarity index 96% rename from target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch rename to target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch index 7d6723bb8e9..4010232300c 100644 --- a/target/linux/generic/backport-5.15/804-v6.2-0002-nvmem-u-boot-env-align-endianness-of-crc32-values.patch +++ b/target/linux/generic/backport-5.15/809-nvmem-u-boot-env-align-endianness-of-crc32-values.patch @@ -36,7 +36,7 @@ Signed-off-by: Srinivas Kandagatla --- a/drivers/nvmem/u-boot-env.c +++ b/drivers/nvmem/u-boot-env.c -@@ -143,7 +143,7 @@ static int u_boot_env_parse(struct u_boo +@@ -156,7 +156,7 @@ static int u_boot_env_parse(struct u_boo crc32_data_len = priv->mtd->size - crc32_data_offset; data_len = priv->mtd->size - data_offset; diff --git a/target/linux/layerscape/armv8_64b/config-5.10 b/target/linux/layerscape/armv8_64b/config-5.10 index 36ca870618e..4b8a819edff 100644 --- a/target/linux/layerscape/armv8_64b/config-5.10 +++ b/target/linux/layerscape/armv8_64b/config-5.10 @@ -541,6 +541,7 @@ CONFIG_NUMA=y CONFIG_NUMA_BALANCING=y CONFIG_NUMA_BALANCING_DEFAULT_ENABLED=y CONFIG_NVMEM=y +# CONFIG_NVMEM_LAYERSCAPE_SFP is not set # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y From 69ea58088245d38926edee13d39e8aa8b637ef1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 7 Jan 2023 01:28:19 +0100 Subject: [PATCH 31/49] treewide: update NVMEM symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 8dfe69cdfc5c ("kernel: update nvmem subsystem to the latest upstream") Signed-off-by: Rafał Miłecki --- target/linux/ipq40xx/config-5.15 | 2 +- target/linux/ipq806x/config-5.10 | 2 +- target/linux/ipq806x/config-5.15 | 2 +- target/linux/mediatek/filogic/config-5.15 | 2 +- target/linux/mediatek/mt7622/config-5.15 | 2 +- target/linux/mediatek/mt7623/config-5.15 | 2 +- target/linux/mediatek/mt7629/config-5.15 | 2 +- target/linux/rockchip/armv8/config-5.10 | 4 ++-- target/linux/rockchip/armv8/config-5.15 | 4 ++-- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/target/linux/ipq40xx/config-5.15 b/target/linux/ipq40xx/config-5.15 index 22b2d03d806..32260fa08c9 100644 --- a/target/linux/ipq40xx/config-5.15 +++ b/target/linux/ipq40xx/config-5.15 @@ -309,6 +309,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y @@ -398,7 +399,6 @@ CONFIG_QCOM_IPQ4019_ESS_EDMA=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set # CONFIG_QCOM_RPMH is not set CONFIG_QCOM_SCM=y diff --git a/target/linux/ipq806x/config-5.10 b/target/linux/ipq806x/config-5.10 index f4d7ba75607..826dd734551 100644 --- a/target/linux/ipq806x/config-5.10 +++ b/target/linux/ipq806x/config-5.10 @@ -288,6 +288,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -378,7 +379,6 @@ CONFIG_QCOM_HFPLL=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set CONFIG_QCOM_RPMCC=y # CONFIG_QCOM_RPMH is not set diff --git a/target/linux/ipq806x/config-5.15 b/target/linux/ipq806x/config-5.15 index 7ea97ff89ec..72017e7528f 100644 --- a/target/linux/ipq806x/config-5.15 +++ b/target/linux/ipq806x/config-5.15 @@ -298,6 +298,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_QCOM_QFPROM=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_OF=y CONFIG_OF_ADDRESS=y @@ -389,7 +390,6 @@ CONFIG_QCOM_HFPLL=y # CONFIG_QCOM_LLCC is not set # CONFIG_QCOM_OCMEM is not set # CONFIG_QCOM_PDC is not set -CONFIG_QCOM_QFPROM=y # CONFIG_QCOM_RMTFS_MEM is not set CONFIG_QCOM_RPMCC=y # CONFIG_QCOM_RPMH is not set diff --git a/target/linux/mediatek/filogic/config-5.15 b/target/linux/mediatek/filogic/config-5.15 index ad3111a6e33..6a989310df9 100644 --- a/target/linux/mediatek/filogic/config-5.15 +++ b/target/linux/mediatek/filogic/config-5.15 @@ -233,7 +233,6 @@ CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set # CONFIG_MTK_CQDMA is not set -CONFIG_MTK_EFUSE=y CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_PMIC_WRAP=y @@ -260,6 +259,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/mediatek/mt7622/config-5.15 b/target/linux/mediatek/mt7622/config-5.15 index f17876fb055..3f99221c212 100644 --- a/target/linux/mediatek/mt7622/config-5.15 +++ b/target/linux/mediatek/mt7622/config-5.15 @@ -262,7 +262,6 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set # CONFIG_MTK_CQDMA is not set -CONFIG_MTK_EFUSE=y CONFIG_MTK_HSDMA=y CONFIG_MTK_INFRACFG=y CONFIG_MTK_PMIC_WRAP=y @@ -289,6 +288,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/mediatek/mt7623/config-5.15 b/target/linux/mediatek/mt7623/config-5.15 index 898e721df44..984e85aba0b 100644 --- a/target/linux/mediatek/mt7623/config-5.15 +++ b/target/linux/mediatek/mt7623/config-5.15 @@ -350,7 +350,6 @@ CONFIG_MTD_UBI_WL_THRESHOLD=4096 CONFIG_MTK_CMDQ=y CONFIG_MTK_CMDQ_MBOX=y CONFIG_MTK_CQDMA=y -CONFIG_MTK_EFUSE=y # CONFIG_MTK_HSDMA is not set CONFIG_MTK_INFRACFG=y CONFIG_MTK_IOMMU=y @@ -386,6 +385,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=4 CONFIG_NVMEM=y +CONFIG_NVMEM_MTK_EFUSE=y # CONFIG_NVMEM_SPMI_SDAM is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y diff --git a/target/linux/mediatek/mt7629/config-5.15 b/target/linux/mediatek/mt7629/config-5.15 index 39596717ae2..fc53bec882e 100644 --- a/target/linux/mediatek/mt7629/config-5.15 +++ b/target/linux/mediatek/mt7629/config-5.15 @@ -187,7 +187,6 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 # CONFIG_MTK_CMDQ is not set -# CONFIG_MTK_EFUSE is not set CONFIG_MTK_INFRACFG=y # CONFIG_MTK_PMIC_WRAP is not set CONFIG_MTK_SCPSYS=y @@ -212,6 +211,7 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=2 CONFIG_NVMEM=y +# CONFIG_NVMEM_MTK_EFUSE is not set CONFIG_NVMEM_SYSFS=y CONFIG_OF=y CONFIG_OF_ADDRESS=y diff --git a/target/linux/rockchip/armv8/config-5.10 b/target/linux/rockchip/armv8/config-5.10 index 25e32145d37..1488da23a8b 100644 --- a/target/linux/rockchip/armv8/config-5.10 +++ b/target/linux/rockchip/armv8/config-5.10 @@ -377,6 +377,8 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=256 CONFIG_NVMEM=y +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set CONFIG_NVMEM_SYSFS=y CONFIG_NVME_CORE=y # CONFIG_NVME_HWMON is not set @@ -492,12 +494,10 @@ CONFIG_REGULATOR_RK808=y CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y CONFIG_ROCKCHIP_MBOX=y -# CONFIG_ROCKCHIP_OTP is not set CONFIG_ROCKCHIP_PHY=y CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_SARADC is not set diff --git a/target/linux/rockchip/armv8/config-5.15 b/target/linux/rockchip/armv8/config-5.15 index 39802ee728f..5f94e0c9f22 100644 --- a/target/linux/rockchip/armv8/config-5.15 +++ b/target/linux/rockchip/armv8/config-5.15 @@ -377,6 +377,8 @@ CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_IDLE=y CONFIG_NR_CPUS=256 CONFIG_NVMEM=y +CONFIG_NVMEM_ROCKCHIP_EFUSE=y +# CONFIG_NVMEM_ROCKCHIP_OTP is not set CONFIG_NVMEM_SYSFS=y CONFIG_NVME_CORE=y # CONFIG_NVME_HWMON is not set @@ -493,12 +495,10 @@ CONFIG_REGULATOR_RK808=y CONFIG_RELOCATABLE=y CONFIG_RESET_CONTROLLER=y CONFIG_RFS_ACCEL=y -CONFIG_ROCKCHIP_EFUSE=y CONFIG_ROCKCHIP_GRF=y CONFIG_ROCKCHIP_IODOMAIN=y CONFIG_ROCKCHIP_IOMMU=y CONFIG_ROCKCHIP_MBOX=y -# CONFIG_ROCKCHIP_OTP is not set CONFIG_ROCKCHIP_PHY=y CONFIG_ROCKCHIP_PM_DOMAINS=y # CONFIG_ROCKCHIP_SARADC is not set From eded295cd7fd53bfa5afcb67a1b91cfda0523ba6 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Tue, 15 Nov 2022 15:25:40 +0100 Subject: [PATCH 32/49] ath79: combine OCEDO dual firmware-partitions In order to maximize the available space on OCEDO boards using a dual-image partition layout, combine the two OS partitions into a single partition. This allows users to access more usable space for additional packages. Don't limit the usable image size to the size of a single OS partition. The initial installation has to be done with an older version of OpenWrt in case the generated image exceeds the space of a single OS partition in the future. Signed-off-by: David Bauer --- target/linux/ath79/dts/ar9344_ocedo_raccoon.dts | 9 ++------- target/linux/ath79/dts/qca9558_ocedo_koala.dts | 9 ++------- target/linux/ath79/dts/qca9558_ocedo_ursus.dts | 9 ++------- target/linux/ath79/image/generic.mk | 6 +++--- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts index 8678315a44a..11205413f4c 100644 --- a/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts +++ b/target/linux/ath79/dts/ar9344_ocedo_raccoon.dts @@ -91,15 +91,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/dts/qca9558_ocedo_koala.dts b/target/linux/ath79/dts/qca9558_ocedo_koala.dts index 8441e5c9a3c..85fd43699ee 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_koala.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_koala.dts @@ -84,15 +84,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts index e99059df047..be958d19a08 100644 --- a/target/linux/ath79/dts/qca9558_ocedo_ursus.dts +++ b/target/linux/ath79/dts/qca9558_ocedo_ursus.dts @@ -55,15 +55,10 @@ }; partition@50000 { + /* Dual-Flash layout combined */ compatible = "denx,uimage"; label = "firmware"; - reg = <0x050000 0x740000>; - }; - - partition@790000 { - label = "vendor"; - reg = <0x790000 0x740000>; - read-only; + reg = <0x050000 0xe80000>; }; partition@ed0000 { diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 59bc449f125..ec7cbb950ae 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1907,7 +1907,7 @@ define Device/ocedo_koala DEVICE_MODEL := Koala DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct SUPPORTED_DEVICES += koala - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_koala @@ -1915,7 +1915,7 @@ define Device/ocedo_raccoon SOC := ar9344 DEVICE_VENDOR := Ocedo DEVICE_MODEL := Raccoon - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_raccoon @@ -1924,7 +1924,7 @@ define Device/ocedo_ursus DEVICE_VENDOR := Ocedo DEVICE_MODEL := Ursus DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct - IMAGE_SIZE := 7424k + IMAGE_SIZE := 14848k endef TARGET_DEVICES += ocedo_ursus From 8036fb8dd01d86a1822efd7bdfac3352d97a7657 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 17 Nov 2022 23:02:13 +0100 Subject: [PATCH 33/49] ramips: combine USW-Flex dual firmware-partitions In order to maximize the available space on USW-Flex boards using a dual-image partition layout, combine the two OS partitions into a single partition. This allows users to access more usable space for additional packages. Don't limit the usable image size to the size of a single OS partition. The initial installation has to be done with an older version of OpenWrt in case the generated image exceeds the space of a single kernel partition in the future. Signed-off-by: David Bauer --- target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts | 8 ++------ target/linux/ramips/image/mt7621.mk | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts index e148242387f..ff328bd858b 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_usw-flex.dts @@ -164,14 +164,10 @@ }; partition@1a0000 { + /* Combine kernel0 / kernel1 */ compatible = "denx,fit"; label = "firmware"; - reg = <0x1a0000 0x730000>; - }; - - partition@8d0000 { - label = "kernel1"; - reg = <0x8d0000 0x730000>; + reg = <0x1a0000 0xe60000>; }; }; }; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2fc193634b0..dd49583bf4b 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2130,7 +2130,7 @@ define Device/ubnt_usw-flex DEVICE_DTS_CONFIG := config@1 DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - IMAGE_SIZE := 7360k + IMAGE_SIZE := 14720k endef TARGET_DEVICES += ubnt_usw-flex From e4a76673ff4f655ba0698d9edb9efbacd0f82fff Mon Sep 17 00:00:00 2001 From: David Bauer Date: Thu, 17 Nov 2022 22:53:33 +0100 Subject: [PATCH 34/49] ath79: combine UniFi AC dual firmware-partitions In order to maximize the available space on UniFi AC boards using a dual-image partition layout, combine the two OS partitions into a single partition. This allows users to access more usable space for additional packages. Don't limit the usable image size to the size of a single OS partition. The initial installation has to be done with an older version of OpenWrt in case the generated image exceeds the space of a single kernel partition in the future. Signed-off-by: David Bauer --- target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi | 9 ++------- target/linux/ath79/image/generic-ubnt.mk | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi index 2e407c34864..6704ec983b0 100644 --- a/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi +++ b/target/linux/ath79/dts/qca9563_ubnt_unifiac.dtsi @@ -69,17 +69,12 @@ }; partition@70000 { + /* Combine kernel0 & kernel1 */ label = "firmware"; - reg = <0x070000 0x790000>; + reg = <0x070000 0xf20000>; compatible = "denx,uimage"; }; - partition@800000 { - label = "kernel1"; - reg = <0x800000 0x790000>; - read-only; - }; - partition@f90000 { label = "bs"; reg = <0xf90000 0x020000>; diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index bed043c3a78..8eeaa8de3e4 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -229,7 +229,7 @@ TARGET_DEVICES += ubnt_unifi-ap-lr define Device/ubnt_unifiac DEVICE_VENDOR := Ubiquiti SOC := qca9563 - IMAGE_SIZE := 7744k + IMAGE_SIZE := 15488k DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct endef From f97ce066a85c8a67bbda696256b5a9a875727b4c Mon Sep 17 00:00:00 2001 From: David Bauer Date: Mon, 26 Dec 2022 22:33:47 +0100 Subject: [PATCH 35/49] zyxel-bootconfig: clean up script Drop unused variable and fix identation. Signed-off-by: David Bauer --- package/utils/zyxel-bootconfig/files/95_apply_bootconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig index c47857b0827..500b81234a6 100644 --- a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig +++ b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig @@ -1,12 +1,10 @@ apply_bootconfig() { . /lib/functions.sh - local part - case $(board_name) in zyxel,nwa50ax|\ zyxel,nwa55axe) - mtd_idx=$(find_mtd_index "bootconfig") + mtd_idx=$(find_mtd_index "bootconfig") zyxel-bootconfig "/dev/mtd$mtd_idx" set-image-status 0 valid zyxel-bootconfig "/dev/mtd$mtd_idx" set-active-image 0 ;; From 9ac377d0e012e42d9cd69ccc6471fae93c738c1d Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 7 Jan 2023 01:22:23 +0100 Subject: [PATCH 36/49] scripts: add Apache fastly mirror Add the Apache fastly mirror as preferred download source. This service is using a dual-stacked CDN. Signed-off-by: David Bauer --- scripts/download.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/download.pl b/scripts/download.pl index 0b3f99e9b03..676c6e9e6b1 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -255,6 +255,7 @@ foreach my $mirror (@ARGV) { push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1"; push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1" } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { + push @mirrors, "https://dlcdn.apache.org/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; From 7c574525eef49f56f9e9880a1584b3f8d12bcf60 Mon Sep 17 00:00:00 2001 From: Jan Hoffmann Date: Thu, 5 Jan 2023 22:36:24 +0100 Subject: [PATCH 37/49] realtek: don't relocate kernel on HPE 1920 series This is no longer needed now that the kernel is built with a load address that matches the one hard-coded in the bootloader. Signed-off-by: Jan Hoffmann --- target/linux/realtek/image/Makefile | 14 -------------- target/linux/realtek/image/common.mk | 2 -- 2 files changed, 16 deletions(-) diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 82390212e62..3dfbcf67c16 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -71,20 +71,6 @@ define Build/h3c-vfs mv $@.new $@ endef -define Build/relocate-kernel - rm -rf $@.relocate - $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -j1 -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) LZMA_TEXT_START=0x82000000 \ - CROSS_COMPILE=$(TARGET_CROSS) - ( \ - dd if=$@.relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("N", @s[7])' && \ - cat "$@" \ - ) > "$@.new" - mv "$@.new" "$@" - rm -rf $@.relocate -endef - define Device/Default PROFILES = Default KERNEL := \ diff --git a/target/linux/realtek/image/common.mk b/target/linux/realtek/image/common.mk index 8f536bf15f5..214683f8e95 100644 --- a/target/linux/realtek/image/common.mk +++ b/target/linux/realtek/image/common.mk @@ -34,14 +34,12 @@ define Device/hpe_1920 KERNEL := \ kernel-bin | \ append-dtb | \ - relocate-kernel | \ 7z | \ h3c-image | \ h3c-vfs KERNEL_INITRAMFS := \ kernel-bin | \ append-dtb | \ - relocate-kernel | \ 7z | \ h3c-image IMAGE/sysupgrade.bin := \ From a1abf71827834345219adc8e2a361ef2faa0d1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Thu, 5 Jan 2023 13:33:18 +0100 Subject: [PATCH 38/49] kernel: fix bugs added with mac-address-ascii support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Check for -EPROBE_DEFER If it occurs we have to return immediately. Trying other properties could result in another error and ignoring -EPROBE_DEFER which has a special meaning. 2. Check for read result Assuming property->read() success can result in NULL pointer dereference. It happens e.g. for "mac-address" with NVMEM cell containing invalid MAC. 3. Simplify code Don't move cell reading & nvmem_cell_put() into a loop. Simplify loop code. Fixes: ecd81de7a5ab ("ath79: add nvmem cell mac-address-ascii support") Cc: Yousong Zhou Signed-off-by: Rafał Miłecki --- ...of_net-add-mac-address-ascii-support.patch | 39 +++++++++---------- ...of_net-add-mac-address-ascii-support.patch | 39 +++++++++---------- 2 files changed, 38 insertions(+), 40 deletions(-) diff --git a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch index 5dd70f5f718..cf2a26c9d6a 100644 --- a/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch +++ b/target/linux/generic/hack-5.10/601-of_net-add-mac-address-ascii-support.patch @@ -75,36 +75,35 @@ Submitted-by: Yousong Zhou /** * Obtain the MAC address from an nvmem cell named 'mac-address' associated * with given device. -@@ -552,19 +609,23 @@ int nvmem_get_mac_address(struct device +@@ -550,21 +607,28 @@ EXPORT_SYMBOL(eth_platform_get_mac_addre + */ + int nvmem_get_mac_address(struct device *dev, void *addrbuf) { ++ struct nvmem_cell_mac_address_property *property; struct nvmem_cell *cell; const void *mac; - size_t len; -+ struct nvmem_cell_mac_address_property *property; + int i; - -- cell = nvmem_cell_get(dev, "mac-address"); -- if (IS_ERR(cell)) -- return PTR_ERR(cell); -- -- mac = nvmem_cell_read(cell, &len); -- nvmem_cell_put(cell); -- -- if (IS_ERR(mac)) -- return PTR_ERR(mac); ++ + for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { + property = &nvmem_cell_mac_address_properties[i]; + cell = nvmem_cell_get(dev, property->name); -+ if (IS_ERR(cell)) { -+ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) -+ return PTR_ERR(cell); -+ continue; -+ } -+ mac = property->read(cell); -+ nvmem_cell_put(cell); -+ break; ++ /* For -EPROBE_DEFER don't try other properties. We'll get back to this one. */ ++ if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) ++ break; + } +- cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + +- mac = nvmem_cell_read(cell, &len); ++ mac = property->read(cell); + nvmem_cell_put(cell); +- + if (IS_ERR(mac)) + return PTR_ERR(mac); + - if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { + if (!is_valid_ether_addr(mac)) { kfree(mac); diff --git a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch index 4ab05b4ea6f..eb390961d78 100644 --- a/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch +++ b/target/linux/generic/hack-5.15/601-of_net-add-mac-address-ascii-support.patch @@ -75,36 +75,35 @@ Submitted-by: Yousong Zhou /** * nvmem_get_mac_address - Obtain the MAC address from an nvmem cell named * 'mac-address' associated with given device. -@@ -551,19 +608,23 @@ int nvmem_get_mac_address(struct device +@@ -549,21 +606,28 @@ EXPORT_SYMBOL(eth_platform_get_mac_addre + */ + int nvmem_get_mac_address(struct device *dev, void *addrbuf) { ++ struct nvmem_cell_mac_address_property *property; struct nvmem_cell *cell; const void *mac; - size_t len; -+ struct nvmem_cell_mac_address_property *property; + int i; - -- cell = nvmem_cell_get(dev, "mac-address"); -- if (IS_ERR(cell)) -- return PTR_ERR(cell); -- -- mac = nvmem_cell_read(cell, &len); -- nvmem_cell_put(cell); -- -- if (IS_ERR(mac)) -- return PTR_ERR(mac); ++ + for (i = 0; i < ARRAY_SIZE(nvmem_cell_mac_address_properties); i++) { + property = &nvmem_cell_mac_address_properties[i]; + cell = nvmem_cell_get(dev, property->name); -+ if (IS_ERR(cell)) { -+ if (i == ARRAY_SIZE(nvmem_cell_mac_address_properties) - 1) -+ return PTR_ERR(cell); -+ continue; -+ } -+ mac = property->read(cell); -+ nvmem_cell_put(cell); -+ break; ++ /* For -EPROBE_DEFER don't try other properties. We'll get back to this one. */ ++ if (!IS_ERR(cell) || PTR_ERR(cell) == -EPROBE_DEFER) ++ break; + } +- cell = nvmem_cell_get(dev, "mac-address"); + if (IS_ERR(cell)) + return PTR_ERR(cell); + +- mac = nvmem_cell_read(cell, &len); ++ mac = property->read(cell); + nvmem_cell_put(cell); +- + if (IS_ERR(mac)) + return PTR_ERR(mac); + - if (len != ETH_ALEN || !is_valid_ether_addr(mac)) { + if (!is_valid_ether_addr(mac)) { kfree(mac); From 2f847da79d1d0a7a8639ed91851c75cf08a02a4e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sat, 7 Jan 2023 14:51:55 +0100 Subject: [PATCH 39/49] kernel: Refresh kernel patches Make the patches apply cleanly again. Fixes: 8dfe69cdfc5c ("kernel: update nvmem subsystem to the latest upstream") Signed-off-by: Hauke Mehrtens --- .../950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch | 2 +- ...3-Documentation-devicetree-Add-documentation-for-imx37.patch | 2 +- ...0-dt-bindings-media-i2c-Add-IMX519-CMOS-sensor-binding.patch | 2 +- .../008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch index ce189789789..2727d476d94 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0281-media-i2c-Add-driver-for-Sony-IMX477-sensor.patch @@ -25,7 +25,7 @@ Signed-off-by: Naushir Patuck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17521,6 +17521,14 @@ T: git git://linuxtv.org/media_tree.git +@@ -17529,6 +17529,14 @@ T: git git://linuxtv.org/media_tree.git F: Documentation/devicetree/bindings/media/i2c/sony,imx412.yaml F: drivers/media/i2c/imx412.c diff --git a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch index bf0a69ffe5b..f21349769cd 100644 --- a/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch +++ b/target/linux/bcm27xx/patches-5.15/950-0413-Documentation-devicetree-Add-documentation-for-imx37.patch @@ -132,7 +132,7 @@ Signed-off-by: David Plowman +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17535,6 +17535,7 @@ M: Raspberry Pi Kernel Maintenance +... --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -17539,6 +17539,14 @@ F: Documentation/devicetree/bindings/med +@@ -17547,6 +17547,14 @@ F: Documentation/devicetree/bindings/med F: Documentation/devicetree/bindings/media/i2c/imx477.yaml F: drivers/media/i2c/imx477.c diff --git a/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index 845441b4257..cf93d28f0a1 100644 --- a/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.10/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -14816,6 +14816,13 @@ S: Maintained +@@ -14824,6 +14824,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* From 3dbaf89296322489e7dafa336d89d8348c3d90c0 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Thu, 1 Dec 2022 18:49:45 +0800 Subject: [PATCH 40/49] ramips: use default lzma dictionary size for better performance limit dictionary size patch was introduced to solve the well known "LZMA ERROR 1 - must RESET board to recover" error. 09b6755946409d8fd8 "ramips: limit dictionary size for lzma compression" It seems that it has failed recently and we can use lzma loader to fix this error by adding "$(Device/uimage-lzma-loader)". So just remove it to use the default parameter -d24 for a higher compression ratio. Signed-off-by: Shiji Yang --- target/linux/ramips/image/mt7621.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index dd49583bf4b..45ff52be352 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -7,7 +7,6 @@ include ./common-tp-link.mk DEFAULT_SOC := mt7621 -KERNEL_DTB += -d21 DEVICE_VARS += ELECOM_HWNAME LINKSYS_HWNAME ifdef CONFIG_LINUX_5_10 From 3410f010a20a60e9fc47a280fdfdc2dc8fa0e447 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 17 Dec 2022 12:50:42 +0000 Subject: [PATCH 41/49] mt76: remove unnecessary dependency from mt7915e The kmod-mt7615-common package does not contain any code that related to mt7915e Wi-Fi6 driver, so remove it. Tested on ramips/mt7621: SIM SIMAX1800T Signed-off-by: Shiji Yang --- package/kernel/mt76/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index d6f53a1d509..4d0575ab3b5 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -221,7 +221,7 @@ endef define KernelPackage/mt7915e $(KernelPackage/mt76-default) TITLE:=MediaTek MT7915e wireless driver - DEPENDS+=@PCI_SUPPORT +kmod-mt7615-common +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY + DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core +kmod-thermal +@DRIVER_11AX_SUPPORT +@KERNEL_RELAY FILES:= $(PKG_BUILD_DIR)/mt7915/mt7915e.ko AUTOLOAD:=$(call AutoProbe,mt7915e) endef From fc9dd3f0834317ceb20700fd7033987695661097 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 17 Dec 2022 12:50:52 +0000 Subject: [PATCH 42/49] mt76: add stand-alone MT7915 firmware package The mt7915e driver supports MT7915, MT7916 and MT7986 chips. And Only MT7915 series chips need the MT7915 firmware. To save storage, extract them from the common code package and create a new package to provide the firmware. Signed-off-by: Shiji Yang --- package/kernel/mt76/Makefile | 9 ++++++- target/linux/mediatek/image/mt7622.mk | 20 +++++++-------- target/linux/ramips/image/mt7621.mk | 36 +++++++++++++-------------- 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 4d0575ab3b5..874c40766f1 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -218,6 +218,12 @@ define KernelPackage/mt7663u AUTOLOAD:=$(call AutoProbe,mt7663u) endef +define KernelPackage/mt7915-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7915 firmware + DEPENDS+=+kmod-mt7915e +endef + define KernelPackage/mt7915e $(KernelPackage/mt76-default) TITLE:=MediaTek MT7915e wireless driver @@ -461,7 +467,7 @@ define KernelPackage/mt7663-firmware-sta/install $(1)/lib/firmware/mediatek endef -define KernelPackage/mt7915e/install +define KernelPackage/mt7915-firmware/install $(INSTALL_DIR) $(1)/lib/firmware/mediatek cp \ $(PKG_BUILD_DIR)/firmware/mt7915_wa.bin \ @@ -526,6 +532,7 @@ $(eval $(call KernelPackage,mt7663-firmware-sta)) $(eval $(call KernelPackage,mt7663-usb-sdio)) $(eval $(call KernelPackage,mt7663u)) $(eval $(call KernelPackage,mt7663s)) +$(eval $(call KernelPackage,mt7915-firmware)) $(eval $(call KernelPackage,mt7915e)) $(eval $(call KernelPackage,mt7916-firmware)) $(eval $(call KernelPackage,mt7986-firmware)) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index 9760097ee4a..d90207e4641 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -158,7 +158,7 @@ define Device/elecom_wrc-x3200gst3 elecom-wrc-gs-factory WRC-X3200GST3 0.00 -N | \ append-string MT7622_ELECOM_WRC-X3200GST3 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += elecom_wrc-x3200gst3 @@ -169,7 +169,7 @@ define Device/linksys_e8450 DEVICE_ALT0_MODEL := RT3200 DEVICE_DTS := mt7622-linksys-e8450 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 endef TARGET_DEVICES += linksys_e8450 @@ -182,7 +182,7 @@ define Device/linksys_e8450-ubi DEVICE_ALT0_VARIANT := UBI DEVICE_DTS := mt7622-linksys-e8450-ubi DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 UBINIZE_OPTS := -E 5 BLOCKSIZE := 128k PAGESIZE := 2048 @@ -233,7 +233,7 @@ define Device/ruijie_rg-ew3200gx-pro DEVICE_MODEL := RG-EW3200GX PRO DEVICE_DTS := mt7622-ruijie-rg-ew3200gx-pro DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += ruijie_rg-ew3200gx-pro @@ -242,7 +242,7 @@ define Device/reyee_ax3200-e5 DEVICE_MODEL := AX3200 E5 DEVICE_DTS := mt7622-reyee-ax3200-e5 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += reyee_ax3200-e5 @@ -263,7 +263,7 @@ define Device/ubnt_unifi-6-lr-v1 DEVICE_DTS_CONFIG := config@1 DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v1 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-leds-ubnt-ledbar + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-leds-ubnt-ledbar SUPPORTED_DEVICES += ubnt,unifi-6-lr endef TARGET_DEVICES += ubnt_unifi-6-lr-v1 @@ -274,7 +274,7 @@ define Device/ubnt_unifi-6-lr-v1-ubootmod DEVICE_VARIANT := v1 U-Boot mod DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v1-ubootmod DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e kmod-leds-ubnt-ledbar + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-leds-ubnt-ledbar KERNEL := kernel-bin | lzma KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k @@ -294,7 +294,7 @@ define Device/ubnt_unifi-6-lr-v2 DEVICE_DTS_CONFIG := config@1 DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v2 DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += ubnt_unifi-6-lr-v2 @@ -304,7 +304,7 @@ define Device/ubnt_unifi-6-lr-v2-ubootmod DEVICE_VARIANT := v2 U-Boot mod DEVICE_DTS := mt7622-ubnt-unifi-6-lr-v2-ubootmod DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware KERNEL := kernel-bin | lzma KERNEL_INITRAMFS_SUFFIX := -recovery.itb KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k @@ -324,7 +324,7 @@ define Device/xiaomi_redmi-router-ax6s DEVICE_DTS := mt7622-xiaomi-redmi-router-ax6s DEVICE_DTS_DIR := ../dts BOARD_NAME := xiaomi,redmi-router-ax6s - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware UBINIZE_OPTS := -E 5 IMAGES += factory.bin BLOCKSIZE := 128k diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 45ff52be352..037b81992d5 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -306,7 +306,7 @@ define Device/asus_rt-ax53u IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools \ + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 uboot-envtools \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += asus_rt-ax53u @@ -367,7 +367,7 @@ define Device/belkin_rt1800 IMAGE_SIZE := 49152k DEVICE_VENDOR := Belkin DEVICE_MODEL := RT1800 - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 uboot-envtools UBINIZE_OPTS := -E 5 KERNEL_LOADADDR := 0x82000000 KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ @@ -431,7 +431,7 @@ define Device/cudy_m1800 DEVICE_MODEL := M1800 IMAGE_SIZE := 16064k UIMAGE_NAME := R17 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += cudy_m1800 @@ -474,7 +474,7 @@ define Device/cudy_x6 DEVICE_VENDOR := Cudy DEVICE_MODEL := X6 UIMAGE_NAME := R13 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += cudy_x6 @@ -881,7 +881,7 @@ define Device/h3c_tx180x KERNEL := $$(KERNEL_INITRAMFS) | h3c-blank-header IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := H3C - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef define Device/h3c_tx1800-plus @@ -918,7 +918,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) haier-sim_wr1800k-factory endif IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef define Device/haier_har-20s2u1 @@ -1161,7 +1161,7 @@ define Device/iptime_ax2004m check-size | iptime-crc32 ax2004m DEVICE_VENDOR := ipTIME DEVICE_MODEL := AX2004M - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES := kmod-mt7915-firmware kmod-usb3 endef TARGET_DEVICES += iptime_ax2004m @@ -1207,7 +1207,7 @@ define Device/jcg_q20 check-size DEVICE_VENDOR := JCG DEVICE_MODEL := Q20 - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools endef TARGET_DEVICES += jcg_q20 @@ -1649,7 +1649,7 @@ define Device/netgear_wax202 $(Device/dsa-migration) DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WAX202 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware NETGEAR_ENC_MODEL := WAX202 NETGEAR_ENC_REGION := US BLOCKSIZE := 128k @@ -1866,7 +1866,7 @@ define Device/tenbay_t-mb5eu-v01 DEVICE_VENDOR := Tenbay DEVICE_MODEL := T-MB5EU-V01 DEVICE_DTS_CONFIG := config@1 - DEVICE_PACKAGES += kmod-mt7915e kmod-usb3 + DEVICE_PACKAGES += kmod-mt7915-firmware kmod-usb3 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 15808k SUPPORTED_DEVICES += mt7621-dm2-t-mb5eu-v01-nor @@ -1900,7 +1900,7 @@ define Device/totolink_x5000r UIMAGE_NAME := C8343R-9999 DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := X5000R - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += totolink_x5000r @@ -1962,7 +1962,7 @@ define Device/tplink_eap615-wall-v1 $(Device/tplink-safeloader) DEVICE_MODEL := EAP615-Wall DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware TPLINK_BOARD_ID := EAP615-WALL-V1 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | pad-to 64k KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd @@ -2095,7 +2095,7 @@ define Device/ubnt_unifi-6-lite DEVICE_MODEL := UniFi 6 Lite DEVICE_DTS_CONFIG := config@1 DEVICE_DTS_LOADADDR := 0x87000000 - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7915e + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7915-firmware KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGE_SIZE := 15424k endef @@ -2353,7 +2353,7 @@ define Device/xiaomi_mi-router-cr660x IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/firmware.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES += kmod-mt7915e uboot-envtools + DEVICE_PACKAGES += kmod-mt7915-firmware uboot-envtools endef define Device/xiaomi_mi-router-cr6606 @@ -2428,7 +2428,7 @@ define Device/yuncore_ax820 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := AX820 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_ax820 @@ -2438,7 +2438,7 @@ define Device/yuncore_fap640 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := FAP640 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_fap640 @@ -2448,7 +2448,7 @@ define Device/yuncore_fap690 IMAGE_SIZE := 15808k DEVICE_VENDOR := YunCore DEVICE_MODEL := FAP690 - DEVICE_PACKAGES := kmod-mt7915e + DEVICE_PACKAGES := kmod-mt7915-firmware endef TARGET_DEVICES += yuncore_fap690 @@ -2611,7 +2611,7 @@ define Device/zyxel_nwa-ax PAGESIZE := 2048 KERNEL_SIZE := 8192k UBINIZE_OPTS := -E 5 - DEVICE_PACKAGES := kmod-mt7915e uboot-envtools zyxel-bootconfig + DEVICE_PACKAGES := kmod-mt7915-firmware uboot-envtools zyxel-bootconfig KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb IMAGES += factory.bin ramboot-factory.bin IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | zyxel-nwa-fit From 9a07895729a9701a673951a31ceb71f16f0a6fad Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 17 Dec 2022 12:50:55 +0000 Subject: [PATCH 43/49] mt76: add stand-alone MT7622 firmware package Add a separate firmware package to avoid installing the MT7615 firmware on all MT7622 target devices by default. Now we only add MT7615 firmware packages for devices that use MT7615E. This commit also removes the explicit dependency on kmod-mt7615e to refine the package dependency. Signed-off-by: Shiji Yang --- package/kernel/mt76/Makefile | 20 +++- target/linux/mediatek/image/mt7622.mk | 6 +- target/linux/mediatek/mt7622/target.mk | 2 +- target/linux/ramips/image/mt7621.mk | 122 ++++++++++++------------- 4 files changed, 81 insertions(+), 69 deletions(-) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index 874c40766f1..6e852bc03f2 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -171,7 +171,7 @@ endef define KernelPackage/mt7615-firmware $(KernelPackage/mt76-default) TITLE:=MediaTek MT7615e firmware - DEFAULT:=PACKAGE_kmod-mt7615e + DEPENDS+=+kmod-mt7615e endef define KernelPackage/mt7615e @@ -182,6 +182,12 @@ define KernelPackage/mt7615e AUTOLOAD:=$(call AutoProbe,mt7615e) endef +define KernelPackage/mt7622-firmware + $(KernelPackage/mt76-default) + TITLE:=MediaTek MT7622 firmware + DEPENDS+=+kmod-mt7615e +endef + define KernelPackage/mt7663-firmware-ap $(KernelPackage/mt76-default) TITLE:=MediaTek MT7663e firmware (optimized for AP) @@ -445,9 +451,14 @@ define KernelPackage/mt7615-firmware/install $(PKG_BUILD_DIR)/firmware/mt7615_cr4.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_n9.bin \ $(PKG_BUILD_DIR)/firmware/mt7615_rom_patch.bin \ - $(if $(CONFIG_TARGET_mediatek_mt7622), \ - $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \ - $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin) \ + $(1)/lib/firmware/mediatek +endef + +define KernelPackage/mt7622-firmware/install + $(INSTALL_DIR) $(1)/lib/firmware/mediatek + cp \ + $(PKG_BUILD_DIR)/firmware/mt7622_n9.bin \ + $(PKG_BUILD_DIR)/firmware/mt7622_rom_patch.bin \ $(1)/lib/firmware/mediatek endef @@ -526,6 +537,7 @@ $(eval $(call KernelPackage,mt76-connac)) $(eval $(call KernelPackage,mt76-sdio)) $(eval $(call KernelPackage,mt7615-common)) $(eval $(call KernelPackage,mt7615-firmware)) +$(eval $(call KernelPackage,mt7622-firmware)) $(eval $(call KernelPackage,mt7615e)) $(eval $(call KernelPackage,mt7663-firmware-ap)) $(eval $(call KernelPackage,mt7663-firmware-sta)) diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk index d90207e4641..097ddd6bfd2 100644 --- a/target/linux/mediatek/image/mt7622.mk +++ b/target/linux/mediatek/image/mt7622.mk @@ -129,7 +129,7 @@ define Device/buffalo_wsr-2533dhp2 IMAGE/sysupgrade.bin := append-kernel | \ buffalo-kernel-trx 0x32504844 $(KDIR)/tmp/$$(DEVICE_NAME).null | \ sysupgrade-tar kernel=$$$$@ | append-metadata - DEVICE_PACKAGES := swconfig + DEVICE_PACKAGES := kmod-mt7615-firmware swconfig endef TARGET_DEVICES += buffalo_wsr-2533dhp2 @@ -138,7 +138,7 @@ define Device/elecom_wrc-2533gent DEVICE_MODEL := WRC-2533GENT DEVICE_DTS := mt7622-elecom-wrc-2533gent DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := kmod-btmtkuart kmod-usb3 swconfig + DEVICE_PACKAGES := kmod-btmtkuart kmod-mt7615-firmware kmod-usb3 swconfig endef TARGET_DEVICES += elecom_wrc-2533gent @@ -251,7 +251,7 @@ define Device/totolink_a8000ru DEVICE_MODEL := A8000RU DEVICE_DTS := mt7622-totolink-a8000ru DEVICE_DTS_DIR := ../dts - DEVICE_PACKAGES := swconfig + DEVICE_PACKAGES := kmod-mt7615-firmware swconfig IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += totolink_a8000ru diff --git a/target/linux/mediatek/mt7622/target.mk b/target/linux/mediatek/mt7622/target.mk index 92c3f47370e..7c9d57b6a13 100644 --- a/target/linux/mediatek/mt7622/target.mk +++ b/target/linux/mediatek/mt7622/target.mk @@ -2,7 +2,7 @@ ARCH:=aarch64 SUBTARGET:=mt7622 BOARDNAME:=MT7622 CPU_TYPE:=cortex-a53 -DEFAULT_PACKAGES += kmod-mt7615e kmod-mt7615-firmware wpad-basic-wolfssl uboot-envtools +DEFAULT_PACKAGES += kmod-mt7622-firmware wpad-basic-wolfssl uboot-envtools KERNELNAME:=Image dtbs define Target/Description diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 037b81992d5..cbcf67c2363 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -134,7 +134,7 @@ define Device/adslr_g7 IMAGE_SIZE := 16064k DEVICE_VENDOR := ADSLR DEVICE_MODEL := G7 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += adslr_g7 @@ -163,7 +163,7 @@ TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common $(Device/dsa-migration) DEVICE_VENDOR := Amped Wireless - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-mt7615-firmware uboot-envtools IMAGE_SIZE := 32768k KERNEL_SIZE := 4096k BLOCKSIZE := 128k @@ -231,7 +231,7 @@ define Device/asus_rp-ac87 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 + DEVICE_PACKAGES := kmod-mt7615-firmware rssileds endef TARGET_DEVICES += asus_rp-ac87 @@ -260,7 +260,7 @@ define Device/asus_rt-ac65p IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware uboot-envtools endef TARGET_DEVICES += asus_rt-ac65p @@ -277,7 +277,7 @@ define Device/asus_rt-ac85p IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware uboot-envtools + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware uboot-envtools endef TARGET_DEVICES += asus_rt-ac85p @@ -328,7 +328,7 @@ define Device/beeline_smartbox-flash IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware \ uboot-envtools uencrypt endef TARGET_DEVICES += beeline_smartbox-flash @@ -354,7 +354,7 @@ define Device/beeline_smartbox-turbo SERCOMM_SWVER := 1004 DEVICE_VENDOR := Beeline DEVICE_MODEL := SmartBox TURBO - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += beeline_smartbox-turbo @@ -401,7 +401,7 @@ define Device/buffalo_wsr-2533dhpl DEVICE_ALT0_VENDOR := Buffalo DEVICE_ALT0_MODEL := WSR-2533DHP IMAGE/sysupgrade.bin := trx | pad-rootfs | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += buffalo_wsr-2533dhpl @@ -464,7 +464,7 @@ define Device/cudy_wr2100 DEVICE_MODEL := WR2100 IMAGE_SIZE := 15872k UIMAGE_NAME := R11 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += cudy_wr2100 @@ -482,7 +482,7 @@ define Device/dlink_dir-8xx-a1 $(Device/dsa-migration) IMAGE_SIZE := 16000k DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware KERNEL := $$(KERNEL) | uimage-sgehdr IMAGES += factory.bin IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ @@ -494,7 +494,7 @@ define Device/dlink_dir-8xx-r1 $(Device/dsa-migration) IMAGE_SIZE := 16064k DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware KERNEL_INITRAMFS := $$(KERNEL) IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | \ check-size | append-metadata @@ -508,7 +508,7 @@ define Device/dlink_dir-xx60-a1 IMAGE_SIZE := 40960k UBINIZE_OPTS := -E 5 DEVICE_VENDOR := D-Link - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport KERNEL := $$(KERNEL) | uimage-sgehdr IMAGES += factory.bin @@ -661,7 +661,7 @@ define Device/edimax_ra21s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 02020040 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_ra21s @@ -680,7 +680,7 @@ define Device/edimax_re23s IMAGE/factory.bin := append-kernel | append-rootfs | \ edimax-header -s CSYS -m RN76 -f 0x70000 -S 0x01100000 | pad-rootfs | \ check-size - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_re23s @@ -693,7 +693,7 @@ define Device/edimax_rg21s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 02020038 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += edimax_rg21s @@ -705,7 +705,7 @@ define Device/elecom_wrc-1167ghbk2-s IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elecom-wrc-gs-factory WRC-1167GHBK2-S 0.00 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += elecom_wrc-1167ghbk2-s @@ -717,7 +717,7 @@ define Device/elecom_wrc-gs IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elecom-wrc-gs-factory $$$$(ELECOM_HWNAME) 0.00 -N | \ append-string MT7621_ELECOM_$$$$(ELECOM_HWNAME) - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef define Device/elecom_wrc-1167gs2-b @@ -778,7 +778,7 @@ define Device/elecom_wrc-2533ghbk-i IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 0107002d 8844A2D168B45A2D | \ elecom-product-header WRC-2533GHBK-I - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += elecom_wrc-2533ghbk-i @@ -814,7 +814,7 @@ define Device/etisalat_s3 SERCOMM_SWVER := 4009 DEVICE_VENDOR := Etisalat DEVICE_MODEL := S3 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += etisalat_s3 @@ -844,7 +844,7 @@ define Device/glinet_gl-mt1300 IMAGE_SIZE := 32448k DEVICE_VENDOR := GL.iNet DEVICE_MODEL := GL-MT1300 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += glinet_gl-mt1300 @@ -971,7 +971,7 @@ define Device/humax_e10 IMAGE/factory.bin := append-kernel | append-rootfs | pad-rootfs | \ edimax-header -s CSYS -m EA03 -f 0x70000 -S 0x01100000 | \ check-size | zip upg -P f013c26cf0a320fb71d03356dcb6bb63 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += humax_e10 @@ -1012,7 +1012,7 @@ define Device/iodata_wn-ax1167gr2 DEVICE_MODEL := WN-AX1167GR2 KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(XBC.1)b10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-ax1167gr2 @@ -1021,7 +1021,7 @@ define Device/iodata_wn-ax2033gr DEVICE_MODEL := WN-AX2033GR KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(VST.1)C10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-ax2033gr @@ -1030,7 +1030,7 @@ define Device/iodata_wn-dx1167r DEVICE_MODEL := WN-DX1167R KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d43 -n '3.10(XIK.1)b10' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-dx1167r @@ -1048,7 +1048,7 @@ define Device/iodata_wn-dx2033gr DEVICE_MODEL := WN-DX2033GR KERNEL_INITRAMFS := $(KERNEL_DTB) | loader-kernel | lzma | \ uImage lzma -M 0x434f4d42 -n '3.10(XID.0)b30' | iodata-mstc-header - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wn-dx2033gr @@ -1071,7 +1071,7 @@ define Device/iodata_wnpr2600g IMAGES += factory.bin IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ elx-header 0104003a 8844A2D168B45A2D - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iodata_wnpr2600g @@ -1081,7 +1081,7 @@ define Device/iptime_a3002mesh UIMAGE_NAME := a3002me DEVICE_VENDOR := ipTIME DEVICE_MODEL := A3002MESH - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += iptime_a3002mesh @@ -1109,7 +1109,7 @@ define Device/iptime_a3004t IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata DEVICE_VENDOR := ipTIME DEVICE_MODEL := A3004T - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += iptime_a3004t @@ -1119,7 +1119,7 @@ define Device/iptime_a6004ns-m UIMAGE_NAME := a6004nm DEVICE_VENDOR := ipTIME DEVICE_MODEL := A6004NS-M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += iptime_a6004ns-m @@ -1130,7 +1130,7 @@ define Device/iptime_a6ns-m UIMAGE_NAME := a6nm DEVICE_VENDOR := ipTIME DEVICE_MODEL := A6ns-M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += iptime_a6ns-m @@ -1141,7 +1141,7 @@ define Device/iptime_a8004t UIMAGE_NAME := a8004t DEVICE_VENDOR := ipTIME DEVICE_MODEL := A8004T - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += iptime_a8004t @@ -1188,7 +1188,7 @@ define Device/jcg_jhr-ac876m JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-AC876M - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport endef TARGET_DEVICES += jcg_jhr-ac876m @@ -1220,7 +1220,7 @@ define Device/jcg_y2 JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := Y2 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += jcg_y2 @@ -1286,7 +1286,7 @@ define Device/linksys_ea7xxx KERNEL_SIZE := 4096k IMAGE_SIZE := 36864k DEVICE_VENDOR := Linksys - DEVICE_PACKAGES := kmod-usb3 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-usb3 kmod-mt7615-firmware \ uboot-envtools UBINIZE_OPTS := -E 5 IMAGES := sysupgrade.bin factory.bin @@ -1468,7 +1468,7 @@ define Device/mts_wg430223 IMAGES += factory.trx IMAGE/factory.trx := append-kernel | append-ubi | check-size IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware uboot-envtools uencrypt + DEVICE_PACKAGES := kmod-mt7615-firmware uboot-envtools uencrypt endef TARGET_DEVICES += mts_wg430223 @@ -1525,7 +1525,7 @@ define Device/netgear_r6260 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6260 @@ -1537,7 +1537,7 @@ define Device/netgear_r6350 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6350 @@ -1556,7 +1556,7 @@ define Device/netgear_r6700-v2 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6700-v2 @@ -1568,7 +1568,7 @@ define Device/netgear_r6800 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0062 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6800 @@ -1580,7 +1580,7 @@ define Device/netgear_r6850 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x0052 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6850 @@ -1593,7 +1593,7 @@ define Device/netgear_r6900-v2 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r6900-v2 @@ -1605,7 +1605,7 @@ define Device/netgear_r7200 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r7200 @@ -1617,7 +1617,7 @@ define Device/netgear_r7450 SERCOMM_HWVER := A001 SERCOMM_SWVER := 0x1032 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_r7450 @@ -1641,7 +1641,7 @@ define Device/netgear_wac124 SERCOMM_HWVER := A003 SERCOMM_SWVER := 0x0402 IMAGE_SIZE := 40960k - DEVICE_PACKAGES += kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7615-firmware endef TARGET_DEVICES += netgear_wac124 @@ -1713,7 +1713,7 @@ define Device/oraybox_x3a IMAGE_SIZE := 15360k DEVICE_VENDOR := OrayBox DEVICE_MODEL := X3A - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += oraybox_x3a @@ -1725,7 +1725,7 @@ define Device/phicomm_k2p DEVICE_ALT0_VENDOR := Phicomm DEVICE_ALT0_MODEL := KE 2P SUPPORTED_DEVICES += k2p - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += phicomm_k2p @@ -1754,7 +1754,7 @@ define Device/raisecom_msg1500-x-00 DEVICE_VARIANT := X.00 DEVICE_ALT0_VENDOR := Nokia DEVICE_ALT0_MODEL := A-040W-Q - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport uboot-envtools endef TARGET_DEVICES += raisecom_msg1500-x-00 @@ -1778,7 +1778,7 @@ define Device/rostelecom_rt-sf-1 SERCOMM_SWVER := 1026 DEVICE_VENDOR := Rostelecom DEVICE_MODEL := RT-SF-1 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware \ + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware \ kmod-usb3 uboot-envtools endef TARGET_DEVICES += rostelecom_rt-sf-1 @@ -1890,7 +1890,7 @@ define Device/totolink_a7000r UIMAGE_NAME := C8340R1C-9999 DEVICE_VENDOR := TOTOLINK DEVICE_MODEL := A7000R - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware endef TARGET_DEVICES += totolink_a7000r @@ -2020,7 +2020,7 @@ define Device/tplink_re500-v1 $(Device/tplink-safeloader) DEVICE_MODEL := RE500 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE500-V1 IMAGE_SIZE := 14208k endef @@ -2031,7 +2031,7 @@ define Device/tplink_re650-v1 $(Device/tplink-safeloader) DEVICE_MODEL := RE650 DEVICE_VARIANT := v1 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE650-V1 IMAGE_SIZE := 14208k endef @@ -2042,7 +2042,7 @@ define Device/tplink_re650-v2 $(Device/tplink-safeloader) DEVICE_MODEL := RE650 DEVICE_VARIANT := v2 - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7615-firmware TPLINK_BOARD_ID := RE650-V2 IMAGE_SIZE := 7994k endef @@ -2108,7 +2108,7 @@ define Device/ubnt_unifi-flexhd DEVICE_DTS_CONFIG := config@2 DEVICE_DTS_LOADADDR := 0x87000000 KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-leds-ubnt-ledbar + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware kmod-leds-ubnt-ledbar IMAGE_SIZE := 15552k endef TARGET_DEVICES += ubnt_unifi-flexhd @@ -2117,7 +2117,7 @@ define Device/ubnt_unifi-nanohd $(Device/dsa-migration) DEVICE_VENDOR := Ubiquiti DEVICE_MODEL := UniFi nanoHD - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware IMAGE_SIZE := 15552k endef TARGET_DEVICES += ubnt_unifi-nanohd @@ -2184,7 +2184,7 @@ define Device/wavlink_wl-wn531a6 $(Device/dsa-migration) DEVICE_VENDOR := Wavlink DEVICE_MODEL := WL-WN531A6 - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 IMAGE_SIZE := 15040k endef TARGET_DEVICES += wavlink_wl-wn531a6 @@ -2194,7 +2194,7 @@ define Device/wavlink_wl-wn533a8 DEVICE_VENDOR := Wavlink DEVICE_MODEL := WL-WN533A8 KERNEL_INITRAMFS_SUFFIX := -WN533A8$$(KERNEL_SUFFIX) - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 IMAGE_SIZE := 15040k endef TARGET_DEVICES += wavlink_wl-wn533a8 @@ -2252,7 +2252,7 @@ define Device/winstars_ws-wn583a6 DEVICE_ALT0_VENDOR := Gemeita DEVICE_ALT0_MODEL := AC2100 KERNEL_INITRAMFS_SUFFIX := -WN583A6$$(KERNEL_SUFFIX) - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += winstars_ws-wn583a6 @@ -2307,7 +2307,7 @@ define Device/xiaomi_mi-router-3-pro IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ kmod-usb-ledtrig-usbport uboot-envtools SUPPORTED_DEVICES += xiaomi,mir3p endef @@ -2336,7 +2336,7 @@ define Device/xiaomi_mi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Mi Router AC2100 IMAGE_SIZE := 120320k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += xiaomi_mi-router-ac2100 @@ -2378,7 +2378,7 @@ define Device/xiaomi_redmi-router-ac2100 $(Device/xiaomi_nand_separate) DEVICE_MODEL := Redmi Router AC2100 IMAGE_SIZE := 120320k - DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615e kmod-mt7615-firmware + DEVICE_PACKAGES += kmod-mt7603 kmod-mt7615-firmware endef TARGET_DEVICES += xiaomi_redmi-router-ac2100 @@ -2577,7 +2577,7 @@ define Device/zyxel_lte3301-plus UBINIZE_OPTS := -E 5 DEVICE_VENDOR := ZyXEL DEVICE_MODEL := LTE3301-PLUS - DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 \ + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 \ uboot-envtools kmod-usb-ledtrig-usbport kmod-usb-net-qmi-wwan \ kmod-usb-serial-option uqmi KERNEL := $(KERNEL_DTB) | uImage lzma | \ From c4b5239b6318c13159e408da359691be032cdeeb Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sat, 7 Jan 2023 17:06:21 +0800 Subject: [PATCH 44/49] tools/xz: update to 5.4.0 Release notes: https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD Signed-off-by: Linhui Liu --- tools/xz/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 6e287a61b0b..18ba1a236e7 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.10 +PKG_VERSION:=5.4.0 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=01b71df61521d9da698ce3c33148bff06a131628ff037398c09482f3a26e5408 +PKG_HASH:=795ea0494c66d509b052ddc36dc63bd634e59ff2a0f39c16a3b5644dd01d87e6 PKG_CPE_ID:=cpe:/a:tukaani:xz HOST_BUILD_PARALLEL:=1 From a72981b97a6902db86ebb51628976a1214e354ee Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sat, 7 Jan 2023 09:55:28 +0800 Subject: [PATCH 45/49] tools/mpfr: update to 4.2.0 Changes from versions 4.1.* to version 4.2.0: - The "fondue savoyarde" release. - Binary compatible with MPFR 4.0.* and 4.1.*, though some minor changes in the behavior of the formatted output functions may be visible, regarded as underspecified behavior or bug fixes (see below). - New functions mpfr_cosu, mpfr_sinu, mpfr_tanu, mpfr_acosu, mpfr_asinu, mpfr_atanu and mpfr_atan2u. - New functions mpfr_cospi, mpfr_sinpi, mpfr_tanpi, mpfr_acospi, mpfr_asinpi, mpfr_atanpi and mpfr_atan2pi. - New functions mpfr_log2p1, mpfr_log10p1, mpfr_exp2m1, mpfr_exp10m1 and mpfr_compound_si. - New functions mpfr_fmod_ui, mpfr_powr, mpfr_pown, mpfr_pow_uj, mpfr_pow_sj and mpfr_rootn_si (mpfr_pown is actually a macro defined as an alias for mpfr_pow_sj). - Bug fixes. In particular, for the formatted output functions (mpfr_printf, etc.), the case where the precision consists only of a period has been fixed to be like ".0" as specified in the ISO C standard, and the manual has been corrected and clarified. The macros of the custom interface have also been fixed: they now behave like functions (except a minor limitation for mpfr_custom_init_set). Remove upstreamed: - 002-Fix-mpfr_custom_get_kind-macro-bug.patch Refresh patches: - 001-only_src.patch Signed-off-by: Linhui Liu --- tools/mpfr/Makefile | 4 +- tools/mpfr/patches/001-only_src.patch | 4 +- ...2-Fix-mpfr_custom_get_kind-macro-bug.patch | 76 ------------------- 3 files changed, 4 insertions(+), 80 deletions(-) delete mode 100644 tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 6a13be73981..cdcca5f11af 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpfr -PKG_VERSION:=4.1.1 +PKG_VERSION:=4.2.0 PKG_CPE_ID:=cpe:/a:mpfr:gnu_mpfr PKG_SOURCE_URL:=@GNU/mpfr http://www.mpfr.org/mpfr-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d +PKG_HASH:=06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mpfr/patches/001-only_src.patch b/tools/mpfr/patches/001-only_src.patch index 68312276c9d..bd9e38aefbd 100644 --- a/tools/mpfr/patches/001-only_src.patch +++ b/tools/mpfr/patches/001-only_src.patch @@ -1,6 +1,6 @@ --- a/Makefile.am +++ b/Makefile.am -@@ -34,7 +34,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -38,7 +38,7 @@ AUTOMAKE_OPTIONS = gnu # old Automake version. ACLOCAL_AMFLAGS = -I m4 @@ -11,7 +11,7 @@ pkgconfig_DATA = mpfr.pc --- a/Makefile.in +++ b/Makefile.in -@@ -397,7 +397,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -401,7 +401,7 @@ AUTOMAKE_OPTIONS = gnu # libtoolize and in case some developer needs to switch back to an # old Automake version. ACLOCAL_AMFLAGS = -I m4 diff --git a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch b/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch deleted file mode 100644 index bb66a9067c4..00000000000 --- a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0ce17bae34a6c54de31b126f969d3ddd72c6bc37 Mon Sep 17 00:00:00 2001 -From: Vincent Lefevre -Date: Tue, 22 Nov 2022 16:33:00 +0100 -Subject: [PATCH] Fix mpfr_custom_get_kind() macro bug. - -* src/mpfr.h: in the mpfr_custom_get_kind() macro, changed mpfr_ptr to - mpfr_srcptr for _x to agree with the function prototype, in order to - avoid a compilation failure of user code in some cases. This bug was - introduced by commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e, which - introduced the temporary variable _x to avoid an incorrect number of - evaluations of the x argument. -* tests/tstckintc.c: improved the tests to detect this bug. - -This should fix mpfr bug #1. - -Bug initially reported by FX Coudert: - https://github.com/CGAL/cgal/issues/7064 - -It affects Fedora Linux: - https://bugzilla.redhat.com/show_bug.cgi?id=2144197 ---- - src/mpfr.h | 2 +- - tests/tstckintc.c | 10 +++++++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - ---- a/src/mpfr.h -+++ b/src/mpfr.h -@@ -1027,7 +1027,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p ( - #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 - #define mpfr_custom_get_kind(x) \ - __extension__ ({ \ -- mpfr_ptr _x = (x); \ -+ mpfr_srcptr _x = (x); \ - _x->_mpfr_exp > __MPFR_EXP_INF ? \ - (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \ - : _x->_mpfr_exp == __MPFR_EXP_INF ? \ ---- a/tests/tstckintc.c -+++ b/tests/tstckintc.c -@@ -295,14 +295,16 @@ static void - test_nan_inf_zero (void) - { - mpfr_ptr val; -+ mpfr_srcptr sval; /* for compilation error checking */ - int sign; - int kind; - - reset_stack (); - - val = new_mpfr (MPFR_PREC_MIN); -+ sval = val; - mpfr_set_nan (val); -- kind = (mpfr_custom_get_kind) (val); -+ kind = (mpfr_custom_get_kind) (sval); - if (kind != MPFR_NAN_KIND) - { - printf ("mpfr_custom_get_kind error: "); -@@ -380,7 +382,8 @@ static long * - dummy_set_si (long si) - { - mpfr_t x; -- long * r = dummy_new (); -+ mpfr_srcptr px; /* for compilation error checking */ -+ long *r = dummy_new (); - int i1, i2, i3, i4, i5; - - /* Check that the type "void *" can be used, like with the function. -@@ -405,7 +408,8 @@ dummy_set_si (long si) - MPFR_ASSERTN (i5 == 1); - - mpfr_set_si (x, si, MPFR_RNDN); -- r[0] = mpfr_custom_get_kind (x); -+ px = x; -+ r[0] = mpfr_custom_get_kind (px); - - /* Check that the type "void *" can be used in C, like with the function - (forbidden in C++). Also check side effects. */ From 9ee12db67cd34a7697ed8497c1d9592d04ff4871 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sat, 7 Jan 2023 11:28:00 +0800 Subject: [PATCH 46/49] util-linux: update to 2.38.1 Release Notes: https://cdn.kernel.org/pub/linux/utils/util-linux/v2.38/v2.38.1-ReleaseNotes Remove upstreamed: - 010-meson-typo.patch - 020-meson-fix-compilation-without-systemd.patch - 110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch Signed-off-by: Linhui Liu --- package/utils/util-linux/Makefile | 6 ++--- .../util-linux/patches/010-meson-typo.patch | 20 ----------------- ...eson-fix-compilation-without-systemd.patch | 22 ------------------- ...n-fix-when-HAVE_CLOCK_GETTIME-is-set.patch | 21 ------------------ 4 files changed, 3 insertions(+), 66 deletions(-) delete mode 100644 package/utils/util-linux/patches/010-meson-typo.patch delete mode 100644 package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch delete mode 100644 package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 706c3194b19..21764a2d270 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.38 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=2.38.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.38 -PKG_HASH:=6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64 +PKG_HASH:=60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only diff --git a/package/utils/util-linux/patches/010-meson-typo.patch b/package/utils/util-linux/patches/010-meson-typo.patch deleted file mode 100644 index 466d942d586..00000000000 --- a/package/utils/util-linux/patches/010-meson-typo.patch +++ /dev/null @@ -1,20 +0,0 @@ -From c387d4fe7a1435a762a5b7d8b75feb13ad613315 Mon Sep 17 00:00:00 2001 -From: Anatoly Pugachev -Date: Fri, 8 Apr 2022 15:34:16 +0300 -Subject: [PATCH] libfdisk: meson.build fix typo - ---- - libfdisk/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/libfdisk/meson.build -+++ b/libfdisk/meson.build -@@ -11,7 +11,7 @@ libfdisk_h = configure_file( - output : 'libfdisk.h', - configuration : defs, - install : build_libfdisk, -- install_dir : join_paths(get_option('includedir'), 'libfisk'), -+ install_dir : join_paths(get_option('includedir'), 'libfdisk'), - ) - - lib_fdisk_sources = ''' diff --git a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch deleted file mode 100644 index aa209994ec3..00000000000 --- a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 38b15ca2dc4ca32bbe4a2449e1c7b645e4577840 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:53:43 -0700 -Subject: [PATCH 1/7] meson: fix compilation without systemd - -systemdsystemunitdir is used elsewhere. - -Signed-off-by: Rosen Penev ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - ---- a/meson.build -+++ b/meson.build -@@ -720,6 +720,7 @@ if fs_search_path_extra != '' - endif - conf.set_quoted('FS_SEARCH_PATH', fs_search_path) - -+systemdsystemunitdir = '' - if systemd.found() - systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') - endif diff --git a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch deleted file mode 100644 index bba8baf5aba..00000000000 --- a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch +++ /dev/null @@ -1,21 +0,0 @@ -From e51565b653cf09985df57cb7254b16d5af5df223 Mon Sep 17 00:00:00 2001 -From: Nicolas Caramelli -Date: Fri, 29 Apr 2022 18:16:36 +0200 -Subject: [PATCH] meson: fix when HAVE_CLOCK_GETTIME is set - -Signed-off-by: Nicolas Caramelli ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -602,7 +602,7 @@ if not have - have = cc.has_function('clock_gettime', - dependencies : realtime_libs) - endif --conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false) -+conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) - - thread_libs = dependency('threads') - From 98b09ba250d3f9e690e26ea65e9bbdcc2dc7d26d Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Tue, 3 Jan 2023 23:48:51 +0200 Subject: [PATCH 47/49] busybox: update to 1.36.0 Update busybox to version 1.36.0 * refresh patches (remove the backported upstream fix) * refresh config Config refresh: Refresh commands, run after busybox is first built once: cd package/utils/busybox/config/ ../convert_menuconfig.pl ../../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.36.0 cd .. ./convert_defaults.pl ../../../build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/busybox-default/busybox-1.36.0/.config > Config-defaults.in Manual edits needed after config refresh: * Config-defaults.in: OpenWrt config symbol IPV6 logic applied to BUSYBOX_DEFAULT_FEATURE_IPV6 * Config-defaults.in: OpenWrt config TARGET_bcm53xx logic applied to BUSYBOX_DEFAULT_TRUNCATE (commit 547f1ec) * Config-defaults.in: OpenWrt logic applied to BUSYBOX_DEFAULT_LOGIN_SESSION_AS_CHILD (commit dc92917) * Config-defaults.in: correct the default ports that get reset BUSYBOX_DEFAULT_FEATURE_HTTPD_PORT_DEFAULT 80 BUSYBOX_DEFAULT_FEATURE_TELNETD_PORT_DEFAULT 23 * config/editors/Config.in: Add USE_GLIBC dependency to BUSYBOX_CONFIG_FEATURE_VI_REGEX_SEARCH (commit f141090) * config/shell/Config.in: change at "Options common to all shells" the conditional symbol SHELL_ASH --> BUSYBOX_CONFIG_SHELL_ASH (discussion in http://lists.openwrt.org/pipermail/openwrt-devel/2021-January/033140.html Apparently our script does not see the hidden option while prepending config options with "BUSYBOX_CONFIG_" which leads to a missed dependency when the options are later evaluated.) * Edit a few Config.in files by adding quotes to sourced items in config/Config.in, config/networking/Config.in and config/util-linux/Config.in (commit 1da014f) Signed-off-by: Hannu Nyman --- package/utils/busybox/Config-defaults.in | 33 ++++++++++ package/utils/busybox/Makefile | 6 +- .../utils/busybox/config/coreutils/Config.in | 7 ++- package/utils/busybox/config/libbb/Config.in | 62 ++++++++++++++++--- .../utils/busybox/config/miscutils/Config.in | 12 ++++ .../busybox/config/networking/udhcp/Config.in | 7 ++- package/utils/busybox/config/shell/Config.in | 5 ++ ...VE-2022-30065-awk-fix-use-after-free.patch | 42 ------------- 8 files changed, 120 insertions(+), 54 deletions(-) delete mode 100644 package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index abe6d5431a7..7b6cf900335 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -208,6 +208,15 @@ config BUSYBOX_DEFAULT_PASSWORD_MINLEN config BUSYBOX_DEFAULT_MD5_SMALL int default 1 +config BUSYBOX_DEFAULT_SHA1_SMALL + int + default 3 +config BUSYBOX_DEFAULT_SHA1_HWACCEL + bool + default y +config BUSYBOX_DEFAULT_SHA256_HWACCEL + bool + default y config BUSYBOX_DEFAULT_SHA3_SMALL int default 1 @@ -298,6 +307,15 @@ config BUSYBOX_DEFAULT_UNICODE_NEUTRAL_TABLE config BUSYBOX_DEFAULT_UNICODE_PRESERVE_BROKEN bool default n +config BUSYBOX_DEFAULT_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_NO_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_TRY_LOOP_CONFIGURE + bool + default y config BUSYBOX_DEFAULT_FEATURE_SEAMLESS_XZ bool default n @@ -860,6 +878,9 @@ config BUSYBOX_DEFAULT_TRUNCATE bool default y if TARGET_bcm53xx default n +config BUSYBOX_DEFAULT_TSORT + bool + default n config BUSYBOX_DEFAULT_TTY bool default n @@ -2162,6 +2183,9 @@ config BUSYBOX_DEFAULT_RUNLEVEL config BUSYBOX_DEFAULT_RX bool default n +config BUSYBOX_DEFAULT_SEEDRNG + bool + default n config BUSYBOX_DEFAULT_SETFATTR bool default n @@ -2174,6 +2198,9 @@ config BUSYBOX_DEFAULT_STRINGS config BUSYBOX_DEFAULT_TIME bool default y +config BUSYBOX_DEFAULT_TREE + bool + default n config BUSYBOX_DEFAULT_TS bool default n @@ -2682,6 +2709,9 @@ config BUSYBOX_DEFAULT_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT string default "/usr/share/udhcpc/default.script" +config BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + string + default "" config BUSYBOX_DEFAULT_UDHCPC6 bool default n @@ -3012,6 +3042,9 @@ config BUSYBOX_DEFAULT_ASH_PRINTF config BUSYBOX_DEFAULT_ASH_TEST bool default y +config BUSYBOX_DEFAULT_ASH_SLEEP + bool + default n config BUSYBOX_DEFAULT_ASH_HELP bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 2861e7d2e94..95732789451 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.35.0 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.36.0 +PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694 +PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/busybox/config/coreutils/Config.in b/package/utils/busybox/config/coreutils/Config.in index 835ce7950a2..983740be6ed 100644 --- a/package/utils/busybox/config/coreutils/Config.in +++ b/package/utils/busybox/config/coreutils/Config.in @@ -653,7 +653,7 @@ config BUSYBOX_CONFIG_SORT sort is used to sort lines of text in specified files. config BUSYBOX_CONFIG_FEATURE_SORT_BIG - bool "Full SuSv3 compliant sort (support -ktcbdfiogM)" + bool "Full SuSv3 compliant sort (support -ktcbdfioghM)" default BUSYBOX_DEFAULT_FEATURE_SORT_BIG depends on BUSYBOX_CONFIG_SORT help @@ -851,6 +851,11 @@ config BUSYBOX_CONFIG_TRUNCATE help truncate truncates files to a given size. If a file does not exist, it is created unless told otherwise. +config BUSYBOX_CONFIG_TSORT + bool "tsort (0.7 kb)" + default BUSYBOX_DEFAULT_TSORT + help + tsort performs a topological sort. config BUSYBOX_CONFIG_TTY bool "tty (3.6 kb)" default BUSYBOX_DEFAULT_TTY diff --git a/package/utils/busybox/config/libbb/Config.in b/package/utils/busybox/config/libbb/Config.in index e050c4a9150..b3a83b9b085 100644 --- a/package/utils/busybox/config/libbb/Config.in +++ b/package/utils/busybox/config/libbb/Config.in @@ -98,21 +98,47 @@ config BUSYBOX_CONFIG_MD5_SMALL default BUSYBOX_DEFAULT_MD5_SMALL # all "fast or small" options default to small range 0 3 help - Trade binary size versus speed for the md5sum algorithm. + Trade binary size versus speed for the md5 algorithm. Approximate values running uClibc and hashing linux-2.4.4.tar.bz2 were: - value user times (sec) text size (386) - 0 (fastest) 1.1 6144 - 1 1.4 5392 - 2 3.0 5088 - 3 (smallest) 5.1 4912 + value user times (sec) text size (386) + 0 (fastest) 1.1 6144 + 1 1.4 5392 + 2 3.0 5088 + 3 (smallest) 5.1 4912 + +config BUSYBOX_CONFIG_SHA1_SMALL + int "SHA1: Trade bytes for speed (0:fast, 3:slow)" + default BUSYBOX_DEFAULT_SHA1_SMALL # all "fast or small" options default to small + range 0 3 + help + Trade binary size versus speed for the sha1 algorithm. + With FEATURE_COPYBUF_KB=64: + throughput MB/s size of sha1_process_block64 + value 486 x86-64 486 x86-64 + 0 440 485 3481 3502 + 1 265 265 641 696 + 2,3 220 210 342 364 + +config BUSYBOX_CONFIG_SHA1_HWACCEL + bool "SHA1: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA1_HWACCEL + help + On x86, this adds ~590 bytes of code. Throughput + is about twice as fast as fully-unrolled generic code. + +config BUSYBOX_CONFIG_SHA256_HWACCEL + bool "SHA256: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA256_HWACCEL + help + On x86, this adds ~1k bytes of code. config BUSYBOX_CONFIG_SHA3_SMALL int "SHA3: Trade bytes for speed (0:fast, 1:slow)" default BUSYBOX_DEFAULT_SHA3_SMALL # all "fast or small" options default to small range 0 1 help - Trade binary size versus speed for the sha3sum algorithm. + Trade binary size versus speed for the sha3 algorithm. SHA3_SMALL=0 compared to SHA3_SMALL=1 (approximate): 64-bit x86: +270 bytes of code, 45% faster 32-bit x86: +450 bytes of code, 75% faster @@ -399,3 +425,25 @@ config BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN For example, this means that entering 'l', 's', ' ', 0xff, [Enter] at shell prompt will list file named 0xff (single char name with char value 255), not file named '?'. + +choice + prompt "Use LOOP_CONFIGURE for losetup and loop mounts" + default BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + help + LOOP_CONFIGURE is added to Linux 5.8 + https://lwn.net/Articles/820408/ + This allows userspace to completely setup a loop device with a single + ioctl, removing the in-between state where the device can be partially + configured - eg the loop device has a backing file associated with it, + but is reading from the wrong offset. + +config BUSYBOX_CONFIG_LOOP_CONFIGURE + bool "use LOOP_CONFIGURE, needs kernel >= 5.8" + +config BUSYBOX_CONFIG_NO_LOOP_CONFIGURE + bool "use LOOP_SET_FD + LOOP_SET_STATUS" + +config BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + bool "try LOOP_CONFIGURE, fall back to LOOP_SET_FD + LOOP_SET_STATUS" + +endchoice diff --git a/package/utils/busybox/config/miscutils/Config.in b/package/utils/busybox/config/miscutils/Config.in index ecb83d9647a..e15e318fe07 100644 --- a/package/utils/busybox/config/miscutils/Config.in +++ b/package/utils/busybox/config/miscutils/Config.in @@ -704,6 +704,13 @@ config BUSYBOX_CONFIG_RX default BUSYBOX_DEFAULT_RX help Receive files using the Xmodem protocol. +config BUSYBOX_CONFIG_SEEDRNG + bool "seedrng (1.3 kb)" + default BUSYBOX_DEFAULT_SEEDRNG + help + Seed the kernel RNG from seed files, meant to be called + once during startup, once during shutdown, and optionally + at some periodic interval in between. config BUSYBOX_CONFIG_SETFATTR bool "setfattr (3.7 kb)" default BUSYBOX_DEFAULT_SETFATTR @@ -727,6 +734,11 @@ config BUSYBOX_CONFIG_TIME The time command runs the specified program with the given arguments. When the command finishes, time writes a message to standard output giving timing statistics about this program run. +config BUSYBOX_CONFIG_TREE + bool "tree (0.6 kb)" + default BUSYBOX_DEFAULT_TREE + help + List files and directories in a tree structure. config BUSYBOX_CONFIG_TS bool "ts (450 bytes)" default BUSYBOX_DEFAULT_TS diff --git a/package/utils/busybox/config/networking/udhcp/Config.in b/package/utils/busybox/config/networking/udhcp/Config.in index ecfa283e23a..6757f1efc9c 100644 --- a/package/utils/busybox/config/networking/udhcp/Config.in +++ b/package/utils/busybox/config/networking/udhcp/Config.in @@ -93,12 +93,17 @@ config BUSYBOX_CONFIG_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT string "Absolute path to config script" default BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT - depends on BUSYBOX_CONFIG_UDHCPC || BUSYBOX_CONFIG_UDHCPC6 + depends on BUSYBOX_CONFIG_UDHCPC help This script is called after udhcpc receives an answer. See examples/udhcp for a working example. Normally it is safe to leave this untouched. +config BUSYBOX_CONFIG_UDHCPC6_DEFAULT_SCRIPT + string "Absolute path to config script for IPv6" + default BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + depends on BUSYBOX_CONFIG_UDHCPC6 + # udhcpc6 config is inserted here: config BUSYBOX_CONFIG_UDHCPC6 bool "udhcpc6 (21 kb)" diff --git a/package/utils/busybox/config/shell/Config.in b/package/utils/busybox/config/shell/Config.in index 2b07812109c..a68e9114ef7 100644 --- a/package/utils/busybox/config/shell/Config.in +++ b/package/utils/busybox/config/shell/Config.in @@ -201,6 +201,11 @@ config BUSYBOX_CONFIG_ASH_TEST default BUSYBOX_DEFAULT_ASH_TEST depends on BUSYBOX_CONFIG_SHELL_ASH +config BUSYBOX_CONFIG_ASH_SLEEP + bool "sleep builtin" + default BUSYBOX_DEFAULT_ASH_SLEEP + depends on BUSYBOX_CONFIG_SHELL_ASH + config BUSYBOX_CONFIG_ASH_HELP bool "help builtin" default BUSYBOX_DEFAULT_ASH_HELP diff --git a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch b/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch deleted file mode 100644 index 7dcb9dff3f6..00000000000 --- a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e63d7cdfdac78c6fd27e9e63150335767592b85e Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 17 Jun 2022 17:45:34 +0200 -Subject: awk: fix use after free (CVE-2022-30065) - -fixes https://bugs.busybox.net/show_bug.cgi?id=14781 - -function old new delta -evaluate 3343 3357 +14 - -Signed-off-by: Natanael Copa -Signed-off-by: Denys Vlasenko ---- - editors/awk.c | 3 +++ - testsuite/awk.tests | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/editors/awk.c -+++ b/editors/awk.c -@@ -3114,6 +3114,9 @@ static var *evaluate(node *op, var *res) - - case XC( OC_MOVE ): - debug_printf_eval("MOVE\n"); -+ /* make sure that we never return a temp var */ -+ if (L.v == TMPVAR0) -+ L.v = res; - /* if source is a temporary string, jusk relink it to dest */ - if (R.v == TMPVAR1 - && !(R.v->type & VF_NUMBER) ---- a/testsuite/awk.tests -+++ b/testsuite/awk.tests -@@ -469,4 +469,10 @@ testing 'awk printf %% prints one %' \ - "%\n" \ - '' '' - -+testing 'awk assign while test' \ -+ "awk '\$1==\$1=\"foo\" {print \$1}'" \ -+ "foo\n" \ -+ "" \ -+ "foo" -+ - exit $FAILCOUNT From 11759a5bf3c62846ded3d8946322802d41ac8984 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sat, 7 Jan 2023 16:59:14 +0100 Subject: [PATCH 48/49] kernel: backport of changes & helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This code is required for upcoming NVMEM changes. Signed-off-by: Rafał Miłecki --- ...-formatting-issues-and-provide-missi.patch | 95 +++ ...5-of-Fix-kerneldoc-output-formatting.patch | 489 +++++++++++ ...Return-section-in-kerneldoc-comments.patch | 787 ++++++++++++++++++ ...lling-issue-with-function-param-prop.patch | 54 ++ ...he-dst-buffer-to-of_get_mac_address.patch} | 2 +- ..._mac_addr_nvmem-for-non-platform-de.patch} | 2 +- ...t_phandle_with_args-arguments-with-C.patch | 27 + ...ll-of_parse_phandle-variants-static-.patch | 359 ++++++++ ...-of_parse_phandle_with_optional_args.patch | 56 ++ ...ke-.-cells-optional-for-simple-props.patch | 32 + ...operty-add-nvmem-cell-cells-property.patch | 28 + ...ll-of_parse_phandle-variants-static-.patch | 359 ++++++++ ...-of_parse_phandle_with_optional_args.patch | 56 ++ ...ke-.-cells-optional-for-simple-props.patch | 32 + ...operty-add-nvmem-cell-cells-property.patch | 28 + .../hack-5.10/920-device_tree_cmdline.patch | 2 +- .../900-arm-add-cmdline-override.patch | 2 +- .../102-powerpc-add-cmdline-override.patch | 2 +- 18 files changed, 2407 insertions(+), 5 deletions(-) create mode 100644 target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch create mode 100644 target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch create mode 100644 target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch create mode 100644 target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch rename target/linux/generic/backport-5.10/{732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch => 732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch} (99%) rename target/linux/generic/backport-5.10/{732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch => 732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch} (96%) create mode 100644 target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch create mode 100644 target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch create mode 100644 target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch create mode 100644 target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch create mode 100644 target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch create mode 100644 target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch create mode 100644 target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch create mode 100644 target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch create mode 100644 target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch diff --git a/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch b/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch new file mode 100644 index 00000000000..33808f88a33 --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0003-of-base-Fix-some-formatting-issues-and-provide-missi.patch @@ -0,0 +1,95 @@ +From 3637d49e11219512920aca8b8ccd0994be33fa8b Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Thu, 18 Mar 2021 10:40:30 +0000 +Subject: [PATCH] of: base: Fix some formatting issues and provide missing + descriptions + +Fixes the following W=1 kernel build warning(s): + + drivers/of/base.c:315: warning: Function parameter or member 'cpun' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'prop_name' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'cpu' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: Function parameter or member 'thread' not described in '__of_find_n_match_cpu_property' + drivers/of/base.c:315: warning: expecting prototype for property holds the physical id of the(). Prototype was for __of_find_n_match_cpu_property() instead + drivers/of/base.c:1139: warning: Function parameter or member 'match' not described in 'of_find_matching_node_and_match' + drivers/of/base.c:1779: warning: Function parameter or member 'np' not described in '__of_add_property' + drivers/of/base.c:1779: warning: Function parameter or member 'prop' not described in '__of_add_property' + drivers/of/base.c:1800: warning: Function parameter or member 'np' not described in 'of_add_property' + drivers/of/base.c:1800: warning: Function parameter or member 'prop' not described in 'of_add_property' + drivers/of/base.c:1849: warning: Function parameter or member 'np' not described in 'of_remove_property' + drivers/of/base.c:1849: warning: Function parameter or member 'prop' not described in 'of_remove_property' + drivers/of/base.c:2137: warning: Function parameter or member 'dn' not described in 'of_console_check' + drivers/of/base.c:2137: warning: Function parameter or member 'name' not described in 'of_console_check' + drivers/of/base.c:2137: warning: Function parameter or member 'index' not described in 'of_console_check' + +Cc: Rob Herring +Cc: Frank Rowand +Cc: "David S. Miller" +Cc: devicetree@vger.kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20210318104036.3175910-5-lee.jones@linaro.org +--- + drivers/of/base.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -305,7 +305,7 @@ bool __weak arch_match_cpu_phys_id(int c + return (u32)phys_id == cpu; + } + +-/** ++/* + * Checks if the given "prop_name" property holds the physical id of the + * core/thread corresponding to the logical cpu 'cpu'. If 'thread' is not + * NULL, local thread number within the core is returned in it. +@@ -1128,7 +1128,7 @@ EXPORT_SYMBOL(of_match_node); + * will; typically, you pass what the previous call + * returned. of_node_put() will be called on it + * @matches: array of of device match structures to search in +- * @match Updated to point at the matches entry which matched ++ * @match: Updated to point at the matches entry which matched + * + * Returns a node pointer with refcount incremented, use + * of_node_put() on it when done. +@@ -1779,6 +1779,8 @@ EXPORT_SYMBOL(of_count_phandle_with_args + + /** + * __of_add_property - Add a property to a node without lock operations ++ * @np: Caller's Device Node ++ * @prob: Property to add + */ + int __of_add_property(struct device_node *np, struct property *prop) + { +@@ -1800,6 +1802,8 @@ int __of_add_property(struct device_node + + /** + * of_add_property - Add a property to a node ++ * @np: Caller's Device Node ++ * @prob: Property to add + */ + int of_add_property(struct device_node *np, struct property *prop) + { +@@ -1844,6 +1848,8 @@ int __of_remove_property(struct device_n + + /** + * of_remove_property - Remove a property from a node. ++ * @np: Caller's Device Node ++ * @prob: Property to remove + * + * Note that we don't actually remove it, since we have given out + * who-knows-how-many pointers to the data using get-property. +@@ -2130,9 +2136,9 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_i + + /** + * of_console_check() - Test and setup console for DT setup +- * @dn - Pointer to device node +- * @name - Name to use for preferred console without index. ex. "ttyS" +- * @index - Index to use for preferred console. ++ * @dn: Pointer to device node ++ * @name: Name to use for preferred console without index. ex. "ttyS" ++ * @index: Index to use for preferred console. + * + * Check if the given device node matches the stdout-path property in the + * /chosen node. If it does then register it as the preferred console and return diff --git a/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch b/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch new file mode 100644 index 00000000000..bda03b9c4c5 --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0005-of-Fix-kerneldoc-output-formatting.patch @@ -0,0 +1,489 @@ +From 62f026f082e4d762a47b43ea693b38f025122332 Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Fri, 26 Mar 2021 13:26:06 -0600 +Subject: [PATCH] of: Fix kerneldoc output formatting + +The indentation of the kerneldoc comments affects the output formatting. +Leading tabs in particular don't work, sections need to be indented +under the section header, and several code blocks are reformatted. + +Cc: Frank Rowand +Cc: Mauro Carvalho Chehab +Signed-off-by: Rob Herring +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210326192606.3702739-1-robh@kernel.org +--- + drivers/of/base.c | 275 +++++++++++++++++++++++----------------------- + drivers/of/fdt.c | 9 +- + 2 files changed, 141 insertions(+), 143 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -651,11 +651,11 @@ bool of_device_is_big_endian(const struc + EXPORT_SYMBOL(of_device_is_big_endian); + + /** +- * of_get_parent - Get a node's parent if any +- * @node: Node to get parent ++ * of_get_parent - Get a node's parent if any ++ * @node: Node to get parent + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_get_parent(const struct device_node *node) + { +@@ -673,15 +673,15 @@ struct device_node *of_get_parent(const + EXPORT_SYMBOL(of_get_parent); + + /** +- * of_get_next_parent - Iterate to a node's parent +- * @node: Node to get parent of ++ * of_get_next_parent - Iterate to a node's parent ++ * @node: Node to get parent of + * +- * This is like of_get_parent() except that it drops the +- * refcount on the passed node, making it suitable for iterating +- * through a node's parents. ++ * This is like of_get_parent() except that it drops the ++ * refcount on the passed node, making it suitable for iterating ++ * through a node's parents. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_get_next_parent(struct device_node *node) + { +@@ -719,13 +719,13 @@ static struct device_node *__of_get_next + child = __of_get_next_child(parent, child)) + + /** +- * of_get_next_child - Iterate a node childs +- * @node: parent node +- * @prev: previous child of the parent node, or NULL to get first +- * +- * Returns a node pointer with refcount incremented, use of_node_put() on +- * it when done. Returns NULL when prev is the last child. Decrements the +- * refcount of prev. ++ * of_get_next_child - Iterate a node childs ++ * @node: parent node ++ * @prev: previous child of the parent node, or NULL to get first ++ * ++ * Return: A node pointer with refcount incremented, use of_node_put() on ++ * it when done. Returns NULL when prev is the last child. Decrements the ++ * refcount of prev. + */ + struct device_node *of_get_next_child(const struct device_node *node, + struct device_node *prev) +@@ -741,12 +741,12 @@ struct device_node *of_get_next_child(co + EXPORT_SYMBOL(of_get_next_child); + + /** +- * of_get_next_available_child - Find the next available child node +- * @node: parent node +- * @prev: previous child of the parent node, or NULL to get first ++ * of_get_next_available_child - Find the next available child node ++ * @node: parent node ++ * @prev: previous child of the parent node, or NULL to get first + * +- * This function is like of_get_next_child(), except that it +- * automatically skips any disabled nodes (i.e. status = "disabled"). ++ * This function is like of_get_next_child(), except that it ++ * automatically skips any disabled nodes (i.e. status = "disabled"). + */ + struct device_node *of_get_next_available_child(const struct device_node *node, + struct device_node *prev) +@@ -772,12 +772,12 @@ struct device_node *of_get_next_availabl + EXPORT_SYMBOL(of_get_next_available_child); + + /** +- * of_get_next_cpu_node - Iterate on cpu nodes +- * @prev: previous child of the /cpus node, or NULL to get first ++ * of_get_next_cpu_node - Iterate on cpu nodes ++ * @prev: previous child of the /cpus node, or NULL to get first + * +- * Returns a cpu node pointer with refcount incremented, use of_node_put() +- * on it when done. Returns NULL when prev is the last child. Decrements +- * the refcount of prev. ++ * Return: A cpu node pointer with refcount incremented, use of_node_put() ++ * on it when done. Returns NULL when prev is the last child. Decrements ++ * the refcount of prev. + */ + struct device_node *of_get_next_cpu_node(struct device_node *prev) + { +@@ -834,15 +834,15 @@ struct device_node *of_get_compatible_ch + EXPORT_SYMBOL(of_get_compatible_child); + + /** +- * of_get_child_by_name - Find the child node by name for a given parent +- * @node: parent node +- * @name: child name to look for. +- * +- * This function looks for child node for given matching name +- * +- * Returns a node pointer if found, with refcount incremented, use +- * of_node_put() on it when done. +- * Returns NULL if node is not found. ++ * of_get_child_by_name - Find the child node by name for a given parent ++ * @node: parent node ++ * @name: child name to look for. ++ * ++ * This function looks for child node for given matching name ++ * ++ * Return: A node pointer if found, with refcount incremented, use ++ * of_node_put() on it when done. ++ * Returns NULL if node is not found. + */ + struct device_node *of_get_child_by_name(const struct device_node *node, + const char *name) +@@ -893,22 +893,22 @@ struct device_node *__of_find_node_by_fu + } + + /** +- * of_find_node_opts_by_path - Find a node matching a full OF path +- * @path: Either the full path to match, or if the path does not +- * start with '/', the name of a property of the /aliases +- * node (an alias). In the case of an alias, the node +- * matching the alias' value will be returned. +- * @opts: Address of a pointer into which to store the start of +- * an options string appended to the end of the path with +- * a ':' separator. +- * +- * Valid paths: +- * /foo/bar Full path +- * foo Valid alias +- * foo/bar Valid alias + relative path ++ * of_find_node_opts_by_path - Find a node matching a full OF path ++ * @path: Either the full path to match, or if the path does not ++ * start with '/', the name of a property of the /aliases ++ * node (an alias). In the case of an alias, the node ++ * matching the alias' value will be returned. ++ * @opts: Address of a pointer into which to store the start of ++ * an options string appended to the end of the path with ++ * a ':' separator. ++ * ++ * Valid paths: ++ * * /foo/bar Full path ++ * * foo Valid alias ++ * * foo/bar Valid alias + relative path + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_opts_by_path(const char *path, const char **opts) + { +@@ -958,15 +958,15 @@ struct device_node *of_find_node_opts_by + EXPORT_SYMBOL(of_find_node_opts_by_path); + + /** +- * of_find_node_by_name - Find a node by its "name" property +- * @from: The node to start searching from or NULL; the node ++ * of_find_node_by_name - Find a node by its "name" property ++ * @from: The node to start searching from or NULL; the node + * you pass will not be searched, only the next one + * will. Typically, you pass what the previous call + * returned. of_node_put() will be called on @from. +- * @name: The name string to match against ++ * @name: The name string to match against + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_name(struct device_node *from, + const char *name) +@@ -985,16 +985,16 @@ struct device_node *of_find_node_by_name + EXPORT_SYMBOL(of_find_node_by_name); + + /** +- * of_find_node_by_type - Find a node by its "device_type" property +- * @from: The node to start searching from, or NULL to start searching ++ * of_find_node_by_type - Find a node by its "device_type" property ++ * @from: The node to start searching from, or NULL to start searching + * the entire device tree. The node you pass will not be + * searched, only the next one will; typically, you pass + * what the previous call returned. of_node_put() will be + * called on from for you. +- * @type: The type string to match against ++ * @type: The type string to match against + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_type(struct device_node *from, + const char *type) +@@ -1013,18 +1013,18 @@ struct device_node *of_find_node_by_type + EXPORT_SYMBOL(of_find_node_by_type); + + /** +- * of_find_compatible_node - Find a node based on type and one of the ++ * of_find_compatible_node - Find a node based on type and one of the + * tokens in its "compatible" property +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @type: The type string to match "device_type" or NULL to ignore +- * @compatible: The string to match to one of the tokens in the device +- * "compatible" list. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @type: The type string to match "device_type" or NULL to ignore ++ * @compatible: The string to match to one of the tokens in the device ++ * "compatible" list. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_compatible_node(struct device_node *from, + const char *type, const char *compatible) +@@ -1044,16 +1044,16 @@ struct device_node *of_find_compatible_n + EXPORT_SYMBOL(of_find_compatible_node); + + /** +- * of_find_node_with_property - Find a node which has a property with +- * the given name. +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @prop_name: The name of the property to look for. ++ * of_find_node_with_property - Find a node which has a property with ++ * the given name. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @prop_name: The name of the property to look for. + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_node_with_property(struct device_node *from, + const char *prop_name) +@@ -1102,10 +1102,10 @@ const struct of_device_id *__of_match_no + + /** + * of_match_node - Tell if a device_node has a matching of_match structure +- * @matches: array of of device match structures to search in +- * @node: the of device structure to match against ++ * @matches: array of of device match structures to search in ++ * @node: the of device structure to match against + * +- * Low level utility function used by device matching. ++ * Low level utility function used by device matching. + */ + const struct of_device_id *of_match_node(const struct of_device_id *matches, + const struct device_node *node) +@@ -1121,17 +1121,17 @@ const struct of_device_id *of_match_node + EXPORT_SYMBOL(of_match_node); + + /** +- * of_find_matching_node_and_match - Find a node based on an of_device_id +- * match table. +- * @from: The node to start searching from or NULL, the node +- * you pass will not be searched, only the next one +- * will; typically, you pass what the previous call +- * returned. of_node_put() will be called on it +- * @matches: array of of device match structures to search in +- * @match: Updated to point at the matches entry which matched ++ * of_find_matching_node_and_match - Find a node based on an of_device_id ++ * match table. ++ * @from: The node to start searching from or NULL, the node ++ * you pass will not be searched, only the next one ++ * will; typically, you pass what the previous call ++ * returned. of_node_put() will be called on it ++ * @matches: array of of device match structures to search in ++ * @match: Updated to point at the matches entry which matched + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. + */ + struct device_node *of_find_matching_node_and_match(struct device_node *from, + const struct of_device_id *matches, +@@ -1465,21 +1465,21 @@ EXPORT_SYMBOL(of_parse_phandle); + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: ++ * Example:: + * +- * phandle1: node1 { ++ * phandle1: node1 { + * #list-cells = <2>; +- * } ++ * }; + * +- * phandle2: node2 { ++ * phandle2: node2 { + * #list-cells = <1>; +- * } ++ * }; + * +- * node3 { ++ * node3 { + * list = <&phandle1 1 2 &phandle2 3>; +- * } ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); + */ + int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +@@ -1517,29 +1517,29 @@ EXPORT_SYMBOL(of_parse_phandle_with_args + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * } +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * } ++ * Example:: + * +- * phandle3: node3 { +- * #list-cells = <1>; +- * list-map = <0 &phandle2 3>, +- * <1 &phandle2 2>, +- * <2 &phandle1 5 1>; +- * list-map-mask = <0x3>; +- * }; +- * +- * node4 { +- * list = <&phandle1 1 2 &phandle3 0>; +- * } ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * phandle3: node3 { ++ * #list-cells = <1>; ++ * list-map = <0 &phandle2 3>, ++ * <1 &phandle2 2>, ++ * <2 &phandle1 5 1>; ++ * list-map-mask = <0x3>; ++ * }; ++ * ++ * node4 { ++ * list = <&phandle1 1 2 &phandle3 0>; ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_args(node4, "list", "list", 1, &args); + */ + int of_parse_phandle_with_args_map(const struct device_node *np, +@@ -1699,19 +1699,19 @@ EXPORT_SYMBOL(of_parse_phandle_with_args + * Caller is responsible to call of_node_put() on the returned out_args->np + * pointer. + * +- * Example: ++ * Example:: + * +- * phandle1: node1 { +- * } ++ * phandle1: node1 { ++ * }; + * +- * phandle2: node2 { +- * } ++ * phandle2: node2 { ++ * }; + * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * } ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; + * +- * To get a device_node of the `node2' node you may call this: ++ * To get a device_node of the ``node2`` node you may call this: + * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); + */ + int of_parse_phandle_with_fixed_args(const struct device_node *np, +@@ -1957,13 +1957,12 @@ static void of_alias_add(struct alias_pr + + /** + * of_alias_scan - Scan all properties of the 'aliases' node ++ * @dt_alloc: An allocator that provides a virtual address to memory ++ * for storing the resulting tree + * + * The function scans all the properties of the 'aliases' node and populates + * the global lookup table with the properties. It returns the + * number of alias properties found, or an error code in case of failure. +- * +- * @dt_alloc: An allocator that provides a virtual address to memory +- * for storing the resulting tree + */ + void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) + { +@@ -2158,12 +2157,12 @@ bool of_console_check(struct device_node + EXPORT_SYMBOL_GPL(of_console_check); + + /** +- * of_find_next_cache_node - Find a node's subsidiary cache +- * @np: node of type "cpu" or "cache" ++ * of_find_next_cache_node - Find a node's subsidiary cache ++ * @np: node of type "cpu" or "cache" + * +- * Returns a node pointer with refcount incremented, use +- * of_node_put() on it when done. Caller should hold a reference +- * to np. ++ * Return: A node pointer with refcount incremented, use ++ * of_node_put() on it when done. Caller should hold a reference ++ * to np. + */ + struct device_node *of_find_next_cache_node(const struct device_node *np) + { +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -349,11 +349,6 @@ static int unflatten_dt_nodes(const void + + /** + * __unflatten_device_tree - create tree of device_nodes from flat blob +- * +- * unflattens a device-tree, creating the +- * tree of struct device_node. It also fills the "name" and "type" +- * pointers of the nodes so the normal device-tree walking functions +- * can be used. + * @blob: The blob to expand + * @dad: Parent device node + * @mynodes: The device_node tree created by the call +@@ -361,6 +356,10 @@ static int unflatten_dt_nodes(const void + * for the resulting tree + * @detached: if true set OF_DETACHED on @mynodes + * ++ * unflattens a device-tree, creating the tree of struct device_node. It also ++ * fills the "name" and "type" pointers of the nodes so the normal device-tree ++ * walking functions can be used. ++ * + * Returns NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ diff --git a/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch b/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch new file mode 100644 index 00000000000..9c99ccb1dbb --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0006-of-Add-missing-Return-section-in-kerneldoc-comments.patch @@ -0,0 +1,787 @@ +From 8c8239c2c1fb82f171cb22a707f3bb88a2f22109 Mon Sep 17 00:00:00 2001 +From: Rob Herring +Date: Thu, 25 Mar 2021 10:47:12 -0600 +Subject: [PATCH] of: Add missing 'Return' section in kerneldoc comments + +Many of the DT kerneldoc comments are lacking a 'Return' section. Let's +add the section in cases we have a description of return values. There's +still some cases where the return values are not documented. + +Cc: Frank Rowand +Cc: Mauro Carvalho Chehab +Signed-off-by: Rob Herring +Reviewed-by: Mauro Carvalho Chehab +Link: https://lore.kernel.org/r/20210325164713.1296407-8-robh@kernel.org +--- + drivers/of/base.c | 39 +++++++++++++------------ + drivers/of/dynamic.c | 19 ++++++++----- + drivers/of/fdt.c | 8 +++--- + drivers/of/irq.c | 14 ++++----- + drivers/of/overlay.c | 16 +++++------ + drivers/of/platform.c | 10 +++---- + drivers/of/property.c | 66 +++++++++++++++++++++++++++---------------- + include/linux/of.h | 63 ++++++++++++++++++++++++++--------------- + 8 files changed, 140 insertions(+), 95 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -244,7 +244,7 @@ struct device_node *__of_find_all_nodes( + * @prev: Previous node or NULL to start iteration + * of_node_put() will be called on it + * +- * Returns a node pointer with refcount incremented, use ++ * Return: A node pointer with refcount incremented, use + * of_node_put() on it when done. + */ + struct device_node *of_find_all_nodes(struct device_node *prev) +@@ -374,7 +374,7 @@ bool __weak arch_find_n_match_cpu_physic + * before booting secondary cores. This function uses arch_match_cpu_phys_id + * which can be overridden by architecture specific implementation. + * +- * Returns a node pointer for the logical cpu with refcount incremented, use ++ * Return: A node pointer for the logical cpu with refcount incremented, use + * of_node_put() on it when done. Returns NULL if not found. + */ + struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) +@@ -394,8 +394,8 @@ EXPORT_SYMBOL(of_get_cpu_node); + * + * @cpu_node: Pointer to the device_node for CPU. + * +- * Returns the logical CPU number of the given CPU device_node. +- * Returns -ENODEV if the CPU is not found. ++ * Return: The logical CPU number of the given CPU device_node or -ENODEV if the ++ * CPU is not found. + */ + int of_cpu_node_to_id(struct device_node *cpu_node) + { +@@ -427,7 +427,7 @@ EXPORT_SYMBOL(of_cpu_node_to_id); + * bindings. This function check for both and returns the idle state node for + * the requested index. + * +- * In case an idle state node is found at @index, the refcount is incremented ++ * Return: An idle state node if found at @index. The refcount is incremented + * for it, so call of_node_put() on it when done. Returns NULL if not found. + */ + struct device_node *of_get_cpu_state_node(struct device_node *cpu_node, +@@ -561,7 +561,7 @@ int of_device_compatible_match(struct de + * of_machine_is_compatible - Test root of device tree for a given compatible value + * @compat: compatible string to look for in root node's compatible property. + * +- * Returns a positive integer if the root node has the given value in its ++ * Return: A positive integer if the root node has the given value in its + * compatible property. + */ + int of_machine_is_compatible(const char *compat) +@@ -583,7 +583,7 @@ EXPORT_SYMBOL(of_machine_is_compatible); + * + * @device: Node to check for availability, with locks already held + * +- * Returns true if the status property is absent or set to "okay" or "ok", ++ * Return: True if the status property is absent or set to "okay" or "ok", + * false otherwise + */ + static bool __of_device_is_available(const struct device_node *device) +@@ -611,7 +611,7 @@ static bool __of_device_is_available(con + * + * @device: Node to check for availability + * +- * Returns true if the status property is absent or set to "okay" or "ok", ++ * Return: True if the status property is absent or set to "okay" or "ok", + * false otherwise + */ + bool of_device_is_available(const struct device_node *device) +@@ -632,7 +632,7 @@ EXPORT_SYMBOL(of_device_is_available); + * + * @device: Node to check for endianness + * +- * Returns true if the device has a "big-endian" property, or if the kernel ++ * Return: True if the device has a "big-endian" property, or if the kernel + * was compiled for BE *and* the device has a "native-endian" property. + * Returns false otherwise. + * +@@ -816,7 +816,7 @@ EXPORT_SYMBOL(of_get_next_cpu_node); + * Lookup child node whose compatible property contains the given compatible + * string. + * +- * Returns a node pointer with refcount incremented, use of_node_put() on it ++ * Return: a node pointer with refcount incremented, use of_node_put() on it + * when done; or NULL if not found. + */ + struct device_node *of_get_compatible_child(const struct device_node *parent, +@@ -1170,7 +1170,7 @@ EXPORT_SYMBOL(of_find_matching_node_and_ + * It does this by stripping the manufacturer prefix (as delimited by a ',') + * from the first entry in the compatible list property. + * +- * This routine returns 0 on success, <0 on failure. ++ * Return: This routine returns 0 on success, <0 on failure. + */ + int of_modalias_node(struct device_node *node, char *modalias, int len) + { +@@ -1190,7 +1190,7 @@ EXPORT_SYMBOL_GPL(of_modalias_node); + * of_find_node_by_phandle - Find a node given a phandle + * @handle: phandle of the node to find + * +- * Returns a node pointer with refcount incremented, use ++ * Return: A node pointer with refcount incremented, use + * of_node_put() on it when done. + */ + struct device_node *of_find_node_by_phandle(phandle handle) +@@ -1431,7 +1431,7 @@ static int __of_parse_phandle_with_args( + * @index: For properties holding a table of phandles, this is the index into + * the table + * +- * Returns the device_node pointer with refcount incremented. Use ++ * Return: The device_node pointer with refcount incremented. Use + * of_node_put() on it when done. + */ + struct device_node *of_parse_phandle(const struct device_node *np, +@@ -1731,7 +1731,7 @@ EXPORT_SYMBOL(of_parse_phandle_with_fixe + * @list_name: property name that contains a list + * @cells_name: property name that specifies phandles' arguments count + * +- * Returns the number of phandle + argument tuples within a property. It ++ * Return: The number of phandle + argument tuples within a property. It + * is a typical pattern to encode a list of phandle and variable + * arguments into a single property. The number of arguments is encoded + * by a property in the phandle-target node. For example, a gpios +@@ -2031,7 +2031,9 @@ void of_alias_scan(void * (*dt_alloc)(u6 + * @stem: Alias stem of the given device_node + * + * The function travels the lookup table to get the alias id for the given +- * device_node and alias stem. It returns the alias id if found. ++ * device_node and alias stem. ++ * ++ * Return: The alias id if found. + */ + int of_alias_get_id(struct device_node *np, const char *stem) + { +@@ -2140,8 +2142,9 @@ EXPORT_SYMBOL_GPL(of_alias_get_highest_i + * @index: Index to use for preferred console. + * + * Check if the given device node matches the stdout-path property in the +- * /chosen node. If it does then register it as the preferred console and return +- * TRUE. Otherwise return FALSE. ++ * /chosen node. If it does then register it as the preferred console. ++ * ++ * Return: TRUE if console successfully setup. Otherwise return FALSE. + */ + bool of_console_check(struct device_node *dn, char *name, int index) + { +@@ -2192,7 +2195,7 @@ struct device_node *of_find_next_cache_n + * + * @cpu: cpu number(logical index) for which the last cache level is needed + * +- * Returns the the level at which the last cache is present. It is exactly ++ * Return: The the level at which the last cache is present. It is exactly + * same as the total number of cache levels for the given logical cpu. + */ + int of_find_last_cache_level(unsigned int cpu) +--- a/drivers/of/dynamic.c ++++ b/drivers/of/dynamic.c +@@ -27,7 +27,7 @@ static struct device_node *kobj_to_devic + * @node: Node to inc refcount, NULL is supported to simplify writing of + * callers + * +- * Returns node. ++ * Return: The node with refcount incremented. + */ + struct device_node *of_node_get(struct device_node *node) + { +@@ -104,7 +104,8 @@ int of_reconfig_notify(unsigned long act + * @arg - argument of the of notifier + * + * Returns the new state of a device based on the notifier used. +- * Returns 0 on device going from enabled to disabled, 1 on device ++ * ++ * Return: 0 on device going from enabled to disabled, 1 on device + * going from disabled to enabled and -1 on no change. + */ + int of_reconfig_get_state_change(unsigned long action, struct of_reconfig_data *pr) +@@ -371,7 +372,8 @@ void of_node_release(struct kobject *kob + * property structure and the property name & contents. The property's + * flags have the OF_DYNAMIC bit set so that we can differentiate between + * dynamically allocated properties and not. +- * Returns the newly allocated property or NULL on out of memory error. ++ * ++ * Return: The newly allocated property or NULL on out of memory error. + */ + struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags) + { +@@ -414,7 +416,7 @@ struct property *__of_prop_dup(const str + * another node. The node data are dynamically allocated and all the node + * flags have the OF_DYNAMIC & OF_DETACHED bits set. + * +- * Returns the newly allocated node or NULL on out of memory error. ++ * Return: The newly allocated node or NULL on out of memory error. + */ + struct device_node *__of_node_dup(const struct device_node *np, + const char *full_name) +@@ -780,7 +782,8 @@ static int __of_changeset_apply(struct o + * Any side-effects of live tree state changes are applied here on + * success, like creation/destruction of devices and side-effects + * like creation of sysfs properties and directories. +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + * On error the partially applied effects are reverted. + */ + int of_changeset_apply(struct of_changeset *ocs) +@@ -874,7 +877,8 @@ static int __of_changeset_revert(struct + * was before the application. + * Any side-effects like creation/destruction of devices and + * removal of sysfs properties and directories are applied. +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + */ + int of_changeset_revert(struct of_changeset *ocs) + { +@@ -902,7 +906,8 @@ EXPORT_SYMBOL_GPL(of_changeset_revert); + * + OF_RECONFIG_ADD_PROPERTY + * + OF_RECONFIG_REMOVE_PROPERTY, + * + OF_RECONFIG_UPDATE_PROPERTY +- * Returns 0 on success, a negative error value in case of an error. ++ * ++ * Return: 0 on success, a negative error value in case of an error. + */ + int of_changeset_action(struct of_changeset *ocs, unsigned long action, + struct device_node *np, struct property *prop) +--- a/drivers/of/fdt.c ++++ b/drivers/of/fdt.c +@@ -282,7 +282,7 @@ static void reverse_nodes(struct device_ + * @dad: Parent struct device_node + * @nodepp: The device_node tree created by the call + * +- * It returns the size of unflattened device tree or error code ++ * Return: The size of unflattened device tree or error code + */ + static int unflatten_dt_nodes(const void *blob, + void *mem, +@@ -360,7 +360,7 @@ static int unflatten_dt_nodes(const void + * fills the "name" and "type" pointers of the nodes so the normal device-tree + * walking functions can be used. + * +- * Returns NULL on failure or the memory chunk containing the unflattened ++ * Return: NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ + void *__unflatten_device_tree(const void *blob, +@@ -441,7 +441,7 @@ static DEFINE_MUTEX(of_fdt_unflatten_mut + * pointers of the nodes so the normal device-tree walking functions + * can be used. + * +- * Returns NULL on failure or the memory chunk containing the unflattened ++ * Return: NULL on failure or the memory chunk containing the unflattened + * device tree on success. + */ + void *of_fdt_unflatten_tree(const unsigned long *blob, +@@ -715,7 +715,7 @@ const void *__init of_get_flat_dt_prop(u + * @node: node to test + * @compat: compatible string to compare with compatible list. + * +- * On match, returns a non-zero value with smaller values returned for more ++ * Return: a non-zero value on match with smaller values returned for more + * specific compatible values. + */ + static int of_fdt_is_compatible(const void *blob, +--- a/drivers/of/irq.c ++++ b/drivers/of/irq.c +@@ -48,7 +48,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map); + * of_irq_find_parent - Given a device node, find its interrupt parent node + * @child: pointer to device node + * +- * Returns a pointer to the interrupt parent node, or NULL if the interrupt ++ * Return: A pointer to the interrupt parent node, or NULL if the interrupt + * parent could not be determined. + */ + struct device_node *of_irq_find_parent(struct device_node *child) +@@ -81,14 +81,14 @@ EXPORT_SYMBOL_GPL(of_irq_find_parent); + * @addr: address specifier (start of "reg" property of the device) in be32 format + * @out_irq: structure of_phandle_args updated by this function + * +- * Returns 0 on success and a negative number on error +- * + * This function is a low-level interrupt tree walking function. It + * can be used to do a partial walk with synthetized reg and interrupts + * properties, for example when resolving PCI interrupts when no device + * node exist for the parent. It takes an interrupt specifier structure as + * input, walks the tree looking for any interrupt-map properties, translates + * the specifier for each map, and then returns the translated map. ++ * ++ * Return: 0 on success and a negative number on error + */ + int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) + { +@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource); + * @dev: pointer to device tree node + * @index: zero-based index of the IRQ + * +- * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or ++ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or + * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case + * of any other failure. + */ +@@ -407,7 +407,7 @@ EXPORT_SYMBOL_GPL(of_irq_get); + * @dev: pointer to device tree node + * @name: IRQ name + * +- * Returns Linux IRQ number on success, or 0 on the IRQ mapping failure, or ++ * Return: Linux IRQ number on success, or 0 on the IRQ mapping failure, or + * -EPROBE_DEFER if the IRQ domain is not yet created, or error code in case + * of any other failure. + */ +@@ -447,7 +447,7 @@ int of_irq_count(struct device_node *dev + * @res: array of resources to fill in + * @nr_irqs: the number of IRQs (and upper bound for num of @res elements) + * +- * Returns the size of the filled in table (up to @nr_irqs). ++ * Return: The size of the filled in table (up to @nr_irqs). + */ + int of_irq_to_resource_table(struct device_node *dev, struct resource *res, + int nr_irqs) +@@ -602,7 +602,7 @@ static u32 __of_msi_map_id(struct device + * Walk up the device hierarchy looking for devices with a "msi-map" + * property. If found, apply the mapping to @id_in. + * +- * Returns the mapped MSI ID. ++ * Return: The mapped MSI ID. + */ + u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in) + { +--- a/drivers/of/overlay.c ++++ b/drivers/of/overlay.c +@@ -296,7 +296,7 @@ err_free_target_path: + * + * Update of property in symbols node is not allowed. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay. + */ + static int add_changeset_property(struct overlay_changeset *ovcs, +@@ -401,7 +401,7 @@ static int add_changeset_property(struct + * + * NOTE_2: Multiple mods of created nodes not supported. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay. + */ + static int add_changeset_node(struct overlay_changeset *ovcs, +@@ -473,7 +473,7 @@ static int add_changeset_node(struct ove + * + * Do not allow symbols node to have any children. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid @overlay_node. + */ + static int build_changeset_next_level(struct overlay_changeset *ovcs, +@@ -604,7 +604,7 @@ static int find_dup_cset_prop(struct ove + * the same node or duplicate {add, delete, or update} properties entries + * for the same property. + * +- * Returns 0 on success, or -EINVAL if duplicate changeset entry found. ++ * Return: 0 on success, or -EINVAL if duplicate changeset entry found. + */ + static int changeset_dup_entry_check(struct overlay_changeset *ovcs) + { +@@ -628,7 +628,7 @@ static int changeset_dup_entry_check(str + * any portions of the changeset that were successfully created will remain + * in @ovcs->cset. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if ++ * Return: 0 on success, -ENOMEM if memory allocation failure, or -EINVAL if + * invalid overlay in @ovcs->fragments[]. + */ + static int build_changeset(struct overlay_changeset *ovcs) +@@ -724,7 +724,7 @@ static struct device_node *find_target(s + * the top level of @tree. The relevant top level nodes are the fragment + * nodes and the __symbols__ node. Any other top level node will be ignored. + * +- * Returns 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error ++ * Return: 0 on success, -ENOMEM if memory allocation failure, -EINVAL if error + * detected in @tree, or -ENOSPC if idr_alloc() error. + */ + static int init_overlay_changeset(struct overlay_changeset *ovcs, +@@ -1179,7 +1179,7 @@ static int overlay_removal_is_ok(struct + * If an error is returned by an overlay changeset post-remove notifier + * then no further overlay changeset post-remove notifier will be called. + * +- * Returns 0 on success, or a negative error number. *ovcs_id is set to ++ * Return: 0 on success, or a negative error number. *ovcs_id is set to + * zero after reverting the changeset, even if a subsequent error occurs. + */ + int of_overlay_remove(int *ovcs_id) +@@ -1257,7 +1257,7 @@ EXPORT_SYMBOL_GPL(of_overlay_remove); + * + * Removes all overlays from the system in the correct order. + * +- * Returns 0 on success, or a negative error number ++ * Return: 0 on success, or a negative error number + */ + int of_overlay_remove_all(void) + { +--- a/drivers/of/platform.c ++++ b/drivers/of/platform.c +@@ -44,7 +44,7 @@ static const struct of_device_id of_skip + * Takes a reference to the embedded struct device which needs to be dropped + * after use. + * +- * Returns platform_device pointer, or NULL if not found ++ * Return: platform_device pointer, or NULL if not found + */ + struct platform_device *of_find_device_by_node(struct device_node *np) + { +@@ -160,7 +160,7 @@ EXPORT_SYMBOL(of_device_alloc); + * @platform_data: pointer to populate platform_data pointer with + * @parent: Linux device model parent device. + * +- * Returns pointer to created platform device, or NULL if a device was not ++ * Return: Pointer to created platform device, or NULL if a device was not + * registered. Unavailable devices will not get registered. + */ + static struct platform_device *of_platform_device_create_pdata( +@@ -204,7 +204,7 @@ err_clear_flag: + * @bus_id: name to assign device + * @parent: Linux device model parent device. + * +- * Returns pointer to created platform device, or NULL if a device was not ++ * Return: Pointer to created platform device, or NULL if a device was not + * registered. Unavailable devices will not get registered. + */ + struct platform_device *of_platform_device_create(struct device_node *np, +@@ -463,7 +463,7 @@ EXPORT_SYMBOL(of_platform_bus_probe); + * New board support should be using this function instead of + * of_platform_bus_probe(). + * +- * Returns 0 on success, < 0 on failure. ++ * Return: 0 on success, < 0 on failure. + */ + int of_platform_populate(struct device_node *root, + const struct of_device_id *matches, +@@ -608,7 +608,7 @@ static void devm_of_platform_populate_re + * Similar to of_platform_populate(), but will automatically call + * of_platform_depopulate() when the device is unbound from the bus. + * +- * Returns 0 on success, < 0 on failure. ++ * Return: 0 on success, < 0 on failure. + */ + int devm_of_platform_populate(struct device *dev) + { +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -60,9 +60,11 @@ EXPORT_SYMBOL(of_graph_is_present); + * @elem_size: size of the individual element + * + * Search for a property in a device node and count the number of elements of +- * size elem_size in it. Returns number of elements on sucess, -EINVAL if the +- * property does not exist or its length does not match a multiple of elem_size +- * and -ENODATA if the property does not have a value. ++ * size elem_size in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does not ++ * exist or its length does not match a multiple of elem_size and -ENODATA if ++ * the property does not have a value. + */ + int of_property_count_elems_of_size(const struct device_node *np, + const char *propname, int elem_size) +@@ -94,8 +96,9 @@ EXPORT_SYMBOL_GPL(of_property_count_elem + * @len: if !=NULL, actual length is written to here + * + * Search for a property in a device node and valid the requested size. +- * Returns the property value on success, -EINVAL if the property does not +- * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * ++ * Return: The property value on success, -EINVAL if the property does not ++ * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data is too small or too large. + * + */ +@@ -128,7 +131,9 @@ static void *of_find_property_value_of_s + * @out_value: pointer to return value, modified only if no error. + * + * Search for a property in a device node and read nth 32-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -160,7 +165,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_i + * @out_value: pointer to return value, modified only if no error. + * + * Search for a property in a device node and read nth 64-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -195,12 +202,14 @@ EXPORT_SYMBOL_GPL(of_property_read_u64_i + * sz_min will be read. + * + * Search for a property in a device node and read 8-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property +- * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW +- * if the property data is smaller than sz_min or longer than sz_max. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 8 <0x50 0x60 0x70>; ++ * ``property = /bits/ 8 <0x50 0x60 0x70>;`` ++ * ++ * Return: The number of elements read on success, -EINVAL if the property ++ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW ++ * if the property data is smaller than sz_min or longer than sz_max. + * + * The out_values is modified only if a valid u8 value can be decoded. + */ +@@ -243,12 +252,14 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * sz_min will be read. + * + * Search for a property in a device node and read 16-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property +- * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW +- * if the property data is smaller than sz_min or longer than sz_max. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 16 <0x5000 0x6000 0x7000>; ++ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` ++ * ++ * Return: The number of elements read on success, -EINVAL if the property ++ * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW ++ * if the property data is smaller than sz_min or longer than sz_max. + * + * The out_values is modified only if a valid u16 value can be decoded. + */ +@@ -291,7 +302,9 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * sz_min will be read. + * + * Search for a property in a device node and read 32-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property ++ * it. ++ * ++ * Return: The number of elements read on success, -EINVAL if the property + * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW + * if the property data is smaller than sz_min or longer than sz_max. + * +@@ -330,7 +343,9 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * @out_value: pointer to return value, modified only if return value is 0. + * + * Search for a property in a device node and read a 64-bit value from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -365,7 +380,9 @@ EXPORT_SYMBOL_GPL(of_property_read_u64); + * sz_min will be read. + * + * Search for a property in a device node and read 64-bit value(s) from +- * it. Returns number of elements read on success, -EINVAL if the property ++ * it. ++ * ++ * Return: The number of elements read on success, -EINVAL if the property + * does not exist, -ENODATA if property does not have a value, and -EOVERFLOW + * if the property data is smaller than sz_min or longer than sz_max. + * +@@ -407,10 +424,11 @@ EXPORT_SYMBOL_GPL(of_property_read_varia + * return value is 0. + * + * Search for a property in a device tree node and retrieve a null +- * terminated string value (pointer to data, not a copy). Returns 0 on +- * success, -EINVAL if the property does not exist, -ENODATA if property +- * does not have a value, and -EILSEQ if the string is not null-terminated +- * within the length of the property data. ++ * terminated string value (pointer to data, not a copy). ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if ++ * property does not have a value, and -EILSEQ if the string is not ++ * null-terminated within the length of the property data. + * + * The out_string pointer is modified only if a valid string can be decoded. + */ +@@ -774,7 +792,7 @@ EXPORT_SYMBOL(of_graph_get_remote_port_p + * @node: pointer to a local endpoint device_node + * + * Return: Remote port node associated with remote endpoint node linked +- * to @node. Use of_node_put() on it when done. ++ * to @node. Use of_node_put() on it when done. + */ + struct device_node *of_graph_get_remote_port(const struct device_node *node) + { +@@ -807,7 +825,7 @@ EXPORT_SYMBOL(of_graph_get_endpoint_coun + * @endpoint: identifier (value of reg property) of the endpoint node + * + * Return: Remote device node associated with remote endpoint node linked +- * to @node. Use of_node_put() on it when done. ++ * to @node. Use of_node_put() on it when done. + */ + struct device_node *of_graph_get_remote_node(const struct device_node *node, + u32 port, u32 endpoint) +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -424,12 +424,14 @@ extern int of_detach_node(struct device_ + * @sz: number of array elements to read + * + * Search for a property in a device node and read 8-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, +- * -ENODATA if property does not have a value, and -EOVERFLOW if the +- * property data isn't large enough. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 8 <0x50 0x60 0x70>; ++ * ``property = /bits/ 8 <0x50 0x60 0x70>;`` ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, ++ * -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * property data isn't large enough. + * + * The out_values is modified only if a valid u8 value can be decoded. + */ +@@ -454,12 +456,14 @@ static inline int of_property_read_u8_ar + * @sz: number of array elements to read + * + * Search for a property in a device node and read 16-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, +- * -ENODATA if property does not have a value, and -EOVERFLOW if the +- * property data isn't large enough. ++ * it. + * + * dts entry of array should be like: +- * property = /bits/ 16 <0x5000 0x6000 0x7000>; ++ * ``property = /bits/ 16 <0x5000 0x6000 0x7000>;`` ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, ++ * -ENODATA if property does not have a value, and -EOVERFLOW if the ++ * property data isn't large enough. + * + * The out_values is modified only if a valid u16 value can be decoded. + */ +@@ -485,7 +489,9 @@ static inline int of_property_read_u16_a + * @sz: number of array elements to read + * + * Search for a property in a device node and read 32-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -513,7 +519,9 @@ static inline int of_property_read_u32_a + * @sz: number of array elements to read + * + * Search for a property in a device node and read 64-bit value(s) from +- * it. Returns 0 on success, -EINVAL if the property does not exist, ++ * it. ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, + * -ENODATA if property does not have a value, and -EOVERFLOW if the + * property data isn't large enough. + * +@@ -1063,7 +1071,9 @@ static inline bool of_node_is_type(const + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u8 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u8 and -ENODATA if the + * property does not have a value. + */ +@@ -1080,7 +1090,9 @@ static inline int of_property_count_u8_e + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u16 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u16 and -ENODATA if the + * property does not have a value. + */ +@@ -1097,7 +1109,9 @@ static inline int of_property_count_u16_ + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u32 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u32 and -ENODATA if the + * property does not have a value. + */ +@@ -1114,7 +1128,9 @@ static inline int of_property_count_u32_ + * @propname: name of the property to be searched. + * + * Search for a property in a device node and count the number of u64 elements +- * in it. Returns number of elements on sucess, -EINVAL if the property does ++ * in it. ++ * ++ * Return: The number of elements on sucess, -EINVAL if the property does + * not exist or its length does not match a multiple of u64 and -ENODATA if the + * property does not have a value. + */ +@@ -1135,7 +1151,7 @@ static inline int of_property_count_u64_ + * Search for a property in a device tree node and retrieve a list of + * terminated string values (pointer to data, not a copy) in that property. + * +- * If @out_strs is NULL, the number of strings in the property is returned. ++ * Return: If @out_strs is NULL, the number of strings in the property is returned. + */ + static inline int of_property_read_string_array(const struct device_node *np, + const char *propname, const char **out_strs, +@@ -1151,10 +1167,11 @@ static inline int of_property_read_strin + * @propname: name of the property to be searched. + * + * Search for a property in a device tree node and retrieve the number of null +- * terminated string contain in it. Returns the number of strings on +- * success, -EINVAL if the property does not exist, -ENODATA if property +- * does not have a value, and -EILSEQ if the string is not null-terminated +- * within the length of the property data. ++ * terminated string contain in it. ++ * ++ * Return: The number of strings on success, -EINVAL if the property does not ++ * exist, -ENODATA if property does not have a value, and -EILSEQ if the string ++ * is not null-terminated within the length of the property data. + */ + static inline int of_property_count_strings(const struct device_node *np, + const char *propname) +@@ -1174,7 +1191,8 @@ static inline int of_property_count_stri + * Search for a property in a device tree node and retrieve a null + * terminated string value (pointer to data, not a copy) in the list of strings + * contained in that property. +- * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if ++ * ++ * Return: 0 on success, -EINVAL if the property does not exist, -ENODATA if + * property does not have a value, and -EILSEQ if the string is not + * null-terminated within the length of the property data. + * +@@ -1194,7 +1212,8 @@ static inline int of_property_read_strin + * @propname: name of the property to be searched. + * + * Search for a property in a device node. +- * Returns true if the property exists false otherwise. ++ * ++ * Return: true if the property exists false otherwise. + */ + static inline bool of_property_read_bool(const struct device_node *np, + const char *propname) +@@ -1440,7 +1459,7 @@ static inline int of_reconfig_get_state_ + * of_device_is_system_power_controller - Tells if system-power-controller is found for device_node + * @np: Pointer to the given device_node + * +- * return true if present false otherwise ++ * Return: true if present false otherwise + */ + static inline bool of_device_is_system_power_controller(const struct device_node *np) + { diff --git a/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch b/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch new file mode 100644 index 00000000000..64197d7482e --- /dev/null +++ b/target/linux/generic/backport-5.10/732-v5.13-0007-of-base-Fix-spelling-issue-with-function-param-prop.patch @@ -0,0 +1,54 @@ +From 31e46db02ac1351c84e56a18606d17fc1b8390dd Mon Sep 17 00:00:00 2001 +From: Lee Jones +Date: Mon, 29 Mar 2021 16:24:35 +0100 +Subject: [PATCH] of: base: Fix spelling issue with function param 'prop' + +Fixes the following W=1 kernel build warning(s): + + drivers/of/base.c:1781: warning: Function parameter or member 'prop' not described in '__of_add_property' + drivers/of/base.c:1781: warning: Excess function parameter 'prob' description in '__of_add_property' + drivers/of/base.c:1804: warning: Function parameter or member 'prop' not described in 'of_add_property' + drivers/of/base.c:1804: warning: Excess function parameter 'prob' description in 'of_add_property' + drivers/of/base.c:1855: warning: Function parameter or member 'prop' not described in 'of_remove_property' + drivers/of/base.c:1855: warning: Excess function parameter 'prob' description in 'of_remove_property' + +Cc: Rob Herring +Cc: Frank Rowand +Cc: "David S. Miller" +Cc: devicetree@vger.kernel.org +Signed-off-by: Lee Jones +Link: https://lore.kernel.org/r/20210329152435.900225-1-lee.jones@linaro.org +Signed-off-by: Rob Herring +--- + drivers/of/base.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1780,7 +1780,7 @@ EXPORT_SYMBOL(of_count_phandle_with_args + /** + * __of_add_property - Add a property to a node without lock operations + * @np: Caller's Device Node +- * @prob: Property to add ++ * @prop: Property to add + */ + int __of_add_property(struct device_node *np, struct property *prop) + { +@@ -1803,7 +1803,7 @@ int __of_add_property(struct device_node + /** + * of_add_property - Add a property to a node + * @np: Caller's Device Node +- * @prob: Property to add ++ * @prop: Property to add + */ + int of_add_property(struct device_node *np, struct property *prop) + { +@@ -1849,7 +1849,7 @@ int __of_remove_property(struct device_n + /** + * of_remove_property - Remove a property from a node. + * @np: Caller's Device Node +- * @prob: Property to remove ++ * @prop: Property to remove + * + * Note that we don't actually remove it, since we have given out + * who-knows-how-many pointers to the data using get-property. diff --git a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch b/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch similarity index 99% rename from target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch rename to target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch index 928e1ca0dca..ae46508aeba 100644 --- a/target/linux/generic/backport-5.10/732-net-next-1-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch +++ b/target/linux/generic/backport-5.10/732-v5.13-0008-of-net-pass-the-dst-buffer-to-of_get_mac_address.patch @@ -1,7 +1,7 @@ From 83216e3988cd196183542937c9bd58b279f946af Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 12 Apr 2021 19:47:17 +0200 -Subject: of: net: pass the dst buffer to of_get_mac_address() +Subject: [PATCH] of: net: pass the dst buffer to of_get_mac_address() of_get_mac_address() returns a "const void*" pointer to a MAC address. Lately, support to fetch the MAC address by an NVMEM provider was added. diff --git a/target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch b/target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch similarity index 96% rename from target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch rename to target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch index 245c5f3bd6c..260a3258bb4 100644 --- a/target/linux/generic/backport-5.10/732-net-next-2-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-devices.patch +++ b/target/linux/generic/backport-5.10/732-v5.13-0009-of-net-fix-of_get_mac_addr_nvmem-for-non-platform-de.patch @@ -1,7 +1,7 @@ From f10843e04a075202dbb39dfcee047e3a2fdf5a8d Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 12 Apr 2021 19:47:18 +0200 -Subject: of: net: fix of_get_mac_addr_nvmem() for non-platform devices +Subject: [PATCH] of: net: fix of_get_mac_addr_nvmem() for non-platform devices of_get_mac_address() already supports fetching the MAC address by an nvmem provider. But until now, it was just working for platform devices. diff --git a/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch b/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch new file mode 100644 index 00000000000..ee5b7a0f7e8 --- /dev/null +++ b/target/linux/generic/backport-5.10/825-v5.15-of-unify-of_count_phandle_with_args-arguments-with-C.patch @@ -0,0 +1,27 @@ +From a065d5615fc83908ef21ed8159ffb63d816ff5de Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 28 Jul 2021 16:42:27 +0200 +Subject: [PATCH] of: unify of_count_phandle_with_args() arguments with + !CONFIG_OF + +Unify the declaration of of_count_phandle_with_args() between enabled +and disabled OF by making constifying pointed device_node. + +Signed-off-by: Krzysztof Kozlowski +Reviewed-by: Rob Herring +Signed-off-by: Bartosz Golaszewski +--- + include/linux/of.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -889,7 +889,7 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_count_phandle_with_args(struct device_node *np, ++static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) + { diff --git a/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch b/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch new file mode 100644 index 00000000000..b6ef67dfa79 --- /dev/null +++ b/target/linux/generic/backport-5.10/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch @@ -0,0 +1,359 @@ +From 66a8f7f04979f4ad739085f01d99c8caf620b4f5 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 18 Jan 2022 18:35:02 +0100 +Subject: [PATCH] of: base: make small of_parse_phandle() variants static + inline + +Make all the smaller variants of the of_parse_phandle() static inline. +This also let us remove the empty function stubs if CONFIG_OF is not +defined. + +Suggested-by: Rob Herring +Signed-off-by: Michael Walle +[robh: move index < 0 check into __of_parse_phandle_with_args] +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc +--- + drivers/of/base.c | 131 +++------------------------------------ + include/linux/of.h | 148 ++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 129 insertions(+), 150 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1372,15 +1372,18 @@ int of_phandle_iterator_args(struct of_p + return count; + } + +-static int __of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int cell_count, int index, +- struct of_phandle_args *out_args) ++int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, int index, ++ struct of_phandle_args *out_args) + { + struct of_phandle_iterator it; + int rc, cur_index = 0; + ++ if (index < 0) ++ return -EINVAL; ++ + /* Loop over the phandles until all the requested entry is found */ + of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { + /* +@@ -1423,82 +1426,7 @@ static int __of_parse_phandle_with_args( + of_node_put(it.node); + return rc; + } +- +-/** +- * of_parse_phandle - Resolve a phandle property to a device_node pointer +- * @np: Pointer to device node holding phandle property +- * @phandle_name: Name of property holding a phandle value +- * @index: For properties holding a table of phandles, this is the index into +- * the table +- * +- * Return: The device_node pointer with refcount incremented. Use +- * of_node_put() on it when done. +- */ +-struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, int index) +-{ +- struct of_phandle_args args; +- +- if (index < 0) +- return NULL; +- +- if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, +- index, &args)) +- return NULL; +- +- return args.np; +-} +-EXPORT_SYMBOL(of_parse_phandle); +- +-/** +- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cells_name: property name that specifies phandles' arguments count +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * }; +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * }; +- * +- * node3 { +- * list = <&phandle1 1 2 &phandle2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); +- */ +-int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +- const char *cells_name, int index, +- struct of_phandle_args *out_args) +-{ +- int cell_count = -1; +- +- if (index < 0) +- return -EINVAL; +- +- /* If cells_name is NULL we assume a cell count of 0 */ +- if (!cells_name) +- cell_count = 0; +- +- return __of_parse_phandle_with_args(np, list_name, cells_name, +- cell_count, index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_args); ++EXPORT_SYMBOL(__of_parse_phandle_with_args); + + /** + * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it +@@ -1685,47 +1613,6 @@ free: + EXPORT_SYMBOL(of_parse_phandle_with_args_map); + + /** +- * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cell_count: number of argument cells following the phandle +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * }; +- * +- * phandle2: node2 { +- * }; +- * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); +- */ +-int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cell_count, +- int index, struct of_phandle_args *out_args) +-{ +- if (index < 0) +- return -EINVAL; +- return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, +- index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); +- +-/** + * of_count_phandle_with_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -363,18 +363,12 @@ extern const struct of_device_id *of_mat + const struct of_device_id *matches, const struct device_node *node); + extern int of_modalias_node(struct device_node *node, char *modalias, int len); + extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); +-extern struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index); +-extern int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, const char *cells_name, int index, +- struct of_phandle_args *out_args); ++extern int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, const char *cells_name, int cell_count, ++ int index, struct of_phandle_args *out_args); + extern int of_parse_phandle_with_args_map(const struct device_node *np, + const char *list_name, const char *stem_name, int index, + struct of_phandle_args *out_args); +-extern int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args); + extern int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name); + +@@ -857,18 +851,12 @@ static inline int of_property_read_strin + return -ENOSYS; + } + +-static inline struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index) +-{ +- return NULL; +-} +- +-static inline int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int index, +- struct of_phandle_args *out_args) ++static inline int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) + { + return -ENOSYS; + } +@@ -882,13 +870,6 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args) +-{ +- return -ENOSYS; +-} +- + static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) +@@ -1065,6 +1046,117 @@ static inline bool of_node_is_type(const + } + + /** ++ * of_parse_phandle - Resolve a phandle property to a device_node pointer ++ * @np: Pointer to device node holding phandle property ++ * @phandle_name: Name of property holding a phandle value ++ * @index: For properties holding a table of phandles, this is the index into ++ * the table ++ * ++ * Return: The device_node pointer with refcount incremented. Use ++ * of_node_put() on it when done. ++ */ ++static inline struct device_node *of_parse_phandle(const struct device_node *np, ++ const char *phandle_name, ++ int index) ++{ ++ struct of_phandle_args args; ++ ++ if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, ++ index, &args)) ++ return NULL; ++ ++ return args.np; ++} ++ ++/** ++ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 1 2 &phandle2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); ++ */ ++static inline int of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ int cell_count = -1; ++ ++ /* If cells_name is NULL we assume a cell count of 0 */ ++ if (!cells_name) ++ cell_count = 0; ++ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ cell_count, index, out_args); ++} ++ ++/** ++ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cell_count: number of argument cells following the phandle ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * }; ++ * ++ * phandle2: node2 { ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); ++ */ ++static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, ++ const char *list_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, ++ index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch b/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch new file mode 100644 index 00000000000..a3df3ce75c6 --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch @@ -0,0 +1,56 @@ +From 8eddceb280f5deb8046fcb660de9f9f683b408b9 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:21 +0100 +Subject: [PATCH] of: base: add of_parse_phandle_with_optional_args() + +Add a new variant of the of_parse_phandle_with_args() which treats the +cells name as optional. If it's missing, it is assumed that the phandle +has no arguments. + +Up until now, a nvmem node didn't have any arguments, so all the device +trees haven't any '#*-cells' property. But there is a need for an +additional argument for the phandle, for which we need a '#*-cells' +property. Therefore, we need to support nvmem nodes with and without +this property. + +Signed-off-by: Michael Walle +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + include/linux/of.h | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1157,6 +1157,31 @@ static inline int of_parse_phandle_with_ + } + + /** ++ * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * Same as of_parse_phandle_with_args() except that if the cells_name property ++ * is not found, cell_count of 0 is assumed. ++ * ++ * This is used to useful, if you have a phandle which didn't have arguments ++ * before and thus doesn't have a '#*-cells' property but is now migrated to ++ * having arguments while retaining backwards compatibility. ++ */ ++static inline int of_parse_phandle_with_optional_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ 0, index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch b/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch new file mode 100644 index 00000000000..95b0e60d564 --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch @@ -0,0 +1,32 @@ +From 4f4145c9fee8c7a445dbbbadceccce5391e6b287 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:22 +0100 +Subject: [PATCH] of: property: make #.*-cells optional for simple props + +Sometimes, future bindings for phandles will get additional arguments. +Thus the target node of the phandle will need a new #.*-cells property. +To be backwards compatible, this needs to be optional. + +Prepare the DEFINE_SIMPLE_PROPS() to handle the cells name as optional. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1267,8 +1267,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (of_parse_phandle_with_args(np, prop_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; diff --git a/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch b/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch new file mode 100644 index 00000000000..5d1df95ff1e --- /dev/null +++ b/target/linux/generic/backport-5.10/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch @@ -0,0 +1,28 @@ +From 9cf9486a6a7e8a3d76154d0c506051ba3740e8b6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:23 +0100 +Subject: [PATCH] of: property: add #nvmem-cell-cells property + +Bindings describe the new '#nvmem-cell-cells' property. Now that the +arguments count property is optional, we just add this property to the +nvmem-cells. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1314,7 +1314,7 @@ DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", " + DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) + DEFINE_SIMPLE_PROP(interrupts_extended, "interrupts-extended", + "#interrupt-cells") +-DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) ++DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") + DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") + DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) + DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) diff --git a/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch new file mode 100644 index 00000000000..b00cf574199 --- /dev/null +++ b/target/linux/generic/backport-5.15/826-v5.17-of-base-make-small-of_parse_phandle-variants-static-.patch @@ -0,0 +1,359 @@ +From 66a8f7f04979f4ad739085f01d99c8caf620b4f5 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 18 Jan 2022 18:35:02 +0100 +Subject: [PATCH] of: base: make small of_parse_phandle() variants static + inline + +Make all the smaller variants of the of_parse_phandle() static inline. +This also let us remove the empty function stubs if CONFIG_OF is not +defined. + +Suggested-by: Rob Herring +Signed-off-by: Michael Walle +[robh: move index < 0 check into __of_parse_phandle_with_args] +Signed-off-by: Rob Herring +Link: https://lore.kernel.org/r/20220118173504.2867523-2-michael@walle.cc +--- + drivers/of/base.c | 131 +++------------------------------------ + include/linux/of.h | 148 ++++++++++++++++++++++++++++++++++++--------- + 2 files changed, 129 insertions(+), 150 deletions(-) + +--- a/drivers/of/base.c ++++ b/drivers/of/base.c +@@ -1371,15 +1371,18 @@ int of_phandle_iterator_args(struct of_p + return count; + } + +-static int __of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int cell_count, int index, +- struct of_phandle_args *out_args) ++int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, int index, ++ struct of_phandle_args *out_args) + { + struct of_phandle_iterator it; + int rc, cur_index = 0; + ++ if (index < 0) ++ return -EINVAL; ++ + /* Loop over the phandles until all the requested entry is found */ + of_for_each_phandle(&it, rc, np, list_name, cells_name, cell_count) { + /* +@@ -1422,82 +1425,7 @@ static int __of_parse_phandle_with_args( + of_node_put(it.node); + return rc; + } +- +-/** +- * of_parse_phandle - Resolve a phandle property to a device_node pointer +- * @np: Pointer to device node holding phandle property +- * @phandle_name: Name of property holding a phandle value +- * @index: For properties holding a table of phandles, this is the index into +- * the table +- * +- * Return: The device_node pointer with refcount incremented. Use +- * of_node_put() on it when done. +- */ +-struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, int index) +-{ +- struct of_phandle_args args; +- +- if (index < 0) +- return NULL; +- +- if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, +- index, &args)) +- return NULL; +- +- return args.np; +-} +-EXPORT_SYMBOL(of_parse_phandle); +- +-/** +- * of_parse_phandle_with_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cells_name: property name that specifies phandles' arguments count +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * #list-cells = <2>; +- * }; +- * +- * phandle2: node2 { +- * #list-cells = <1>; +- * }; +- * +- * node3 { +- * list = <&phandle1 1 2 &phandle2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); +- */ +-int of_parse_phandle_with_args(const struct device_node *np, const char *list_name, +- const char *cells_name, int index, +- struct of_phandle_args *out_args) +-{ +- int cell_count = -1; +- +- if (index < 0) +- return -EINVAL; +- +- /* If cells_name is NULL we assume a cell count of 0 */ +- if (!cells_name) +- cell_count = 0; +- +- return __of_parse_phandle_with_args(np, list_name, cells_name, +- cell_count, index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_args); ++EXPORT_SYMBOL(__of_parse_phandle_with_args); + + /** + * of_parse_phandle_with_args_map() - Find a node pointed by phandle in a list and remap it +@@ -1684,47 +1612,6 @@ free: + EXPORT_SYMBOL(of_parse_phandle_with_args_map); + + /** +- * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list +- * @np: pointer to a device tree node containing a list +- * @list_name: property name that contains a list +- * @cell_count: number of argument cells following the phandle +- * @index: index of a phandle to parse out +- * @out_args: optional pointer to output arguments structure (will be filled) +- * +- * This function is useful to parse lists of phandles and their arguments. +- * Returns 0 on success and fills out_args, on error returns appropriate +- * errno value. +- * +- * Caller is responsible to call of_node_put() on the returned out_args->np +- * pointer. +- * +- * Example:: +- * +- * phandle1: node1 { +- * }; +- * +- * phandle2: node2 { +- * }; +- * +- * node3 { +- * list = <&phandle1 0 2 &phandle2 2 3>; +- * }; +- * +- * To get a device_node of the ``node2`` node you may call this: +- * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); +- */ +-int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cell_count, +- int index, struct of_phandle_args *out_args) +-{ +- if (index < 0) +- return -EINVAL; +- return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, +- index, out_args); +-} +-EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); +- +-/** + * of_count_phandle_with_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -363,18 +363,12 @@ extern const struct of_device_id *of_mat + const struct of_device_id *matches, const struct device_node *node); + extern int of_modalias_node(struct device_node *node, char *modalias, int len); + extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); +-extern struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index); +-extern int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, const char *cells_name, int index, +- struct of_phandle_args *out_args); ++extern int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, const char *cells_name, int cell_count, ++ int index, struct of_phandle_args *out_args); + extern int of_parse_phandle_with_args_map(const struct device_node *np, + const char *list_name, const char *stem_name, int index, + struct of_phandle_args *out_args); +-extern int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args); + extern int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, const char *cells_name); + +@@ -864,18 +858,12 @@ static inline int of_property_read_strin + return -ENOSYS; + } + +-static inline struct device_node *of_parse_phandle(const struct device_node *np, +- const char *phandle_name, +- int index) +-{ +- return NULL; +-} +- +-static inline int of_parse_phandle_with_args(const struct device_node *np, +- const char *list_name, +- const char *cells_name, +- int index, +- struct of_phandle_args *out_args) ++static inline int __of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) + { + return -ENOSYS; + } +@@ -889,13 +877,6 @@ static inline int of_parse_phandle_with_ + return -ENOSYS; + } + +-static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, +- const char *list_name, int cells_count, int index, +- struct of_phandle_args *out_args) +-{ +- return -ENOSYS; +-} +- + static inline int of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name) +@@ -1077,6 +1058,117 @@ static inline bool of_node_is_type(const + } + + /** ++ * of_parse_phandle - Resolve a phandle property to a device_node pointer ++ * @np: Pointer to device node holding phandle property ++ * @phandle_name: Name of property holding a phandle value ++ * @index: For properties holding a table of phandles, this is the index into ++ * the table ++ * ++ * Return: The device_node pointer with refcount incremented. Use ++ * of_node_put() on it when done. ++ */ ++static inline struct device_node *of_parse_phandle(const struct device_node *np, ++ const char *phandle_name, ++ int index) ++{ ++ struct of_phandle_args args; ++ ++ if (__of_parse_phandle_with_args(np, phandle_name, NULL, 0, ++ index, &args)) ++ return NULL; ++ ++ return args.np; ++} ++ ++/** ++ * of_parse_phandle_with_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * #list-cells = <2>; ++ * }; ++ * ++ * phandle2: node2 { ++ * #list-cells = <1>; ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 1 2 &phandle2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_args(node3, "list", "#list-cells", 1, &args); ++ */ ++static inline int of_parse_phandle_with_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ int cell_count = -1; ++ ++ /* If cells_name is NULL we assume a cell count of 0 */ ++ if (!cells_name) ++ cell_count = 0; ++ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ cell_count, index, out_args); ++} ++ ++/** ++ * of_parse_phandle_with_fixed_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cell_count: number of argument cells following the phandle ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * This function is useful to parse lists of phandles and their arguments. ++ * Returns 0 on success and fills out_args, on error returns appropriate ++ * errno value. ++ * ++ * Caller is responsible to call of_node_put() on the returned out_args->np ++ * pointer. ++ * ++ * Example:: ++ * ++ * phandle1: node1 { ++ * }; ++ * ++ * phandle2: node2 { ++ * }; ++ * ++ * node3 { ++ * list = <&phandle1 0 2 &phandle2 2 3>; ++ * }; ++ * ++ * To get a device_node of the ``node2`` node you may call this: ++ * of_parse_phandle_with_fixed_args(node3, "list", 2, 1, &args); ++ */ ++static inline int of_parse_phandle_with_fixed_args(const struct device_node *np, ++ const char *list_name, ++ int cell_count, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, NULL, cell_count, ++ index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch new file mode 100644 index 00000000000..b829f21cfac --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0001-of-base-add-of_parse_phandle_with_optional_args.patch @@ -0,0 +1,56 @@ +From 8eddceb280f5deb8046fcb660de9f9f683b408b9 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:21 +0100 +Subject: [PATCH] of: base: add of_parse_phandle_with_optional_args() + +Add a new variant of the of_parse_phandle_with_args() which treats the +cells name as optional. If it's missing, it is assumed that the phandle +has no arguments. + +Up until now, a nvmem node didn't have any arguments, so all the device +trees haven't any '#*-cells' property. But there is a need for an +additional argument for the phandle, for which we need a '#*-cells' +property. Therefore, we need to support nvmem nodes with and without +this property. + +Signed-off-by: Michael Walle +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + include/linux/of.h | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -1169,6 +1169,31 @@ static inline int of_parse_phandle_with_ + } + + /** ++ * of_parse_phandle_with_optional_args() - Find a node pointed by phandle in a list ++ * @np: pointer to a device tree node containing a list ++ * @list_name: property name that contains a list ++ * @cells_name: property name that specifies phandles' arguments count ++ * @index: index of a phandle to parse out ++ * @out_args: optional pointer to output arguments structure (will be filled) ++ * ++ * Same as of_parse_phandle_with_args() except that if the cells_name property ++ * is not found, cell_count of 0 is assumed. ++ * ++ * This is used to useful, if you have a phandle which didn't have arguments ++ * before and thus doesn't have a '#*-cells' property but is now migrated to ++ * having arguments while retaining backwards compatibility. ++ */ ++static inline int of_parse_phandle_with_optional_args(const struct device_node *np, ++ const char *list_name, ++ const char *cells_name, ++ int index, ++ struct of_phandle_args *out_args) ++{ ++ return __of_parse_phandle_with_args(np, list_name, cells_name, ++ 0, index, out_args); ++} ++ ++/** + * of_property_count_u8_elems - Count the number of u8 elements in a property + * + * @np: device node from which the property value is to be read. diff --git a/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch b/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch new file mode 100644 index 00000000000..4cf11ca34bb --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0002-of-property-make-.-cells-optional-for-simple-props.patch @@ -0,0 +1,32 @@ +From 4f4145c9fee8c7a445dbbbadceccce5391e6b287 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:22 +0100 +Subject: [PATCH] of: property: make #.*-cells optional for simple props + +Sometimes, future bindings for phandles will get additional arguments. +Thus the target node of the phandle will need a new #.*-cells property. +To be backwards compatible, this needs to be optional. + +Prepare the DEFINE_SIMPLE_PROPS() to handle the cells name as optional. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1227,8 +1227,8 @@ static struct device_node *parse_suffix_ + if (strcmp_suffix(prop_name, suffix)) + return NULL; + +- if (of_parse_phandle_with_args(np, prop_name, cells_name, index, +- &sup_args)) ++ if (__of_parse_phandle_with_args(np, prop_name, cells_name, 0, index, ++ &sup_args)) + return NULL; + + return sup_args.np; diff --git a/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch b/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch new file mode 100644 index 00000000000..8c047e685d3 --- /dev/null +++ b/target/linux/generic/backport-5.15/827-v6.3-0003-of-property-add-nvmem-cell-cells-property.patch @@ -0,0 +1,28 @@ +From 9cf9486a6a7e8a3d76154d0c506051ba3740e8b6 Mon Sep 17 00:00:00 2001 +From: Michael Walle +Date: Tue, 6 Dec 2022 21:07:23 +0100 +Subject: [PATCH] of: property: add #nvmem-cell-cells property + +Bindings describe the new '#nvmem-cell-cells' property. Now that the +arguments count property is optional, we just add this property to the +nvmem-cells. + +Signed-off-by: Michael Walle +Tested-by: Miquel Raynal +Reviewed-by: Rob Herring +Signed-off-by: Srinivas Kandagatla +--- + drivers/of/property.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/of/property.c ++++ b/drivers/of/property.c +@@ -1276,7 +1276,7 @@ DEFINE_SIMPLE_PROP(dmas, "dmas", "#dma-c + DEFINE_SIMPLE_PROP(power_domains, "power-domains", "#power-domain-cells") + DEFINE_SIMPLE_PROP(hwlocks, "hwlocks", "#hwlock-cells") + DEFINE_SIMPLE_PROP(extcon, "extcon", NULL) +-DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", NULL) ++DEFINE_SIMPLE_PROP(nvmem_cells, "nvmem-cells", "#nvmem-cell-cells") + DEFINE_SIMPLE_PROP(phys, "phys", "#phy-cells") + DEFINE_SIMPLE_PROP(wakeup_parent, "wakeup-parent", NULL) + DEFINE_SIMPLE_PROP(pinctrl0, "pinctrl-0", NULL) diff --git a/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch b/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch index 17d3f2ffd59..dbba45b41c3 100644 --- a/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch +++ b/target/linux/generic/hack-5.10/920-device_tree_cmdline.patch @@ -16,7 +16,7 @@ SVN-Revision: 36780 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1055,6 +1055,9 @@ int __init early_init_dt_scan_chosen(uns +@@ -1054,6 +1054,9 @@ int __init early_init_dt_scan_chosen(uns p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) strlcpy(data, p, min(l, COMMAND_LINE_SIZE)); diff --git a/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch b/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch index ddc3b7cb527..3f433289617 100644 --- a/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch +++ b/target/linux/ipq806x/patches-5.10/900-arm-add-cmdline-override.patch @@ -17,7 +17,7 @@ default "" --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1058,6 +1058,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); diff --git a/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch b/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch index 9242fce4e21..95ce5f2bb91 100644 --- a/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch +++ b/target/linux/mpc85xx/patches-5.10/102-powerpc-add-cmdline-override.patch @@ -17,7 +17,7 @@ help --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c -@@ -1059,6 +1059,17 @@ int __init early_init_dt_scan_chosen(uns +@@ -1058,6 +1058,17 @@ int __init early_init_dt_scan_chosen(uns if (p != NULL && l > 0) strlcat(data, p, min_t(int, strlen(data) + (int)l, COMMAND_LINE_SIZE)); From 3c31f6b521bb5fc49e222a8f2bcd454b73452a0e Mon Sep 17 00:00:00 2001 From: Sebastian Schaper Date: Sat, 7 Jan 2023 13:45:44 +0100 Subject: [PATCH 49/49] ramips: add support for D-Link DAP-X1860 A1 The DAP-X1860 is a wall-plug AX1800 repeater. Specifications: - MT7621, 256 MiB RAM, 128 MiB SPI NAND - MT7915 + MT7975 2x2 802.11ax (DBDC) - Ethernet: 1 port 10/100/1000 - LED RSSI bargraph (2x green, 1x red/orange), status and RSSI LEDs are incorrectly populated red/orange (should be red/green according to documentation) Installation: - Keep reset button pressed during plug-in - Web Recovery Updater is at 192.168.0.50 - Upload factory.bin, confirm flashing (seems to work best with Chromium-based browsers) Revert to OEM firmware: - tar -xvf DAP-X1860_RevA_Firmware_101b94.bin - openssl enc -d -md md5 -aes-256-cbc -in FWImage.st2 \ -out FWImage.st1 -k MB0dBx62oXJXDvt12lETWQ== - tar -xvf FWImage.st1 - flash kernel_DAP-X1860.bin via Recovery Signed-off-by: Sebastian Schaper --- .../ramips/dts/mt7621_dlink_dap-x1860-a1.dts | 197 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 21 ++ .../mt7621/base-files/etc/board.d/01_leds | 7 + .../mt7621/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/ieee80211/10_fix_wifi_mac | 7 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 6 files changed, 234 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts new file mode 100644 index 00000000000..edc1c6544c0 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "dlink,dap-x1860-a1", "mediatek,mt7621-soc"; + model = "D-Link DAP-X1860 A1"; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + aliases { + label-mac-device = &gmac0; + led-boot = &led_power_orange; + led-failsafe = &led_power_red; + led-running = &led_power_orange; + led-upgrade = &led_power_red; + }; + + keys { + compatible = "gpio-keys"; + + wps { + label = "wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + reset { + label = "reset"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_red: power_red { + label = "red:power"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + }; + + led_power_orange: power_orange { + label = "orange:power"; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + rssihigh { + label = "green:rssihigh"; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; + }; + + rssimedium { + label = "green:rssimedium"; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; + }; + + rssilow_orange { + label = "orange:rssilow"; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; + }; + + rssilow_green { + label = "green:rssilow"; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + + devices = <&fwconcat0 &fwconcat1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "ubi"; + reg = <0x0 0x0>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + mediatek,nmbm; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x80000>; + read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + }; + + partition@180000 { + label = "kernel"; + reg = <0x180000 0x0800000>; + }; + + fwconcat0: partition@980000 { + label = "fwconcat0"; + reg = <0x980000 0x2c00000>; + }; + + partition@3580000 { + label = "manufacture"; + reg = <0x3580000 0x400000>; + read-only; + }; + + partition@3980000 { + label = "storage"; + reg = <0x3980000 0x680000>; + read-only; + }; + + fwconcat1: partition@4000000 { + label = "fwconcat1"; + reg = <0x4000000 0x3800000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + mediatek,disable-radar-background; + }; +}; + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + gpio-controller; + #gpio-cells = <2>; + + ports { + port@0 { + status = "okay"; + label = "lan"; + }; + }; +}; + +&state_default { + gpio { + groups = "uart2"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index cbcf67c2363..2269833e480 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -478,6 +478,27 @@ define Device/cudy_x6 endef TARGET_DEVICES += cudy_x6 +define Device/dlink_dap-x1860-a1 + $(Device/dsa-migration) + IMAGE_SIZE := 53248k + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DAP-X1860 + DEVICE_VARIANT := A1 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 8192k + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += factory.bin + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ + check-size | elx-header 011b0060 8844A2D168B45A2D + DEVICE_PACKAGES := kmod-mt7915-firmware rssileds +endef +TARGET_DEVICES += dlink_dap-x1860-a1 + define Device/dlink_dir-8xx-a1 $(Device/dsa-migration) IMAGE_SIZE := 16000k 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 9e0eaac9412..5fafb9b50a9 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 @@ -56,6 +56,13 @@ jcg,y2|\ xzwifi,creativebox-v1) ucidef_set_led_netdev "internet" "internet" "blue:internet" "wan" ;; +dlink,dap-x1860-a1) + ucidef_set_rssimon "wlan1" "200000" "1" + ucidef_set_led_rssi "rssilow" "RSSILOW" "orange:rssilow" "wlan1" "1" "25" + ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "green:rssilow" "wlan1" "26" "100" + ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "green:rssimedium" "wlan1" "51" "100" + ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan1" "76" "100" + ;; dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ dlink,dir-2660-a1) 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 dea433dec42..9a8e385a31c 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 @@ -11,6 +11,7 @@ ramips_setup_interfaces() ampedwireless,ally-00x19k|\ asus,rp-ac56|\ asus,rp-ac87|\ + dlink,dap-x1860-a1|\ edimax,re23s|\ mikrotik,ltap-2hnd|\ mikrotik,routerboard-m11g|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 69ecaefd27c..161bd942db8 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -22,6 +22,13 @@ case "$board" in hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" macaddr_add $hw_mac_addr "$PHYNBR" > /sys${DEVPATH}/macaddress ;; + dlink,dap-x1860-a1) + hw_mac_addr="$(mtd_get_mac_binary factory 0x4)" + [ "$PHYNBR" = "0" ] && \ + macaddr_add $hw_mac_addr 1 > /sys${DEVPATH}/macaddress + [ "$PHYNBR" = "1" ] && \ + macaddr_add $hw_mac_addr 4 > /sys${DEVPATH}/macaddress + ;; dlink,dir-853-a3) [ "$PHYNBR" = "0" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary factory 0xe000)" \ diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index fd856e6b3ac..53ff9c016c3 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -59,6 +59,7 @@ platform_do_upgrade() { beeline,smartbox-giga|\ beeline,smartbox-turbo|\ belkin,rt1800|\ + dlink,dap-x1860-a1|\ dlink,dir-1960-a1|\ dlink,dir-2640-a1|\ dlink,dir-2660-a1|\