[rdkb][common][bsp][Refactor and sync kernel from openwrt]
[Description]
5eb1020 [kernel][common][rename patches to match new naming rules]
15fa43c [MAC80211][core][Fix mtk_eth_setup_tc_block panic issue]
54585c8 [kernel][common][eth][Add phylink rate_matching support for the internal 2.5G PHY]
bb46acf [kernel][7988][eth][Adjust MDC/MDIO driving strength]
0cb4a3e [kernel][common][eth][Fix panic issue for the Aquantia heartbeat check thread]
1e37a75 [kernel][mac80211][flowblock: update patch naming]
79b394d [openwrt][update the patches in accordance with the new naming rules]
4796c77 [MAC80211][hnat][Fix patch fail issue]
594f776 [MT7986][Change reserved memory for BL31]
db13165 [kernel][mt7988][eth][mediatek-ge-soc: Add V4.0 hardware patch]
4f17f97 [kernel][common][eth][Fix 1G/2.5G RJ-45 SFP IOT issues]
d7001d5 [kernel][mt7988][i2c][add i2c nodes for i2p5g device tree]
[Release-log]
Change-Id: I930a553e21822590704caec025f49700f928eb3b
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch
deleted file mode 100644
index 3292a6b..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 051e070d0a019df6be9e21be1fb63352e4c4412e Mon Sep 17 00:00:00 2001
-From: YouChing Lin <ycllin@mxic.com.tw>
-Date: Wed, 22 Jul 2020 16:02:57 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add support for MX31LF1GE4BC
-
-The Macronix MX31LF1GE4BC is a 3V, 1Gbit (128MB) serial
-NAND flash device.
-
-Validated by read, erase, read back, write and read back
-on Xilinx Zynq PicoZed FPGA board which included
-Macronix SPI Host (driver/spi/spi-mxic.c).
-
-Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1595404978-31079-2-git-send-email-ycllin@mxic.com.tw
----
- drivers/mtd/nand/spi/macronix.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index 9ff8debd599418..9ae48ce1c46f91 100644
---- a/drivers/mtd/nand/spi/macronix.c
-+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -119,6 +119,16 @@ static const struct spinand_info macronix_spinand_table[] = {
- &update_cache_variants),
- SPINAND_HAS_QE_BIT,
- SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
-+ SPINAND_INFO("MX31LF1GE4BC",
-+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
-+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ 0 /*SPINAND_HAS_QE_BIT*/,
-+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
-+ mx35lf1ge4ab_ecc_get_status)),
- };
-
- static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/431-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/431-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch
deleted file mode 100644
index 9f48d4a..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/431-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 75b049bb7f89a58a25592f17baf91d703f0f548e Mon Sep 17 00:00:00 2001
-From: YouChing Lin <ycllin@mxic.com.tw>
-Date: Wed, 22 Jul 2020 16:02:58 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add support for MX31UF1GE4BC
-
-The Macronix MX31UF1GE4BC is a 1.8V, 1Gbit (128MB) serial
-NAND flash device.
-
-Validated by read, erase, read back, write and read back
-on Xilinx Zynq PicoZed FPGA board which included
-Macronix SPI Host (driver/spi/spi-mxic.c).
-
-Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1595404978-31079-3-git-send-email-ycllin@mxic.com.tw
----
- drivers/mtd/nand/spi/macronix.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index 9ae48ce1c46f91..8e801e4c3a006f 100644
---- a/drivers/mtd/nand/spi/macronix.c
-+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -129,6 +129,16 @@ static const struct spinand_info macronix_spinand_table[] = {
- 0 /*SPINAND_HAS_QE_BIT*/,
- SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
- mx35lf1ge4ab_ecc_get_status)),
-+ SPINAND_INFO("MX31UF1GE4BC",
-+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x9e),
-+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ 0 /*SPINAND_HAS_QE_BIT*/,
-+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
-+ mx35lf1ge4ab_ecc_get_status)),
- };
-
- static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/451-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/451-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch
deleted file mode 100644
index 31141db..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/451-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 8511a3a9937e30949b34bea46c3dc3f65d11034b Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:31 +0100
-Subject: [PATCH] mtd: spinand: micron: Describe the SPI NAND device
- MT29F2G01ABAGD
-
-Add the SPI NAND device MT29F2G01ABAGD series number, size and voltage
-details as a comment.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-3-sshivamurthy@micron.com
----
- drivers/mtd/nand/spi/micron.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index cc1ee68421c8e1..4727933c894bc8 100644
---- a/drivers/mtd/nand/spi/micron.c
-+++ b/drivers/mtd/nand/spi/micron.c
-@@ -91,6 +91,7 @@ static int micron_8_ecc_get_status(struct spinand_device *spinand,
- }
-
- static const struct spinand_info micron_spinand_table[] = {
-+ /* M79A 2Gb 3.3V */
- SPINAND_INFO("MT29F2G01ABAGD",
- SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
- NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/453-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/453-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch
deleted file mode 100644
index 59a4234..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/453-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch
+++ /dev/null
@@ -1,79 +0,0 @@
-From 0bc68af9137dc3f30b161de4ce546c7799f88d1e Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:33 +0100
-Subject: [PATCH] mtd: spinand: micron: identify SPI NAND device with
- Continuous Read mode
-
-Add SPINAND_HAS_CR_FEAT_BIT flag to identify the SPI NAND device with
-the Continuous Read mode.
-
-Some of the Micron SPI NAND devices have the "Continuous Read" feature
-enabled by default, which does not fit the subsystem needs.
-
-In this mode, the READ CACHE command doesn't require the starting column
-address. The device always output the data starting from the first
-column of the cache register, and once the end of the cache register
-reached, the data output continues through the next page. With the
-continuous read mode, it is possible to read out the entire block using
-a single READ command, and once the end of the block reached, the output
-pins become High-Z state. However, during this mode the read command
-doesn't output the OOB area.
-
-Hence, we disable the feature at probe time.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-5-sshivamurthy@micron.com
----
- drivers/mtd/nand/spi/micron.c | 16 ++++++++++++++++
- include/linux/mtd/spinand.h | 1 +
- 2 files changed, 17 insertions(+)
-
-diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index 26925714a9fbac..956f7710aca263 100644
---- a/drivers/mtd/nand/spi/micron.c
-+++ b/drivers/mtd/nand/spi/micron.c
-@@ -18,6 +18,8 @@
- #define MICRON_STATUS_ECC_4TO6_BITFLIPS (3 << 4)
- #define MICRON_STATUS_ECC_7TO8_BITFLIPS (5 << 4)
-
-+#define MICRON_CFG_CR BIT(0)
-+
- static SPINAND_OP_VARIANTS(read_cache_variants,
- SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
- SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
-@@ -137,7 +139,21 @@ static const struct spinand_info micron_spinand_table[] = {
- micron_8_ecc_get_status)),
- };
-
-+static int micron_spinand_init(struct spinand_device *spinand)
-+{
-+ /*
-+ * M70A device series enable Continuous Read feature at Power-up,
-+ * which is not supported. Disable this bit to avoid any possible
-+ * failure.
-+ */
-+ if (spinand->flags & SPINAND_HAS_CR_FEAT_BIT)
-+ return spinand_upd_cfg(spinand, MICRON_CFG_CR, 0);
-+
-+ return 0;
-+}
-+
- static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
-+ .init = micron_spinand_init,
- };
-
- const struct spinand_manufacturer micron_spinand_manufacturer = {
-diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
-index f4c4ae87181b27..1077c45721ff25 100644
---- a/include/linux/mtd/spinand.h
-+++ b/include/linux/mtd/spinand.h
-@@ -284,6 +284,7 @@ struct spinand_ecc_info {
- };
-
- #define SPINAND_HAS_QE_BIT BIT(0)
-+#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
-
- /**
- * struct spinand_info - Structure used to describe SPI NAND chips
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/790-v5.7-iopoll-introduce-read_poll_timeout-macro.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/790-v5.7-iopoll-introduce-read_poll_timeout-macro.patch
deleted file mode 100644
index 26de067..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/790-v5.7-iopoll-introduce-read_poll_timeout-macro.patch
+++ /dev/null
@@ -1,269 +0,0 @@
-From patchwork Mon Mar 23 15:05:51 2020
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Dejin Zheng <zhengdejin5@gmail.com>
-X-Patchwork-Id: 1260097
-X-Patchwork-Delegate: davem@davemloft.net
-Return-Path: <netdev-owner@vger.kernel.org>
-X-Original-To: patchwork-incoming-netdev@ozlabs.org
-Delivered-To: patchwork-incoming-netdev@ozlabs.org
-Authentication-Results: ozlabs.org; spf=none (no SPF record)
- smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67;
- helo=vger.kernel.org;
- envelope-from=netdev-owner@vger.kernel.org;
- receiver=<UNKNOWN>)
-Authentication-Results: ozlabs.org;
- dmarc=pass (p=none dis=none) header.from=gmail.com
-Authentication-Results: ozlabs.org; dkim=pass (2048-bit key;
- unprotected) header.d=gmail.com header.i=@gmail.com
- header.a=rsa-sha256 header.s=20161025 header.b=N1ACwCYl;
- dkim-atps=neutral
-Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
- by ozlabs.org (Postfix) with ESMTP id 48mHlP3Hzhz9sSs
- for <patchwork-incoming-netdev@ozlabs.org>;
- Tue, 24 Mar 2020 02:06:25 +1100 (AEDT)
-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
- id S1727267AbgCWPGW (ORCPT
- <rfc822;patchwork-incoming-netdev@ozlabs.org>);
- Mon, 23 Mar 2020 11:06:22 -0400
-Received: from mail-pj1-f68.google.com ([209.85.216.68]:50286 "EHLO
- mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
- with ESMTP id S1727024AbgCWPGV (ORCPT
- <rfc822;netdev@vger.kernel.org>); Mon, 23 Mar 2020 11:06:21 -0400
-Received: by mail-pj1-f68.google.com with SMTP id v13so6312358pjb.0;
- Mon, 23 Mar 2020 08:06:20 -0700 (PDT)
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
- d=gmail.com; s=20161025;
- h=from:to:cc:subject:date:message-id:in-reply-to:references
- :mime-version:content-transfer-encoding;
- bh=GmXKgcJDZee4jC3cNKHKWCJhJ0kS9L2vONq2fIA+AaY=;
- b=N1ACwCYlon7WkTCOGFsGWeQq6lNeUjbuQa8UGIBK7O82wFqYoTVzGY8MUnU/tEjer9
- AtZt9996i6pDsvhpbunlFffuKPui1YOisSe6Xcn6Ur2AiFvfJr1DMpWE2PdmlLGH2bkH
- /Oiqbikpi9dSUfgFJ7JfIyISqKyP15jsdhhl8xtA30gWb6CuhlhBuWuLV5CqTAZKGWab
- LMFipg2GDKlx0udJoUoNAPi/hcypdWJW8DtamDxwH/OmZk2evJsfhm2MwG/1qAb95nJ0
- rU/60e4BhqadPHfO9cyvgdbR+xcCJkuSIqKWH6utfd9RamZDS2djU3XDWhFW2blmcVLb
- Ue5w==
-X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
- d=1e100.net; s=20161025;
- h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
- :references:mime-version:content-transfer-encoding;
- bh=GmXKgcJDZee4jC3cNKHKWCJhJ0kS9L2vONq2fIA+AaY=;
- b=AwMmzIpdEKD6duSw3Dl9aQkzxRMmPOysumBp0nIE9FvhZJ+67auGBvMa7G80/DyF4x
- BbrwsUrYoDLXs7fuLEjjZgxKwSCtYfWyPDdM/ezShIx9KZIfPiXhn6uH3eXP+g4feJN4
- IlWVwvJMDzRJOhdZVzg934FJeMs4bW7XNm07jKxjsqksHGcw5JoHsP53xNegPbIpNb8X
- h7+AwHXYAKzVC9aGYTA8bgxSD0d+SlO7CJ4nY+lHXcBR266/rt7rDFOwCdv9TUUAMCkY
- rXrgSb8vThpKY/wZ8rK3SyJcPdvDt6TnmdZO7LqTbbzAHjzJml7s+5vYhk3CSOvjGTHt
- KcMA==
-X-Gm-Message-State: ANhLgQ1lOBl50y5dc6fz/BIFJrpgXnM0GF/1DvoZm8oJbZIt2H9n38WA
- pBi6LVse2n2Ed5tvz68N8x8=
-X-Google-Smtp-Source:
- ADFU+vtPoQt/0UFiy7Bq0L9uIMvQbBOJzH8+jTojBCcjj2V26XqJvxqSMSsy9g8ZZ96F/Q8I4cpXYw==
-X-Received: by 2002:a17:902:9a09:: with SMTP id
- v9mr21358610plp.341.1584975980336;
- Mon, 23 Mar 2020 08:06:20 -0700 (PDT)
-Received: from localhost (176.122.158.203.16clouds.com. [176.122.158.203])
- by smtp.gmail.com with ESMTPSA id
- j19sm13485589pfe.102.2020.03.23.08.06.19
- (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
- Mon, 23 Mar 2020 08:06:19 -0700 (PDT)
-From: Dejin Zheng <zhengdejin5@gmail.com>
-To: andrew@lunn.ch, f.fainelli@gmail.com, hkallweit1@gmail.com,
- linux@armlinux.org.uk, davem@davemloft.net, corbet@lwn.net,
- tglx@linutronix.de, gregkh@linuxfoundation.org,
- allison@lohutok.net, mchehab+samsung@kernel.org, netdev@vger.kernel.org
-Cc: linux-kernel@vger.kernel.org, Dejin Zheng <zhengdejin5@gmail.com>
-Subject: [PATCH net-next v7 01/10] iopoll: introduce read_poll_timeout macro
-Date: Mon, 23 Mar 2020 23:05:51 +0800
-Message-Id: <20200323150600.21382-2-zhengdejin5@gmail.com>
-X-Mailer: git-send-email 2.25.0
-In-Reply-To: <20200323150600.21382-1-zhengdejin5@gmail.com>
-References: <20200323150600.21382-1-zhengdejin5@gmail.com>
-MIME-Version: 1.0
-Sender: netdev-owner@vger.kernel.org
-Precedence: bulk
-List-ID: <netdev.vger.kernel.org>
-X-Mailing-List: netdev@vger.kernel.org
-
-this macro is an extension of readx_poll_timeout macro. the accessor
-function op just supports only one parameter in the readx_poll_timeout
-macro, but this macro can supports multiple variable parameters for
-it. so functions like phy_read(struct phy_device *phydev, u32 regnum)
-and phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum) can
-also use this poll timeout core. and also expand it can sleep some time
-before read operation.
-
-Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
----
-v6 -> v7:
- - add a parameter sleep_before_read to support that it can sleep
- some time before read operation in read_poll_timeout macro.
-v5 -> v6:
- - no changed
-v4 -> v5:
- - no changed
-v3 -> v4:
- - no changed
-v2 -> v3:
- - no changed
-v1 -> v2:
- - no changed
-
- include/linux/iopoll.h | 44 ++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 44 insertions(+)
-
---- a/include/linux/iopoll.h
-+++ b/include/linux/iopoll.h
-@@ -14,36 +14,41 @@
- #include <linux/io.h>
-
- /**
-- * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
-- * @op: accessor function (takes @addr as its only argument)
-- * @addr: Address to poll
-+ * read_poll_timeout - Periodically poll an address until a condition is
-+ * met or a timeout occurs
-+ * @op: accessor function (takes @args as its arguments)
- * @val: Variable to read the value into
- * @cond: Break condition (usually involving @val)
- * @sleep_us: Maximum time to sleep between reads in us (0
- * tight-loops). Should be less than ~20ms since usleep_range
- * is used (see Documentation/timers/timers-howto.rst).
- * @timeout_us: Timeout in us, 0 means never timeout
-+ * @sleep_before_read: if it is true, sleep @sleep_us before read.
-+ * @args: arguments for @op poll
- *
- * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
-- * case, the last read value at @addr is stored in @val. Must not
-+ * case, the last read value at @args is stored in @val. Must not
- * be called from atomic context if sleep_us or timeout_us are used.
- *
- * When available, you'll probably want to use one of the specialized
- * macros defined below rather than this macro directly.
- */
--#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
-+#define read_poll_timeout(op, val, cond, sleep_us, timeout_us, \
-+ sleep_before_read, args...) \
- ({ \
- u64 __timeout_us = (timeout_us); \
- unsigned long __sleep_us = (sleep_us); \
- ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
- might_sleep_if((__sleep_us) != 0); \
-+ if (sleep_before_read && __sleep_us) \
-+ usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
- for (;;) { \
-- (val) = op(addr); \
-+ (val) = op(args); \
- if (cond) \
- break; \
- if (__timeout_us && \
- ktime_compare(ktime_get(), __timeout) > 0) { \
-- (val) = op(addr); \
-+ (val) = op(args); \
- break; \
- } \
- if (__sleep_us) \
-@@ -53,6 +58,27 @@
- })
-
- /**
-+ * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
-+ * @op: accessor function (takes @addr as its only argument)
-+ * @addr: Address to poll
-+ * @val: Variable to read the value into
-+ * @cond: Break condition (usually involving @val)
-+ * @sleep_us: Maximum time to sleep between reads in us (0
-+ * tight-loops). Should be less than ~20ms since usleep_range
-+ * is used (see Documentation/timers/timers-howto.rst).
-+ * @timeout_us: Timeout in us, 0 means never timeout
-+ *
-+ * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
-+ * case, the last read value at @addr is stored in @val. Must not
-+ * be called from atomic context if sleep_us or timeout_us are used.
-+ *
-+ * When available, you'll probably want to use one of the specialized
-+ * macros defined below rather than this macro directly.
-+ */
-+#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
-+ read_poll_timeout(op, val, cond, sleep_us, timeout_us, false, addr)
-+
-+/**
- * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
- * @op: accessor function (takes @addr as its only argument)
- * @addr: Address to poll
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -21,6 +21,7 @@
- #include <linux/timer.h>
- #include <linux/workqueue.h>
- #include <linux/mod_devicetable.h>
-+#include <linux/iopoll.h>
-
- #include <linux/atomic.h>
-
-@@ -714,6 +715,19 @@ static inline int phy_read(struct phy_de
- return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
- }
-
-+#define phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \
-+ timeout_us, sleep_before_read) \
-+({ \
-+ int __ret = read_poll_timeout(phy_read, val, (cond) || val < 0, \
-+ sleep_us, timeout_us, sleep_before_read, phydev, regnum); \
-+ if (val < 0) \
-+ __ret = val; \
-+ if (__ret) \
-+ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
-+ __ret; \
-+})
-+
-+
- /**
- * __phy_read - convenience function for reading a given PHY register
- * @phydev: the phy_device struct
-@@ -766,6 +780,19 @@ static inline int __phy_write(struct phy
- */
- int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
-
-+#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \
-+ sleep_us, timeout_us, sleep_before_read) \
-+({ \
-+ int __ret = read_poll_timeout(phy_read_mmd, val, (cond) || val < 0, \
-+ sleep_us, timeout_us, sleep_before_read, \
-+ phydev, devaddr, regnum); \
-+ if (val < 0) \
-+ __ret = val; \
-+ if (__ret) \
-+ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
-+ __ret; \
-+})
-+
- /**
- * __phy_read_mmd - Convenience function for reading a register
- * from an MMD on a given PHY.
---- a/drivers/net/phy/phy_device.c
-+++ b/drivers/net/phy/phy_device.c
-@@ -1056,18 +1056,12 @@ EXPORT_SYMBOL(phy_disconnect);
- static int phy_poll_reset(struct phy_device *phydev)
- {
- /* Poll until the reset bit clears (50ms per retry == 0.6 sec) */
-- unsigned int retries = 12;
-- int ret;
--
-- do {
-- msleep(50);
-- ret = phy_read(phydev, MII_BMCR);
-- if (ret < 0)
-- return ret;
-- } while (ret & BMCR_RESET && --retries);
-- if (ret & BMCR_RESET)
-- return -ETIMEDOUT;
-+ int ret, val;
-
-+ ret = phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET),
-+ 50000, 600000, true);
-+ if (ret)
-+ return ret;
- /* Some chips (smsc911x) may still need up to another 1ms after the
- * BMCR_RESET bit is cleared before they are usable.
- */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/792-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/792-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
deleted file mode 100644
index 39b29ad..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/792-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
+++ /dev/null
@@ -1,109 +0,0 @@
-From patchwork Tue Jun 23 14:30:07 2020
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Antoine Tenart <antoine.tenart@bootlin.com>
-X-Patchwork-Id: 1315292
-X-Patchwork-Delegate: davem@davemloft.net
-Return-Path: <netdev-owner@vger.kernel.org>
-X-Original-To: patchwork-incoming-netdev@ozlabs.org
-Delivered-To: patchwork-incoming-netdev@ozlabs.org
-Authentication-Results: ozlabs.org;
- spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org
- (client-ip=23.128.96.18; helo=vger.kernel.org;
- envelope-from=netdev-owner@vger.kernel.org; receiver=<UNKNOWN>)
-Authentication-Results: ozlabs.org;
- dmarc=none (p=none dis=none) header.from=bootlin.com
-Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
- by ozlabs.org (Postfix) with ESMTP id 49rpjP0BTdz9sRN
- for <patchwork-incoming-netdev@ozlabs.org>;
- Wed, 24 Jun 2020 00:35:37 +1000 (AEST)
-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
- id S1732957AbgFWOf1 (ORCPT
- <rfc822;patchwork-incoming-netdev@ozlabs.org>);
- Tue, 23 Jun 2020 10:35:27 -0400
-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:35381 "EHLO
- relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
- with ESMTP id S1732900AbgFWOfX (ORCPT
- <rfc822;netdev@vger.kernel.org>); Tue, 23 Jun 2020 10:35:23 -0400
-X-Originating-IP: 90.76.143.236
-Received: from localhost (lfbn-tou-1-1075-236.w90-76.abo.wanadoo.fr
- [90.76.143.236])
- (Authenticated sender: antoine.tenart@bootlin.com)
- by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 38BE860006;
- Tue, 23 Jun 2020 14:35:19 +0000 (UTC)
-From: Antoine Tenart <antoine.tenart@bootlin.com>
-To: davem@davemloft.net, andrew@lunn.ch, f.fainelli@gmail.com,
- hkallweit1@gmail.com, richardcochran@gmail.com,
- alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com
-Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
- thomas.petazzoni@bootlin.com, allan.nielsen@microchip.com,
- foss@0leil.net, antoine.tenart@bootlin.com
-Subject: [PATCH net-next v4 1/8] net: phy: add support for a common probe
- between shared PHYs
-Date: Tue, 23 Jun 2020 16:30:07 +0200
-Message-Id: <20200623143014.47864-2-antoine.tenart@bootlin.com>
-X-Mailer: git-send-email 2.26.2
-In-Reply-To: <20200623143014.47864-1-antoine.tenart@bootlin.com>
-References: <20200623143014.47864-1-antoine.tenart@bootlin.com>
-MIME-Version: 1.0
-Sender: netdev-owner@vger.kernel.org
-Precedence: bulk
-List-ID: <netdev.vger.kernel.org>
-X-Mailing-List: netdev@vger.kernel.org
-
-Shared PHYs (PHYs in the same hardware package) may have shared
-registers and their drivers would usually need to share information.
-There is currently a way to have a shared (part of the) init, by using
-phy_package_init_once(). This patch extends the logic to share parts of
-the probe to allow sharing the initialization of locks or resources
-retrieval.
-
-Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
----
- include/linux/phy.h | 18 +++++++++++++++---
- 1 file changed, 15 insertions(+), 3 deletions(-)
-
-diff --git a/include/linux/phy.h b/include/linux/phy.h
-index 9248dd2ce4ca..457489f1951c 100644
---- a/include/linux/phy.h
-+++ b/include/linux/phy.h
-@@ -244,7 +244,8 @@ struct phy_package_shared {
- };
-
- /* used as bit number in atomic bitops */
--#define PHY_SHARED_F_INIT_DONE 0
-+#define PHY_SHARED_F_INIT_DONE 0
-+#define PHY_SHARED_F_PROBE_DONE 1
-
- /*
- * The Bus class for PHYs. Devices which provide access to
-@@ -1558,14 +1559,25 @@ static inline int __phy_package_write(struct phy_device *phydev,
- return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val);
- }
-
--static inline bool phy_package_init_once(struct phy_device *phydev)
-+static inline bool __phy_package_set_once(struct phy_device *phydev,
-+ unsigned int b)
- {
- struct phy_package_shared *shared = phydev->shared;
-
- if (!shared)
- return false;
-
-- return !test_and_set_bit(PHY_SHARED_F_INIT_DONE, &shared->flags);
-+ return !test_and_set_bit(b, &shared->flags);
-+}
-+
-+static inline bool phy_package_init_once(struct phy_device *phydev)
-+{
-+ return __phy_package_set_once(phydev, PHY_SHARED_F_INIT_DONE);
-+}
-+
-+static inline bool phy_package_probe_once(struct phy_device *phydev)
-+{
-+ return __phy_package_set_once(phydev, PHY_SHARED_F_PROBE_DONE);
- }
-
- extern struct bus_type mdio_bus_type;
\ No newline at end of file
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/408-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2310-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/408-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2310-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
index e4e283c..f9c3542 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/408-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2310-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
@@ -1,3 +1,22 @@
+From 0aeb63ff705a42b9140cad179ebe7f5fc54d285c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:09 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2310-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch]
+
+---
+ drivers/mtd/nand/spi/core.c | 86 ++++++++++++++++++++++---------
+ drivers/mtd/nand/spi/gigadevice.c | 45 +++++-----------
+ drivers/mtd/nand/spi/macronix.c | 30 +++--------
+ drivers/mtd/nand/spi/micron.c | 26 ++--------
+ drivers/mtd/nand/spi/paragon.c | 28 +++-------
+ drivers/mtd/nand/spi/toshiba.c | 42 +++++----------
+ drivers/mtd/nand/spi/winbond.c | 34 +++---------
+ include/linux/mtd/spinand.h | 66 ++++++++++++++++--------
+ 8 files changed, 155 insertions(+), 202 deletions(-)
+
+diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
+index 55e636efc..9f5f95ff7 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -16,6 +16,7 @@
@@ -23,7 +42,7 @@
int ret;
ret = spi_mem_exec_op(spinand->spimem, &op);
-@@ -760,24 +762,62 @@ static const struct spinand_manufacturer
+@@ -760,24 +762,62 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = {
&winbond_spinand_manufacturer,
};
@@ -95,7 +114,7 @@
static int spinand_manufacturer_init(struct spinand_device *spinand)
{
if (spinand->manufacturer->ops->init)
-@@ -833,9 +873,9 @@ spinand_select_op_variant(struct spinand
+@@ -833,9 +873,9 @@ spinand_select_op_variant(struct spinand_device *spinand,
* @spinand: SPI NAND object
* @table: SPI NAND device description table
* @table_size: size of the device description table
@@ -107,7 +126,7 @@
* entry in the SPI NAND description table. If a match is found, the spinand
* object will be initialized with information provided by the matching
* spinand_info entry.
-@@ -844,8 +884,10 @@ spinand_select_op_variant(struct spinand
+@@ -844,8 +884,10 @@ spinand_select_op_variant(struct spinand_device *spinand,
*/
int spinand_match_and_init(struct spinand_device *spinand,
const struct spinand_info *table,
@@ -119,7 +138,7 @@
struct nand_device *nand = spinand_to_nand(spinand);
unsigned int i;
-@@ -853,13 +895,17 @@ int spinand_match_and_init(struct spinan
+@@ -853,13 +895,17 @@ int spinand_match_and_init(struct spinand_device *spinand,
const struct spinand_info *info = &table[i];
const struct spi_mem_op *op;
@@ -138,7 +157,7 @@
spinand->select_target = table[i].select_target;
op = spinand_select_op_variant(spinand,
-@@ -896,13 +942,7 @@ static int spinand_detect(struct spinand
+@@ -896,13 +942,7 @@ static int spinand_detect(struct spinand_device *spinand)
if (ret)
return ret;
@@ -153,9 +172,11 @@
if (ret) {
dev_err(dev, "unknown raw ID %*phN\n", SPINAND_MAX_ID_LEN,
spinand->id.data);
+diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
+index b13b39763..a34c5ede1 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -195,7 +195,8 @@ static int gd5fxgq4ufxxg_ecc_get_status(
+@@ -195,7 +195,8 @@ static int gd5fxgq4ufxxg_ecc_get_status(struct spinand_device *spinand,
}
static const struct spinand_info gigadevice_spinand_table[] = {
@@ -165,7 +186,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -204,7 +205,8 @@ static const struct spinand_info gigadev
+@@ -204,7 +205,8 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
gd5fxgq4xa_ecc_get_status)),
@@ -175,7 +196,7 @@
NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -213,7 +215,8 @@ static const struct spinand_info gigadev
+@@ -213,7 +215,8 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
gd5fxgq4xa_ecc_get_status)),
@@ -185,7 +206,7 @@
NAND_MEMORG(1, 2048, 64, 64, 4096, 80, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -222,7 +225,8 @@ static const struct spinand_info gigadev
+@@ -222,7 +225,8 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
gd5fxgq4xa_ecc_get_status)),
@@ -195,7 +216,7 @@
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -231,7 +235,8 @@ static const struct spinand_info gigadev
+@@ -231,7 +235,8 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&gd5fxgq4_variant2_ooblayout,
gd5fxgq4uexxg_ecc_get_status)),
@@ -205,7 +226,7 @@
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f,
-@@ -242,39 +247,13 @@ static const struct spinand_info gigadev
+@@ -242,39 +247,13 @@ static const struct spinand_info gigadevice_spinand_table[] = {
gd5fxgq4ufxxg_ecc_get_status)),
};
@@ -247,9 +268,11 @@
+ .nchips = ARRAY_SIZE(gigadevice_spinand_table),
.ops = &gigadevice_spinand_manuf_ops,
};
+diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
+index 21def3f8f..0f900f3aa 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -99,7 +99,8 @@ static int mx35lf1ge4ab_ecc_get_status(s
+@@ -99,7 +99,8 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
}
static const struct spinand_info macronix_spinand_table[] = {
@@ -259,7 +282,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(4, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -108,7 +109,8 @@ static const struct spinand_info macroni
+@@ -108,7 +109,8 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
@@ -269,7 +292,7 @@
NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 2, 1, 1),
NAND_ECCREQ(4, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -118,33 +120,13 @@ static const struct spinand_info macroni
+@@ -118,33 +120,13 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
};
@@ -305,9 +328,11 @@
+ .nchips = ARRAY_SIZE(macronix_spinand_table),
.ops = ¯onix_spinand_manuf_ops,
};
+diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
+index 7d7b1f7fc..f56f81325 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
-@@ -91,7 +91,8 @@ static int mt29f2g01abagd_ecc_get_status
+@@ -91,7 +91,8 @@ static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
}
static const struct spinand_info micron_spinand_table[] = {
@@ -317,7 +342,7 @@
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -102,32 +103,13 @@ static const struct spinand_info micron_
+@@ -102,32 +103,13 @@ static const struct spinand_info micron_spinand_table[] = {
mt29f2g01abagd_ecc_get_status)),
};
@@ -352,9 +377,11 @@
+ .nchips = ARRAY_SIZE(micron_spinand_table),
.ops = µn_spinand_manuf_ops,
};
+diff --git a/drivers/mtd/nand/spi/paragon.c b/drivers/mtd/nand/spi/paragon.c
+index 52307681c..519ade513 100644
--- a/drivers/mtd/nand/spi/paragon.c
+++ b/drivers/mtd/nand/spi/paragon.c
-@@ -97,7 +97,8 @@ static const struct mtd_ooblayout_ops pn
+@@ -97,7 +97,8 @@ static const struct mtd_ooblayout_ops pn26g0xa_ooblayout = {
static const struct spinand_info paragon_spinand_table[] = {
@@ -364,7 +391,7 @@
NAND_MEMORG(1, 2048, 128, 64, 1024, 21, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -106,7 +107,8 @@ static const struct spinand_info paragon
+@@ -106,7 +107,8 @@ static const struct spinand_info paragon_spinand_table[] = {
0,
SPINAND_ECCINFO(&pn26g0xa_ooblayout,
pn26g0xa_ecc_get_status)),
@@ -374,7 +401,7 @@
NAND_MEMORG(1, 2048, 128, 64, 2048, 41, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -117,31 +119,13 @@ static const struct spinand_info paragon
+@@ -117,31 +119,13 @@ static const struct spinand_info paragon_spinand_table[] = {
pn26g0xa_ecc_get_status)),
};
@@ -408,9 +435,11 @@
+ .nchips = ARRAY_SIZE(paragon_spinand_table),
.ops = ¶gon_spinand_manuf_ops,
};
+diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
+index 1cb3760ff..35da3c6e9 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
-@@ -95,7 +95,8 @@ static int tc58cxgxsx_ecc_get_status(str
+@@ -95,7 +95,8 @@ static int tc58cxgxsx_ecc_get_status(struct spinand_device *spinand,
static const struct spinand_info toshiba_spinand_table[] = {
/* 3.3V 1Gb */
@@ -420,7 +449,7 @@
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -105,7 +106,8 @@ static const struct spinand_info toshiba
+@@ -105,7 +106,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
tc58cxgxsx_ecc_get_status)),
/* 3.3V 2Gb */
@@ -430,7 +459,7 @@
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -115,7 +117,8 @@ static const struct spinand_info toshiba
+@@ -115,7 +117,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
tc58cxgxsx_ecc_get_status)),
/* 3.3V 4Gb */
@@ -440,7 +469,7 @@
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -125,7 +128,8 @@ static const struct spinand_info toshiba
+@@ -125,7 +128,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
tc58cxgxsx_ecc_get_status)),
/* 1.8V 1Gb */
@@ -450,7 +479,7 @@
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -135,7 +139,8 @@ static const struct spinand_info toshiba
+@@ -135,7 +139,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
tc58cxgxsx_ecc_get_status)),
/* 1.8V 2Gb */
@@ -460,7 +489,7 @@
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -145,7 +150,8 @@ static const struct spinand_info toshiba
+@@ -145,7 +150,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
tc58cxgxsx_ecc_get_status)),
/* 1.8V 4Gb */
@@ -470,7 +499,7 @@
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -156,33 +162,13 @@ static const struct spinand_info toshiba
+@@ -156,33 +162,13 @@ static const struct spinand_info toshiba_spinand_table[] = {
tc58cxgxsx_ecc_get_status)),
};
@@ -506,9 +535,11 @@
+ .nchips = ARRAY_SIZE(toshiba_spinand_table),
.ops = &toshiba_spinand_manuf_ops,
};
+diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
+index a6c17e0ca..766844283 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
-@@ -75,7 +75,8 @@ static int w25m02gv_select_target(struct
+@@ -75,7 +75,8 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
}
static const struct spinand_info winbond_spinand_table[] = {
@@ -518,7 +549,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 2),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -84,7 +85,8 @@ static const struct spinand_info winbond
+@@ -84,7 +85,8 @@ static const struct spinand_info winbond_spinand_table[] = {
0,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
SPINAND_SELECT_TARGET(w25m02gv_select_target)),
@@ -528,7 +559,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -94,31 +96,6 @@ static const struct spinand_info winbond
+@@ -94,31 +96,6 @@ static const struct spinand_info winbond_spinand_table[] = {
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
};
@@ -560,7 +591,7 @@
static int winbond_spinand_init(struct spinand_device *spinand)
{
struct nand_device *nand = spinand_to_nand(spinand);
-@@ -138,12 +115,13 @@ static int winbond_spinand_init(struct s
+@@ -138,12 +115,13 @@ static int winbond_spinand_init(struct spinand_device *spinand)
}
static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
@@ -575,6 +606,8 @@
+ .nchips = ARRAY_SIZE(winbond_spinand_table),
.ops = &winbond_spinand_manuf_ops,
};
+diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
+index 4ea558bd3..f4c4ae871 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -32,9 +32,9 @@
@@ -693,7 +726,7 @@
#define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \
{ \
.read_cache = __read, \
-@@ -451,9 +472,10 @@ static inline void spinand_set_of_node(s
+@@ -451,9 +472,10 @@ static inline void spinand_set_of_node(struct spinand_device *spinand,
nanddev_set_of_node(&spinand->base, np);
}
@@ -706,3 +739,6 @@
int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
int spinand_select_target(struct spinand_device *spinand, unsigned int target);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2311-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
similarity index 66%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2311-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
index d4e9497..e3e81e5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2311-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
@@ -1,48 +1,15 @@
-From 469b992489852b500d39048aa0013639dfe9f2e6 Mon Sep 17 00:00:00 2001
-From: Reto Schneider <reto.schneider@husqvarnagroup.com>
-Date: Thu, 11 Feb 2021 12:36:19 +0100
-Subject: [PATCH] mtd: spinand: gigadevice: Support GD5F1GQ5UExxG
+From 2f8ed664925318dacb6a92ca6383b5589cc2f7e1 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:09 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2311-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch]
-The relevant changes to the already existing GD5F1GQ4UExxG support has
-been determined by consulting the GigaDevice product change notice
-AN-0392-10, version 1.0 from November 30, 2020.
-
-As the overlaps are huge, variable names have been generalized
-accordingly.
-
-Apart from the lowered ECC strength (4 instead of 8 bits per 512 bytes),
-the new device ID, and the extra quad IO dummy byte, no changes had to
-be taken into account.
-
-New hardware features are not supported, namely:
- - Power on reset
- - Unique ID
- - Double transfer rate (DTR)
- - Parameter page
- - Random data quad IO
-
-The inverted semantic of the "driver strength" register bits, defaulting
-to 100% instead of 50% for the Q5 devices, got ignored as the driver has
-never touched them anyway.
-
-The no longer supported "read from cache during block erase"
-functionality is not reflected as the current SPI NAND core does not
-support it anyway.
-
-Implementation has been tested on MediaTek MT7688 based GARDENA smart
-Gateways using both, GigaDevice GD5F1GQ5UEYIG and GD5F1GQ4UBYIG.
-
-Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
-Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
-Reviewed-by: Stefan Roese <sr@denx.de>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20210211113619.3502-1-code@reto-schneider.ch
---
drivers/mtd/nand/spi/gigadevice.c | 69 +++++++++++++++++++++++++++----
1 file changed, 60 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
-index 33c67403c4aa1e..1dd1c589809341 100644
+index a34c5ede1..937a04ce6 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
@@ -13,7 +13,10 @@
@@ -75,7 +42,7 @@
struct mtd_oob_region *region)
{
if (section)
-@@ -127,9 +130,10 @@ static int gd5fxgq4_variant2_ooblayout_free(struct mtd_info *mtd, int section,
+@@ -127,16 +130,17 @@ static int gd5fxgq4_variant2_ooblayout_free(struct mtd_info *mtd, int section,
return 0;
}
@@ -88,8 +55,7 @@
+ .free = gd5fxgqx_variant2_ooblayout_free,
};
- static int gd5fxgq4xc_ooblayout_256_ecc(struct mtd_info *mtd, int section,
-@@ -165,7 +169,7 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
+ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
u8 status)
{
u8 status2;
@@ -98,7 +64,7 @@
&status2);
int ret;
-@@ -203,6 +207,43 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
+@@ -174,6 +178,43 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
return -EINVAL;
}
@@ -142,7 +108,7 @@
static int gd5fxgq4ufxxg_ecc_get_status(struct spinand_device *spinand,
u8 status)
{
-@@ -282,7 +323,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
+@@ -233,7 +274,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
@@ -151,7 +117,7 @@
gd5fxgq4uexxg_ecc_get_status)),
SPINAND_INFO("GD5F1GQ4UFxxG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE, 0xb1, 0x48),
-@@ -292,8 +333,18 @@ static const struct spinand_info gigadevice_spinand_table[] = {
+@@ -243,8 +284,18 @@ static const struct spinand_info gigadevice_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
@@ -171,3 +137,6 @@
};
static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2312-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2312-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch
new file mode 100644
index 0000000..d55e946
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2312-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch
@@ -0,0 +1,34 @@
+From 9c8aa0697168dac0ad3638dc075c25087d4ee19c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:10 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2312-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch]
+
+---
+ drivers/mtd/nand/spi/macronix.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
+index 0f900f3aa..6e66d8710 100644
+--- a/drivers/mtd/nand/spi/macronix.c
++++ b/drivers/mtd/nand/spi/macronix.c
+@@ -118,6 +118,16 @@ static const struct spinand_info macronix_spinand_table[] = {
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
++ SPINAND_INFO("MX31LF1GE4BC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0 /*SPINAND_HAS_QE_BIT*/,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2313-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2313-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch
new file mode 100644
index 0000000..8dcf798
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2313-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch
@@ -0,0 +1,34 @@
+From 34485df92908238e8603d2c9de486e7c41db45fb Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:10 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2313-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch]
+
+---
+ drivers/mtd/nand/spi/macronix.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
+index 6e66d8710..4964fe35b 100644
+--- a/drivers/mtd/nand/spi/macronix.c
++++ b/drivers/mtd/nand/spi/macronix.c
+@@ -128,6 +128,16 @@ static const struct spinand_info macronix_spinand_table[] = {
+ 0 /*SPINAND_HAS_QE_BIT*/,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX31UF1GE4BC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x9e),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0 /*SPINAND_HAS_QE_BIT*/,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2314-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
similarity index 63%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2314-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
index 313b373..eaa9851 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2314-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
@@ -1,27 +1,18 @@
-From 5ece78de88739b4c68263e9f2582380c1fd8314f Mon Sep 17 00:00:00 2001
-From: YouChing Lin <ycllin@mxic.com.tw>
-Date: Thu, 5 Nov 2020 15:23:40 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add support for MX35LFxGE4AD
+From 14f6824f11e1167bf2cbbd650cd6a7a2ad856555 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:10 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2314-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch]
-The Macronix MX35LF2GE4AD / MX35LF4GE4AD are 3V, 2G / 4Gbit serial
-SLC NAND flash device (with on-die ECC).
-
-Validated by read, erase, read back, write, read back and nandtest
-on Xilinx Zynq PicoZed FPGA board which included Macronix SPI Host
-(drivers/spi/spi-mxic.c).
-
-Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1604561020-13499-1-git-send-email-ycllin@mxic.com.tw
---
drivers/mtd/nand/spi/macronix.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index 8e801e4c3a006f..3786b1b03b3b4b 100644
+index 4964fe35b..16d2acafb 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -119,6 +119,26 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -118,6 +118,26 @@ static const struct spinand_info macronix_spinand_table[] = {
&update_cache_variants),
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
@@ -48,3 +39,6 @@
SPINAND_INFO("MX31LF1GE4BC",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2315-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
similarity index 64%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2315-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
index e323a53..41b540c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2315-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
@@ -1,28 +1,18 @@
-From ee4e0eafa43cfd9008722fe15e17b8bf62fb6e8d Mon Sep 17 00:00:00 2001
-From: YouChing Lin <ycllin@mxic.com.tw>
-Date: Thu, 10 Dec 2020 11:22:09 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add support for MX35LFxG24AD
+From 1de538322f8e3b2586d5b41bdcc0383ecba9ce32 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:10 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2315-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch]
-The Macronix MX35LF1G24AD(/2G24AD/4G24AD) are 3V, 1G/2G/4Gbit serial
-SLC NAND flash device (without on-die ECC).
-
-Validated by read, erase, read back, write, read back on Xilinx Zynq
-PicoZed FPGA board which included Macronix SPI Host(drivers/spi/spi-mxic.c)
-& S/W BCH ecc(drivers/mtd/nand/ecc-sw-bch.c) with bug fixing patch
-(mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of the BCH).
-
-Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1607570529-22341-3-git-send-email-ycllin@mxic.com.tw
---
drivers/mtd/nand/spi/macronix.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index 3786b1b03b3b4b..6701aaa21a49df 100644
+index 16d2acafb..e0c71c654 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -139,6 +139,33 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -138,6 +138,33 @@ static const struct spinand_info macronix_spinand_table[] = {
0,
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
@@ -56,3 +46,6 @@
SPINAND_INFO("MX31LF1GE4BC",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2316-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
similarity index 72%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2316-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
index 9900084..fbcca17 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2316-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
@@ -1,55 +1,18 @@
-From c374839f9b4475173e536d1eaddff45cb481dbdf Mon Sep 17 00:00:00 2001
-From: Jaime Liao <jaimeliao@mxic.com.tw>
-Date: Thu, 20 May 2021 09:45:08 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add support for serial NAND flash
+From 3b7dc97f2ff2d354c7f624d4d04fd5dd8595c923 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:11 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2316-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch]
-Macronix NAND Flash devices are available in different configurations
-and densities.
-
-MX"35" means SPI NAND
-MX35"LF"/"UF" , LF means 3V and UF meands 1.8V
-MX35LF"2G" , 2G means 2Gbits
-MX35LF2G"E4"/"24"/"14",
-E4 means internal ECC and Quad I/O(x4)
-24 means 8-bit ecc requirement and Quad I/O(x4)
-14 means 4-bit ecc requirement and Quad I/O(x4)
-
-MX35LF2G14AC is 3V 2Gbit serial NAND flash device
-(without on-die ECC)
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/7926/MX35LF2G14AC,%203V,%202Gb,%20v1.1.pdf
-
-MX35UF4G24AD is 1.8V 4Gbit serial NAND flash device
-(without on-die ECC)
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/7980/MX35UF4G24AD,%201.8V,%204Gb,%20v0.00.pdf
-
-MX35UF4GE4AD/MX35UF2GE4AD are 1.8V 4G/2Gbit serial
-NAND flash device with 8-bit on-die ECC
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/7983/MX35UF4GE4AD,%201.8V,%204Gb,%20v0.00.pdf
-
-MX35UF2GE4AC/MX35UF1GE4AC are 1.8V 2G/1Gbit serial
-NAND flash device with 8-bit on-die ECC
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/7974/MX35UF2GE4AC,%201.8V,%202Gb,%20v1.0.pdf
-
-MX35UF2G14AC/MX35UF1G14AC are 1.8V 2G/1Gbit serial
-NAND flash device (without on-die ECC)
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/7931/MX35UF2G14AC,%201.8V,%202Gb,%20v1.1.pdf
-
-Validated via normal(default) and QUAD mode by read, erase, read back,
-on Xilinx Zynq PicoZed FPGA board which included Macronix
-SPI Host(drivers/spi/spi-mxic.c).
-
-Signed-off-by: Jaime Liao <jaimeliao@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1621475108-22523-1-git-send-email-jaimeliao@mxic.com.tw
---
drivers/mtd/nand/spi/macronix.c | 112 ++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index 6701aaa21a49df..a9890350db0293 100644
+index e0c71c654..ede66b71b 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -186,6 +186,118 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -185,6 +185,118 @@ static const struct spinand_info macronix_spinand_table[] = {
0 /*SPINAND_HAS_QE_BIT*/,
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
@@ -168,3 +131,6 @@
};
static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2317-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
similarity index 70%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2317-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
index cc6900a..bcc9df8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2317-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
@@ -1,27 +1,18 @@
-From 6f802696c2faf0119781fc3b7977a4eedf9ab239 Mon Sep 17 00:00:00 2001
-From: Jaime Liao <jaimeliao@mxic.com.tw>
-Date: Mon, 9 Aug 2021 09:27:52 +0800
-Subject: [PATCH] mtd: spinand: macronix: Add Quad support for serial NAND
- flash
+From ec328d836a28d538c38f67f5467b9319d6a950a3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:11 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2317-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch]
-Adding FLAG "SPINAND_HAS_QE_BIT" for Quad mode support on Macronix
-Serial Flash.
-Validated via normal(default) and QUAD mode by read, erase, read back,
-on Xilinx Zynq PicoZed FPGA board which included Macronix
-SPI Host(drivers/spi/spi-mxic.c).
-
-Signed-off-by: Jaime Liao <jaimeliao@mxic.com.tw>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/1628472472-32008-1-git-send-email-jaimeliao@mxic.com.tw
---
drivers/mtd/nand/spi/macronix.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
-index a9890350db0293..3f31f1381a62c0 100644
+index ede66b71b..25319b4f8 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -126,7 +126,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -125,7 +125,7 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -30,7 +21,7 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
SPINAND_INFO("MX35LF4GE4AD",
-@@ -136,7 +136,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -135,7 +135,7 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -39,7 +30,7 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
SPINAND_INFO("MX35LF1G24AD",
-@@ -146,16 +146,16 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -145,16 +145,16 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -59,7 +50,7 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
SPINAND_INFO("MX35LF4G24AD",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
-@@ -164,7 +164,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -163,7 +163,7 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -68,7 +59,7 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
SPINAND_INFO("MX31LF1GE4BC",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
-@@ -173,7 +173,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -172,7 +172,7 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -77,7 +68,7 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
SPINAND_INFO("MX31UF1GE4BC",
-@@ -183,7 +183,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+@@ -182,7 +182,7 @@ static const struct spinand_info macronix_spinand_table[] = {
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
@@ -86,3 +77,6 @@
SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
mx35lf1ge4ab_ecc_get_status)),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
similarity index 77%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
index b4fcfbc..2e888d3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
@@ -1,22 +1,15 @@
-From d3137043440fb1faaaf2481184f35b9ed0c1f2c2 Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:30 +0100
-Subject: [PATCH] mtd: spinand: micron: Generalize the OOB layout structure and
- function names
+From aebf853ada4f73280d4cf7a1799cb0ebf84f87e1 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:11 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch]
-In order to add new Micron SPI NAND devices, we generalized the OOB
-layout structure and function names.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-2-sshivamurthy@micron.com
---
drivers/mtd/nand/spi/micron.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index f56f81325e10ac..cc1ee68421c8e1 100644
+index f56f81325..cc1ee6842 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -34,38 +34,38 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
@@ -81,3 +74,6 @@
};
static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2319-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2319-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch
new file mode 100644
index 0000000..3ff682b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2319-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch
@@ -0,0 +1,25 @@
+From 59766b3af8f603e740c38d2cc03c37226c78bb11 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:11 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2319-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch]
+
+---
+ drivers/mtd/nand/spi/micron.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
+index cc1ee6842..4727933c8 100644
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -91,6 +91,7 @@ static int micron_8_ecc_get_status(struct spinand_device *spinand,
+ }
+
+ static const struct spinand_info micron_spinand_table[] = {
++ /* M79A 2Gb 3.3V */
+ SPINAND_INFO("MT29F2G01ABAGD",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2320-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
similarity index 75%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2320-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
index be3a3b1..4c5e911 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2320-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
@@ -1,20 +1,15 @@
-From a15335a17f4abf48ed9739c3b119232f9392cb60 Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:32 +0100
-Subject: [PATCH] mtd: spinand: micron: Add new Micron SPI NAND devices
+From 66ea40f7c5b196eee609c5e3322aac3a7ac59e03 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:12 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2320-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch]
-Add device table for M79A and M78A series Micron SPI NAND devices.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-4-sshivamurthy@micron.com
---
drivers/mtd/nand/spi/micron.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index 4727933c894bc8..26925714a9fbac 100644
+index 4727933c8..26925714a 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -102,6 +102,39 @@ static const struct spinand_info micron_spinand_table[] = {
@@ -57,3 +52,6 @@
};
static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2321-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2321-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch
new file mode 100644
index 0000000..ae7ac72
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2321-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch
@@ -0,0 +1,61 @@
+From 65c3b878a33bb7edd5413860537fecdff94aaba6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:12 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2321-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch]
+
+---
+ drivers/mtd/nand/spi/micron.c | 16 ++++++++++++++++
+ include/linux/mtd/spinand.h | 1 +
+ 2 files changed, 17 insertions(+)
+
+diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
+index 26925714a..956f7710a 100644
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -18,6 +18,8 @@
+ #define MICRON_STATUS_ECC_4TO6_BITFLIPS (3 << 4)
+ #define MICRON_STATUS_ECC_7TO8_BITFLIPS (5 << 4)
+
++#define MICRON_CFG_CR BIT(0)
++
+ static SPINAND_OP_VARIANTS(read_cache_variants,
+ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
+@@ -137,7 +139,21 @@ static const struct spinand_info micron_spinand_table[] = {
+ micron_8_ecc_get_status)),
+ };
+
++static int micron_spinand_init(struct spinand_device *spinand)
++{
++ /*
++ * M70A device series enable Continuous Read feature at Power-up,
++ * which is not supported. Disable this bit to avoid any possible
++ * failure.
++ */
++ if (spinand->flags & SPINAND_HAS_CR_FEAT_BIT)
++ return spinand_upd_cfg(spinand, MICRON_CFG_CR, 0);
++
++ return 0;
++}
++
+ static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
++ .init = micron_spinand_init,
+ };
+
+ const struct spinand_manufacturer micron_spinand_manufacturer = {
+diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
+index f4c4ae871..1077c4572 100644
+--- a/include/linux/mtd/spinand.h
++++ b/include/linux/mtd/spinand.h
+@@ -284,6 +284,7 @@ struct spinand_ecc_info {
+ };
+
+ #define SPINAND_HAS_QE_BIT BIT(0)
++#define SPINAND_HAS_CR_FEAT_BIT BIT(1)
+
+ /**
+ * struct spinand_info - Structure used to describe SPI NAND chips
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2322-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
similarity index 70%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2322-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
index 158492f..426d674 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2322-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
@@ -1,20 +1,15 @@
-From a7e5daccc310c3b892ae5e598cadb7a9274c2547 Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:34 +0100
-Subject: [PATCH] mtd: spinand: micron: Add M70A series Micron SPI NAND devices
+From 5a4cd6ba8f7ae6744ca44f78c761f26e843c0341 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:12 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2322-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch]
-Add device table for M70A series Micron SPI NAND devices.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-6-sshivamurthy@micron.com
---
drivers/mtd/nand/spi/micron.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index 956f7710aca263..d6fd630087822c 100644
+index 956f7710a..d6fd63008 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -137,6 +137,28 @@ static const struct spinand_info micron_spinand_table[] = {
@@ -46,3 +41,6 @@
};
static int micron_spinand_init(struct spinand_device *spinand)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/455-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2323-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/455-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2323-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
index 8f8f1da..2e0a356 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/455-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2323-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
@@ -1,24 +1,15 @@
-From 9f9ae0c253c1e058fbc845e26c4a32a7d777f0dc Mon Sep 17 00:00:00 2001
-From: Shivamurthy Shastri <sshivamurthy@micron.com>
-Date: Wed, 11 Mar 2020 18:57:35 +0100
-Subject: [PATCH] mtd: spinand: micron: Add new Micron SPI NAND devices with
- multiple dies
+From ac7be09336555cf993d904bd9e42c05d1769288a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:12 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2323-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch]
-Add device table for new Micron SPI NAND devices, which have multiple
-dies.
-
-Also, enable support to select the dies.
-
-Signed-off-by: Shivamurthy Shastri <sshivamurthy@micron.com>
-Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20200311175735.2007-7-sshivamurthy@micron.com
---
drivers/mtd/nand/spi/micron.c | 58 +++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index d6fd630087822c..5d370cfcdaaaa9 100644
+index d6fd63008..5d370cfcd 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -20,6 +20,14 @@
@@ -107,3 +98,6 @@
};
static int micron_spinand_init(struct spinand_device *spinand)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/456-mtd-spinand-micron-Use-more-specific-names.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2324-mtd-spinand-micron-Use-more-specific-names.patch
similarity index 92%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/456-mtd-spinand-micron-Use-more-specific-names.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2324-mtd-spinand-micron-Use-more-specific-names.patch
index ec03ffe..e397967 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/456-mtd-spinand-micron-Use-more-specific-names.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2324-mtd-spinand-micron-Use-more-specific-names.patch
@@ -1,20 +1,15 @@
-From bdb84a22b02b0c2ca76bb3e3e16942338f67999b Mon Sep 17 00:00:00 2001
-From: Thirumalesha Narasimhappa <nthirumalesha7@gmail.com>
-Date: Sun, 8 Nov 2020 19:37:34 +0800
-Subject: [PATCH] mtd: spinand: micron: Use more specific names
+From 5abef195abf3faa6f8e22a2e6996316f14c4f21c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:13 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2324-mtd-spinand-micron-Use-more-specific-names.patch]
-Rename the read/write/update of SPINAND_OP_VARIANTS() to more
-specialized names.
-
-Signed-off-by: Thirumalesha Narasimhappa <nthirumalesha7@gmail.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20201108113735.2533-2-nthirumalesha7@gmail.com
---
drivers/mtd/nand/spi/micron.c | 60 +++++++++++++++++------------------
1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index 5d370cfcdaaaa9..afe3ba37dcfb8e 100644
+index 5d370cfcd..afe3ba37d 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -28,7 +28,7 @@
@@ -157,3 +152,6 @@
SPINAND_HAS_CR_FEAT_BIT,
SPINAND_ECCINFO(µn_8_ooblayout,
micron_8_ecc_get_status),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2325-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2325-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
index ecd2b71..b6914ce 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2325-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
@@ -1,20 +1,15 @@
-From 8c573d9419bf61f7b66b6114f1171f3a8a4a0e38 Mon Sep 17 00:00:00 2001
-From: Thirumalesha Narasimhappa <nthirumalesha7@gmail.com>
-Date: Sun, 8 Nov 2020 19:37:35 +0800
-Subject: [PATCH] mtd: spinand: micron: Add support for MT29F2G01AAAED
+From 5cea72055a3bce2b8b5a1f8cb6d46165eeccd8b9 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:13 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2325-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch]
-The MT29F2G01AAAED is a single die, 2Gb Micron SPI NAND Flash with 4-bit
-ECC
-
-Signed-off-by: Thirumalesha Narasimhappa <nthirumalesha7@gmail.com>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/20201108113735.2533-3-nthirumalesha7@gmail.com
---
drivers/mtd/nand/spi/micron.c | 64 +++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
-index afe3ba37dcfb8e..50b7295bc92226 100644
+index afe3ba37d..50b7295bc 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -44,6 +44,19 @@ static SPINAND_OP_VARIANTS(x4_update_cache_variants,
@@ -102,3 +97,6 @@
};
static int micron_spinand_init(struct spinand_device *spinand)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/470-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2326-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
similarity index 73%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/470-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2326-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
index 80672e6..74bab62 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/470-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2326-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
@@ -1,32 +1,18 @@
-From 6b49e58d6d9dab031a16af2af5439f28a37c4cd9 Mon Sep 17 00:00:00 2001
-From: Yoshio Furuyama <ytc-mb-yfuruyama7@kioxia.com>
-Date: Tue, 24 Mar 2020 15:49:44 +0900
-Subject: [PATCH] mtd: spinand: toshiba: Rename function name to change suffix
- and prefix (8Gbit)
+From af4301a675f4fcbaa787f1d3bd07df1c08a093c3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:13 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2326-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch]
-The suffix was changed from "G" to "J" to classify between 1st generation
-and 2nd generation serial NAND devices (which now belong to the Kioxia
-brand).
-As reference that's
-1st generation device of 1Gbit product is "TC58CVG0S3HRAIG"
-2nd generation device of 1Gbit product is "TC58CVG0S3HRAIJ".
-
-The 8Gbit type "TH58CxG3S0HRAIJ" is new to Kioxia's serial NAND lineup and
-the prefix was changed from "TC58" to "TH58".
-
-Thus the functions were renamed from tc58cxgxsx_*() to tx58cxgxsxraix_*().
-
-Signed-off-by: Yoshio Furuyama <ytc-mb-yfuruyama7@kioxia.com>
-Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/0dedd9869569a17625822dba87878254d253ba0e.1584949601.git.ytc-mb-yfuruyama7@kioxia.com
---
- drivers/mtd/nand/spi/toshiba.c | 60 +++++++++++++++++-----------------
- 1 file changed, 30 insertions(+), 30 deletions(-)
+ drivers/mtd/nand/spi/toshiba.c | 65 ++++++++++++++++++++--------------
+ 1 file changed, 38 insertions(+), 27 deletions(-)
+diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
+index 35da3c6e9..7ce5997dd 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
-@@ -25,8 +25,8 @@ static SPINAND_OP_VARIANTS(write_cache_v
+@@ -25,8 +25,8 @@ static SPINAND_OP_VARIANTS(write_cache_variants,
static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD(false, 0, NULL, 0));
@@ -37,7 +23,7 @@
{
if (section > 0)
return -ERANGE;
-@@ -37,8 +37,8 @@ static int tc58cxgxsx_ooblayout_ecc(stru
+@@ -37,8 +37,8 @@ static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section,
return 0;
}
@@ -48,7 +34,7 @@
{
if (section > 0)
return -ERANGE;
-@@ -50,13 +50,13 @@ static int tc58cxgxsx_ooblayout_free(str
+@@ -50,13 +50,13 @@ static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section,
return 0;
}
@@ -67,7 +53,7 @@
{
struct nand_device *nand = spinand_to_nand(spinand);
u8 mbf = 0;
-@@ -95,7 +95,7 @@ static int tc58cxgxsx_ecc_get_status(str
+@@ -95,7 +95,7 @@ static int tc58cxgxsx_ecc_get_status(struct spinand_device *spinand,
static const struct spinand_info toshiba_spinand_table[] = {
/* 3.3V 1Gb */
@@ -76,7 +62,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xC2),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -103,10 +103,10 @@ static const struct spinand_info toshiba
+@@ -103,10 +103,10 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -90,7 +76,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCB),
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -114,10 +114,10 @@ static const struct spinand_info toshiba
+@@ -114,10 +114,10 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -104,7 +90,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCD),
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -125,10 +125,21 @@ static const struct spinand_info toshiba
+@@ -125,10 +125,21 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -129,7 +115,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xB2),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -136,10 +147,10 @@ static const struct spinand_info toshiba
+@@ -136,10 +147,10 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -143,7 +129,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBB),
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -147,10 +158,10 @@ static const struct spinand_info toshiba
+@@ -147,10 +158,10 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -157,7 +143,7 @@
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBD),
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
-@@ -158,8 +169,8 @@ static const struct spinand_info toshiba
+@@ -158,8 +169,8 @@ static const struct spinand_info toshiba_spinand_table[] = {
&write_cache_variants,
&update_cache_variants),
0,
@@ -168,3 +154,6 @@
};
static const struct spinand_manufacturer_ops toshiba_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2327-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
similarity index 85%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2327-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
index ffa1ad8..12a55cb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2327-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
@@ -1,25 +1,18 @@
-From 798fcdd010006e87b3154d6454c657af7b033002 Mon Sep 17 00:00:00 2001
-From: Yoshio Furuyama <ytc-mb-yfuruyama7@kioxia.com>
-Date: Tue, 24 Mar 2020 15:49:55 +0900
-Subject: [PATCH] mtd: spinand: toshiba: Support for new Kioxia Serial NAND
+From 1d16ff587875717c950c983af8eaa474d0a855ca Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:13 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2327-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch]
-Add support for new Kioxia products.
-The new Kioxia products support program load x4 command, and have
-HOLD_D bit which is equivalent to QE bit.
-
-Signed-off-by: Yoshio Furuyama <ytc-mb-yfuruyama7@kioxia.com>
-Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
-Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/linux-mtd/aa69e455beedc5ce0d7141359b9364ed8aec9e65.1584949601.git.ytc-mb-yfuruyama7@kioxia.com
---
drivers/mtd/nand/spi/toshiba.c | 128 ++++++++++++++++++++++++++++-----
1 file changed, 111 insertions(+), 17 deletions(-)
diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
-index 5d217dd4b2539a..bc801d83343e5c 100644
+index 7ce5997dd..be51a2eaf 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
-@@ -20,6 +20,18 @@ static SPINAND_OP_VARIANTS(read_cache_variants,
+@@ -19,6 +19,18 @@ static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
@@ -38,7 +31,7 @@
static SPINAND_OP_VARIANTS(write_cache_variants,
SPINAND_PROG_LOAD(true, 0, NULL, 0));
-@@ -95,7 +107,7 @@ static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
+@@ -94,7 +106,7 @@ static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
}
static const struct spinand_info toshiba_spinand_table[] = {
@@ -47,7 +40,7 @@
SPINAND_INFO("TC58CVG0S3HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xC2),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
-@@ -106,7 +118,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -105,7 +117,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -56,7 +49,7 @@
SPINAND_INFO("TC58CVG1S3HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCB),
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
-@@ -117,7 +129,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -116,7 +128,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -65,7 +58,7 @@
SPINAND_INFO("TC58CVG2S0HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCD),
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
-@@ -128,18 +140,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -127,18 +139,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -85,7 +78,7 @@
SPINAND_INFO("TC58CYG0S3HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xB2),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
-@@ -150,7 +151,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -149,7 +150,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -94,7 +87,7 @@
SPINAND_INFO("TC58CYG1S3HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBB),
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
-@@ -161,7 +162,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -160,7 +161,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -103,7 +96,7 @@
SPINAND_INFO("TC58CYG2S0HRAIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBD),
NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
-@@ -172,6 +173,99 @@ static const struct spinand_info toshiba_spinand_table[] = {
+@@ -171,6 +172,99 @@ static const struct spinand_info toshiba_spinand_table[] = {
0,
SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
tx58cxgxsxraix_ecc_get_status)),
@@ -203,3 +196,6 @@
};
static const struct spinand_manufacturer_ops toshiba_spinand_manuf_ops = {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/827-v5.16-spi-add-power-control-when-set_cs.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2360-v5.16-spi-add-power-control-when-set_cs.patch
similarity index 62%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/827-v5.16-spi-add-power-control-when-set_cs.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2360-v5.16-spi-add-power-control-when-set_cs.patch
index f3e7940..1016204 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/827-v5.16-spi-add-power-control-when-set_cs.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2360-v5.16-spi-add-power-control-when-set_cs.patch
@@ -1,14 +1,15 @@
-drivers: spi: backport PM improvement for SPI framework
+From 0078d23c468b3b3fd73d65f1652de0b355b95081 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:18 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2360-v5.16-spi-add-power-control-when-set_cs.patch]
-Fix PM improvement for SPI framework.
-As to set_cs takes effect immediately, power spi
-is needed when setup spi.
+---
+ drivers/spi/spi.c | 24 +++++++++++++++++++++++-
+ 1 file changed, 23 insertions(+), 1 deletion(-)
-(cherry picked from commit d948e6ca189985495a21cd622c31e30e72b6b688)
-Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/spi/spi.c?h=v5.16-rc4&id=d948e6ca189985495a21cd622c31e30e72b6b688
-(cherry picked from commit 57a9460705f105e1d79d1410c5cfe285beda8986)
-Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/spi/spi.c?h=v5.16-rc4&id=57a9460705f105e1d79d1410c5cfe285beda8986
-
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
+index 197a47eab..e562735a3 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3170,7 +3170,29 @@ int spi_setup(struct spi_device *spi)
@@ -43,5 +44,5 @@
if (spi->rt && !spi->controller->rt) {
spi->controller->rt = true;
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2700-v5.7-iopoll-introduce-read_poll_timeout-macro.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2700-v5.7-iopoll-introduce-read_poll_timeout-macro.patch
new file mode 100644
index 0000000..d7fc25c
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2700-v5.7-iopoll-introduce-read_poll_timeout-macro.patch
@@ -0,0 +1,176 @@
+From bc97a676615bd0ec66bb2a2a42c939455bf5bed6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:27 +0800
+Subject: [PATCH]
+ [networking][999-2700-v5.7-iopoll-introduce-read_poll_timeout-macro.patch]
+
+---
+ drivers/net/phy/phy_device.c | 16 +++++----------
+ include/linux/iopoll.h | 40 +++++++++++++++++++++++++++++-------
+ include/linux/phy.h | 27 ++++++++++++++++++++++++
+ 3 files changed, 65 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
+index 76a68bb02..0349801df 100644
+--- a/drivers/net/phy/phy_device.c
++++ b/drivers/net/phy/phy_device.c
+@@ -1056,18 +1056,12 @@ EXPORT_SYMBOL(phy_disconnect);
+ static int phy_poll_reset(struct phy_device *phydev)
+ {
+ /* Poll until the reset bit clears (50ms per retry == 0.6 sec) */
+- unsigned int retries = 12;
+- int ret;
+-
+- do {
+- msleep(50);
+- ret = phy_read(phydev, MII_BMCR);
+- if (ret < 0)
+- return ret;
+- } while (ret & BMCR_RESET && --retries);
+- if (ret & BMCR_RESET)
+- return -ETIMEDOUT;
++ int ret, val;
+
++ ret = phy_read_poll_timeout(phydev, MII_BMCR, val, !(val & BMCR_RESET),
++ 50000, 600000, true);
++ if (ret)
++ return ret;
+ /* Some chips (smsc911x) may still need up to another 1ms after the
+ * BMCR_RESET bit is cleared before they are usable.
+ */
+diff --git a/include/linux/iopoll.h b/include/linux/iopoll.h
+index 35e15dfd4..cb20c733b 100644
+--- a/include/linux/iopoll.h
++++ b/include/linux/iopoll.h
+@@ -14,36 +14,41 @@
+ #include <linux/io.h>
+
+ /**
+- * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
+- * @op: accessor function (takes @addr as its only argument)
+- * @addr: Address to poll
++ * read_poll_timeout - Periodically poll an address until a condition is
++ * met or a timeout occurs
++ * @op: accessor function (takes @args as its arguments)
+ * @val: Variable to read the value into
+ * @cond: Break condition (usually involving @val)
+ * @sleep_us: Maximum time to sleep between reads in us (0
+ * tight-loops). Should be less than ~20ms since usleep_range
+ * is used (see Documentation/timers/timers-howto.rst).
+ * @timeout_us: Timeout in us, 0 means never timeout
++ * @sleep_before_read: if it is true, sleep @sleep_us before read.
++ * @args: arguments for @op poll
+ *
+ * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
+- * case, the last read value at @addr is stored in @val. Must not
++ * case, the last read value at @args is stored in @val. Must not
+ * be called from atomic context if sleep_us or timeout_us are used.
+ *
+ * When available, you'll probably want to use one of the specialized
+ * macros defined below rather than this macro directly.
+ */
+-#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
++#define read_poll_timeout(op, val, cond, sleep_us, timeout_us, \
++ sleep_before_read, args...) \
+ ({ \
+ u64 __timeout_us = (timeout_us); \
+ unsigned long __sleep_us = (sleep_us); \
+ ktime_t __timeout = ktime_add_us(ktime_get(), __timeout_us); \
+ might_sleep_if((__sleep_us) != 0); \
++ if (sleep_before_read && __sleep_us) \
++ usleep_range((__sleep_us >> 2) + 1, __sleep_us); \
+ for (;;) { \
+- (val) = op(addr); \
++ (val) = op(args); \
+ if (cond) \
+ break; \
+ if (__timeout_us && \
+ ktime_compare(ktime_get(), __timeout) > 0) { \
+- (val) = op(addr); \
++ (val) = op(args); \
+ break; \
+ } \
+ if (__sleep_us) \
+@@ -52,6 +57,27 @@
+ (cond) ? 0 : -ETIMEDOUT; \
+ })
+
++/**
++ * readx_poll_timeout - Periodically poll an address until a condition is met or a timeout occurs
++ * @op: accessor function (takes @addr as its only argument)
++ * @addr: Address to poll
++ * @val: Variable to read the value into
++ * @cond: Break condition (usually involving @val)
++ * @sleep_us: Maximum time to sleep between reads in us (0
++ * tight-loops). Should be less than ~20ms since usleep_range
++ * is used (see Documentation/timers/timers-howto.rst).
++ * @timeout_us: Timeout in us, 0 means never timeout
++ *
++ * Returns 0 on success and -ETIMEDOUT upon a timeout. In either
++ * case, the last read value at @addr is stored in @val. Must not
++ * be called from atomic context if sleep_us or timeout_us are used.
++ *
++ * When available, you'll probably want to use one of the specialized
++ * macros defined below rather than this macro directly.
++ */
++#define readx_poll_timeout(op, addr, val, cond, sleep_us, timeout_us) \
++ read_poll_timeout(op, val, cond, sleep_us, timeout_us, false, addr)
++
+ /**
+ * readx_poll_timeout_atomic - Periodically poll an address until a condition is met or a timeout occurs
+ * @op: accessor function (takes @addr as its only argument)
+diff --git a/include/linux/phy.h b/include/linux/phy.h
+index a1070d60e..107dcbea4 100644
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -21,6 +21,7 @@
+ #include <linux/timer.h>
+ #include <linux/workqueue.h>
+ #include <linux/mod_devicetable.h>
++#include <linux/iopoll.h>
+
+ #include <linux/atomic.h>
+
+@@ -714,6 +715,19 @@ static inline int phy_read(struct phy_device *phydev, u32 regnum)
+ return mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, regnum);
+ }
+
++#define phy_read_poll_timeout(phydev, regnum, val, cond, sleep_us, \
++ timeout_us, sleep_before_read) \
++({ \
++ int __ret = read_poll_timeout(phy_read, val, (cond) || val < 0, \
++ sleep_us, timeout_us, sleep_before_read, phydev, regnum); \
++ if (val < 0) \
++ __ret = val; \
++ if (__ret) \
++ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
++ __ret; \
++})
++
++
+ /**
+ * __phy_read - convenience function for reading a given PHY register
+ * @phydev: the phy_device struct
+@@ -766,6 +780,19 @@ static inline int __phy_write(struct phy_device *phydev, u32 regnum, u16 val)
+ */
+ int phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum);
+
++#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \
++ sleep_us, timeout_us, sleep_before_read) \
++({ \
++ int __ret = read_poll_timeout(phy_read_mmd, val, (cond) || val < 0, \
++ sleep_us, timeout_us, sleep_before_read, \
++ phydev, devaddr, regnum); \
++ if (val < 0) \
++ __ret = val; \
++ if (__ret) \
++ phydev_err(phydev, "%s failed: %d\n", __func__, __ret); \
++ __ret; \
++})
++
+ /**
+ * __phy_read_mmd - Convenience function for reading a register
+ * from an MMD on a given PHY.
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/791-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2701-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch
similarity index 66%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/791-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2701-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch
index b47f2bf..e74f20b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/791-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2701-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch
@@ -1,97 +1,20 @@
-From patchwork Wed May 6 14:53:13 2020
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Michael Walle <michael@walle.cc>
-X-Patchwork-Id: 1284481
-X-Patchwork-Delegate: davem@davemloft.net
-Return-Path: <netdev-owner@vger.kernel.org>
-X-Original-To: patchwork-incoming-netdev@ozlabs.org
-Delivered-To: patchwork-incoming-netdev@ozlabs.org
-Authentication-Results: ozlabs.org;
- spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org
- (client-ip=23.128.96.18; helo=vger.kernel.org;
- envelope-from=netdev-owner@vger.kernel.org; receiver=<UNKNOWN>)
-Authentication-Results: ozlabs.org;
- dmarc=none (p=none dis=none) header.from=walle.cc
-Authentication-Results: ozlabs.org;
- dkim=pass (1024-bit key;
- secure) header.d=walle.cc header.i=@walle.cc header.a=rsa-sha256
- header.s=mail2016061301 header.b=m9HhLh3d;
- dkim-atps=neutral
-Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
- by ozlabs.org (Postfix) with ESMTP id 49HKQ62Q28z9sSG
- for <patchwork-incoming-netdev@ozlabs.org>;
- Thu, 7 May 2020 00:55:10 +1000 (AEST)
-Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
- id S1729301AbgEFOzD (ORCPT
- <rfc822;patchwork-incoming-netdev@ozlabs.org>);
- Wed, 6 May 2020 10:55:03 -0400
-Received: from ssl.serverraum.org ([176.9.125.105]:43029 "EHLO
- ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
- with ESMTP id S1729078AbgEFOzC (ORCPT
- <rfc822;netdev@vger.kernel.org>); Wed, 6 May 2020 10:55:02 -0400
-Received: from apollo.fritz.box (unknown
- [IPv6:2a02:810c:c200:2e91:6257:18ff:fec4:ca34])
- (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
- key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits)
- server-digest SHA256)
- (No client certificate requested)
- by ssl.serverraum.org (Postfix) with ESMTPSA id 2354022EEB;
- Wed, 6 May 2020 16:54:57 +0200 (CEST)
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc;
- s=mail2016061301;
- t=1588776897;
- h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
- to:to:cc:cc:mime-version:mime-version:
- content-transfer-encoding:content-transfer-encoding:
- in-reply-to:in-reply-to:references:references;
- bh=Y1HXOD90+xthCbcF5aODRvO5s4y3GjqVZeWMcm2C9hg=;
- b=m9HhLh3dnD9BTg85PIRYHxEzW+9tKI8srVGI3MjgXJkJaWDcnUKGyPN86orzkyHrB0ai5O
- VyiY7R2tdN04JifV18FNmxuUW/9Pc3kWUfo+q974YzVhTm0Tkrc3osn/smhyhl7PxpHZMl
- VHiTEHII3umwamTkGQq8kpYUr38joLY=
-From: Michael Walle <michael@walle.cc>
-To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
-Cc: Andrew Lunn <andrew@lunn.ch>,
- Florian Fainelli <f.fainelli@gmail.com>,
- Heiner Kallweit <hkallweit1@gmail.com>,
- Russell King <linux@armlinux.org.uk>,
- "David S . Miller" <davem@davemloft.net>,
- Vladimir Oltean <vladimir.oltean@nxp.com>,
- Antoine Tenart <antoine.tenart@bootlin.com>,
- Michael Walle <michael@walle.cc>
-Subject: [PATCH net-next v3 1/3] net: phy: add concept of shared storage for
- PHYs
-Date: Wed, 6 May 2020 16:53:13 +0200
-Message-Id: <20200506145315.13967-2-michael@walle.cc>
-X-Mailer: git-send-email 2.20.1
-In-Reply-To: <20200506145315.13967-1-michael@walle.cc>
-References: <20200506145315.13967-1-michael@walle.cc>
-MIME-Version: 1.0
-X-Spam: Yes
-Sender: netdev-owner@vger.kernel.org
-Precedence: bulk
-List-ID: <netdev.vger.kernel.org>
-X-Mailing-List: netdev@vger.kernel.org
+From 2dca4de7282d3003f3703f707d773f4dbbc0f28e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:27 +0800
+Subject: [PATCH]
+ [networking][999-2701-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch]
-There are packages which contain multiple PHY devices, eg. a quad PHY
-transceiver. Provide functions to allocate and free shared storage.
-
-Usually, a quad PHY contains global registers, which don't belong to any
-PHY. Provide convenience functions to access these registers.
-
-Signed-off-by: Michael Walle <michael@walle.cc>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/mdio_bus.c | 1 +
drivers/net/phy/phy_device.c | 138 +++++++++++++++++++++++++++++++++++
include/linux/phy.h | 89 ++++++++++++++++++++++
3 files changed, 228 insertions(+)
+diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
+index fdf8221f4..d9f2cee33 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
-@@ -404,6 +404,7 @@ int __mdiobus_register(struct mii_bus *b
+@@ -404,6 +404,7 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
}
mutex_init(&bus->mdio_lock);
@@ -99,12 +22,15 @@
/* de-assert bus level PHY GPIO reset */
gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
+diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
+index 0349801df..99f265a1c 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1448,6 +1448,144 @@ bool phy_driver_is_genphy_10g(struct phy
+@@ -1447,6 +1447,144 @@ bool phy_driver_is_genphy_10g(struct phy_device *phydev)
+ }
EXPORT_SYMBOL_GPL(phy_driver_is_genphy_10g);
- /**
++/**
+ * phy_package_join - join a common PHY group
+ * @phydev: target phy_device struct
+ * @addr: cookie and PHY address for global register access
@@ -242,10 +168,11 @@
+}
+EXPORT_SYMBOL_GPL(devm_phy_package_join);
+
-+/**
+ /**
* phy_detach - detach a PHY device from its network device
* @phydev: target phy_device struct
- *
+diff --git a/include/linux/phy.h b/include/linux/phy.h
+index 107dcbea4..d26dba255 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -22,6 +22,7 @@
@@ -256,7 +183,7 @@
#include <linux/atomic.h>
-@@ -208,6 +209,28 @@ struct sfp_bus;
+@@ -211,6 +212,28 @@ struct sfp_bus;
struct sfp_upstream_ops;
struct sk_buff;
@@ -285,7 +212,7 @@
/*
* The Bus class for PHYs. Devices which provide access to
* PHYs should register using this structure
-@@ -255,6 +278,12 @@ struct mii_bus {
+@@ -258,6 +281,12 @@ struct mii_bus {
int reset_delay_us;
/* RESET GPIO descriptor pointer */
struct gpio_desc *reset_gpiod;
@@ -298,7 +225,7 @@
};
#define to_mii_bus(d) container_of(d, struct mii_bus, dev)
-@@ -434,6 +463,10 @@ struct phy_device {
+@@ -437,6 +466,10 @@ struct phy_device {
/* For use by PHYs to maintain extra state */
void *priv;
@@ -309,7 +236,7 @@
/* Interrupt and Polling infrastructure */
struct delayed_work state_queue;
-@@ -1232,6 +1265,10 @@ int phy_ethtool_get_link_ksettings(struc
+@@ -1242,6 +1275,10 @@ int phy_ethtool_get_link_ksettings(struct net_device *ndev,
int phy_ethtool_set_link_ksettings(struct net_device *ndev,
const struct ethtool_link_ksettings *cmd);
int phy_ethtool_nway_reset(struct net_device *ndev);
@@ -320,7 +247,7 @@
#if IS_ENABLED(CONFIG_PHYLIB)
int __init mdio_bus_init(void);
-@@ -1284,6 +1321,58 @@ static inline int phy_ethtool_get_stats(
+@@ -1294,6 +1331,58 @@ static inline int phy_ethtool_get_stats(struct phy_device *phydev,
return 0;
}
@@ -379,3 +306,6 @@
extern struct bus_type mdio_bus_type;
struct mdio_board_info {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
new file mode 100644
index 0000000..c2f2c10
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
@@ -0,0 +1,55 @@
+From 3fc10755d5f6a5618519f2b5b3a68febfc5984b0 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:27 +0800
+Subject: [PATCH]
+ [networking][999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch]
+
+---
+ include/linux/phy.h | 18 +++++++++++++++---
+ 1 file changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/include/linux/phy.h b/include/linux/phy.h
+index d26dba255..4f2c105f5 100644
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -232,7 +232,8 @@ struct phy_package_shared {
+ };
+
+ /* used as bit number in atomic bitops */
+-#define PHY_SHARED_F_INIT_DONE 0
++#define PHY_SHARED_F_INIT_DONE 0
++#define PHY_SHARED_F_PROBE_DONE 1
+
+ /*
+ * The Bus class for PHYs. Devices which provide access to
+@@ -1373,14 +1374,25 @@ static inline int __phy_package_write(struct phy_device *phydev,
+ return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val);
+ }
+
+-static inline bool phy_package_init_once(struct phy_device *phydev)
++static inline bool __phy_package_set_once(struct phy_device *phydev,
++ unsigned int b)
+ {
+ struct phy_package_shared *shared = phydev->shared;
+
+ if (!shared)
+ return false;
+
+- return !test_and_set_bit(PHY_SHARED_F_INIT_DONE, &shared->flags);
++ return !test_and_set_bit(b, &shared->flags);
++}
++
++static inline bool phy_package_init_once(struct phy_device *phydev)
++{
++ return __phy_package_set_once(phydev, PHY_SHARED_F_INIT_DONE);
++}
++
++static inline bool phy_package_probe_once(struct phy_device *phydev)
++{
++ return __phy_package_set_once(phydev, PHY_SHARED_F_PROBE_DONE);
+ }
+
+ extern struct bus_type mdio_bus_type;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/793-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2703-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch
similarity index 63%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/793-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2703-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch
index 83df94a..3551935 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/793-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/999-2703-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch
@@ -1,17 +1,19 @@
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -92,6 +92,8 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c
- obj-$(CONFIG_LXT_PHY) += lxt.o
- obj-$(CONFIG_MARVELL_PHY) += marvell.o
- obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o
-+obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o
-+obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o
- obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o
- obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o
- obj-$(CONFIG_MICREL_PHY) += micrel.o
+From 0e0b69abbc9fdba0bf1ea723cee71b2a2402559e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:28 +0800
+Subject: [PATCH]
+ [networking][999-2703-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch]
+
+---
+ drivers/net/phy/Kconfig | 17 +++++++++++++++++
+ drivers/net/phy/Makefile | 2 ++
+ 2 files changed, 19 insertions(+)
+
+diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
+index 5eeccfee2..ec5c66d0a 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
-@@ -507,6 +507,23 @@ config MESON_GXL_PHY
+@@ -512,6 +512,23 @@ config MESON_GXL_PHY
---help---
Currently has a driver for the Amlogic Meson GXL Internal PHY
@@ -35,3 +37,19 @@
config MICREL_PHY
tristate "Micrel PHYs"
---help---
+diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
+index 437ff2a2c..f4feb0e3d 100644
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -94,6 +94,8 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
+ obj-$(CONFIG_LXT_PHY) += lxt.o
+ obj-$(CONFIG_MARVELL_PHY) += marvell.o
+ obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o
++obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o
++obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o
+ obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o
+ obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o
+ obj-$(CONFIG_MICREL_PHY) += micrel.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
index aab01cf..d2f9398 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/backport-5.4.inc
@@ -163,9 +163,7 @@
file://406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch \
file://407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch \
file://407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch \
- file://408-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch \
file://410-mtd-fix-calculating-partition-end-address.patch \
- file://411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch \
file://412-v5.19-mtd-call-of_platform_populate-for-MTD-partitions.patch \
file://413-v6.0-mtd-next-mtd-core-introduce-of-support-for-dynamic-partitions.patch \
file://414-v6.1-mtd-allow-getting-MTD-device-associated-with-a-speci.patch \
@@ -174,23 +172,7 @@
file://417-v6.2-0001-mtd-core-simplify-a-bit-code-find-partition-matching.patch \
file://417-v6.2-0002-mtd-core-try-to-find-OF-node-for-every-MTD-partition.patch \
file://420-v6.2-mtd-parsers-add-TP-Link-SafeLoader-partitions-table-.patch \
- file://430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch \
file://430-v6.3-ubi-Fix-failure-attaching-when-vid_hdr-offset-equals.patch \
- file://431-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch \
- file://432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch \
- file://433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch \
- file://434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch \
- file://435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch \
- file://450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch \
- file://451-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch \
- file://452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch \
- file://453-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch \
- file://454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch \
- file://455-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch \
- file://456-mtd-spinand-micron-Use-more-specific-names.patch \
- file://457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch \
- file://470-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch \
- file://471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch \
file://600-v5.12-net-extract-napi-poll-functionality-to-__napi_poll.patch \
file://601-v5.12-net-implement-threaded-able-napi-poll-loop-support.patch \
file://602-v5.12-net-add-sysfs-attribute-to-control-napi-threaded-mod.patch \
@@ -270,10 +252,6 @@
file://780-net-dsa-mt7530-setup-core-clock-even-in-TRGMII-mode.patch \
file://781-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch \
file://781-v5.18-2-net-dsa-Avoid-cross-chip-syncing-of-VLAN-filtering.patch \
- file://790-v5.7-iopoll-introduce-read_poll_timeout-macro.patch \
- file://791-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch \
- file://792-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch;apply=no \
- file://793-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch \
file://800-v5.5-iio-imu-Add-support-for-the-FXOS8700-IMU.patch \
file://800-v5.5-scsi-core-Add-sysfs-attributes-for-VPD-pages-0h-and-.patch \
file://801-v5.19-nvmem-core-support-passing-DT-node-in-cell-info.patch \
@@ -304,7 +282,6 @@
file://822-v6.2-0003-nvmem-u-boot-env-add-Broadcom-format-support.patch \
file://825-v5.8-spi-rb4xx-null-pointer-bug-fix.patch \
file://826-v5.8-spi-rb4xx-update-driver-to-be-device-tree-aware.patch \
- file://827-v5.16-spi-add-power-control-when-set_cs.patch \
file://831-v5.13-0001-firmware-bcm47xx_nvram-rename-finding-function-and-i.patch \
file://831-v5.13-0002-firmware-bcm47xx_nvram-add-helper-checking-for-NVRAM.patch \
file://831-v5.13-0003-firmware-bcm47xx_nvram-extract-code-copying-NVRAM.patch \
@@ -320,5 +297,28 @@
file://900-v5.9-0001-dt-bindings-Add-multicolor-class-dt-bindings-documen.patch \
file://900-v5.9-0002-leds-Add-multicolor-ID-to-the-color-ID-list.patch \
file://900-v5.9-0003-leds-add-RGB-color-option-as-that-is-different-from-.patch \
+ file://999-2310-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch \
+ file://999-2311-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch \
+ file://999-2312-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch \
+ file://999-2313-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch \
+ file://999-2314-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch \
+ file://999-2315-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch \
+ file://999-2316-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch \
+ file://999-2317-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch \
+ file://999-2318-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch \
+ file://999-2319-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch \
+ file://999-2320-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch \
+ file://999-2321-mtd-spinand-micron-identify-SPI-NAND-device-with-Continuous-Read-mode.patch \
+ file://999-2322-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch \
+ file://999-2323-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch \
+ file://999-2324-mtd-spinand-micron-Use-more-specific-names.patch \
+ file://999-2325-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch \
+ file://999-2326-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch \
+ file://999-2327-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch \
+ file://999-2360-v5.16-spi-add-power-control-when-set_cs.patch \
+ file://999-2700-v5.7-iopoll-introduce-read_poll_timeout-macro.patch \
+ file://999-2701-v5.8-net-phy-add-concept-of-shared-storage-for-PHYs.patch \
+ file://999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch;apply=no \
+ file://999-2703-net-phy-backport-v5.4-mediatek-ge-and-v6.4-mediatek-ge-soc.patch \
file://999-update-uapi-header-files-for-bridger.patch \
"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/930-cmdline-boot-parameters.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/999-2540-cmdline-boot-parameters.patch
similarity index 72%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/930-cmdline-boot-parameters.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/999-2540-cmdline-boot-parameters.patch
index 6a6c8a6..eadc288 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/930-cmdline-boot-parameters.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/999-2540-cmdline-boot-parameters.patch
@@ -1,6 +1,19 @@
+From 32fdf519125a828c6fbbbc8dfdfda22791e710e6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:24 +0800
+Subject: [PATCH] [adv-feature][999-2540-cmdline-boot-parameters.patch]
+
+---
+ kernel/Makefile | 2 ++
+ kernel/boot_param.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 46 insertions(+)
+ create mode 100644 kernel/boot_param.c
+
+diff --git a/kernel/Makefile b/kernel/Makefile
+index d038b0de8..be219c6ca 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
-@@ -12,6 +12,8 @@ obj-y = fork.o exec_domain.o panic.o
+@@ -12,6 +12,8 @@ obj-y = fork.o exec_domain.o panic.o \
notifier.o ksysfs.o cred.o reboot.o \
async.o range.o smpboot.o ucount.o
@@ -9,7 +22,10 @@
obj-$(CONFIG_MODULES) += kmod.o
obj-$(CONFIG_MULTIUSER) += groups.o
---- a/kernel/boot_param.c
+diff --git a/kernel/boot_param.c b/kernel/boot_param.c
+new file mode 100644
+index 000000000..3dfe828bc
+--- /dev/null
+++ b/kernel/boot_param.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
@@ -56,3 +72,6 @@
+
+static char env_part[BOOT_PARAM_STR_MAX_LEN];
+module_param_string(env_part, env_part, BOOT_PARAM_STR_MAX_LEN, 0444);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/hack-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/hack-5.4.inc
index 431e127..11b86e3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/hack-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/hack-5.4.inc
@@ -41,5 +41,5 @@
file://910-kobject_uevent.patch \
file://911-kobject_add_broadcast_uevent.patch \
file://921-always-create-console-node-in-initramfs.patch \
- file://930-cmdline-boot-parameters.patch \
+ file://999-2540-cmdline-boot-parameters.patch \
"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/499-mtd-add-nmbm-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/499-mtd-add-nmbm-support.patch
deleted file mode 100644
index 5cbaae2..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/499-mtd-add-nmbm-support.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -228,6 +228,8 @@ source "drivers/mtd/ubi/Kconfig"
-
- source "drivers/mtd/hyperbus/Kconfig"
-
-+source "drivers/mtd/nmbm/Kconfig"
-+
- source "drivers/mtd/composite/Kconfig"
-
- endif # MTD
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -33,5 +33,7 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/
- obj-$(CONFIG_MTD_UBI) += ubi/
- obj-$(CONFIG_MTD_HYPERBUS) += hyperbus/
-
-+obj-y += nmbm/
-+
- # Composite drivers must be loaded last
- obj-y += composite/
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2328-mtd-add-nmbm-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2328-mtd-add-nmbm-support.patch
new file mode 100644
index 0000000..1ed432c
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2328-mtd-add-nmbm-support.patch
@@ -0,0 +1,38 @@
+From 648532e848587a525aa02add84b119844a4aabc3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:14 +0800
+Subject: [PATCH] [spi-and-storage][999-2328-mtd-add-nmbm-support.patch]
+
+---
+ drivers/mtd/Kconfig | 2 ++
+ drivers/mtd/Makefile | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
+index 503f19763..3ed42b402 100644
+--- a/drivers/mtd/Kconfig
++++ b/drivers/mtd/Kconfig
+@@ -228,6 +228,8 @@ source "drivers/mtd/ubi/Kconfig"
+
+ source "drivers/mtd/hyperbus/Kconfig"
+
++source "drivers/mtd/nmbm/Kconfig"
++
+ source "drivers/mtd/composite/Kconfig"
+
+ endif # MTD
+diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
+index 147e79596..f27f66784 100644
+--- a/drivers/mtd/Makefile
++++ b/drivers/mtd/Makefile
+@@ -33,5 +33,7 @@ obj-$(CONFIG_MTD_SPI_NOR) += spi-nor/
+ obj-$(CONFIG_MTD_UBI) += ubi/
+ obj-$(CONFIG_MTD_HYPERBUS) += hyperbus/
+
++obj-y += nmbm/
++
+ # Composite drivers must be loaded last
+ obj-y += composite/
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/500-ubi-add-configurable-rootdev.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2329-ubi-add-configurable-rootdev.patch
similarity index 66%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/500-ubi-add-configurable-rootdev.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2329-ubi-add-configurable-rootdev.patch
index e0102c7..1ee6142 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/500-ubi-add-configurable-rootdev.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2329-ubi-add-configurable-rootdev.patch
@@ -1,3 +1,15 @@
+From 27ae9a1b684cd183ccf6881d32710b8890113d20 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:14 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2329-ubi-add-configurable-rootdev.patch]
+
+---
+ drivers/mtd/ubi/block.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
+index 873f9cb24..33e969fd3 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -97,6 +97,12 @@ static DEFINE_IDR(ubiblock_minor_idr);
@@ -13,7 +25,7 @@
static int __init ubiblock_set_param(const char *val,
const struct kernel_param *kp)
{
-@@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_in
+@@ -460,8 +466,9 @@ int ubiblock_create(struct ubi_volume_info *vi)
dev->ubi_num, dev->vol_id, vi->name);
mutex_unlock(&devices_mutex);
@@ -24,7 +36,7 @@
ROOT_DEV == 0) {
pr_notice("ubiblock: device ubiblock%d_%d (%s) set to be root filesystem\n",
dev->ubi_num, dev->vol_id, vi->name);
-@@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_
+@@ -681,7 +688,7 @@ static void __init ubiblock_create_auto_rootfs(void)
struct ubi_volume_info vi;
for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
@@ -33,3 +45,6 @@
if (IS_ERR(desc))
continue;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2704-netfilter_optional_tcp_window_check.patch
similarity index 69%
rename from recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2704-netfilter_optional_tcp_window_check.patch
index f6a3a82..0aea6d3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/613-netfilter_optional_tcp_window_check.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/999-2704-netfilter_optional_tcp_window_check.patch
@@ -1,11 +1,16 @@
-From: Felix Fietkau <nbd@nbd.name>
-Subject: netfilter: optional tcp window check
+From 1f85572a62a39799a9bac846d46965d9a57a1e24 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:28 +0800
+Subject: [PATCH]
+ [networking][999-2704-netfilter_optional_tcp_window_check.patch]
-Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
- net/netfilter/nf_conntrack_proto_tcp.c | 13 +++++++++++++
- 1 file changed, 13 insertions(+)
+ net/netfilter/nf_conntrack_proto_tcp.c | 8 +++++++-
+ net/netfilter/nf_conntrack_standalone.c | 11 +++++++++++
+ 2 files changed, 18 insertions(+), 1 deletion(-)
+diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
+index aed967e2f..e219b6f34 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -31,6 +31,9 @@
@@ -18,7 +23,7 @@
/* "Be conservative in what you do,
be liberal in what you accept from others."
If it's non-zero, we mark only out of window RST segments as INVALID. */
-@@ -476,6 +479,9 @@ static bool tcp_in_window(const struct n
+@@ -476,6 +479,9 @@ static bool tcp_in_window(const struct nf_conn *ct,
s32 receiver_offset;
bool res, in_recv_win;
@@ -28,7 +33,7 @@
/*
* Get the required data from the packet.
*/
-@@ -1139,7 +1145,7 @@ int nf_conntrack_tcp_packet(struct nf_co
+@@ -1139,7 +1145,7 @@ int nf_conntrack_tcp_packet(struct nf_conn *ct,
IP_CT_TCP_FLAG_DATA_UNACKNOWLEDGED &&
timeouts[new_state] > timeouts[TCP_CONNTRACK_UNACK])
timeout = timeouts[TCP_CONNTRACK_UNACK];
@@ -37,6 +42,8 @@
timeouts[new_state] > timeouts[TCP_CONNTRACK_RETRANS])
timeout = timeouts[TCP_CONNTRACK_RETRANS];
else
+diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
+index 73415bf51..236954e4f 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -25,6 +25,9 @@
@@ -57,7 +64,7 @@
__NF_SYSCTL_CT_LAST_SYSCTL,
};
-@@ -969,6 +973,13 @@ static struct ctl_table nf_ct_sysctl_tab
+@@ -969,6 +973,13 @@ static struct ctl_table nf_ct_sysctl_table[] = {
.proc_handler = proc_dointvec_jiffies,
},
#endif
@@ -71,3 +78,6 @@
{}
};
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/pending-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/pending-5.4.inc
index 3ac355f..af11131 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/pending-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/pending-5.4.inc
@@ -65,15 +65,12 @@
file://496-dt-bindings-add-bindings-for-mtd-concat-devices.patch \
file://497-mtd-mtdconcat-add-dt-driver-for-concat-devices.patch \
file://498-mtd-mtdconcat-select-readwrite-function.patch \
- file://499-mtd-add-nmbm-support.patch \
- file://500-ubi-add-configurable-rootdev.patch \
file://530-jffs2_make_lzma_available.patch \
file://532-jffs2_eofdetect.patch \
file://600-netfilter_conntrack_flush.patch \
file://610-netfilter_match_bypass_default_checks.patch \
file://611-netfilter_match_bypass_default_table.patch \
file://612-netfilter_match_reduce_memory_access.patch \
- file://613-netfilter_optional_tcp_window_check.patch \
file://620-net_sched-codel-do-not-defer-queue-length-update.patch \
file://630-packet_socket_type.patch \
file://655-increase_skb_pad.patch \
@@ -123,4 +120,7 @@
file://834-ledtrig-libata.patch \
file://840-hwrng-bcm2835-set-quality-to-1000.patch \
file://920-mangle_bootargs.patch \
+ file://999-2328-mtd-add-nmbm-support.patch \
+ file://999-2329-ubi-add-configurable-rootdev.patch \
+ file://999-2704-netfilter_optional_tcp_window_check.patch \
"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
index 820e8bb..81851a0 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
@@ -124,9 +124,9 @@
#size-cells = <2>;
ranges;
- /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+ /* 256 KiB reserved for ARM Trusted Firmware (BL31) */
secmon_reserved: secmon@43000000 {
- reg = <0 0x43000000 0 0x30000>;
+ reg = <0 0x43000000 0 0x40000>;
no-map;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
index 96c68a5..6fcfa57 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
@@ -124,9 +124,9 @@
#size-cells = <2>;
ranges;
- /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+ /* 256 KiB reserved for ARM Trusted Firmware (BL31) */
secmon_reserved: secmon@43000000 {
- reg = <0 0x43000000 0 0x30000>;
+ reg = <0 0x43000000 0 0x40000>;
no-map;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index 820e8bb..81851a0 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -124,9 +124,9 @@
#size-cells = <2>;
ranges;
- /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+ /* 256 KiB reserved for ARM Trusted Firmware (BL31) */
secmon_reserved: secmon@43000000 {
- reg = <0 0x43000000 0 0x30000>;
+ reg = <0 0x43000000 0 0x40000>;
no-map;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
index 96c68a5..6fcfa57 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
@@ -124,9 +124,9 @@
#size-cells = <2>;
ranges;
- /* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+ /* 256 KiB reserved for ARM Trusted Firmware (BL31) */
secmon_reserved: secmon@43000000 {
- reg = <0 0x43000000 0 0x30000>;
+ reg = <0 0x43000000 0 0x40000>;
no-map;
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
index 9e2e9a9..2cf886c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
@@ -263,7 +263,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
index 201f9ee..bf2abb6 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
@@ -102,7 +102,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
index d664a46..aa93f3c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
@@ -93,7 +93,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
index c7e83fd..b8fb6aa 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
@@ -127,7 +127,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
index cf117ca..de0bc9c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
@@ -258,7 +258,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
index a9fc3c5..70a7554 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
@@ -127,7 +127,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
index 2a24f7d..7f7ddfd 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
@@ -73,6 +73,58 @@
};
};
+&i2c0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2c0_pins>;
+ status = "okay";
+
+ rt5190a_64: rt5190a@64 {
+ compatible = "richtek,rt5190a";
+ reg = <0x64>;
+ /*interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>;*/
+ vin2-supply = <&rt5190_buck1>;
+ vin3-supply = <&rt5190_buck1>;
+ vin4-supply = <&rt5190_buck1>;
+
+ regulators {
+ rt5190_buck1: buck1 {
+ regulator-name = "rt5190a-buck1";
+ regulator-min-microvolt = <5090000>;
+ regulator-max-microvolt = <5090000>;
+ regulator-allowed-modes =
+ <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+ regulator-boot-on;
+ };
+ buck2 {
+ regulator-name = "vcore";
+ regulator-min-microvolt = <600000>;
+ regulator-max-microvolt = <1400000>;
+ regulator-boot-on;
+ };
+ buck3 {
+ regulator-name = "proc";
+ regulator-min-microvolt = <600000>;
+ regulator-max-microvolt = <1400000>;
+ regulator-boot-on;
+ };
+ buck4 {
+ regulator-name = "rt5190a-buck4";
+ regulator-min-microvolt = <850000>;
+ regulator-max-microvolt = <850000>;
+ regulator-allowed-modes =
+ <RT5190A_OPMODE_AUTO RT5190A_OPMODE_FPWM>;
+ regulator-boot-on;
+ };
+ ldo {
+ regulator-name = "rt5190a-ldo";
+ regulator-min-microvolt = <1200000>;
+ regulator-max-microvolt = <1200000>;
+ regulator-boot-on;
+ };
+ };
+ };
+};
+
&uart0 {
status = "okay";
};
@@ -166,6 +218,13 @@
};
};
+ i2c0_pins: i2c0-pins-g0 {
+ mux {
+ function = "i2c";
+ groups = "i2c0_1";
+ };
+ };
+
pcie0_pins: pcie0-pins {
mux {
function = "pcie";
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
index fde3572..13e25e1 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
@@ -213,7 +213,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
index 0941b06..3865bf8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
@@ -229,7 +229,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
index ba29680..8e5751b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-emmc.dts
@@ -102,7 +102,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
index 133da0c..a681b8b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sd.dts
@@ -93,7 +93,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
index 7721c07..6a7773f 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
@@ -127,7 +127,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
index 06b5702..d7df193 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
@@ -247,7 +247,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
index 61cdf7b..4f281a3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
@@ -127,7 +127,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
index a86e77e..1b04950 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
@@ -223,7 +223,7 @@
conf {
groups = "mdc_mdio0";
- drive-strength = <MTK_DRIVE_8mA>;
+ drive-strength = <MTK_DRIVE_10mA>;
};
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
index 9987630..189d409 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.c
@@ -41,8 +41,10 @@
u32 hw_lro_norule_flush_cnt[MTK_HW_LRO_RING_NUM];
u32 mtk_hwlro_stats_ebl;
u32 dbg_show_level;
+u32 cur_rss_num;
-static struct proc_dir_entry *proc_hw_lro_stats, *proc_hw_lro_auto_tlb;
+static struct proc_dir_entry *proc_hw_lro_stats, *proc_hw_lro_auto_tlb,
+ *proc_rss_ctrl;
typedef int (*mtk_lro_dbg_func) (int par);
struct mtk_eth_debug {
@@ -1124,6 +1126,60 @@
.release = single_release
};
+ssize_t rss_ctrl_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *data)
+{
+ char buf[32];
+ char *p_buf;
+ char *p_token = NULL;
+ char *p_delimiter = " \t";
+ long num = 4;
+ u32 len = count;
+ int ret;
+
+ if (len >= sizeof(buf)) {
+ pr_info("Input handling fail!\n");
+ return -1;
+ }
+
+ if (copy_from_user(buf, buffer, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+
+ p_buf = buf;
+ p_token = strsep(&p_buf, p_delimiter);
+ if (!p_token)
+ num = 4;
+ else
+ ret = kstrtol(p_token, 10, &num);
+
+ if (!mtk_rss_set_indr_tbl(g_eth, num))
+ cur_rss_num = num;
+
+ return count;
+}
+
+int rss_ctrl_read(struct seq_file *seq, void *v)
+{
+ pr_info("ADMA is using %d-RSS.\n", cur_rss_num);
+ return 0;
+}
+
+static int rss_ctrl_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, rss_ctrl_read, 0);
+}
+
+static const struct file_operations rss_ctrl_fops = {
+ .owner = THIS_MODULE,
+ .open = rss_ctrl_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .write = rss_ctrl_write,
+ .release = single_release
+};
+
void hw_lro_stats_update(u32 ring_no, struct mtk_rx_dma_v2 *rxd)
{
struct mtk_eth *eth = g_eth;
@@ -1837,6 +1893,17 @@
if (!proc_dbg_regs)
pr_notice("!! FAIL to create %s PROC !!\n", PROCREG_DBG_REGS);
+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_RSS)) {
+ proc_rss_ctrl =
+ proc_create(PROCREG_RSS_CTRL, 0, proc_reg_dir,
+ &rss_ctrl_fops);
+ if (!proc_rss_ctrl)
+ pr_info("!! FAIL to create %s PROC !!\n",
+ PROCREG_RSS_CTRL);
+
+ cur_rss_num = g_eth->soc->rss_num;
+ }
+
if (g_eth->hwlro) {
proc_hw_lro_stats =
proc_create(PROCREG_HW_LRO_STATS, 0, proc_reg_dir,
@@ -1881,6 +1948,9 @@
if (proc_dbg_regs)
remove_proc_entry(PROCREG_DBG_REGS, proc_reg_dir);
+ if (proc_rss_ctrl)
+ remove_proc_entry(PROCREG_RSS_CTRL, proc_reg_dir);
+
if (g_eth->hwlro) {
if (proc_hw_lro_stats)
remove_proc_entry(PROCREG_HW_LRO_STATS, proc_reg_dir);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.h
index ec7167b..3e7c137 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_dbg.h
@@ -61,6 +61,7 @@
#define PROCREG_RXRING "rx_ring"
#define PROCREG_DIR "mtketh"
#define PROCREG_DBG_REGS "dbg_regs"
+#define PROCREG_RSS_CTRL "rss_ctrl"
#define PROCREG_HW_LRO_STATS "hw_lro_stats"
#define PROCREG_HW_LRO_AUTO_TLB "hw_lro_auto_tlb"
#define PROCREG_RESET_EVENT "reset_event"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 02f1d34..8f94fc5 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3015,6 +3015,24 @@
return 0;
}
+int mtk_rss_set_indr_tbl(struct mtk_eth *eth, int num)
+{
+ u32 i, config;
+
+ if (num <= 0 || num > MTK_RX_NAPI_NUM)
+ return -EOPNOTSUPP;
+
+ for (i = 0, config = 0; i < 16; i++) {
+ config <<= 2;
+ config |= (i % num);
+ }
+
+ for (i = 0; i < 8; i++)
+ mtk_w32(eth, config, MTK_RSS_INDR_TABLE_DW(i));
+
+ return 0;
+}
+
static int mtk_rss_init(struct mtk_eth *eth)
{
u32 val;
@@ -3045,14 +3063,7 @@
mtk_w32(eth, val, MTK_PDMA_RSS_GLO_CFG);
/* Select the size of indirection table */
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW0);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW1);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW2);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW3);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW4);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW5);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW6);
- mtk_w32(eth, MTK_RSS_INDR_TABLE_SIZE4, MTK_RSS_INDR_TABLE_DW7);
+ mtk_rss_set_indr_tbl(eth, eth->soc->rss_num);
/* Pause */
val |= MTK_RSS_CFG_REQ;
@@ -4911,6 +4922,7 @@
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -4927,6 +4939,7 @@
.required_clks = MT7621_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rx_dma_l4_valid = RX_DMA_L4_VALID,
@@ -4944,6 +4957,7 @@
.required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -4960,6 +4974,7 @@
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -4977,6 +4992,7 @@
.required_clks = MT7629_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -4994,6 +5010,7 @@
.required_clks = MT7986_CLKS_BITMAP,
.required_pctl = false,
.has_sram = true,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -5011,6 +5028,7 @@
.required_clks = MT7981_CLKS_BITMAP,
.required_pctl = false,
.has_sram = true,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -5028,6 +5046,7 @@
.required_clks = MT7988_CLKS_BITMAP,
.required_pctl = false,
.has_sram = true,
+ .rss_num = 4,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
.rxd_size = sizeof(struct mtk_rx_dma_v2),
@@ -5044,6 +5063,7 @@
.required_clks = MT7628_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 7465188..06c2b0a 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -267,15 +267,8 @@
#define MTK_RSS_CFG_REQ BIT(2)
#define MTK_RSS_IPV6_STATIC_HASH (0x7 << 8)
#define MTK_RSS_IPV4_STATIC_HASH (0x7 << 12)
-#define MTK_RSS_INDR_TABLE_DW0 (MTK_PDMA_RSS_GLO_CFG + 0x50)
-#define MTK_RSS_INDR_TABLE_DW1 (MTK_PDMA_RSS_GLO_CFG + 0x54)
-#define MTK_RSS_INDR_TABLE_DW2 (MTK_PDMA_RSS_GLO_CFG + 0x58)
-#define MTK_RSS_INDR_TABLE_DW3 (MTK_PDMA_RSS_GLO_CFG + 0x5C)
-#define MTK_RSS_INDR_TABLE_DW4 (MTK_PDMA_RSS_GLO_CFG + 0x60)
-#define MTK_RSS_INDR_TABLE_DW5 (MTK_PDMA_RSS_GLO_CFG + 0x64)
-#define MTK_RSS_INDR_TABLE_DW6 (MTK_PDMA_RSS_GLO_CFG + 0x68)
-#define MTK_RSS_INDR_TABLE_DW7 (MTK_PDMA_RSS_GLO_CFG + 0x6C)
-#define MTK_RSS_INDR_TABLE_SIZE4 0x39393939
+#define MTK_RSS_INDR_TABLE_DW(x) (MTK_PDMA_RSS_GLO_CFG + 0x50 + \
+ ((x) * 0x4))
/* PDMA Global Configuration Register */
#define MTK_PDMA_GLO_CFG (PDMA_BASE + 0x204)
@@ -1614,6 +1607,7 @@
struct mtk_soc_data {
const struct mtk_reg_map *reg_map;
u32 ana_rgc3;
+ u32 rss_num;
u64 caps;
u64 required_clks;
bool required_pctl;
@@ -1870,4 +1864,5 @@
int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
+int mtk_rss_set_indr_tbl(struct mtk_eth *eth, int num);
#endif /* MTK_ETH_H */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
index c2acab2..3cc8f90 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_sgmii.c
@@ -440,22 +440,18 @@
sgm_mode = SGMII_IF_MODE_SGMII |
SGMII_REMOTE_FAULT_DIS |
SGMII_SPEED_DUPLEX_AN;
- } else if (phylink_autoneg_inband(mode)) {
- /* 1000base-X or HSGMII with autoneg */
- if (interface == PHY_INTERFACE_MODE_2500BASEX)
- return -EINVAL;
-
+ } else if (interface == PHY_INTERFACE_MODE_2500BASEX) {
+ /* HSGMII without autoneg */
+ speed = SGMII_SPEED_1000;
+ sgm_mode = SGMII_IF_MODE_SGMII;
+ } else {
+ /* 1000base-X with/without autoneg */
bmcr = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
advertising) ? SGMII_AN_ENABLE : 0;
if (bmcr)
sgm_mode = SGMII_SPEED_DUPLEX_AN;
else
speed = SGMII_SPEED_1000;
- } else {
- /* 1000base-X or HSGMII without autoneg */
- speed = SGMII_SPEED_1000;
- if (interface == PHY_INTERFACE_MODE_2500BASEX)
- sgm_mode = SGMII_IF_MODE_SGMII;
}
if (mpcs->interface != interface ||
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
index 2825a36..1047943 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-2p5ge.c
@@ -222,10 +222,20 @@
if (ret < 0)
return ret;
phydev->duplex = (ret & MTK_PHY_FDX_ENABLE) ? DUPLEX_FULL : DUPLEX_HALF;
+ /* FIXME: The current firmware always enables rate adaptation mode. */
+ phydev->rate_matching = RATE_MATCH_PAUSE;
return 0;
}
+static int mt798x_2p5ge_phy_get_rate_matching(struct phy_device *phydev,
+ phy_interface_t iface)
+{
+ if (iface == PHY_INTERFACE_MODE_XGMII)
+ return RATE_MATCH_PAUSE;
+ return RATE_MATCH_NONE;
+}
+
static struct phy_driver mtk_gephy_driver[] = {
{
PHY_ID_MATCH_EXACT(0x00339c11),
@@ -234,6 +244,7 @@
.config_aneg = mt798x_2p5ge_phy_config_aneg,
.get_features = mt798x_2p5ge_phy_get_features,
.read_status = mt798x_2p5ge_phy_read_status,
+ .get_rate_matching = mt798x_2p5ge_phy_get_rate_matching,
//.config_intr = genphy_no_config_intr,
//.handle_interrupt = genphy_no_ack_interrupt,
//.suspend = genphy_suspend,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge-soc.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge-soc.c
index f25fb8e..489e524 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge-soc.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge-soc.c
@@ -502,7 +502,7 @@
u16 reg, val;
if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988)
- bias = -2;
+ bias = -1;
val = clamp_val(bias + tx_r50_cal_val, 0, 63);
@@ -718,6 +718,11 @@
static void mt798x_phy_common_finetune(struct phy_device *phydev)
{
phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
+ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
+ __phy_write(phydev, 0x11, 0xc71);
+ __phy_write(phydev, 0x12, 0xc);
+ __phy_write(phydev, 0x10, 0x8fae);
+
/* EnabRandUpdTrig = 1 */
__phy_write(phydev, 0x11, 0x2f00);
__phy_write(phydev, 0x12, 0xe);
@@ -728,15 +733,56 @@
__phy_write(phydev, 0x12, 0x0);
__phy_write(phydev, 0x10, 0x83aa);
+ /* FfeUpdGainForce = 1(Enable), FfeUpdGainForceVal = 4 */
+ __phy_write(phydev, 0x11, 0x240);
+ __phy_write(phydev, 0x12, 0x0);
+ __phy_write(phydev, 0x10, 0x9680);
+
- /* TrFreeze = 0 */
+ /* TrFreeze = 0 (mt7988 default) */
__phy_write(phydev, 0x11, 0x0);
__phy_write(phydev, 0x12, 0x0);
__phy_write(phydev, 0x10, 0x9686);
+ /* SSTrKp100 = 5 */
+ /* SSTrKf100 = 6 */
+ /* SSTrKp1000Mas = 5 */
+ /* SSTrKf1000Mas = 6 */
/* SSTrKp1000Slv = 5 */
+ /* SSTrKf1000Slv = 6 */
__phy_write(phydev, 0x11, 0xbaef);
__phy_write(phydev, 0x12, 0x2e);
__phy_write(phydev, 0x10, 0x968c);
+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
+}
+
+static void mt7981_phy_finetune(struct phy_device *phydev)
+{
+ u16 val[8] = { 0x01ce, 0x01c1,
+ 0x020f, 0x0202,
+ 0x03d0, 0x03c0,
+ 0x0013, 0x0005 };
+ int i, k;
+
+ /* 100M eye finetune:
+ * Keep middle level of TX MLT3 shapper as default.
+ * Only change TX MLT3 overshoot level here.
+ */
+ for (k = 0, i = 1; i < 12; i++) {
+ if (i % 3 == 0)
+ continue;
+ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
+ }
+
+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
+ /* ResetSyncOffset = 6 */
+ __phy_write(phydev, 0x11, 0x600);
+ __phy_write(phydev, 0x12, 0x0);
+ __phy_write(phydev, 0x10, 0x8fc0);
+
+ /* VgaDecRate = 1 */
+ __phy_write(phydev, 0x11, 0x4c2a);
+ __phy_write(phydev, 0x12, 0x3e);
+ __phy_write(phydev, 0x10, 0x8fa4);
/* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2,
* MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2
@@ -751,7 +797,7 @@
__phy_write(phydev, 0x10, 0x8ec0);
phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
- /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/
+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9 */
phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9));
@@ -782,48 +828,7 @@
phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_PUMP_EN_PAIRCD, 0x0);
/* Adjust LDO output voltage */
phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222);
-}
-static void mt7981_phy_finetune(struct phy_device *phydev)
-{
- u16 val[8] = { 0x01ce, 0x01c1,
- 0x020f, 0x0202,
- 0x03d0, 0x03c0,
- 0x0013, 0x0005 };
- int i, k;
-
- /* 100M eye finetune:
- * Keep middle level of TX MLT3 shapper as default.
- * Only change TX MLT3 overshoot level here.
- */
- for (k = 0, i = 1; i < 12; i++) {
- if (i % 3 == 0)
- continue;
- phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
- }
-
- phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
- /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
- __phy_write(phydev, 0x11, 0xc71);
- __phy_write(phydev, 0x12, 0xc);
- __phy_write(phydev, 0x10, 0x8fae);
-
- /* ResetSyncOffset = 6 */
- __phy_write(phydev, 0x11, 0x600);
- __phy_write(phydev, 0x12, 0x0);
- __phy_write(phydev, 0x10, 0x8fc0);
-
- /* VgaDecRate = 1 */
- __phy_write(phydev, 0x11, 0x4c2a);
- __phy_write(phydev, 0x12, 0x3e);
- __phy_write(phydev, 0x10, 0x8fa4);
-
- /* FfeUpdGainForce = 4 */
- __phy_write(phydev, 0x11, 0x240);
- __phy_write(phydev, 0x12, 0x0);
- __phy_write(phydev, 0x10, 0x9680);
-
- phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
}
static void mt7988_phy_finetune(struct phy_device *phydev)
@@ -845,12 +850,6 @@
MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8);
phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
-
- /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */
- __phy_write(phydev, 0x11, 0x671);
- __phy_write(phydev, 0x12, 0xc);
- __phy_write(phydev, 0x10, 0x8fae);
-
/* ResetSyncOffset = 5 */
__phy_write(phydev, 0x11, 0x500);
__phy_write(phydev, 0x12, 0x0);
@@ -858,13 +857,28 @@
/* VgaDecRate is 1 at default on mt7988 */
- phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
+ /* MrvlTrFix100Kp = 6, MrvlTrFix100Kf = 7,
+ * MrvlTrFix1000Kp = 6, MrvlTrFix1000Kf = 7
+ */
+ __phy_write(phydev, 0x11, 0xb90a);
+ __phy_write(phydev, 0x12, 0x6f);
+ __phy_write(phydev, 0x10, 0x8f82);
+
+ /* RemAckCntLimitCtrl = 1 */
+ __phy_write(phydev, 0x11, 0xfbba);
+ __phy_write(phydev, 0x12, 0xc3);
+ __phy_write(phydev, 0x10, 0x87f8);
- phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30);
- /* TxClkOffset = 2 */
- __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK,
- FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2));
phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
+
+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 10 */
+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
+ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
+ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0xa));
+
+ /* rg_tr_lpf_cnt_val = 1023 */
+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x3ff);
+
}
static void mt798x_phy_eee(struct phy_device *phydev)
@@ -897,11 +911,11 @@
MTK_PHY_LPI_SLV_SEND_TX_EN,
FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120));
- phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
- MTK_PHY_LPI_SEND_LOC_TIMER_MASK |
- MTK_PHY_LPI_TXPCS_LOC_RCV,
- FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117));
+ /* Keep MTK_PHY_LPI_SEND_LOC_TIMER as 375 */
+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
+ MTK_PHY_LPI_TXPCS_LOC_RCV);
+ /* This also fixes some IoT issues, such as CH340 */
phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7,
MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK,
FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) |
@@ -935,7 +949,7 @@
__phy_write(phydev, 0x12, 0x0);
__phy_write(phydev, 0x10, 0x9690);
- /* REG_EEE_st2TrKf1000 = 3 */
+ /* REG_EEE_st2TrKf1000 = 2 */
__phy_write(phydev, 0x11, 0x114f);
__phy_write(phydev, 0x12, 0x2);
__phy_write(phydev, 0x10, 0x969a);
@@ -960,7 +974,7 @@
__phy_write(phydev, 0x12, 0x0);
__phy_write(phydev, 0x10, 0x96b8);
- /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */
+ /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 0 */
__phy_write(phydev, 0x11, 0x1463);
__phy_write(phydev, 0x12, 0x0);
__phy_write(phydev, 0x10, 0x96ca);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/1004-mtketh-add-threaded-napi-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3000-mtketh-add-threaded-napi-support.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/1004-mtketh-add-threaded-napi-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3000-mtketh-add-threaded-napi-support.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/1007-mtketh-add-qdma-sw-solution-for-mac80211-sdk.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3001-mtketh-add-qdma-sw-solution-for-mac80211-sdk.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/1007-mtketh-add-qdma-sw-solution-for-mac80211-sdk.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3001-mtketh-add-qdma-sw-solution-for-mac80211-sdk.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-ovs-add-multicast-to-unicast-support.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8011-ovs-add-multicast-to-unicast-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3002-ovs-add-multicast-to-unicast-support.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch
similarity index 99%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch
index 17f2cb1..b52782f 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9990-mt7622-backport-nf-hw-offload-framework-and-ups.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3003-mt7622-backport-nf-hw-offload-framework-and-ups.patch
@@ -135,33 +135,33 @@
.required_pctl = true,
.has_sram = false,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
@@ -4424,6 +4444,7 @@ static const struct mtk_soc_data mt7621_
.required_clks = MT7621_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
@@ -4439,6 +4460,7 @@ static const struct mtk_soc_data mt7622_
.required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
@@ -4453,6 +4475,7 @@ static const struct mtk_soc_data mt7623_
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.has_sram = false,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index b6380ffeb..349f98503 100755
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -1266,7 +1266,7 @@
index 000000000..4294f0c74
--- /dev/null
+++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c
-@@ -0,0 +1,541 @@
+@@ -0,0 +1,535 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
@@ -1735,14 +1735,11 @@
+{
+ struct mtk_mac *mac = netdev_priv(dev);
+ struct mtk_eth *eth = mac->hw;
-+ struct nf_flowtable *flowtable;
+ static LIST_HEAD(block_cb_list);
+ struct flow_block_cb *block_cb;
+ flow_setup_cb_t *cb;
+ int err = 0;
+
-+ flowtable = container_of(f->block, struct nf_flowtable, flow_block);
-+
+ if (!eth->ppe.foe_table)
+ return -EOPNOTSUPP;
+
@@ -1752,8 +1749,6 @@
+ cb = mtk_eth_setup_tc_block_cb;
+ f->driver_block_list = &block_cb_list;
+
-+ down_write(&flowtable->flow_block_lock);
-+
+ switch (f->command) {
+ case FLOW_BLOCK_BIND:
+ block_cb = flow_block_cb_lookup(f->block, cb, dev);
@@ -1788,7 +1783,6 @@
+ }
+
+unlock:
-+ up_write(&flowtable->flow_block_lock);
+ return err;
+}
+
@@ -4922,7 +4916,7 @@
index 000000000..d94c6fb92
--- /dev/null
+++ b/net/netfilter/nf_flow_table_offload.c
-@@ -0,0 +1,1197 @@
+@@ -0,0 +1,1199 @@
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
@@ -5766,7 +5760,7 @@
+ if (cmd == FLOW_CLS_REPLACE)
+ cls_flow.rule = flow_rule->rule;
+
-+ down_write(&flowtable->flow_block_lock);
++ down_read(&flowtable->flow_block_lock);
+ list_for_each_entry(block_cb, block_cb_list, list) {
+ err = block_cb->cb(TC_SETUP_CLSFLOWER, &cls_flow,
+ block_cb->cb_priv);
@@ -5775,7 +5769,7 @@
+
+ i++;
+ }
-+ up_write(&flowtable->flow_block_lock);
++ up_read(&flowtable->flow_block_lock);
+
+ if (cmd == FLOW_CLS_STATS)
+ memcpy(stats, &cls_flow.stats, sizeof(*stats));
@@ -5994,7 +5988,7 @@
+ struct flow_block_cb *block_cb, *next;
+ int err = 0;
+
-+ down_read(&flowtable->flow_block_lock);
++ down_write(&flowtable->flow_block_lock);
+
+ switch (cmd) {
+ case FLOW_BLOCK_BIND:
@@ -6011,7 +6005,7 @@
+ err = -EOPNOTSUPP;
+ }
+
-+ up_read(&flowtable->flow_block_lock);
++ up_write(&flowtable->flow_block_lock);
+
+ return err;
+}
@@ -6057,7 +6051,9 @@
+
+ nf_flow_table_block_offload_init(bo, dev_net(dev), cmd, flowtable,
+ extack);
++ down_write(&flowtable->flow_block_lock);
+ err = dev->netdev_ops->ndo_setup_tc(dev, TC_SETUP_FT, bo);
++ up_write(&flowtable->flow_block_lock);
+ if (err < 0)
+ return err;
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9992-dts-mt7986-wed-changes.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-dts-mt7986-wed-changes.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9992-dts-mt7986-wed-changes.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3004-dts-mt7986-wed-changes.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-add-wed.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9993-add-wed.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3005-add-wed.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch
similarity index 99%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch
index 033f588..c0efd12 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9994-ethernet-update-ppe-from-mt7622-to-mt7986.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3006-ethernet-update-ppe-from-mt7622-to-mt7986.patch
@@ -51,6 +51,7 @@
.required_pctl = false,
.has_sram = true,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
.rxd_size = sizeof(struct mtk_rx_dma),
@@ -60,7 +61,6 @@
},
};
- static const struct mtk_soc_data mt7981_data = {
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index b52378bd6..fce1a7172 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
similarity index 98%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
index 5d6f0d1..954c6e2 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9995-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3007-flow-offload-add-mkhnat-dual-ppe-new-v2.patch
@@ -165,7 +165,7 @@
struct rhashtable flow_table;
};
-@@ -1668,8 +1674,10 @@ int mtk_gmac_usxgmii_path_setup(struct m
+@@ -1668,9 +1674,11 @@ int mtk_gmac_usxgmii_path_setup(struct m
void mtk_usxgmii_reset(struct mtk_xgmii *ss, int mac_id);
int mtk_dump_usxgmii(struct regmap *pmap, char *name, u32 offset, u32 range);
@@ -174,6 +174,7 @@
int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
void *type_data);
void mtk_eth_set_dma_device(struct mtk_eth *eth, struct device *dma_dev);
+ int mtk_rss_set_indr_tbl(struct mtk_eth *eth, int num);
+
+int mtk_ppe_debugfs_init(struct mtk_eth *eth);
#endif /* MTK_ETH_H */
@@ -429,15 +430,13 @@
f->stats.lastused = jiffies - idle * HZ;
return 0;
-@@ -540,12 +564,14 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
+@@ -540,10 +564,12 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
static LIST_HEAD(block_cb_list);
struct flow_block_cb *block_cb;
flow_setup_cb_t *cb;
- int err = 0;
+ int i, err = 0;
- flowtable = container_of(f->block, struct nf_flowtable, flow_block);
-
- if (!eth->ppe || !eth->ppe->foe_table)
- return -EOPNOTSUPP;
+ for (i = 0; i < eth->ppe_num; i++) {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9996-add-wed-tx-support-for-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-tx-support-for-mt7986.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9996-add-wed-tx-support-for-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3008-add-wed-tx-support-for-mt7986.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9996-add-wed-tx-wds-support-for-mt7986.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-tx-wds-support-for-mt7986.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9996-add-wed-tx-wds-support-for-mt7986.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3009-add-wed-tx-wds-support-for-mt7986.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-add-wed-rx-support-for-mt7896.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9997-add-wed-rx-support-for-mt7896.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3010-add-wed-rx-support-for-mt7896.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9998-add-wed-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-add-wed-ser-support.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9998-add-wed-ser-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3011-add-wed-ser-support.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-1-ethernet-update-ppe-backward-compatible-two-way-hash.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch
old mode 100644
new mode 100755
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-1-ethernet-update-ppe-backward-compatible-two-way-hash.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch
index ab5bbab..cfe29e7
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-1-ethernet-update-ppe-backward-compatible-two-way-hash.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3012-ethernet-update-ppe-backward-compatible-two-way-hash.patch
@@ -18,49 +18,49 @@
.has_sram = false,
+ .hash_way = 2,
.offload_version = 2,
+ .rss_num = 0,
.txrx = {
- .txd_size = sizeof(struct mtk_tx_dma),
@@ -4573,6 +4575,7 @@ static const struct mtk_soc_data mt7621_
.required_clks = MT7621_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .hash_way = 2,
.offload_version = 2,
+ .rss_num = 0,
.txrx = {
- .txd_size = sizeof(struct mtk_tx_dma),
@@ -4589,6 +4592,7 @@ static const struct mtk_soc_data mt7622_
.required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .hash_way = 2,
.offload_version = 2,
+ .rss_num = 0,
.txrx = {
- .txd_size = sizeof(struct mtk_tx_dma),
@@ -4604,6 +4608,7 @@ static const struct mtk_soc_data mt7623_
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
.has_sram = false,
+ .hash_way = 2,
.offload_version = 2,
+ .rss_num = 0,
.txrx = {
- .txd_size = sizeof(struct mtk_tx_dma),
@@ -4635,6 +4640,7 @@ static const struct mtk_soc_data mt7986_
.required_clks = MT7986_CLKS_BITMAP,
.required_pctl = false,
.has_sram = true,
+ .hash_way = 4,
.offload_version = 2,
+ .rss_num = 0,
.txrx = {
- .txd_size = sizeof(struct mtk_tx_dma_v2),
@@ -4651,6 +4657,8 @@ static const struct mtk_soc_data mt7981_
.required_clks = MT7981_CLKS_BITMAP,
.required_pctl = false,
.has_sram = true,
+ .hash_way = 4,
+ .offload_version = 2,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
- .rxd_size = sizeof(struct mtk_rx_dma_v2),
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 4a69bd0..35a7543 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-2-flow-offload-add-mtkhnat-flow-accounting.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch
old mode 100644
new mode 100755
similarity index 98%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-2-flow-offload-add-mtkhnat-flow-accounting.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch
index 5b6253f..ed90d2c
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-2-flow-offload-add-mtkhnat-flow-accounting.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3013-flow-offload-add-mtkhnat-flow-accounting.patch
@@ -19,7 +19,7 @@
+ .has_accounting = false,
.hash_way = 2,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4073,6 +4075,7 @@ static const struct mtk_soc_data mt7621_data = {
.required_clks = MT7621_CLKS_BITMAP,
.required_pctl = false,
@@ -27,7 +27,7 @@
+ .has_accounting = false,
.hash_way = 2,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4090,6 +4093,7 @@ static const struct mtk_soc_data mt7622_data = {
.required_clks = MT7622_CLKS_BITMAP,
.required_pctl = false,
@@ -35,7 +35,7 @@
+ .has_accounting = true,
.hash_way = 2,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4106,6 +4110,7 @@ static const struct mtk_soc_data mt7623_data = {
.required_clks = MT7623_CLKS_BITMAP,
.required_pctl = true,
@@ -43,15 +43,15 @@
+ .has_accounting = false,
.hash_way = 2,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4123,6 +4128,7 @@ static const struct mtk_soc_data mt7629_data = {
.required_clks = MT7629_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .has_accounting = true,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
@@ -4138,6 +4144,7 @@ static const struct mtk_soc_data mt7986_data = {
.required_clks = MT7986_CLKS_BITMAP,
.required_pctl = false,
@@ -59,7 +59,7 @@
+ .has_accounting = true,
.hash_way = 4,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4155,6 +4162,7 @@ static const struct mtk_soc_data mt7981_data = {
.required_clks = MT7981_CLKS_BITMAP,
.required_pctl = false,
@@ -67,15 +67,15 @@
+ .has_accounting = true,
.hash_way = 4,
.offload_version = 2,
- .txrx = {
+ .rss_num = 0,
@@ -4171,6 +4179,7 @@ static const struct mtk_soc_data rt5350_data = {
.required_clks = MT7628_CLKS_BITMAP,
.required_pctl = false,
.has_sram = false,
+ .has_accounting = false,
+ .rss_num = 0,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
- .rxd_size = sizeof(struct mtk_rx_dma),
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index f659633..5e16fa8 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-3-flow-offload-add-mtkhnat-qdma-qos.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-4-flow-offload-ovs-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-flow-offload-ovs-support.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-4-flow-offload-ovs-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3015-flow-offload-ovs-support.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-5-update-net-bridge-for-bridger.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-update-net-bridge-for-bridger.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-5-update-net-bridge-for-bridger.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3016-update-net-bridge-for-bridger.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch
old mode 100644
new mode 100755
similarity index 99%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch
index aac0808..d9af44d
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-6-ethernet-update-ppe-from-mt7986-to-mt7988.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3017-ethernet-update-ppe-from-mt7986-to-mt7988.patch
@@ -41,6 +41,7 @@
+ .has_accounting = true,
+ .hash_way = 4,
+ .offload_version = 2,
+ .rss_num = 4,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma_v2),
.rxd_size = sizeof(struct mtk_rx_dma_v2),
@@ -50,7 +51,6 @@
.qdma_tx_sch = 4,
},
};
-
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 5b39d87..94bd423 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-7-mediatek-ethernet-add-wifi2wifi-offload-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-7-mediatek-ethernet-add-wifi2wifi-offload-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch
index 85e15c9..c810ff1 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-7-mediatek-ethernet-add-wifi2wifi-offload-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3018-mediatek-ethernet-add-wifi2wifi-offload-support.patch
@@ -56,7 +56,7 @@
if (!tc_can_offload(dev))
return -EOPNOTSUPP;
-@@ -577,17 +587,22 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
+@@ -577,14 +587,19 @@ mtk_eth_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_pri
return err;
}
@@ -69,7 +69,6 @@
- struct mtk_mac *mac = netdev_priv(dev);
- struct mtk_eth *eth = mac->hw;
+ struct mtk_mac *mac;
- struct nf_flowtable *flowtable;
static LIST_HEAD(block_cb_list);
struct flow_block_cb *block_cb;
flow_setup_cb_t *cb;
@@ -80,8 +79,6 @@
+ eth = mac->hw;
+ }
+
- flowtable = container_of(f->block, struct nf_flowtable, flow_block);
-
for (i = 0; i < eth->ppe_num; i++) {
@@ -610,7 +625,7 @@ mtk_eth_setup_tc_block(struct net_device *dev, struct flow_block_offload *f)
flow_block_cb_incref(block_cb);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-8-flow-offload-add-mtkhnat-dscp.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3019-flow-offload-add-mtkhnat-dscp.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-8-flow-offload-add-mtkhnat-dscp.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3019-flow-offload-add-mtkhnat-dscp.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-9-flow-offload-add-mtkhnat-netlink.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3020-flow-offload-add-mtkhnat-netlink.patch
old mode 100644
new mode 100755
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-9-flow-offload-add-mtkhnat-netlink.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3020-flow-offload-add-mtkhnat-netlink.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7988.cfg b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7988.cfg
index e706419..9906113 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7988.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7988.cfg
@@ -263,6 +263,7 @@
CONFIG_LZO_DECOMPRESS=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_MAGIC_SYSRQ_SERIAL=y
+CONFIG_MARVELL_PHY=y
CONFIG_MARVELL_10G_PHY=y
CONFIG_MAXLINEAR_GPHY=y
CONFIG_MD=y
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-2708-mtkhnat-add-support-for-virtual-interface-acceleration.patch
similarity index 76%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-2708-mtkhnat-add-support-for-virtual-interface-acceleration.patch
index 150087a..4d21ebd 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/nf_hnat/999-2708-mtkhnat-add-support-for-virtual-interface-acceleration.patch
@@ -1,8 +1,21 @@
+From fd6e50fdeb1d943b889a5aa093790a798ae598d3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:29 +0800
+Subject: [PATCH]
+ [networking][999-2708-mtkhnat-add-support-for-virtual-interface-acceleration.patch]
+
+---
+ include/net/netfilter/nf_flow_table.h | 3 +++
+ net/8021q/vlan_dev.c | 1 +
+ net/ipv6/ip6_tunnel.c | 24 ++++++++++++++++++++++++
+ net/ipv6/sit.c | 24 ++++++++++++++++++++++++
+ 4 files changed, 52 insertions(+)
+
diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
-index 3d73c0c..960ade1 100644
+index 16dbf5461..4cb73a7cb 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
-@@ -92,9 +92,12 @@ struct flow_offload {
+@@ -94,9 +94,12 @@ struct flow_offload {
#define FLOW_OFFLOAD_PATH_VLAN BIT(1)
#define FLOW_OFFLOAD_PATH_PPPOE BIT(2)
#define FLOW_OFFLOAD_PATH_DSA BIT(3)
@@ -16,10 +29,10 @@
u8 eth_src[ETH_ALEN];
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
-index be6801524..c51af70f6 100644
+index f973bec77..dbb3cea5c 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
-@@ -761,6 +761,7 @@ static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
+@@ -764,6 +764,7 @@ static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
path->flags |= FLOW_OFFLOAD_PATH_VLAN;
path->vlan_proto = vlan->vlan_proto;
path->vlan_id = vlan->vlan_id;
@@ -28,7 +41,7 @@
if (vlan->real_dev->netdev_ops->ndo_flow_offload_check)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
-index 1b7e3141c..da4e34f74 100644
+index 71ef26e60..f8302fdd5 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -57,6 +57,11 @@
@@ -43,7 +56,7 @@
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6 tunneling device");
MODULE_LICENSE("GPL");
-@@ -1880,6 +1885,22 @@ int ip6_tnl_get_iflink(const struct net_device *dev)
+@@ -1889,6 +1894,22 @@ int ip6_tnl_get_iflink(const struct net_device *dev)
}
EXPORT_SYMBOL(ip6_tnl_get_iflink);
@@ -66,7 +79,7 @@
int ip6_tnl_encap_add_ops(const struct ip6_tnl_encap_ops *ops,
unsigned int num)
{
-@@ -1941,6 +1962,9 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
+@@ -1950,6 +1971,9 @@ static const struct net_device_ops ip6_tnl_netdev_ops = {
.ndo_change_mtu = ip6_tnl_change_mtu,
.ndo_get_stats = ip6_get_stats,
.ndo_get_iflink = ip6_tnl_get_iflink,
@@ -77,7 +90,7 @@
#define IPXIPX_FEATURES (NETIF_F_SG | \
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
-index 98954830c..42b6e8c4c 100644
+index 117960895..0844a95e3 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -52,6 +52,11 @@
@@ -92,7 +105,7 @@
/*
This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c
-@@ -1345,6 +1350,22 @@ ipip6_tunnel_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+@@ -1342,6 +1347,22 @@ done:
return err;
}
@@ -115,7 +128,7 @@
static const struct net_device_ops ipip6_netdev_ops = {
.ndo_init = ipip6_tunnel_init,
.ndo_uninit = ipip6_tunnel_uninit,
-@@ -1352,6 +1373,9 @@ static const struct net_device_ops ipip6_netdev_ops = {
+@@ -1349,6 +1370,9 @@ static const struct net_device_ops ipip6_netdev_ops = {
.ndo_do_ioctl = ipip6_tunnel_ioctl,
.ndo_get_stats64 = ip_tunnel_get_stats64,
.ndo_get_iflink = ip_tunnel_get_iflink,
@@ -125,3 +138,6 @@
};
static void ipip6_dev_free(struct net_device *dev)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-cpufreq-add-the-missing-platform-driver-unregister.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-cpufreq-add-the-missing-platform-driver-unregister.patch
deleted file mode 100644
index fdf953d..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-cpufreq-add-the-missing-platform-driver-unregister.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
-index 927ebc5..03bb7b5 100644
---- a/drivers/cpufreq/mediatek-cpufreq.c
-+++ b/drivers/cpufreq/mediatek-cpufreq.c
-@@ -573,6 +573,7 @@ static int __init mtk_cpufreq_driver_init(void)
- pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
- if (IS_ERR(pdev)) {
- pr_err("failed to register mtk-cpufreq platform device\n");
-+ platform_driver_unregister(&mtk_cpufreq_platdrv);
- return PTR_ERR(pdev);
- }
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0006-powerdomain-add-mt7988-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0006-powerdomain-add-mt7988-support.patch
deleted file mode 100644
index 7fc4f1d..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0006-powerdomain-add-mt7988-support.patch
+++ /dev/null
@@ -1,9 +0,0 @@
-diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
-index b017330..1c485e3 100644
---- a/drivers/soc/mediatek/Makefile
-+++ b/drivers/soc/mediatek/Makefile
-@@ -3,3 +3,4 @@ obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
- obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
- obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
- obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
-+obj-$(CONFIG_MTK_SCPSYS) += mtk-pm-domains.o
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0020-dts-mt7622-enable-new-mtk-snand-for-ubi.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0020-dts-mt7622-enable-new-mtk-snand-for-ubi.patch
deleted file mode 100644
index 3a9e061..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0020-dts-mt7622-enable-new-mtk-snand-for-ubi.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
-+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
-@@ -567,6 +567,20 @@
- status = "disabled";
- };
-
-+ snand: snfi@1100d000 {
-+ compatible = "mediatek,mt7622-snand";
-+ reg = <0 0x1100d000 0 0x1000>, <0 0x1100e000 0 0x1000>;
-+ reg-names = "nfi", "ecc";
-+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
-+ clocks = <&pericfg CLK_PERI_NFI_PD>,
-+ <&pericfg CLK_PERI_SNFI_PD>,
-+ <&pericfg CLK_PERI_NFIECC_PD>;
-+ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
-+ #address-cells = <1>;
-+ #size-cells = <0>;
-+ status = "disabled";
-+ };
-+
- nor_flash: spi@11014000 {
- compatible = "mediatek,mt7622-nor",
- "mediatek,mt8173-nor";
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0021-dts-mt7622-remove-cooling-device.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0021-dts-mt7622-remove-cooling-device.patch
deleted file mode 100644
index efcc14f..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0021-dts-mt7622-remove-cooling-device.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
-+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
-@@ -167,25 +167,6 @@
- };
- };
-
-- cooling-maps {
-- map0 {
-- trip = <&cpu_passive>;
-- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-- };
--
-- map1 {
-- trip = <&cpu_active>;
-- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-- };
--
-- map2 {
-- trip = <&cpu_hot>;
-- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
-- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
-- };
-- };
- };
- };
-
---
-2.29.2
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0200-show_model_name_in_cpuinfo_on_arm64.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0200-show_model_name_in_cpuinfo_on_arm64.patch
deleted file mode 100644
index 98e5ab6..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0200-show_model_name_in_cpuinfo_on_arm64.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Index: linux-5.4.70/arch/arm64/kernel/cpuinfo.c
-===================================================================
---- linux-5.4.70.orig/arch/arm64/kernel/cpuinfo.c
-+++ linux-5.4.70/arch/arm64/kernel/cpuinfo.c
-@@ -139,9 +139,8 @@ static int c_show(struct seq_file *m, vo
- * "processor". Give glibc what it expects.
- */
- seq_printf(m, "processor\t: %d\n", i);
-- if (compat)
-- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
-- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
-+ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
-+ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
-
- seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
- loops_per_jiffy / (500000UL/HZ),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0491-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0491-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch
deleted file mode 100644
index 7951d63..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0491-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/mtd/nand/spi/macronix.c
-+++ b/drivers/mtd/nand/spi/macronix.c
-@@ -86,7 +86,7 @@ static int mx35lf1ge4ab_ecc_get_status(s
- if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
- return nand->eccreq.strength;
-
-- if (WARN_ON(eccsr > nand->eccreq.strength || !eccsr))
-+ if (eccsr > nand->eccreq.strength || !eccsr)
- return nand->eccreq.strength;
-
- return eccsr;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0504-macsec-revert-async-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0504-macsec-revert-async-support.patch
deleted file mode 100644
index d52db50..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0504-macsec-revert-async-support.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/net/macsec.c
-+++ b/drivers/net/macsec.c
-@@ -1309,8 +1309,7 @@
- struct crypto_aead *tfm;
- int ret;
-
-- /* Pick a sync gcm(aes) cipher to ensure order is preserved. */
-- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
-+ tfm = crypto_alloc_aead("gcm(aes)", 0, 0);
-
- if (IS_ERR(tfm))
- return tfm;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-spi-mtk-nor-fix-timeout-calculation-overflow.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-spi-mtk-nor-fix-timeout-calculation-overflow.patch
deleted file mode 100644
index 86b2089..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-spi-mtk-nor-fix-timeout-calculation-overflow.patch
+++ /dev/null
@@ -1,179 +0,0 @@
-From patchwork Tue Sep 22 11:49:02 2020
-Content-Type: text/plain; charset="utf-8"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-X-Patchwork-Submitter: Chuanhong Guo <gch981213@gmail.com>
-X-Patchwork-Id: 11792387
-Return-Path:
- <SRS0=i66O=C7=lists.infradead.org=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@kernel.org>
-Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org
- [172.30.200.123])
- by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 21EB0618
- for <patchwork-linux-arm@patchwork.kernel.org>;
- Tue, 22 Sep 2020 11:51:33 +0000 (UTC)
-Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134])
- (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
- (No client certificate requested)
- by mail.kernel.org (Postfix) with ESMTPS id E15FF221EB
- for <patchwork-linux-arm@patchwork.kernel.org>;
- Tue, 22 Sep 2020 11:51:32 +0000 (UTC)
-Authentication-Results: mail.kernel.org;
- dkim=pass (2048-bit key) header.d=lists.infradead.org
- header.i=@lists.infradead.org header.b="KBg/skkC";
- dkim=fail reason="signature verification failed" (2048-bit key)
- header.d=gmail.com header.i=@gmail.com header.b="Gtqp4rrT"
-DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E15FF221EB
-Authentication-Results: mail.kernel.org;
- dmarc=fail (p=none dis=none) header.from=gmail.com
-Authentication-Results: mail.kernel.org;
- spf=none
- smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
- d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding:
- Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive:
- List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From:
- Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender
- :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner;
- bh=Xg61WV47qNPjINdHDPnF6T3q8GN8f9evwhTMdYR0Zqs=; b=KBg/skkCvnF7/8AlleTay0p/H2
- hC4Lzo+slWhX5/eepUEXzhTr5ORf4Dx9gD65UEuordKQKFpg6Y9ApoGaYtmBJ0vABdAZt+oVG4sFf
- K3z3CYV6EZ5qvwsZt53Xm3YsHojgu+Lnc/MGgGWBRjCtTP7gshm480pZ0w6ADgHvrym5hNajUF6+5
- zMm5Wwq34jxUApGU7k5FAPsvO5ctYCuhECq/mLB6tplCVh3/+XLdSiHMUlY17fh+xs732kgaDotuQ
- QYgXtDmMB1pVKCq5cf3Bcuz7Ww47vLSx4rBxtdB/vpp2w9SdrU6K8Q7DuJ3+XrGfbMhKtBU5ektA8
- GxEUUaKw==;
-Received: from localhost ([::1] helo=merlin.infradead.org)
- by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux))
- id 1kKgo2-0000Ze-Fb; Tue, 22 Sep 2020 11:50:00 +0000
-Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543])
- by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux))
- id 1kKgnr-0000Vv-6z; Tue, 22 Sep 2020 11:49:49 +0000
-Received: by mail-pg1-x543.google.com with SMTP id o25so6798387pgm.0;
- Tue, 22 Sep 2020 04:49:46 -0700 (PDT)
-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
- h=from:to:cc:subject:date:message-id:mime-version
- :content-transfer-encoding;
- bh=EJwpKrbgqo/Jc/SWHvyAGB9CrpkZ5L1Hzq9tInFHTYk=;
- b=Gtqp4rrTgM1+bYxfUQXe+lfPcgHRW6GccdN42Iszl6ozMbezvftl1BUcKE22S6eFW3
- Vs+lcKZN9Eh9C53YAAd0cuZYhJ2GqlfGNLA/9SyB7s/gIwHqO9Cuu17YpB9dAFfEUxoS
- 825uUcTeRe6BTagZAh2/MBluiMY3TszRi94MbOftxUg+wSqp0wMAPe9RN0gAEc/l2xgK
- 8PhXbZv3uItI4QqoKYiz93vrF/zYhj+oGTI44g2li2fpAgCNL7lXCpSE2C9NsEe+YqTw
- aO5A3W8t4jvp8oCJEvr/MWY1ZZLd1fVJ17W3aGXoDi/7EUcAvX9G5Ee7U68UXGMtty/d
- z5Nw==
-X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
- d=1e100.net; s=20161025;
- h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
- :content-transfer-encoding;
- bh=EJwpKrbgqo/Jc/SWHvyAGB9CrpkZ5L1Hzq9tInFHTYk=;
- b=XhcpP16zYyJr/qCT9JbO3fn8RyfI44xJL3hvgNrlcr4ljkEZ4TF6OfyhjdEZYeeA3C
- kLlWuAqrSn6mweuhS2LZ0BV5QL/YYaVO4wP4B/y3j+tNbnW3JNM0NtEY19pOtaM4vYK/
- tPuNxld5RvJWxQ9BLs8hH6y7j/ob6oDug170P5YkwK6Wa/FLCi2bw92/vldhdnFP/Nny
- 1bbiWRVls1Ra/Q3z90tGViMkBdlcff6MI9DR5M6a1HTQN7kN9rLDCMGs3r9XVComY07N
- ECbrZbL+iJwuRuT43RAUxE72X/Pn0WYD20unzITf8bta92usNDRgEuxc1bLyL+uHxgUk
- YQKA==
-X-Gm-Message-State: AOAM531Xr1Bg4uwupCAPpH4eBWVrXGALjIWa+5AVNZ8w6ltS4BGgWv6b
- e4g6ycKnUp/KalpJhOMi90o=
-X-Google-Smtp-Source:
- ABdhPJx36OliaaLkiX3ZeZNNWgd/qSKiRor2X0eeHScDrjMSi5bTiEzAfX5j7hkQgqz8ZUT0qqLRNA==
-X-Received: by 2002:a63:1863:: with SMTP id 35mr3131307pgy.413.1600775385014;
- Tue, 22 Sep 2020 04:49:45 -0700 (PDT)
-Received: from guoguo-omen.lan ([156.96.148.94])
- by smtp.gmail.com with ESMTPSA id r4sm2223750pjf.4.2020.09.22.04.49.42
- (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
- Tue, 22 Sep 2020 04:49:44 -0700 (PDT)
-From: Chuanhong Guo <gch981213@gmail.com>
-To: linux-spi@vger.kernel.org
-Subject: [PATCH v2] spi: spi-mtk-nor: fix timeout calculation overflow
-Date: Tue, 22 Sep 2020 19:49:02 +0800
-Message-Id: <20200922114905.2942859-1-gch981213@gmail.com>
-X-Mailer: git-send-email 2.26.2
-MIME-Version: 1.0
-X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3
-X-CRM114-CacheID: sfid-20200922_074948_345420_69207EBE
-X-CRM114-Status: GOOD ( 12.60 )
-X-Spam-Score: 2.6 (++)
-X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary:
- Content analysis details: (2.6 points)
- pts rule name description
- ---- ----------------------
- --------------------------------------------------
- 2.6 RCVD_IN_SBL RBL: Received via a relay in Spamhaus SBL
- [156.96.148.94 listed in zen.spamhaus.org]
- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/,
- no trust [2607:f8b0:4864:20:0:0:0:543 listed in]
- [list.dnswl.org]
- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
- provider [gch981213[at]gmail.com]
- 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends
- in digit [gch981213[at]gmail.com]
- -0.0 SPF_PASS SPF: sender matches SPF record
- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record
- -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
- -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
- author's domain
- -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from
- envelope-from domain
- 0.1 DKIM_SIGNED Message has a DKIM or DK signature,
- not necessarily
- valid
-X-BeenThere: linux-arm-kernel@lists.infradead.org
-X-Mailman-Version: 2.1.29
-Precedence: list
-List-Id: <linux-arm-kernel.lists.infradead.org>
-List-Unsubscribe:
- <http://lists.infradead.org/mailman/options/linux-arm-kernel>,
- <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe>
-List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/>
-List-Post: <mailto:linux-arm-kernel@lists.infradead.org>
-List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help>
-List-Subscribe:
- <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>,
- <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe>
-Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
- Mark Brown <broonie@kernel.org>, linux-mediatek@lists.infradead.org,
- bayi.cheng@mediatek.com, Matthias Brugger <matthias.bgg@gmail.com>,
- Chuanhong Guo <gch981213@gmail.com>, linux-arm-kernel@lists.infradead.org
-Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org>
-Errors-To:
- linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org
-
-CLK_TO_US macro is used to calculate potential transfer time for various
-timeout handling. However it overflows on transfer bigger than 512 bytes
-because it first did (len * 8 * 1000000).
-This controller typically operates at 45MHz. This patch did 2 things:
-1. calculate clock / 1000000 first
-2. add a 4M transfer size cap so that the final timeout in DMA reading
- doesn't overflow
-
-Fixes: 881d1ee9fe81f ("spi: add support for mediatek spi-nor controller")
-Cc: <stable@vger.kernel.org>
-Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
----
-
-Change since v1: fix transfer size cap to 4M
-
- drivers/spi/spi-mtk-nor.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
-index 6e6ca2b8e6c82..62f5ff2779884 100644
---- a/drivers/spi/spi-mtk-nor.c
-+++ b/drivers/spi/spi-mtk-nor.c
-@@ -89,7 +89,7 @@
- // Buffered page program can do one 128-byte transfer
- #define MTK_NOR_PP_SIZE 128
-
--#define CLK_TO_US(sp, clkcnt) ((clkcnt) * 1000000 / sp->spi_freq)
-+#define CLK_TO_US(sp, clkcnt) DIV_ROUND_UP(clkcnt, sp->spi_freq / 1000000)
-
- struct mtk_nor {
- struct spi_controller *ctlr;
-@@ -177,6 +177,10 @@ static int mtk_nor_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
- if ((op->addr.nbytes == 3) || (op->addr.nbytes == 4)) {
- if ((op->data.dir == SPI_MEM_DATA_IN) &&
- mtk_nor_match_read(op)) {
-+ // limit size to prevent timeout calculation overflow
-+ if (op->data.nbytes > 0x400000)
-+ op->data.nbytes = 0x400000;
-+
- if ((op->addr.val & MTK_NOR_DMA_ALIGN_MASK) ||
- (op->data.nbytes < MTK_NOR_DMA_ALIGN))
- op->data.nbytes = 1;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0667-spi-mediatek-fix-timeout-for-large-data.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0667-spi-mediatek-fix-timeout-for-large-data.patch
deleted file mode 100644
index a04f5d6..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0667-spi-mediatek-fix-timeout-for-large-data.patch
+++ /dev/null
@@ -1,34 +0,0 @@
---- a/drivers/spi/spi-mt65xx.c
-+++ b/drivers/spi/spi-mt65xx.c
-@@ -720,6 +720,23 @@ static irqreturn_t mtk_spi_interrupt(int
- return IRQ_HANDLED;
- }
-
-+static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem,
-+ struct spi_mem_op *op)
-+{
-+ int opcode_len;
-+
-+ if(!op->data.nbytes)
-+ return 0;
-+
-+ if (op->data.dir != SPI_MEM_NO_DATA) {
-+ opcode_len = 1 + op->addr.nbytes + op->dummy.nbytes;
-+ if (opcode_len + op->data.nbytes > MTK_SPI_IPM_PACKET_SIZE)
-+ op->data.nbytes = MTK_SPI_IPM_PACKET_SIZE -opcode_len;
-+ }
-+
-+ return 0;
-+}
-+
- static bool mtk_spi_mem_supports_op(struct spi_mem *mem,
- const struct spi_mem_op *op)
- {
-@@ -946,6 +963,7 @@ err_exit:
- }
-
- static const struct spi_controller_mem_ops mtk_spi_mem_ops = {
-+ .adjust_op_size = mtk_spi_mem_adjust_op_size,
- .supports_op = mtk_spi_mem_supports_op,
- .exec_op = mtk_spi_mem_exec_op,
- };
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0668-spi-mediatek-fix-dma-unmap-twice.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0668-spi-mediatek-fix-dma-unmap-twice.patch
deleted file mode 100644
index 31562bf..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0668-spi-mediatek-fix-dma-unmap-twice.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/drivers/spi/spi-mt65xx.c
-+++ b/drivers/spi/spi-mt65xx.c
-@@ -946,12 +946,10 @@ static int mtk_spi_mem_exec_op(struct sp
- reg_val &= ~SPI_CMD_RX_DMA;
- writel(reg_val, mdata->base + SPI_CMD_REG);
-
-+unmap_rx_dma:
- if (op->data.dir == SPI_MEM_DATA_IN)
- dma_unmap_single(mdata->dev, mdata->rx_dma,
- op->data.nbytes, DMA_FROM_DEVICE);
--unmap_rx_dma:
-- dma_unmap_single(mdata->dev, mdata->rx_dma,
-- op->data.nbytes, DMA_FROM_DEVICE);
- unmap_tx_dma:
- dma_unmap_single(mdata->dev, mdata->tx_dma,
- tx_size, DMA_TO_DEVICE);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0669-fix-SPIM-NAND-and-NOR-probing.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0669-fix-SPIM-NAND-and-NOR-probing.patch
deleted file mode 100644
index 582771b..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0669-fix-SPIM-NAND-and-NOR-probing.patch
+++ /dev/null
@@ -1,33 +0,0 @@
---- a/drivers/spi/spi-mt65xx.c
-+++ b/drivers/spi/spi-mt65xx.c
-@@ -1073,7 +1073,7 @@ static int mtk_spi_probe(struct platform
- goto err_put_master;
- }
-
--/*
-+
- mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk");
- if (IS_ERR(mdata->parent_clk)) {
- ret = PTR_ERR(mdata->parent_clk);
-@@ -1101,17 +1101,17 @@ static int mtk_spi_probe(struct platform
- goto err_put_master;
- }
-
-- ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
-+ /*ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
- if (ret < 0) {
- dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);
- clk_disable_unprepare(mdata->spi_clk);
- goto err_put_master;
- }
-
-- clk_disable_unprepare(mdata->spi_clk);
-+ clk_disable_unprepare(mdata->sel_clk);*/
-+
-+ //pm_runtime_enable(&pdev->dev);
-
-- pm_runtime_enable(&pdev->dev);
--*/
- ret = devm_spi_register_master(&pdev->dev, master);
- if (ret) {
- dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0701-fix-mtk-nfi-driver-dependency.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0701-fix-mtk-nfi-driver-dependency.patch
deleted file mode 100644
index 3023076..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0701-fix-mtk-nfi-driver-dependency.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/drivers/spi/Kconfig
-+++ b/drivers/spi/Kconfig
-@@ -429,6 +429,7 @@ config SPI_MT65XX
-
- config SPI_MTK_SNFI
- tristate "MediaTek SPI NAND interface"
-+ depends on MTD
- select MTD_SPI_NAND
- help
- This selects the SPI NAND FLASH interface(SNFI),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0920-kernel-MT7988-fix-spi-dma-unmap.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0920-kernel-MT7988-fix-spi-dma-unmap.patch
deleted file mode 100644
index 5129e37..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0920-kernel-MT7988-fix-spi-dma-unmap.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 38d0cd2179791e27f06e1cfc6773f35b699ee99a Mon Sep 17 00:00:00 2001
-From: liya Li <ot_liya.li@mediatek.com>
-Date: Thu, 2 Feb 2023 14:26:39 +0800
-Subject: [PATCH] [WCNCR00293802][kernel][MT7988] fix spi dma unmap
-
-[Description]
-Use dma_unmap_single before memcpy to ensure that
-CPU can get the latest and correct data
-
-[Release-log]
-N/A
-
-Signed-off-by: liya Li <ot_liya.li@mediatek.com>
-Change-Id: Ib0b51e34e289c670f0d020fb62a15078ed116203
----
- drivers/spi/spi-mt65xx.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index 1b272d15cc..2034d19790 100644
---- a/drivers/spi/spi-mt65xx.c
-+++ b/drivers/spi/spi-mt65xx.c
-@@ -978,12 +978,12 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
-
- unmap_rx_dma:
- if (op->data.dir == SPI_MEM_DATA_IN) {
-+ dma_unmap_single(mdata->dev, mdata->rx_dma,
-+ op->data.nbytes, DMA_FROM_DEVICE);
- if(!IS_ALIGNED((size_t)op->data.buf.in, 4)) {
- memcpy(op->data.buf.in, rx_tmp_buf, op->data.nbytes);
- kfree(rx_tmp_buf);
- }
-- dma_unmap_single(mdata->dev, mdata->rx_dma,
-- op->data.nbytes, DMA_FROM_DEVICE);
- }
- unmap_tx_dma:
- dma_unmap_single(mdata->dev, mdata->tx_dma,
---
-2.18.0
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch
deleted file mode 100755
index 99f72c0..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0961-dual-image-mount-rootfs.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Index: linux-5.4.224/init/do_mounts.c
-===================================================================
---- linux-5.4.224.orig/init/do_mounts.c
-+++ linux-5.4.224/init/do_mounts.c
-@@ -576,7 +576,8 @@ void __init mount_root(void)
- }
- #endif
- #ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
-- if (!mount_ubi_rootfs())
-+ extern bool dual_boot;
-+ if (!dual_boot && !mount_ubi_rootfs())
- return;
- #endif
- #ifdef CONFIG_BLOCK
-Index: linux-5.4.224/kernel/boot_param.c
-===================================================================
---- linux-5.4.224.orig/kernel/boot_param.c
-+++ linux-5.4.224/kernel/boot_param.c
-@@ -10,7 +10,7 @@
-
- #define BOOT_PARAM_STR_MAX_LEN 256
-
--static bool dual_boot;
-+bool dual_boot;
- module_param(dual_boot, bool, 0444);
-
- static bool no_split_rootfs_data;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/2000-misc-add-mtk-platform.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/2000-misc-add-mtk-platform.patch
deleted file mode 100644
index f280e10..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/2000-misc-add-mtk-platform.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff -urN a/drivers/misc/Kconfig b/drivers/misc/Kconfig
---- a/drivers/misc/Kconfig 2021-06-29 15:10:00.970788831 +0800
-+++ b/drivers/misc/Kconfig 2021-06-29 15:09:41.579158152 +0800
-@@ -481,4 +481,5 @@
- source "drivers/misc/ocxl/Kconfig"
- source "drivers/misc/cardreader/Kconfig"
- source "drivers/misc/habanalabs/Kconfig"
-+source "drivers/misc/mediatek/Kconfig"
- endmenu
-diff -urN a/drivers/misc/Makefile b/drivers/misc/Makefile
---- a/drivers/misc/Makefile 2021-06-29 15:10:15.150518461 +0800
-+++ b/drivers/misc/Makefile 2021-06-29 15:09:46.939056121 +0800
-@@ -57,3 +57,4 @@
- obj-$(CONFIG_PVPANIC) += pvpanic.o
- obj-$(CONFIG_HABANA_AI) += habanalabs/
- obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o
-+obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/400-mtd-add-mtk-snand-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/400-mtd-add-mtk-snand-driver.patch
deleted file mode 100644
index f283bd2..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/400-mtd-add-mtk-snand-driver.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/drivers/mtd/Kconfig
-+++ b/drivers/mtd/Kconfig
-@@ -230,6 +230,8 @@ source "drivers/mtd/hyperbus/Kconfig"
-
- source "drivers/mtd/nmbm/Kconfig"
-
-+source "drivers/mtd/mtk-snand/Kconfig"
-+
- source "drivers/mtd/composite/Kconfig"
-
- endif # MTD
---- a/drivers/mtd/Makefile
-+++ b/drivers/mtd/Makefile
-@@ -35,5 +35,7 @@ obj-$(CONFIG_MTD_HYPERBUS) += hyperbus/
-
- obj-y += nmbm/
-
-+obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/
-+
- # Composite drivers must be loaded last
- obj-y += composite/
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/415-mtd-spinand-fix-F50L1G41LB-ecc-check.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/415-mtd-spinand-fix-F50L1G41LB-ecc-check.patch
deleted file mode 100644
index e4e51bb..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/415-mtd-spinand-fix-F50L1G41LB-ecc-check.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/mtd/nand/spi/gigadevice.c
-+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -263,8 +263,7 @@ static const struct spinand_info gigadev
- &write_cache_variants,
- &update_cache_variants),
- 0,
-- SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
-- gd5fxgq4xa_ecc_get_status)),
-+ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, NULL)),
- SPINAND_INFO("GD5F1GQ4xA",
- SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf1),
- NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/416-mtd-spinor-support-EN25QX128A.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/416-mtd-spinor-support-EN25QX128A.patch
deleted file mode 100644
index 2985532..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/416-mtd-spinor-support-EN25QX128A.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/drivers/mtd/spi-nor/spi-nor.c 2022-12-14 15:29:28.587567592 +0800
-+++ b/drivers/mtd/spi-nor/spi-nor.c 2022-12-14 15:04:52.625250000 +0800
-@@ -2246,6 +2246,9 @@ static const struct flash_info spi_nor_i
- { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128,
- SECT_4K | SPI_NOR_DUAL_READ) },
- { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) },
-+ { "en25qx128", INFO(0x1c7118, 0, 64 * 1024, 256,
-+ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
-+ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
- { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
- { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) },
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/492-mtd-tests-fix-pagetest-load.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/492-mtd-tests-fix-pagetest-load.patch
deleted file mode 100644
index f10b5c5..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/492-mtd-tests-fix-pagetest-load.patch
+++ /dev/null
@@ -1,42 +0,0 @@
---- a/drivers/mtd/tests/pagetest.c 2022-11-28 16:08:26.978090509 +0800
-+++ b/drivers/mtd/tests/pagetest.c 2022-11-28 16:10:04.351026850 +0800
-@@ -25,6 +25,10 @@ static int dev = -EINVAL;
- module_param(dev, int, S_IRUGO);
- MODULE_PARM_DESC(dev, "MTD device number to use");
-
-+static int count = 10000;
-+module_param(count, int, 0444);
-+MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)");
-+
- static struct mtd_info *mtd;
- static unsigned char *twopages;
- static unsigned char *writebuf;
-@@ -331,7 +335,7 @@ static int __init mtd_pagetest_init(void
- return -EINVAL;
- }
-
-- pr_info("MTD device: %d\n", dev);
-+ pr_info("MTD device: %d count:%d\n", dev, count);
-
- mtd = get_mtd_device(NULL, dev);
- if (IS_ERR(mtd)) {
-@@ -376,6 +380,7 @@ static int __init mtd_pagetest_init(void
- if (err)
- goto out;
-
-+LOOP:
- /* Erase all eraseblocks */
- pr_info("erasing whole device\n");
- err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
-@@ -435,7 +440,10 @@ static int __init mtd_pagetest_init(void
- if (err)
- goto out;
-
-- pr_info("finished with %d errors\n", errcnt);
-+ pr_info("finished with %d errors count:%d\n", errcnt, count);
-+
-+ if (count-- > 0)
-+ goto LOOP;
- out:
-
- kfree(bbt);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7000-fix-race-inside-napi-enable.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7000-fix-race-inside-napi-enable.patch
deleted file mode 100644
index 052f40c..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7000-fix-race-inside-napi-enable.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-From git@z Thu Jan 1 00:00:00 1970
-Subject: [PATCH v2] napi: fix race inside napi_enable
-From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
-Date: Sat, 18 Sep 2021 16:52:32 +0800
-Message-Id: <20210918085232.71436-1-xuanzhuo@linux.alibaba.com>
-To: netdev@vger.kernel.org, linyunsheng@huawei.com
-Cc: "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Eric Dumazet <edumazet@google.com>, Daniel Borkmann <daniel@iogearbox.net>, Antoine Tenart <atenart@kernel.org>, Alexander Lobakin <alobakin@pm.me>, Wei Wang <weiwan@google.com>, Taehee Yoo <ap420073@gmail.com>,Björn Töpel <bjorn@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Kumar Kartikeya Dwivedi <memxor@gmail.com>, Neil Horman <nhorman@redhat.com>, Dust Li <dust.li@linux.alibaba.com>
-List-Id: <netdev.vger.kernel.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 7bit
-
-The process will cause napi.state to contain NAPI_STATE_SCHED and
-not in the poll_list, which will cause napi_disable() to get stuck.
-
-The prefix "NAPI_STATE_" is removed in the figure below, and
-NAPI_STATE_HASHED is ignored in napi.state.
-
- CPU0 | CPU1 | napi.state
-===============================================================================
-napi_disable() | | SCHED | NPSVC
-napi_enable() | |
-{ | |
- smp_mb__before_atomic(); | |
- clear_bit(SCHED, &n->state); | | NPSVC
- | napi_schedule_prep() | SCHED | NPSVC
- | napi_poll() |
- | napi_complete_done() |
- | { |
- | if (n->state & (NPSVC | | (1)
- | _BUSY_POLL))) |
- | return false; |
- | ................ |
- | } | SCHED | NPSVC
- | |
- clear_bit(NPSVC, &n->state); | | SCHED
-} | |
- | |
-napi_schedule_prep() | | SCHED | MISSED (2)
-
-(1) Here return direct. Because of NAPI_STATE_NPSVC exists.
-(2) NAPI_STATE_SCHED exists. So not add napi.poll_list to sd->poll_list
-
-Since NAPI_STATE_SCHED already exists and napi is not in the
-sd->poll_list queue, NAPI_STATE_SCHED cannot be cleared and will always
-exist.
-
-1. This will cause this queue to no longer receive packets.
-2. If you encounter napi_disable under the protection of rtnl_lock, it
- will cause the entire rtnl_lock to be locked, affecting the overall
- system.
-
-This patch uses cmpxchg to implement napi_enable(), which ensures that
-there will be no race due to the separation of clear two bits.
-
-Fixes: 2d8bff12699abc ("netpoll: Close race condition between poll_one_napi and napi_disable")
-Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
-Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
----
- net/core/dev.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/net/core/dev.c b/net/core/dev.c
-index 74fd402d26dd..7ee9fecd3aff 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -6923,12 +6923,16 @@ EXPORT_SYMBOL(napi_disable);
- */
- void napi_enable(struct napi_struct *n)
- {
-- BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
-- smp_mb__before_atomic();
-- clear_bit(NAPI_STATE_SCHED, &n->state);
-- clear_bit(NAPI_STATE_NPSVC, &n->state);
-- if (n->dev->threaded && n->thread)
-- set_bit(NAPI_STATE_THREADED, &n->state);
-+ unsigned long val, new;
-+
-+ do {
-+ val = READ_ONCE(n->state);
-+ BUG_ON(!test_bit(NAPI_STATE_SCHED, &val));
-+
-+ new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC);
-+ if (n->dev->threaded && n->thread)
-+ new |= NAPIF_STATE_THREADED;
-+ } while (cmpxchg(&n->state, val, new) != val);
- }
- EXPORT_SYMBOL(napi_enable);
-
-
---
-2.31.0
-
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7001-net-make-napi-disable-symmetric-with-enable.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7001-net-make-napi-disable-symmetric-with-enable.patch
deleted file mode 100644
index ac84ffc..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7001-net-make-napi-disable-symmetric-with-enable.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From git@z Thu Jan 1 00:00:00 1970
-Subject: [PATCH v2] net: make napi_disable() symmetric with enable
-From: Jakub Kicinski <kuba@kernel.org>
-Date: Fri, 24 Sep 2021 13:24:53 -0700
-Message-Id: <20210924202453.1051687-1-kuba@kernel.org>
-To: davem@davemloft.net
-Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, weiwan@google.com, xuanzhuo@linux.alibaba.com, Jakub Kicinski <kuba@kernel.org>
-List-Id: <netdev.vger.kernel.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 7bit
-
-Commit 3765996e4f0b ("napi: fix race inside napi_enable") fixed
-an ordering bug in napi_enable() and made the napi_enable() diverge
-from napi_disable(). The state transitions done on disable are
-not symmetric to enable.
-
-There is no known bug in napi_disable() this is just refactoring.
-
-Eric suggests we can also replace msleep(1) with a more opportunistic
-usleep_range().
-
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
----
- net/core/dev.c | 17 ++++++++++++-----
- 1 file changed, 12 insertions(+), 5 deletions(-)
-
-diff --git a/net/core/dev.c b/net/core/dev.c
-index f24c3a9..f0a556a 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -6386,18 +6386,25 @@ EXPORT_SYMBOL(netif_napi_add);
-
- void napi_disable(struct napi_struct *n)
- {
-+ unsigned long val, new;
-+
- might_sleep();
- set_bit(NAPI_STATE_DISABLE, &n->state);
-
-- while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
-- msleep(1);
-- while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
-- msleep(1);
-+ do {
-+ val = READ_ONCE(n->state);
-+ if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
-+ usleep_range(20, 200);
-+ continue;
-+ }
-+
-+ new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
-+ new &= ~(NAPIF_STATE_THREADED);
-+ } while (cmpxchg(&n->state, val, new) != val);
-
- hrtimer_cancel(&n->timer);
-
- clear_bit(NAPI_STATE_DISABLE, &n->state);
-- clear_bit(NAPI_STATE_THREADED, &n->state);
- }
- EXPORT_SYMBOL(napi_disable);
-
---
-2.31.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7002-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7002-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch
deleted file mode 100644
index 0daf233..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/7002-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch
+++ /dev/null
@@ -1,114 +0,0 @@
-From git@z Thu Jan 1 00:00:00 1970
-Subject: [PATCH v2] net: fix premature exit from NAPI state polling in napi_disable()
-From: Alexander Lobakin <alexandr.lobakin@intel.com>
-Date: Wed, 10 Nov 2021 20:56:05 +0100
-Message-Id: <20211110195605.1304-1-alexandr.lobakin@intel.com>
-To: "David S. Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>
-Cc: Alexander Lobakin <alexandr.lobakin@intel.com>, Jesse Brandeburg <jesse.brandeburg@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Michal Swiatkowski <michal.swiatkowski@intel.com>, Xuan Zhuo <xuanzhuo@linux.alibaba.com>, Antoine Tenart <atenart@kernel.org>, Eric Dumazet <edumazet@google.com>, Wei Wang <weiwan@google.com>,Björn Töpel <bjorn@kernel.org>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org
-List-Id: <linux-kernel.vger.kernel.org>
-MIME-Version: 1.0
-Content-Type: text/plain; charset="utf-8"
-Content-Transfer-Encoding: 7bit
-
-Commit 719c57197010 ("net: make napi_disable() symmetric with
-enable") accidentally introduced a bug sometimes leading to a kernel
-BUG when bringing an iface up/down under heavy traffic load.
-
-Prior to this commit, napi_disable() was polling n->state until
-none of (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC) is set and then
-always flip them. Now there's a possibility to get away with the
-NAPIF_STATE_SCHE unset as 'continue' drops us to the cmpxchg()
-call with an unitialized variable, rather than straight to
-another round of the state check.
-
-Error path looks like:
-
-napi_disable():
-unsigned long val, new; /* new is uninitialized */
-
-do {
- val = READ_ONCE(n->state); /* NAPIF_STATE_NPSVC and/or
- NAPIF_STATE_SCHED is set */
- if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) { /* true */
- usleep_range(20, 200);
- continue; /* go straight to the condition check */
- }
- new = val | <...>
-} while (cmpxchg(&n->state, val, new) != val); /* state == val, cmpxchg()
- writes garbage */
-
-napi_enable():
-do {
- val = READ_ONCE(n->state);
- BUG_ON(!test_bit(NAPI_STATE_SCHED, &val)); /* 50/50 boom */
-<...>
-
-while the typical BUG splat is like:
-
-[ 172.652461] ------------[ cut here ]------------
-[ 172.652462] kernel BUG at net/core/dev.c:6937!
-[ 172.656914] invalid opcode: 0000 [#1] PREEMPT SMP PTI
-[ 172.661966] CPU: 36 PID: 2829 Comm: xdp_redirect_cp Tainted: G I 5.15.0 #42
-[ 172.670222] Hardware name: Intel Corporation S2600WFT/S2600WFT, BIOS SE5C620.86B.02.01.0014.082620210524 08/26/2021
-[ 172.680646] RIP: 0010:napi_enable+0x5a/0xd0
-[ 172.684832] Code: 07 49 81 cc 00 01 00 00 4c 89 e2 48 89 d8 80 e6 fb f0 48 0f b1 55 10 48 39 c3 74 10 48 8b 5d 10 f6 c7 04 75 3d f6 c3 01 75 b4 <0f> 0b 5b 5d 41 5c c3 65 ff 05 b8 e5 61 53 48 c7 c6 c0 f3 34 ad 48
-[ 172.703578] RSP: 0018:ffffa3c9497477a8 EFLAGS: 00010246
-[ 172.708803] RAX: ffffa3c96615a014 RBX: 0000000000000000 RCX: ffff8a4b575301a0
-< snip >
-[ 172.782403] Call Trace:
-[ 172.784857] <TASK>
-[ 172.786963] ice_up_complete+0x6f/0x210 [ice]
-[ 172.791349] ice_xdp+0x136/0x320 [ice]
-[ 172.795108] ? ice_change_mtu+0x180/0x180 [ice]
-[ 172.799648] dev_xdp_install+0x61/0xe0
-[ 172.803401] dev_xdp_attach+0x1e0/0x550
-[ 172.807240] dev_change_xdp_fd+0x1e6/0x220
-[ 172.811338] do_setlink+0xee8/0x1010
-[ 172.814917] rtnl_setlink+0xe5/0x170
-[ 172.818499] ? bpf_lsm_binder_set_context_mgr+0x10/0x10
-[ 172.823732] ? security_capable+0x36/0x50
-< snip >
-
-Fix this by replacing 'do { } while (cmpxchg())' with an "infinite"
-for-loop with an explicit break.
-
-From v1 [0]:
- - just use a for-loop to simplify both the fix and the existing
- code (Eric).
-
-[0] https://lore.kernel.org/netdev/20211110191126.1214-1-alexandr.lobakin@intel.com
-
-Fixes: 719c57197010 ("net: make napi_disable() symmetric with enable")
-Suggested-by: Eric Dumazet <edumazet@google.com> # for-loop
-Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
-Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
-Reviewed-by: Eric Dumazet <edumazet@google.com>
----
- net/core/dev.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/net/core/dev.c b/net/core/dev.c
-index c8f7c15..fe2c856 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -6391,7 +6391,7 @@ void napi_disable(struct napi_struct *n)
- might_sleep();
- set_bit(NAPI_STATE_DISABLE, &n->state);
-
-- do {
-+ for ( ; ; ) {
- val = READ_ONCE(n->state);
- if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
- usleep_range(20, 200);
-@@ -6400,7 +6400,10 @@ void napi_disable(struct napi_struct *n)
-
- new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
- new &= ~(NAPIF_STATE_THREADED);
-- } while (cmpxchg(&n->state, val, new) != val);
-+
-+ if (cmpxchg(&n->state, val, new) == val)
-+ break;
-+ }
-
- hrtimer_cancel(&n->timer);
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/740-add-gpy211-phy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/740-add-gpy211-phy-support.patch
deleted file mode 100644
index 2496084..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/740-add-gpy211-phy-support.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-Index: linux-5.4.119/drivers/net/phy/Kconfig
-===================================================================
---- linux-5.4.119.orig/drivers/net/phy/Kconfig
-+++ linux-5.4.119/drivers/net/phy/Kconfig
-@@ -468,6 +468,11 @@ config FIXED_PHY
-
- Currently tested with mpc866ads and mpc8349e-mitx.
-
-+config GPY211_PHY
-+ tristate "GPY211 PHY"
-+ ---help---
-+ Supports the Intel GPY211 PHY with rate adaption.
-+
- config ICPLUS_PHY
- tristate "ICPlus PHYs"
- ---help---
-Index: linux-5.4.119/drivers/net/phy/Makefile
-===================================================================
---- linux-5.4.119.orig/drivers/net/phy/Makefile
-+++ linux-5.4.119/drivers/net/phy/Makefile
-@@ -86,6 +86,7 @@ obj-$(CONFIG_DP83TC811_PHY) += dp83tc811
- obj-$(CONFIG_DP83848_PHY) += dp83848.o
- obj-$(CONFIG_DP83867_PHY) += dp83867.o
- obj-$(CONFIG_FIXED_PHY) += fixed_phy.o
-+obj-$(CONFIG_GPY211_PHY) += gpy211.o
- obj-$(CONFIG_ICPLUS_PHY) += icplus.o
- obj-$(CONFIG_INTEL_XWAY_PHY) += intel-xway.o
- obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-en8801sc-gphy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-en8801sc-gphy-support.patch
deleted file mode 100644
index 6de04c3..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-en8801sc-gphy-support.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-Index: drivers/net/phy/Kconfig
-===================================================================
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -350,6 +350,11 @@ config AIROHA_EN8801S_PHY
- depends on HWMON || HWMON=n
- select MDIO_I2C
-
-+config AIROHA_EN8801SC_PHY
-+ tristate "Drivers for Airoha EN8801S Gigabit PHYs for MediaTek SoC."
-+ ---help---
-+ Currently supports the Airoha EN8801S PHY for MediaTek SoC.
-+
- config AIROHA_EN8811H_PHY
- tristate "Drivers for Airoha EN8811H 2.5G Gigabit PHY"
- ---help---
-Index: drivers/net/phy/Makefile
-===================================================================
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -68,5 +68,6 @@ ifdef CONFIG_HWMON
- aquantia-objs += aquantia_hwmon.o
- endif
-+obj-$(CONFIG_AIROHA_EN8801SC_PHY) += en8801sc.o
- obj-$(CONFIG_AIROHA_EN8811H_PHY) += air_en8811h.o
- obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o
- obj-$(CONFIG_AX88796B_PHY) += ax88796b.o
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-add-mediatek-2p5ge-phy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-add-mediatek-2p5ge-phy-support.patch
deleted file mode 100644
index 161e90f..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-add-mediatek-2p5ge-phy-support.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- a/drivers/net/phy/Kconfig
-+++ b/drivers/net/phy/Kconfig
-@@ -431,6 +431,11 @@ config MEDIATEK_GE_SOC_PHY
- present in the SoCs efuse and will dynamically calibrate VCM
- (common-mode voltage) during startup.
-
-+config MEDIATEK_2P5GE_PHY
-+ tristate "MediaTek 2.5Gb Ethernet PHYs"
-+ ---help---
-+ Supports MediaTek internal 2.5Gb Ethernet PHYs.
-+
- config MICREL_PHY
- tristate "Micrel PHYs"
- ---help---
---- a/drivers/net/phy/Makefile
-+++ b/drivers/net/phy/Makefile
-@@ -79,6 +79,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o
- obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o
- obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o
- obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o
-+obj-$(CONFIG_MEDIATEK_2P5GE_PHY)+= mediatek-2p5ge.o
- obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o
- obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o
- obj-$(CONFIG_MICREL_PHY) += micrel.o
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8001-PATCH-2-4-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8001-PATCH-2-4-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch
deleted file mode 100644
index f83e220..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8001-PATCH-2-4-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 8a79db5e83a5d52c74e6f3c40d6f312cf899213e Mon Sep 17 00:00:00 2001
-From: Jyri Sarha <jsarha@ti.com>
-Date: Wed, 8 Jan 2020 10:30:07 +0200
-Subject: [PATCH 1/5] dt-bindings: phy: Add PHY_TYPE_DP definition
-
-Add definition for DisplayPort phy type.
-
-Signed-off-by: Jyri Sarha <jsarha@ti.com>
-Reviewed-by: Roger Quadros <rogerq@ti.com>
-Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
-Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
----
- include/dt-bindings/phy/phy.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
-index b6a1eaf1b339..1f3f866fae7b 100644
---- a/include/dt-bindings/phy/phy.h
-+++ b/include/dt-bindings/phy/phy.h
-@@ -16,5 +16,6 @@
- #define PHY_TYPE_USB2 3
- #define PHY_TYPE_USB3 4
- #define PHY_TYPE_UFS 5
-+#define PHY_TYPE_DP 6
-
- #endif /* _DT_BINDINGS_PHY */
---
-2.18.0
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8002-PATCH-3-4-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8002-PATCH-3-4-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch
deleted file mode 100644
index 7bd1ca7..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8002-PATCH-3-4-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From c5d3cdad688ed75fb311a3a671eb30ba7106d7d3 Mon Sep 17 00:00:00 2001
-From: Dilip Kota <eswara.kota@linux.intel.com>
-Date: Tue, 19 May 2020 14:19:19 +0800
-Subject: [PATCH 2/5] dt-bindings: phy: Add PHY_TYPE_XPCS definition
-
-Add definition for Ethernet PCS phy type.
-
-Signed-off-by: Dilip Kota <eswara.kota@linux.intel.com>
-Acked-by: Rob Herring <robh@kernel.org>
-Acked-By: Vinod Koul <vkoul@kernel.org>
-Link: https://lore.kernel.org/r/6091f0d2a1046f1e3656d9e33b6cc433d5465eaf.1589868358.git.eswara.kota@linux.intel.com
-Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
----
- include/dt-bindings/phy/phy.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
-index 1f3f866fae7b..3727ef72138b 100644
---- a/include/dt-bindings/phy/phy.h
-+++ b/include/dt-bindings/phy/phy.h
-@@ -17,5 +17,6 @@
- #define PHY_TYPE_USB3 4
- #define PHY_TYPE_UFS 5
- #define PHY_TYPE_DP 6
-+#define PHY_TYPE_XPCS 7
-
- #endif /* _DT_BINDINGS_PHY */
---
-2.18.0
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8003-PATCH-4-4-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8003-PATCH-4-4-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch
deleted file mode 100644
index ef5df66..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8003-PATCH-4-4-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From cea0f76a483d1270ac6f6513964e3e75193dda48 Mon Sep 17 00:00:00 2001
-From: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
-Date: Mon, 29 Jun 2020 15:00:52 +0300
-Subject: [PATCH 3/5] dt-bindings: phy: Add DT bindings for Xilinx ZynqMP PSGTR
- PHY
-
-Add DT bindings for the Xilinx ZynqMP PHY. ZynqMP SoCs have a High Speed
-Processing System Gigabit Transceiver which provides PHY capabilities to
-USB, SATA, PCIE, Display Port and Ehernet SGMII controllers.
-
-Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
-Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Reviewed-by: Rob Herring <robh@kernel.org>
-Link: https://lore.kernel.org/r/20200629120054.29338-2-laurent.pinchart@ideasonboard.com
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
----
- include/dt-bindings/phy/phy.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
-index 3727ef72138b..36e8c241cf48 100644
---- a/include/dt-bindings/phy/phy.h
-+++ b/include/dt-bindings/phy/phy.h
-@@ -18,5 +18,6 @@
- #define PHY_TYPE_UFS 5
- #define PHY_TYPE_DP 6
- #define PHY_TYPE_XPCS 7
-+#define PHY_TYPE_SGMII 8
-
- #endif /* _DT_BINDINGS_PHY */
---
-2.18.0
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9103-drivers-spi-mt65xx-add-dts-buswidth-flow.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9103-drivers-spi-mt65xx-add-dts-buswidth-flow.patch
deleted file mode 100644
index 31ceb83..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9103-drivers-spi-mt65xx-add-dts-buswidth-flow.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/drivers/spi/spi-mt65xx.c
-+++ b/drivers/spi/spi-mt65xx.c
-@@ -1080,7 +1080,7 @@ static int mtk_spi_probe(struct platform
- master->flags = SPI_MASTER_MUST_TX;
-
- if (mdata->dev_comp->ipm_design)
-- master->mode_bits |= SPI_LOOP;
-+ master->mode_bits |= SPI_LOOP | SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD;
-
- if (mdata->dev_comp->ipm_design) {
- mdata->dev = dev;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-mdiobus-add-c45.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1600-mdiobus-add-c45.patch
similarity index 86%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-mdiobus-add-c45.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1600-mdiobus-add-c45.patch
index 93c00b8..acc6d2a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/745-mdiobus-add-c45.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1600-mdiobus-add-c45.patch
@@ -1,3 +1,12 @@
+From abf7f24a61f01977b657285d6425b1185354a29a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:05:59 +0800
+Subject: [PATCH] [backport-networking-generic][999-1600-mdiobus-add-c45.patch]
+
+---
+ include/linux/mdio.h | 49 ++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 49 insertions(+)
+
diff --git a/include/linux/mdio.h b/include/linux/mdio.h
index 0f1f784de..006d1c1e9 100644
--- a/include/linux/mdio.h
@@ -68,5 +77,5 @@
int mdiobus_unregister_device(struct mdio_device *mdiodev);
bool mdiobus_is_registered_device(struct mii_bus *bus, int addr);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1700-macsec-revert-async-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1700-macsec-revert-async-support.patch
new file mode 100644
index 0000000..3212b6b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1700-macsec-revert-async-support.patch
@@ -0,0 +1,27 @@
+From 8b45e5c6b6b419305ef893e1dfdd4c69c020958b Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:05:59 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1700-macsec-revert-async-support.patch]
+
+---
+ drivers/net/macsec.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
+index f729f55f6..e3f03c89c 100644
+--- a/drivers/net/macsec.c
++++ b/drivers/net/macsec.c
+@@ -1311,8 +1311,7 @@ static struct crypto_aead *macsec_alloc_tfm(char *key, int key_len, int icv_len)
+ struct crypto_aead *tfm;
+ int ret;
+
+- /* Pick a sync gcm(aes) cipher to ensure order is preserved. */
+- tfm = crypto_alloc_aead("gcm(aes)", 0, CRYPTO_ALG_ASYNC);
++ tfm = crypto_alloc_aead("gcm(aes)", 0, 0);
+
+ if (IS_ERR(tfm))
+ return tfm;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/741-add-default-setting-to-dsa-unused-port.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1701-add-default-setting-to-dsa-unused-port.patch
similarity index 71%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/741-add-default-setting-to-dsa-unused-port.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1701-add-default-setting-to-dsa-unused-port.patch
index 7769ebd..888a312 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/741-add-default-setting-to-dsa-unused-port.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1701-add-default-setting-to-dsa-unused-port.patch
@@ -1,8 +1,19 @@
-Index: linux-5.4.124/drivers/net/dsa/mt7530.c
-===================================================================
---- linux-5.4.124.orig/drivers/net/dsa/mt7530.c
-+++ linux-5.4.124/drivers/net/dsa/mt7530.c
-@@ -1021,6 +1021,9 @@ mt7530_stp_state_set(struct dsa_switch *
+From e3dd6804fa642a733b7a6932d60bb83b6363555c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:05:59 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1701-add-default-setting-to-dsa-unused-port.patch]
+
+---
+ drivers/net/dsa/mt7530.c | 62 ++++++++++++++++++++++++++++++++++++++--
+ drivers/net/dsa/mt7530.h | 1 +
+ 2 files changed, 60 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index 8ce3d51e8..008432d5c 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
+@@ -1022,6 +1022,9 @@ mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state)
struct mt7530_priv *priv = ds->priv;
u32 stp_state;
@@ -12,10 +23,11 @@
switch (state) {
case BR_STATE_DISABLED:
stp_state = MT7530_STP_DISABLED;
-@@ -1676,10 +1679,58 @@ mt7530_setup(struct dsa_switch *ds)
+@@ -1674,11 +1677,59 @@ mt7530_setup(struct dsa_switch *ds)
+ return 0;
}
- static int
++static int
+setup_unused_ports(struct dsa_switch *ds, u32 pm)
+{
+ struct mt7530_priv *priv = ds->priv;
@@ -62,7 +74,7 @@
+ return 0;
+}
+
-+static int
+ static int
mt7531_setup(struct dsa_switch *ds)
{
struct mt7530_priv *priv = ds->priv;
@@ -71,7 +83,7 @@
u32 val, id;
int ret, i;
-@@ -1767,7 +1818,9 @@ mt7531_setup(struct dsa_switch *ds)
+@@ -1766,7 +1817,9 @@ mt7531_setup(struct dsa_switch *ds)
mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR);
@@ -82,7 +94,7 @@
mt753x_cpu_port_enable(ds, i);
else
mt7530_port_disable(ds, i);
-@@ -1777,6 +1830,9 @@ mt7531_setup(struct dsa_switch *ds)
+@@ -1776,6 +1829,9 @@ mt7531_setup(struct dsa_switch *ds)
PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
}
@@ -92,7 +104,7 @@
ds->configure_vlan_while_not_filtering = true;
/* Flush the FDB table */
-@@ -2101,7 +2157,7 @@ mt7531_mac_config(struct dsa_switch *ds,
+@@ -2100,7 +2156,7 @@ mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
dp = dsa_to_port(ds, port);
@@ -101,7 +113,7 @@
return mt7531_rgmii_setup(priv, port, interface, phydev);
case PHY_INTERFACE_MODE_SGMII:
return mt7531_sgmii_setup_mode_an(priv, port, interface);
-@@ -2641,7 +2697,7 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -2640,7 +2696,7 @@ mt7530_probe(struct mdio_device *mdiodev)
if (!priv)
return -ENOMEM;
@@ -110,10 +122,10 @@
if (!priv->ds)
return -ENOMEM;
-Index: linux-5.4.124/drivers/net/dsa/mt7530.h
-===================================================================
---- linux-5.4.124.orig/drivers/net/dsa/mt7530.h
-+++ linux-5.4.124/drivers/net/dsa/mt7530.h
+diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
+index 6424bc90e..aa758b2d2 100644
+--- a/drivers/net/dsa/mt7530.h
++++ b/drivers/net/dsa/mt7530.h
@@ -10,6 +10,7 @@
#define MT7530_CPU_PORT 6
#define MT7530_NUM_FDB_RECORDS 2048
@@ -122,3 +134,6 @@
enum mt753x_id {
ID_MT7530 = 0,
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/742-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1702-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/742-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1702-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch
index 948bb69..bf4cef7 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/742-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1702-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch
@@ -1,8 +1,38 @@
-Index: linux-5.4.124/drivers/net/dsa/mt7530.c
-===================================================================
---- linux-5.4.124.orig/drivers/net/dsa/mt7530.c
-+++ linux-5.4.124/drivers/net/dsa/mt7530.c
-@@ -1830,6 +1830,8 @@ mt7531_setup(struct dsa_switch *ds)
+From b736c4488d00e4b6e363220746c666176c12ea90 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:05:59 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1702-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch]
+
+---
+ drivers/net/dsa/Makefile | 3 +-
+ drivers/net/dsa/mt7530.c | 2 +
+ drivers/net/dsa/mt7530.h | 1 +
+ drivers/net/dsa/mt7531_phy.c | 1378 ++++++++++++++++++++++++++++++++++
+ drivers/net/dsa/mt7531_phy.h | 262 +++++++
+ 5 files changed, 1645 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/dsa/mt7531_phy.c
+ create mode 100644 drivers/net/dsa/mt7531_phy.h
+
+diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
+index ae70b7962..0aa10bc3d 100644
+--- a/drivers/net/dsa/Makefile
++++ b/drivers/net/dsa/Makefile
+@@ -6,7 +6,8 @@ ifdef CONFIG_NET_DSA_LOOP
+ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o
+ endif
+ obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
+-obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
++obj-$(CONFIG_NET_DSA_MT7530) += mt7530-dsa.o
++mt7530-dsa-objs := mt7530.o mt7531_phy.o
+ obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
+ obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
+ obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index 008432d5c..e4c021eeb 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
+@@ -1829,6 +1829,8 @@ mt7531_setup(struct dsa_switch *ds)
PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
}
@@ -11,20 +41,21 @@
/* Group and enable unused ports as a standalone dumb switch. */
setup_unused_ports(ds, unused_pm);
-Index: linux-5.4.124/drivers/net/dsa/mt7530.h
-===================================================================
---- linux-5.4.124.orig/drivers/net/dsa/mt7530.h
-+++ linux-5.4.124/drivers/net/dsa/mt7530.h
-@@ -782,4 +782,5 @@ static inline void INIT_MT7530_DUMMY_POL
+diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
+index aa758b2d2..8f1e827ff 100644
+--- a/drivers/net/dsa/mt7530.h
++++ b/drivers/net/dsa/mt7530.h
+@@ -782,4 +782,5 @@ static inline void INIT_MT7530_DUMMY_POLL(struct mt7530_dummy_poll *p,
p->reg = reg;
}
+int mt7531_phy_setup(struct dsa_switch *ds);
#endif /* __MT7530_H */
-Index: linux-5.4.124/drivers/net/dsa/mt7531_phy.c
-===================================================================
+diff --git a/drivers/net/dsa/mt7531_phy.c b/drivers/net/dsa/mt7531_phy.c
+new file mode 100644
+index 000000000..a5c1e7d54
--- /dev/null
-+++ linux-5.4.124/drivers/net/dsa/mt7531_phy.c
++++ b/drivers/net/dsa/mt7531_phy.c
@@ -0,0 +1,1378 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
@@ -1404,10 +1435,11 @@
+
+ return ret;
+}
-Index: linux-5.4.124/drivers/net/dsa/mt7531_phy.h
-===================================================================
+diff --git a/drivers/net/dsa/mt7531_phy.h b/drivers/net/dsa/mt7531_phy.h
+new file mode 100644
+index 000000000..4cacabf54
--- /dev/null
-+++ linux-5.4.124/drivers/net/dsa/mt7531_phy.h
++++ b/drivers/net/dsa/mt7531_phy.h
@@ -0,0 +1,262 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
@@ -1671,17 +1703,6 @@
+ DSP_MAX = 0x3e,
+};
+#endif /* _MT753X_REGS_H_ */
-Index: linux-5.4.124/drivers/net/dsa/Makefile
-===================================================================
---- linux-5.4.124.orig/drivers/net/dsa/Makefile
-+++ linux-5.4.124/drivers/net/dsa/Makefile
-@@ -6,7 +6,8 @@ ifdef CONFIG_NET_DSA_LOOP
- obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o
- endif
- obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
--obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o
-+obj-$(CONFIG_NET_DSA_MT7530) += mt7530-dsa.o
-+mt7530-dsa-objs := mt7530.o mt7531_phy.o
- obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
- obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
- obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/747-net-phy-aquantia-add-AQR113C.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1704-net-phy-aquantia-add-AQR113C.patch
similarity index 76%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/747-net-phy-aquantia-add-AQR113C.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1704-net-phy-aquantia-add-AQR113C.patch
index d99d75f..46960d6 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/747-net-phy-aquantia-add-AQR113C.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1704-net-phy-aquantia-add-AQR113C.patch
@@ -1,5 +1,15 @@
+From 23e3cea0589cd65b9c405f23720e4ba8b1264cb3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:00 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1704-net-phy-aquantia-add-AQR113C.patch]
+
+---
+ drivers/net/phy/aquantia_main.c | 45 +++++++++++++++------------------
+ 1 file changed, 21 insertions(+), 24 deletions(-)
+
diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c
-index 75d8351..ac8dd8e 100644
+index 75d8351ee..e7495c9a7 100644
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -22,6 +22,7 @@
@@ -10,7 +20,7 @@
#define MDIO_PHYXS_VEND_IF_STATUS 0xe812
#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3)
-@@ -268,17 +268,6 @@ static int aqr_read_status(struct phy_device *phydev)
+@@ -303,17 +304,6 @@ static int aqr_read_status(struct phy_device *phydev)
return genphy_c45_read_status(phydev);
}
@@ -28,7 +38,7 @@
static int aqr107_read_rate(struct phy_device *phydev)
{
int val;
-@@ -353,13 +342,7 @@ static int aqr107_read_status(struct phy_device *phydev)
+@@ -388,13 +378,7 @@ static int aqr107_read_status(struct phy_device *phydev)
break;
}
@@ -43,7 +53,7 @@
return aqr107_read_rate(phydev);
}
-@@ -500,9 +483,6 @@ static int aqr107_config_init(struct phy_device *phydev)
+@@ -516,9 +500,6 @@ static int aqr107_config_init(struct phy_device *phydev)
if (!ret)
aqr107_chip_info(phydev);
@@ -53,7 +63,7 @@
return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}
-@@ -527,9 +507,6 @@ static int aqcs109_config_init(struct phy_device *phydev)
+@@ -543,9 +524,6 @@ static int aqcs109_config_init(struct phy_device *phydev)
if (ret)
return ret;
@@ -63,7 +73,7 @@
return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}
-@@ -695,6 +696,24 @@ static struct phy_driver aqr_driver[] = {
+@@ -695,6 +673,24 @@ static struct phy_driver aqr_driver[] = {
.ack_interrupt = aqr_ack_interrupt,
.read_status = aqr_read_status,
},
@@ -88,7 +98,7 @@
};
module_phy_driver(aqr_driver);
-@@ -707,6 +726,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = {
+@@ -707,6 +703,7 @@ static struct mdio_device_id __maybe_unused aqr_tbl[] = {
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR107) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQCS109) },
{ PHY_ID_MATCH_MODEL(PHY_ID_AQR405) },
@@ -96,3 +106,6 @@
{ }
};
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/748-add-netlink-support-for-dsa.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1705-add-netlink-support-for-dsa.patch
similarity index 84%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/748-add-netlink-support-for-dsa.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1705-add-netlink-support-for-dsa.patch
index 8853324..3f9adab 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/748-add-netlink-support-for-dsa.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1705-add-netlink-support-for-dsa.patch
@@ -1,8 +1,24 @@
-Index: linux-5.4.203/drivers/net/dsa/Makefile
-===================================================================
---- linux-5.4.203.orig/drivers/net/dsa/Makefile
-+++ linux-5.4.203/drivers/net/dsa/Makefile
-@@ -7,7 +7,7 @@ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdi
+From 3e75ca66195dec023ca2e837ff748c317fd7ac26 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:00 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1705-add-netlink-support-for-dsa.patch]
+
+---
+ drivers/net/dsa/Makefile | 2 +-
+ drivers/net/dsa/mt7530.c | 24 ++-
+ drivers/net/dsa/mt7530.h | 8 +
+ drivers/net/dsa/mt7530_nl.c | 311 ++++++++++++++++++++++++++++++++++++
+ drivers/net/dsa/mt7530_nl.h | 49 ++++++
+ 5 files changed, 386 insertions(+), 8 deletions(-)
+ create mode 100644 drivers/net/dsa/mt7530_nl.c
+ create mode 100644 drivers/net/dsa/mt7530_nl.h
+
+diff --git a/drivers/net/dsa/Makefile b/drivers/net/dsa/Makefile
+index 0aa10bc3d..ef563c6c1 100644
+--- a/drivers/net/dsa/Makefile
++++ b/drivers/net/dsa/Makefile
+@@ -7,7 +7,7 @@ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o
endif
obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o
obj-$(CONFIG_NET_DSA_MT7530) += mt7530-dsa.o
@@ -11,40 +27,40 @@
obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o
obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
-Index: linux-5.4.203/drivers/net/dsa/mt7530.c
-===================================================================
---- linux-5.4.203.orig/drivers/net/dsa/mt7530.c
-+++ linux-5.4.203/drivers/net/dsa/mt7530.c
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index e4c021eeb..63f8a632b 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
@@ -21,6 +21,7 @@
#include <net/dsa.h>
-
+
#include "mt7530.h"
+#include "mt7530_nl.h"
-
+
/* String, offset, and register size in bytes if different from 4 bytes */
static const struct mt7530_mib_desc mt7530_mib[] = {
-@@ -222,7 +223,7 @@ mt7530_mii_read(struct mt7530_priv *priv
+@@ -222,7 +223,7 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
return (hi << 16) | (lo & 0xffff);
}
-
+
-static void
+void
mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val)
{
struct mii_bus *bus = priv->bus;
-@@ -255,7 +256,7 @@ _mt7530_read(struct mt7530_dummy_poll *p
+@@ -255,7 +256,7 @@ _mt7530_read(struct mt7530_dummy_poll *p)
return val;
}
-
+
-static u32
+u32
mt7530_read(struct mt7530_priv *priv, u32 reg)
{
struct mt7530_dummy_poll p;
-@@ -614,7 +615,7 @@ static int mt7530_phy_write(struct dsa_s
+@@ -614,7 +615,7 @@ static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum,
return mdiobus_write_nested(priv->bus, port, regnum, val);
}
-
+
-static int
+int
mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad,
@@ -53,7 +69,7 @@
@@ -663,7 +664,7 @@ out:
return ret;
}
-
+
-static int
+int
mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad,
@@ -62,7 +78,7 @@
@@ -711,7 +712,7 @@ out:
return ret;
}
-
+
-static int
+int
mt7531_ind_c22_phy_read(struct mt7530_priv *priv, int port, int regnum)
@@ -71,24 +87,24 @@
@@ -749,7 +750,7 @@ out:
return ret;
}
-
+
-static int
+int
mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum,
u16 data)
{
-@@ -2690,6 +2691,7 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -2691,6 +2692,7 @@ mt7530_probe(struct mdio_device *mdiodev)
{
struct mt7530_priv *priv;
struct device_node *dn;
+ int ret;
-
+
dn = mdiodev->dev.of_node;
-
-@@ -2765,7 +2767,13 @@ mt7530_probe(struct mdio_device *mdiodev
+
+@@ -2766,7 +2768,13 @@ mt7530_probe(struct mdio_device *mdiodev)
mutex_init(&priv->reg_mutex);
dev_set_drvdata(&mdiodev->dev, priv);
-
+
- return dsa_register_switch(priv->ds);
+ ret = dsa_register_switch(priv->ds);
+ if (ret)
@@ -98,24 +114,24 @@
+
+ return 0;
}
-
+
static void
-@@ -2786,6 +2794,8 @@ mt7530_remove(struct mdio_device *mdiode
-
+@@ -2787,6 +2795,8 @@ mt7530_remove(struct mdio_device *mdiodev)
+
dsa_unregister_switch(priv->ds);
mutex_destroy(&priv->reg_mutex);
+
+ mt7530_nl_exit();
}
-
+
static struct mdio_driver mt7530_mdio_driver = {
-Index: linux-5.4.203/drivers/net/dsa/mt7530.h
-===================================================================
---- linux-5.4.203.orig/drivers/net/dsa/mt7530.h
-+++ linux-5.4.203/drivers/net/dsa/mt7530.h
-@@ -783,4 +783,12 @@ static inline void INIT_MT7530_DUMMY_POL
+diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
+index 8f1e827ff..130d7e5ec 100644
+--- a/drivers/net/dsa/mt7530.h
++++ b/drivers/net/dsa/mt7530.h
+@@ -783,4 +783,12 @@ static inline void INIT_MT7530_DUMMY_POLL(struct mt7530_dummy_poll *p,
}
-
+
int mt7531_phy_setup(struct dsa_switch *ds);
+u32 mt7530_read(struct mt7530_priv *priv, u32 reg);
+void mt7530_write(struct mt7530_priv *priv, u32 reg, u32 val);
@@ -126,10 +142,11 @@
+
+
#endif /* __MT7530_H */
-Index: linux-5.4.203/drivers/net/dsa/mt7530_nl.c
-===================================================================
+diff --git a/drivers/net/dsa/mt7530_nl.c b/drivers/net/dsa/mt7530_nl.c
+new file mode 100644
+index 000000000..676adef70
--- /dev/null
-+++ linux-5.4.203/drivers/net/dsa/mt7530_nl.c
++++ b/drivers/net/dsa/mt7530_nl.c
@@ -0,0 +1,311 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
@@ -442,10 +459,11 @@
+ sw_priv = NULL;
+ genl_unregister_family(&mt7530_nl_family);
+}
-Index: linux-5.4.203/drivers/net/dsa/mt7530_nl.h
-===================================================================
+diff --git a/drivers/net/dsa/mt7530_nl.h b/drivers/net/dsa/mt7530_nl.h
+new file mode 100644
+index 000000000..4619288c2
--- /dev/null
-+++ linux-5.4.203/drivers/net/dsa/mt7530_nl.h
++++ b/drivers/net/dsa/mt7530_nl.h
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
@@ -496,3 +514,6 @@
+#endif /* __KERNEL__ */
+
+#endif /* _MT7530_NL_H_ */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/749-net-dsa-support-mt7988.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1706-net-dsa-support-mt7988.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/749-net-dsa-support-mt7988.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1706-net-dsa-support-mt7988.patch
index 7c468d8..c53c205 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/749-net-dsa-support-mt7988.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1706-net-dsa-support-mt7988.patch
@@ -1,19 +1,30 @@
-Index: linux-5.4.203/drivers/net/dsa/mt7530.c
-===================================================================
---- linux-5.4.203.orig/drivers/net/dsa/mt7530.c
-+++ linux-5.4.203/drivers/net/dsa/mt7530.c
+From 90508a46a0fd6416dcaad2c7f0ef25a5a421bf4f Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:00 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1706-net-dsa-support-mt7988.patch]
+
+---
+ drivers/net/dsa/mt7530.c | 191 ++++++++++++++++++++++++++++++++-------
+ drivers/net/dsa/mt7530.h | 11 ++-
+ 2 files changed, 164 insertions(+), 38 deletions(-)
+
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index 63f8a632b..2cd5dae9c 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
@@ -19,6 +19,7 @@
#include <linux/reset.h>
#include <linux/gpio/consumer.h>
#include <net/dsa.h>
+#include <linux/of_address.h>
-
+
#include "mt7530.h"
#include "mt7530_nl.h"
-@@ -170,28 +171,44 @@ core_clear(struct mt7530_priv *priv, u32
+@@ -170,28 +171,44 @@ core_clear(struct mt7530_priv *priv, u32 reg, u32 val)
core_rmw(priv, reg, val, 0);
}
-
+
+static void
+mtk_w32(struct mt7530_priv *priv, u32 val, unsigned reg)
+{
@@ -32,21 +43,12 @@
struct mii_bus *bus = priv->bus;
u16 page, r, lo, hi;
- int ret;
--
++ int ret = 0;
+
- page = (reg >> 6) & 0x3ff;
- r = (reg >> 2) & 0xf;
- lo = val & 0xffff;
- hi = val >> 16;
--
-- /* MT7530 uses 31 as the pseudo port */
-- ret = bus->write(bus, 0x1f, 0x1f, page);
-- if (ret < 0)
-- goto err;
-+ int ret = 0;
-
-- ret = bus->write(bus, 0x1f, r, lo);
-- if (ret < 0)
-- goto err;
+ if (priv->direct_access){
+ mtk_w32(priv, val, reg);
+ } else {
@@ -54,26 +56,33 @@
+ r = (reg >> 2) & 0xf;
+ lo = val & 0xffff;
+ hi = val >> 16;
-+
+
+- /* MT7530 uses 31 as the pseudo port */
+- ret = bus->write(bus, 0x1f, 0x1f, page);
+- if (ret < 0)
+- goto err;
+ /* MT7530 uses 31 as the pseudo port */
+ ret = bus->write(bus, 0x1f, 0x1f, page);
+ if (ret < 0)
+ goto err;
-+
+
+- ret = bus->write(bus, 0x1f, r, lo);
+- if (ret < 0)
+- goto err;
+ ret = bus->write(bus, 0x1f, r, lo);
+ if (ret < 0)
+ goto err;
-
+
- ret = bus->write(bus, 0x1f, 0x10, hi);
+ ret = bus->write(bus, 0x1f, 0x10, hi);
+ }
err:
if (ret < 0)
dev_err(&bus->dev,
-@@ -206,21 +223,25 @@ mt7530_mii_read(struct mt7530_priv *priv
+@@ -206,21 +223,25 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
u16 page, r, lo, hi;
int ret;
-
+
- page = (reg >> 6) & 0x3ff;
- r = (reg >> 2) & 0xf;
+ if (priv->direct_access){
@@ -81,7 +90,7 @@
+ } else {
+ page = (reg >> 6) & 0x3ff;
+ r = (reg >> 2) & 0xf;
-
+
- /* MT7530 uses 31 as the pseudo port */
- ret = bus->write(bus, 0x1f, 0x1f, page);
- if (ret < 0) {
@@ -96,19 +105,19 @@
+ "failed to read mt7530 register\n");
+ return ret;
+ }
-
+
- lo = bus->read(bus, 0x1f, r);
- hi = bus->read(bus, 0x1f, 0x10);
+ lo = bus->read(bus, 0x1f, r);
+ hi = bus->read(bus, 0x1f, 0x10);
-
+
- return (hi << 16) | (lo & 0xffff);
+ return (hi << 16) | (lo & 0xffff);
+ }
}
-
+
void
-@@ -1906,9 +1927,9 @@ mt7531_phy_supported(struct dsa_switch *
+@@ -1907,9 +1928,9 @@ mt7531_phy_supported(struct dsa_switch *ds, int port,
if (mt7531_is_rgmii_port(priv, port))
return phy_interface_mode_is_rgmii(state->interface);
fallthrough;
@@ -121,7 +130,7 @@
goto unsupported;
break;
default:
-@@ -2017,6 +2038,13 @@ static void mt7531_sgmii_validate(struct
+@@ -2018,6 +2039,13 @@ static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port,
phylink_set(supported, 1000baseX_Full);
phylink_set(supported, 2500baseX_Full);
phylink_set(supported, 2500baseT_Full);
@@ -134,8 +143,8 @@
+ phylink_set(supported, 10000baseER_Full);
}
}
-
-@@ -2165,6 +2193,8 @@ mt7531_mac_config(struct dsa_switch *ds,
+
+@@ -2166,6 +2194,8 @@ mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
case PHY_INTERFACE_MODE_NA:
case PHY_INTERFACE_MODE_1000BASEX:
case PHY_INTERFACE_MODE_2500BASEX:
@@ -143,8 +152,8 @@
+ case PHY_INTERFACE_MODE_10GKR:
if (phylink_autoneg_inband(mode))
return -EINVAL;
-
-@@ -2302,8 +2332,8 @@ static void mt753x_phylink_mac_link_up(s
+
+@@ -2303,8 +2333,8 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port,
/* MT753x MAC works in 1G full duplex mode for all up-clocked
* variants.
*/
@@ -155,10 +164,10 @@
speed = SPEED_1000;
duplex = DUPLEX_FULL;
}
-@@ -2402,8 +2432,8 @@ mt753x_phylink_validate(struct dsa_switc
-
+@@ -2403,8 +2433,8 @@ mt753x_phylink_validate(struct dsa_switch *ds, int port,
+
phylink_set_port_modes(mask);
-
+
- if (state->interface != PHY_INTERFACE_MODE_TRGMII ||
- !phy_interface_mode_is_8023z(state->interface)) {
+ if (state->interface != PHY_INTERFACE_MODE_TRGMII || state->interface != PHY_INTERFACE_MODE_USXGMII ||
@@ -166,10 +175,10 @@
phylink_set(mask, 10baseT_Half);
phylink_set(mask, 10baseT_Full);
phylink_set(mask, 100baseT_Half);
-@@ -2607,6 +2637,66 @@ mt753x_phy_write(struct dsa_switch *ds,
+@@ -2608,6 +2638,66 @@ mt753x_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
return priv->info->phy_write(ds, port, regnum, val);
}
-
+
+static int
+mt7988_pad_setup(struct dsa_switch *ds, phy_interface_t interface)
+{
@@ -233,7 +242,7 @@
static const struct dsa_switch_ops mt7530_switch_ops = {
.get_tag_protocol = mtk_get_tag_protocol,
.setup = mt753x_setup,
-@@ -2676,12 +2766,28 @@ static const struct mt753x_info mt753x_t
+@@ -2677,12 +2767,28 @@ static const struct mt753x_info mt753x_table[] = {
.mac_pcs_an_restart = mt7531_sgmii_restart_an,
.mac_pcs_link_up = mt7531_sgmii_link_up_force,
},
@@ -253,7 +262,7 @@
+ },
+
};
-
+
static const struct of_device_id mt7530_of_match[] = {
{ .compatible = "mediatek,mt7621", .data = &mt753x_table[ID_MT7621], },
{ .compatible = "mediatek,mt7530", .data = &mt753x_table[ID_MT7530], },
@@ -262,18 +271,18 @@
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, mt7530_of_match);
-@@ -2691,6 +2797,7 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -2692,6 +2798,7 @@ mt7530_probe(struct mdio_device *mdiodev)
{
struct mt7530_priv *priv;
struct device_node *dn;
+ struct device_node *switch_node = NULL;
int ret;
-
+
dn = mdiodev->dev.of_node;
-@@ -2760,6 +2867,16 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -2761,6 +2868,16 @@ mt7530_probe(struct mdio_device *mdiodev)
}
}
-
+
+ switch_node = of_find_node_by_name(NULL, "switch0");
+ if(switch_node) {
+ priv->base = of_iomap(switch_node, 0);
@@ -287,48 +296,47 @@
priv->bus = mdiodev->bus;
priv->dev = &mdiodev->dev;
priv->ds->priv = priv;
-@@ -2768,9 +2885,12 @@ mt7530_probe(struct mdio_device *mdiodev
+@@ -2769,9 +2886,12 @@ mt7530_probe(struct mdio_device *mdiodev)
dev_set_drvdata(&mdiodev->dev, priv);
-
+
ret = dsa_register_switch(priv->ds);
- if (ret)
- return ret;
--
+ if (ret) {
+ if(priv->base)
+ iounmap(priv->base);
-+
+
+ return ret;
+ }
mt7530_nl_init(&priv);
-
+
return 0;
-@@ -2795,6 +2915,9 @@ mt7530_remove(struct mdio_device *mdiode
+@@ -2796,6 +2916,9 @@ mt7530_remove(struct mdio_device *mdiodev)
dsa_unregister_switch(priv->ds);
mutex_destroy(&priv->reg_mutex);
-
+
+ if(priv->base)
+ iounmap(priv->base);
+
mt7530_nl_exit();
}
-
-Index: linux-5.4.203/drivers/net/dsa/mt7530.h
-===================================================================
---- linux-5.4.203.orig/drivers/net/dsa/mt7530.h
-+++ linux-5.4.203/drivers/net/dsa/mt7530.h
+
+diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
+index 130d7e5ec..7b175c5f2 100644
+--- a/drivers/net/dsa/mt7530.h
++++ b/drivers/net/dsa/mt7530.h
@@ -16,6 +16,7 @@ enum mt753x_id {
ID_MT7530 = 0,
ID_MT7621 = 1,
ID_MT7531 = 2,
+ ID_MT7988 = 3,
};
-
+
#define NUM_TRGMII_CTRL 5
@@ -51,11 +52,11 @@ enum mt753x_id {
#define MT7531_MIRROR_PORT_SET(x) (((x) & MIRROR_MASK) << 16)
#define MT7531_CPU_PMAP_MASK GENMASK(7, 0)
-
+
-#define MT753X_MIRROR_REG(id) (((id) == ID_MT7531) ? \
+#define MT753X_MIRROR_REG(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
MT7531_CFC : MT7530_MFC)
@@ -338,7 +346,7 @@
-#define MT753X_MIRROR_MASK(id) (((id) == ID_MT7531) ? \
+#define MT753X_MIRROR_MASK(id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \
MT7531_MIRROR_MASK : MIRROR_MASK)
-
+
/* Registers for BPDU and PAE frame control*/
@@ -261,7 +262,7 @@ enum mt7530_vlan_port_attr {
MT7531_FORCE_DPX | \
@@ -358,3 +366,6 @@
const struct mt753x_info *info;
unsigned int id;
bool mcm;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/750-add-mdio-bus-for-gphy-calibration.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1707-add-mdio-bus-for-gphy-calibration.patch
old mode 100755
new mode 100644
similarity index 82%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/750-add-mdio-bus-for-gphy-calibration.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1707-add-mdio-bus-for-gphy-calibration.patch
index e3efa34..cfa2a0c
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/750-add-mdio-bus-for-gphy-calibration.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1707-add-mdio-bus-for-gphy-calibration.patch
@@ -1,11 +1,21 @@
-Index: linux-5.4.215/drivers/net/dsa/mt7530.c
-===================================================================
---- linux-5.4.215.orig/drivers/net/dsa/mt7530.c
-+++ linux-5.4.215/drivers/net/dsa/mt7530.c
-@@ -847,6 +847,117 @@ mt7531_ind_phy_write(struct dsa_switch *
+From c816d165754d8fd002478cce6eb774b9390c795f Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:01 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1707-add-mdio-bus-for-gphy-calibration.patch]
+
+---
+ drivers/net/dsa/mt7530.c | 115 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 115 insertions(+)
+
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index 2cd5dae9c..290a2e77a 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
+@@ -847,6 +847,117 @@ mt7531_ind_phy_write(struct dsa_switch *ds, int port, int regnum,
return ret;
}
-
+
+static int mt753x_mdio_read(struct mii_bus *bus, int addr, int regnum)
+{
+ struct mt7530_priv *priv = bus->priv;
@@ -120,14 +130,17 @@
static void
mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset,
uint8_t *data)
-@@ -2694,6 +2805,10 @@ mt7988_setup(struct dsa_switch *ds)
+@@ -2695,6 +2806,10 @@ mt7988_setup(struct dsa_switch *ds)
if (ret < 0)
return ret;
-
+
+ ret = mt753x_setup_mdio(ds);
+ if (ret < 0)
+ dev_err(priv->dev, "mt753x_setup_mdio failed\n");
+
return 0;
}
+
+--
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/754-net-phy-add-5GBASER.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1708-net-phy-add-5GBASER.patch
similarity index 72%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/754-net-phy-add-5GBASER.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1708-net-phy-add-5GBASER.patch
index 8165303..b112bdb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/754-net-phy-add-5GBASER.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1708-net-phy-add-5GBASER.patch
@@ -1,16 +1,29 @@
+From 4df7f1c284d2c63bc78c2a517e510a8d250dd4c4 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:01 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1708-net-phy-add-5GBASER.patch]
+
+---
+ drivers/net/phy/marvell10g.c | 4 ++++
+ drivers/net/phy/phylink.c | 4 ++++
+ drivers/net/phy/sfp-bus.c | 3 +++
+ include/linux/phy.h | 3 +++
+ 4 files changed, 14 insertions(+)
+
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
-index daed73a..7d080d5 100644
+index 512f27b0b..1e4631761 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
-@@ -516,6 +516,7 @@ static void mv3310_update_interface(struct phy_device *phydev)
-
+@@ -386,6 +386,7 @@ static void mv3310_update_interface(struct phy_device *phydev)
+ {
if ((phydev->interface == PHY_INTERFACE_MODE_SGMII ||
phydev->interface == PHY_INTERFACE_MODE_2500BASEX ||
+ phydev->interface == PHY_INTERFACE_MODE_5GBASER ||
phydev->interface == PHY_INTERFACE_MODE_10GKR) && phydev->link) {
/* The PHY automatically switches its serdes interface (and
* active PHYXS instance) between Cisco SGMII, 10GBase-KR and
-@@ -527,6 +528,9 @@ static void mv3310_update_interface(struct phy_device *phydev)
+@@ -397,6 +398,9 @@ static void mv3310_update_interface(struct phy_device *phydev)
case SPEED_10000:
phydev->interface = PHY_INTERFACE_MODE_10GKR;
break;
@@ -21,7 +34,7 @@
phydev->interface = PHY_INTERFACE_MODE_2500BASEX;
break;
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
-index b3f25a9..6a38a1c 100644
+index b3f25a939..f360d9225 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -299,6 +299,10 @@ static int phylink_parse_mode(struct phylink *pl, struct fwnode_handle *fwnode)
@@ -36,10 +49,10 @@
phylink_set(pl->supported, 10baseT_Half);
phylink_set(pl->supported, 10baseT_Full);
diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
-index 0d5ac2a..a702c9b 100644
+index 42f0441f2..a2f451c31 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
-@@ -302,6 +302,9 @@ phy_interface_t sfp_select_interface(struct sfp_bus *bus,
+@@ -389,6 +389,9 @@ phy_interface_t sfp_select_interface(struct sfp_bus *bus,
phylink_test(link_modes, 10000baseT_Full))
return PHY_INTERFACE_MODE_10GKR;
@@ -50,10 +63,10 @@
return PHY_INTERFACE_MODE_2500BASEX;
diff --git a/include/linux/phy.h b/include/linux/phy.h
-index 34bdd16..77fad08 100644
+index 19444cd96..a1070d60e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
-@@ -98,6 +98,7 @@ typedef enum {
+@@ -97,6 +97,7 @@ typedef enum {
PHY_INTERFACE_MODE_TRGMII,
PHY_INTERFACE_MODE_1000BASEX,
PHY_INTERFACE_MODE_2500BASEX,
@@ -61,7 +74,7 @@
PHY_INTERFACE_MODE_RXAUI,
PHY_INTERFACE_MODE_XAUI,
/* 10GBASE-KR, XFI, SFI - single lane 10G Serdes */
-@@ -172,6 +173,8 @@ static inline const char *phy_modes(phy_interface_t interface)
+@@ -171,6 +172,8 @@ static inline const char *phy_modes(phy_interface_t interface)
return "1000base-x";
case PHY_INTERFACE_MODE_2500BASEX:
return "2500base-x";
@@ -70,3 +83,6 @@
case PHY_INTERFACE_MODE_RXAUI:
return "rxaui";
case PHY_INTERFACE_MODE_XAUI:
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1709-net-phy-sfp-add-rollball-support.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1709-net-phy-sfp-add-rollball-support.patch
index 5a6e865..bac49cf 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/755-net-phy-sfp-add-rollball-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1709-net-phy-sfp-add-rollball-support.patch
@@ -1,270 +1,575 @@
---- a/drivers/net/phy/mdio-i2c.c
-+++ b/drivers/net/phy/mdio-i2c.c
-@@ -12,6 +12,7 @@
- #include <linux/i2c.h>
- #include <linux/mdio/mdio-i2c.h>
- #include <linux/phy.h>
-+#include <linux/sfp.h>
+From 1631a36b9ac022ce6ffb58b039a7e85ad3414ed5 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:01 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1709-net-phy-sfp-add-rollball-support.patch]
+
+---
+ drivers/net/phy/marvell.c | 2 +-
+ drivers/net/phy/marvell10g.c | 168 +++++++++++++--
+ drivers/net/phy/mdio-i2c.c | 309 +++++++++++++++++++++++++++-
+ drivers/net/phy/phylink.c | 74 +++++--
+ drivers/net/phy/sfp-bus.c | 102 +---------
+ drivers/net/phy/sfp.c | 373 +++++++++++++++++++++++++++++-----
+ drivers/net/phy/sfp.h | 11 +-
+ include/linux/mdio/mdio-i2c.h | 10 +-
+ 8 files changed, 874 insertions(+), 175 deletions(-)
+
+diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
+index 49801c2eb..f25881745 100644
+--- a/drivers/net/phy/marvell.c
++++ b/drivers/net/phy/marvell.c
+@@ -2175,7 +2175,7 @@ static struct phy_driver marvell_drivers[] = {
+ .phy_id = MARVELL_PHY_ID_88E1111,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
+ .name = "Marvell 88E1111",
+- /* PHY_GBIT_FEATURES */
++ .features = PHY_GBIT_FEATURES,
+ .probe = marvell_probe,
+ .config_init = &m88e1111_config_init,
+ .config_aneg = &marvell_config_aneg,
+diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
+index 1e4631761..7d080d52e 100644
+--- a/drivers/net/phy/marvell10g.c
++++ b/drivers/net/phy/marvell10g.c
+@@ -32,6 +32,15 @@
+ #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa)
- /*
- * I2C bus addresses 0x50 and 0x51 are normally an EEPROM, which is
-@@ -28,7 +29,7 @@ static unsigned int i2c_mii_phy_addr(int
- return phy_id + 0x40;
- }
+ enum {
++ MV_PMA_21X0_PORT_CTRL = 0xc04a,
++ MV_PMA_21X0_PORT_CTRL_SWRST = BIT(15),
++ MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK = 0x7,
++ MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII = 0x0,
++ MV_PMA_2180_PORT_CTRL_MACTYPE_DXGMII = 0x1,
++ MV_PMA_2180_PORT_CTRL_MACTYPE_QXGMII = 0x2,
++ MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER = 0x4,
++ MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN = 0x5,
++ MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6,
+ MV_PMA_BOOT = 0xc050,
+ MV_PMA_BOOT_FATAL = BIT(0),
--static int i2c_mii_read(struct mii_bus *bus, int phy_id, int reg)
-+static int i2c_mii_read_default(struct mii_bus *bus, int phy_id, int reg)
- {
- struct i2c_adapter *i2c = bus->priv;
- struct i2c_msg msgs[2];
-@@ -62,7 +63,8 @@ static int i2c_mii_read(struct mii_bus *
- return data[0] << 8 | data[1];
- }
+@@ -53,7 +62,18 @@ enum {
--static int i2c_mii_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
-+static int i2c_mii_write_default(struct mii_bus *bus, int phy_id, int reg,
-+ u16 val)
- {
- struct i2c_adapter *i2c = bus->priv;
- struct i2c_msg msg;
-@@ -91,9 +93,288 @@ static int i2c_mii_write(struct mii_bus
- return ret < 0 ? ret : 0;
- }
+ /* Vendor2 MMD registers */
+ MV_V2_PORT_CTRL = 0xf001,
+- MV_V2_PORT_CTRL_PWRDOWN = 0x0800,
++ MV_V2_PORT_CTRL_PWRDOWN = BIT(11),
++ MV_V2_33X0_PORT_CTRL_SWRST = BIT(15),
++ MV_V2_33X0_PORT_CTRL_MACTYPE_MASK = 0x7,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI = 0x0,
++ MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH = 0x1,
++ MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN = 0x1,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH = 0x2,
++ MV_V2_3310_PORT_CTRL_MACTYPE_XAUI = 0x3,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER = 0x4,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN = 0x5,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6,
++ MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII = 0x7,
+ MV_V2_TEMP_CTRL = 0xf08a,
+ MV_V2_TEMP_CTRL_MASK = 0xc000,
+ MV_V2_TEMP_CTRL_SAMPLE = 0x0000,
+@@ -62,11 +82,24 @@ enum {
+ MV_V2_TEMP_UNKNOWN = 0x9600, /* unknown function */
+ };
--struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c)
-+/* RollBall SFPs do not access internal PHY via I2C address 0x56, but
-+ * instead via address 0x51, when SFP page is set to 0x03 and password to
-+ * 0xffffffff.
-+ *
-+ * address size contents description
-+ * ------- ---- -------- -----------
-+ * 0x80 1 CMD 0x01/0x02/0x04 for write/read/done
-+ * 0x81 1 DEV Clause 45 device
-+ * 0x82 2 REG Clause 45 register
-+ * 0x84 2 VAL Register value
-+ */
-+#define ROLLBALL_PHY_I2C_ADDR 0x51
-+
-+#define ROLLBALL_PASSWORD (SFP_VSL + 3)
-+
-+#define ROLLBALL_CMD_ADDR 0x80
-+#define ROLLBALL_DATA_ADDR 0x81
-+
-+#define ROLLBALL_CMD_WRITE 0x01
-+#define ROLLBALL_CMD_READ 0x02
-+#define ROLLBALL_CMD_DONE 0x04
++struct mv3310_chip {
++ int (*get_mactype)(struct phy_device *phydev);
++ int (*init_interface)(struct phy_device *phydev, int mactype);
++};
+
-+#define SFP_PAGE_ROLLBALL_MDIO 3
+ struct mv3310_priv {
++ bool rate_match;
++ phy_interface_t const_interface;
+
-+static int __i2c_transfer_err(struct i2c_adapter *i2c, struct i2c_msg *msgs,
-+ int num)
+ struct device *hwmon_dev;
+ char *hwmon_name;
+ };
+
++static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev)
+{
-+ int ret;
-+
-+ ret = __i2c_transfer(i2c, msgs, num);
-+ if (ret < 0)
-+ return ret;
-+ else if (ret != num)
-+ return -EIO;
-+ else
-+ return 0;
++ return phydev->drv->driver_data;
+}
+
-+static int __i2c_rollball_get_page(struct i2c_adapter *i2c, int bus_addr,
-+ u8 *page)
+ #ifdef CONFIG_HWMON
+ static umode_t mv3310_hwmon_is_visible(const void *data,
+ enum hwmon_sensor_types type,
+@@ -155,13 +188,6 @@ static int mv3310_hwmon_config(struct phy_device *phydev, bool enable)
+ MV_V2_TEMP_CTRL_MASK, val);
+ }
+
+-static void mv3310_hwmon_disable(void *data)
+-{
+- struct phy_device *phydev = data;
+-
+- mv3310_hwmon_config(phydev, false);
+-}
+-
+ static int mv3310_hwmon_probe(struct phy_device *phydev)
+ {
+ struct device *dev = &phydev->mdio.dev;
+@@ -185,10 +211,6 @@ static int mv3310_hwmon_probe(struct phy_device *phydev)
+ if (ret)
+ return ret;
+
+- ret = devm_add_action_or_reset(dev, mv3310_hwmon_disable, phydev);
+- if (ret)
+- return ret;
+-
+ priv->hwmon_dev = devm_hwmon_device_register_with_info(dev,
+ priv->hwmon_name, phydev,
+ &mv3310_hwmon_chip_info, NULL);
+@@ -262,6 +284,11 @@ static int mv3310_probe(struct phy_device *phydev)
+ return phy_sfp_probe(phydev, &mv3310_sfp_ops);
+ }
+
++static void mv3310_remove(struct phy_device *phydev)
+{
-+ struct i2c_msg msgs[2];
-+ u8 addr = SFP_PAGE;
-+
-+ msgs[0].addr = bus_addr;
-+ msgs[0].flags = 0;
-+ msgs[0].len = 1;
-+ msgs[0].buf = &addr;
-+
-+ msgs[1].addr = bus_addr;
-+ msgs[1].flags = I2C_M_RD;
-+ msgs[1].len = 1;
-+ msgs[1].buf = page;
-+
-+ return __i2c_transfer_err(i2c, msgs, 2);
++ mv3310_hwmon_config(phydev, false);
+}
+
-+static int __i2c_rollball_set_page(struct i2c_adapter *i2c, int bus_addr,
-+ u8 page)
+ static int mv3310_suspend(struct phy_device *phydev)
+ {
+ return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
+@@ -297,8 +324,84 @@ static bool mv3310_has_pma_ngbaset_quirk(struct phy_device *phydev)
+ MV_PHY_ALASKA_NBT_QUIRK_MASK) == MV_PHY_ALASKA_NBT_QUIRK_REV;
+ }
+
++static int mv2110_get_mactype(struct phy_device *phydev)
+{
-+ struct i2c_msg msg;
-+ u8 buf[2];
-+
-+ buf[0] = SFP_PAGE;
-+ buf[1] = page;
++ int mactype;
+
-+ msg.addr = bus_addr;
-+ msg.flags = 0;
-+ msg.len = 2;
-+ msg.buf = buf;
++ mactype = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_21X0_PORT_CTRL);
++ if (mactype < 0)
++ return mactype;
+
-+ return __i2c_transfer_err(i2c, &msg, 1);
++ return mactype & MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK;
+}
+
-+/* In order to not interfere with other SFP code (which possibly may manipulate
-+ * SFP_PAGE), for every transfer we do this:
-+ * 1. lock the bus
-+ * 2. save content of SFP_PAGE
-+ * 3. set SFP_PAGE to 3
-+ * 4. do the transfer
-+ * 5. restore original SFP_PAGE
-+ * 6. unlock the bus
-+ * Note that one might think that steps 2 to 5 could be theoretically done all
-+ * in one call to i2c_transfer (by constructing msgs array in such a way), but
-+ * unfortunately tests show that this does not work :-( Changed SFP_PAGE does
-+ * not take into account until i2c_transfer() is done.
-+ */
-+static int i2c_transfer_rollball(struct i2c_adapter *i2c,
-+ struct i2c_msg *msgs, int num)
++static int mv3310_get_mactype(struct phy_device *phydev)
+{
-+ int ret, main_err = 0;
-+ u8 saved_page;
++ int mactype;
+
-+ i2c_lock_bus(i2c, I2C_LOCK_SEGMENT);
++ mactype = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL);
++ if (mactype < 0)
++ return mactype;
+
-+ /* save original page */
-+ ret = __i2c_rollball_get_page(i2c, msgs->addr, &saved_page);
-+ if (ret)
-+ goto unlock;
++ return mactype & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK;
++}
+
-+ /* change to RollBall MDIO page */
-+ ret = __i2c_rollball_set_page(i2c, msgs->addr, SFP_PAGE_ROLLBALL_MDIO);
-+ if (ret)
-+ goto unlock;
++static int mv2110_init_interface(struct phy_device *phydev, int mactype)
++{
++ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
+
-+ /* do the transfer; we try to restore original page if this fails */
-+ ret = __i2c_transfer_err(i2c, msgs, num);
-+ if (ret)
-+ main_err = ret;
++ priv->rate_match = false;
+
-+ /* restore original page */
-+ ret = __i2c_rollball_set_page(i2c, msgs->addr, saved_page);
++ if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH)
++ priv->rate_match = true;
+
-+unlock:
-+ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT);
++ if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII)
++ priv->const_interface = PHY_INTERFACE_MODE_USXGMII;
++ else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH)
++ priv->const_interface = PHY_INTERFACE_MODE_10GKR;
++ else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER ||
++ mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN)
++ priv->const_interface = PHY_INTERFACE_MODE_NA;
++ else
++ return -EINVAL;
+
-+ return main_err ? : ret;
++ return 0;
+}
+
-+static int i2c_rollball_mii_poll(struct mii_bus *bus, int bus_addr, u8 *buf,
-+ size_t len)
++static int mv3310_init_interface(struct phy_device *phydev, int mactype)
+{
-+ struct i2c_adapter *i2c = bus->priv;
-+ struct i2c_msg msgs[2];
-+ u8 cmd_addr, tmp, *res;
-+ int i, ret;
++ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
+
-+ cmd_addr = ROLLBALL_CMD_ADDR;
++ priv->rate_match = false;
+
-+ res = buf ? buf : &tmp;
-+ len = buf ? len : 1;
++ if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH ||
++ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH ||
++ mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH)
++ priv->rate_match = true;
+
-+ msgs[0].addr = bus_addr;
-+ msgs[0].flags = 0;
-+ msgs[0].len = 1;
-+ msgs[0].buf = &cmd_addr;
++ if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII)
++ priv->const_interface = PHY_INTERFACE_MODE_USXGMII;
++ else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH ||
++ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN ||
++ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER)
++ priv->const_interface = PHY_INTERFACE_MODE_10GKR;
++ else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH ||
++ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI)
++ priv->const_interface = PHY_INTERFACE_MODE_RXAUI;
++ else if (mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH ||
++ mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI)
++ priv->const_interface = PHY_INTERFACE_MODE_XAUI;
++ else
++ return -EINVAL;
+
-+ msgs[1].addr = bus_addr;
-+ msgs[1].flags = I2C_M_RD;
-+ msgs[1].len = len;
-+ msgs[1].buf = res;
++ return 0;
++}
+
-+ /* By experiment it takes up to 70 ms to access a register for these
-+ * SFPs. Sleep 20ms between iterations and try 10 times.
-+ */
-+ i = 10;
-+ do {
-+ msleep(20);
+ static int mv3310_config_init(struct phy_device *phydev)
+ {
++ const struct mv3310_chip *chip = to_mv3310_chip(phydev);
++ int err, mactype;
+
-+ ret = i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
-+ if (ret)
-+ return ret;
+ /* Check that the PHY interface type is compatible */
+ if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
+ phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
+@@ -307,6 +410,16 @@ static int mv3310_config_init(struct phy_device *phydev)
+ phydev->interface != PHY_INTERFACE_MODE_10GKR)
+ return -ENODEV;
+
++ mactype = chip->get_mactype(phydev);
++ if (mactype < 0)
++ return mactype;
+
-+ if (*res == ROLLBALL_CMD_DONE)
-+ return 0;
-+ } while (i-- > 0);
++ err = chip->init_interface(phydev, mactype);
++ if (err) {
++ phydev_err(phydev, "MACTYPE configuration invalid\n");
++ return err;
++ }
+
-+ dev_info(&bus->dev, "poll timed out\n");
+ return 0;
+ }
+
+@@ -384,6 +497,23 @@ static int mv3310_aneg_done(struct phy_device *phydev)
+
+ static void mv3310_update_interface(struct phy_device *phydev)
+ {
++ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
+
-+ return -ETIMEDOUT;
-+}
++ if (!phydev->link)
++ return;
+
-+static int i2c_rollball_mii_cmd(struct mii_bus *bus, int bus_addr, u8 cmd,
-+ u8 *data, size_t len)
-+{
-+ struct i2c_adapter *i2c = bus->priv;
-+ struct i2c_msg msgs[2];
-+ u8 cmdbuf[2];
++ /* In all of the "* with Rate Matching" modes the PHY interface is fixed
++ * at 10Gb. The PHY adapts the rate to actual wire speed with help of
++ * internal 16KB buffer.
++ *
++ * In USXGMII mode the PHY interface mode is also fixed.
++ */
++ if (priv->rate_match ||
++ priv->const_interface == PHY_INTERFACE_MODE_USXGMII) {
++ phydev->interface = priv->const_interface;
++ return;
++ }
+
-+ cmdbuf[0] = ROLLBALL_CMD_ADDR;
-+ cmdbuf[1] = cmd;
+ if ((phydev->interface == PHY_INTERFACE_MODE_SGMII ||
+ phydev->interface == PHY_INTERFACE_MODE_2500BASEX ||
+ phydev->interface == PHY_INTERFACE_MODE_5GBASER ||
+@@ -503,11 +633,22 @@ static int mv3310_read_status(struct phy_device *phydev)
+ return 0;
+ }
+
++static const struct mv3310_chip mv3310_type = {
++ .get_mactype = mv3310_get_mactype,
++ .init_interface = mv3310_init_interface,
++};
+
-+ msgs[0].addr = bus_addr;
-+ msgs[0].flags = 0;
-+ msgs[0].len = len;
-+ msgs[0].buf = data;
++static const struct mv3310_chip mv2111_type = {
++ .get_mactype = mv2110_get_mactype,
++ .init_interface = mv2110_init_interface,
++};
+
-+ msgs[1].addr = bus_addr;
-+ msgs[1].flags = 0;
-+ msgs[1].len = sizeof(cmdbuf);
-+ msgs[1].buf = cmdbuf;
+ static struct phy_driver mv3310_drivers[] = {
+ {
+ .phy_id = MARVELL_PHY_ID_88X3310,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
+ .name = "mv88x3310",
++ .driver_data = &mv3310_type,
+ .get_features = mv3310_get_features,
+ .soft_reset = genphy_no_soft_reset,
+ .config_init = mv3310_config_init,
+@@ -517,11 +658,13 @@ static struct phy_driver mv3310_drivers[] = {
+ .config_aneg = mv3310_config_aneg,
+ .aneg_done = mv3310_aneg_done,
+ .read_status = mv3310_read_status,
++ .remove = mv3310_remove,
+ },
+ {
+ .phy_id = MARVELL_PHY_ID_88E2110,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
+ .name = "mv88x2110",
++ .driver_data = &mv2111_type,
+ .probe = mv3310_probe,
+ .suspend = mv3310_suspend,
+ .resume = mv3310_resume,
+@@ -530,6 +673,7 @@ static struct phy_driver mv3310_drivers[] = {
+ .config_aneg = mv3310_config_aneg,
+ .aneg_done = mv3310_aneg_done,
+ .read_status = mv3310_read_status,
++ .remove = mv3310_remove,
+ },
+ };
+
+diff --git a/drivers/net/phy/mdio-i2c.c b/drivers/net/phy/mdio-i2c.c
+index 09200a70b..85db63c33 100644
+--- a/drivers/net/phy/mdio-i2c.c
++++ b/drivers/net/phy/mdio-i2c.c
+@@ -12,6 +12,7 @@
+ #include <linux/i2c.h>
+ #include <linux/mdio/mdio-i2c.h>
+ #include <linux/phy.h>
++#include <linux/sfp.h>
+
+ /*
+ * I2C bus addresses 0x50 and 0x51 are normally an EEPROM, which is
+@@ -28,7 +29,7 @@ static unsigned int i2c_mii_phy_addr(int phy_id)
+ return phy_id + 0x40;
+ }
+
+-static int i2c_mii_read(struct mii_bus *bus, int phy_id, int reg)
++static int i2c_mii_read_default(struct mii_bus *bus, int phy_id, int reg)
+ {
+ struct i2c_adapter *i2c = bus->priv;
+ struct i2c_msg msgs[2];
+@@ -62,7 +63,8 @@ static int i2c_mii_read(struct mii_bus *bus, int phy_id, int reg)
+ return data[0] << 8 | data[1];
+ }
+
+-static int i2c_mii_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
++static int i2c_mii_write_default(struct mii_bus *bus, int phy_id, int reg,
++ u16 val)
+ {
+ struct i2c_adapter *i2c = bus->priv;
+ struct i2c_msg msg;
+@@ -91,9 +93,288 @@ static int i2c_mii_write(struct mii_bus *bus, int phy_id, int reg, u16 val)
+ return ret < 0 ? ret : 0;
+ }
+
+-struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c)
++/* RollBall SFPs do not access internal PHY via I2C address 0x56, but
++ * instead via address 0x51, when SFP page is set to 0x03 and password to
++ * 0xffffffff.
++ *
++ * address size contents description
++ * ------- ---- -------- -----------
++ * 0x80 1 CMD 0x01/0x02/0x04 for write/read/done
++ * 0x81 1 DEV Clause 45 device
++ * 0x82 2 REG Clause 45 register
++ * 0x84 2 VAL Register value
++ */
++#define ROLLBALL_PHY_I2C_ADDR 0x51
+
-+ return i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
-+}
++#define ROLLBALL_PASSWORD (SFP_VSL + 3)
+
-+static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
-+{
-+ u8 buf[4], res[6];
-+ int bus_addr, ret;
-+ u16 val;
++#define ROLLBALL_CMD_ADDR 0x80
++#define ROLLBALL_DATA_ADDR 0x81
+
-+ if (!(reg & MII_ADDR_C45))
-+ return -EOPNOTSUPP;
++#define ROLLBALL_CMD_WRITE 0x01
++#define ROLLBALL_CMD_READ 0x02
++#define ROLLBALL_CMD_DONE 0x04
+
-+ bus_addr = i2c_mii_phy_addr(phy_id);
-+ if (bus_addr != ROLLBALL_PHY_I2C_ADDR)
-+ return 0xffff;
++#define SFP_PAGE_ROLLBALL_MDIO 3
+
-+ buf[0] = ROLLBALL_DATA_ADDR;
-+ buf[1] = (reg >> 16) & 0x1f;
-+ buf[2] = (reg >> 8) & 0xff;
-+ buf[3] = reg & 0xff;
++static int __i2c_transfer_err(struct i2c_adapter *i2c, struct i2c_msg *msgs,
++ int num)
++{
++ int ret;
+
-+ ret = i2c_rollball_mii_cmd(bus, bus_addr, ROLLBALL_CMD_READ, buf,
-+ sizeof(buf));
++ ret = __i2c_transfer(i2c, msgs, num);
+ if (ret < 0)
+ return ret;
++ else if (ret != num)
++ return -EIO;
++ else
++ return 0;
++}
+
-+ ret = i2c_rollball_mii_poll(bus, bus_addr, res, sizeof(res));
-+ if (ret == -ETIMEDOUT)
-+ return 0xffff;
-+ else if (ret < 0)
-+ return ret;
++static int __i2c_rollball_get_page(struct i2c_adapter *i2c, int bus_addr,
++ u8 *page)
++{
++ struct i2c_msg msgs[2];
++ u8 addr = SFP_PAGE;
+
-+ val = res[4] << 8 | res[5];
++ msgs[0].addr = bus_addr;
++ msgs[0].flags = 0;
++ msgs[0].len = 1;
++ msgs[0].buf = &addr;
+
-+ return val;
++ msgs[1].addr = bus_addr;
++ msgs[1].flags = I2C_M_RD;
++ msgs[1].len = 1;
++ msgs[1].buf = page;
++
++ return __i2c_transfer_err(i2c, msgs, 2);
+}
+
-+static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
-+ u16 val)
++static int __i2c_rollball_set_page(struct i2c_adapter *i2c, int bus_addr,
++ u8 page)
+{
-+ int bus_addr, ret;
-+ u8 buf[6];
++ struct i2c_msg msg;
++ u8 buf[2];
+
-+ if (!(reg & MII_ADDR_C45))
-+ return -EOPNOTSUPP;
++ buf[0] = SFP_PAGE;
++ buf[1] = page;
+
-+ bus_addr = i2c_mii_phy_addr(phy_id);
-+ if (bus_addr != ROLLBALL_PHY_I2C_ADDR)
-+ return 0;
++ msg.addr = bus_addr;
++ msg.flags = 0;
++ msg.len = 2;
++ msg.buf = buf;
+
-+ buf[0] = ROLLBALL_DATA_ADDR;
++ return __i2c_transfer_err(i2c, &msg, 1);
++}
++
++/* In order to not interfere with other SFP code (which possibly may manipulate
++ * SFP_PAGE), for every transfer we do this:
++ * 1. lock the bus
++ * 2. save content of SFP_PAGE
++ * 3. set SFP_PAGE to 3
++ * 4. do the transfer
++ * 5. restore original SFP_PAGE
++ * 6. unlock the bus
++ * Note that one might think that steps 2 to 5 could be theoretically done all
++ * in one call to i2c_transfer (by constructing msgs array in such a way), but
++ * unfortunately tests show that this does not work :-( Changed SFP_PAGE does
++ * not take into account until i2c_transfer() is done.
++ */
++static int i2c_transfer_rollball(struct i2c_adapter *i2c,
++ struct i2c_msg *msgs, int num)
++{
++ int ret, main_err = 0;
++ u8 saved_page;
++
++ i2c_lock_bus(i2c, I2C_LOCK_SEGMENT);
++
++ /* save original page */
++ ret = __i2c_rollball_get_page(i2c, msgs->addr, &saved_page);
++ if (ret)
++ goto unlock;
++
++ /* change to RollBall MDIO page */
++ ret = __i2c_rollball_set_page(i2c, msgs->addr, SFP_PAGE_ROLLBALL_MDIO);
++ if (ret)
++ goto unlock;
++
++ /* do the transfer; we try to restore original page if this fails */
++ ret = __i2c_transfer_err(i2c, msgs, num);
++ if (ret)
++ main_err = ret;
++
++ /* restore original page */
++ ret = __i2c_rollball_set_page(i2c, msgs->addr, saved_page);
++
++unlock:
++ i2c_unlock_bus(i2c, I2C_LOCK_SEGMENT);
++
++ return main_err ? : ret;
++}
++
++static int i2c_rollball_mii_poll(struct mii_bus *bus, int bus_addr, u8 *buf,
++ size_t len)
++{
++ struct i2c_adapter *i2c = bus->priv;
++ struct i2c_msg msgs[2];
++ u8 cmd_addr, tmp, *res;
++ int i, ret;
++
++ cmd_addr = ROLLBALL_CMD_ADDR;
++
++ res = buf ? buf : &tmp;
++ len = buf ? len : 1;
++
++ msgs[0].addr = bus_addr;
++ msgs[0].flags = 0;
++ msgs[0].len = 1;
++ msgs[0].buf = &cmd_addr;
++
++ msgs[1].addr = bus_addr;
++ msgs[1].flags = I2C_M_RD;
++ msgs[1].len = len;
++ msgs[1].buf = res;
++
++ /* By experiment it takes up to 70 ms to access a register for these
++ * SFPs. Sleep 20ms between iterations and try 10 times.
++ */
++ i = 10;
++ do {
++ msleep(20);
++
++ ret = i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
++ if (ret)
++ return ret;
++
++ if (*res == ROLLBALL_CMD_DONE)
++ return 0;
++ } while (i-- > 0);
++
++ dev_info(&bus->dev, "poll timed out\n");
++
++ return -ETIMEDOUT;
++}
++
++static int i2c_rollball_mii_cmd(struct mii_bus *bus, int bus_addr, u8 cmd,
++ u8 *data, size_t len)
++{
++ struct i2c_adapter *i2c = bus->priv;
++ struct i2c_msg msgs[2];
++ u8 cmdbuf[2];
++
++ cmdbuf[0] = ROLLBALL_CMD_ADDR;
++ cmdbuf[1] = cmd;
++
++ msgs[0].addr = bus_addr;
++ msgs[0].flags = 0;
++ msgs[0].len = len;
++ msgs[0].buf = data;
++
++ msgs[1].addr = bus_addr;
++ msgs[1].flags = 0;
++ msgs[1].len = sizeof(cmdbuf);
++ msgs[1].buf = cmdbuf;
++
++ return i2c_transfer_rollball(i2c, msgs, ARRAY_SIZE(msgs));
++}
++
++static int i2c_mii_read_rollball(struct mii_bus *bus, int phy_id, int reg)
++{
++ u8 buf[4], res[6];
++ int bus_addr, ret;
++ u16 val;
++
++ if (!(reg & MII_ADDR_C45))
++ return -EOPNOTSUPP;
++
++ bus_addr = i2c_mii_phy_addr(phy_id);
++ if (bus_addr != ROLLBALL_PHY_I2C_ADDR)
++ return 0xffff;
++
++ buf[0] = ROLLBALL_DATA_ADDR;
++ buf[1] = (reg >> 16) & 0x1f;
++ buf[2] = (reg >> 8) & 0xff;
++ buf[3] = reg & 0xff;
++
++ ret = i2c_rollball_mii_cmd(bus, bus_addr, ROLLBALL_CMD_READ, buf,
++ sizeof(buf));
++ if (ret < 0)
++ return ret;
++
++ ret = i2c_rollball_mii_poll(bus, bus_addr, res, sizeof(res));
++ if (ret == -ETIMEDOUT)
++ return 0xffff;
++ else if (ret < 0)
++ return ret;
++
++ val = res[4] << 8 | res[5];
++
++ return val;
++}
++
++static int i2c_mii_write_rollball(struct mii_bus *bus, int phy_id, int reg,
++ u16 val)
++{
++ int bus_addr, ret;
++ u8 buf[6];
++
++ if (!(reg & MII_ADDR_C45))
++ return -EOPNOTSUPP;
++
++ bus_addr = i2c_mii_phy_addr(phy_id);
++ if (bus_addr != ROLLBALL_PHY_I2C_ADDR)
++ return 0;
++
++ buf[0] = ROLLBALL_DATA_ADDR;
+ buf[1] = (reg >> 16) & 0x1f;
+ buf[2] = (reg >> 8) & 0xff;
+ buf[3] = reg & 0xff;
@@ -317,7 +622,7 @@
if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
return ERR_PTR(-EINVAL);
-@@ -104,10 +385,28 @@ struct mii_bus *mdio_i2c_alloc(struct de
+@@ -104,10 +385,28 @@ struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c)
snprintf(mii->id, MII_BUS_ID_SIZE, "i2c:%s", dev_name(parent));
mii->parent = parent;
@@ -348,27 +653,11 @@
return mii;
}
EXPORT_SYMBOL_GPL(mdio_i2c_alloc);
---- a/include/linux/mdio/mdio-i2c.h
-+++ b/include/linux/mdio/mdio-i2c.h
-@@ -11,6 +11,14 @@ struct device;
- struct i2c_adapter;
- struct mii_bus;
-
--struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c);
-+enum mdio_i2c_proto {
-+ MDIO_I2C_NONE,
-+ MDIO_I2C_MARVELL_C22,
-+ MDIO_I2C_C45,
-+ MDIO_I2C_ROLLBALL,
-+};
-+
-+struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
-+ enum mdio_i2c_proto protocol);
-
- #endif
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
+index f360d9225..67f34ed4c 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -483,62 +483,105 @@ static void phylink_resolve(struct work_
+@@ -483,62 +483,105 @@ static void phylink_resolve(struct work_struct *w)
struct phylink *pl = container_of(w, struct phylink, resolve);
struct phylink_link_state link_state;
struct net_device *ndev = pl->netdev;
@@ -498,6 +787,8 @@
mod_timer(&pl->link_poll, jiffies + HZ);
if (pl->phydev)
phy_start(pl->phydev);
+diff --git a/drivers/net/phy/sfp-bus.c b/drivers/net/phy/sfp-bus.c
+index a2f451c31..4be24406b 100644
--- a/drivers/net/phy/sfp-bus.c
+++ b/drivers/net/phy/sfp-bus.c
@@ -10,12 +10,6 @@
@@ -601,7 +892,18 @@
/**
* sfp_parse_port() - Parse the EEPROM base ID, setting the port type
* @bus: a pointer to the &struct sfp_bus structure for the sfp module
-@@ -359,7 +272,7 @@ void sfp_parse_support(struct sfp_bus *b
+@@ -236,6 +149,10 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
+ unsigned int br_min, br_nom, br_max;
+ __ETHTOOL_DECLARE_LINK_MODE_MASK(modes) = { 0, };
+
++ phylink_set(modes, Autoneg);
++ phylink_set(modes, Pause);
++ phylink_set(modes, Asym_Pause);
++
+ /* Decode the bitrate information to MBd */
+ br_min = br_nom = br_max = 0;
+ if (id->base.br_nominal) {
+@@ -359,14 +276,10 @@ void sfp_parse_support(struct sfp_bus *bus, const struct sfp_eeprom_id *id,
phylink_set(modes, 1000baseX_Full);
}
@@ -610,6 +912,13 @@
bus->sfp_quirk->modes(id, modes);
bitmap_or(support, support, modes, __ETHTOOL_LINK_MODE_MASK_NBITS);
+-
+- phylink_set(support, Autoneg);
+- phylink_set(support, Pause);
+- phylink_set(support, Asym_Pause);
+ }
+ EXPORT_SYMBOL_GPL(sfp_parse_support);
+
@@ -737,12 +650,13 @@ void sfp_link_down(struct sfp_bus *bus)
}
EXPORT_SYMBOL_GPL(sfp_link_down);
@@ -626,9 +935,11 @@
if (ops && ops->module_insert)
ret = ops->module_insert(bus->upstream, id);
+diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
+index f8d1742e0..0fdf5d6d4 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -165,6 +165,7 @@ static const enum gpiod_flags gpio_flags
+@@ -165,6 +165,7 @@ static const enum gpiod_flags gpio_flags[] = {
* on board (for a copper SFP) time to initialise.
*/
#define T_WAIT msecs_to_jiffies(50)
@@ -636,7 +947,7 @@
#define T_START_UP msecs_to_jiffies(300)
#define T_START_UP_BAD_GPON msecs_to_jiffies(60000)
-@@ -204,8 +205,11 @@ static const enum gpiod_flags gpio_flags
+@@ -204,8 +205,11 @@ static const enum gpiod_flags gpio_flags[] = {
/* SFP modules appear to always have their PHY configured for bus address
* 0x56 (which with mdio-i2c, translates to a PHY address of 22).
@@ -676,7 +987,26 @@
#if IS_ENABLED(CONFIG_HWMON)
struct sfp_diag diag;
-@@ -303,6 +313,156 @@ static const struct of_device_id sfp_of_
+@@ -287,6 +297,18 @@ static bool sfp_module_supported(const struct sfp_eeprom_id *id)
+ !memcmp(id->base.vendor_pn, "UF-INSTANT ", 16))
+ return true;
+
++ /* SFP GPON module SK-LiNK SFP-GE-LX20 SM1310 and SM1550 Instant
++ * has in its EEPROM stored phys id UNK instead of SFP. Therefore
++ * mark this module explicitly as supported based on vendor name
++ * and pn match.
++ */
++ if (id->base.phys_id == SFF8024_ID_UNK &&
++ id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP &&
++ !memcmp(id->base.vendor_name, "SK-LINK ", 16) &&
++ (!memcmp(id->base.vendor_pn, "SFP-GE-LX20-SM13", 16) ||
++ !memcmp(id->base.vendor_pn, "SFP-GE-LX-SM1550", 16)))
++ return true;
++
+ return false;
+ }
+
+@@ -303,6 +325,180 @@ static const struct of_device_id sfp_of_match[] = {
};
MODULE_DEVICE_TABLE(of, sfp_of_match);
@@ -732,6 +1062,21 @@
+ linkmode_set_bit(ETHTOOL_LINK_MODE_10000baseSR_Full_BIT, modes);
+}
+
++static void sfp_quirk_disable_autoneg(const struct sfp_eeprom_id *id,
++ unsigned long *modes)
++{
++ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, modes);
++}
++
++static void sfp_quirk_oem_2_5g(const struct sfp_eeprom_id *id,
++ unsigned long *modes)
++{
++ /* Copper 2.5G SFP */
++ linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, modes);
++ linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseX_Full_BIT, modes);
++ sfp_quirk_disable_autoneg(id, modes);
++}
++
+static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
+ unsigned long *modes)
+{
@@ -773,10 +1118,19 @@
+ // 2500MBd NRZ in their EEPROM
+ SFP_QUIRK_M("Lantech", "8330-262D-E", '\0', sfp_quirk_2500basex),
+
++ // CISCO PLRXPL-VC-S43-CG can operate at 10000baseSR, but not report
++ // in their EEPROM
+ SFP_QUIRK_M("CISCO-JDSU", "PLRXPL-VC-S43-CG", '\0', sfp_quirk_10000baseSR),
+
+ SFP_QUIRK_M("UBNT", "UF-INSTANT", '\0', sfp_quirk_ubnt_uf_instant),
+
++ // OEM SFP-2.5G-T can operate at 2500base-T, but not report
++ // in their EEPROM
++ SFP_QUIRK_M("OEM", "SFP-2.5G-T", '\0', sfp_quirk_oem_2_5g),
++ // TP-LINK TL-SM410U can operate at 2500base-T, but not report
++ // in their EEPROM
++ SFP_QUIRK_M("TP-LINK", "TL-SM410U", '\0', sfp_quirk_oem_2_5g),
++
+ SFP_QUIRK_F("ETU", "ESP-T5-R", '\0', sfp_fixup_rollball_cc),
+ SFP_QUIRK_F("OEM", "SFP-10G-T", '\0', sfp_fixup_rollball_cc),
+ SFP_QUIRK_F("OEM", "RTSFP-10", '\0', sfp_fixup_rollball_cc),
@@ -833,7 +1187,7 @@
static unsigned long poll_jiffies;
static unsigned int sfp_gpio_get_state(struct sfp *sfp)
-@@ -414,9 +554,6 @@ static int sfp_i2c_write(struct sfp *sfp
+@@ -414,9 +610,6 @@ static int sfp_i2c_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
{
@@ -843,7 +1197,7 @@
if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
return -EINVAL;
-@@ -424,7 +561,15 @@ static int sfp_i2c_configure(struct sfp
+@@ -424,7 +617,15 @@ static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
sfp->read = sfp_i2c_read;
sfp->write = sfp_i2c_write;
@@ -860,7 +1214,7 @@
if (IS_ERR(i2c_mii))
return PTR_ERR(i2c_mii);
-@@ -442,6 +587,12 @@ static int sfp_i2c_configure(struct sfp
+@@ -442,6 +643,12 @@ static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
return 0;
}
@@ -873,7 +1227,7 @@
/* Interface */
static int sfp_read(struct sfp *sfp, bool a2, u8 addr, void *buf, size_t len)
{
-@@ -487,17 +638,18 @@ static void sfp_soft_set_state(struct sf
+@@ -487,17 +694,18 @@ static void sfp_soft_set_state(struct sfp *sfp, unsigned int state)
static void sfp_soft_start_poll(struct sfp *sfp)
{
const struct sfp_eeprom_id *id = &sfp->id;
@@ -901,7 +1255,7 @@
if (sfp->state_soft_mask & (SFP_F_LOS | SFP_F_TX_FAULT) &&
!sfp->need_poll)
-@@ -511,10 +663,11 @@ static void sfp_soft_stop_poll(struct sf
+@@ -511,10 +719,11 @@ static void sfp_soft_stop_poll(struct sfp *sfp)
static unsigned int sfp_get_state(struct sfp *sfp)
{
@@ -916,7 +1270,7 @@
state |= sfp_soft_get_state(sfp);
return state;
-@@ -1448,12 +1601,12 @@ static void sfp_sm_phy_detach(struct sfp
+@@ -1448,12 +1657,12 @@ static void sfp_sm_phy_detach(struct sfp *sfp)
sfp->mod_phy = NULL;
}
@@ -931,7 +1285,7 @@
if (phy == ERR_PTR(-ENODEV))
return PTR_ERR(phy);
if (IS_ERR(phy)) {
-@@ -1548,6 +1701,14 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1548,6 +1757,14 @@ static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
}
}
@@ -946,7 +1300,7 @@
/* Probe a SFP for a PHY device if the module supports copper - the PHY
* normally sits at I2C bus address 0x56, and may either be a clause 22
* or clause 45 PHY.
-@@ -1563,19 +1724,23 @@ static int sfp_sm_probe_for_phy(struct s
+@@ -1563,36 +1780,52 @@ static int sfp_sm_probe_for_phy(struct sfp *sfp)
{
int err = 0;
@@ -979,7 +1333,6 @@
return err;
}
-@@ -1755,17 +1783,29 @@ static int sfp_sm_probe_for_phy(struct sfp *sfp)
static int sfp_module_parse_power(struct sfp *sfp)
{
u32 power_mW = 1000;
@@ -1014,7 +1367,7 @@
/* The module appears not to implement bus address
* 0xa2, so assume that the module powers up in the
* indicated mode.
-@@ -1782,13 +1822,21 @@ static int sfp_module_parse_power(struct sfp *sfp)
+@@ -1609,13 +1842,21 @@ static int sfp_module_parse_power(struct sfp *sfp)
}
}
@@ -1038,7 +1391,34 @@
power_mW / 1000, (power_mW / 100) % 10);
return 0;
}
-@@ -1819,11 +1984,33 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1692,7 +1933,7 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
+ {
+ /* SFP module inserted - read I2C data */
+ struct sfp_eeprom_id id;
+- bool cotsworks;
++ bool cotsworks, sklink;
+ u8 check;
+ int ret;
+
+@@ -1747,10 +1988,16 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
+ */
+ cotsworks = !memcmp(id.base.vendor_name, "COTSWORKS ", 16);
+
++ /* SK-LiNK do not seem to update the checksums when they
++ * do the final programming with the final module part number,
++ * serial number and date code.
++ */
++ sklink = !memcmp(id.base.vendor_name, "SK-LINK ", 16);
++
+ /* Validate the checksum over the base structure */
+ check = sfp_check(&id.base, sizeof(id.base) - 1);
+ if (check != id.base.cc_base) {
+- if (cotsworks) {
++ if (cotsworks || sklink) {
+ dev_warn(sfp->dev,
+ "EEPROM base structure checksum failure (0x%02x != 0x%02x)\n",
+ check, id.base.cc_base);
+@@ -1819,11 +2066,33 @@ static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
if (ret < 0)
return ret;
@@ -1076,7 +1456,7 @@
return 0;
}
-@@ -1936,7 +2123,8 @@ static void sfp_sm_module(struct sfp *sf
+@@ -1936,7 +2205,8 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
break;
/* Report the module insertion to the upstream device */
@@ -1086,7 +1466,7 @@
if (err < 0) {
sfp_sm_mod_next(sfp, SFP_MOD_ERROR, 0);
break;
-@@ -1995,6 +2183,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1995,6 +2265,8 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
sfp_module_stop(sfp->sfp_bus);
if (sfp->mod_phy)
sfp_sm_phy_detach(sfp);
@@ -1095,7 +1475,7 @@
sfp_module_tx_disable(sfp);
sfp_soft_stop_poll(sfp);
sfp_sm_next(sfp, SFP_S_DOWN, 0);
-@@ -2018,9 +2208,10 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2018,9 +2290,10 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
/* We need to check the TX_FAULT state, which is not defined
* while TX_DISABLE is asserted. The earliest we want to do
@@ -1108,7 +1488,7 @@
break;
case SFP_S_WAIT:
-@@ -2034,8 +2225,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2034,8 +2307,8 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
* deasserting.
*/
timeout = sfp->module_t_start_up;
@@ -1119,7 +1499,7 @@
else
timeout = 1;
-@@ -2057,6 +2248,12 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2057,6 +2330,12 @@ static void sfp_sm_main(struct sfp *sfp, unsigned int event)
sfp->sm_fault_retries == N_FAULT_INIT);
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done:
@@ -1132,7 +1512,7 @@
sfp->sm_phy_retries = R_PHY_RETRY;
goto phy_probe;
}
-@@ -2409,6 +2606,8 @@ static int sfp_probe(struct platform_dev
+@@ -2409,6 +2688,8 @@ static int sfp_probe(struct platform_device *pdev)
return PTR_ERR(sfp->gpio[i]);
}
@@ -1141,6 +1521,8 @@
sfp->get_state = sfp_gpio_get_state;
sfp->set_state = sfp_gpio_set_state;
+diff --git a/drivers/net/phy/sfp.h b/drivers/net/phy/sfp.h
+index b83f70526..f533e2dd6 100644
--- a/drivers/net/phy/sfp.h
+++ b/drivers/net/phy/sfp.h
@@ -6,6 +6,14 @@
@@ -1158,7 +1540,7 @@
struct sfp_socket_ops {
void (*attach)(struct sfp *sfp);
void (*detach)(struct sfp *sfp);
-@@ -20,7 +27,8 @@ int sfp_add_phy(struct sfp_bus *bus, str
+@@ -20,7 +28,8 @@ int sfp_add_phy(struct sfp_bus *bus, struct phy_device *phydev);
void sfp_remove_phy(struct sfp_bus *bus);
void sfp_link_up(struct sfp_bus *bus);
void sfp_link_down(struct sfp_bus *bus);
@@ -1168,274 +1550,26 @@
void sfp_module_remove(struct sfp_bus *bus);
int sfp_module_start(struct sfp_bus *bus);
void sfp_module_stop(struct sfp_bus *bus);
---- a/drivers/net/phy/marvell10g.c
-+++ b/drivers/net/phy/marvell10g.c
-@@ -32,6 +32,15 @@
- #define MV_PHY_ALASKA_NBT_QUIRK_REV (MARVELL_PHY_ID_88X3310 | 0xa)
-
- enum {
-+ MV_PMA_21X0_PORT_CTRL = 0xc04a,
-+ MV_PMA_21X0_PORT_CTRL_SWRST = BIT(15),
-+ MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK = 0x7,
-+ MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII = 0x0,
-+ MV_PMA_2180_PORT_CTRL_MACTYPE_DXGMII = 0x1,
-+ MV_PMA_2180_PORT_CTRL_MACTYPE_QXGMII = 0x2,
-+ MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER = 0x4,
-+ MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN = 0x5,
-+ MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6,
- MV_PMA_BOOT = 0xc050,
- MV_PMA_BOOT_FATAL = BIT(0),
-
-@@ -53,7 +62,18 @@ enum {
-
- /* Vendor2 MMD registers */
- MV_V2_PORT_CTRL = 0xf001,
-- MV_V2_PORT_CTRL_PWRDOWN = 0x0800,
-+ MV_V2_PORT_CTRL_PWRDOWN = BIT(11),
-+ MV_V2_33X0_PORT_CTRL_SWRST = BIT(15),
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_MASK = 0x7,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI = 0x0,
-+ MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH = 0x1,
-+ MV_V2_3340_PORT_CTRL_MACTYPE_RXAUI_NO_SGMII_AN = 0x1,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH = 0x2,
-+ MV_V2_3310_PORT_CTRL_MACTYPE_XAUI = 0x3,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER = 0x4,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN = 0x5,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH = 0x6,
-+ MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII = 0x7,
- MV_V2_TEMP_CTRL = 0xf08a,
- MV_V2_TEMP_CTRL_MASK = 0xc000,
- MV_V2_TEMP_CTRL_SAMPLE = 0x0000,
-@@ -62,11 +82,24 @@ enum {
- MV_V2_TEMP_UNKNOWN = 0x9600, /* unknown function */
- };
-
-+struct mv3310_chip {
-+ int (*get_mactype)(struct phy_device *phydev);
-+ int (*init_interface)(struct phy_device *phydev, int mactype);
-+};
-+
- struct mv3310_priv {
-+ bool rate_match;
-+ phy_interface_t const_interface;
-+
- struct device *hwmon_dev;
- char *hwmon_name;
- };
-
-+static const struct mv3310_chip *to_mv3310_chip(struct phy_device *phydev)
-+{
-+ return phydev->drv->driver_data;
-+}
-+
- #ifdef CONFIG_HWMON
- static umode_t mv3310_hwmon_is_visible(const void *data,
- enum hwmon_sensor_types type,
-@@ -155,13 +188,6 @@ static int mv3310_hwmon_config(struct ph
- MV_V2_TEMP_CTRL_MASK, val);
- }
-
--static void mv3310_hwmon_disable(void *data)
--{
-- struct phy_device *phydev = data;
--
-- mv3310_hwmon_config(phydev, false);
--}
--
- static int mv3310_hwmon_probe(struct phy_device *phydev)
- {
- struct device *dev = &phydev->mdio.dev;
-@@ -185,10 +211,6 @@ static int mv3310_hwmon_probe(struct phy
- if (ret)
- return ret;
-
-- ret = devm_add_action_or_reset(dev, mv3310_hwmon_disable, phydev);
-- if (ret)
-- return ret;
--
- priv->hwmon_dev = devm_hwmon_device_register_with_info(dev,
- priv->hwmon_name, phydev,
- &mv3310_hwmon_chip_info, NULL);
-@@ -262,6 +284,11 @@ static int mv3310_probe(struct phy_devic
- return phy_sfp_probe(phydev, &mv3310_sfp_ops);
- }
-
-+static void mv3310_remove(struct phy_device *phydev)
-+{
-+ mv3310_hwmon_config(phydev, false);
-+}
-+
- static int mv3310_suspend(struct phy_device *phydev)
- {
- return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
-@@ -297,8 +324,84 @@ static bool mv3310_has_pma_ngbaset_quirk
- MV_PHY_ALASKA_NBT_QUIRK_MASK) == MV_PHY_ALASKA_NBT_QUIRK_REV;
- }
-
-+static int mv2110_get_mactype(struct phy_device *phydev)
-+{
-+ int mactype;
-+
-+ mactype = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MV_PMA_21X0_PORT_CTRL);
-+ if (mactype < 0)
-+ return mactype;
-+
-+ return mactype & MV_PMA_21X0_PORT_CTRL_MACTYPE_MASK;
-+}
-+
-+static int mv3310_get_mactype(struct phy_device *phydev)
-+{
-+ int mactype;
-+
-+ mactype = phy_read_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL);
-+ if (mactype < 0)
-+ return mactype;
-+
-+ return mactype & MV_V2_33X0_PORT_CTRL_MACTYPE_MASK;
-+}
-+
-+static int mv2110_init_interface(struct phy_device *phydev, int mactype)
-+{
-+ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
-+
-+ priv->rate_match = false;
-+
-+ if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH)
-+ priv->rate_match = true;
-+
-+ if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_USXGMII)
-+ priv->const_interface = PHY_INTERFACE_MODE_USXGMII;
-+ else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH)
-+ priv->const_interface = PHY_INTERFACE_MODE_10GKR;
-+ else if (mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER ||
-+ mactype == MV_PMA_21X0_PORT_CTRL_MACTYPE_5GBASER_NO_SGMII_AN)
-+ priv->const_interface = PHY_INTERFACE_MODE_NA;
-+ else
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
-+static int mv3310_init_interface(struct phy_device *phydev, int mactype)
-+{
-+ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
-+
-+ priv->rate_match = false;
-+
-+ if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH ||
-+ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH ||
-+ mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH)
-+ priv->rate_match = true;
-+
-+ if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_USXGMII)
-+ priv->const_interface = PHY_INTERFACE_MODE_USXGMII;
-+ else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_RATE_MATCH ||
-+ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER_NO_SGMII_AN ||
-+ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_10GBASER)
-+ priv->const_interface = PHY_INTERFACE_MODE_10GKR;
-+ else if (mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI_RATE_MATCH ||
-+ mactype == MV_V2_33X0_PORT_CTRL_MACTYPE_RXAUI)
-+ priv->const_interface = PHY_INTERFACE_MODE_RXAUI;
-+ else if (mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI_RATE_MATCH ||
-+ mactype == MV_V2_3310_PORT_CTRL_MACTYPE_XAUI)
-+ priv->const_interface = PHY_INTERFACE_MODE_XAUI;
-+ else
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
- static int mv3310_config_init(struct phy_device *phydev)
- {
-+ const struct mv3310_chip *chip = to_mv3310_chip(phydev);
-+ int err, mactype;
-+
- /* Check that the PHY interface type is compatible */
- if (phydev->interface != PHY_INTERFACE_MODE_SGMII &&
- phydev->interface != PHY_INTERFACE_MODE_2500BASEX &&
-@@ -307,6 +410,16 @@ static int mv3310_config_init(struct phy
- phydev->interface != PHY_INTERFACE_MODE_10GKR)
- return -ENODEV;
-
-+ mactype = chip->get_mactype(phydev);
-+ if (mactype < 0)
-+ return mactype;
-+
-+ err = chip->init_interface(phydev, mactype);
-+ if (err) {
-+ phydev_err(phydev, "MACTYPE configuration invalid\n");
-+ return err;
-+ }
-+
- return 0;
- }
-
-@@ -384,6 +497,23 @@ static int mv3310_aneg_done(struct phy_d
-
- static void mv3310_update_interface(struct phy_device *phydev)
- {
-+ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
-+
-+ if (!phydev->link)
-+ return;
-+
-+ /* In all of the "* with Rate Matching" modes the PHY interface is fixed
-+ * at 10Gb. The PHY adapts the rate to actual wire speed with help of
-+ * internal 16KB buffer.
-+ *
-+ * In USXGMII mode the PHY interface mode is also fixed.
-+ */
-+ if (priv->rate_match ||
-+ priv->const_interface == PHY_INTERFACE_MODE_USXGMII) {
-+ phydev->interface = priv->const_interface;
-+ return;
-+ }
-+
- if ((phydev->interface == PHY_INTERFACE_MODE_SGMII ||
- phydev->interface == PHY_INTERFACE_MODE_2500BASEX ||
- phydev->interface == PHY_INTERFACE_MODE_5GBASER ||
-@@ -503,11 +633,22 @@ static int mv3310_read_status(struct phy
- return 0;
- }
+diff --git a/include/linux/mdio/mdio-i2c.h b/include/linux/mdio/mdio-i2c.h
+index 751dab281..1c2114068 100644
+--- a/include/linux/mdio/mdio-i2c.h
++++ b/include/linux/mdio/mdio-i2c.h
+@@ -11,6 +11,14 @@ struct device;
+ struct i2c_adapter;
+ struct mii_bus;
-+static const struct mv3310_chip mv3310_type = {
-+ .get_mactype = mv3310_get_mactype,
-+ .init_interface = mv3310_init_interface,
-+};
-+
-+static const struct mv3310_chip mv2111_type = {
-+ .get_mactype = mv2110_get_mactype,
-+ .init_interface = mv2110_init_interface,
+-struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c);
++enum mdio_i2c_proto {
++ MDIO_I2C_NONE,
++ MDIO_I2C_MARVELL_C22,
++ MDIO_I2C_C45,
++ MDIO_I2C_ROLLBALL,
+};
+
- static struct phy_driver mv3310_drivers[] = {
- {
- .phy_id = MARVELL_PHY_ID_88X3310,
- .phy_id_mask = MARVELL_PHY_ID_MASK,
- .name = "mv88x3310",
-+ .driver_data = &mv3310_type,
- .get_features = mv3310_get_features,
- .soft_reset = genphy_no_soft_reset,
- .config_init = mv3310_config_init,
-@@ -517,11 +658,13 @@ static struct phy_driver mv3310_drivers[
- .config_aneg = mv3310_config_aneg,
- .aneg_done = mv3310_aneg_done,
- .read_status = mv3310_read_status,
-+ .remove = mv3310_remove,
- },
- {
- .phy_id = MARVELL_PHY_ID_88E2110,
- .phy_id_mask = MARVELL_PHY_ID_MASK,
- .name = "mv88x2110",
-+ .driver_data = &mv2111_type,
- .probe = mv3310_probe,
- .suspend = mv3310_suspend,
- .resume = mv3310_resume,
-@@ -530,6 +673,7 @@ static struct phy_driver mv3310_drivers[
- .config_aneg = mv3310_config_aneg,
- .aneg_done = mv3310_aneg_done,
- .read_status = mv3310_read_status,
-+ .remove = mv3310_remove,
- },
- };
++struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
++ enum mdio_i2c_proto protocol);
+ #endif
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/757-net-phy-add-phylink-pcs-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1710-net-phy-add-phylink-pcs-support.patch
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/757-net-phy-add-phylink-pcs-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1710-net-phy-add-phylink-pcs-support.patch
index 99e4141..8f298c3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/757-net-phy-add-phylink-pcs-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1710-net-phy-add-phylink-pcs-support.patch
@@ -1,5 +1,16 @@
+From 45878f8001b0ad75c5497a999a43b5901c1e03a6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:01 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1710-net-phy-add-phylink-pcs-support.patch]
+
+---
+ drivers/net/phy/phylink.c | 306 ++++++++++++++++++++++++++++++--------
+ include/linux/phylink.h | 195 ++++++++++++++++++++++++
+ 2 files changed, 443 insertions(+), 58 deletions(-)
+
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
-index 67f34ed..ead9b37 100644
+index 67f34ed4c..9c76517ea 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -40,8 +40,9 @@ enum {
@@ -446,7 +457,7 @@
clear_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state);
phylink_run_resolve(pl);
-@@ -1055,10 +1238,19 @@ void phylink_start(struct phylink *pl)
+@@ -1055,10 +1239,19 @@ void phylink_start(struct phylink *pl)
irq = 0;
}
if (irq <= 0)
@@ -469,7 +480,7 @@
mod_timer(&pl->link_poll, jiffies + HZ);
if (pl->phydev)
phy_start(pl->phydev);
-@@ -1202,7 +1394,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
+@@ -1202,7 +1395,7 @@ int phylink_ethtool_ksettings_get(struct phylink *pl,
if (pl->phydev)
break;
@@ -478,7 +489,7 @@
/* The MAC is reporting the link results from its own PCS
* layer via in-band status. Report these as the current
-@@ -1314,7 +1506,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
+@@ -1314,7 +1507,7 @@ int phylink_ethtool_ksettings_set(struct phylink *pl,
if (pl->cur_link_an_mode == MLO_AN_INBAND &&
!test_bit(PHYLINK_DISABLE_STOPPED, &pl->phylink_disable_state)) {
phylink_mac_config(pl, &pl->link_config);
@@ -487,7 +498,7 @@
}
mutex_unlock(&pl->state_mutex);
-@@ -1341,7 +1533,7 @@ int phylink_ethtool_nway_reset(struct phylink *pl)
+@@ -1341,7 +1534,7 @@ int phylink_ethtool_nway_reset(struct phylink *pl)
if (pl->phydev)
ret = phy_restart_aneg(pl->phydev);
@@ -496,7 +507,7 @@
return ret;
}
-@@ -1410,7 +1602,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
+@@ -1410,7 +1603,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
case MLO_AN_INBAND:
phylink_mac_config(pl, config);
@@ -505,7 +516,7 @@
break;
}
}
-@@ -1621,10 +1813,7 @@ static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
+@@ -1621,10 +1814,7 @@ static int phylink_mii_read(struct phylink *pl, unsigned int phy_id,
case MLO_AN_INBAND:
if (phy_id == 0) {
@@ -517,7 +528,7 @@
val = phylink_mii_emul_read(reg, &state);
}
break;
-@@ -2010,7 +2010,7 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode,
+@@ -1820,7 +2010,7 @@ static int phylink_sfp_config(struct phylink *pl, u8 mode,
if (changed && !test_bit(PHYLINK_DISABLE_STOPPED,
&pl->phylink_disable_state))
@@ -527,7 +538,7 @@
return ret;
}
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
-index 8229f56..ba0f09d 100644
+index 8229f56a1..ba0f09d02 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -63,17 +63,23 @@ enum phylink_op_type {
@@ -782,3 +793,6 @@
struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
phy_interface_t iface,
const struct phylink_mac_ops *ops);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/758-net-phy-add-phylink-pcs-decode-helper.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1711-net-phy-add-phylink-pcs-decode-helper.patch
similarity index 93%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/758-net-phy-add-phylink-pcs-decode-helper.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1711-net-phy-add-phylink-pcs-decode-helper.patch
index 164578a..1c7ff1c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/758-net-phy-add-phylink-pcs-decode-helper.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1711-net-phy-add-phylink-pcs-decode-helper.patch
@@ -1,5 +1,23 @@
+From 318f81610f630a026fd5ca0d4da7e34df25df663 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:02 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1711-net-phy-add-phylink-pcs-decode-helper.patch]
+
+---
+ drivers/net/phy/Makefile | 3 +-
+ drivers/net/phy/linkmode.c | 95 +++++++++++++++++++
+ drivers/net/phy/phylink.c | 188 +++++++++++++++++++++++++++++++++++++
+ include/linux/linkmode.h | 6 ++
+ include/linux/mii.h | 39 ++++++++
+ include/linux/phylink.h | 30 ++++++
+ include/uapi/linux/mdio.h | 26 +++++
+ include/uapi/linux/mii.h | 17 ++++
+ 8 files changed, 403 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/phy/linkmode.c
+
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
-index 799ff9c..54ad7e8 100644
+index 8ea612a85..437ff2a2c 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -1,7 +1,8 @@
@@ -14,7 +32,7 @@
ifdef CONFIG_MDIO_DEVICE
diff --git a/drivers/net/phy/linkmode.c b/drivers/net/phy/linkmode.c
new file mode 100644
-index 0000000..a5a347b
+index 000000000..a5a347bca
--- /dev/null
+++ b/drivers/net/phy/linkmode.c
@@ -0,0 +1,95 @@
@@ -114,10 +132,10 @@
+}
+EXPORT_SYMBOL_GPL(linkmode_set_pause);
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
-index ead9b37..fec6d0e 100644
+index 9c76517ea..6b63b9839 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
-@@ -2184,4 +2184,192 @@ void phylink_helper_basex_speed(struct phylink_link_state *state)
+@@ -2185,4 +2185,192 @@ void phylink_helper_basex_speed(struct phylink_link_state *state)
}
EXPORT_SYMBOL_GPL(phylink_helper_basex_speed);
@@ -311,7 +329,7 @@
+
MODULE_LICENSE("GPL v2");
diff --git a/include/linux/linkmode.h b/include/linux/linkmode.h
-index a99c588..d38da4e 100644
+index a99c58866..d38da4e89 100644
--- a/include/linux/linkmode.h
+++ b/include/linux/linkmode.h
@@ -82,4 +82,10 @@ static inline int linkmode_equal(const unsigned long *src1,
@@ -326,7 +344,7 @@
+
#endif /* __LINKMODE_H */
diff --git a/include/linux/mii.h b/include/linux/mii.h
-index 4ce8901..54b7f64 100644
+index 4ce8901a1..54b7f64b0 100644
--- a/include/linux/mii.h
+++ b/include/linux/mii.h
@@ -485,6 +485,45 @@ static inline u32 linkmode_adv_to_lcl_adv_t(unsigned long *advertising)
@@ -376,7 +394,7 @@
* mii_advertise_flowctrl - get flow control advertisement flags
* @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
-index ba0f09d..48ff9fe 100644
+index ba0f09d02..48ff9fead 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -490,4 +490,34 @@ int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
@@ -415,7 +433,7 @@
+ uint16_t lpa);
#endif
diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h
-index 4bcb41c..3f302e2 100644
+index 4bcb41c71..3f302e252 100644
--- a/include/uapi/linux/mdio.h
+++ b/include/uapi/linux/mdio.h
@@ -324,4 +324,30 @@ static inline __u16 mdio_phy_id_c45(int prtad, int devad)
@@ -450,7 +468,7 @@
+
#endif /* _UAPI__LINUX_MDIO_H__ */
diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h
-index 51b48e4..90f9b4e 100644
+index 51b48e4be..90f9b4e1b 100644
--- a/include/uapi/linux/mii.h
+++ b/include/uapi/linux/mii.h
@@ -131,6 +131,23 @@
@@ -477,3 +495,6 @@
/* 1000BASE-T Control register */
#define ADVERTISE_1000FULL 0x0200 /* Advertise 1000BASE-T full duplex */
#define ADVERTISE_1000HALF 0x0100 /* Advertise 1000BASE-T half duplex */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1712-net-phy-add-phylink-rate-matching-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1712-net-phy-add-phylink-rate-matching-support.patch
new file mode 100644
index 0000000..3b9d2a6
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-1712-net-phy-add-phylink-rate-matching-support.patch
@@ -0,0 +1,413 @@
+diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
+index 8406412..96d9e1f 100644
+--- a/drivers/net/phy/phy-core.c
++++ b/drivers/net/phy/phy-core.c
+@@ -62,6 +62,27 @@ const char *phy_duplex_to_str(unsigned int duplex)
+ }
+ EXPORT_SYMBOL_GPL(phy_duplex_to_str);
+
++/**
++ * phy_rate_matching_to_str - Return a string describing the rate matching
++ *
++ * @rate_matching: Type of rate matching to describe
++ */
++const char *phy_rate_matching_to_str(int rate_matching)
++{
++ switch (rate_matching) {
++ case RATE_MATCH_NONE:
++ return "none";
++ case RATE_MATCH_PAUSE:
++ return "pause";
++ case RATE_MATCH_CRS:
++ return "crs";
++ case RATE_MATCH_OPEN_LOOP:
++ return "open-loop";
++ }
++ return "Unsupported (update phy-core.c)";
++}
++EXPORT_SYMBOL_GPL(phy_rate_matching_to_str);
++
+ /* A mapping of all SUPPORTED settings to speed/duplex. This table
+ * must be grouped by speed and sorted in descending match priority
+ * - iow, descending speed. */
+diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
+index e223f0d..6f2e4c7 100644
+--- a/drivers/net/phy/phy.c
++++ b/drivers/net/phy/phy.c
+@@ -106,6 +106,33 @@ void phy_print_status(struct phy_device *phydev)
+ }
+ EXPORT_SYMBOL(phy_print_status);
+
++/**
++ * phy_get_rate_matching - determine if rate matching is supported
++ * @phydev: The phy device to return rate matching for
++ * @iface: The interface mode to use
++ *
++ * This determines the type of rate matching (if any) that @phy supports
++ * using @iface. @iface may be %PHY_INTERFACE_MODE_NA to determine if any
++ * interface supports rate matching.
++ *
++ * Return: The type of rate matching @phy supports for @iface, or
++ * %RATE_MATCH_NONE.
++ */
++int phy_get_rate_matching(struct phy_device *phydev,
++ phy_interface_t iface)
++{
++ int ret = RATE_MATCH_NONE;
++
++ if (phydev->drv->get_rate_matching) {
++ mutex_lock(&phydev->lock);
++ ret = phydev->drv->get_rate_matching(phydev, iface);
++ mutex_unlock(&phydev->lock);
++ }
++
++ return ret;
++}
++EXPORT_SYMBOL_GPL(phy_get_rate_matching);
++
+ /**
+ * phy_clear_interrupt - Ack the phy device's interrupt
+ * @phydev: the phy_device struct
+@@ -380,6 +407,7 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev,
+
+ cmd->base.speed = phydev->speed;
+ cmd->base.duplex = phydev->duplex;
++ cmd->base.rate_matching = phydev->rate_matching;
+ if (phydev->interface == PHY_INTERFACE_MODE_MOCA)
+ cmd->base.port = PORT_BNC;
+ else
+diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
+index 6b63b98..949e3b8 100644
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -155,6 +155,64 @@ static const char *phylink_an_mode_str(unsigned int mode)
+ return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
+ }
+
++/**
++ * phylink_interface_max_speed() - get the maximum speed of a phy interface
++ * @interface: phy interface mode defined by &typedef phy_interface_t
++ *
++ * Determine the maximum speed of a phy interface. This is intended to help
++ * determine the correct speed to pass to the MAC when the phy is performing
++ * rate matching.
++ *
++ * Return: The maximum speed of @interface
++ */
++static int phylink_interface_max_speed(phy_interface_t interface)
++{
++ switch (interface) {
++ case PHY_INTERFACE_MODE_RMII:
++ case PHY_INTERFACE_MODE_SMII:
++ case PHY_INTERFACE_MODE_REVMII:
++ case PHY_INTERFACE_MODE_MII:
++ return SPEED_100;
++
++ case PHY_INTERFACE_MODE_TBI:
++ case PHY_INTERFACE_MODE_MOCA:
++ case PHY_INTERFACE_MODE_RTBI:
++ case PHY_INTERFACE_MODE_1000BASEX:
++ case PHY_INTERFACE_MODE_TRGMII:
++ case PHY_INTERFACE_MODE_RGMII_TXID:
++ case PHY_INTERFACE_MODE_RGMII_RXID:
++ case PHY_INTERFACE_MODE_RGMII_ID:
++ case PHY_INTERFACE_MODE_RGMII:
++ case PHY_INTERFACE_MODE_QSGMII:
++ case PHY_INTERFACE_MODE_SGMII:
++ case PHY_INTERFACE_MODE_GMII:
++ return SPEED_1000;
++
++ case PHY_INTERFACE_MODE_2500BASEX:
++ return SPEED_2500;
++
++ case PHY_INTERFACE_MODE_5GBASER:
++ return SPEED_5000;
++
++ case PHY_INTERFACE_MODE_XGMII:
++ case PHY_INTERFACE_MODE_RXAUI:
++ case PHY_INTERFACE_MODE_XAUI:
++ case PHY_INTERFACE_MODE_10GKR:
++ case PHY_INTERFACE_MODE_USXGMII:
++ return SPEED_10000;
++
++ case PHY_INTERFACE_MODE_INTERNAL:
++ case PHY_INTERFACE_MODE_NA:
++ case PHY_INTERFACE_MODE_MAX:
++ /* No idea! Garbage in, unknown out */
++ return SPEED_UNKNOWN;
++ }
++
++ /* If we get here, someone forgot to add an interface mode above */
++ WARN_ON_ONCE(1);
++ return SPEED_UNKNOWN;
++}
++
+ static int phylink_validate_mac_and_pcs(struct phylink *pl,
+ unsigned long *supported,
+ struct phylink_link_state *state)
+@@ -402,11 +460,12 @@ static void phylink_mac_config(struct phylink *pl,
+ const struct phylink_link_state *state)
+ {
+ phylink_dbg(pl,
+- "%s: mode=%s/%s/%s/%s adv=%*pb pause=%02x link=%u an=%u\n",
++ "%s: mode=%s/%s/%s/%s/%s adv=%*pb pause=%02x link=%u an=%u\n",
+ __func__, phylink_an_mode_str(pl->cur_link_an_mode),
+ phy_modes(state->interface),
+ phy_speed_to_str(state->speed),
+ phy_duplex_to_str(state->duplex),
++ phy_rate_matching_to_str(state->rate_matching),
+ __ETHTOOL_LINK_MODE_MASK_NBITS, state->advertising,
+ state->pause, state->link, state->an_enabled);
+
+@@ -499,6 +558,7 @@ static void phylink_mac_pcs_get_state(struct phylink *pl,
+ linkmode_zero(state->lp_advertising);
+ state->interface = pl->link_config.interface;
+ state->an_enabled = pl->link_config.an_enabled;
++ state->rate_matching = pl->link_config.rate_matching;
+ if (state->an_enabled) {
+ state->speed = SPEED_UNKNOWN;
+ state->duplex = DUPLEX_UNKNOWN;
+@@ -614,9 +674,32 @@ static void phylink_link_up(struct phylink *pl,
+ {
+ struct net_device *ndev = pl->netdev;
+ int speed, duplex;
++ bool rx_pause;
+
+ speed = link_state.speed;
+ duplex = link_state.duplex;
++ rx_pause = !!(link_state.pause & MLO_PAUSE_RX);
++
++ switch (link_state.rate_matching) {
++ case RATE_MATCH_PAUSE:
++ /* The PHY is doing rate matchion from the media rate (in
++ * the link_state) to the interface speed, and will send
++ * pause frames to the MAC to limit its transmission speed.
++ */
++ speed = phylink_interface_max_speed(link_state.interface);
++ duplex = DUPLEX_FULL;
++ rx_pause = true;
++ break;
++
++ case RATE_MATCH_CRS:
++ /* The PHY is doing rate matchion from the media rate (in
++ * the link_state) to the interface speed, and will cause
++ * collisions to the MAC to limit its transmission speed.
++ */
++ speed = phylink_interface_max_speed(link_state.interface);
++ duplex = DUPLEX_HALF;
++ break;
++ }
+
+ pl->cur_interface = link_state.interface;
+
+@@ -626,8 +709,7 @@ static void phylink_link_up(struct phylink *pl,
+
+ pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode,
+ pl->cur_interface, speed, duplex,
+- !!(link_state.pause & MLO_PAUSE_TX),
+- !!(link_state.pause & MLO_PAUSE_RX));
++ !!(link_state.pause & MLO_PAUSE_TX), rx_pause);
+
+ if (ndev)
+ netif_carrier_on(ndev);
+@@ -719,6 +801,17 @@ static void phylink_resolve(struct work_struct *w)
+ }
+ link_state.interface = pl->phy_state.interface;
+
++ /* If we are doing rate matching, then the
++ * link speed/duplex comes from the PHY
++ */
++ if (pl->phy_state.rate_matching) {
++ link_state.rate_matching =
++ pl->phy_state.rate_matching;
++ link_state.speed = pl->phy_state.speed;
++ link_state.duplex =
++ pl->phy_state.duplex;
++ }
++
+ /* If we have a PHY, we need to update with
+ * the PHY flow control bits.
+ */
+@@ -935,6 +1028,7 @@ static void phylink_phy_change(struct phy_device *phydev, bool up,
+ mutex_lock(&pl->state_mutex);
+ pl->phy_state.speed = phydev->speed;
+ pl->phy_state.duplex = phydev->duplex;
++ pl->phy_state.rate_matching = phydev->rate_matching;
+ pl->phy_state.pause = MLO_PAUSE_NONE;
+ if (phydev->pause)
+ pl->phy_state.pause |= MLO_PAUSE_SYM;
+@@ -946,10 +1040,11 @@ static void phylink_phy_change(struct phy_device *phydev, bool up,
+
+ phylink_run_resolve(pl);
+
+- phylink_dbg(pl, "phy link %s %s/%s/%s\n", up ? "up" : "down",
++ phylink_dbg(pl, "phy link %s %s/%s/%s/%s\n", up ? "up" : "down",
+ phy_modes(phydev->interface),
+ phy_speed_to_str(phydev->speed),
+- phy_duplex_to_str(phydev->duplex));
++ phy_duplex_to_str(phydev->duplex),
++ phy_rate_matching_to_str(phydev->rate_matching));
+ }
+
+ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
+@@ -971,6 +1066,12 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
+ memset(&config, 0, sizeof(config));
+ linkmode_copy(supported, phy->supported);
+ linkmode_copy(config.advertising, phy->advertising);
++
++ /* Check whether we would use rate matching for the proposed interface
++ * mode.
++ */
++ config.rate_matching = phy_get_rate_matching(phy, interface);
++
+ config.interface = interface;
+
+ ret = phylink_validate(pl, supported, &config);
+@@ -988,6 +1089,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy,
+ mutex_lock(&pl->state_mutex);
+ pl->phydev = phy;
+ pl->phy_state.interface = interface;
++ pl->phy_state.rate_matching = RATE_MATCH_NONE;
+ linkmode_copy(pl->supported, supported);
+ linkmode_copy(pl->link_config.advertising, config.advertising);
+
+@@ -1348,8 +1450,10 @@ static void phylink_get_ksettings(const struct phylink_link_state *state,
+ {
+ phylink_merge_link_mode(kset->link_modes.advertising, state->advertising);
+ linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising);
+- kset->base.speed = state->speed;
+- kset->base.duplex = state->duplex;
++ if (kset->base.rate_matching == RATE_MATCH_NONE) {
++ kset->base.speed = state->speed;
++ kset->base.duplex = state->duplex;
++ }
+ kset->base.autoneg = state->an_enabled ? AUTONEG_ENABLE :
+ AUTONEG_DISABLE;
+ }
+diff --git a/include/linux/phy.h b/include/linux/phy.h
+index 4f2c105..df9fb90 100644
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -423,6 +423,8 @@ struct phy_device {
+ /* Interrupts are enabled */
+ unsigned interrupts:1;
+
++ int rate_matching;
++
+ enum phy_state state;
+
+ u32 dev_flags;
+@@ -544,6 +546,18 @@ struct phy_driver {
+ */
+ int (*get_features)(struct phy_device *phydev);
+
++ /**
++ * @get_rate_matching: Get the supported type of rate matching for a
++ * particular phy interface. This is used by phy consumers to determine
++ * whether to advertise lower-speed modes for that interface. It is
++ * assumed that if a rate matching mode is supported on an interface,
++ * then that interface's rate can be adapted to all slower link speeds
++ * supported by the phy. If the interface is not supported, this should
++ * return %RATE_MATCH_NONE.
++ */
++ int (*get_rate_matching)(struct phy_device *phydev,
++ phy_interface_t iface);
++
+ /* PHY Power Management */
+ int (*suspend)(struct phy_device *phydev);
+ int (*resume)(struct phy_device *phydev);
+@@ -704,6 +718,7 @@ struct phy_fixup {
+
+ const char *phy_speed_to_str(int speed);
+ const char *phy_duplex_to_str(unsigned int duplex);
++const char *phy_rate_matching_to_str(int rate_matching);
+
+ /* A structure for mapping a particular speed and duplex
+ * combination to a particular SUPPORTED and ADVERTISED value
+@@ -1242,6 +1257,8 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd);
+ void phy_request_interrupt(struct phy_device *phydev);
+ void phy_free_interrupt(struct phy_device *phydev);
+ void phy_print_status(struct phy_device *phydev);
++int phy_get_rate_matching(struct phy_device *phydev,
++ phy_interface_t iface);
+ int phy_set_max_speed(struct phy_device *phydev, u32 max_speed);
+ void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode);
+ void phy_advertise_supported(struct phy_device *phydev);
+diff --git a/include/linux/phylink.h b/include/linux/phylink.h
+index 48ff9fe..e1c022f 100644
+--- a/include/linux/phylink.h
++++ b/include/linux/phylink.h
+@@ -38,6 +38,10 @@ static inline bool phylink_autoneg_inband(unsigned int mode)
+ * @speed: link speed, one of the SPEED_* constants.
+ * @duplex: link duplex mode, one of DUPLEX_* constants.
+ * @pause: link pause state, described by MLO_PAUSE_* constants.
++ * @rate_matching: rate matching being performed, one of the RATE_MATCH_*
++ * constants. If rate matching is taking place, then the speed/duplex of
++ * the medium link mode (@speed and @duplex) and the speed/duplex of the phy
++ * interface mode (@interface) are different.
+ * @link: true if the link is up.
+ * @an_enabled: true if autonegotiation is enabled/desired.
+ * @an_complete: true if autonegotiation has completed.
+@@ -49,6 +53,7 @@ struct phylink_link_state {
+ int speed;
+ int duplex;
+ int pause;
++ int rate_matching;
+ unsigned int link:1;
+ unsigned int an_enabled:1;
+ unsigned int an_complete:1;
+diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
+index 8d465e5..ce41d2f 100644
+--- a/include/uapi/linux/ethtool.h
++++ b/include/uapi/linux/ethtool.h
+@@ -1643,6 +1643,20 @@ static inline int ethtool_validate_duplex(__u8 duplex)
+ return 0;
+ }
+
++/* These are used to throttle the rate of data on the phy interface when the
++ * native speed of the interface is higher than the link speed. These should
++ * not be used for phy interfaces which natively support multiple speeds (e.g.
++ * MII or SGMII).
++ */
++/* No rate matching performed. */
++#define RATE_MATCH_NONE 0
++/* The phy sends pause frames to throttle the MAC. */
++#define RATE_MATCH_PAUSE 1
++/* The phy asserts CRS to prevent the MAC from transmitting. */
++#define RATE_MATCH_CRS 2
++/* The MAC is programmed with a sufficiently-large IPG. */
++#define RATE_MATCH_OPEN_LOOP 3
++
+ /* Which connector port. */
+ #define PORT_TP 0x00
+ #define PORT_AUI 0x01
+@@ -1832,6 +1846,7 @@ enum ethtool_reset_flags {
+ * autonegotiation; 0 if unknown or not applicable. Read-only.
+ * @transceiver: Used to distinguish different possible PHY types,
+ * reported consistently by PHYLIB. Read-only.
++ * @rate_matching: Rate adaptation performed by the PHY
+ *
+ * If autonegotiation is disabled, the speed and @duplex represent the
+ * fixed link mode and are writable if the driver supports multiple
+@@ -1879,7 +1894,8 @@ struct ethtool_link_settings {
+ __u8 eth_tp_mdix_ctrl;
+ __s8 link_mode_masks_nwords;
+ __u8 transceiver;
+- __u8 reserved1[3];
++ __u8 reserved1[2];
++ __u8 rate_matching;
+ __u32 reserved[7];
+ __u32 link_mode_masks[0];
+ /* layout of link_mode_masks fields:
+diff --git a/net/core/ethtool.c b/net/core/ethtool.c
+index 9ae38c3..41a8b1d 100644
+--- a/net/core/ethtool.c
++++ b/net/core/ethtool.c
+@@ -656,6 +656,7 @@ static int ethtool_get_link_ksettings(struct net_device *dev,
+ link_ksettings.base.cmd = ETHTOOL_GLINKSETTINGS;
+ link_ksettings.base.link_mode_masks_nwords
+ = __ETHTOOL_LINK_MODE_MASK_NU32;
++ link_ksettings.base.rate_matching = RATE_MATCH_NONE;
+
+ return store_link_ksettings_for_user(useraddr, &link_ksettings);
+ }
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2000-show_model_name_in_cpuinfo_on_arm64.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2000-show_model_name_in_cpuinfo_on_arm64.patch
new file mode 100644
index 0000000..12ad322
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2000-show_model_name_in_cpuinfo_on_arm64.patch
@@ -0,0 +1,29 @@
+From 9fb8ad91c5e221d44089ca908311842d61c8f289 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:02 +0800
+Subject: [PATCH]
+ [basic-part][999-2000-show_model_name_in_cpuinfo_on_arm64.patch]
+
+---
+ arch/arm64/kernel/cpuinfo.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
+index 90b35011a..4324f12a2 100644
+--- a/arch/arm64/kernel/cpuinfo.c
++++ b/arch/arm64/kernel/cpuinfo.c
+@@ -139,9 +139,8 @@ static int c_show(struct seq_file *m, void *v)
+ * "processor". Give glibc what it expects.
+ */
+ seq_printf(m, "processor\t: %d\n", i);
+- if (compat)
+- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
+- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
++ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n",
++ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM);
+
+ seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
+ loops_per_jiffy / (500000UL/HZ),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1023-kgdb-add-interrupt-control.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2001-kgdb-add-interrupt-control.patch
similarity index 76%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1023-kgdb-add-interrupt-control.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2001-kgdb-add-interrupt-control.patch
index e0ee954..7973173 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1023-kgdb-add-interrupt-control.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2001-kgdb-add-interrupt-control.patch
@@ -1,5 +1,14 @@
+From 766f65096433dde206cdfa19c2cd644be6beaf32 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:02 +0800
+Subject: [PATCH] [basic-part][999-2001-kgdb-add-interrupt-control.patch]
+
+---
+ arch/arm64/kernel/kgdb.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
-index 1a157ca..258fe4b 100644
+index 1a157ca33..258fe4b38 100644
--- a/arch/arm64/kernel/kgdb.c
+++ b/arch/arm64/kernel/kgdb.c
@@ -18,6 +18,10 @@
@@ -40,3 +49,6 @@
kgdb_handle_exception(0, SIGTRAP, 0, regs);
return DBG_HOOK_HANDLED;
}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-clk-mtk-add-mt7986-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2010-clk-mtk-add-mt7986-support.patch
similarity index 79%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-clk-mtk-add-mt7986-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2010-clk-mtk-add-mt7986-support.patch
index 930e88b..0708076 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0001-clk-mtk-add-mt7986-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2010-clk-mtk-add-mt7986-support.patch
@@ -1,11 +1,21 @@
+From cd39b20ca69be67d38a2366e64c496f157f12672 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:02 +0800
+Subject: [PATCH] [basic-part][999-2010-clk-mtk-add-mt7986-support.patch]
+
+---
+ drivers/clk/mediatek/Kconfig | 9 +++++++++
+ drivers/clk/mediatek/Makefile | 2 ++
+ 2 files changed, 11 insertions(+)
+
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
-index 7efc361..5f11280 100644
+index 7efc3617b..1c48fe9f5 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -258,6 +258,15 @@ config COMMON_CLK_MT7629_HIFSYS
This driver supports MediaTek MT7629 HIFSYS clocks providing
to PCI-E and USB.
-
+
+config COMMON_CLK_MT7986
+ bool "Clock driver for MediaTek MT7986"
+ depends on ARCH_MEDIATEK || COMPILE_TEST
@@ -19,7 +29,7 @@
bool "Clock driver for MediaTek MT8135"
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
-index 8cdb76a..8c392f4 100644
+index 8cdb76a5c..8c392f4ef 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -39,6 +39,7 @@ obj-$(CONFIG_COMMON_CLK_MT7622_AUDSYS) += clk-mt7622-aud.o
@@ -37,5 +47,5 @@
+obj-y += clk-bringup.o
\ No newline at end of file
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-clk-mtk-add-mt7981-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2011-clk-mtk-add-mt7981-support.patch
similarity index 75%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-clk-mtk-add-mt7981-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2011-clk-mtk-add-mt7981-support.patch
index 72f9e8a..7bf43f4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-clk-mtk-add-mt7981-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2011-clk-mtk-add-mt7981-support.patch
@@ -1,5 +1,15 @@
+From 0c59e472d0ace19f00d06b4ccf5dba6a7831c001 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:03 +0800
+Subject: [PATCH] [basic-part][999-2011-clk-mtk-add-mt7981-support.patch]
+
+---
+ drivers/clk/mediatek/Kconfig | 8 ++++++++
+ drivers/clk/mediatek/Makefile | 1 +
+ 2 files changed, 9 insertions(+)
+
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
-index 1c48fe9..23393d5 100644
+index 1c48fe9f5..23393d5ec 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -267,6 +267,14 @@ config COMMON_CLK_MT7986
@@ -18,7 +28,7 @@
bool "Clock driver for MediaTek MT8135"
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
-index 8c392f4..ffe0850 100644
+index 8c392f4ef..ffe0850e1 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_COMMON_CLK_MT7629) += clk-mt7629.o
@@ -30,5 +40,5 @@
obj-$(CONFIG_COMMON_CLK_MT8173) += clk-mt8173.o
obj-$(CONFIG_COMMON_CLK_MT8183) += clk-mt8183.o
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-clk-mtk-add-mt7988-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2012-clk-mtk-add-mt7988-support.patch
similarity index 78%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-clk-mtk-add-mt7988-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2012-clk-mtk-add-mt7988-support.patch
index e673148..d29a023 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-clk-mtk-add-mt7988-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2012-clk-mtk-add-mt7988-support.patch
@@ -1,5 +1,15 @@
+From 63786d6f950d63c586b4efac77d3244b959ba5a6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:03 +0800
+Subject: [PATCH] [basic-part][999-2012-clk-mtk-add-mt7988-support.patch]
+
+---
+ drivers/clk/mediatek/Kconfig | 8 ++++++++
+ drivers/clk/mediatek/Makefile | 3 ++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
diff --git a/drivers/clk/mediatek/Kconfig b/drivers/clk/mediatek/Kconfig
-index 23393d5..cf3a53e 100644
+index 23393d5ec..cf3a53e9b 100644
--- a/drivers/clk/mediatek/Kconfig
+++ b/drivers/clk/mediatek/Kconfig
@@ -275,6 +275,14 @@ config COMMON_CLK_MT7981
@@ -18,7 +28,7 @@
bool "Clock driver for MediaTek MT8135"
depends on (ARCH_MEDIATEK && ARM) || COMPILE_TEST
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
-index ffe0850..43ca85d 100644
+index ffe0850e1..43ca85d10 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -41,6 +41,7 @@ obj-$(CONFIG_COMMON_CLK_MT7629_ETHSYS) += clk-mt7629-eth.o
@@ -36,3 +46,6 @@
-obj-y += clk-bringup.o
\ No newline at end of file
+obj-y += clk-bringup.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0005-clk-mtk-add-chg-shift-control.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2013-clk-mtk-add-chg-shift-control.patch
similarity index 69%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0005-clk-mtk-add-chg-shift-control.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2013-clk-mtk-add-chg-shift-control.patch
index 4a9ff6f..7853f41 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0005-clk-mtk-add-chg-shift-control.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2013-clk-mtk-add-chg-shift-control.patch
@@ -1,5 +1,15 @@
+From e640a8767e5ab047b8a4c89041ee3872132ce38a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:03 +0800
+Subject: [PATCH] [basic-part][999-2013-clk-mtk-add-chg-shift-control.patch]
+
+---
+ drivers/clk/mediatek/clk-mtk.h | 1 +
+ drivers/clk/mediatek/clk-pll.c | 5 ++++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
-index c3d6756..d84c45d 100644
+index c3d6756b0..d84c45d75 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -231,6 +231,7 @@ struct mtk_pll_data {
@@ -11,7 +21,7 @@
const char *parent_name;
};
diff --git a/drivers/clk/mediatek/clk-pll.c b/drivers/clk/mediatek/clk-pll.c
-index f440f2c..db318fe 100644
+index f440f2cd0..db318fe1c 100644
--- a/drivers/clk/mediatek/clk-pll.c
+++ b/drivers/clk/mediatek/clk-pll.c
@@ -136,7 +136,10 @@ static void mtk_pll_set_rate_regs(struct mtk_clk_pll *pll, u32 pcw,
@@ -26,3 +36,6 @@
writel(chg, pll->pcw_chg_addr);
if (pll->tuner_addr)
writel(val + 1, pll->tuner_addr);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-add-mt7986-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2020-pinctrl-add-mt7986-driver.patch
similarity index 72%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-add-mt7986-driver.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2020-pinctrl-add-mt7986-driver.patch
index a02873d..ba9e2bb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-add-mt7986-driver.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2020-pinctrl-add-mt7986-driver.patch
@@ -1,5 +1,15 @@
+From 1cbd50ca51ad80b9c2527c1aaccb57b92dd6d635 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:03 +0800
+Subject: [PATCH] [basic-part][999-2020-pinctrl-add-mt7986-driver.patch]
+
+---
+ drivers/pinctrl/mediatek/Kconfig | 7 +++++++
+ drivers/pinctrl/mediatek/Makefile | 1 +
+ 2 files changed, 8 insertions(+)
+
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
-index 701f9af..9109f91 100644
+index 701f9af63..9109f911a 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -100,6 +100,13 @@ config PINCTRL_MT7622
@@ -17,7 +27,7 @@
bool "Mediatek MT8173 pin control"
depends on OF
diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
-index a74325a..d408585 100644
+index a74325abd..d4085859a 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_PINCTRL_MT6797) += pinctrl-mt6797.o
@@ -28,3 +38,6 @@
obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o
obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o
obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-enable-mt7988-pinctrl-config.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2021-pinctrl-enable-mt7988-pinctrl-config.patch
similarity index 62%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-enable-mt7988-pinctrl-config.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2021-pinctrl-enable-mt7988-pinctrl-config.patch
index 01f01f6..84f0b84 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/401-pinctrl-enable-mt7988-pinctrl-config.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2021-pinctrl-enable-mt7988-pinctrl-config.patch
@@ -1,8 +1,19 @@
+From c0566aeb32196514614c335efb3e280595da99c3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:04 +0800
+Subject: [PATCH]
+ [basic-part][999-2021-pinctrl-enable-mt7988-pinctrl-config.patch]
+
+---
+ drivers/pinctrl/mediatek/Kconfig | 7 +++++++
+ drivers/pinctrl/mediatek/Makefile | 1 +
+ 2 files changed, 8 insertions(+)
+
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
-index e7ec276..b6341dd 100644
+index 9109f911a..a2223dbe0 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
-@@ -112,6 +112,13 @@ config PINCTRL_MT7986
+@@ -107,6 +107,13 @@ config PINCTRL_MT7986
default ARM64 && ARCH_MEDIATEK
select PINCTRL_MTK_MOORE
@@ -17,14 +28,17 @@
bool "Mediatek MT8173 pin control"
depends on OF
diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
-index e6813cf..6e28df9 100644
+index d4085859a..6526efc2c 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
-@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
+@@ -16,6 +16,7 @@ obj-$(CONFIG_PINCTRL_MT7622) += pinctrl-mt7622.o
+ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
- obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o
obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o
+obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o
obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o
obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o
obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/402-pinctrl-add-mt7981-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2022-pinctrl-add-mt7981-driver.patch
similarity index 74%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/402-pinctrl-add-mt7981-driver.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2022-pinctrl-add-mt7981-driver.patch
index 9e67ee7..10f0938 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/402-pinctrl-add-mt7981-driver.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2022-pinctrl-add-mt7981-driver.patch
@@ -1,15 +1,15 @@
-From 1b529849f324edec053a34292e3f874bde8f7401 Mon Sep 17 00:00:00 2001
+From af29af4ab3fb39d3884ea9f7352e672c89093c3b Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
-Date: Fri, 25 Jun 2021 15:43:55 +0800
-Subject: [PATCH] Add mt7981 pinctrl driver support
+Date: Fri, 2 Jun 2023 13:06:04 +0800
+Subject: [PATCH] [basic-part][999-2022-pinctrl-add-mt7981-driver.patch]
---
- drivers/pinctrl/mediatek/Kconfig | 7 +++++++
+ drivers/pinctrl/mediatek/Kconfig | 5 +++++
drivers/pinctrl/mediatek/Makefile | 1 +
- 2 files changed, 8 insertions(+)
+ 2 files changed, 6 insertions(+)
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
-index 9109f91..d40aee5 100644
+index a2223dbe0..b6341dd83 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -100,6 +100,11 @@ config PINCTRL_MT7622
@@ -25,7 +25,7 @@
bool "Mediatek MT7986 pin control"
depends on OF
diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
-index d408585..e6813cf 100644
+index 6526efc2c..b80ef66da 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_PINCTRL_MT6797) += pinctrl-mt6797.o
@@ -34,8 +34,8 @@
obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
+obj-$(CONFIG_PINCTRL_MT7981) += pinctrl-mt7981.o
obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o
+ obj-$(CONFIG_PINCTRL_MT7988) += pinctrl-mt7988.o
obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o
- obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o
--
-2.6.4
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2040-powerdomain-add-mt7988-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2040-powerdomain-add-mt7988-support.patch
new file mode 100644
index 0000000..33f4ae6
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2040-powerdomain-add-mt7988-support.patch
@@ -0,0 +1,21 @@
+From c04a931b0f3f8c1af74197ef22a9cbcb96697c9f Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:04 +0800
+Subject: [PATCH] [basic-part][999-2040-powerdomain-add-mt7988-support.patch]
+
+---
+ drivers/soc/mediatek/Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
+index b01733074..1c485e3ba 100644
+--- a/drivers/soc/mediatek/Makefile
++++ b/drivers/soc/mediatek/Makefile
+@@ -3,3 +3,4 @@ obj-$(CONFIG_MTK_CMDQ) += mtk-cmdq-helper.o
+ obj-$(CONFIG_MTK_INFRACFG) += mtk-infracfg.o
+ obj-$(CONFIG_MTK_PMIC_WRAP) += mtk-pmic-wrap.o
+ obj-$(CONFIG_MTK_SCPSYS) += mtk-scpsys.o
++obj-$(CONFIG_MTK_SCPSYS) += mtk-pm-domains.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0960-watchdog-add-mt7986-assert.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2050-watchdog-add-mt7986-assert.patch
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0960-watchdog-add-mt7986-assert.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2050-watchdog-add-mt7986-assert.patch
index 619fc10..2b0f938 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0960-watchdog-add-mt7986-assert.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2050-watchdog-add-mt7986-assert.patch
@@ -1,5 +1,14 @@
+From d02a2cf00764f83a9efdc08685381ee9167b0a9e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:04 +0800
+Subject: [PATCH] [basic-part][999-2050-watchdog-add-mt7986-assert.patch]
+
+---
+ drivers/watchdog/mtk_wdt.c | 202 +++++++++++++++++++++++++++++++++++--
+ 1 file changed, 193 insertions(+), 9 deletions(-)
+
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
-index 9c3d003..30127d1 100644
+index 9c3d00332..30127d1e7 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -9,6 +9,8 @@
@@ -326,3 +335,6 @@
-MODULE_VERSION(DRV_VERSION);
+MODULE_VERSION(DRV_VERSION);
\ No newline at end of file
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0111-mt7986-trng-add-rng-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2100-mt7986-trng-add-rng-support.patch
similarity index 68%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0111-mt7986-trng-add-rng-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2100-mt7986-trng-add-rng-support.patch
index 1b132a3..bef2e1c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0111-mt7986-trng-add-rng-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2100-mt7986-trng-add-rng-support.patch
@@ -1,18 +1,14 @@
-From 6d4a858d6f7db2a86f6513a543feb8f7b8a8b4c1 Mon Sep 17 00:00:00 2001
-From: "Mingming.Su" <Mingming.Su@mediatek.com>
-Date: Wed, 30 Jun 2021 16:59:32 +0800
-Subject: [PATCH] mt7986: trng: add rng support
+From 28b23dd56546943c99dc4e884576e629b417fb6d Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:05 +0800
+Subject: [PATCH] [slow-speed-io][999-2100-mt7986-trng-add-rng-support.patch]
-1. Add trng compatible name for MT7986
-2. Fix mtk_rng_wait_ready() function
-
-Signed-off-by: Mingming.Su <Mingming.Su@mediatek.com>
---
drivers/char/hw_random/mtk-rng.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c
-index e649be5a5..496adb0a0 100644
+index 6670516fa..a8bd06da7 100644
--- a/drivers/char/hw_random/mtk-rng.c
+++ b/drivers/char/hw_random/mtk-rng.c
@@ -22,7 +22,7 @@
@@ -33,7 +29,7 @@
}
static int mtk_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
-@@ -181,6 +181,7 @@ static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend,
+@@ -186,6 +186,7 @@ static const struct dev_pm_ops mtk_rng_pm_ops = {
#endif /* CONFIG_PM */
static const struct of_device_id mtk_rng_match[] = {
@@ -42,5 +38,5 @@
{},
};
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1661-Add-trngv2-driver-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2101-Add-trngv2-driver-support.patch
similarity index 95%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1661-Add-trngv2-driver-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2101-Add-trngv2-driver-support.patch
index 7c09a71..2169d20 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1661-Add-trngv2-driver-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2101-Add-trngv2-driver-support.patch
@@ -1,7 +1,7 @@
-From ae5611b1b7a857edb3d9c8e900b550c76f7c236e Mon Sep 17 00:00:00 2001
-From: "Mingming.Su" <Mingming.Su@mediatek.com>
-Date: Fri, 17 Dec 2021 20:27:34 +0800
-Subject: [PATCH] Add trngv2 driver support
+From cff177b10455d17fec2c2a412a4f5491af3be315 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:05 +0800
+Subject: [PATCH] [slow-speed-io][999-2101-Add-trngv2-driver-support.patch]
---
drivers/char/hw_random/mtk-rng.c | 105 +++++++++++++++++++++++--------
@@ -181,5 +181,5 @@
};
MODULE_DEVICE_TABLE(of, mtk_rng_match);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1662-trng-Add-trng-support-for-mt7988.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2102-trng-Add-trng-support-for-mt7988.patch
similarity index 77%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1662-trng-Add-trng-support-for-mt7988.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2102-trng-Add-trng-support-for-mt7988.patch
index a8f1dfe..80d3df8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1662-trng-Add-trng-support-for-mt7988.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2102-trng-Add-trng-support-for-mt7988.patch
@@ -1,11 +1,9 @@
-From cbd37bfc8221c1a81d235ddfb1898536a821c650 Mon Sep 17 00:00:00 2001
-From: "mingming.su" <Mingming.Su@mediatek.com>
-Date: Wed, 7 Sep 2022 15:44:46 +0800
-Subject: [PATCH] trng: Add trng support for mt7988
+From a63382c6164e5c856057a394f53c91cb0d79222f Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:05 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2102-trng-Add-trng-support-for-mt7988.patch]
-Add trng support for mt7988.
-
-Signed-off-by: mingming.su <Mingming.Su@mediatek.com>
---
drivers/char/hw_random/mtk-rng.c | 5 +++++
1 file changed, 5 insertions(+)
@@ -34,5 +32,5 @@
{},
};
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9019-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2103-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch
similarity index 74%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9019-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2103-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch
index 5635f55..47ac32a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9019-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2103-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch
@@ -1,19 +1,20 @@
-From 6110010f7b88392a3094f2aaec91ee54151cde2a Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:43:02 +0800
-Subject: [PATCH] drivers: char: tpm: Add calibration example for SPI TPM
- module
+From daaf90f34aa73625585f56d766e51c7b718bebc3 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:05 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2103-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
drivers/char/tpm/tpm_tis_core.c | 19 +++++++++++++++++++
drivers/char/tpm/tpm_tis_core.h | 2 ++
drivers/char/tpm/tpm_tis_spi.c | 7 +++++++
3 files changed, 28 insertions(+)
+diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
+index 70f785994..b9898a56d 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
-@@ -817,6 +817,21 @@ static const struct tpm_class_ops tpm_ti
+@@ -817,6 +817,21 @@ static const struct tpm_class_ops tpm_tis = {
.clk_enable = tpm_tis_clkrun_enable,
};
@@ -35,7 +36,7 @@
int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
const struct tpm_tis_phy_ops *phy_ops,
acpi_handle acpi_dev_handle)
-@@ -864,6 +879,10 @@ int tpm_tis_core_init(struct device *dev
+@@ -864,6 +879,10 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
if (chip->ops->clk_enable != NULL)
chip->ops->clk_enable(chip, true);
@@ -46,6 +47,8 @@
if (wait_startup(chip, 0) != 0) {
rc = -ENODEV;
goto out_err;
+diff --git a/drivers/char/tpm/tpm_tis_core.h b/drivers/char/tpm/tpm_tis_core.h
+index 7337819f5..7bb0bc8b6 100644
--- a/drivers/char/tpm/tpm_tis_core.h
+++ b/drivers/char/tpm/tpm_tis_core.h
@@ -106,6 +106,7 @@ struct tpm_tis_phy_ops {
@@ -64,9 +67,11 @@
int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
const struct tpm_tis_phy_ops *phy_ops,
acpi_handle acpi_dev_handle);
+diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c
+index 19513e622..3be2d53a5 100644
--- a/drivers/char/tpm/tpm_tis_spi.c
+++ b/drivers/char/tpm/tpm_tis_spi.c
-@@ -184,12 +184,19 @@ static int tpm_tis_spi_write32(struct tp
+@@ -184,12 +184,19 @@ static int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value)
return rc;
}
@@ -86,3 +91,6 @@
};
static int tpm_tis_spi_probe(struct spi_device *dev)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0900-i2c-busses-add-mt7986-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2110-i2c-busses-add-mt7986-support.patch
similarity index 75%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0900-i2c-busses-add-mt7986-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2110-i2c-busses-add-mt7986-support.patch
index a375842..e97ff9b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0900-i2c-busses-add-mt7986-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2110-i2c-busses-add-mt7986-support.patch
@@ -1,11 +1,20 @@
+From 64902a41254881d559a2f1e4d2966f16e4a7f98a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:06 +0800
+Subject: [PATCH] [slow-speed-io][999-2110-i2c-busses-add-mt7986-support.patch]
+
+---
+ drivers/i2c/busses/i2c-mt65xx.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
-index e1ef012..4fd4721 100644
+index 5587e7c54..14d96c876 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -289,6 +289,19 @@ static const struct mtk_i2c_compatible mt7622_compat = {
.ltiming_adjust = 0,
};
-
+
+static const struct mtk_i2c_compatible mt7986_compat = {
+ .quirks = &mt7622_i2c_quirks,
+ .regs = mt_i2c_regs_v1,
@@ -30,3 +39,6 @@
{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
{ .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat },
{}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0901-i2c-busses-add-mt7981-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2111-i2c-busses-add-mt7981-support.patch
similarity index 79%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0901-i2c-busses-add-mt7981-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2111-i2c-busses-add-mt7981-support.patch
index f79d2f8..ba37f4a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0901-i2c-busses-add-mt7981-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2111-i2c-busses-add-mt7981-support.patch
@@ -1,5 +1,14 @@
+From c4ad4b0aa7fb10beb510b99caba9cd027a88a723 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:06 +0800
+Subject: [PATCH] [slow-speed-io][999-2111-i2c-busses-add-mt7981-support.patch]
+
+---
+ drivers/i2c/busses/i2c-mt65xx.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
-index e1ef012..4fd4721 100644
+index 14d96c876..995e8bbaf 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -157,7 +157,7 @@ static const u16 mt_i2c_regs_v1[] = {
@@ -39,5 +48,5 @@
{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
{ .compatible = "mediatek,mt8183-i2c", .data = &mt8183_compat },
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/500-auxadc-add-auxadc-32k-clk.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2120-auxadc-add-auxadc-32k-clk.patch
similarity index 73%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/500-auxadc-add-auxadc-32k-clk.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2120-auxadc-add-auxadc-32k-clk.patch
index dc0dd2f..2125916 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/500-auxadc-add-auxadc-32k-clk.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2120-auxadc-add-auxadc-32k-clk.patch
@@ -1,5 +1,14 @@
+From ab1b6a5a856d2ade01ce7f677dc8943ffc476c35 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:06 +0800
+Subject: [PATCH] [slow-speed-io][999-2120-auxadc-add-auxadc-32k-clk.patch]
+
+---
+ drivers/iio/adc/mt6577_auxadc.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c
-index 2449d91..b8a43eb 100644
+index 9cdb9084c..34f94554f 100644
--- a/drivers/iio/adc/mt6577_auxadc.c
+++ b/drivers/iio/adc/mt6577_auxadc.c
@@ -42,6 +42,7 @@ struct mtk_auxadc_compatible {
@@ -10,7 +19,7 @@
struct mutex lock;
const struct mtk_auxadc_compatible *dev_comp;
};
-@@ -214,6 +215,12 @@ static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
+@@ -222,6 +223,12 @@ static int __maybe_unused mt6577_auxadc_resume(struct device *dev)
return ret;
}
@@ -23,7 +32,7 @@
mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
MT6577_AUXADC_PDN_EN, 0);
mdelay(MT6577_AUXADC_POWER_READY_MS);
-@@ -228,6 +235,8 @@ static int __maybe_unused mt6577_auxadc_suspend(struct device *dev)
+@@ -236,6 +243,8 @@ static int __maybe_unused mt6577_auxadc_suspend(struct device *dev)
mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
0, MT6577_AUXADC_PDN_EN);
@@ -32,7 +41,7 @@
clk_disable_unprepare(adc_dev->adc_clk);
return 0;
-@@ -272,6 +281,17 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
+@@ -280,6 +289,17 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
return ret;
}
@@ -50,7 +59,7 @@
adc_clk_rate = clk_get_rate(adc_dev->adc_clk);
if (!adc_clk_rate) {
ret = -EINVAL;
-@@ -301,6 +321,7 @@ static int mt6577_auxadc_probe(struct platform_device *pdev)
+@@ -309,6 +329,7 @@ err_power_off:
mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
0, MT6577_AUXADC_PDN_EN);
err_disable_clk:
@@ -58,7 +67,7 @@
clk_disable_unprepare(adc_dev->adc_clk);
return ret;
}
-@@ -315,6 +336,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
+@@ -323,6 +344,7 @@ static int mt6577_auxadc_remove(struct platform_device *pdev)
mt6577_auxadc_mod_reg(adc_dev->reg_base + MT6577_AUXADC_MISC,
0, MT6577_AUXADC_PDN_EN);
@@ -66,3 +75,6 @@
clk_disable_unprepare(adc_dev->adc_clk);
return 0;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0930-pwm-add-mt7986-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2130-pwm-add-mt7986-support.patch
similarity index 72%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0930-pwm-add-mt7986-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2130-pwm-add-mt7986-support.patch
index a791d3a..dac5409 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0930-pwm-add-mt7986-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2130-pwm-add-mt7986-support.patch
@@ -1,11 +1,20 @@
+From dcce03b49e8bac8a2c371c24dbcc9a6922861b8a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:07 +0800
+Subject: [PATCH] [slow-speed-io][999-2130-pwm-add-mt7986-support.patch]
+
+---
+ drivers/pwm/pwm-mediatek.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
-index b94e0d0..35a0db2 100644
+index b94e0d09c..35a0db2ff 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -302,6 +302,11 @@ static const struct pwm_mediatek_of_data mt7629_pwm_data = {
.pwm45_fixup = false,
};
-
+
+static const struct pwm_mediatek_of_data mt7986_pwm_data = {
+ .num_pwms = 2,
+ .pwm45_fixup = false,
@@ -22,3 +31,6 @@
{ .compatible = "mediatek,mt8516-pwm", .data = &mt8516_pwm_data },
{ },
};
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0931-pwm-add-mt7981-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2131-pwm-add-mt7981-support.patch
similarity index 83%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0931-pwm-add-mt7981-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2131-pwm-add-mt7981-support.patch
index 0de7966..e137dc4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0931-pwm-add-mt7981-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2131-pwm-add-mt7981-support.patch
@@ -1,8 +1,17 @@
+From c6dc9128df3673041cade417331ad2579e669520 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:07 +0800
+Subject: [PATCH] [slow-speed-io][999-2131-pwm-add-mt7981-support.patch]
+
+---
+ drivers/pwm/pwm-mediatek.c | 51 +++++++++++++++++++++++++++++++++++---
+ 1 file changed, 48 insertions(+), 3 deletions(-)
+
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
-index 7c56ee2..3a5a456 100644
+index 35a0db2ff..f4393bd46 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
-@@ -33,10 +32,13 @@
+@@ -32,10 +32,13 @@
#define PWM45THRES_FIXUP 0x34
#define PWM_CLK_DIV_MAX 7
@@ -16,7 +25,7 @@
};
/**
-@@ -57,10 +59,14 @@ struct pwm_mediatek_chip {
+@@ -56,10 +59,14 @@ struct pwm_mediatek_chip {
const struct pwm_mediatek_of_data *soc;
};
@@ -32,7 +41,7 @@
static inline struct pwm_mediatek_chip *
to_pwm_mediatek_chip(struct pwm_chip *chip)
{
-@@ -108,14 +114,38 @@ static void pwm_mediatek_clk_disable(struct pwm_chip *chip,
+@@ -107,14 +114,38 @@ static void pwm_mediatek_clk_disable(struct pwm_chip *chip,
static inline u32 pwm_mediatek_readl(struct pwm_mediatek_chip *chip,
unsigned int num, unsigned int offset)
{
@@ -73,7 +82,7 @@
}
static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
-@@ -281,36 +311,49 @@ static int pwm_mediatek_remove(struct platform_device *pdev)
+@@ -280,36 +311,49 @@ static int pwm_mediatek_remove(struct platform_device *pdev)
static const struct pwm_mediatek_of_data mt2712_pwm_data = {
.num_pwms = 8,
.pwm45_fixup = false,
@@ -123,7 +132,7 @@
};
static const struct of_device_id pwm_mediatek_of_match[] = {
-@@ -319,6 +362,7 @@ static const struct of_device_id pwm_mediatek_of_match[] = {
+@@ -318,6 +362,7 @@ static const struct of_device_id pwm_mediatek_of_match[] = {
{ .compatible = "mediatek,mt7623-pwm", .data = &mt7623_pwm_data },
{ .compatible = "mediatek,mt7628-pwm", .data = &mt7628_pwm_data },
{ .compatible = "mediatek,mt7629-pwm", .data = &mt7629_pwm_data },
@@ -131,3 +140,6 @@
{ .compatible = "mediatek,mt7986-pwm", .data = &mt7986_pwm_data },
{ .compatible = "mediatek,mt8516-pwm", .data = &mt8516_pwm_data },
{ },
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0932-add-pwm-feature-in-mt7988-project.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2132-add-pwm-feature-in-mt7988-project.patch
similarity index 70%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0932-add-pwm-feature-in-mt7988-project.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2132-add-pwm-feature-in-mt7988-project.patch
index 8268e7d..afa7720 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0932-add-pwm-feature-in-mt7988-project.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2132-add-pwm-feature-in-mt7988-project.patch
@@ -1,9 +1,19 @@
+From 1ad5b06d70ce07cd377d6a9580b922b1fa68e674 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:07 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2132-add-pwm-feature-in-mt7988-project.patch]
+
+---
+ drivers/pwm/pwm-mediatek.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
-index 3a5a456..6d6206e 100644
+index f4393bd46..9701092e7 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -350,6 +350,12 @@ static const struct pwm_mediatek_of_data mt7986_pwm_data = {
- .reg_ver = REG_V2,
+ .reg_ver = REG_V1,
};
+static const struct pwm_mediatek_of_data mt7988_pwm_data = {
@@ -23,3 +33,6 @@
{ .compatible = "mediatek,mt8516-pwm", .data = &mt8516_pwm_data },
{ },
};
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-pwm-mediatek-add-longer-period-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2133-pwm-mediatek-add-longer-period-support.patch
similarity index 85%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-pwm-mediatek-add-longer-period-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2133-pwm-mediatek-add-longer-period-support.patch
index 0934ae2..79afa46 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-pwm-mediatek-add-longer-period-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2133-pwm-mediatek-add-longer-period-support.patch
@@ -1,5 +1,15 @@
+From 58d5a373d2d42b5292c1c2242133bcf0b082c6e0 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:07 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2133-pwm-mediatek-add-longer-period-support.patch]
+
+---
+ drivers/pwm/pwm-mediatek.c | 34 ++++++++++++++++++++++++++++++----
+ 1 file changed, 30 insertions(+), 4 deletions(-)
+
diff --git a/drivers/pwm/pwm-mediatek.c b/drivers/pwm/pwm-mediatek.c
-index 9701092..79d15a9 100644
+index 9701092e7..79d15a9c0 100644
--- a/drivers/pwm/pwm-mediatek.c
+++ b/drivers/pwm/pwm-mediatek.c
@@ -152,8 +152,11 @@ static int pwm_mediatek_config(struct pwm_chip *chip, struct pwm_device *pwm,
@@ -63,3 +73,6 @@
pwm_mediatek_writel(pc, pwm->hwpwm, reg_width, cnt_period);
pwm_mediatek_writel(pc, pwm->hwpwm, reg_thres, cnt_duty);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/6001-mtk-thermal-add-lvts-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2140-mtk-thermal-add-lvts-support.patch
similarity index 71%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/6001-mtk-thermal-add-lvts-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2140-mtk-thermal-add-lvts-support.patch
index 1591144..a9ca6d7 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/6001-mtk-thermal-add-lvts-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2140-mtk-thermal-add-lvts-support.patch
@@ -1,5 +1,15 @@
+From 23c38736374866e0f1423dde94ac6e80eb644132 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:08 +0800
+Subject: [PATCH] [slow-speed-io][999-2140-mtk-thermal-add-lvts-support.patch]
+
+---
+ drivers/thermal/Kconfig | 5 +++++
+ drivers/thermal/Makefile | 1 +
+ 2 files changed, 6 insertions(+)
+
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
-index 001a21ab..67d3da48 100644
+index 001a21abc..67d3da488 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -348,6 +348,11 @@ config MTK_THERMAL
@@ -15,7 +25,7 @@
depends on X86 || X86_INTEL_QUARK || COMPILE_TEST
source "drivers/thermal/intel/Kconfig"
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
-index 74a37c7f..6be9ff19 100644
+index 74a37c7f8..6be9ff194 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -51,6 +51,7 @@ obj-$(CONFIG_QCOM_TSENS) += qcom/
@@ -26,3 +36,6 @@
obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
obj-$(CONFIG_ZX2967_THERMAL) += zx2967_thermal.o
obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0400-sound-add-some-helpers-to-control-mtk_memif.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2150-sound-add-some-helpers-to-control-mtk_memif.patch
similarity index 87%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0400-sound-add-some-helpers-to-control-mtk_memif.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2150-sound-add-some-helpers-to-control-mtk_memif.patch
index ddeb5a4..85c5ceb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0400-sound-add-some-helpers-to-control-mtk_memif.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2150-sound-add-some-helpers-to-control-mtk_memif.patch
@@ -1,6 +1,20 @@
+From 21c1013ecce400652b42489935190df542c9fa4b Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:08 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2150-sound-add-some-helpers-to-control-mtk_memif.patch]
+
+---
+ sound/soc/mediatek/common/mtk-afe-fe-dai.c | 216 +++++++++++++++++++++
+ sound/soc/mediatek/common/mtk-afe-fe-dai.h | 16 ++
+ sound/soc/mediatek/common/mtk-base-afe.h | 28 ++-
+ 3 files changed, 259 insertions(+), 1 deletion(-)
+
+diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+index 10ea4fdbe..309dc1ef6 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
-@@ -361,6 +361,222 @@
+@@ -361,6 +361,222 @@ int mtk_afe_dai_resume(struct snd_soc_dai *dai)
}
EXPORT_SYMBOL_GPL(mtk_afe_dai_resume);
@@ -223,9 +237,11 @@
MODULE_DESCRIPTION("Mediatek simple fe dai operator");
MODULE_AUTHOR("Garlic Tseng <garlic.tseng@mediatek.com>");
MODULE_LICENSE("GPL v2");
+diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.h b/sound/soc/mediatek/common/mtk-afe-fe-dai.h
+index 55074fb98..507e3e7c3 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.h
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.h
-@@ -34,4 +34,20 @@
+@@ -34,4 +34,20 @@ int mtk_dynamic_irq_release(struct mtk_base_afe *afe, int irq_id);
int mtk_afe_dai_suspend(struct snd_soc_dai *dai);
int mtk_afe_dai_resume(struct snd_soc_dai *dai);
@@ -246,9 +262,11 @@
+int mtk_memif_set_pbuf_size(struct mtk_base_afe *afe,
+ int id, int pbuf_size);
#endif
+diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h
+index 60cb609a9..a8cf44d98 100644
--- a/sound/soc/mediatek/common/mtk-base-afe.h
+++ b/sound/soc/mediatek/common/mtk-base-afe.h
-@@ -16,21 +16,38 @@
+@@ -16,21 +16,38 @@ struct mtk_base_memif_data {
const char *name;
int reg_ofs_base;
int reg_ofs_cur;
@@ -288,7 +306,7 @@
};
struct mtk_base_irq_data {
-@@ -84,6 +101,12 @@
+@@ -84,6 +101,12 @@ struct mtk_base_afe {
unsigned int rate);
int (*irq_fs)(struct snd_pcm_substream *substream,
unsigned int rate);
@@ -301,7 +319,7 @@
void *platform_priv;
};
-@@ -95,6 +118,9 @@
+@@ -95,6 +118,9 @@ struct mtk_base_afe_memif {
const struct mtk_base_memif_data *data;
int irq_usage;
int const_irq;
@@ -311,3 +329,6 @@
};
struct mtk_base_afe_irq {
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0401-sound-refine-hw-params-and-hw-prepare.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2151-sound-refine-hw-params-and-hw-prepare.patch
similarity index 87%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0401-sound-refine-hw-params-and-hw-prepare.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2151-sound-refine-hw-params-and-hw-prepare.patch
index 3e24d51..f097f4a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0401-sound-refine-hw-params-and-hw-prepare.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2151-sound-refine-hw-params-and-hw-prepare.patch
@@ -1,3 +1,15 @@
+From 35cc92b8996980021f881a202b8e1233ca41eb0d Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:08 +0800
+Subject: [PATCH]
+ [slow-speed-io][999-2151-sound-refine-hw-params-and-hw-prepare.patch]
+
+---
+ sound/soc/mediatek/common/mtk-afe-fe-dai.c | 143 +++++++++++----------
+ 1 file changed, 77 insertions(+), 66 deletions(-)
+
+diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+index 309dc1ef6..e761cb66b 100644
--- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c
+++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c
@@ -6,11 +6,13 @@
@@ -14,7 +26,7 @@
#include "mtk-afe-fe-dai.h"
#include "mtk-base-afe.h"
-@@ -120,50 +122,64 @@
+@@ -120,50 +122,64 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
@@ -49,10 +61,7 @@
- 1, msb_at_bit33, memif->data->msb_shift);
+ if (afe->request_dram_resource)
+ afe->request_dram_resource(afe->dev);
-
-- /* set channel */
-- if (memif->data->mono_shift >= 0) {
-- unsigned int mono = (params_channels(params) == 1) ? 1 : 0;
++
+ dev_dbg(afe->dev, "%s(), %s, ch %d, rate %d, fmt %d, dma_addr %pad, dma_area %p, dma_bytes 0x%zx\n",
+ __func__, memif->data->name,
+ channels, rate, format,
@@ -74,9 +83,12 @@
+ return ret;
+ }
+ /* set channel */
+- if (memif->data->mono_shift >= 0) {
+- unsigned int mono = (params_channels(params) == 1) ? 1 : 0;
+-
- mtk_regmap_update_bits(afe->regmap, memif->data->mono_reg,
- 1, mono, memif->data->mono_shift);
-+ /* set channel */
+ ret = mtk_memif_set_channel(afe, id, channels);
+ if (ret) {
+ dev_err(afe->dev, "%s(), error, id %d, set channel %d, ret %d\n",
@@ -112,7 +124,7 @@
return 0;
}
-@@ -172,6 +188,11 @@
+@@ -172,6 +188,11 @@ EXPORT_SYMBOL_GPL(mtk_afe_fe_hw_params);
int mtk_afe_fe_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
@@ -124,7 +136,7 @@
return snd_pcm_lib_free_pages(substream);
}
EXPORT_SYMBOL_GPL(mtk_afe_fe_hw_free);
-@@ -182,20 +203,25 @@
+@@ -182,20 +203,25 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime * const runtime = substream->runtime;
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
@@ -154,7 +166,7 @@
/* set irq counter */
mtk_regmap_update_bits(afe->regmap, irq_data->irq_cnt_reg,
-@@ -219,15 +245,19 @@
+@@ -219,15 +245,19 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
return 0;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -177,7 +189,7 @@
default:
return -EINVAL;
}
-@@ -239,34 +269,15 @@
+@@ -239,34 +269,15 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
@@ -219,3 +231,6 @@
return 0;
}
EXPORT_SYMBOL_GPL(mtk_afe_fe_prepare);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0402-sound-add-mt7986-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2152-sound-add-mt7986-driver.patch
similarity index 70%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0402-sound-add-mt7986-driver.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2152-sound-add-mt7986-driver.patch
index 973f565..41eb05e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0402-sound-add-mt7986-driver.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2152-sound-add-mt7986-driver.patch
@@ -1,6 +1,18 @@
+From 593cfdef7ef160c49db5c7ae315cb963f32a947a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:08 +0800
+Subject: [PATCH] [slow-speed-io][999-2152-sound-add-mt7986-driver.patch]
+
+---
+ sound/soc/mediatek/Kconfig | 30 ++++++++++++++++++++++++++++++
+ sound/soc/mediatek/Makefile | 1 +
+ 2 files changed, 31 insertions(+)
+
+diff --git a/sound/soc/mediatek/Kconfig b/sound/soc/mediatek/Kconfig
+index 111e44b64..25e392428 100644
--- a/sound/soc/mediatek/Kconfig
+++ b/sound/soc/mediatek/Kconfig
-@@ -53,6 +53,36 @@
+@@ -53,6 +53,36 @@ config SND_SOC_MT6797_MT6351
Select Y if you have such device.
If unsure select "N".
@@ -37,6 +49,8 @@
config SND_SOC_MT8173
tristate "ASoC support for Mediatek MT8173 chip"
depends on ARCH_MEDIATEK
+diff --git a/sound/soc/mediatek/Makefile b/sound/soc/mediatek/Makefile
+index 76032cae6..9690326b2 100644
--- a/sound/soc/mediatek/Makefile
+++ b/sound/soc/mediatek/Makefile
@@ -2,5 +2,6 @@
@@ -46,3 +60,6 @@
+obj-$(CONFIG_SND_SOC_MT79XX) += mt79xx/
obj-$(CONFIG_SND_SOC_MT8173) += mt8173/
obj-$(CONFIG_SND_SOC_MT8183) += mt8183/
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0801-mtk-sd-add-mt7986-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2300-mtk-sd-add-mt7986-support.patch
similarity index 60%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0801-mtk-sd-add-mt7986-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2300-mtk-sd-add-mt7986-support.patch
index 6b76993..5a36ab0 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0801-mtk-sd-add-mt7986-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2300-mtk-sd-add-mt7986-support.patch
@@ -1,6 +1,17 @@
+From b4ad228b3e415f980932a2200d93b56f135e6bc8 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:09 +0800
+Subject: [PATCH] [spi-and-storage][999-2300-mtk-sd-add-mt7986-support.patch]
+
+---
+ drivers/mmc/host/mtk-sd.c | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
+index 1254a5650..b25e8567f 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
-@@ -508,6 +508,18 @@ static const struct mtk_mmc_compatible m
+@@ -508,6 +508,18 @@ static const struct mtk_mmc_compatible mt7622_compat = {
.support_64g = false,
};
@@ -19,7 +30,7 @@
static const struct mtk_mmc_compatible mt8516_compat = {
.clk_div_bits = 12,
.hs400_tune = false,
-@@ -537,6 +549,7 @@ static const struct of_device_id msdc_of
+@@ -537,6 +549,7 @@ static const struct of_device_id msdc_of_ids[] = {
{ .compatible = "mediatek,mt2701-mmc", .data = &mt2701_compat},
{ .compatible = "mediatek,mt2712-mmc", .data = &mt2712_compat},
{ .compatible = "mediatek,mt7622-mmc", .data = &mt7622_compat},
@@ -27,3 +38,6 @@
{ .compatible = "mediatek,mt8516-mmc", .data = &mt8516_compat},
{ .compatible = "mediatek,mt7620-mmc", .data = &mt7620_compat},
{}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0802-mtk-sd-Add-subsys-clock-control.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2301-mtk-sd-Add-subsys-clock-control.patch
similarity index 81%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0802-mtk-sd-Add-subsys-clock-control.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2301-mtk-sd-Add-subsys-clock-control.patch
index 8732cef..9ac8a25 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0802-mtk-sd-Add-subsys-clock-control.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2301-mtk-sd-Add-subsys-clock-control.patch
@@ -1,3 +1,15 @@
+From 80d83b8abe9bc8878ba7a40b4e399b8ea2ff8ad2 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:09 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2301-mtk-sd-Add-subsys-clock-control.patch]
+
+---
+ drivers/mmc/host/mtk-sd.c | 76 +++++++++++++++++++++++++++++----------
+ 1 file changed, 58 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
+index b25e8567f..ef344a4bd 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -33,6 +33,7 @@
@@ -17,7 +29,7 @@
u32 mclk; /* mmc subsystem clock frequency */
u32 src_clk_freq; /* source clock frequency */
unsigned char timing;
-@@ -745,6 +748,7 @@ static void msdc_set_timeout(struct msdc
+@@ -745,6 +748,7 @@ static void msdc_set_timeout(struct msdc_host *host, u32 ns, u32 clks)
static void msdc_gate_clock(struct msdc_host *host)
{
@@ -25,7 +37,7 @@
clk_disable_unprepare(host->src_clk_cg);
clk_disable_unprepare(host->src_clk);
clk_disable_unprepare(host->bus_clk);
-@@ -753,10 +757,18 @@ static void msdc_gate_clock(struct msdc_
+@@ -753,10 +757,18 @@ static void msdc_gate_clock(struct msdc_host *host)
static void msdc_ungate_clock(struct msdc_host *host)
{
@@ -44,7 +56,7 @@
while (!(readl(host->base + MSDC_CFG) & MSDC_CFG_CKSTB))
cpu_relax();
}
-@@ -2195,6 +2207,50 @@ static void msdc_of_property_parse(struc
+@@ -2195,6 +2207,50 @@ static void msdc_of_property_parse(struct platform_device *pdev,
host->hs400_cmd_resp_sel_rising = false;
}
@@ -95,7 +107,7 @@
static int msdc_drv_probe(struct platform_device *pdev)
{
struct mmc_host *mmc;
-@@ -2235,25 +2291,9 @@ static int msdc_drv_probe(struct platfor
+@@ -2235,25 +2291,9 @@ static int msdc_drv_probe(struct platform_device *pdev)
if (ret)
goto host_free;
@@ -123,3 +135,6 @@
host->reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
"hrst");
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0490-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2330-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch
similarity index 86%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0490-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2330-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch
index 6d2a4b8..42467b6 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0490-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2330-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch
@@ -1,3 +1,15 @@
+From 2c71a01b9363f44ca077ec0e27b6a06a15617497 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:14 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2330-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch]
+
+---
+ drivers/mtd/nand/spi/winbond.c | 129 ++++++++++++++++++++++++++++++++-
+ 1 file changed, 127 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
+index 766844283..6473b0367 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -15,6 +15,23 @@
@@ -24,7 +36,7 @@
static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
-@@ -31,6 +48,29 @@ static SPINAND_OP_VARIANTS(update_cache_
+@@ -31,6 +48,29 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0));
@@ -54,7 +66,7 @@
static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
-@@ -74,9 +114,61 @@ static int w25m02gv_select_target(struct
+@@ -74,9 +114,61 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
return spi_mem_exec_op(spinand->spimem, &op);
}
@@ -117,7 +129,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 2),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -85,8 +177,18 @@ static const struct spinand_info winbond
+@@ -85,8 +177,18 @@ static const struct spinand_info winbond_spinand_table[] = {
0,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
SPINAND_SELECT_TARGET(w25m02gv_select_target)),
@@ -137,7 +149,7 @@
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-@@ -94,6 +196,29 @@ static const struct spinand_info winbond
+@@ -94,6 +196,29 @@ static const struct spinand_info winbond_spinand_table[] = {
&update_cache_variants),
0,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
@@ -167,3 +179,6 @@
};
static int winbond_spinand_init(struct spinand_device *spinand)
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2331-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2331-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch
new file mode 100644
index 0000000..b19492b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2331-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch
@@ -0,0 +1,26 @@
+From 6d8d4dc76ac31cfdecef99c72aad6a65f963d4a0 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:14 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2331-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch]
+
+---
+ drivers/mtd/nand/spi/macronix.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
+index 25319b4f8..d3ae24ecc 100644
+--- a/drivers/mtd/nand/spi/macronix.c
++++ b/drivers/mtd/nand/spi/macronix.c
+@@ -86,7 +86,7 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
+ if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
+ return nand->eccreq.strength;
+
+- if (WARN_ON(eccsr > nand->eccreq.strength || !eccsr))
++ if (eccsr > nand->eccreq.strength || !eccsr)
+ return nand->eccreq.strength;
+
+ return eccsr;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2332-mtd-add-mtk-snand-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2332-mtd-add-mtk-snand-driver.patch
new file mode 100644
index 0000000..a020a2f
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2332-mtd-add-mtk-snand-driver.patch
@@ -0,0 +1,38 @@
+From 6fa8802185f08391dd3eb6e0609268e1108a7f57 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:15 +0800
+Subject: [PATCH] [spi-and-storage][999-2332-mtd-add-mtk-snand-driver.patch]
+
+---
+ drivers/mtd/Kconfig | 2 ++
+ drivers/mtd/Makefile | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
+index 3ed42b402..4b6f9d851 100644
+--- a/drivers/mtd/Kconfig
++++ b/drivers/mtd/Kconfig
+@@ -230,6 +230,8 @@ source "drivers/mtd/hyperbus/Kconfig"
+
+ source "drivers/mtd/nmbm/Kconfig"
+
++source "drivers/mtd/mtk-snand/Kconfig"
++
+ source "drivers/mtd/composite/Kconfig"
+
+ endif # MTD
+diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
+index f27f66784..df786f994 100644
+--- a/drivers/mtd/Makefile
++++ b/drivers/mtd/Makefile
+@@ -35,5 +35,7 @@ obj-$(CONFIG_MTD_HYPERBUS) += hyperbus/
+
+ obj-y += nmbm/
+
++obj-$(CONFIG_MTK_SPI_NAND) += mtk-snand/
++
+ # Composite drivers must be loaded last
+ obj-y += composite/
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2333-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
similarity index 70%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2333-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
index 32bce58..d37dd56 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2333-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
@@ -1,6 +1,18 @@
+From 39ee4e9fb5fd3ce678223147df9d9bef0ce822cd Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:15 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2333-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch]
+
+---
+ drivers/mtd/nand/spi/gigadevice.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
+index 937a04ce6..ce88f0c91 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -39,6 +39,15 @@ static SPINAND_OP_VARIANTS(read_cache_va
+@@ -39,6 +39,15 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f,
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
@@ -16,7 +28,7 @@
static SPINAND_OP_VARIANTS(write_cache_variants,
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
SPINAND_PROG_LOAD(true, 0, NULL, 0));
-@@ -265,6 +274,16 @@ static int gd5fxgq4ufxxg_ecc_get_status(
+@@ -236,6 +245,16 @@ static int gd5fxgq4ufxxg_ecc_get_status(struct spinand_device *spinand,
}
static const struct spinand_info gigadevice_spinand_table[] = {
@@ -33,7 +45,7 @@
SPINAND_INFO("GD5F1GQ4xA",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf1),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
-@@ -337,7 +356,7 @@ static const struct spinand_info gigadev
+@@ -290,7 +309,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(4, 512),
@@ -42,3 +54,6 @@
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2334-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
similarity index 86%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2334-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
index 83e4c71..c609bd7 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2334-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
@@ -1,6 +1,18 @@
+From b8ffe42101eb8abfb6530396e0c74a85b43eed44 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:15 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2334-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch]
+
+---
+ drivers/mtd/nand/spi/gigadevice.c | 98 +++++++++++++++++++++++++++++--
+ 1 file changed, 94 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
+index ce88f0c91..a4e89529d 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -39,8 +39,9 @@ static SPINAND_OP_VARIANTS(read_cache_va
+@@ -39,8 +39,9 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f,
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
@@ -12,7 +24,7 @@
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
-@@ -48,6 +49,15 @@ static SPINAND_OP_VARIANTS(gd5f1gq5_read
+@@ -48,6 +49,15 @@ static SPINAND_OP_VARIANTS(gd5f1gq5_read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
@@ -28,7 +40,7 @@
static SPINAND_OP_VARIANTS(write_cache_variants,
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
SPINAND_PROG_LOAD(true, 0, NULL, 0));
-@@ -249,7 +259,7 @@ static const struct spinand_info gigadev
+@@ -249,7 +259,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
@@ -37,7 +49,7 @@
&write_cache_variants,
&update_cache_variants),
0,
-@@ -309,7 +319,87 @@ static const struct spinand_info gigadev
+@@ -309,7 +319,87 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(4, 512),
@@ -126,3 +138,6 @@
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/414-mtd-spinand-fix-gigadevice-read-dummy.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2335-mtd-spinand-fix-gigadevice-read-dummy.patch
similarity index 68%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/414-mtd-spinand-fix-gigadevice-read-dummy.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2335-mtd-spinand-fix-gigadevice-read-dummy.patch
index 5c5af56..977c65c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/414-mtd-spinand-fix-gigadevice-read-dummy.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2335-mtd-spinand-fix-gigadevice-read-dummy.patch
@@ -1,6 +1,18 @@
+From be41be0e740933fa976ad2990b94ef1e62542a8e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:15 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2335-mtd-spinand-fix-gigadevice-read-dummy.patch]
+
+---
+ drivers/mtd/nand/spi/gigadevice.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
+index a4e89529d..b163ea5dc 100644
--- a/drivers/mtd/nand/spi/gigadevice.c
+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -379,7 +379,7 @@ static const struct spinand_info gigadev
+@@ -379,7 +379,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x31),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(4, 512),
@@ -9,7 +21,7 @@
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
-@@ -389,17 +389,17 @@ static const struct spinand_info gigadev
+@@ -389,17 +389,17 @@ static const struct spinand_info gigadevice_spinand_table[] = {
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x32),
NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
NAND_ECCREQ(4, 512),
@@ -30,3 +42,6 @@
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2336-mtd-spinand-fix-F50L1G41LB-ecc-check.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2336-mtd-spinand-fix-F50L1G41LB-ecc-check.patch
new file mode 100644
index 0000000..644c6b3
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2336-mtd-spinand-fix-F50L1G41LB-ecc-check.patch
@@ -0,0 +1,27 @@
+From c93adec4ad0e8ca47f1a622fb3a5ae445251af36 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:16 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2336-mtd-spinand-fix-F50L1G41LB-ecc-check.patch]
+
+---
+ drivers/mtd/nand/spi/gigadevice.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c
+index b163ea5dc..6ee569de2 100644
+--- a/drivers/mtd/nand/spi/gigadevice.c
++++ b/drivers/mtd/nand/spi/gigadevice.c
+@@ -263,8 +263,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
+- gd5fxgq4xa_ecc_get_status)),
++ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout, NULL)),
+ SPINAND_INFO("GD5F1GQ4xA",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf1),
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2337-mtd-spinor-support-EN25QX128A.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2337-mtd-spinor-support-EN25QX128A.patch
new file mode 100644
index 0000000..239d246
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2337-mtd-spinor-support-EN25QX128A.patch
@@ -0,0 +1,27 @@
+From 6e915b8dd6ddb6f56ebf23123c26fb90fd5f5198 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:16 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2337-mtd-spinor-support-EN25QX128A.patch]
+
+---
+ drivers/mtd/spi-nor/spi-nor.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
+index 2599bbea8..8d2bc03cd 100644
+--- a/drivers/mtd/spi-nor/spi-nor.c
++++ b/drivers/mtd/spi-nor/spi-nor.c
+@@ -2249,6 +2249,9 @@ static const struct flash_info spi_nor_ids[] = {
+ { "en25qh64", INFO(0x1c7017, 0, 64 * 1024, 128,
+ SECT_4K | SPI_NOR_DUAL_READ) },
+ { "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) },
++ { "en25qx128", INFO(0x1c7118, 0, 64 * 1024, 256,
++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
++ SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
+ { "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
+ { "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, SECT_4K) },
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2338-mtd-tests-fix-pagetest-load.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2338-mtd-tests-fix-pagetest-load.patch
new file mode 100644
index 0000000..776d990
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2338-mtd-tests-fix-pagetest-load.patch
@@ -0,0 +1,56 @@
+From eaa6d1a21a8ea3c68498ef4ff0cf91d109e4d821 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:16 +0800
+Subject: [PATCH] [spi-and-storage][999-2338-mtd-tests-fix-pagetest-load.patch]
+
+---
+ drivers/mtd/tests/pagetest.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
+index 8eb40b6e6..d1c8a932e 100644
+--- a/drivers/mtd/tests/pagetest.c
++++ b/drivers/mtd/tests/pagetest.c
+@@ -25,6 +25,10 @@ static int dev = -EINVAL;
+ module_param(dev, int, S_IRUGO);
+ MODULE_PARM_DESC(dev, "MTD device number to use");
+
++static int count = 10000;
++module_param(count, int, 0444);
++MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)");
++
+ static struct mtd_info *mtd;
+ static unsigned char *twopages;
+ static unsigned char *writebuf;
+@@ -331,7 +335,7 @@ static int __init mtd_pagetest_init(void)
+ return -EINVAL;
+ }
+
+- pr_info("MTD device: %d\n", dev);
++ pr_info("MTD device: %d count:%d\n", dev, count);
+
+ mtd = get_mtd_device(NULL, dev);
+ if (IS_ERR(mtd)) {
+@@ -376,6 +380,7 @@ static int __init mtd_pagetest_init(void)
+ if (err)
+ goto out;
+
++LOOP:
+ /* Erase all eraseblocks */
+ pr_info("erasing whole device\n");
+ err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
+@@ -435,7 +440,10 @@ static int __init mtd_pagetest_init(void)
+ if (err)
+ goto out;
+
+- pr_info("finished with %d errors\n", errcnt);
++ pr_info("finished with %d errors count:%d\n", errcnt, count);
++
++ if (count-- > 0)
++ goto LOOP;
+ out:
+
+ kfree(bbt);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9017-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch
similarity index 87%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9017-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch
index 374531b..cf785fe 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9017-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch
@@ -1,9 +1,9 @@
-From 6bd88d34cb5a5cb1d7c544c9f5b430105b000308 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:39:56 +0800
-Subject: [PATCH] drivers: mtd: spinand: Add calibration support for spinand
+From ddd2951e2f35477a81fb882a976a5a1fe981883d Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:17 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
drivers/mtd/nand/spi/core.c | 58 +++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
@@ -85,5 +85,5 @@
if (ret)
goto err_free_bufs;
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9018-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch
similarity index 68%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9018-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch
index fd1bd1a..b6a4255 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9018-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch
@@ -1,16 +1,18 @@
-From b242e30661dac5c1c127999600029cd5b3f6b458 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:40:59 +0800
-Subject: [PATCH] drivers: mtd: spi-nor: Add calibration support for spi-nor
+From f392188951839efae7807b6287a62c78d1ed0088 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:17 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
- drivers/mtd/spi-nor/spi-nor.c | 17 +++++++++++++++++
- 1 file changed, 17 insertions(+)
+ drivers/mtd/spi-nor/spi-nor.c | 40 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
+index 8d2bc03cd..198b57a92 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
-@@ -4897,6 +4897,35 @@ static void spi_nor_debugfs_init(struct
+@@ -4899,6 +4899,35 @@ static void spi_nor_debugfs_init(struct spi_nor *nor,
info->id_len, info->id);
}
@@ -46,7 +48,7 @@
static const struct flash_info *spi_nor_get_flash_info(struct spi_nor *nor,
const char *name)
{
-@@ -4971,6 +5000,17 @@ int spi_nor_scan(struct spi_nor *nor, co
+@@ -4973,6 +5002,17 @@ int spi_nor_scan(struct spi_nor *nor, const char *name,
if (!nor->bouncebuf)
return -ENOMEM;
@@ -64,3 +66,6 @@
info = spi_nor_get_flash_info(nor, name);
if (IS_ERR(info))
return PTR_ERR(info);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8004-nvmem-core-Add-functions-to-make-number-reading-easy.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch
similarity index 69%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8004-nvmem-core-Add-functions-to-make-number-reading-easy.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch
index 969ec3f..a4147dd 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8004-nvmem-core-Add-functions-to-make-number-reading-easy.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch
@@ -1,65 +1,16 @@
-From 8dc0b1158dcffd78ea2b3a5604b82ee826de687b Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Mon, 8 Nov 2021 13:58:51 +0800
-Subject: [PATCH 1/5] nvmem: core: Add functions to make number reading easy
+From 21a99150a566b69edc7f3b9bc369bb4525e04acd Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:17 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch]
-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 <dianders@chromium.org>
-Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
-Link: https://lore.kernel.org/r/20210330111241.19401-7-srinivas.kandagatla@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Change-Id: I3e1d96ec1680812d5e24681c79852c9b36899559
---
drivers/nvmem/core.c | 161 +++++++++++++++++++++++++++------
include/linux/nvmem-consumer.h | 15 +++
2 files changed, 150 insertions(+), 26 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
-index c0f4324d8f7c..e26b25b5c288 100644
+index 19ac0d055..f65305b6d 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -1102,16 +1102,8 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len)
@@ -270,10 +221,10 @@
/**
* nvmem_device_cell_read() - Read a given nvmem device and cell
diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h
-index 5c17cb733224..e328c0f7eef3 100644
+index 0f490b288..227b93158 100644
--- a/include/linux/nvmem-consumer.h
+++ b/include/linux/nvmem-consumer.h
-@@ -63,6 +63,10 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len);
+@@ -64,6 +64,10 @@ void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len);
int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len);
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);
@@ -284,7 +235,7 @@
/* direct nvmem device read/write interface */
struct nvmem_device *nvmem_device_get(struct device *dev, const char *name);
-@@ -134,6 +138,17 @@ static inline int nvmem_cell_read_u32(struct device *dev,
+@@ -135,6 +139,17 @@ static inline int nvmem_cell_read_u32(struct device *dev,
{
return -EOPNOTSUPP;
}
@@ -303,5 +254,5 @@
static inline struct nvmem_device *nvmem_device_get(struct device *dev,
const char *name)
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8005-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch
similarity index 62%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8005-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch
index 8de4c2a..c042918 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8005-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch
@@ -1,21 +1,15 @@
-From 44ae4ed142265a6d50a9d3e6f4c395f97b6849ab Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Sat, 6 Nov 2021 20:06:30 +0800
-Subject: [PATCH 2/5] nvmem: mtk-efuse: support minimum one byte access stride
- and granularity
+From 6b7498e172d4458499a3ba406bf7975478f46d21 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:17 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch]
-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 <chunfeng.yun@mediatek.com>
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Change-Id: Iafe1ebf195d58a3e9e3518913f795d14a01dfd3b
---
drivers/nvmem/mtk-efuse.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/nvmem/mtk-efuse.c b/drivers/nvmem/mtk-efuse.c
-index 856d9c3fc38e..2e728fed0b49 100644
+index 856d9c3fc..2e728fed0 100644
--- a/drivers/nvmem/mtk-efuse.c
+++ b/drivers/nvmem/mtk-efuse.c
@@ -19,11 +19,12 @@ static int mtk_reg_read(void *context,
@@ -47,5 +41,5 @@
econfig.reg_write = mtk_reg_write;
econfig.size = resource_size(res);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-add-spimem-support-to-mtk-spi.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2361-add-spimem-support-to-mtk-spi.patch
similarity index 94%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-add-spimem-support-to-mtk-spi.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2361-add-spimem-support-to-mtk-spi.patch
index d50aa25..2d2aeaa 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0666-add-spimem-support-to-mtk-spi.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2361-add-spimem-support-to-mtk-spi.patch
@@ -1,21 +1,16 @@
-From 675b477b2a50b2fb97f35944756f89644bf70092 Mon Sep 17 00:00:00 2001
-From: Qii Wang <qii.wang@mediatek.com>
-Date: Tue, 5 Jan 2021 16:48:39 +0800
-Subject: [PATCH] spi: mediatek: support IPM Design
+From 85e3059aee9943eddfd2b7c9fc83481751005c09 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:18 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2361-add-spimem-support-to-mtk-spi.patch]
-[Description]
-1. support sigle mode;
-2. support dual/quad mode with spi-mem framework.
-
-Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
-Reviewed-by: Qii Wang <qii.wang@mediatek.com>
---
drivers/spi/spi-mt65xx.c | 395 +++++++++++++++++++++--
include/linux/platform_data/spi-mt65xx.h | 2 +-
2 files changed, 370 insertions(+), 27 deletions(-)
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index 8acf24f7c..9183c64e4 100644
+index 29d44f5d5..dbb471769 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -17,6 +17,7 @@
@@ -282,8 +277,8 @@
+ mtk_spi_prepare_transfer(master, xfer->speed_hz);
mtk_spi_setup_packet(master);
- cnt = xfer->len / 4;
-@@ -455,7 +553,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
+ if (xfer->tx_buf) {
+@@ -456,7 +554,7 @@ static int mtk_spi_dma_transfer(struct spi_master *master,
mdata->cur_transfer = xfer;
mdata->num_xfered = 0;
@@ -292,7 +287,7 @@
cmd = readl(mdata->base + SPI_CMD_REG);
if (xfer->tx_buf)
-@@ -532,6 +630,13 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
+@@ -533,6 +631,13 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
else
mdata->state = MTK_SPI_IDLE;
@@ -306,7 +301,7 @@
if (!master->can_dma(master, NULL, trans)) {
if (trans->rx_buf) {
cnt = mdata->xfer_len / 4;
-@@ -615,12 +720,241 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
+@@ -616,12 +721,241 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
@@ -549,7 +544,7 @@
int i, irq, ret, addr_bits;
master = spi_alloc_master(&pdev->dev, sizeof(*mdata));
-@@ -629,7 +963,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -630,7 +964,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
return -ENOMEM;
}
@@ -558,7 +553,7 @@
master->dev.of_node = pdev->dev.of_node;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
-@@ -648,9 +982,25 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -649,9 +983,25 @@ static int mtk_spi_probe(struct platform_device *pdev)
mdata = spi_master_get_devdata(master);
mdata->dev_comp = of_id->data;
@@ -584,7 +579,7 @@
if (mdata->dev_comp->need_pad_sel) {
mdata->pad_num = of_property_count_u32_elems(
pdev->dev.of_node,
-@@ -683,15 +1033,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -684,15 +1034,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, master);
@@ -601,7 +596,7 @@
if (IS_ERR(mdata->base)) {
ret = PTR_ERR(mdata->base);
goto err_put_master;
-@@ -713,6 +1055,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -714,6 +1056,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master;
}
@@ -609,7 +604,7 @@
mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk");
if (IS_ERR(mdata->parent_clk)) {
ret = PTR_ERR(mdata->parent_clk);
-@@ -750,7 +1093,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -751,7 +1094,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
clk_disable_unprepare(mdata->spi_clk);
pm_runtime_enable(&pdev->dev);
@@ -632,5 +627,5 @@
};
#endif
--
-2.17.1
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2362-spi-mtk-nor-fix-timeout-calculation-overflow.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2362-spi-mtk-nor-fix-timeout-calculation-overflow.patch
new file mode 100644
index 0000000..d7f7d9b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2362-spi-mtk-nor-fix-timeout-calculation-overflow.patch
@@ -0,0 +1,37 @@
+From 2231dfcbcffef50846a9c240651c62771d7e33b0 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:18 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2362-spi-mtk-nor-fix-timeout-calculation-overflow.patch]
+
+---
+ drivers/spi/spi-mtk-nor.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-mtk-nor.c b/drivers/spi/spi-mtk-nor.c
+index c15a99105..4f72f08c0 100644
+--- a/drivers/spi/spi-mtk-nor.c
++++ b/drivers/spi/spi-mtk-nor.c
+@@ -89,7 +89,7 @@
+ // Buffered page program can do one 128-byte transfer
+ #define MTK_NOR_PP_SIZE 128
+
+-#define CLK_TO_US(sp, clkcnt) ((clkcnt) * 1000000 / sp->spi_freq)
++#define CLK_TO_US(sp, clkcnt) DIV_ROUND_UP(clkcnt, sp->spi_freq / 1000000)
+
+ struct mtk_nor {
+ struct spi_controller *ctlr;
+@@ -177,6 +177,10 @@ static int mtk_nor_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op)
+ if ((op->addr.nbytes == 3) || (op->addr.nbytes == 4)) {
+ if ((op->data.dir == SPI_MEM_DATA_IN) &&
+ mtk_nor_match_read(op)) {
++ // limit size to prevent timeout calculation overflow
++ if (op->data.nbytes > 0x400000)
++ op->data.nbytes = 0x400000;
++
+ if ((op->addr.val & MTK_NOR_DMA_ALIGN_MASK) ||
+ (op->data.nbytes < MTK_NOR_DMA_ALIGN))
+ op->data.nbytes = 1;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2363-spi-mediatek-fix-timeout-for-large-data.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2363-spi-mediatek-fix-timeout-for-large-data.patch
new file mode 100644
index 0000000..2a05ef3
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2363-spi-mediatek-fix-timeout-for-large-data.patch
@@ -0,0 +1,49 @@
+From 8efe8045522d7bd790b9ae7408c64f497a54e643 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:18 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2363-spi-mediatek-fix-timeout-for-large-data.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 18 ++++++++++++++++++
+ 1 file changed, 18 insertions(+)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index dbb471769..871eff03f 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -721,6 +721,23 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
+ return IRQ_HANDLED;
+ }
+
++static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem,
++ struct spi_mem_op *op)
++{
++ int opcode_len;
++
++ if(!op->data.nbytes)
++ return 0;
++
++ if (op->data.dir != SPI_MEM_NO_DATA) {
++ opcode_len = 1 + op->addr.nbytes + op->dummy.nbytes;
++ if (opcode_len + op->data.nbytes > MTK_SPI_IPM_PACKET_SIZE)
++ op->data.nbytes = MTK_SPI_IPM_PACKET_SIZE -opcode_len;
++ }
++
++ return 0;
++}
++
+ static bool mtk_spi_mem_supports_op(struct spi_mem *mem,
+ const struct spi_mem_op *op)
+ {
+@@ -947,6 +964,7 @@ err_exit:
+ }
+
+ static const struct spi_controller_mem_ops mtk_spi_mem_ops = {
++ .adjust_op_size = mtk_spi_mem_adjust_op_size,
+ .supports_op = mtk_spi_mem_supports_op,
+ .exec_op = mtk_spi_mem_exec_op,
+ };
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2364-spi-mediatek-fix-dma-unmap-twice.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2364-spi-mediatek-fix-dma-unmap-twice.patch
new file mode 100644
index 0000000..997e16f
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2364-spi-mediatek-fix-dma-unmap-twice.patch
@@ -0,0 +1,31 @@
+From 548735b3ae97333e3630febcf15298304aa42dcf Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:19 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2364-spi-mediatek-fix-dma-unmap-twice.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index 871eff03f..3a8f67f1e 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -947,12 +947,10 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
+ reg_val &= ~SPI_CMD_RX_DMA;
+ writel(reg_val, mdata->base + SPI_CMD_REG);
+
++unmap_rx_dma:
+ if (op->data.dir == SPI_MEM_DATA_IN)
+ dma_unmap_single(mdata->dev, mdata->rx_dma,
+ op->data.nbytes, DMA_FROM_DEVICE);
+-unmap_rx_dma:
+- dma_unmap_single(mdata->dev, mdata->rx_dma,
+- op->data.nbytes, DMA_FROM_DEVICE);
+ unmap_tx_dma:
+ dma_unmap_single(mdata->dev, mdata->tx_dma,
+ tx_size, DMA_TO_DEVICE);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2365-fix-SPIM-NAND-and-NOR-probing.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2365-fix-SPIM-NAND-and-NOR-probing.patch
new file mode 100644
index 0000000..02e460a
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2365-fix-SPIM-NAND-and-NOR-probing.patch
@@ -0,0 +1,48 @@
+From 1a41f923f66c03c40e6703dd69f8bfbe2791ce70 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:19 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2365-fix-SPIM-NAND-and-NOR-probing.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index 3a8f67f1e..05697e1d1 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -1072,7 +1072,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+ goto err_put_master;
+ }
+
+-/*
++
+ mdata->parent_clk = devm_clk_get(&pdev->dev, "parent-clk");
+ if (IS_ERR(mdata->parent_clk)) {
+ ret = PTR_ERR(mdata->parent_clk);
+@@ -1100,17 +1100,17 @@ static int mtk_spi_probe(struct platform_device *pdev)
+ goto err_put_master;
+ }
+
+- ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
++ /*ret = clk_set_parent(mdata->sel_clk, mdata->parent_clk);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "failed to clk_set_parent (%d)\n", ret);
+ clk_disable_unprepare(mdata->spi_clk);
+ goto err_put_master;
+ }
+
+- clk_disable_unprepare(mdata->spi_clk);
++ clk_disable_unprepare(mdata->sel_clk);*/
++
++ //pm_runtime_enable(&pdev->dev);
+
+- pm_runtime_enable(&pdev->dev);
+-*/
+ ret = devm_spi_register_master(&pdev->dev, master);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register master (%d)\n", ret);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0670-fix-SPIM-dma-buffer-not-aligned.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2366-fix-SPIM-dma-buffer-not-aligned.patch
similarity index 68%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0670-fix-SPIM-dma-buffer-not-aligned.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2366-fix-SPIM-dma-buffer-not-aligned.patch
index d4534e7..fed7675 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0670-fix-SPIM-dma-buffer-not-aligned.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2366-fix-SPIM-dma-buffer-not-aligned.patch
@@ -1,6 +1,18 @@
+From 475f064022a716bda4574406d8365627c3bcf131 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:19 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2366-fix-SPIM-dma-buffer-not-aligned.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 33 +++++++++++++++++++++++----------
+ 1 file changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index 05697e1d1..2883dc908 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
-@@ -184,7 +184,7 @@ static const struct mtk_spi_compatible m
+@@ -184,7 +184,7 @@ static const struct mtk_spi_compatible mt8183_compat = {
*/
static const struct mtk_chip_config mtk_default_chip_info = {
.sample_sel = 0,
@@ -9,7 +21,7 @@
};
static const struct of_device_id mtk_spi_of_match[] = {
-@@ -730,8 +730,11 @@ static int mtk_spi_mem_adjust_op_size(st
+@@ -731,8 +731,11 @@ static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem,
if (op->data.dir != SPI_MEM_NO_DATA) {
opcode_len = 1 + op->addr.nbytes + op->dummy.nbytes;
@@ -22,7 +34,7 @@
}
return 0;
-@@ -758,10 +761,6 @@ static bool mtk_spi_mem_supports_op(stru
+@@ -759,10 +762,6 @@ static bool mtk_spi_mem_supports_op(struct spi_mem *mem,
return false;
}
@@ -33,7 +45,7 @@
return true;
}
-@@ -820,6 +819,7 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -821,6 +820,7 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
struct mtk_spi *mdata = spi_master_get_devdata(mem->spi->master);
u32 reg_val, nio = 1, tx_size;
char *tx_tmp_buf;
@@ -41,7 +53,7 @@
int ret = 0;
mdata->use_spimem = true;
-@@ -914,10 +914,18 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -915,10 +915,18 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
}
if (op->data.dir == SPI_MEM_DATA_IN) {
@@ -63,7 +75,7 @@
if (dma_mapping_error(mdata->dev, mdata->rx_dma)) {
ret = -ENOMEM;
goto unmap_tx_dma;
-@@ -947,9 +955,14 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -948,9 +956,14 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
writel(reg_val, mdata->base + SPI_CMD_REG);
unmap_rx_dma:
@@ -79,3 +91,6 @@
unmap_tx_dma:
dma_unmap_single(mdata->dev, mdata->tx_dma,
tx_size, DMA_TO_DEVICE);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2367-fix-mtk-nfi-driver-dependency.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2367-fix-mtk-nfi-driver-dependency.patch
new file mode 100644
index 0000000..9ef3678
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2367-fix-mtk-nfi-driver-dependency.patch
@@ -0,0 +1,25 @@
+From 8a165fdcdddc69e2bc048636695521d5b6966ff7 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:19 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2367-fix-mtk-nfi-driver-dependency.patch]
+
+---
+ drivers/spi/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
+index b26bf6b46..4b97ca45c 100644
+--- a/drivers/spi/Kconfig
++++ b/drivers/spi/Kconfig
+@@ -429,6 +429,7 @@ config SPI_MT65XX
+
+ config SPI_MTK_SNFI
+ tristate "MediaTek SPI NAND interface"
++ depends on MTD
+ select MTD_SPI_NAND
+ help
+ This selects the SPI NAND FLASH interface(SNFI),
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2368-kernel-MT7988-fix-spi-dma-unmap.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2368-kernel-MT7988-fix-spi-dma-unmap.patch
new file mode 100644
index 0000000..4774cb3
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2368-kernel-MT7988-fix-spi-dma-unmap.patch
@@ -0,0 +1,32 @@
+From f715b301cff26297a1f4af71e6982de3d56673dd Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:20 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2368-kernel-MT7988-fix-spi-dma-unmap.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index 2883dc908..b03257132 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -957,12 +957,12 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
+
+ unmap_rx_dma:
+ if (op->data.dir == SPI_MEM_DATA_IN) {
++ dma_unmap_single(mdata->dev, mdata->rx_dma,
++ op->data.nbytes, DMA_FROM_DEVICE);
+ if(!IS_ALIGNED((size_t)op->data.buf.in, 4)) {
+ memcpy(op->data.buf.in, rx_tmp_buf, op->data.nbytes);
+ kfree(rx_tmp_buf);
+ }
+- dma_unmap_single(mdata->dev, mdata->rx_dma,
+- op->data.nbytes, DMA_FROM_DEVICE);
+ }
+ unmap_tx_dma:
+ dma_unmap_single(mdata->dev, mdata->tx_dma,
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9009-Add-spi-runtime-PM-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2369-Add-spi-runtime-PM-support.patch
similarity index 84%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9009-Add-spi-runtime-PM-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2369-Add-spi-runtime-PM-support.patch
index 8371b57..92dbb42 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9009-Add-spi-runtime-PM-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2369-Add-spi-runtime-PM-support.patch
@@ -1,22 +1,14 @@
-From 0c1e4af01506c913cc54e63f66bb5470f50790c7 Mon Sep 17 00:00:00 2001
-From: Leilk Liu <leilk.liu@mediatek.com>
-Date: Tue, 13 Jul 2021 21:45:59 +0800
-Subject: [PATCH] [Add spi runtime PM support]
+From c8ea5f2bbc2ece3efcb7b8c704a7bee4c5f7adef Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:20 +0800
+Subject: [PATCH] [spi-and-storage][999-2369-Add-spi-runtime-PM-support.patch]
-[Description]
-Add ahb clk and enable runtime pm
-
-[Release-log]
-N/A
-
-Change-Id: I0529f6e829f5fc4c5880508971c97b9434820340
-Signed-off-by: Leilk Liu <leilk.liu@mediatek.com>
---
drivers/spi/spi-mt65xx.c | 77 ++++++++++++++++++++++++++++++++++------
1 file changed, 67 insertions(+), 10 deletions(-)
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index 7e54984..ff2d825 100644
+index b03257132..7c3ee3381 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -119,6 +119,8 @@ struct mtk_spi_compatible {
@@ -74,7 +66,7 @@
},
{ .compatible = "mediatek,mt2701-spi",
.data = (void *)&mtk_common_compat,
-@@ -992,7 +1006,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -993,7 +1007,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
return -ENOMEM;
}
@@ -83,7 +75,7 @@
master->dev.of_node = pdev->dev.of_node;
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
-@@ -1106,22 +1120,40 @@ static int mtk_spi_probe(struct platform_device *pdev)
+@@ -1107,22 +1121,40 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master;
}
@@ -127,7 +119,7 @@
ret = devm_spi_register_master(&pdev->dev, master);
if (ret) {
-@@ -1201,8 +1233,11 @@ static int mtk_spi_suspend(struct device *dev)
+@@ -1202,8 +1234,11 @@ static int mtk_spi_suspend(struct device *dev)
if (ret)
return ret;
@@ -140,7 +132,7 @@
return ret;
}
-@@ -1214,6 +1249,14 @@ static int mtk_spi_resume(struct device *dev)
+@@ -1215,6 +1250,14 @@ static int mtk_spi_resume(struct device *dev)
struct mtk_spi *mdata = spi_master_get_devdata(master);
if (!pm_runtime_suspended(dev)) {
@@ -155,7 +147,7 @@
ret = clk_prepare_enable(mdata->spi_clk);
if (ret < 0) {
dev_err(dev, "failed to enable spi_clk (%d)\n", ret);
-@@ -1222,8 +1265,11 @@ static int mtk_spi_resume(struct device *dev)
+@@ -1223,8 +1266,11 @@ static int mtk_spi_resume(struct device *dev)
}
ret = spi_master_resume(master);
@@ -168,7 +160,7 @@
return ret;
}
-@@ -1237,6 +1283,9 @@ static int mtk_spi_runtime_suspend(struct device *dev)
+@@ -1238,6 +1284,9 @@ static int mtk_spi_runtime_suspend(struct device *dev)
clk_disable_unprepare(mdata->spi_clk);
@@ -178,7 +170,7 @@
return 0;
}
-@@ -1246,6 +1295,14 @@ static int mtk_spi_runtime_resume(struct device *dev)
+@@ -1247,6 +1296,14 @@ static int mtk_spi_runtime_resume(struct device *dev)
struct mtk_spi *mdata = spi_master_get_devdata(master);
int ret;
@@ -194,5 +186,5 @@
if (ret < 0) {
dev_err(dev, "failed to enable spi_clk (%d)\n", ret);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9011-Modify-tick_delay-for-spi-work-safety.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2370-Modify-tick_delay-for-spi-work-safety.patch
similarity index 64%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9011-Modify-tick_delay-for-spi-work-safety.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2370-Modify-tick_delay-for-spi-work-safety.patch
index dd73f82..7adee7d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9011-Modify-tick_delay-for-spi-work-safety.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2370-Modify-tick_delay-for-spi-work-safety.patch
@@ -1,14 +1,15 @@
-From 02205bef8a645d4374d2869e3a5a5a1d7c2e693a Mon Sep 17 00:00:00 2001
-From: Qii Wang <qii.wang@mediatek.com>
-Date: Sat, 14 May 2022 14:18:13 +0800
-Subject: [PATCH] [Modify tick_delay for spi work safety]
+From adcc9739e6457df20339161299cf267de9699a2e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:20 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2370-Modify-tick_delay-for-spi-work-safety.patch]
---
drivers/spi/spi-mt65xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index bef03bd8c..c19e2d4d7 100644
+index 7c3ee3381..83a2417a8 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -195,7 +195,7 @@ static const struct mtk_spi_compatible mt8183_compat = {
@@ -21,5 +22,5 @@
static const struct of_device_id mtk_spi_of_match[] = {
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9013-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2371-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch
similarity index 92%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9013-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2371-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch
index d64f376..47611e5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9013-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2371-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch
@@ -1,10 +1,9 @@
-From 45ec6dfcc5f48127d5bd440fb615bbf48f3fc9c1 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:29:51 +0800
-Subject: [PATCH] drivers: spi-mt65xx: Move chip_config to driver's private
- data
+From 8fc345d6238b0fb81f6737d21ca9d7efb1dd1489 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:20 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2371-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
drivers/spi/spi-mt65xx.c | 31 +++++++++++-------------
include/linux/platform_data/spi-mt65xx.h | 17 -------------
@@ -12,7 +11,7 @@
delete mode 100644 include/linux/platform_data/spi-mt65xx.h
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index c19e2d4d7..0afd00891 100644
+index 83a2417a8..32a0b0264 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -14,7 +14,6 @@
@@ -138,5 +137,5 @@
-};
-#endif
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2372-drivers-spi-Add-support-for-dynamic-calibration.patch
similarity index 87%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2372-drivers-spi-Add-support-for-dynamic-calibration.patch
index 750c87b..d438084 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2372-drivers-spi-Add-support-for-dynamic-calibration.patch
@@ -1,17 +1,19 @@
-From a84c53fce4ccd67c147dcbb2dcf4fdeceab05981 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:35:52 +0800
-Subject: [PATCH] drivers: spi: Add support for dynamic calibration
+From a7d7d3c4d6a949135a34dff1e987a52de9f227b7 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:21 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2372-drivers-spi-Add-support-for-dynamic-calibration.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
- drivers/spi/spi.c | 137 ++++++++++++++++++++++++++++++++++++++++
+ drivers/spi/spi.c | 141 ++++++++++++++++++++++++++++++++++++++++
include/linux/spi/spi.h | 42 ++++++++++++
- 2 files changed, 179 insertions(+)
+ 2 files changed, 183 insertions(+)
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
+index e562735a3..28bad4a8b 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
-@@ -1109,6 +1109,74 @@ static int spi_transfer_wait(struct spi_
+@@ -1109,6 +1109,74 @@ static int spi_transfer_wait(struct spi_controller *ctlr,
return 0;
}
@@ -86,7 +88,7 @@
static void _spi_transfer_delay_ns(u32 ns)
{
if (!ns)
-@@ -1720,6 +1788,75 @@ void spi_flush_queue(struct spi_controll
+@@ -1720,6 +1788,75 @@ void spi_flush_queue(struct spi_controller *ctlr)
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_OF)
@@ -162,7 +164,7 @@
static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
struct device_node *nc)
{
-@@ -1841,6 +1978,10 @@ of_register_spi_device(struct spi_contro
+@@ -1841,6 +1978,10 @@ of_register_spi_device(struct spi_controller *ctlr, struct device_node *nc)
if (rc)
goto err_out;
@@ -173,6 +175,8 @@
/* Store a pointer to the node in the device structure */
of_node_get(nc);
spi->dev.of_node = nc;
+diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
+index 7067f85ce..5330cd9b0 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -264,6 +264,40 @@ struct spi_driver {
@@ -228,7 +232,7 @@
int (*fw_translate_cs)(struct spi_controller *ctlr, unsigned cs);
};
-@@ -1369,6 +1408,9 @@ spi_register_board_info(struct spi_board
+@@ -1369,6 +1408,9 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
{ return 0; }
#endif
@@ -238,3 +242,6 @@
/* If you're hotplugging an adapter with devices (parport, usb, etc)
* use spi_new_device() to describe each device. You can also call
* spi_unregister_device() to start making that device vanish, but
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9015-drivers-spi-mem-Add-spi-calibration-hook.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch
similarity index 82%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9015-drivers-spi-mem-Add-spi-calibration-hook.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch
index dcea7de..c16f87e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9015-drivers-spi-mem-Add-spi-calibration-hook.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch
@@ -1,9 +1,9 @@
-From a4f235c3a3c4d25aa6a4417ce64831ca0b38c324 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:37:55 +0800
-Subject: [PATCH] drivers: spi-mem: Add spi calibration hook
+From 945b61ae2d00d59eacebb70496ce9bc530767929 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:21 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
drivers/spi/spi-mem.c | 8 ++++++++
include/linux/spi/spi-mem.h | 4 ++++
@@ -44,5 +44,5 @@
struct spi_mem_dirmap_desc *
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9016-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch
similarity index 78%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9016-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch
index 2c51aa9..f39b229 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9016-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch
@@ -1,15 +1,15 @@
-From ac9ed3898b80a81ce220a682749767ef189094a8 Mon Sep 17 00:00:00 2001
-From: "SkyLake.Huang" <skylake.huang@mediatek.com>
-Date: Thu, 23 Jun 2022 18:39:03 +0800
-Subject: [PATCH] drivers: spi-mt65xx: Add controller's calibration paramter
+From 6411311c9df3bce87ad46650053eb52cf12be889 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:21 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch]
-Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
---
drivers/spi/spi-mt65xx.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
-index 0afd00891..1b272d15c 100644
+index 32a0b0264..2034d1979 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -727,6 +727,21 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
@@ -44,5 +44,5 @@
if (!of_id) {
dev_err(&pdev->dev, "failed to probe of_node\n");
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9102-spi-update-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2375-spi-update-driver.patch
similarity index 91%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9102-spi-update-driver.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2375-spi-update-driver.patch
index 4900733..48e7187 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9102-spi-update-driver.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2375-spi-update-driver.patch
@@ -1,3 +1,14 @@
+From f8707b14c517f9402456c3c1e98f64d0eb8a4af5 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:21 +0800
+Subject: [PATCH] [spi-and-storage][999-2375-spi-update-driver.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 414 ++++++++++++++++++++++-----------------
+ 1 file changed, 231 insertions(+), 183 deletions(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index 2034d1979..b80f8dcd9 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -12,7 +12,7 @@
@@ -71,7 +82,7 @@
struct completion spimem_done;
bool use_spimem;
struct device *dev;
-@@ -154,21 +152,10 @@ static const struct mtk_spi_compatible m
+@@ -154,21 +152,10 @@ static const struct mtk_spi_compatible mt2712_compat = {
.must_tx = true,
};
@@ -94,7 +105,7 @@
};
static const struct mtk_spi_compatible mt6765_compat = {
-@@ -194,13 +181,25 @@ static const struct mtk_spi_compatible m
+@@ -194,13 +181,25 @@ static const struct mtk_spi_compatible mt8183_compat = {
.enhance_timing = true,
};
@@ -122,7 +133,7 @@
{ .compatible = "mediatek,mt2701-spi",
.data = (void *)&mtk_common_compat,
},
-@@ -228,6 +227,12 @@ static const struct of_device_id mtk_spi
+@@ -228,6 +227,12 @@ static const struct of_device_id mtk_spi_of_match[] = {
{ .compatible = "mediatek,mt8183-spi",
.data = (void *)&mt8183_compat,
},
@@ -135,7 +146,7 @@
{}
};
MODULE_DEVICE_TABLE(of, mtk_spi_of_match);
-@@ -256,27 +261,30 @@ static int mtk_spi_hw_init(struct spi_ma
+@@ -256,27 +261,30 @@ static int mtk_spi_hw_init(struct spi_master *master,
cpha = spi->mode & SPI_CPHA ? 1 : 0;
cpol = spi->mode & SPI_CPOL ? 1 : 0;
@@ -176,7 +187,7 @@
reg_val = readl(mdata->base + SPI_CMD_REG);
if (mdata->dev_comp->ipm_design) {
/* SPI transfer without idle time until packet length done */
-@@ -375,12 +383,11 @@ static void mtk_spi_set_cs(struct spi_de
+@@ -375,12 +383,11 @@ static void mtk_spi_set_cs(struct spi_device *spi, bool enable)
static void mtk_spi_prepare_transfer(struct spi_master *master,
u32 speed_hz)
{
@@ -192,7 +203,7 @@
else
div = 1;
-@@ -388,13 +395,19 @@ static void mtk_spi_prepare_transfer(str
+@@ -388,13 +395,19 @@ static void mtk_spi_prepare_transfer(struct spi_master *master,
cs_time = sck_time * 2;
if (mdata->dev_comp->enhance_timing) {
@@ -214,7 +225,7 @@
reg_val |= (((cs_time - 1) & 0xffff)
<< SPI_ADJUST_CFG0_CS_SETUP_OFFSET);
writel(reg_val, mdata->base + SPI_CFG0_REG);
-@@ -453,14 +466,17 @@ static void mtk_spi_enable_transfer(stru
+@@ -453,14 +466,17 @@ static void mtk_spi_enable_transfer(struct spi_master *master)
writel(cmd, mdata->base + SPI_CMD_REG);
}
@@ -238,7 +249,7 @@
return mult_delta;
}
-@@ -472,22 +488,22 @@ static void mtk_spi_update_mdata_len(str
+@@ -472,22 +488,22 @@ static void mtk_spi_update_mdata_len(struct spi_master *master)
if (mdata->tx_sgl_len && mdata->rx_sgl_len) {
if (mdata->tx_sgl_len > mdata->rx_sgl_len) {
@@ -265,7 +276,7 @@
mdata->xfer_len = mdata->rx_sgl_len - mult_delta;
mdata->rx_sgl_len = mult_delta;
}
-@@ -598,6 +614,19 @@ static int mtk_spi_transfer_one(struct s
+@@ -598,6 +614,19 @@ static int mtk_spi_transfer_one(struct spi_master *master,
struct spi_device *spi,
struct spi_transfer *xfer)
{
@@ -285,7 +296,7 @@
if (master->can_dma(master, spi, xfer))
return mtk_spi_dma_transfer(master, spi, xfer);
else
-@@ -618,8 +647,9 @@ static int mtk_spi_setup(struct spi_devi
+@@ -618,8 +647,9 @@ static int mtk_spi_setup(struct spi_device *spi)
{
struct mtk_spi *mdata = spi_master_get_devdata(spi->master);
@@ -297,7 +308,7 @@
return 0;
}
-@@ -747,9 +777,6 @@ static int mtk_spi_mem_adjust_op_size(st
+@@ -747,9 +777,6 @@ static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem,
{
int opcode_len;
@@ -307,7 +318,7 @@
if (op->data.dir != SPI_MEM_NO_DATA) {
opcode_len = 1 + op->addr.nbytes + op->dummy.nbytes;
if (opcode_len + op->data.nbytes > MTK_SPI_IPM_PACKET_SIZE) {
-@@ -765,8 +792,7 @@ static int mtk_spi_mem_adjust_op_size(st
+@@ -765,8 +792,7 @@ static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem,
static bool mtk_spi_mem_supports_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
@@ -317,7 +328,7 @@
return false;
if (op->addr.nbytes && op->dummy.nbytes &&
-@@ -814,13 +840,18 @@ static int mtk_spi_transfer_wait(struct
+@@ -814,13 +840,18 @@ static int mtk_spi_transfer_wait(struct spi_mem *mem,
const struct spi_mem_op *op)
{
struct mtk_spi *mdata = spi_master_get_devdata(mem->spi->master);
@@ -340,7 +351,7 @@
ms += ms + 1000; /* 1s tolerance */
if (ms > UINT_MAX)
-@@ -839,9 +870,8 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -839,9 +870,8 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
const struct spi_mem_op *op)
{
struct mtk_spi *mdata = spi_master_get_devdata(mem->spi->master);
@@ -352,7 +363,7 @@
int ret = 0;
mdata->use_spimem = true;
-@@ -887,9 +917,11 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -887,9 +917,11 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
op->dummy.buswidth == 4 ||
op->data.buswidth == 4)
nio = 4;
@@ -365,7 +376,7 @@
reg_val |= SPI_CFG3_IPM_HALF_DUPLEX_EN;
if (op->data.dir == SPI_MEM_DATA_IN)
-@@ -902,11 +934,13 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -902,11 +934,13 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
if (op->data.dir == SPI_MEM_DATA_OUT)
tx_size += op->data.nbytes;
@@ -381,7 +392,7 @@
tx_tmp_buf[0] = op->cmd.opcode;
-@@ -937,12 +971,15 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -937,12 +971,15 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
if (op->data.dir == SPI_MEM_DATA_IN) {
if(!IS_ALIGNED((size_t)op->data.buf.in, 4)) {
@@ -402,7 +413,7 @@
mdata->rx_dma = dma_map_single(mdata->dev,
rx_tmp_buf,
-@@ -950,7 +987,7 @@ static int mtk_spi_mem_exec_op(struct sp
+@@ -950,7 +987,7 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
DMA_FROM_DEVICE);
if (dma_mapping_error(mdata->dev, mdata->rx_dma)) {
ret = -ENOMEM;
@@ -428,7 +439,7 @@
unmap_tx_dma:
dma_unmap_single(mdata->dev, mdata->tx_dma,
tx_size, DMA_TO_DEVICE);
-@@ -1003,19 +1042,19 @@ static const struct spi_controller_mem_o
+@@ -1003,19 +1042,19 @@ static const struct spi_controller_mem_ops mtk_spi_mem_ops = {
static int mtk_spi_probe(struct platform_device *pdev)
{
@@ -452,7 +463,7 @@
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
master->set_cs = mtk_spi_set_cs;
-@@ -1023,23 +1062,16 @@ static int mtk_spi_probe(struct platform
+@@ -1023,23 +1062,16 @@ static int mtk_spi_probe(struct platform_device *pdev)
master->transfer_one = mtk_spi_transfer_one;
master->can_dma = mtk_spi_can_dma;
master->setup = mtk_spi_setup;
@@ -478,7 +489,7 @@
if (mdata->dev_comp->enhance_timing)
master->mode_bits |= SPI_CS_HIGH;
-@@ -1050,27 +1082,23 @@ static int mtk_spi_probe(struct platform
+@@ -1050,27 +1082,23 @@ static int mtk_spi_probe(struct platform_device *pdev)
if (mdata->dev_comp->ipm_design)
master->mode_bits |= SPI_LOOP;
@@ -511,7 +522,7 @@
sizeof(u32), GFP_KERNEL);
if (!mdata->pad_sel) {
ret = -ENOMEM;
-@@ -1078,11 +1106,11 @@ static int mtk_spi_probe(struct platform
+@@ -1078,11 +1106,11 @@ static int mtk_spi_probe(struct platform_device *pdev)
}
for (i = 0; i < mdata->pad_num; i++) {
@@ -525,7 +536,7 @@
i, mdata->pad_sel[i]);
ret = -EINVAL;
goto err_put_master;
-@@ -1103,122 +1131,118 @@ static int mtk_spi_probe(struct platform
+@@ -1103,122 +1131,118 @@ static int mtk_spi_probe(struct platform_device *pdev)
goto err_put_master;
}
@@ -702,7 +713,7 @@
err_put_master:
spi_master_put(master);
-@@ -1229,11 +1253,22 @@ static int mtk_spi_remove(struct platfor
+@@ -1229,11 +1253,22 @@ static int mtk_spi_remove(struct platform_device *pdev)
{
struct spi_master *master = platform_get_drvdata(pdev);
struct mtk_spi *mdata = spi_master_get_devdata(master);
@@ -726,7 +737,7 @@
return 0;
}
-@@ -1250,8 +1285,7 @@ static int mtk_spi_suspend(struct device
+@@ -1250,8 +1285,7 @@ static int mtk_spi_suspend(struct device *dev)
if (!pm_runtime_suspended(dev)) {
clk_disable_unprepare(mdata->spi_clk);
@@ -736,7 +747,7 @@
}
return ret;
-@@ -1264,26 +1298,24 @@ static int mtk_spi_resume(struct device
+@@ -1264,26 +1298,24 @@ static int mtk_spi_resume(struct device *dev)
struct mtk_spi *mdata = spi_master_get_devdata(master);
if (!pm_runtime_suspended(dev)) {
@@ -771,7 +782,7 @@
}
return ret;
-@@ -1296,10 +1328,13 @@ static int mtk_spi_runtime_suspend(struc
+@@ -1296,10 +1328,13 @@ static int mtk_spi_runtime_suspend(struct device *dev)
struct spi_master *master = dev_get_drvdata(dev);
struct mtk_spi *mdata = spi_master_get_devdata(master);
@@ -788,7 +799,7 @@
return 0;
}
-@@ -1310,18 +1345,31 @@ static int mtk_spi_runtime_resume(struct
+@@ -1310,18 +1345,31 @@ static int mtk_spi_runtime_resume(struct device *dev)
struct mtk_spi *mdata = spi_master_get_devdata(master);
int ret;
@@ -827,3 +838,6 @@
}
return 0;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2376-drivers-spi-mt65xx-add-dts-buswidth-flow.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2376-drivers-spi-mt65xx-add-dts-buswidth-flow.patch
new file mode 100644
index 0000000..ffe6003
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2376-drivers-spi-mt65xx-add-dts-buswidth-flow.patch
@@ -0,0 +1,26 @@
+From 89740f80939ddd9b73648da2a97c8f31ae16050a Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:22 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2376-drivers-spi-mt65xx-add-dts-buswidth-flow.patch]
+
+---
+ drivers/spi/spi-mt65xx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
+index b80f8dcd9..ac95e26c1 100644
+--- a/drivers/spi/spi-mt65xx.c
++++ b/drivers/spi/spi-mt65xx.c
+@@ -1080,7 +1080,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
+ master->flags = SPI_MASTER_MUST_TX;
+
+ if (mdata->dev_comp->ipm_design)
+- master->mode_bits |= SPI_LOOP;
++ master->mode_bits |= SPI_LOOP | SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD;
+
+ if (mdata->dev_comp->ipm_design) {
+ mdata->dev = dev;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0322-fix-dirty-race-between-do_tmpfile.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2380-fix-dirty-race-between-do_tmpfile.patch
similarity index 88%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0322-fix-dirty-race-between-do_tmpfile.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2380-fix-dirty-race-between-do_tmpfile.patch
index 94ce9bd..63943f8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0322-fix-dirty-race-between-do_tmpfile.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2380-fix-dirty-race-between-do_tmpfile.patch
@@ -1,4 +1,15 @@
+From d08d34636d1384d5ddb141e0bb72afa591c12118 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:22 +0800
+Subject: [PATCH]
+ [spi-and-storage][999-2380-fix-dirty-race-between-do_tmpfile.patch]
+
+---
+ fs/ubifs/dir.c | 60 +++++++++++++++++++++++++-------------------------
+ 1 file changed, 30 insertions(+), 30 deletions(-)
+
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
+index 332c0b02a..97b231c43 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -356,6 +356,32 @@ out_budg:
@@ -98,3 +109,6 @@
static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
struct dentry *dentry)
{
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2500-cpufreq-add-the-missing-platform-driver-unregister.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2500-cpufreq-add-the-missing-platform-driver-unregister.patch
new file mode 100644
index 0000000..b03956f
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2500-cpufreq-add-the-missing-platform-driver-unregister.patch
@@ -0,0 +1,25 @@
+From 074bd5464b2e05ad5c8ed9ba0442a8abdfd4e2fc Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:22 +0800
+Subject: [PATCH]
+ [adv-feature][999-2500-cpufreq-add-the-missing-platform-driver-unregister.patch]
+
+---
+ drivers/cpufreq/mediatek-cpufreq.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
+index 927ebc582..03bb7b58d 100644
+--- a/drivers/cpufreq/mediatek-cpufreq.c
++++ b/drivers/cpufreq/mediatek-cpufreq.c
+@@ -573,6 +573,7 @@ static int __init mtk_cpufreq_driver_init(void)
+ pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0);
+ if (IS_ERR(pdev)) {
+ pr_err("failed to register mtk-cpufreq platform device\n");
++ platform_driver_unregister(&mtk_cpufreq_platdrv);
+ return PTR_ERR(pdev);
+ }
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-cpufreq-Enable-clocks-and-regulators.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2501-cpufreq-Enable-clocks-and-regulators.patch
similarity index 85%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-cpufreq-Enable-clocks-and-regulators.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2501-cpufreq-Enable-clocks-and-regulators.patch
index 2fa9359..ca84955 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0002-cpufreq-Enable-clocks-and-regulators.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2501-cpufreq-Enable-clocks-and-regulators.patch
@@ -1,5 +1,15 @@
+From 31b16ccb455139f23e4989c0795564350774c8c6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:22 +0800
+Subject: [PATCH]
+ [adv-feature][999-2501-cpufreq-Enable-clocks-and-regulators.patch]
+
+---
+ drivers/cpufreq/mediatek-cpufreq.c | 41 +++++++++++++++++++++++++++---
+ 1 file changed, 37 insertions(+), 4 deletions(-)
+
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
-index 03bb7b5..010a947 100644
+index 03bb7b58d..010a947a6 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -351,6 +351,12 @@ static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu)
@@ -86,3 +96,6 @@
dev_pm_opp_of_cpumask_remove_table(&info->cpus);
}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-cpufreq-add-mt7988a-spim-snand-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2502-cpufreq-add-mt7988a-spim-snand-support.patch
similarity index 94%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-cpufreq-add-mt7988a-spim-snand-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2502-cpufreq-add-mt7988a-spim-snand-support.patch
index ee87f4e..b40509d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0003-cpufreq-add-mt7988a-spim-snand-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2502-cpufreq-add-mt7988a-spim-snand-support.patch
@@ -1,5 +1,15 @@
+From 8abbdaf99bd93b9009482e49c94455d5c10a29f6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:23 +0800
+Subject: [PATCH]
+ [adv-feature][999-2502-cpufreq-add-mt7988a-spim-snand-support.patch]
+
+---
+ drivers/cpufreq/mediatek-cpufreq.c | 83 +++++++++++++++++++++++++++++-
+ 1 file changed, 81 insertions(+), 2 deletions(-)
+
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
-index 010a947..291f629 100644
+index 010a947a6..b23b6d2b4 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -38,6 +38,7 @@ struct mtk_cpu_dvfs_info {
@@ -210,3 +220,6 @@
{ }
};
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0007-cpufreq-mtk-vbining-add-mt7988-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2503-cpufreq-mtk-vbining-add-mt7988-support.patch
similarity index 78%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0007-cpufreq-mtk-vbining-add-mt7988-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2503-cpufreq-mtk-vbining-add-mt7988-support.patch
index aa31f22..032d163 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0007-cpufreq-mtk-vbining-add-mt7988-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2503-cpufreq-mtk-vbining-add-mt7988-support.patch
@@ -1,5 +1,15 @@
+From 96af4d1381b43bafba252d38c2a344f1011de638 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:23 +0800
+Subject: [PATCH]
+ [adv-feature][999-2503-cpufreq-mtk-vbining-add-mt7988-support.patch]
+
+---
+ drivers/cpufreq/mediatek-cpufreq.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
-index b23b6d2..147a224 100644
+index b23b6d2b4..c22945100 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -15,6 +15,7 @@
@@ -45,3 +55,6 @@
ret = dev_pm_opp_init_cpufreq_table(info->cpu_dev, &freq_table);
if (ret) {
pr_err("failed to init cpufreq table for cpu%d: %d\n",
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-add-pmic-config.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2530-add-pmic-config.patch
similarity index 76%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-add-pmic-config.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2530-add-pmic-config.patch
index f5384f3..0194261 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0950-add-pmic-config.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2530-add-pmic-config.patch
@@ -1,5 +1,15 @@
+From 4ff5fd6b2d7df7b572bce364d6a1853665e378ac Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:23 +0800
+Subject: [PATCH] [adv-feature][999-2530-add-pmic-config.patch]
+
+---
+ drivers/regulator/Kconfig | 10 ++++++++++
+ drivers/regulator/Makefile | 1 +
+ 2 files changed, 11 insertions(+)
+
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
-index 3ee6353..2e393a7 100644
+index 3ee63531f..5c573ced5 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -798,6 +798,16 @@ config REGULATOR_RT5033
@@ -20,7 +30,7 @@
tristate "Samsung S2MPA01 voltage regulator"
depends on MFD_SEC_CORE
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
-index 2210ba5..bf75b77 100644
+index 2210ba56f..bf75b7755 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
@@ -32,5 +42,5 @@
obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2550-dual-image-mount-rootfs.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2550-dual-image-mount-rootfs.patch
new file mode 100644
index 0000000..350e7d3
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2550-dual-image-mount-rootfs.patch
@@ -0,0 +1,40 @@
+From 7be8614176dc79bc242a12b7669f330058e36df6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:24 +0800
+Subject: [PATCH] [adv-feature][999-2550-dual-image-mount-rootfs.patch]
+
+---
+ init/do_mounts.c | 3 ++-
+ kernel/boot_param.c | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/init/do_mounts.c b/init/do_mounts.c
+index cd5fca8aa..2dfc0dac7 100644
+--- a/init/do_mounts.c
++++ b/init/do_mounts.c
+@@ -576,7 +576,8 @@ void __init mount_root(void)
+ }
+ #endif
+ #ifdef CONFIG_MTD_ROOTFS_ROOT_DEV
+- if (!mount_ubi_rootfs())
++ extern bool dual_boot;
++ if (!dual_boot && !mount_ubi_rootfs())
+ return;
+ #endif
+ #ifdef CONFIG_BLOCK
+diff --git a/kernel/boot_param.c b/kernel/boot_param.c
+index 3dfe828bc..cc0b2b8b0 100644
+--- a/kernel/boot_param.c
++++ b/kernel/boot_param.c
+@@ -10,7 +10,7 @@
+
+ #define BOOT_PARAM_STR_MAX_LEN 256
+
+-static bool dual_boot;
++bool dual_boot;
+ module_param(dual_boot, bool, 0444);
+
+ static bool no_split_rootfs_data;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1015-pcie-add-pcie-gen3-upstream-driver.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2600-pcie-add-pcie-gen3-upstream-driver.patch
similarity index 76%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1015-pcie-add-pcie-gen3-upstream-driver.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2600-pcie-add-pcie-gen3-upstream-driver.patch
index 4b99d9d..6e5b96a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1015-pcie-add-pcie-gen3-upstream-driver.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2600-pcie-add-pcie-gen3-upstream-driver.patch
@@ -1,5 +1,16 @@
+From 99a6452c7481de2f1a36699dd60361c49602cc77 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:24 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2600-pcie-add-pcie-gen3-upstream-driver.patch]
+
+---
+ drivers/pci/controller/Kconfig | 13 +++++++++++++
+ drivers/pci/controller/Makefile | 1 +
+ 2 files changed, 14 insertions(+)
+
diff --git a/drivers/pci/controller/Kconfig b/drivers/pci/controller/Kconfig
-index 70e0782..67988f8 100644
+index 70e078238..67988f868 100644
--- a/drivers/pci/controller/Kconfig
+++ b/drivers/pci/controller/Kconfig
@@ -241,6 +241,19 @@ config PCIE_MEDIATEK
@@ -23,7 +34,7 @@
bool "Mobiveil AXI PCIe controller"
depends on ARCH_ZYNQMP || COMPILE_TEST
diff --git a/drivers/pci/controller/Makefile b/drivers/pci/controller/Makefile
-index a2a22c9..54a496a 100644
+index a2a22c9d9..54a496a68 100644
--- a/drivers/pci/controller/Makefile
+++ b/drivers/pci/controller/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_PCIE_ROCKCHIP) += pcie-rockchip.o
@@ -34,3 +45,6 @@
obj-$(CONFIG_PCIE_MOBIVEIL) += pcie-mobiveil.o
obj-$(CONFIG_PCIE_TANGO_SMP8759) += pcie-tango.o
obj-$(CONFIG_VMD) += vmd.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1024-pcie-add-multi-MSI-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2601-pcie-add-multi-MSI-support.patch
similarity index 75%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1024-pcie-add-multi-MSI-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2601-pcie-add-multi-MSI-support.patch
index 5cf486c..80ce145 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1024-pcie-add-multi-MSI-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2601-pcie-add-multi-MSI-support.patch
@@ -1,8 +1,17 @@
+From f001395855db2d04f499a2e2936f1d54dcaab225 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:24 +0800
+Subject: [PATCH] [high-speed-io][999-2601-pcie-add-multi-MSI-support.patch]
+
+---
+ drivers/pci/controller/pcie-mediatek.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c
-index 2a54fa7a3..132b3204c 100644
+index db3672917..44a046005 100644
--- a/drivers/pci/controller/pcie-mediatek.c
+++ b/drivers/pci/controller/pcie-mediatek.c
-@@ -446,24 +446,24 @@ static int mtk_pcie_irq_domain_alloc(struct irq_domain *domain, unsigned int vir
+@@ -440,24 +440,24 @@ static int mtk_pcie_irq_domain_alloc(struct irq_domain *domain, unsigned int vir
unsigned int nr_irqs, void *args)
{
struct mtk_pcie_port *port = domain->host_data;
@@ -36,7 +45,7 @@
return 0;
}
-@@ -501,7 +501,7 @@ static struct irq_chip mtk_msi_irq_chip = {
+@@ -495,7 +495,7 @@ static struct irq_chip mtk_msi_irq_chip = {
static struct msi_domain_info mtk_msi_domain_info = {
.flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
@@ -45,7 +54,7 @@
.chip = &mtk_msi_irq_chip,
};
-@@ -633,14 +633,14 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
+@@ -627,14 +627,14 @@ static void mtk_pcie_intr_handler(struct irq_desc *desc)
if (status & MSI_STATUS){
unsigned long imsi_status;
@@ -62,3 +71,6 @@
}
}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8000-PATCH-1-4-tphy-support-type-switch-by-pericfg.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2610-tphy-support-type-switch-by-pericfg.patch
similarity index 77%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8000-PATCH-1-4-tphy-support-type-switch-by-pericfg.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2610-tphy-support-type-switch-by-pericfg.patch
index 032ef35..da92a39 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8000-PATCH-1-4-tphy-support-type-switch-by-pericfg.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2610-tphy-support-type-switch-by-pericfg.patch
@@ -1,21 +1,15 @@
-From 34687407776d46f08926b91f118adc484c4ac231 Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Fri, 17 Sep 2021 15:56:53 +0800
-Subject: [PATCH 1/8] phy: phy-mtk-tphy: support type switch by pericfg
+From 3ef64d448a36853279de5324f9bf00041b9f3ce5 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:25 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2610-tphy-support-type-switch-by-pericfg.patch]
-Add support type switch between USB3, PCIe, SATA and SGMII by
-pericfg register, this is used to take the place of efuse or
-jumper.
-
-Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/phy/mediatek/phy-mtk-tphy.c | 83 ++++++++++++++++++++++++++++-
1 file changed, 81 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
-index cb2ed3b25068..a59fe65f69e5 100644
+index d1ecf0880..c6e073401 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -10,6 +10,7 @@
@@ -26,9 +20,9 @@
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
-@@ -263,6 +264,14 @@
- #define RG_CDR_BIRLTD0_GEN3_MSK GENMASK(4, 0)
- #define RG_CDR_BIRLTD0_GEN3_VAL(x) (0x1f & (x))
+@@ -268,6 +269,14 @@
+ #define HIF_SYSCFG1 0x14
+ #define HIF_SYSCFG1_PHY2_MASK (0x3 << 20)
+/* PHY switch between pcie/usb3/sgmii/sata */
+#define USB_PHY_SWITCH_CTRL 0x0
@@ -41,7 +35,7 @@
enum mtk_phy_version {
MTK_PHY_V1 = 1,
MTK_PHY_V2,
-@@ -296,7 +305,10 @@ struct mtk_phy_instance {
+@@ -301,7 +310,10 @@ struct mtk_phy_instance {
};
struct clk *ref_clk; /* reference clock of anolog phy */
u32 index;
@@ -53,7 +47,7 @@
int eye_src;
int eye_vrt;
int eye_term;
-@@ -890,6 +902,64 @@ static void u2_phy_props_set(struct mtk_tphy *tphy,
+@@ -900,6 +912,64 @@ static void u2_phy_props_set(struct mtk_tphy *tphy,
}
}
@@ -118,7 +112,7 @@
static int mtk_phy_init(struct phy *phy)
{
struct mtk_phy_instance *instance = phy_get_drvdata(phy);
-@@ -922,6 +992,9 @@ static int mtk_phy_init(struct phy *phy)
+@@ -932,6 +1002,9 @@ static int mtk_phy_init(struct phy *phy)
case PHY_TYPE_SATA:
sata_phy_instance_init(tphy, instance);
break;
@@ -128,7 +122,7 @@
default:
dev_err(tphy->dev, "incompatible PHY type\n");
return -EINVAL;
-@@ -1010,7 +1083,8 @@ static struct phy *mtk_phy_xlate(struct device *dev,
+@@ -1020,7 +1093,8 @@ static struct phy *mtk_phy_xlate(struct device *dev,
if (!(instance->type == PHY_TYPE_USB2 ||
instance->type == PHY_TYPE_USB3 ||
instance->type == PHY_TYPE_PCIE ||
@@ -138,7 +132,7 @@
dev_err(dev, "unsupported device type: %d\n", instance->type);
return ERR_PTR(-EINVAL);
}
-@@ -1025,6 +1099,7 @@ static struct phy *mtk_phy_xlate(struct device *dev,
+@@ -1035,6 +1109,7 @@ static struct phy *mtk_phy_xlate(struct device *dev,
}
phy_parse_property(tphy, instance);
@@ -146,7 +140,7 @@
return instance->phy;
}
-@@ -1163,6 +1238,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
+@@ -1183,6 +1258,10 @@ static int mtk_tphy_probe(struct platform_device *pdev)
retval = PTR_ERR(instance->ref_clk);
goto put_child;
}
@@ -158,5 +152,5 @@
provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8006-phy-phy-mtk-tphy-add-support-efuse-setting.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2611-phy-phy-mtk-tphy-add-support-efuse-setting.patch
similarity index 88%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8006-phy-phy-mtk-tphy-add-support-efuse-setting.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2611-phy-phy-mtk-tphy-add-support-efuse-setting.patch
index 05eb738..1f958e8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8006-phy-phy-mtk-tphy-add-support-efuse-setting.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2611-phy-phy-mtk-tphy-add-support-efuse-setting.patch
@@ -1,21 +1,15 @@
-From a2eaa93a5887ddd20af0373244481139627d0d77 Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Mon, 8 Nov 2021 14:51:38 +0800
-Subject: [PATCH 2/8] phy: phy-mtk-tphy: add support efuse setting
+From 004157ce74543694981c461e95ac0cc1fa8721d7 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:25 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2611-phy-phy-mtk-tphy-add-support-efuse-setting.patch]
-Due to some SoCs have a bit shift issue that will drop a bit for usb3
-phy or pcie phy, fix it by adding software efuse reading and setting,
-but only support it optionally for versoin.
-
-Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Change-Id: Ibf88868668b3889f18c7930531981400cac732f1
---
drivers/phy/mediatek/phy-mtk-tphy.c | 195 ++++++++++++++++++++++++++++
1 file changed, 195 insertions(+)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
-index a59fe65f69e5..ce2731b2f5ff 100644
+index c6e073401..fcf8c845f 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
@@ -12,6 +12,7 @@
@@ -26,7 +20,7 @@
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/phy/phy.h>
-@@ -39,11 +40,16 @@
+@@ -41,11 +42,16 @@
#define SSUSB_SIFSLV_V2_U3PHYD 0x200
#define SSUSB_SIFSLV_V2_U3PHYA 0x400
@@ -43,7 +37,7 @@
#define PA1_RG_VRT_SEL GENMASK(14, 12)
#define PA1_RG_VRT_SEL_VAL(x) ((0x7 & (x)) << 12)
#define PA1_RG_TERM_SEL GENMASK(10, 8)
-@@ -115,6 +121,8 @@
+@@ -117,6 +123,8 @@
#define P3C_RG_SWRST_U3_PHYD_FORCE_EN BIT(24)
#define U3P_U3_PHYA_REG0 0x000
@@ -52,7 +46,7 @@
#define P3A_RG_CLKDRV_OFF GENMASK(3, 2)
#define P3A_RG_CLKDRV_OFF_VAL(x) ((0x3 & (x)) << 2)
-@@ -169,6 +177,25 @@
+@@ -171,6 +179,25 @@
#define P3D_RG_FWAKE_TH GENMASK(21, 16)
#define P3D_RG_FWAKE_TH_VAL(x) ((0x3f & (x)) << 16)
@@ -78,7 +72,7 @@
#define U3P_U3_PHYD_CDR1 0x05c
#define P3D_RG_CDR_BIR_LTD1 GENMASK(28, 24)
#define P3D_RG_CDR_BIR_LTD1_VAL(x) ((0x1f & (x)) << 24)
-@@ -275,11 +302,23 @@
+@@ -280,11 +307,23 @@
enum mtk_phy_version {
MTK_PHY_V1 = 1,
MTK_PHY_V2,
@@ -102,7 +96,7 @@
enum mtk_phy_version version;
};
-@@ -304,6 +343,10 @@ struct mtk_phy_instance {
+@@ -309,6 +348,10 @@ struct mtk_phy_instance {
struct u3phy_banks u3_banks;
};
struct clk *ref_clk; /* reference clock of anolog phy */
@@ -113,7 +107,7 @@
u32 index;
u32 type;
struct regmap *type_sw;
-@@ -960,6 +1003,139 @@ static int phy_type_set(struct mtk_phy_instance *instance)
+@@ -970,6 +1013,139 @@ static int phy_type_set(struct mtk_phy_instance *instance)
return 0;
}
@@ -253,7 +247,7 @@
static int mtk_phy_init(struct phy *phy)
{
struct mtk_phy_instance *instance = phy_get_drvdata(phy);
-@@ -978,6 +1154,8 @@ static int mtk_phy_init(struct phy *phy)
+@@ -988,6 +1164,8 @@ static int mtk_phy_init(struct phy *phy)
return ret;
}
@@ -262,7 +256,7 @@
switch (instance->type) {
case PHY_TYPE_USB2:
u2_phy_instance_init(tphy, instance);
-@@ -1062,6 +1240,7 @@ static struct phy *mtk_phy_xlate(struct device *dev,
+@@ -1072,6 +1250,7 @@ static struct phy *mtk_phy_xlate(struct device *dev,
struct mtk_phy_instance *instance = NULL;
struct device_node *phy_np = args->np;
int index;
@@ -270,7 +264,7 @@
if (args->args_count != 1) {
dev_err(dev, "invalid number of cells in 'phy' property\n");
-@@ -1098,6 +1277,10 @@ static struct phy *mtk_phy_xlate(struct device *dev,
+@@ -1108,6 +1287,10 @@ static struct phy *mtk_phy_xlate(struct device *dev,
return ERR_PTR(-EINVAL);
}
@@ -281,7 +275,7 @@
phy_parse_property(tphy, instance);
phy_type_set(instance);
-@@ -1120,14 +1303,26 @@ static const struct mtk_phy_pdata tphy_v1_pdata = {
+@@ -1130,14 +1313,26 @@ static const struct mtk_phy_pdata tphy_v1_pdata = {
static const struct mtk_phy_pdata tphy_v2_pdata = {
.avoid_rx_sen_degradation = false,
@@ -309,5 +303,5 @@
{ .compatible = "mediatek,mt2701-u3phy", .data = &tphy_v1_pdata },
{ .compatible = "mediatek,mt2712-u3phy", .data = &tphy_v2_pdata },
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8007-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2612-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch
similarity index 88%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8007-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2612-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch
index 1c6711f..1a70ada 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8007-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2612-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch
@@ -1,21 +1,18 @@
-From 2abe803824f0331c42eb9853199d5f147cee3a06 Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Tue, 25 Jan 2022 16:50:47 +0800
-Subject: [PATCH 3/8] phy: phy-mtk-tphy: Add PCIe 2 lane efuse support
+From e63fdeaa652ad5fd8d7a591e346abe587fd9bede Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:25 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2612-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch]
-Add PCIe 2 lane efuse support in tphy driver.
-
-Signed-off-by: Jie Yang <jieyy.yang@mediatek.com>
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/phy/mediatek/phy-mtk-tphy.c | 140 ++++++++++++++++++++++++++++
1 file changed, 140 insertions(+)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
-index ce2731b2f5ff..b855e759b0da 100644
+index fcf8c845f..6c07885be 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
-@@ -40,6 +40,15 @@
+@@ -42,6 +42,15 @@
#define SSUSB_SIFSLV_V2_U3PHYD 0x200
#define SSUSB_SIFSLV_V2_U3PHYA 0x400
@@ -31,7 +28,7 @@
#define U3P_MISC_REG1 0x04
#define MR1_EFUSE_AUTO_LOAD_DIS BIT(6)
-@@ -303,6 +312,7 @@ enum mtk_phy_version {
+@@ -308,6 +317,7 @@ enum mtk_phy_version {
MTK_PHY_V1 = 1,
MTK_PHY_V2,
MTK_PHY_V3,
@@ -39,7 +36,7 @@
};
struct mtk_phy_pdata {
-@@ -347,6 +357,9 @@ struct mtk_phy_instance {
+@@ -352,6 +362,9 @@ struct mtk_phy_instance {
u32 efuse_intr;
u32 efuse_tx_imp;
u32 efuse_rx_imp;
@@ -49,7 +46,7 @@
u32 index;
u32 type;
struct regmap *type_sw;
-@@ -890,6 +903,36 @@ static void phy_v2_banks_init(struct mtk_tphy *tphy,
+@@ -900,6 +913,36 @@ static void phy_v2_banks_init(struct mtk_tphy *tphy,
}
}
@@ -86,7 +83,7 @@
static void phy_parse_property(struct mtk_tphy *tphy,
struct mtk_phy_instance *instance)
{
-@@ -1072,6 +1115,40 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
+@@ -1082,6 +1125,40 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
dev_info(dev, "u3 efuse - intr %x, rx_imp %x, tx_imp %x\n",
instance->efuse_intr, instance->efuse_rx_imp,
instance->efuse_tx_imp);
@@ -127,7 +124,7 @@
break;
default:
dev_err(dev, "no sw efuse for type %d\n", instance->type);
-@@ -1105,6 +1182,31 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1115,6 +1192,31 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
break;
case PHY_TYPE_USB3:
@@ -159,7 +156,7 @@
case PHY_TYPE_PCIE:
tmp = readl(u3_banks->phyd + U3P_U3_PHYD_RSV);
tmp |= P3D_RG_EFUSE_AUTO_LOAD_DIS;
-@@ -1129,6 +1231,35 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1139,6 +1241,35 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
pr_err("%s set efuse, tx_imp %x, rx_imp %x intr %x\n",
__func__, instance->efuse_tx_imp,
instance->efuse_rx_imp, instance->efuse_intr);
@@ -195,7 +192,7 @@
break;
default:
dev_warn(dev, "no sw efuse for type %d\n", instance->type);
-@@ -1272,6 +1403,8 @@ static struct phy *mtk_phy_xlate(struct device *dev,
+@@ -1282,6 +1413,8 @@ static struct phy *mtk_phy_xlate(struct device *dev,
phy_v1_banks_init(tphy, instance);
} else if (tphy->pdata->version == MTK_PHY_V2) {
phy_v2_banks_init(tphy, instance);
@@ -204,7 +201,7 @@
} else {
dev_err(dev, "phy version is not supported\n");
return ERR_PTR(-EINVAL);
-@@ -1323,12 +1456,19 @@ static const struct mtk_phy_pdata mt8195_pdata = {
+@@ -1333,12 +1466,19 @@ static const struct mtk_phy_pdata mt8195_pdata = {
.version = MTK_PHY_V3,
};
@@ -225,5 +222,5 @@
};
MODULE_DEVICE_TABLE(of, mtk_tphy_id_table);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8008-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2613-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch
similarity index 81%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8008-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2613-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch
index e84ca6c..64e68c3 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8008-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2613-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch
@@ -1,21 +1,18 @@
-From 355e7f114a47819c3c6545a97ad308d627da5d1a Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Tue, 25 Jan 2022 19:03:34 +0800
-Subject: [PATCH 4/8] phy: phy-mtk-tphy: add auto-load-valid check mechanism
- support
+From 0e03f2c1ade35e8d40c87425414d0a6ccef0439c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:25 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2613-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch]
-add auto-load-valid check mechanism support
-
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/phy/mediatek/phy-mtk-tphy.c | 67 +++++++++++++++++++++++++++--
1 file changed, 64 insertions(+), 3 deletions(-)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
-index b855e759b0da..a5b17a1aed5c 100644
+index 6c07885be..149464f37 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
-@@ -354,9 +354,13 @@ struct mtk_phy_instance {
+@@ -359,9 +359,13 @@ struct mtk_phy_instance {
};
struct clk *ref_clk; /* reference clock of anolog phy */
u32 efuse_sw_en;
@@ -29,7 +26,7 @@
u32 efuse_intr_ln1;
u32 efuse_tx_imp_ln1;
u32 efuse_rx_imp_ln1;
-@@ -1050,6 +1054,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
+@@ -1060,6 +1064,7 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
{
struct device *dev = &instance->phy->dev;
int ret = 0;
@@ -37,7 +34,7 @@
dev_err(dev, "try to get sw efuse\n");
-@@ -1068,6 +1073,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
+@@ -1078,6 +1083,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
switch (instance->type) {
case PHY_TYPE_USB2:
@@ -58,7 +55,7 @@
ret = nvmem_cell_read_variable_le_u32(dev, "intr", &instance->efuse_intr);
if (ret) {
dev_err(dev, "fail to get u2 intr efuse, %d\n", ret);
-@@ -1085,6 +1104,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
+@@ -1095,6 +1114,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
break;
case PHY_TYPE_USB3:
case PHY_TYPE_PCIE:
@@ -79,7 +76,7 @@
ret = nvmem_cell_read_variable_le_u32(dev, "intr", &instance->efuse_intr);
if (ret) {
dev_err(dev, "fail to get u3 intr efuse, %d\n", ret);
-@@ -1119,6 +1152,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
+@@ -1129,6 +1162,20 @@ static int phy_efuse_get(struct mtk_tphy *tphy, struct mtk_phy_instance *instanc
if (tphy->pdata->version != MTK_PHY_V4)
break;
@@ -100,7 +97,7 @@
ret = nvmem_cell_read_variable_le_u32(dev, "intr_ln1", &instance->efuse_intr_ln1);
if (ret) {
dev_err(dev, "fail to get u3 lane1 intr efuse, %d\n", ret);
-@@ -1170,6 +1217,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1180,6 +1227,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
switch (instance->type) {
case PHY_TYPE_USB2:
@@ -111,7 +108,7 @@
tmp = readl(u2_banks->misc + U3P_MISC_REG1);
tmp |= MR1_EFUSE_AUTO_LOAD_DIS;
writel(tmp, u2_banks->misc + U3P_MISC_REG1);
-@@ -1182,6 +1233,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1192,6 +1243,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
break;
case PHY_TYPE_USB3:
@@ -122,7 +119,7 @@
tmp = readl(u3_banks->phyd + U3P_U3_PHYD_RSV);
tmp |= P3D_RG_EFUSE_AUTO_LOAD_DIS;
writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RSV);
-@@ -1208,6 +1263,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1218,6 +1273,10 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
break;
case PHY_TYPE_PCIE:
@@ -133,7 +130,7 @@
tmp = readl(u3_banks->phyd + U3P_U3_PHYD_RSV);
tmp |= P3D_RG_EFUSE_AUTO_LOAD_DIS;
writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RSV);
-@@ -1232,9 +1291,11 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
+@@ -1242,9 +1301,11 @@ static void phy_efuse_set(struct mtk_phy_instance *instance)
__func__, instance->efuse_tx_imp,
instance->efuse_rx_imp, instance->efuse_intr);
@@ -149,5 +146,5 @@
tmp = readl(u3_banks->phyd + SSUSB_LN1_OFFSET + U3P_U3_PHYD_RSV);
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8009-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch
similarity index 77%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8009-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch
index 36362f5..ef3b3a6 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8009-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch
@@ -1,20 +1,18 @@
-From 3295585b4e77f4a365bd1a4e17d8be6ee504584a Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Sat, 15 Oct 2022 17:38:54 +0800
-Subject: [PATCH 5/8] tphy: one setting of TTSSC-Freq-Dev for all IC cases
+From a977dbd79bc888d32fb974f328efa650722590c2 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:26 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch]
-try to use one setting of TTSSC-Freq-Dev to covery all IC cases
-
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/phy/mediatek/phy-mtk-tphy.c | 37 +++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c b/drivers/phy/mediatek/phy-mtk-tphy.c
-index a5b17a1aed5c..49a2625c1fc1 100644
+index 149464f37..e7ed93799 100644
--- a/drivers/phy/mediatek/phy-mtk-tphy.c
+++ b/drivers/phy/mediatek/phy-mtk-tphy.c
-@@ -219,6 +219,14 @@
+@@ -221,6 +221,14 @@
#define P3D_RG_RXDET_STB2_SET_P3 GENMASK(8, 0)
#define P3D_RG_RXDET_STB2_SET_P3_VAL(x) (0x1ff & (x))
@@ -29,7 +27,7 @@
#define U3P_SPLLC_XTALCTL3 0x018
#define XC3_RG_U3_XTAL_RX_PWD BIT(9)
#define XC3_RG_U3_FRC_XTAL_RX_PWD BIT(8)
-@@ -373,6 +381,8 @@ struct mtk_phy_instance {
+@@ -378,6 +386,8 @@ struct mtk_phy_instance {
int eye_vrt;
int eye_term;
bool bc12_en;
@@ -38,7 +36,7 @@
};
struct mtk_tphy {
-@@ -514,6 +524,20 @@ static void u3_phy_instance_init(struct mtk_tphy *tphy,
+@@ -520,6 +530,20 @@ static void u3_phy_instance_init(struct mtk_tphy *tphy,
tmp |= P3D_RG_RXDET_STB2_SET_P3_VAL(0x10);
writel(tmp, u3_banks->phyd + U3P_U3_PHYD_RXDET2);
@@ -59,7 +57,7 @@
dev_dbg(tphy->dev, "%s(%d)\n", __func__, instance->index);
}
-@@ -942,6 +966,19 @@ static void phy_parse_property(struct mtk_tphy *tphy,
+@@ -952,6 +976,19 @@ static void phy_parse_property(struct mtk_tphy *tphy,
{
struct device *dev = &instance->phy->dev;
@@ -80,5 +78,5 @@
return;
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8010-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2615-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch
similarity index 89%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8010-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2615-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch
index c20e930..fcd38ac 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/8010-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2615-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch
@@ -1,5 +1,15 @@
+From 50cefacc6c001eea1d9b1c78ba27304566f304f1 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:26 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2615-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch]
+
+---
+ drivers/phy/mediatek/phy-mtk-xsphy.c | 81 +++++++++++++++++++++++++++-
+ 1 file changed, 80 insertions(+), 1 deletion(-)
+
diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
-index 8c51131..e77092c 100644
+index 8c5113194..e77092c3e 100644
--- a/drivers/phy/mediatek/phy-mtk-xsphy.c
+++ b/drivers/phy/mediatek/phy-mtk-xsphy.c
@@ -12,10 +12,12 @@
@@ -140,3 +150,6 @@
}
provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9000-PATCH-1-1-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2620-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch
similarity index 80%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9000-PATCH-1-1-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2620-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch
index 9d1ca10..f38ed0d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9000-PATCH-1-1-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2620-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch
@@ -1,21 +1,16 @@
-From 0df9413c8ff0df4ed69b6e1577d7cd5fd2d72e5e Mon Sep 17 00:00:00 2001
+From 9ef2a9d208fba86dfbc06d4f2f743562bd14c145 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
-Date: Tue, 25 Oct 2022 18:25:25 +0800
-Subject: [PATCH 1/3] xHCI: change compliance mode de-emphasis default as gen1
+Date: Fri, 2 Jun 2023 13:06:26 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2620-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch]
-Port0 is using Gen2 Phy for 10GHz, and Port0 is running
-on 5GHz actually. hence to change compliance mode de-
-emphasis default as Gen1.
-
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Signed-off-by: Sam Shih <sam.shih@mediatek.com>
---
drivers/usb/host/xhci-mtk.c | 18 +++++++++++++++++-
drivers/usb/host/xhci-mtk.h | 1 +
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
-index 5c0eb35cd007..77ddb8c05500 100644
+index 5c0eb35cd..77ddb8c05 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -22,6 +22,11 @@
@@ -65,7 +60,7 @@
if (ret) {
dev_err(dev, "failed to parse uwk property\n");
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
-index 2f702342de66..8a884e7b481b 100644
+index 2f702342d..8a884e7b4 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -156,6 +156,7 @@ struct xhci_hcd_mtk {
@@ -77,5 +72,5 @@
static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
similarity index 86%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
index 07b87fc..d6974a5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
@@ -1,11 +1,9 @@
-From 083b79c977495cafc70c5d044db1f3f6c0587b1c Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Mon, 15 Aug 2022 12:40:22 +0800
-Subject: [PATCH 2/3] xHCI: MT79xx USB 2.0 USBIF compliance toolkit
+From f6aea6b89ce99b4f490fe1e1062b88042096703e Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:26 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch]
-MT79xx USB 2.0 USBIF compliance toolkit
-
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/usb/host/Kconfig | 9 +++++++++
drivers/usb/host/Makefile | 10 ++++++++++
@@ -16,7 +14,7 @@
6 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
-index 79b2e79dddd0..12b1bf9aa043 100644
+index 79b2e79dd..12b1bf9aa 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -69,6 +69,15 @@ config USB_XHCI_MTK
@@ -36,7 +34,7 @@
tristate "xHCI support for Marvell Armada 375/38x/37xx"
select USB_XHCI_PLATFORM
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
-index b191361257cc..f064f836db2b 100644
+index b19136125..f064f836d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -21,6 +21,16 @@ endif
@@ -57,7 +55,7 @@
xhci-plat-hcd-y := xhci-plat.o
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
-index 77ddb8c05500..7a200793169b 100644
+index 77ddb8c05..7a2007931 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
@@ -18,10 +18,10 @@
@@ -90,7 +88,7 @@
pm_runtime_put_noidle(&dev->dev);
pm_runtime_disable(&dev->dev);
diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h
-index 8a884e7b481b..e815d7091acc 100644
+index 8a884e7b4..e815d7091 100644
--- a/drivers/usb/host/xhci-mtk.h
+++ b/drivers/usb/host/xhci-mtk.h
@@ -157,6 +157,13 @@ struct xhci_hcd_mtk {
@@ -108,10 +106,10 @@
static inline struct xhci_hcd_mtk *hcd_to_mtk(struct usb_hcd *hcd)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
-index 5ce16a259e61..b6f8383f7371 100644
+index b8915790a..dd1b520af 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
-@@ -713,7 +713,7 @@ EXPORT_SYMBOL_GPL(xhci_run);
+@@ -714,7 +714,7 @@ EXPORT_SYMBOL_GPL(xhci_run);
* Disable device contexts, disable IRQs, and quiesce the HC.
* Reset the HC, finish any completed transactions, and cleanup memory.
*/
@@ -121,10 +119,10 @@
u32 temp;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
-index 0dc448630197..80b3124c43e2 100644
+index e696f1508..07f904167 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
-@@ -2070,6 +2070,7 @@ int xhci_halt(struct xhci_hcd *xhci);
+@@ -2073,6 +2073,7 @@ int xhci_halt(struct xhci_hcd *xhci);
int xhci_start(struct xhci_hcd *xhci);
int xhci_reset(struct xhci_hcd *xhci, u64 timeout_us);
int xhci_run(struct usb_hcd *hcd);
@@ -133,5 +131,5 @@
void xhci_shutdown(struct usb_hcd *hcd);
void xhci_init_driver(struct hc_driver *drv,
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2622-usb-add-embedded-Host-feature-support.patch
similarity index 77%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2622-usb-add-embedded-Host-feature-support.patch
index c4970eb..7776441 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2622-usb-add-embedded-Host-feature-support.patch
@@ -1,18 +1,9 @@
-From be6839b4144867c7ea6ffbedb6c6a2a42976e16d Mon Sep 17 00:00:00 2001
-From: Zhanyong Wang <zhanyong.wang@mediatek.com>
-Date: Thu, 17 Jun 2021 16:09:04 +0800
-Subject: [PATCH 3/3] usb: add embedded Host feature support
+From 32950d08c99f51e88a2db8dd30c5076a4947de24 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:27 +0800
+Subject: [PATCH]
+ [high-speed-io][999-2622-usb-add-embedded-Host-feature-support.patch]
-add EH(Embedded Host) feature for PET authentication
-1. need CONFIG_USB_OTG_WHITELIST enable
- CONFIG_USB_OTG_WHITELIST=y
-
-2. host device tree node need include "tpl-support" keyword
- &xhci {
- tpl-support;
- }
-
-Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/usb/core/hub.c | 9 +++++---
drivers/usb/core/otg_whitelist.h | 39 ++++++++++++++++++++++++++++++++
@@ -20,10 +11,10 @@
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
-index 4cf0dc7f330d..f2f330606d0c 100644
+index f787e9771..7687711f1 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
-@@ -2422,6 +2422,8 @@ static int usb_enumerate_device(struct usb_device *udev)
+@@ -2424,6 +2424,8 @@ static int usb_enumerate_device(struct usb_device *udev)
if (err < 0)
dev_dbg(&udev->dev, "HNP fail, %d\n", err);
}
@@ -32,7 +23,7 @@
return -ENOTSUPP;
}
-@@ -4779,9 +4781,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
+@@ -4781,9 +4783,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
goto fail;
}
if (r) {
@@ -47,7 +38,7 @@
continue;
}
diff --git a/drivers/usb/core/otg_whitelist.h b/drivers/usb/core/otg_whitelist.h
-index 2ae90158ded7..a8dd221334c1 100644
+index 2ae90158d..a8dd22133 100644
--- a/drivers/usb/core/otg_whitelist.h
+++ b/drivers/usb/core/otg_whitelist.h
@@ -39,9 +39,44 @@ static struct usb_device_id whitelist_table[] = {
@@ -107,10 +98,10 @@
}
diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c
-index d4345657945d..2a4b73a658f9 100644
+index 7a2007931..19b54c343 100644
--- a/drivers/usb/host/xhci-mtk.c
+++ b/drivers/usb/host/xhci-mtk.c
-@@ -571,6 +571,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)
+@@ -575,6 +575,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)
goto disable_device_wakeup;
}
@@ -120,5 +111,5 @@
if (ret)
goto put_usb3_hcd;
--
-2.18.0
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/744-en8811h-2p5gphy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2704-en8811h-2p5gphy-support.patch
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/744-en8811h-2p5gphy-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2704-en8811h-2p5gphy-support.patch
index 5a3e423..5e3c619 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/744-en8811h-2p5gphy-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2704-en8811h-2p5gphy-support.patch
@@ -1,10 +1,25 @@
+From b5aa08e6dd4e06ffd3fb4de2ffc6af1e3da0bce4 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:00 +0800
+Subject: [PATCH]
+ [backport-networking-drivers][999-1703-en8811h-2p5gphy-support.patch]
+
+---
+ drivers/net/phy/Kconfig | 5 +
+ drivers/net/phy/Makefile | 1 +
+ drivers/net/phy/air_en8811h.c | 702 ++++++++++++++++++++++++++++++++++
+ drivers/net/phy/air_en8811h.h | 151 ++++++++
+ 4 files changed, 859 insertions(+)
+ create mode 100644 drivers/net/phy/air_en8811h.c
+ create mode 100644 drivers/net/phy/air_en8811h.h
+
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
-index 207046b..21a4497 100644
+index 170dd00cd..5eeccfee2 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
-@@ -350,6 +350,11 @@ config AIROHA_EN8801SC_PHY
- ---help---
- Currently supports the Airoha EN8801S PHY for MT7981 SoC.
+@@ -345,6 +345,11 @@ config SFP
+ depends on HWMON || HWMON=n
+ select MDIO_I2C
+config AIROHA_EN8811H_PHY
+ tristate "Drivers for Airoha EN8811H 2.5G Gigabit PHY"
@@ -15,10 +30,10 @@
tristate "Analog Devices Industrial Ethernet PHYs"
help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
-index 1b13c02..744b249 100644
+index 2368c1d19..8ea612a85 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
-@@ -71,6 +71,7 @@ ifdef CONFIG_AQUANTIA_PHY_FW_DOWNLOAD
+@@ -67,6 +67,7 @@ aquantia-objs += aquantia_main.o
ifdef CONFIG_HWMON
aquantia-objs += aquantia_hwmon.o
endif
@@ -28,7 +43,7 @@
obj-$(CONFIG_AT803X_PHY) += at803x.o
diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
new file mode 100644
-index 0000000..cf564fc
+index 000000000..cf564fc04
--- /dev/null
+++ b/drivers/net/phy/air_en8811h.c
@@ -0,0 +1,702 @@
@@ -736,7 +751,7 @@
+module_exit(en8811h_phy_driver_unregister);
diff --git a/drivers/net/phy/air_en8811h.h b/drivers/net/phy/air_en8811h.h
new file mode 100644
-index 0000000..1c91627
+index 000000000..1c9162795
--- /dev/null
+++ b/drivers/net/phy/air_en8811h.h
@@ -0,0 +1,151 @@
@@ -891,3 +906,6 @@
+} AIR_LED_MODE_T;
+
+#endif /* End of __EN8811H_MD32_H */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0100-hwnat_Kconfig_Makefile.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2705-hwnat_Kconfig_Makefile.patch
old mode 100755
new mode 100644
similarity index 61%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0100-hwnat_Kconfig_Makefile.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2705-hwnat_Kconfig_Makefile.patch
index e0ac7ab..fbb8410
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0100-hwnat_Kconfig_Makefile.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2705-hwnat_Kconfig_Makefile.patch
@@ -1,6 +1,18 @@
---- a/net/Kconfig 2020-04-29 17:25:49.750444000 +0800
-+++ b/net/Kconfig 2020-04-29 17:42:40.950424000 +0800
-@@ -451,6 +451,18 @@
+From bc06d56dc89af9d13d3b993dae0de46e76dfc3a7 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:28 +0800
+Subject: [PATCH] [networking][999-2705-hwnat_Kconfig_Makefile.patch]
+
+---
+ net/Kconfig | 12 ++++++++++++
+ net/Makefile | 3 +++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/net/Kconfig b/net/Kconfig
+index 46d9b3827..123e4bc28 100644
+--- a/net/Kconfig
++++ b/net/Kconfig
+@@ -460,6 +460,18 @@ config FAILOVER
migration of VMs with direct attached VFs by failing over to the
paravirtual datapath when the VF is unplugged.
@@ -19,9 +31,11 @@
endif # if NET
# Used by archs to tell that they support BPF JIT compiler plus which flavour.
---- a/net/Makefile 2020-04-23 16:36:46.000000000 +0800
-+++ b/net/Makefile 2020-04-29 17:42:58.106487000 +0800
-@@ -62,6 +62,9 @@
+diff --git a/net/Makefile b/net/Makefile
+index 9603e98f0..673f0a664 100644
+--- a/net/Makefile
++++ b/net/Makefile
+@@ -62,6 +62,9 @@ endif
obj-$(CONFIG_6LOWPAN) += 6lowpan/
obj-$(CONFIG_IEEE802154) += ieee802154/
obj-$(CONFIG_MAC802154) += mac802154/
@@ -31,3 +45,6 @@
ifeq ($(CONFIG_NET),y)
obj-$(CONFIG_SYSCTL) += sysctl_net.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2706-crypto-add-eip197-inside-secure-support.patch
similarity index 82%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2706-crypto-add-eip197-inside-secure-support.patch
index 8b9ccce..a144c36 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0505-crypto-add-eip197-inside-secure-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2706-crypto-add-eip197-inside-secure-support.patch
@@ -1,6 +1,19 @@
+From 7baac266ec5e64236ff94447286a9cc74815d259 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:28 +0800
+Subject: [PATCH]
+ [networking][999-2706-crypto-add-eip197-inside-secure-support.patch]
+
+---
+ drivers/crypto/inside-secure/safexcel.c | 69 ++++++++++++++++++++++---
+ drivers/crypto/inside-secure/safexcel.h | 15 ++++++
+ 2 files changed, 78 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
+index 647c5a0c1..6f4fc15b7 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
-@@ -304,6 +304,11 @@
+@@ -304,6 +304,11 @@ static void eip197_init_firmware(struct safexcel_crypto_priv *priv)
/* Enable access to all IFPP program memories */
writel(EIP197_PE_ICE_RAM_CTRL_FPP_PROG_EN,
EIP197_PE(priv) + EIP197_PE_ICE_RAM_CTRL(pe));
@@ -12,7 +25,7 @@
}
}
-@@ -403,13 +408,13 @@
+@@ -403,13 +408,13 @@ static int eip197_load_firmwares(struct safexcel_crypto_priv *priv)
const struct firmware *fw[FW_NB];
char fw_path[37], *dir = NULL;
int i, j, ret = 0, pe;
@@ -28,7 +41,7 @@
else
return -ENODEV;
-@@ -442,6 +447,9 @@
+@@ -442,6 +447,9 @@ retry_fw:
ipuesz = eip197_write_firmware(priv, fw[FW_IPUE]);
@@ -38,7 +51,7 @@
if (eip197_start_firmware(priv, ipuesz, ifppsz, minifw)) {
dev_dbg(priv->dev, "Firmware loaded successfully\n");
return 0;
-@@ -592,6 +600,11 @@
+@@ -592,6 +600,11 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
*/
if (priv->flags & SAFEXCEL_HW_EIP197) {
val = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
@@ -50,7 +63,7 @@
val |= EIP197_MST_CTRL_TX_MAX_CMD(5);
writel(val, EIP197_HIA_AIC(priv) + EIP197_HIA_MST_CTRL);
}
-@@ -792,6 +805,12 @@
+@@ -792,6 +805,12 @@ static int safexcel_hw_init(struct safexcel_crypto_priv *priv)
return ret;
}
@@ -63,7 +76,7 @@
return safexcel_hw_setup_cdesc_rings(priv) ?:
safexcel_hw_setup_rdesc_rings(priv) ?:
0;
-@@ -1498,6 +1517,9 @@
+@@ -1498,6 +1517,9 @@ static int safexcel_probe_generic(void *pdev,
hwopt = readl(EIP197_GLOBAL(priv) + EIP197_OPTIONS);
hiaopt = readl(EIP197_HIA_AIC(priv) + EIP197_HIA_OPTIONS);
@@ -73,7 +86,7 @@
if (priv->flags & SAFEXCEL_HW_EIP197) {
/* EIP197 */
peopt = readl(EIP197_PE(priv) + EIP197_PE_OPTIONS(0));
-@@ -1516,8 +1538,37 @@
+@@ -1516,8 +1538,37 @@ static int safexcel_probe_generic(void *pdev,
EIP197_N_RINGS_MASK;
if (hiaopt & EIP197_HIA_OPT_HAS_PE_ARB)
priv->flags |= EIP197_PE_ARB;
@@ -112,7 +125,7 @@
/* If not a full TRC, then assume simple TRC */
if (!(hwopt & EIP197_OPT_HAS_TRC))
priv->flags |= EIP197_SIMPLE_TRC;
-@@ -1555,13 +1606,14 @@
+@@ -1555,13 +1606,14 @@ static int safexcel_probe_generic(void *pdev,
EIP197_PE_EIP96_OPTIONS(0));
/* Print single info line describing what we just detected */
@@ -129,7 +142,7 @@
safexcel_configure(priv);
-@@ -1690,6 +1742,7 @@
+@@ -1690,6 +1742,7 @@ static int safexcel_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct safexcel_crypto_priv *priv;
@@ -137,7 +150,7 @@
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-@@ -1701,7 +1754,11 @@
+@@ -1701,7 +1754,11 @@ static int safexcel_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
@@ -150,6 +163,8 @@
if (IS_ERR(priv->base)) {
dev_err(dev, "failed to get resource\n");
return PTR_ERR(priv->base);
+diff --git a/drivers/crypto/inside-secure/safexcel.h b/drivers/crypto/inside-secure/safexcel.h
+index c031c197e..e9909c336 100644
--- a/drivers/crypto/inside-secure/safexcel.h
+++ b/drivers/crypto/inside-secure/safexcel.h
@@ -22,6 +22,7 @@
@@ -202,7 +217,7 @@
/* EIP197_STRC_CONFIG */
#define EIP197_STRC_CONFIG_INIT BIT(31)
#define EIP197_STRC_CONFIG_LARGE_REC(s) (s<<8)
-@@ -777,6 +788,7 @@
+@@ -777,6 +788,7 @@ enum safexcel_flags {
EIP197_PE_ARB = BIT(2),
EIP197_ICE = BIT(3),
EIP197_SIMPLE_TRC = BIT(4),
@@ -210,7 +225,7 @@
};
struct safexcel_hwconfig {
-@@ -784,7 +796,10 @@
+@@ -784,7 +796,10 @@ struct safexcel_hwconfig {
int hwver;
int hiaver;
int ppver;
@@ -221,3 +236,6 @@
int hwdataw;
int hwcfsize;
int hwrfsize;
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1001-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2707-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch
similarity index 66%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1001-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2707-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch
index 72719c8..879e79d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1001-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2707-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch
@@ -1,5 +1,15 @@
+From 5583834362f5a9050e701e324f6a9b4d7bf5fcdf Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:29 +0800
+Subject: [PATCH]
+ [networking][999-2707-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch]
+
+---
+ net/core/skbuff.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
-index 5ba1c72f..f4239459 100644
+index 409f33e16..d91b2dfe2 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -69,6 +69,7 @@
@@ -20,3 +30,6 @@
/*
* if shinfo is shared we must drop the old head gracefully, but if it
* is not we can just drop the old head and let the existing refcount
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2709-fix-race-inside-napi-enable.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2709-fix-race-inside-napi-enable.patch
new file mode 100644
index 0000000..0d90686
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2709-fix-race-inside-napi-enable.patch
@@ -0,0 +1,39 @@
+From f57826291fc2ff833c01b39c01fa5b74b69485da Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:29 +0800
+Subject: [PATCH] [networking][999-2709-fix-race-inside-napi-enable.patch]
+
+---
+ net/core/dev.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 81892cd83..503af0034 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -6413,12 +6413,16 @@ EXPORT_SYMBOL(napi_disable);
+ */
+ void napi_enable(struct napi_struct *n)
+ {
+- BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
+- smp_mb__before_atomic();
+- clear_bit(NAPI_STATE_SCHED, &n->state);
+- clear_bit(NAPI_STATE_NPSVC, &n->state);
+- if (n->dev->threaded && n->thread)
+- set_bit(NAPI_STATE_THREADED, &n->state);
++ unsigned long val, new;
++
++ do {
++ val = READ_ONCE(n->state);
++ BUG_ON(!test_bit(NAPI_STATE_SCHED, &val));
++
++ new = val & ~(NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC);
++ if (n->dev->threaded && n->thread)
++ new |= NAPIF_STATE_THREADED;
++ } while (cmpxchg(&n->state, val, new) != val);
+ }
+ EXPORT_SYMBOL(napi_enable);
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2710-net-make-napi-disable-symmetric-with-enable.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2710-net-make-napi-disable-symmetric-with-enable.patch
new file mode 100644
index 0000000..0de5a63
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2710-net-make-napi-disable-symmetric-with-enable.patch
@@ -0,0 +1,48 @@
+From 8e758bb3fc5eee316843eeaad1601ee44ce1c899 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:30 +0800
+Subject: [PATCH]
+ [networking][999-2710-net-make-napi-disable-symmetric-with-enable.patch]
+
+---
+ net/core/dev.c | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 503af0034..cccd7b407 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -6389,18 +6389,25 @@ EXPORT_SYMBOL(netif_napi_add);
+
+ void napi_disable(struct napi_struct *n)
+ {
++ unsigned long val, new;
++
+ might_sleep();
+ set_bit(NAPI_STATE_DISABLE, &n->state);
+
+- while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
+- msleep(1);
+- while (test_and_set_bit(NAPI_STATE_NPSVC, &n->state))
+- msleep(1);
++ do {
++ val = READ_ONCE(n->state);
++ if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
++ usleep_range(20, 200);
++ continue;
++ }
++
++ new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
++ new &= ~(NAPIF_STATE_THREADED);
++ } while (cmpxchg(&n->state, val, new) != val);
+
+ hrtimer_cancel(&n->timer);
+
+ clear_bit(NAPI_STATE_DISABLE, &n->state);
+- clear_bit(NAPI_STATE_THREADED, &n->state);
+ }
+ EXPORT_SYMBOL(napi_disable);
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2711-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2711-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch
new file mode 100644
index 0000000..ef18a49
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2711-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch
@@ -0,0 +1,38 @@
+From a3eac970a1a3e2fc8cdc98acd2594e0578725ad6 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:30 +0800
+Subject: [PATCH]
+ [networking][999-2711-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch]
+
+---
+ net/core/dev.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index cccd7b407..794c768e3 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -6394,7 +6394,7 @@ void napi_disable(struct napi_struct *n)
+ might_sleep();
+ set_bit(NAPI_STATE_DISABLE, &n->state);
+
+- do {
++ for ( ; ; ) {
+ val = READ_ONCE(n->state);
+ if (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
+ usleep_range(20, 200);
+@@ -6403,7 +6403,10 @@ void napi_disable(struct napi_struct *n)
+
+ new = val | NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC;
+ new &= ~(NAPIF_STATE_THREADED);
+- } while (cmpxchg(&n->state, val, new) != val);
++
++ if (cmpxchg(&n->state, val, new) == val)
++ break;
++ }
+
+ hrtimer_cancel(&n->timer);
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/730-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2712-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch
similarity index 68%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/730-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2712-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch
index 6b10584..a76a784 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/730-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2712-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch
@@ -1,6 +1,18 @@
---- linux-5.4.77.orig/net/dsa/tag_mtk.c
-+++ linux-5.4.77/net/dsa/tag_mtk.c
-@@ -73,22 +73,28 @@ static struct sk_buff *mtk_tag_rcv(struc
+From 0f2e84b06686745694f276c4aae6cf9d132a56af Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:30 +0800
+Subject: [PATCH]
+ [networking][999-2712-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch]
+
+---
+ net/dsa/tag_mtk.c | 32 +++++++++++++++++++-------------
+ 1 file changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
+index edc505e07..c386fdc90 100644
+--- a/net/dsa/tag_mtk.c
++++ b/net/dsa/tag_mtk.c
+@@ -80,22 +80,28 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
bool is_multicast_skb = is_multicast_ether_addr(dest) &&
!is_broadcast_ether_addr(dest);
@@ -42,3 +54,6 @@
/* Get source port information */
port = (hdr & MTK_HDR_RECV_SOURCE_PORT_MASK);
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/738-mt7531-gsw-internal_phy_calibration.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2713-mt7531-gsw-internal_phy_calibration.patch
old mode 100755
new mode 100644
similarity index 97%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/738-mt7531-gsw-internal_phy_calibration.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2713-mt7531-gsw-internal_phy_calibration.patch
index 361eca6..e0759b2
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/738-mt7531-gsw-internal_phy_calibration.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2713-mt7531-gsw-internal_phy_calibration.patch
@@ -1,5 +1,21 @@
-Index: drivers/net/phy/mtk/mt753x/Makefile
-===================================================================
+From e17d8763f1279f43edf51a8ceb8b4f78d67eaefa Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:30 +0800
+Subject: [PATCH]
+ [networking][999-2713-mt7531-gsw-internal_phy_calibration.patch]
+
+---
+ drivers/net/phy/mtk/mt753x/Makefile | 2 +-
+ drivers/net/phy/mtk/mt753x/mt7531.c | 21 +
+ drivers/net/phy/mtk/mt753x/mt753x.h | 2 +
+ drivers/net/phy/mtk/mt753x/mt753x_phy.c | 1069 +++++++++++++++++++++++
+ drivers/net/phy/mtk/mt753x/mt753x_phy.h | 145 +++
+ 5 files changed, 1238 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/phy/mtk/mt753x/mt753x_phy.c
+ create mode 100644 drivers/net/phy/mtk/mt753x/mt753x_phy.h
+
+diff --git a/drivers/net/phy/mtk/mt753x/Makefile b/drivers/net/phy/mtk/mt753x/Makefile
+index e304fcb41..b5a63fe91 100644
--- a/drivers/net/phy/mtk/mt753x/Makefile
+++ b/drivers/net/phy/mtk/mt753x/Makefile
@@ -7,5 +7,5 @@ obj-$(CONFIG_MT753X_GSW) += mt753x.o
@@ -9,11 +25,11 @@
- mt753x_common.o mt753x_vlan.o mt753x_nl.o
+ mt753x_common.o mt753x_vlan.o mt753x_nl.o mt753x_phy.o
-Index: drivers/net/phy/mtk/mt753x/mt7531.c
-===================================================================
+diff --git a/drivers/net/phy/mtk/mt753x/mt7531.c b/drivers/net/phy/mtk/mt753x/mt7531.c
+index b27c679a5..512a89a94 100755
--- a/drivers/net/phy/mtk/mt753x/mt7531.c
+++ b/drivers/net/phy/mtk/mt753x/mt7531.c
-@@ -658,6 +658,27 @@ static void mt7531_core_pll_setup(struct
+@@ -662,6 +662,27 @@ static void mt7531_core_pll_setup(struct gsw_mt753x *gsw)
static int mt7531_internal_phy_calibration(struct gsw_mt753x *gsw)
{
@@ -41,11 +57,11 @@
return 0;
}
-Index: drivers/net/phy/mtk/mt753x/mt753x.h
-===================================================================
+diff --git a/drivers/net/phy/mtk/mt753x/mt753x.h b/drivers/net/phy/mtk/mt753x/mt753x.h
+index 344d2b0c6..252ce350f 100644
--- a/drivers/net/phy/mtk/mt753x/mt753x.h
+++ b/drivers/net/phy/mtk/mt753x/mt753x.h
-@@ -140,6 +140,8 @@ void mt753x_irq_enable(struct gsw_mt753x
+@@ -146,6 +146,8 @@ void mt753x_irq_enable(struct gsw_mt753x *gsw);
int mt753x_phy_calibration(struct gsw_mt753x *gsw, u8 phyaddr);
int extphy_init(struct gsw_mt753x *gsw, int addr);
@@ -54,9 +70,9 @@
/* MDIO Indirect Access Registers */
#define MII_MMD_ACC_CTL_REG 0x0d
#define MMD_CMD_S 14
-Index: drivers/net/phy/mtk/mt753x/mt753x_phy.c
-===================================================================
+diff --git a/drivers/net/phy/mtk/mt753x/mt753x_phy.c b/drivers/net/phy/mtk/mt753x/mt753x_phy.c
new file mode 100644
+index 000000000..0c6f9c930
--- /dev/null
+++ b/drivers/net/phy/mtk/mt753x/mt753x_phy.c
@@ -0,0 +1,1069 @@
@@ -1129,9 +1145,9 @@
+
+ return ret;
+}
-Index: drivers/net/phy/mtk/mt753x/mt753x_phy.h
-===================================================================
+diff --git a/drivers/net/phy/mtk/mt753x/mt753x_phy.h b/drivers/net/phy/mtk/mt753x/mt753x_phy.h
new file mode 100644
+index 000000000..1b9e2ea80
--- /dev/null
+++ b/drivers/net/phy/mtk/mt753x/mt753x_phy.h
@@ -0,0 +1,145 @@
@@ -1280,3 +1296,6 @@
+#define DA_TX_I2MPB_D_GBE BITS(8, 13)
+
+#endif /* _MT753X_REGS_H_ */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/739-mt7531-gsw-port5_external_phy_init.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2714-mt7531-gsw-port5_external_phy_init.patch
old mode 100755
new mode 100644
similarity index 87%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/739-mt7531-gsw-port5_external_phy_init.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2714-mt7531-gsw-port5_external_phy_init.patch
index 0d88c60..237c68e
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/739-mt7531-gsw-port5_external_phy_init.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2714-mt7531-gsw-port5_external_phy_init.patch
@@ -1,9 +1,9 @@
-From 9206472ba03032aea120604e8637b52408ca4b3a Mon Sep 17 00:00:00 2001
-From: Landen Chao <landen.chao@mediatek.com>
-Date: Fri, 29 May 2020 15:12:35 +0800
-Subject: [PATCH 2/2] 740_patch
+From 13b169a35dfff523263d20d0d97e46401f6c692f Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:31 +0800
+Subject: [PATCH]
+ [networking][999-2714-mt7531-gsw-port5_external_phy_init.patch]
-Change-Id: I7e0164751702f573d5185c4290ff78688f42f603
---
drivers/net/phy/mtk/mt753x/Makefile | 3 +-
drivers/net/phy/mtk/mt753x/mt7531.c | 3 +
@@ -15,7 +15,7 @@
create mode 100644 drivers/net/phy/mtk/mt753x/mt753x_extphy.h
diff --git a/drivers/net/phy/mtk/mt753x/Makefile b/drivers/net/phy/mtk/mt753x/Makefile
-index 384b0ff7..694ffa83 100644
+index b5a63fe91..16e977528 100644
--- a/drivers/net/phy/mtk/mt753x/Makefile
+++ b/drivers/net/phy/mtk/mt753x/Makefile
@@ -7,5 +7,6 @@ obj-$(CONFIG_MT753X_GSW) += mt753x.o
@@ -27,10 +27,10 @@
+ mt753x_extphy.o
diff --git a/drivers/net/phy/mtk/mt753x/mt7531.c b/drivers/net/phy/mtk/mt753x/mt7531.c
-index 04729835..4a2943b1 100644
+index 512a89a94..3e2187d21 100755
--- a/drivers/net/phy/mtk/mt753x/mt7531.c
+++ b/drivers/net/phy/mtk/mt753x/mt7531.c
-@@ -265,6 +265,9 @@ static int mt7531_set_port_sgmii_force_mode(struct gsw_mt753x *gsw, u32 port,
+@@ -264,6 +264,9 @@ static int mt7531_set_port_sgmii_force_mode(struct gsw_mt753x *gsw, u32 port,
return -EINVAL;
}
@@ -41,11 +41,11 @@
switch (port_cfg->speed) {
diff --git a/drivers/net/phy/mtk/mt753x/mt753x.h b/drivers/net/phy/mtk/mt753x/mt753x.h
-index 5053a7d7..a3f343cd 100644
+index 252ce350f..c23fd9e5f 100644
--- a/drivers/net/phy/mtk/mt753x/mt753x.h
+++ b/drivers/net/phy/mtk/mt753x/mt753x.h
-@@ -154,6 +154,7 @@ void mt753x_irq_worker(struct work_struct *work);
- void mt753x_irq_enable(struct gsw_mt753x *gsw);
+@@ -147,6 +147,7 @@ int mt753x_phy_calibration(struct gsw_mt753x *gsw, u8 phyaddr);
+ int extphy_init(struct gsw_mt753x *gsw, int addr);
int mt753x_phy_calibration(struct gsw_mt753x *gsw, u8 phyaddr);
+int extphy_init(struct gsw_mt753x *gsw, int addr);
@@ -54,7 +54,7 @@
#define MII_MMD_ACC_CTL_REG 0x0d
diff --git a/drivers/net/phy/mtk/mt753x/mt753x_extphy.c b/drivers/net/phy/mtk/mt753x/mt753x_extphy.c
new file mode 100644
-index 00000000..f58e8a62
+index 000000000..f58e8a62d
--- /dev/null
+++ b/drivers/net/phy/mtk/mt753x/mt753x_extphy.c
@@ -0,0 +1,69 @@
@@ -129,7 +129,7 @@
+}
diff --git a/drivers/net/phy/mtk/mt753x/mt753x_extphy.h b/drivers/net/phy/mtk/mt753x/mt753x_extphy.h
new file mode 100644
-index 00000000..2b72c8a9
+index 000000000..2b72c8a9d
--- /dev/null
+++ b/drivers/net/phy/mtk/mt753x/mt753x_extphy.h
@@ -0,0 +1,18 @@
@@ -152,5 +152,5 @@
+};
+#endif
--
-2.17.1
+2.34.1
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2715-add-gpy211-phy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2715-add-gpy211-phy-support.patch
new file mode 100644
index 0000000..7613c86
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2715-add-gpy211-phy-support.patch
@@ -0,0 +1,41 @@
+From e18ad3270a1bdd776f5d7b13c4756efbd890825b Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:31 +0800
+Subject: [PATCH] [networking][999-2715-add-gpy211-phy-support.patch]
+
+---
+ drivers/net/phy/Kconfig | 5 +++++
+ drivers/net/phy/Makefile | 1 +
+ 2 files changed, 6 insertions(+)
+
+diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
+index ec5c66d0a..3a3c12566 100644
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -473,6 +473,11 @@ config FIXED_PHY
+
+ Currently tested with mpc866ads and mpc8349e-mitx.
+
++config GPY211_PHY
++ tristate "GPY211 PHY"
++ ---help---
++ Supports the Intel GPY211 PHY with rate adaption.
++
+ config ICPLUS_PHY
+ tristate "ICPlus PHYs"
+ ---help---
+diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
+index f4feb0e3d..1d368d1d5 100644
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -88,6 +88,7 @@ obj-$(CONFIG_DP83TC811_PHY) += dp83tc811.o
+ obj-$(CONFIG_DP83848_PHY) += dp83848.o
+ obj-$(CONFIG_DP83867_PHY) += dp83867.o
+ obj-$(CONFIG_FIXED_PHY) += fixed_phy.o
++obj-$(CONFIG_GPY211_PHY) += gpy211.o
+ obj-$(CONFIG_ICPLUS_PHY) += icplus.o
+ obj-$(CONFIG_INTEL_XWAY_PHY) += intel-xway.o
+ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2716-en8801sc-gphy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2716-en8801sc-gphy-support.patch
new file mode 100644
index 0000000..47168b9
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2716-en8801sc-gphy-support.patch
@@ -0,0 +1,41 @@
+From 43abbf9e88d9cf44e123a17d6d46db06fbb51da7 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:31 +0800
+Subject: [PATCH] [networking][999-2716-en8801sc-gphy-support.patch]
+
+---
+ drivers/net/phy/Kconfig | 5 +++++
+ drivers/net/phy/Makefile | 1 +
+ 2 files changed, 6 insertions(+)
+
+diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
+index 3a3c12566..87eaaad76 100644
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -345,6 +345,11 @@ config SFP
+ depends on HWMON || HWMON=n
+ select MDIO_I2C
+
++config AIROHA_EN8801SC_PHY
++ tristate "Drivers for Airoha EN8801S Gigabit PHYs for MediaTek SoC."
++ ---help---
++ Currently supports the Airoha EN8801S PHY for MediaTek SoC.
++
+ config AIROHA_EN8811H_PHY
+ tristate "Drivers for Airoha EN8811H 2.5G Gigabit PHY"
+ ---help---
+diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
+index 1d368d1d5..801550726 100644
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -68,6 +68,7 @@ aquantia-objs += aquantia_main.o
+ ifdef CONFIG_HWMON
+ aquantia-objs += aquantia_hwmon.o
+ endif
++obj-$(CONFIG_AIROHA_EN8801SC_PHY) += en8801sc.o
+ obj-$(CONFIG_AIROHA_EN8811H_PHY) += air_en8811h.o
+ obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o
+ obj-$(CONFIG_AX88796B_PHY) += ax88796b.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2717-add-mediatek-2p5ge-phy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2717-add-mediatek-2p5ge-phy-support.patch
new file mode 100644
index 0000000..b750c57
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2717-add-mediatek-2p5ge-phy-support.patch
@@ -0,0 +1,41 @@
+From d3e70b511ec583b7cced3ffd3c34700084c9149d Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:31 +0800
+Subject: [PATCH] [networking][999-2717-add-mediatek-2p5ge-phy-support.patch]
+
+---
+ drivers/net/phy/Kconfig | 5 +++++
+ drivers/net/phy/Makefile | 1 +
+ 2 files changed, 6 insertions(+)
+
+diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
+index 87eaaad76..45aaf7203 100644
+--- a/drivers/net/phy/Kconfig
++++ b/drivers/net/phy/Kconfig
+@@ -539,6 +539,11 @@ config MEDIATEK_GE_SOC_PHY
+ present in the SoCs efuse and will dynamically calibrate VCM
+ (common-mode voltage) during startup.
+
++config MEDIATEK_2P5GE_PHY
++ tristate "MediaTek 2.5Gb Ethernet PHYs"
++ ---help---
++ Supports MediaTek internal 2.5Gb Ethernet PHYs.
++
+ config MICREL_PHY
+ tristate "Micrel PHYs"
+ ---help---
+diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
+index 801550726..998de790e 100644
+--- a/drivers/net/phy/Makefile
++++ b/drivers/net/phy/Makefile
+@@ -98,6 +98,7 @@ obj-$(CONFIG_MARVELL_PHY) += marvell.o
+ obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o
+ obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o
+ obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o
++obj-$(CONFIG_MEDIATEK_2P5GE_PHY)+= mediatek-2p5ge.o
+ obj-$(CONFIG_MESON_GXL_PHY) += meson-gxl.o
+ obj-$(CONFIG_MICREL_KS8995MA) += spi_ks8995.o
+ obj-$(CONFIG_MICREL_PHY) += micrel.o
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-mxl-gpy-phy-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2718-mxl-gpy-phy-support.patch
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-mxl-gpy-phy-support.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2718-mxl-gpy-phy-support.patch
index 5ff2798..a4cc28a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/746-mxl-gpy-phy-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2718-mxl-gpy-phy-support.patch
@@ -1,3 +1,17 @@
+From 4dad0228a64a810460928cd55c4dee0dd35708a0 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:32 +0800
+Subject: [PATCH] [networking][999-2718-mxl-gpy-phy-support.patch]
+
+---
+ drivers/net/phy/Kconfig | 6 +
+ drivers/net/phy/Makefile | 1 +
+ drivers/net/phy/mxl-gpy.c | 738 ++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 745 insertions(+)
+ create mode 100644 drivers/net/phy/mxl-gpy.c
+
+diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
+index 45aaf7203..c0e09c99d 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -516,6 +516,12 @@ config MARVELL_10G_PHY
@@ -13,9 +27,11 @@
config MESON_GXL_PHY
tristate "Amlogic Meson GXL Internal PHY"
depends on ARCH_MESON || COMPILE_TEST
+diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
+index 998de790e..8b57d6105 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
-@@ -95,6 +95,7 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c
+@@ -96,6 +96,7 @@ obj-$(CONFIG_LSI_ET1011C_PHY) += et1011c.o
obj-$(CONFIG_LXT_PHY) += lxt.o
obj-$(CONFIG_MARVELL_PHY) += marvell.o
obj-$(CONFIG_MARVELL_10G_PHY) += marvell10g.o
@@ -23,6 +39,9 @@
obj-$(CONFIG_MEDIATEK_GE_PHY) += mediatek-ge.o
obj-$(CONFIG_MEDIATEK_GE_SOC_PHY) += mediatek-ge-soc.o
obj-$(CONFIG_MEDIATEK_2P5GE_PHY)+= mediatek-2p5ge.o
+diff --git a/drivers/net/phy/mxl-gpy.c b/drivers/net/phy/mxl-gpy.c
+new file mode 100644
+index 000000000..730427832
--- /dev/null
+++ b/drivers/net/phy/mxl-gpy.c
@@ -0,0 +1,738 @@
@@ -764,3 +783,6 @@
+MODULE_DESCRIPTION("Maxlinear Ethernet GPY Driver");
+MODULE_AUTHOR("Xu Liang");
+MODULE_LICENSE("GPL");
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
similarity index 96%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
index 0e38dad..c128bbe 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
@@ -1,5 +1,20 @@
+From 2fd17c806f5ad23f9958c358cdc26f618f05d5df Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:32 +0800
+Subject: [PATCH]
+ [networking][999-2719-net-phy-aquantia-add-firmware-download.patch]
+
+---
+ drivers/net/phy/Kconfig | 33 +-
+ drivers/net/phy/Makefile | 3 +
+ drivers/net/phy/aquantia.h | 64 ++
+ drivers/net/phy/aquantia_firmware.c | 1090 +++++++++++++++++++++++++++
+ drivers/net/phy/aquantia_main.c | 92 ++-
+ 5 files changed, 1241 insertions(+), 41 deletions(-)
+ create mode 100644 drivers/net/phy/aquantia_firmware.c
+
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
-index 7b49c94..5a79af2 100644
+index c0e09c99d..d467834eb 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -372,7 +372,38 @@ config AMD_PHY
@@ -43,10 +58,10 @@
config AX88796B_PHY
tristate "Asix PHYs"
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
-index 043a697..4f67110 100644
+index 8b57d6105..e9653de36 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
-@@ -67,5 +67,8 @@ aquantia-objs += aquantia_main.o
+@@ -68,6 +68,9 @@ aquantia-objs += aquantia_main.o
ifdef CONFIG_HWMON
aquantia-objs += aquantia_hwmon.o
endif
@@ -54,9 +69,10 @@
+aquantia-objs += aquantia_firmware.o
+endif
obj-$(CONFIG_AIROHA_EN8801SC_PHY) += en8801sc.o
+ obj-$(CONFIG_AIROHA_EN8811H_PHY) += air_en8811h.o
obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o
diff --git a/drivers/net/phy/aquantia.h b/drivers/net/phy/aquantia.h
-index 5a16caa..ab1c241 100644
+index 5a16caab7..ab1c241d3 100644
--- a/drivers/net/phy/aquantia.h
+++ b/drivers/net/phy/aquantia.h
@@ -9,8 +9,72 @@
@@ -134,10 +150,10 @@
+#endif
diff --git a/drivers/net/phy/aquantia_firmware.c b/drivers/net/phy/aquantia_firmware.c
new file mode 100644
-index 0000000..622557c
+index 000000000..d2828aad4
--- /dev/null
+++ b/drivers/net/phy/aquantia_firmware.c
-@@ -0,0 +1,1090 @@
+@@ -0,0 +1,1091 @@
+// SPDX-License-Identifier: GPL-2.0
+/* FW download driver for Aquantia PHY
+ */
@@ -1196,7 +1212,8 @@
+ "aqr_firmware_gandload_thread");
+ if (IS_ERR(gangload_kthread)) {
+ dev_err(dev,
-+ "failed to create aqr_firmware_gandload_thread\n");
++ "failed to create aqr_firmware_gandload_thread(%ld)\n",
++ PTR_ERR(gangload_kthread));
+ return PTR_ERR(gangload_kthread);
+ }
+ wake_up_process(gangload_kthread);
@@ -1229,7 +1246,7 @@
+ return ret;
+}
diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c
-index a8c828b..d98757f 100644
+index e7495c9a7..36f1aac4f 100644
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -8,10 +8,12 @@
@@ -1245,7 +1262,7 @@
#include "aquantia.h"
-@@ -39,7 +40,6 @@
+@@ -39,7 +41,6 @@
#define MDIO_AN_VEND_PROV_2500BASET_FULL BIT(10)
#define MDIO_AN_VEND_PROV_DOWNSHIFT_EN BIT(4)
#define MDIO_AN_VEND_PROV_DOWNSHIFT_MASK GENMASK(3, 0)
@@ -1253,7 +1270,7 @@
#define MDIO_AN_TX_VEND_STATUS1 0xc800
#define MDIO_AN_TX_VEND_STATUS1_RATE_MASK GENMASK(3, 1)
-@@ -73,18 +73,6 @@
+@@ -73,18 +74,6 @@
#define MDIO_AN_RX_VEND_STAT3 0xe832
#define MDIO_AN_RX_VEND_STAT3_AFR BIT(0)
@@ -1272,7 +1289,7 @@
/* Vendor specific 1, MDIO_MMD_VEND1 */
#define VEND1_GLOBAL_FW_ID 0x0020
#define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8)
-@@ -124,31 +112,6 @@
+@@ -124,31 +113,6 @@
#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2 BIT(1)
#define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3 BIT(0)
@@ -1304,7 +1321,7 @@
static int aqr107_get_sset_count(struct phy_device *phydev)
{
return AQR107_SGMII_STAT_SZ;
-@@ -422,7 +361,7 @@ static int aqr107_get_downshift(struct phy_device *phydev, u8 *data)
+@@ -398,7 +362,7 @@ static int aqr107_get_downshift(struct phy_device *phydev, u8 *data)
return 0;
}
@@ -1313,7 +1330,7 @@
{
int val = 0;
-@@ -482,7 +421,7 @@ static int aqr107_wait_reset_complete(struct phy_device *phydev)
+@@ -458,7 +422,7 @@ static int aqr107_wait_reset_complete(struct phy_device *phydev)
return val ? 0 : -ETIMEDOUT;
}
@@ -1322,7 +1339,7 @@
{
u8 fw_major, fw_minor, build_id, prov_id;
int val;
-@@ -505,6 +444,21 @@ static void aqr107_chip_info(struct phy_device *phydev)
+@@ -481,6 +445,21 @@ static void aqr107_chip_info(struct phy_device *phydev)
fw_major, fw_minor, build_id, prov_id);
}
@@ -1344,7 +1361,7 @@
static int aqr107_config_init(struct phy_device *phydev)
{
int ret;
-@@ -520,6 +470,12 @@ static int aqr107_config_init(struct phy_device *phydev)
+@@ -499,6 +478,12 @@ static int aqr107_config_init(struct phy_device *phydev)
ret = aqr107_wait_reset_complete(phydev);
if (!ret)
aqr107_chip_info(phydev);
@@ -1357,7 +1374,7 @@
return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT);
}
-@@ -604,12 +556,39 @@ static void aqr107_link_change_notify(struct phy_device *phydev)
+@@ -574,12 +559,41 @@ static void aqr107_link_change_notify(struct phy_device *phydev)
static int aqr107_suspend(struct phy_device *phydev)
{
@@ -1388,12 +1405,17 @@
+ "aqr_firmware_heartbeat_thread");
+ if (IS_ERR(priv->heartbeat_thread)) {
+ phydev_err(phydev,
-+ "Failed to create aqr_firmware_heartbeat_thread\n");
-+ }
-+ wake_up_process(priv->heartbeat_thread);
++ "Failed to create aqr_firmware_heartbeat_thread(%ld)\n",
++ PTR_ERR(priv->heartbeat_thread));
++ priv->heartbeat_thread = NULL;
++ } else
++ wake_up_process(priv->heartbeat_thread);
+ }
+ spin_unlock(&priv->lock);
+#endif
return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1,
MDIO_CTRL1_LPOWER);
}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/752-net-dsa-phy-coverity-scan.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2720-net-dsa-phy-coverity-scan.patch
old mode 100755
new mode 100644
similarity index 78%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/752-net-dsa-phy-coverity-scan.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2720-net-dsa-phy-coverity-scan.patch
index 17921e8..dfdb019
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/752-net-dsa-phy-coverity-scan.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2720-net-dsa-phy-coverity-scan.patch
@@ -1,7 +1,18 @@
-diff -Naur a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
---- a/drivers/net/dsa/mt7530.c 2022-11-25 14:10:39.452491570 +0800
-+++ b/drivers/net/dsa/mt7530.c 2022-11-28 09:47:11.157096408 +0800
-@@ -2476,7 +2476,7 @@
+From 98719219a038adac88f2fae9caaecb7e84704d09 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:32 +0800
+Subject: [PATCH] [networking][999-2720-net-dsa-phy-coverity-scan.patch]
+
+---
+ drivers/net/dsa/mt7530.c | 4 ++-
+ drivers/net/dsa/mt7531_phy.c | 56 +++++++++++++++++++-----------------
+ 2 files changed, 32 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
+index 290a2e77a..21fa3e300 100644
+--- a/drivers/net/dsa/mt7530.c
++++ b/drivers/net/dsa/mt7530.c
+@@ -2477,7 +2477,7 @@ static int
mt7531_cpu_port_config(struct dsa_switch *ds, int port)
{
struct mt7530_priv *priv = ds->priv;
@@ -10,7 +21,7 @@
int speed;
switch (port) {
-@@ -2496,6 +2496,8 @@
+@@ -2497,6 +2497,8 @@ mt7531_cpu_port_config(struct dsa_switch *ds, int port)
priv->p6_interface = interface;
break;
};
@@ -19,10 +30,11 @@
if (interface == PHY_INTERFACE_MODE_2500BASEX)
speed = SPEED_2500;
-diff -Naur a/drivers/net/dsa/mt7531_phy.c b/drivers/net/dsa/mt7531_phy.c
---- a/drivers/net/dsa/mt7531_phy.c 2022-11-25 14:10:47.032465430 +0800
-+++ b/drivers/net/dsa/mt7531_phy.c 2022-11-29 09:56:05.024665073 +0800
-@@ -252,7 +252,7 @@
+diff --git a/drivers/net/dsa/mt7531_phy.c b/drivers/net/dsa/mt7531_phy.c
+index a5c1e7d54..aaa03c678 100644
+--- a/drivers/net/dsa/mt7531_phy.c
++++ b/drivers/net/dsa/mt7531_phy.c
+@@ -252,7 +252,7 @@ static int ge_cal_rext(struct dsa_switch *ds, u8 phyaddr, u32 delay)
u16 dev1e_17a_tmp, dev1e_e0_tmp;
/* *** Iext/Rext Cal start ************ */
@@ -31,7 +43,7 @@
/* analog calibration enable, Rext calibration enable */
/* 1e_db[12]:rg_cal_ckinv, [8]:rg_ana_calen, [4]:rg_rext_calen, [0]:rg_zcalen_a */
/* 1e_dc[0]:rg_txvos_calen */
-@@ -296,7 +296,7 @@
+@@ -296,7 +296,7 @@ static int ge_cal_rext(struct dsa_switch *ds, u8 phyaddr, u32 delay)
all_ana_cal_status = ANACAL_FINISH;
//printk(" GE Rext AnaCal Done! (%d)(0x%x) \r\n", cnt, rg_zcal_ctrl);
} else {
@@ -40,7 +52,7 @@
dev1e_e0_tmp = tc_phy_read_dev_reg(ds, PHY0, 0x1e, 0xe0);
if ((rg_zcal_ctrl == 0x3F) || (rg_zcal_ctrl == 0x00)) {
all_ana_cal_status = ANACAL_SATURATION; /* need to FT(IC fail?) */
-@@ -718,32 +718,34 @@
+@@ -718,32 +718,34 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
} else if (phyaddr == 1) {
if (calibration_pair == ANACAL_PAIR_A)
tx_amp_temp = tx_amp_temp - 1;
@@ -91,7 +103,7 @@
}
reg_temp = tc_phy_read_dev_reg(ds, phyaddr, 0x1e, tx_amp_reg)&(~0xff00);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, tx_amp_reg_100,(tx_amp_temp|((tx_amp_temp)<<tx_amp_reg_shift)));
-@@ -858,7 +860,7 @@
+@@ -858,7 +860,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = 0x0000;
reg_backup |= ((tx_amp_temp << 10) | (tx_amp_temp << 0));
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x12, reg_backup);
@@ -100,7 +112,7 @@
//printk("PORT[%d] 1e.012 = %x (OFFSET_1000M_PAIR_A)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(ds, phyaddr, 0x1e, 0x16);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -866,7 +868,7 @@
+@@ -866,7 +868,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (tx_amp_temp << 0);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x16, reg_backup);
@@ -109,7 +121,7 @@
//printk("PORT[%d] 1e.016 = %x (OFFSET_TESTMODE_1000M_PAIR_A)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_B){
-@@ -876,7 +878,7 @@
+@@ -876,7 +878,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = 0x0000;
reg_backup |= ((tx_amp_temp << 8) | (tx_amp_temp << 0));
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x17, reg_backup);
@@ -118,7 +130,7 @@
//printk("PORT[%d] 1e.017 = %x (OFFSET_1000M_PAIR_B)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(ds, phyaddr, 0x1e, 0x18);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -884,7 +886,7 @@
+@@ -884,7 +886,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (tx_amp_temp << 0);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x18, reg_backup);
@@ -127,7 +139,7 @@
//printk("PORT[%d] 1e.018 = %x (OFFSET_TESTMODE_1000M_PAIR_B)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_C){
-@@ -894,7 +896,7 @@
+@@ -894,7 +896,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f00));
reg_backup |= (tx_amp_temp << 8);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x19, reg_backup);
@@ -136,7 +148,7 @@
//printk("PORT[%d] 1e.019 = %x (OFFSET_1000M_PAIR_C)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(ds, phyaddr, 0x1e, 0x20);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -902,7 +904,7 @@
+@@ -902,7 +904,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (tx_amp_temp << 0);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x20, reg_backup);
@@ -145,7 +157,7 @@
//printk("PORT[%d] 1e.020 = %x (OFFSET_TESTMODE_1000M_PAIR_C)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_D){
-@@ -912,7 +914,7 @@
+@@ -912,7 +914,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f00));
reg_backup |= (tx_amp_temp << 8);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x21, reg_backup);
@@ -154,7 +166,7 @@
//printk("PORT[%d] 1e.021 = %x (OFFSET_1000M_PAIR_D)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(ds, phyaddr, 0x1e, 0x22);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -920,7 +922,7 @@
+@@ -920,7 +922,7 @@ static int ge_cal_tx_amp(struct dsa_switch *ds, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (tx_amp_temp << 0);
tc_phy_write_dev_reg(ds, phyaddr, 0x1e, 0x22, reg_backup);
@@ -163,7 +175,7 @@
//printk("PORT[%d] 1e.022 = %x (OFFSET_TESTMODE_1000M_PAIR_D)\n", phyaddr, reg_backup);
}
-@@ -1352,7 +1354,7 @@
+@@ -1352,7 +1354,7 @@ static void mt7531_eee_setting(struct dsa_switch *ds, u32 port)
int mt7531_phy_setup(struct dsa_switch *ds)
{
@@ -172,4 +184,6 @@
int i;
mt7531_phy_setting(ds);
-
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/753-net-mt753x-phy-coverity-scan.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2721-net-mt753x-phy-coverity-scan.patch
old mode 100755
new mode 100644
similarity index 79%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/753-net-mt753x-phy-coverity-scan.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2721-net-mt753x-phy-coverity-scan.patch
index c4d7d4c..a9b1316
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/753-net-mt753x-phy-coverity-scan.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2721-net-mt753x-phy-coverity-scan.patch
@@ -1,7 +1,18 @@
-diff -Naur a/drivers/net/phy/mtk/mt753x/mt753x_common.c b/drivers/net/phy/mtk/mt753x/mt753x_common.c
---- a/drivers/net/phy/mtk/mt753x/mt753x_common.c 2022-11-25 14:12:06.308223474 +0800
-+++ b/drivers/net/phy/mtk/mt753x/mt753x_common.c 2022-11-25 14:21:52.038450276 +0800
-@@ -49,6 +49,9 @@
+From 520aea1caf199f454a0988f23d000c18256caa2b Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:32 +0800
+Subject: [PATCH] [networking][999-2721-net-mt753x-phy-coverity-scan.patch]
+
+---
+ drivers/net/phy/mtk/mt753x/mt753x_common.c | 3 ++
+ drivers/net/phy/mtk/mt753x/mt753x_phy.c | 56 +++++++++++-----------
+ 2 files changed, 32 insertions(+), 27 deletions(-)
+
+diff --git a/drivers/net/phy/mtk/mt753x/mt753x_common.c b/drivers/net/phy/mtk/mt753x/mt753x_common.c
+index 4015ddf12..0e08c8532 100644
+--- a/drivers/net/phy/mtk/mt753x/mt753x_common.c
++++ b/drivers/net/phy/mtk/mt753x/mt753x_common.c
+@@ -49,6 +49,9 @@ static void display_port_link_status(struct gsw_mt753x *gsw, u32 port)
case MAC_SPD_2500:
speed = "2.5Gbps";
break;
@@ -11,10 +22,11 @@
}
if (pmsr & MAC_LNK_STS) {
-diff -Naur a/drivers/net/phy/mtk/mt753x/mt753x_phy.c b/drivers/net/phy/mtk/mt753x/mt753x_phy.c
---- a/drivers/net/phy/mtk/mt753x/mt753x_phy.c 2022-11-25 14:12:34.160149995 +0800
-+++ b/drivers/net/phy/mtk/mt753x/mt753x_phy.c 2022-11-29 14:12:28.261884707 +0800
-@@ -141,7 +141,7 @@
+diff --git a/drivers/net/phy/mtk/mt753x/mt753x_phy.c b/drivers/net/phy/mtk/mt753x/mt753x_phy.c
+index 0c6f9c930..afc46cdd8 100644
+--- a/drivers/net/phy/mtk/mt753x/mt753x_phy.c
++++ b/drivers/net/phy/mtk/mt753x/mt753x_phy.c
+@@ -141,7 +141,7 @@ int ge_cal_rext(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
u16 dev1e_17a_tmp, dev1e_e0_tmp;
/* *** Iext/Rext Cal start ************ */
@@ -23,7 +35,7 @@
/* analog calibration enable, Rext calibration enable */
/* 1e_db[12]:rg_cal_ckinv, [8]:rg_ana_calen, [4]:rg_rext_calen, [0]:rg_zcalen_a */
/* 1e_dc[0]:rg_txvos_calen */
-@@ -185,7 +185,7 @@
+@@ -185,7 +185,7 @@ int ge_cal_rext(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
all_ana_cal_status = ANACAL_FINISH;
//printk(" GE Rext AnaCal Done! (%d)(0x%x) \r\n", cnt, rg_zcal_ctrl);
} else {
@@ -32,7 +44,7 @@
dev1e_e0_tmp = tc_phy_read_dev_reg(gsw, PHY0, 0x1e, 0xe0);
if ((rg_zcal_ctrl == 0x3F) || (rg_zcal_ctrl == 0x00)) {
all_ana_cal_status = ANACAL_SATURATION; /* need to FT(IC fail?) */
-@@ -580,33 +580,35 @@
+@@ -580,33 +580,35 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
} else if (phyaddr == 1) {
if (calibration_pair == ANACAL_PAIR_A)
tx_amp_temp = tx_amp_temp - 1;
@@ -85,7 +97,7 @@
reg_temp = tc_phy_read_dev_reg(gsw, phyaddr, 0x1e, tx_amp_reg)&(~0xff00);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, tx_amp_reg_100,(tx_amp_temp|((tx_amp_temp)<<tx_amp_reg_shift)));
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, tx_amp_reg, (tx_amp_temp|((tx_amp_temp)<<tx_amp_reg_shift)));
-@@ -704,7 +706,7 @@
+@@ -704,7 +706,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = 0x0000;
reg_backup |= ((reg_tmp << 10) | (reg_tmp << 0));
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x12, reg_backup);
@@ -94,7 +106,7 @@
//printk("PORT[%d] 1e.012 = %x (OFFSET_1000M_PAIR_A)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(gsw, phyaddr, 0x1e, 0x16);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -712,7 +714,7 @@
+@@ -712,7 +714,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (reg_tmp << 0);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x16, reg_backup);
@@ -103,7 +115,7 @@
//printk("PORT[%d] 1e.016 = %x (OFFSET_TESTMODE_1000M_PAIR_A)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_B){
-@@ -722,7 +724,7 @@
+@@ -722,7 +724,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = 0x0000;
reg_backup |= ((reg_tmp << 8) | (reg_tmp << 0));
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x17, reg_backup);
@@ -112,7 +124,7 @@
//printk("PORT[%d] 1e.017 = %x (OFFSET_1000M_PAIR_B)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(gsw, phyaddr, 0x1e, 0x18);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -730,7 +732,7 @@
+@@ -730,7 +732,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (reg_tmp << 0);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x18, reg_backup);
@@ -121,7 +133,7 @@
//printk("PORT[%d] 1e.018 = %x (OFFSET_TESTMODE_1000M_PAIR_B)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_C){
-@@ -740,7 +742,7 @@
+@@ -740,7 +742,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f00));
reg_backup |= (reg_tmp << 8);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x19, reg_backup);
@@ -130,7 +142,7 @@
//printk("PORT[%d] 1e.019 = %x (OFFSET_1000M_PAIR_C)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(gsw, phyaddr, 0x1e, 0x20);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -748,7 +750,7 @@
+@@ -748,7 +750,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (reg_tmp << 0);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x20, reg_backup);
@@ -139,7 +151,7 @@
//printk("PORT[%d] 1e.020 = %x (OFFSET_TESTMODE_1000M_PAIR_C)\n", phyaddr, reg_backup);
}
else if(calibration_pair == ANACAL_PAIR_D){
-@@ -758,7 +760,7 @@
+@@ -758,7 +760,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f00));
reg_backup |= (reg_tmp << 8);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x21, reg_backup);
@@ -148,7 +160,7 @@
//printk("PORT[%d] 1e.021 = %x (OFFSET_1000M_PAIR_D)\n", phyaddr, reg_backup);
reg_backup = tc_phy_read_dev_reg(gsw, phyaddr, 0x1e, 0x22);
reg_tmp = ((reg_backup & 0x3f) >> 0);
-@@ -766,7 +768,7 @@
+@@ -766,7 +768,7 @@ int ge_cal_tx_amp(struct gsw_mt753x *gsw, u8 phyaddr, u32 delay)
reg_backup = (reg_backup & (~0x3f));
reg_backup |= (reg_tmp << 0);
tc_phy_write_dev_reg(gsw, phyaddr, 0x1e, 0x22, reg_backup);
@@ -157,3 +169,6 @@
//printk("PORT[%d] 1e.022 = %x (OFFSET_TESTMODE_1000M_PAIR_D)\n", phyaddr, reg_backup);
}
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2722-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2722-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch
new file mode 100644
index 0000000..8e87e12
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2722-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch
@@ -0,0 +1,24 @@
+From 14155ead210d465dc00552fa2537bdafc25054a5 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:33 +0800
+Subject: [PATCH]
+ [networking][999-2722-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch]
+
+---
+ include/dt-bindings/phy/phy.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
+index b6a1eaf1b..1f3f866fa 100644
+--- a/include/dt-bindings/phy/phy.h
++++ b/include/dt-bindings/phy/phy.h
+@@ -16,5 +16,6 @@
+ #define PHY_TYPE_USB2 3
+ #define PHY_TYPE_USB3 4
+ #define PHY_TYPE_UFS 5
++#define PHY_TYPE_DP 6
+
+ #endif /* _DT_BINDINGS_PHY */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch
new file mode 100644
index 0000000..c0e2127
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch
@@ -0,0 +1,24 @@
+From 971fc691db21a6d231545f8519d920301818c2d5 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:33 +0800
+Subject: [PATCH]
+ [networking][999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch]
+
+---
+ include/dt-bindings/phy/phy.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
+index 1f3f866fa..3727ef721 100644
+--- a/include/dt-bindings/phy/phy.h
++++ b/include/dt-bindings/phy/phy.h
+@@ -17,5 +17,6 @@
+ #define PHY_TYPE_USB3 4
+ #define PHY_TYPE_UFS 5
+ #define PHY_TYPE_DP 6
++#define PHY_TYPE_XPCS 7
+
+ #endif /* _DT_BINDINGS_PHY */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch
new file mode 100644
index 0000000..41db424
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch
@@ -0,0 +1,24 @@
+From 313a776ae1ef71f826cd39545e358a3735c1a032 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:33 +0800
+Subject: [PATCH]
+ [networking][999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch]
+
+---
+ include/dt-bindings/phy/phy.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/dt-bindings/phy/phy.h b/include/dt-bindings/phy/phy.h
+index 3727ef721..36e8c241c 100644
+--- a/include/dt-bindings/phy/phy.h
++++ b/include/dt-bindings/phy/phy.h
+@@ -18,5 +18,6 @@
+ #define PHY_TYPE_UFS 5
+ #define PHY_TYPE_DP 6
+ #define PHY_TYPE_XPCS 7
++#define PHY_TYPE_SGMII 8
+
+ #endif /* _DT_BINDINGS_PHY */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2725-iwconfig-wireless-rate-fix.patch
similarity index 63%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2725-iwconfig-wireless-rate-fix.patch
index b29e4cc..951afc2 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9010-iwconfig-wireless-rate-fix.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2725-iwconfig-wireless-rate-fix.patch
@@ -1,20 +1,34 @@
---- a/include/uapi/linux/wireless.h
-+++ b/include/uapi/linux/wireless.h
-@@ -678,7 +678,7 @@
- * Generic format for most parameters that fit in an int
- */
- struct iw_param {
-- __s32 value; /* The value of the parameter itself */
-+ __u64 value; /* The value of the parameter itself */
- __u8 fixed; /* Hardware should not use auto select */
- __u8 disabled; /* Disable the feature */
- __u16 flags; /* Various specifc flags (if any) */
-@@ -1002,7 +1002,7 @@ struct iw_range {
-
- /* Rates */
- __u8 num_bitrates; /* Number of entries in the list */
-- __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
-+ __u64 bitrate[IW_MAX_BITRATES]; /* list, in bps */
-
- /* RTS threshold */
- __s32 min_rts; /* Minimal RTS threshold */
+From 572be3e7a2e9f41c64dd6c8c89cc763b97ecab6c Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:33 +0800
+Subject: [PATCH] [networking][999-2725-iwconfig-wireless-rate-fix.patch]
+
+---
+ include/uapi/linux/wireless.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/uapi/linux/wireless.h b/include/uapi/linux/wireless.h
+index 24f3371ad..590c90b14 100644
+--- a/include/uapi/linux/wireless.h
++++ b/include/uapi/linux/wireless.h
+@@ -678,7 +678,7 @@
+ * Generic format for most parameters that fit in an int
+ */
+ struct iw_param {
+- __s32 value; /* The value of the parameter itself */
++ __u64 value; /* The value of the parameter itself */
+ __u8 fixed; /* Hardware should not use auto select */
+ __u8 disabled; /* Disable the feature */
+ __u16 flags; /* Various specifc flags (if any) */
+@@ -1002,7 +1002,7 @@ struct iw_range {
+
+ /* Rates */
+ __u8 num_bitrates; /* Number of entries in the list */
+- __s32 bitrate[IW_MAX_BITRATES]; /* list, in bps */
++ __u64 bitrate[IW_MAX_BITRATES]; /* list, in bps */
+
+ /* RTS threshold */
+ __s32 min_rts; /* Minimal RTS threshold */
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2800-misc-add-mtk-platform.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2800-misc-add-mtk-platform.patch
new file mode 100644
index 0000000..19cab49
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2800-misc-add-mtk-platform.patch
@@ -0,0 +1,32 @@
+From cbf9eb1b168ed4b650d464512f6502d3d1668813 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:34 +0800
+Subject: [PATCH] [misc][999-2800-misc-add-mtk-platform.patch]
+
+---
+ drivers/misc/Kconfig | 1 +
+ drivers/misc/Makefile | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
+index c55b63750..4cd30fab5 100644
+--- a/drivers/misc/Kconfig
++++ b/drivers/misc/Kconfig
+@@ -481,4 +481,5 @@ source "drivers/misc/cxl/Kconfig"
+ source "drivers/misc/ocxl/Kconfig"
+ source "drivers/misc/cardreader/Kconfig"
+ source "drivers/misc/habanalabs/Kconfig"
++source "drivers/misc/mediatek/Kconfig"
+ endmenu
+diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
+index c1860d35d..30b5d29a1 100644
+--- a/drivers/misc/Makefile
++++ b/drivers/misc/Makefile
+@@ -57,3 +57,4 @@ obj-y += cardreader/
+ obj-$(CONFIG_PVPANIC) += pvpanic.o
+ obj-$(CONFIG_HABANA_AI) += habanalabs/
+ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o
++obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch
new file mode 100644
index 0000000..d12f629
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch
@@ -0,0 +1,38 @@
+From 9ec485a8a2002d6625b8b43158887ecac572ce76 Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:34 +0800
+Subject: [PATCH]
+ [uncategorized][999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch]
+
+---
+ arch/arm64/boot/dts/mediatek/mt7622.dtsi | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+index 988c31403..d7f147414 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+@@ -568,6 +568,20 @@
+ status = "disabled";
+ };
+
++ snand: snfi@1100d000 {
++ compatible = "mediatek,mt7622-snand";
++ reg = <0 0x1100d000 0 0x1000>, <0 0x1100e000 0 0x1000>;
++ reg-names = "nfi", "ecc";
++ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
++ clocks = <&pericfg CLK_PERI_NFI_PD>,
++ <&pericfg CLK_PERI_SNFI_PD>,
++ <&pericfg CLK_PERI_NFIECC_PD>;
++ clock-names = "nfi_clk", "pad_clk", "ecc_clk";
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "disabled";
++ };
++
+ nor_flash: spi@11014000 {
+ compatible = "mediatek,mt7622-nor",
+ "mediatek,mt8173-nor";
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2901-dts-mt7622-remove-cooling-device.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2901-dts-mt7622-remove-cooling-device.patch
new file mode 100644
index 0000000..16bf5b8
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2901-dts-mt7622-remove-cooling-device.patch
@@ -0,0 +1,43 @@
+From abe2d8053a5323638eedb60e1e58d2bf34b98a3b Mon Sep 17 00:00:00 2001
+From: Sam Shih <sam.shih@mediatek.com>
+Date: Fri, 2 Jun 2023 13:06:34 +0800
+Subject: [PATCH]
+ [uncategorized][999-2901-dts-mt7622-remove-cooling-device.patch]
+
+---
+ arch/arm64/boot/dts/mediatek/mt7622.dtsi | 19 -------------------
+ 1 file changed, 19 deletions(-)
+
+diff --git a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+index d7f147414..753a97a2f 100644
+--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi
++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
+@@ -167,25 +167,6 @@
+ };
+ };
+
+- cooling-maps {
+- map0 {
+- trip = <&cpu_passive>;
+- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+- };
+-
+- map1 {
+- trip = <&cpu_active>;
+- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+- };
+-
+- map2 {
+- trip = <&cpu_hot>;
+- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+- };
+- };
+ };
+ };
+
+--
+2.34.1
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
index 2a6b31a..4279ec4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
@@ -1,27 +1,13 @@
#patch patches-5.4 (come from openwrt/lede/target/linux/mediatek)
SRC_URI_append = " \
- file://0001-clk-mtk-add-mt7986-support.patch \
- file://0001-cpufreq-add-the-missing-platform-driver-unregister.patch \
file://0001-v5.7-spi-make-spi-max-frequency-optional.patch \
- file://0002-clk-mtk-add-mt7981-support.patch \
- file://0002-cpufreq-Enable-clocks-and-regulators.patch \
file://0002-v5.7-spi-add-support-for-mediatek-spi-nor-controller.patch \
- file://0003-clk-mtk-add-mt7988-support.patch \
- file://0003-cpufreq-add-mt7988a-spim-snand-support.patch \
file://0003-switch-add-mt7531.patch \
- file://0005-clk-mtk-add-chg-shift-control.patch \
file://0005-dts-mt7622-add-gsw.patch \
file://0005-dts-mt7629-add-gsw.patch \
file://0006-dts-fix-bpi2-console.patch \
file://0006-dts-fix-bpi64-console.patch \
- file://0006-powerdomain-add-mt7988-support.patch \
- file://0007-cpufreq-mtk-vbining-add-mt7988-support.patch \
file://0010-dts-mt7629-rfb-fix-firmware-partition.patch \
- file://0020-dts-mt7622-enable-new-mtk-snand-for-ubi.patch \
- file://0021-dts-mt7622-remove-cooling-device.patch \
- file://0100-hwnat_Kconfig_Makefile.patch \
- file://0111-mt7986-trng-add-rng-support.patch \
- file://0200-show_model_name_in_cpuinfo_on_arm64.patch \
file://0226-phy-phy-mtk-tphy-Add-hifsys-support.patch \
file://0227-arm-dts-Add-Unielec-U7623-DTS.patch \
file://0301-mtd-mtk-ecc-move-mtk-ecc-header-file-to-include-mtd.patch \
@@ -29,122 +15,136 @@
file://0307-dts-mt7629-add-snand-support.patch \
file://0308-dts-mt7622-add-snand-support.patch \
file://0310-dts-add-wmac-support-for-mt7622-rfb1.patch \
- file://0322-fix-dirty-race-between-do_tmpfile.patch \
- file://0400-sound-add-some-helpers-to-control-mtk_memif.patch \
- file://0401-sound-refine-hw-params-and-hw-prepare.patch \
- file://0402-sound-add-mt7986-driver.patch \
- file://0490-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch \
- file://0491-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch \
file://0500-v5.6-crypto-backport-inside-secure.patch \
file://0501-crypto-add-eip97-inside-secure-support.patch \
file://0502-dts-mt7623-eip97-inside-secure-support.patch \
file://0503-crypto-fix-eip97-cache-incoherent.patch \
- file://0504-macsec-revert-async-support.patch \
- file://0505-crypto-add-eip197-inside-secure-support.patch \
file://0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch;apply=no \
file://0601-net-dsa-propagate-resolved-link-config-via-mac_link_.patch \
file://0602-net-dsa-mt7530-use-resolved-link-config-in-mac_link_.patch \
file://0603-net-dsa-mt7530-Extend-device-data-ready-for-adding-a.patch \
file://0604-net-dsa-mt7530-Add-the-support-of-MT7531-switch.patch \
file://0605-arm64-dts-mt7622-add-mt7531-dsa-to-bananapi-bpi-r64-board.patch \
- file://0666-add-spimem-support-to-mtk-spi.patch \
- file://0666-spi-mtk-nor-fix-timeout-calculation-overflow.patch \
- file://0667-spi-mediatek-fix-timeout-for-large-data.patch \
- file://0668-spi-mediatek-fix-dma-unmap-twice.patch \
- file://0669-fix-SPIM-NAND-and-NOR-probing.patch \
- file://0670-fix-SPIM-dma-buffer-not-aligned.patch \
- file://0701-fix-mtk-nfi-driver-dependency.patch \
- file://0801-mtk-sd-add-mt7986-support.patch \
- file://0802-mtk-sd-Add-subsys-clock-control.patch \
file://0900-bt-mtk-serial-fix.patch \
- file://0900-i2c-busses-add-mt7986-support.patch \
- file://0901-i2c-busses-add-mt7981-support.patch \
- file://0920-kernel-MT7988-fix-spi-dma-unmap.patch \
- file://0930-pwm-add-mt7986-support.patch \
- file://0931-pwm-add-mt7981-support.patch \
- file://0932-add-pwm-feature-in-mt7988-project.patch \
- file://0950-add-pmic-config.patch \
- file://0950-pwm-mediatek-add-longer-period-support.patch \
- file://0960-watchdog-add-mt7986-assert.patch \
- file://0961-dual-image-mount-rootfs.patch \
file://0990-gsw-rtl8367s-mt7622-support.patch \
file://0991-dt-bindings-PCI-Mediatek-Update-PCIe-binding.patch \
file://0992-PCI-mediatek-Use-regmap-to-get-shared-pcie-cfg-base.patch \
file://0993-arm64-dts-mediatek-Split-PCIe-node-for-MT2712-MT7622.patch \
file://0994-ARM-dts-mediatek-Update-mt7629-PCIe-node.patch \
- file://1001-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch \
file://1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch \
file://1010-pcie-mediatek-fix-clearing-interrupt-status.patch \
- file://1015-pcie-add-pcie-gen3-upstream-driver.patch \
file://1020-spi-nor-w25q512jv.patch \
file://1021-ubnt-ledbar-driver.patch \
- file://1023-kgdb-add-interrupt-control.patch \
- file://1024-pcie-add-multi-MSI-support.patch \
- file://1661-Add-trngv2-driver-support.patch \
- file://1662-trng-Add-trng-support-for-mt7988.patch \
- file://2000-misc-add-mtk-platform.patch \
- file://400-mtd-add-mtk-snand-driver.patch \
- file://401-pinctrl-add-mt7986-driver.patch \
- file://401-pinctrl-enable-mt7988-pinctrl-config.patch \
- file://402-pinctrl-add-mt7981-driver.patch \
- file://412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch \
- file://413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch \
- file://414-mtd-spinand-fix-gigadevice-read-dummy.patch \
- file://415-mtd-spinand-fix-F50L1G41LB-ecc-check.patch \
- file://416-mtd-spinor-support-EN25QX128A.patch \
- file://492-mtd-tests-fix-pagetest-load.patch \
- file://500-auxadc-add-auxadc-32k-clk.patch \
- file://6001-mtk-thermal-add-lvts-support.patch \
- file://7000-fix-race-inside-napi-enable.patch \
- file://7001-net-make-napi-disable-symmetric-with-enable.patch \
- file://7002-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch \
- file://730-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch \
- file://738-mt7531-gsw-internal_phy_calibration.patch;apply=no \
- file://739-mt7531-gsw-port5_external_phy_init.patch;apply=no \
- file://740-add-gpy211-phy-support.patch \
- file://741-add-default-setting-to-dsa-unused-port.patch \
- file://742-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch \
- file://744-en8811h-2p5gphy-support.patch \
- file://745-en8801sc-gphy-support.patch \
- file://745-mdiobus-add-c45.patch \
- file://746-add-mediatek-2p5ge-phy-support.patch \
- file://746-mxl-gpy-phy-support.patch \
- file://747-net-phy-aquantia-add-AQR113C.patch \
- file://748-add-netlink-support-for-dsa.patch \
- file://749-net-dsa-support-mt7988.patch \
- file://750-add-mdio-bus-for-gphy-calibration.patch \
- file://751-net-phy-aquantia-add-firmware-download.patch \
- file://752-net-dsa-phy-coverity-scan.patch \
- file://753-net-mt753x-phy-coverity-scan.patch;apply=no \
- file://754-net-phy-add-5GBASER.patch \
- file://755-net-phy-sfp-add-rollball-support.patch \
- file://757-net-phy-add-phylink-pcs-support.patch;apply=no \
- file://758-net-phy-add-phylink-pcs-decode-helper.patch \
- file://8000-PATCH-1-4-tphy-support-type-switch-by-pericfg.patch \
- file://8001-PATCH-2-4-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch \
- file://8002-PATCH-3-4-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch \
- file://8003-PATCH-4-4-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch \
- file://8004-nvmem-core-Add-functions-to-make-number-reading-easy.patch \
- file://8005-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch \
- file://8006-phy-phy-mtk-tphy-add-support-efuse-setting.patch \
- file://8007-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch \
- file://8008-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch \
- file://8009-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch \
- file://8010-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch \
- file://8011-ovs-add-multicast-to-unicast-support.patch \
- file://9000-PATCH-1-1-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch \
- file://9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch \
- file://9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch \
- file://9009-Add-spi-runtime-PM-support.patch \
- file://9010-iwconfig-wireless-rate-fix.patch;apply=no \
- file://9011-Modify-tick_delay-for-spi-work-safety.patch \
- file://9013-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch \
- file://9014-drivers-spi-Add-support-for-dynamic-calibration.patch \
- file://9015-drivers-spi-mem-Add-spi-calibration-hook.patch \
- file://9016-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch \
- file://9017-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch \
- file://9018-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch \
- file://9019-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch \
- file://9102-spi-update-driver.patch \
- file://9103-drivers-spi-mt65xx-add-dts-buswidth-flow.patch \
+ file://999-1600-mdiobus-add-c45.patch \
+ file://999-1700-macsec-revert-async-support.patch \
+ file://999-1701-add-default-setting-to-dsa-unused-port.patch \
+ file://999-1702-net-dsa-add-MT7531-Gigabit-Ethernet-PHY-setting.patch \
+ file://999-1704-net-phy-aquantia-add-AQR113C.patch \
+ file://999-1705-add-netlink-support-for-dsa.patch \
+ file://999-1706-net-dsa-support-mt7988.patch \
+ file://999-1707-add-mdio-bus-for-gphy-calibration.patch \
+ file://999-1708-net-phy-add-5GBASER.patch \
+ file://999-1709-net-phy-sfp-add-rollball-support.patch \
+ file://999-1710-net-phy-add-phylink-pcs-support.patch;apply=no \
+ file://999-1711-net-phy-add-phylink-pcs-decode-helper.patch \
+ file://999-1712-net-phy-add-phylink-rate-matching-support.patch;apply=no \
+ file://999-2000-show_model_name_in_cpuinfo_on_arm64.patch \
+ file://999-2001-kgdb-add-interrupt-control.patch \
+ file://999-2010-clk-mtk-add-mt7986-support.patch \
+ file://999-2011-clk-mtk-add-mt7981-support.patch \
+ file://999-2012-clk-mtk-add-mt7988-support.patch \
+ file://999-2013-clk-mtk-add-chg-shift-control.patch \
+ file://999-2020-pinctrl-add-mt7986-driver.patch \
+ file://999-2021-pinctrl-enable-mt7988-pinctrl-config.patch \
+ file://999-2022-pinctrl-add-mt7981-driver.patch \
+ file://999-2040-powerdomain-add-mt7988-support.patch \
+ file://999-2050-watchdog-add-mt7986-assert.patch \
+ file://999-2100-mt7986-trng-add-rng-support.patch \
+ file://999-2101-Add-trngv2-driver-support.patch \
+ file://999-2102-trng-Add-trng-support-for-mt7988.patch \
+ file://999-2103-drivers-char-tpm-Add-calibration-example-for-SPI-TPM-module.patch \
+ file://999-2110-i2c-busses-add-mt7986-support.patch \
+ file://999-2111-i2c-busses-add-mt7981-support.patch \
+ file://999-2120-auxadc-add-auxadc-32k-clk.patch \
+ file://999-2130-pwm-add-mt7986-support.patch \
+ file://999-2131-pwm-add-mt7981-support.patch \
+ file://999-2132-add-pwm-feature-in-mt7988-project.patch \
+ file://999-2133-pwm-mediatek-add-longer-period-support.patch \
+ file://999-2140-mtk-thermal-add-lvts-support.patch \
+ file://999-2150-sound-add-some-helpers-to-control-mtk_memif.patch \
+ file://999-2151-sound-refine-hw-params-and-hw-prepare.patch \
+ file://999-2152-sound-add-mt7986-driver.patch \
+ file://999-2300-mtk-sd-add-mt7986-support.patch \
+ file://999-2301-mtk-sd-Add-subsys-clock-control.patch \
+ file://999-2330-mtd-spinand-winbond-Support-for-W25MxxGV-W25NxxKV-series.patch \
+ file://999-2331-mtd-spinand-macronix-suppress-mx35lf1ge4ab-warning-log.patch \
+ file://999-2332-mtd-add-mtk-snand-driver.patch \
+ file://999-2333-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch \
+ file://999-2334-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch \
+ file://999-2335-mtd-spinand-fix-gigadevice-read-dummy.patch \
+ file://999-2336-mtd-spinand-fix-F50L1G41LB-ecc-check.patch \
+ file://999-2337-mtd-spinor-support-EN25QX128A.patch \
+ file://999-2338-mtd-tests-fix-pagetest-load.patch \
+ file://999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch \
+ file://999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch \
+ file://999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch \
+ file://999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch \
+ file://999-2361-add-spimem-support-to-mtk-spi.patch \
+ file://999-2362-spi-mtk-nor-fix-timeout-calculation-overflow.patch \
+ file://999-2363-spi-mediatek-fix-timeout-for-large-data.patch \
+ file://999-2364-spi-mediatek-fix-dma-unmap-twice.patch \
+ file://999-2365-fix-SPIM-NAND-and-NOR-probing.patch \
+ file://999-2366-fix-SPIM-dma-buffer-not-aligned.patch \
+ file://999-2367-fix-mtk-nfi-driver-dependency.patch \
+ file://999-2368-kernel-MT7988-fix-spi-dma-unmap.patch \
+ file://999-2369-Add-spi-runtime-PM-support.patch \
+ file://999-2370-Modify-tick_delay-for-spi-work-safety.patch \
+ file://999-2371-drivers-spi-mt65xx-Move-chip_config-to-driver-priv.patch \
+ file://999-2372-drivers-spi-Add-support-for-dynamic-calibration.patch \
+ file://999-2373-drivers-spi-mem-Add-spi-calibration-hook.patch \
+ file://999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch \
+ file://999-2375-spi-update-driver.patch \
+ file://999-2376-drivers-spi-mt65xx-add-dts-buswidth-flow.patch \
+ file://999-2380-fix-dirty-race-between-do_tmpfile.patch \
+ file://999-2500-cpufreq-add-the-missing-platform-driver-unregister.patch \
+ file://999-2501-cpufreq-Enable-clocks-and-regulators.patch \
+ file://999-2502-cpufreq-add-mt7988a-spim-snand-support.patch \
+ file://999-2503-cpufreq-mtk-vbining-add-mt7988-support.patch \
+ file://999-2530-add-pmic-config.patch \
+ file://999-2550-dual-image-mount-rootfs.patch \
+ file://999-2600-pcie-add-pcie-gen3-upstream-driver.patch \
+ file://999-2601-pcie-add-multi-MSI-support.patch \
+ file://999-2610-tphy-support-type-switch-by-pericfg.patch \
+ file://999-2611-phy-phy-mtk-tphy-add-support-efuse-setting.patch \
+ file://999-2612-phy-phy-mtk-tphy-Add-PCIe-2-lane-efuse-support.patch \
+ file://999-2613-phy-phy-mtk-tphy-add-auto-load-valid-check-mechanism.patch \
+ file://999-2614-tphy-one-setting-of-TTSSC-Freq-Dev-for-all-IC-cases.patch \
+ file://999-2615-phy-phy-mtk-xsphy-support-type-switch-by-pericfg.patch \
+ file://999-2620-xHCI-change-compliance-mode-de-emphasis-default-as-g.patch \
+ file://999-2621-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch \
+ file://999-2622-usb-add-embedded-Host-feature-support.patch \
+ file://999-2704-en8811h-2p5gphy-support.patch \
+ file://999-2705-hwnat_Kconfig_Makefile.patch \
+ file://999-2706-crypto-add-eip197-inside-secure-support.patch \
+ file://999-2707-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch \
+ file://999-2709-fix-race-inside-napi-enable.patch \
+ file://999-2710-net-make-napi-disable-symmetric-with-enable.patch \
+ file://999-2711-net-fix-premature-exit-from-napi-state-polling-in-napi-disable-v2.patch \
+ file://999-2712-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch \
+ file://999-2713-mt7531-gsw-internal_phy_calibration.patch;apply=no \
+ file://999-2714-mt7531-gsw-port5_external_phy_init.patch;apply=no \
+ file://999-2715-add-gpy211-phy-support.patch \
+ file://999-2716-en8801sc-gphy-support.patch \
+ file://999-2717-add-mediatek-2p5ge-phy-support.patch \
+ file://999-2718-mxl-gpy-phy-support.patch \
+ file://999-2719-net-phy-aquantia-add-firmware-download.patch \
+ file://999-2720-net-dsa-phy-coverity-scan.patch \
+ file://999-2721-net-mt753x-phy-coverity-scan.patch;apply=no \
+ file://999-2722-dt-bindings-phy-Add-PHY_TYPE_DP-definition.patch \
+ file://999-2723-dt-bindings-phy-Add-PHY_TYPE_XPCS-definition.patch \
+ file://999-2724-dt-bindings-phy-Add-DT-bindings-for-Xilinx-ZynqMP-PS.patch \
+ file://999-2725-iwconfig-wireless-rate-fix.patch;apply=no \
+ file://999-2800-misc-add-mtk-platform.patch \
+ file://999-2900-dts-mt7622-enable-new-mtk-snand-for-ubi.patch \
+ file://999-2901-dts-mt7622-remove-cooling-device.patch \
"
diff --git a/recipes-kernel/linux/linux-mediatek_5.4.bb b/recipes-kernel/linux/linux-mediatek_5.4.bb
index 8728f3f..322b9af 100644
--- a/recipes-kernel/linux/linux-mediatek_5.4.bb
+++ b/recipes-kernel/linux/linux-mediatek_5.4.bb
@@ -63,7 +63,7 @@
require ${PN}-${PV}/mediatek/patches-5.4/patches-5.4.inc
SRC_URI_remove_mt7986-32bit = " \
- file://401-pinctrl-add-mt7986-driver.patch \
+ file://999-2020-pinctrl-add-mt7986-driver.patch \
"
SRC_URI_append_secureboot += " \
file://0404-mtdsplit-dm-verity.patch;apply=no \
@@ -88,12 +88,13 @@
patch -p1 < ${WORKDIR}/001-rdkb-eth-mtk-change-ifname-for.patch
patch -p1 < ${WORKDIR}/003-rdkb-mtd-kernel-ubi-relayout.patch
patch -p1 < ${WORKDIR}/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch
- patch -p1 < ${WORKDIR}/738-mt7531-gsw-internal_phy_calibration.patch
- patch -p1 < ${WORKDIR}/739-mt7531-gsw-port5_external_phy_init.patch
- patch -p1 < ${WORKDIR}/753-net-mt753x-phy-coverity-scan.patch
- patch -p1 < ${WORKDIR}/757-net-phy-add-phylink-pcs-support.patch
- patch -p1 < ${WORKDIR}/792-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
- patch -p1 < ${WORKDIR}/9010-iwconfig-wireless-rate-fix.patch
+ patch -p1 < ${WORKDIR}/999-2713-mt7531-gsw-internal_phy_calibration.patch
+ patch -p1 < ${WORKDIR}/999-2714-mt7531-gsw-port5_external_phy_init.patch
+ patch -p1 < ${WORKDIR}/999-2721-net-mt753x-phy-coverity-scan.patch
+ patch -p1 < ${WORKDIR}/999-1710-net-phy-add-phylink-pcs-support.patch
+ patch -p1 < ${WORKDIR}/999-1712-net-phy-add-phylink-rate-matching-support.patch
+ patch -p1 < ${WORKDIR}/999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch
+ patch -p1 < ${WORKDIR}/999-2725-iwconfig-wireless-rate-fix.patch
if [ $DISTRO_secure_boot_ENABLED = 'true' ]; then
patch -p1 < ${WORKDIR}/0404-mtdsplit-dm-verity.patch
patch -p1 < ${WORKDIR}/0800-dm-verity-redo-hash-for-safexel-sha256.patch