[Change and sync linux version from OpenWRT]
[Description]
Change and sync linux version from OpenWRT
1. sync kernel to Openwrt21.02 : v5.4.188
2. sync mtk kernel patch from mtk_feed
[Release-log]
N/A
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/408-v5.7-mtd-nand-spi-rework-detect-procedure-for-different-read-id-op.patch
new file mode 100644
index 0000000..e4e283c
--- /dev/null
+++ b/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
@@ -0,0 +1,708 @@
+--- a/drivers/mtd/nand/spi/core.c
++++ b/drivers/mtd/nand/spi/core.c
+@@ -16,6 +16,7 @@
+ #include <linux/mtd/spinand.h>
+ #include <linux/of.h>
+ #include <linux/slab.h>
++#include <linux/string.h>
+ #include <linux/spi/spi.h>
+ #include <linux/spi/spi-mem.h>
+
+@@ -370,10 +371,11 @@ out:
+ return status & STATUS_BUSY ? -ETIMEDOUT : 0;
+ }
+
+-static int spinand_read_id_op(struct spinand_device *spinand, u8 *buf)
++static int spinand_read_id_op(struct spinand_device *spinand, u8 naddr,
++ u8 ndummy, u8 *buf)
+ {
+- struct spi_mem_op op = SPINAND_READID_OP(0, spinand->scratchbuf,
+- SPINAND_MAX_ID_LEN);
++ struct spi_mem_op op = SPINAND_READID_OP(
++ naddr, ndummy, spinand->scratchbuf, SPINAND_MAX_ID_LEN);
+ int ret;
+
+ ret = spi_mem_exec_op(spinand->spimem, &op);
+@@ -760,24 +762,62 @@ static const struct spinand_manufacturer
+ &winbond_spinand_manufacturer,
+ };
+
+-static int spinand_manufacturer_detect(struct spinand_device *spinand)
++static int spinand_manufacturer_match(struct spinand_device *spinand,
++ enum spinand_readid_method rdid_method)
+ {
++ u8 *id = spinand->id.data;
+ unsigned int i;
+ int ret;
+
+ for (i = 0; i < ARRAY_SIZE(spinand_manufacturers); i++) {
+- ret = spinand_manufacturers[i]->ops->detect(spinand);
+- if (ret > 0) {
+- spinand->manufacturer = spinand_manufacturers[i];
+- return 0;
+- } else if (ret < 0) {
+- return ret;
+- }
+- }
++ const struct spinand_manufacturer *manufacturer =
++ spinand_manufacturers[i];
++
++ if (id[0] != manufacturer->id)
++ continue;
+
++ ret = spinand_match_and_init(spinand,
++ manufacturer->chips,
++ manufacturer->nchips,
++ rdid_method);
++ if (ret < 0)
++ continue;
++
++ spinand->manufacturer = manufacturer;
++ return 0;
++ }
+ return -ENOTSUPP;
+ }
+
++static int spinand_id_detect(struct spinand_device *spinand)
++{
++ u8 *id = spinand->id.data;
++ int ret;
++
++ ret = spinand_read_id_op(spinand, 0, 0, id);
++ if (ret)
++ return ret;
++ ret = spinand_manufacturer_match(spinand, SPINAND_READID_METHOD_OPCODE);
++ if (!ret)
++ return 0;
++
++ ret = spinand_read_id_op(spinand, 1, 0, id);
++ if (ret)
++ return ret;
++ ret = spinand_manufacturer_match(spinand,
++ SPINAND_READID_METHOD_OPCODE_ADDR);
++ if (!ret)
++ return 0;
++
++ ret = spinand_read_id_op(spinand, 0, 1, id);
++ if (ret)
++ return ret;
++ ret = spinand_manufacturer_match(spinand,
++ SPINAND_READID_METHOD_OPCODE_DUMMY);
++
++ return ret;
++}
++
+ static int spinand_manufacturer_init(struct spinand_device *spinand)
+ {
+ if (spinand->manufacturer->ops->init)
+@@ -833,9 +873,9 @@ spinand_select_op_variant(struct spinand
+ * @spinand: SPI NAND object
+ * @table: SPI NAND device description table
+ * @table_size: size of the device description table
++ * @rdid_method: read id method to match
+ *
+- * Should be used by SPI NAND manufacturer drivers when they want to find a
+- * match between a device ID retrieved through the READ_ID command and an
++ * Match between a device ID retrieved through the READ_ID command and an
+ * 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
+ */
+ int spinand_match_and_init(struct spinand_device *spinand,
+ const struct spinand_info *table,
+- unsigned int table_size, u16 devid)
++ unsigned int table_size,
++ enum spinand_readid_method rdid_method)
+ {
++ u8 *id = spinand->id.data;
+ struct nand_device *nand = spinand_to_nand(spinand);
+ unsigned int i;
+
+@@ -853,13 +895,17 @@ int spinand_match_and_init(struct spinan
+ const struct spinand_info *info = &table[i];
+ const struct spi_mem_op *op;
+
+- if (devid != info->devid)
++ if (rdid_method != info->devid.method)
++ continue;
++
++ if (memcmp(id + 1, info->devid.id, info->devid.len))
+ continue;
+
+ nand->memorg = table[i].memorg;
+ nand->eccreq = table[i].eccreq;
+ spinand->eccinfo = table[i].eccinfo;
+ spinand->flags = table[i].flags;
++ spinand->id.len = 1 + table[i].devid.len;
+ spinand->select_target = table[i].select_target;
+
+ op = spinand_select_op_variant(spinand,
+@@ -896,13 +942,7 @@ static int spinand_detect(struct spinand
+ if (ret)
+ return ret;
+
+- ret = spinand_read_id_op(spinand, spinand->id.data);
+- if (ret)
+- return ret;
+-
+- spinand->id.len = SPINAND_MAX_ID_LEN;
+-
+- ret = spinand_manufacturer_detect(spinand);
++ ret = spinand_id_detect(spinand);
+ if (ret) {
+ dev_err(dev, "unknown raw ID %*phN\n", SPINAND_MAX_ID_LEN,
+ spinand->id.data);
+--- a/drivers/mtd/nand/spi/gigadevice.c
++++ b/drivers/mtd/nand/spi/gigadevice.c
+@@ -195,7 +195,8 @@ static int gd5fxgq4ufxxg_ecc_get_status(
+ }
+
+ static const struct spinand_info gigadevice_spinand_table[] = {
+- SPINAND_INFO("GD5F1GQ4xA", 0xF1,
++ SPINAND_INFO("GD5F1GQ4xA",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf1),
+ 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
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
+ gd5fxgq4xa_ecc_get_status)),
+- SPINAND_INFO("GD5F2GQ4xA", 0xF2,
++ SPINAND_INFO("GD5F2GQ4xA",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf2),
+ 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
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
+ gd5fxgq4xa_ecc_get_status)),
+- SPINAND_INFO("GD5F4GQ4xA", 0xF4,
++ SPINAND_INFO("GD5F4GQ4xA",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xf4),
+ 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
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
+ gd5fxgq4xa_ecc_get_status)),
+- SPINAND_INFO("GD5F1GQ4UExxG", 0xd1,
++ SPINAND_INFO("GD5F1GQ4UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xd1),
+ 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
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&gd5fxgq4_variant2_ooblayout,
+ gd5fxgq4uexxg_ecc_get_status)),
+- SPINAND_INFO("GD5F1GQ4UFxxG", 0xb148,
++ SPINAND_INFO("GD5F1GQ4UFxxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE, 0xb1, 0x48),
+ 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
+ gd5fxgq4ufxxg_ecc_get_status)),
+ };
+
+-static int gigadevice_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- u16 did;
+- int ret;
+-
+- /*
+- * Earlier GDF5-series devices (A,E) return [0][MID][DID]
+- * Later (F) devices return [MID][DID1][DID2]
+- */
+-
+- if (id[0] == SPINAND_MFR_GIGADEVICE)
+- did = (id[1] << 8) + id[2];
+- else if (id[0] == 0 && id[1] == SPINAND_MFR_GIGADEVICE)
+- did = id[2];
+- else
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, gigadevice_spinand_table,
+- ARRAY_SIZE(gigadevice_spinand_table),
+- did);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
+- .detect = gigadevice_spinand_detect,
+ };
+
+ const struct spinand_manufacturer gigadevice_spinand_manufacturer = {
+ .id = SPINAND_MFR_GIGADEVICE,
+ .name = "GigaDevice",
++ .chips = gigadevice_spinand_table,
++ .nchips = ARRAY_SIZE(gigadevice_spinand_table),
+ .ops = &gigadevice_spinand_manuf_ops,
+ };
+--- 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
+ }
+
+ static const struct spinand_info macronix_spinand_table[] = {
+- SPINAND_INFO("MX35LF1GE4AB", 0x12,
++ SPINAND_INFO("MX35LF1GE4AB",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x12),
+ 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
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
+- SPINAND_INFO("MX35LF2GE4AB", 0x22,
++ SPINAND_INFO("MX35LF2GE4AB",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x22),
+ 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
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
+ };
+
+-static int macronix_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- int ret;
+-
+- /*
+- * Macronix SPI NAND read ID needs a dummy byte, so the first byte in
+- * raw_id is garbage.
+- */
+- if (id[1] != SPINAND_MFR_MACRONIX)
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, macronix_spinand_table,
+- ARRAY_SIZE(macronix_spinand_table),
+- id[2]);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ static const struct spinand_manufacturer_ops macronix_spinand_manuf_ops = {
+- .detect = macronix_spinand_detect,
+ };
+
+ const struct spinand_manufacturer macronix_spinand_manufacturer = {
+ .id = SPINAND_MFR_MACRONIX,
+ .name = "Macronix",
++ .chips = macronix_spinand_table,
++ .nchips = ARRAY_SIZE(macronix_spinand_table),
+ .ops = ¯onix_spinand_manuf_ops,
+ };
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -91,7 +91,8 @@ static int mt29f2g01abagd_ecc_get_status
+ }
+
+ static const struct spinand_info micron_spinand_table[] = {
+- SPINAND_INFO("MT29F2G01ABAGD", 0x24,
++ SPINAND_INFO("MT29F2G01ABAGD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
+ 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_
+ mt29f2g01abagd_ecc_get_status)),
+ };
+
+-static int micron_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- int ret;
+-
+- /*
+- * Micron SPI NAND read ID need a dummy byte,
+- * so the first byte in raw_id is dummy.
+- */
+- if (id[1] != SPINAND_MFR_MICRON)
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, micron_spinand_table,
+- ARRAY_SIZE(micron_spinand_table), id[2]);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
+- .detect = micron_spinand_detect,
+ };
+
+ const struct spinand_manufacturer micron_spinand_manufacturer = {
+ .id = SPINAND_MFR_MICRON,
+ .name = "Micron",
++ .chips = micron_spinand_table,
++ .nchips = ARRAY_SIZE(micron_spinand_table),
+ .ops = µn_spinand_manuf_ops,
+ };
+--- 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
+
+
+ static const struct spinand_info paragon_spinand_table[] = {
+- SPINAND_INFO("PN26G01A", 0xe1,
++ SPINAND_INFO("PN26G01A",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xe1),
+ 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
+ 0,
+ SPINAND_ECCINFO(&pn26g0xa_ooblayout,
+ pn26g0xa_ecc_get_status)),
+- SPINAND_INFO("PN26G02A", 0xe2,
++ SPINAND_INFO("PN26G02A",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xe2),
+ 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
+ pn26g0xa_ecc_get_status)),
+ };
+
+-static int paragon_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- int ret;
+-
+- /* Read ID returns [0][MID][DID] */
+-
+- if (id[1] != SPINAND_MFR_PARAGON)
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, paragon_spinand_table,
+- ARRAY_SIZE(paragon_spinand_table),
+- id[2]);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ static const struct spinand_manufacturer_ops paragon_spinand_manuf_ops = {
+- .detect = paragon_spinand_detect,
+ };
+
+ const struct spinand_manufacturer paragon_spinand_manufacturer = {
+ .id = SPINAND_MFR_PARAGON,
+ .name = "Paragon",
++ .chips = paragon_spinand_table,
++ .nchips = ARRAY_SIZE(paragon_spinand_table),
+ .ops = ¶gon_spinand_manuf_ops,
+ };
+--- 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
+
+ static const struct spinand_info toshiba_spinand_table[] = {
+ /* 3.3V 1Gb */
+- SPINAND_INFO("TC58CVG0S3", 0xC2,
++ SPINAND_INFO("TC58CVG0S3",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xC2),
+ 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
+ SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+ tc58cxgxsx_ecc_get_status)),
+ /* 3.3V 2Gb */
+- SPINAND_INFO("TC58CVG1S3", 0xCB,
++ SPINAND_INFO("TC58CVG1S3",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCB),
+ 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
+ SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+ tc58cxgxsx_ecc_get_status)),
+ /* 3.3V 4Gb */
+- SPINAND_INFO("TC58CVG2S0", 0xCD,
++ SPINAND_INFO("TC58CVG2S0",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCD),
+ 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
+ SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+ tc58cxgxsx_ecc_get_status)),
+ /* 1.8V 1Gb */
+- SPINAND_INFO("TC58CYG0S3", 0xB2,
++ SPINAND_INFO("TC58CYG0S3",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xB2),
+ 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
+ SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+ tc58cxgxsx_ecc_get_status)),
+ /* 1.8V 2Gb */
+- SPINAND_INFO("TC58CYG1S3", 0xBB,
++ SPINAND_INFO("TC58CYG1S3",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBB),
+ 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
+ SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+ tc58cxgxsx_ecc_get_status)),
+ /* 1.8V 4Gb */
+- SPINAND_INFO("TC58CYG2S0", 0xBD,
++ SPINAND_INFO("TC58CYG2S0",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBD),
+ 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
+ tc58cxgxsx_ecc_get_status)),
+ };
+
+-static int toshiba_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- int ret;
+-
+- /*
+- * Toshiba SPI NAND read ID needs a dummy byte,
+- * so the first byte in id is garbage.
+- */
+- if (id[1] != SPINAND_MFR_TOSHIBA)
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, toshiba_spinand_table,
+- ARRAY_SIZE(toshiba_spinand_table),
+- id[2]);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ static const struct spinand_manufacturer_ops toshiba_spinand_manuf_ops = {
+- .detect = toshiba_spinand_detect,
+ };
+
+ const struct spinand_manufacturer toshiba_spinand_manufacturer = {
+ .id = SPINAND_MFR_TOSHIBA,
+ .name = "Toshiba",
++ .chips = toshiba_spinand_table,
++ .nchips = ARRAY_SIZE(toshiba_spinand_table),
+ .ops = &toshiba_spinand_manuf_ops,
+ };
+--- a/drivers/mtd/nand/spi/winbond.c
++++ b/drivers/mtd/nand/spi/winbond.c
+@@ -75,7 +75,8 @@ static int w25m02gv_select_target(struct
+ }
+
+ static const struct spinand_info winbond_spinand_table[] = {
+- SPINAND_INFO("W25M02GV", 0xAB,
++ SPINAND_INFO("W25M02GV",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab),
+ 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
+ 0,
+ SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
+ SPINAND_SELECT_TARGET(w25m02gv_select_target)),
+- SPINAND_INFO("W25N01GV", 0xAA,
++ SPINAND_INFO("W25N01GV",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa),
+ 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
+ SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
+ };
+
+-/**
+- * winbond_spinand_detect - initialize device related part in spinand_device
+- * struct if it is a Winbond device.
+- * @spinand: SPI NAND device structure
+- */
+-static int winbond_spinand_detect(struct spinand_device *spinand)
+-{
+- u8 *id = spinand->id.data;
+- int ret;
+-
+- /*
+- * Winbond SPI NAND read ID need a dummy byte,
+- * so the first byte in raw_id is dummy.
+- */
+- if (id[1] != SPINAND_MFR_WINBOND)
+- return 0;
+-
+- ret = spinand_match_and_init(spinand, winbond_spinand_table,
+- ARRAY_SIZE(winbond_spinand_table), id[2]);
+- if (ret)
+- return ret;
+-
+- return 1;
+-}
+-
+ 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
+ }
+
+ static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
+- .detect = winbond_spinand_detect,
+ .init = winbond_spinand_init,
+ };
+
+ const struct spinand_manufacturer winbond_spinand_manufacturer = {
+ .id = SPINAND_MFR_WINBOND,
+ .name = "Winbond",
++ .chips = winbond_spinand_table,
++ .nchips = ARRAY_SIZE(winbond_spinand_table),
+ .ops = &winbond_spinand_manuf_ops,
+ };
+--- a/include/linux/mtd/spinand.h
++++ b/include/linux/mtd/spinand.h
+@@ -32,9 +32,9 @@
+ SPI_MEM_OP_NO_DUMMY, \
+ SPI_MEM_OP_NO_DATA)
+
+-#define SPINAND_READID_OP(ndummy, buf, len) \
++#define SPINAND_READID_OP(naddr, ndummy, buf, len) \
+ SPI_MEM_OP(SPI_MEM_OP_CMD(0x9f, 1), \
+- SPI_MEM_OP_NO_ADDR, \
++ SPI_MEM_OP_ADDR(naddr, 0, 1), \
+ SPI_MEM_OP_DUMMY(ndummy, 1), \
+ SPI_MEM_OP_DATA_IN(len, buf, 1))
+
+@@ -176,37 +176,46 @@ struct spinand_device;
+ * @data: buffer containing the id bytes. Currently 4 bytes large, but can
+ * be extended if required
+ * @len: ID length
+- *
+- * struct_spinand_id->data contains all bytes returned after a READ_ID command,
+- * including dummy bytes if the chip does not emit ID bytes right after the
+- * READ_ID command. The responsibility to extract real ID bytes is left to
+- * struct_manufacurer_ops->detect().
+ */
+ struct spinand_id {
+ u8 data[SPINAND_MAX_ID_LEN];
+ int len;
+ };
+
++enum spinand_readid_method {
++ SPINAND_READID_METHOD_OPCODE,
++ SPINAND_READID_METHOD_OPCODE_ADDR,
++ SPINAND_READID_METHOD_OPCODE_DUMMY,
++};
++
++/**
++ * struct spinand_devid - SPI NAND device id structure
++ * @id: device id of current chip
++ * @len: number of bytes in device id
++ * @method: method to read chip id
++ * There are 3 possible variants:
++ * SPINAND_READID_METHOD_OPCODE: chip id is returned immediately
++ * after read_id opcode.
++ * SPINAND_READID_METHOD_OPCODE_ADDR: chip id is returned after
++ * read_id opcode + 1-byte address.
++ * SPINAND_READID_METHOD_OPCODE_DUMMY: chip id is returned after
++ * read_id opcode + 1 dummy byte.
++ */
++struct spinand_devid {
++ const u8 *id;
++ const u8 len;
++ const enum spinand_readid_method method;
++};
++
+ /**
+ * struct manufacurer_ops - SPI NAND manufacturer specific operations
+- * @detect: detect a SPI NAND device. Every time a SPI NAND device is probed
+- * the core calls the struct_manufacurer_ops->detect() hook of each
+- * registered manufacturer until one of them return 1. Note that
+- * the first thing to check in this hook is that the manufacturer ID
+- * in struct_spinand_device->id matches the manufacturer whose
+- * ->detect() hook has been called. Should return 1 if there's a
+- * match, 0 if the manufacturer ID does not match and a negative
+- * error code otherwise. When true is returned, the core assumes
+- * that properties of the NAND chip (spinand->base.memorg and
+- * spinand->base.eccreq) have been filled
+ * @init: initialize a SPI NAND device
+ * @cleanup: cleanup a SPI NAND device
+ *
+ * Each SPI NAND manufacturer driver should implement this interface so that
+- * NAND chips coming from this vendor can be detected and initialized properly.
++ * NAND chips coming from this vendor can be initialized properly.
+ */
+ struct spinand_manufacturer_ops {
+- int (*detect)(struct spinand_device *spinand);
+ int (*init)(struct spinand_device *spinand);
+ void (*cleanup)(struct spinand_device *spinand);
+ };
+@@ -215,11 +224,16 @@ struct spinand_manufacturer_ops {
+ * struct spinand_manufacturer - SPI NAND manufacturer instance
+ * @id: manufacturer ID
+ * @name: manufacturer name
++ * @devid_len: number of bytes in device ID
++ * @chips: supported SPI NANDs under current manufacturer
++ * @nchips: number of SPI NANDs available in chips array
+ * @ops: manufacturer operations
+ */
+ struct spinand_manufacturer {
+ u8 id;
+ char *name;
++ const struct spinand_info *chips;
++ const size_t nchips;
+ const struct spinand_manufacturer_ops *ops;
+ };
+
+@@ -291,7 +305,7 @@ struct spinand_ecc_info {
+ */
+ struct spinand_info {
+ const char *model;
+- u16 devid;
++ struct spinand_devid devid;
+ u32 flags;
+ struct nand_memory_organization memorg;
+ struct nand_ecc_req eccreq;
+@@ -305,6 +319,13 @@ struct spinand_info {
+ unsigned int target);
+ };
+
++#define SPINAND_ID(__method, ...) \
++ { \
++ .id = (const u8[]){ __VA_ARGS__ }, \
++ .len = sizeof((u8[]){ __VA_ARGS__ }), \
++ .method = __method, \
++ }
++
+ #define SPINAND_INFO_OP_VARIANTS(__read, __write, __update) \
+ { \
+ .read_cache = __read, \
+@@ -451,9 +472,10 @@ static inline void spinand_set_of_node(s
+ nanddev_set_of_node(&spinand->base, np);
+ }
+
+-int spinand_match_and_init(struct spinand_device *dev,
++int spinand_match_and_init(struct spinand_device *spinand,
+ const struct spinand_info *table,
+- unsigned int table_size, u16 devid);
++ unsigned int table_size,
++ enum spinand_readid_method rdid_method);
+
+ int spinand_upd_cfg(struct spinand_device *spinand, u8 mask, u8 val);
+ int spinand_select_target(struct spinand_device *spinand, unsigned int target);
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/411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
new file mode 100644
index 0000000..d4e9497
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/411-mtd-spinand-gigadevice-Support-GD5F1GQ5UExxG.patch
@@ -0,0 +1,173 @@
+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
+
+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
+--- a/drivers/mtd/nand/spi/gigadevice.c
++++ b/drivers/mtd/nand/spi/gigadevice.c
+@@ -13,7 +13,10 @@
+ #define GD5FXGQ4XA_STATUS_ECC_1_7_BITFLIPS (1 << 4)
+ #define GD5FXGQ4XA_STATUS_ECC_8_BITFLIPS (3 << 4)
+
+-#define GD5FXGQ4UEXXG_REG_STATUS2 0xf0
++#define GD5FXGQ5XE_STATUS_ECC_1_4_BITFLIPS (1 << 4)
++#define GD5FXGQ5XE_STATUS_ECC_4_BITFLIPS (3 << 4)
++
++#define GD5FXGQXXEXXG_REG_STATUS2 0xf0
+
+ #define GD5FXGQ4UXFXXG_STATUS_ECC_MASK (7 << 4)
+ #define GD5FXGQ4UXFXXG_STATUS_ECC_NO_BITFLIPS (0 << 4)
+@@ -102,7 +105,7 @@ static int gd5fxgq4xa_ecc_get_status(struct spinand_device *spinand,
+ return -EINVAL;
+ }
+
+-static int gd5fxgq4_variant2_ooblayout_ecc(struct mtd_info *mtd, int section,
++static int gd5fxgqx_variant2_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+ {
+ if (section)
+@@ -114,7 +117,7 @@ static int gd5fxgq4_variant2_ooblayout_ecc(struct mtd_info *mtd, int section,
+ return 0;
+ }
+
+-static int gd5fxgq4_variant2_ooblayout_free(struct mtd_info *mtd, int section,
++static int gd5fxgqx_variant2_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+ {
+ if (section)
+@@ -127,9 +130,10 @@ static int gd5fxgq4_variant2_ooblayout_free(struct mtd_info *mtd, int section,
+ return 0;
+ }
+
+-static const struct mtd_ooblayout_ops gd5fxgq4_variant2_ooblayout = {
+- .ecc = gd5fxgq4_variant2_ooblayout_ecc,
+- .free = gd5fxgq4_variant2_ooblayout_free,
++/* Valid for Q4/Q5 and Q6 (untested) devices */
++static const struct mtd_ooblayout_ops gd5fxgqx_variant2_ooblayout = {
++ .ecc = gd5fxgqx_variant2_ooblayout_ecc,
++ .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,
+ u8 status)
+ {
+ u8 status2;
+- struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQ4UEXXG_REG_STATUS2,
++ struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
+ &status2);
+ int ret;
+
+@@ -203,6 +207,43 @@ static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
+ return -EINVAL;
+ }
+
++static int gd5fxgq5xexxg_ecc_get_status(struct spinand_device *spinand,
++ u8 status)
++{
++ u8 status2;
++ struct spi_mem_op op = SPINAND_GET_FEATURE_OP(GD5FXGQXXEXXG_REG_STATUS2,
++ &status2);
++ int ret;
++
++ switch (status & STATUS_ECC_MASK) {
++ case STATUS_ECC_NO_BITFLIPS:
++ return 0;
++
++ case GD5FXGQ5XE_STATUS_ECC_1_4_BITFLIPS:
++ /*
++ * Read status2 register to determine a more fine grained
++ * bit error status
++ */
++ ret = spi_mem_exec_op(spinand->spimem, &op);
++ if (ret)
++ return ret;
++
++ /*
++ * 1 ... 4 bits are flipped (and corrected)
++ */
++ /* bits sorted this way (1...0): ECCSE1, ECCSE0 */
++ return ((status2 & STATUS_ECC_MASK) >> 4) + 1;
++
++ case STATUS_ECC_UNCOR_ERROR:
++ return -EBADMSG;
++
++ default:
++ break;
++ }
++
++ return -EINVAL;
++}
++
+ static int gd5fxgq4ufxxg_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
+ {
+@@ -282,7 +323,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {
+ &write_cache_variants,
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+- SPINAND_ECCINFO(&gd5fxgq4_variant2_ooblayout,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
+ 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[] = {
+ &write_cache_variants,
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+- SPINAND_ECCINFO(&gd5fxgq4_variant2_ooblayout,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
+ gd5fxgq4ufxxg_ecc_get_status)),
++ SPINAND_INFO("GD5F1GQ5UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
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
new file mode 100644
index 0000000..3292a6b
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.patch
@@ -0,0 +1,40 @@
+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
new file mode 100644
index 0000000..9f48d4a
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/431-mtd-spinand-macronix-Add-support-for-MX31UF1GE4BC.patch
@@ -0,0 +1,40 @@
+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/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
new file mode 100644
index 0000000..313b373
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/432-mtd-spinand-macronix-Add-support-for-MX35LFxGE4AD.patch
@@ -0,0 +1,50 @@
+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
+
+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
+--- 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[] = {
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
++ SPINAND_INFO("MX35LF2GE4AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x26),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35LF4GE4AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x37),
++ NAND_MEMORG(1, 4096, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
+ SPINAND_INFO("MX31LF1GE4BC",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x1e),
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 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/433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
new file mode 100644
index 0000000..e323a53
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/433-mtd-spinand-macronix-Add-support-for-MX35LFxG24AD.patch
@@ -0,0 +1,58 @@
+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
+
+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
+--- 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[] = {
+ 0,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35LF1G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x14),
++ NAND_MEMORG(1, 2048, 128, 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_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
++ SPINAND_INFO("MX35LF2G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
++ SPINAND_INFO("MX35LF4G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ 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),
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/434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
new file mode 100644
index 0000000..9900084
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/434-mtd-spinand-macronix-Add-support-for-serial-NAND-flash.patch
@@ -0,0 +1,170 @@
+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
+
+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
+--- 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[] = {
+ 0 /*SPINAND_HAS_QE_BIT*/,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
++
++ SPINAND_INFO("MX35LF2G14AC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x20),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF4G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xb5),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF4GE4AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xb7),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF2G14AC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa0),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF2G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa4),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF2GE4AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa6),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF2GE4AC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa2),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF1G14AC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x90),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF1G24AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x94),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF1GE4AD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x96),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
++ mx35lf1ge4ab_ecc_get_status)),
++ SPINAND_INFO("MX35UF1GE4AC",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x92),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 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/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
new file mode 100644
index 0000000..cc6900a
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/435-mtd-spinand-macronix-Add-Quad-support-for-serial-NAND-flash.patch
@@ -0,0 +1,88 @@
+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
+
+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
+--- 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[] = {
+ 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)),
+ SPINAND_INFO("MX35LF4GE4AD",
+@@ -136,7 +136,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+ 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)),
+ SPINAND_INFO("MX35LF1G24AD",
+@@ -146,16 +146,16 @@ static const struct spinand_info macronix_spinand_table[] = {
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+- 0,
++ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout, NULL)),
+ SPINAND_INFO("MX35LF2G24AD",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
+- NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 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, NULL)),
+ SPINAND_INFO("MX35LF4G24AD",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
+@@ -164,7 +164,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+- 0,
++ SPINAND_HAS_QE_BIT,
+ 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[] = {
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+- 0 /*SPINAND_HAS_QE_BIT*/,
++ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
+ SPINAND_INFO("MX31UF1GE4BC",
+@@ -183,7 +183,7 @@ static const struct spinand_info macronix_spinand_table[] = {
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+- 0 /*SPINAND_HAS_QE_BIT*/,
++ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&mx35lfxge4ab_ooblayout,
+ mx35lf1ge4ab_ecc_get_status)),
+
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/450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
new file mode 100644
index 0000000..b4fcfbc
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/450-mtd-spinand-micron-Generalize-the-OOB-layout-structure-and-function-names.patch
@@ -0,0 +1,83 @@
+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
+
+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
+--- 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,
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
+-static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
+- struct mtd_oob_region *region)
++static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
+ {
+ if (section)
+ return -ERANGE;
+
+- region->offset = 64;
+- region->length = 64;
++ region->offset = mtd->oobsize / 2;
++ region->length = mtd->oobsize / 2;
+
+ return 0;
+ }
+
+-static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section,
+- struct mtd_oob_region *region)
++static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
+ {
+ if (section)
+ return -ERANGE;
+
+ /* Reserve 2 bytes for the BBM. */
+ region->offset = 2;
+- region->length = 62;
++ region->length = (mtd->oobsize / 2) - 2;
+
+ return 0;
+ }
+
+-static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = {
+- .ecc = mt29f2g01abagd_ooblayout_ecc,
+- .free = mt29f2g01abagd_ooblayout_free,
++static const struct mtd_ooblayout_ops micron_8_ooblayout = {
++ .ecc = micron_8_ooblayout_ecc,
++ .free = micron_8_ooblayout_free,
+ };
+
+-static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
+- u8 status)
++static int micron_8_ecc_get_status(struct spinand_device *spinand,
++ u8 status)
+ {
+ switch (status & MICRON_STATUS_ECC_MASK) {
+ case STATUS_ECC_NO_BITFLIPS:
+@@ -99,8 +99,8 @@ static const struct spinand_info micron_spinand_table[] = {
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
+- mt29f2g01abagd_ecc_get_status)),
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops micron_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
new file mode 100644
index 0000000..31141db
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/451-mtd-spinand-micron-Describe-the-SPI-NAND-device-MT29F2G01ABAGD.patch
@@ -0,0 +1,29 @@
+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/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
new file mode 100644
index 0000000..be3a3b1
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/452-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices.patch
@@ -0,0 +1,59 @@
+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
+
+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
+--- 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[] = {
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
++ /* M79A 2Gb 1.8V */
++ SPINAND_INFO("MT29F2G01ABBGD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x25),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
++ /* M78A 1Gb 3.3V */
++ SPINAND_INFO("MT29F1G01ABAFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x14),
++ NAND_MEMORG(1, 2048, 128, 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_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
++ /* M78A 1Gb 1.8V */
++ SPINAND_INFO("MT29F1G01ABAFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x15),
++ NAND_MEMORG(1, 2048, 128, 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_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops micron_spinand_manuf_ops = {
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
new file mode 100644
index 0000000..59a4234
--- /dev/null
+++ 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
@@ -0,0 +1,79 @@
+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/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
new file mode 100644
index 0000000..158492f
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/454-mtd-spinand-micron-Add-M70A-series-Micron-SPI-NAND-devices.patch
@@ -0,0 +1,48 @@
+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
+
+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
+--- 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[] = {
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
++ /* M70A 4Gb 3.3V */
++ SPINAND_INFO("MT29F4G01ABAFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_CR_FEAT_BIT,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
++ /* M70A 4Gb 1.8V */
++ SPINAND_INFO("MT29F4G01ABBFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_CR_FEAT_BIT,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status)),
+ };
+
+ static int micron_spinand_init(struct spinand_device *spinand)
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/455-mtd-spinand-micron-Add-new-Micron-SPI-NAND-devices-with-multiple-dies.patch
new file mode 100644
index 0000000..8f8f1da
--- /dev/null
+++ b/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
@@ -0,0 +1,109 @@
+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
+
+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
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -20,6 +20,14 @@
+
+ #define MICRON_CFG_CR BIT(0)
+
++/*
++ * As per datasheet, die selection is done by the 6th bit of Die
++ * Select Register (Address 0xD0).
++ */
++#define MICRON_DIE_SELECT_REG 0xD0
++
++#define MICRON_SELECT_DIE(x) ((x) << 6)
++
+ 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),
+@@ -66,6 +74,20 @@ static const struct mtd_ooblayout_ops micron_8_ooblayout = {
+ .free = micron_8_ooblayout_free,
+ };
+
++static int micron_select_target(struct spinand_device *spinand,
++ unsigned int target)
++{
++ struct spi_mem_op op = SPINAND_SET_FEATURE_OP(MICRON_DIE_SELECT_REG,
++ spinand->scratchbuf);
++
++ if (target > 1)
++ return -EINVAL;
++
++ *spinand->scratchbuf = MICRON_SELECT_DIE(target);
++
++ return spi_mem_exec_op(spinand->spimem, &op);
++}
++
+ static int micron_8_ecc_get_status(struct spinand_device *spinand,
+ u8 status)
+ {
+@@ -137,6 +159,18 @@ static const struct spinand_info micron_spinand_table[] = {
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
++ /* M79A 4Gb 3.3V */
++ SPINAND_INFO("MT29F4G01ADAGD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x36),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 80, 2, 1, 2),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status),
++ SPINAND_SELECT_TARGET(micron_select_target)),
+ /* M70A 4Gb 3.3V */
+ SPINAND_INFO("MT29F4G01ABAFD",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34),
+@@ -159,6 +193,30 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_HAS_CR_FEAT_BIT,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
++ /* M70A 8Gb 3.3V */
++ SPINAND_INFO("MT29F8G01ADAFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x46),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_CR_FEAT_BIT,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status),
++ SPINAND_SELECT_TARGET(micron_select_target)),
++ /* M70A 8Gb 1.8V */
++ SPINAND_INFO("MT29F8G01ADBFD",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x47),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_CR_FEAT_BIT,
++ SPINAND_ECCINFO(µn_8_ooblayout,
++ micron_8_ecc_get_status),
++ SPINAND_SELECT_TARGET(micron_select_target)),
+ };
+
+ static int micron_spinand_init(struct spinand_device *spinand)
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/456-mtd-spinand-micron-Use-more-specific-names.patch
new file mode 100644
index 0000000..ec03ffe
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/456-mtd-spinand-micron-Use-more-specific-names.patch
@@ -0,0 +1,159 @@
+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
+
+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
+--- a/drivers/mtd/nand/spi/micron.c
++++ b/drivers/mtd/nand/spi/micron.c
+@@ -28,7 +28,7 @@
+
+ #define MICRON_SELECT_DIE(x) ((x) << 6)
+
+-static SPINAND_OP_VARIANTS(read_cache_variants,
++static SPINAND_OP_VARIANTS(quadio_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),
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
+@@ -36,11 +36,11 @@ 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));
+
+-static SPINAND_OP_VARIANTS(write_cache_variants,
++static SPINAND_OP_VARIANTS(x4_write_cache_variants,
+ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
+ SPINAND_PROG_LOAD(true, 0, NULL, 0));
+
+-static SPINAND_OP_VARIANTS(update_cache_variants,
++static SPINAND_OP_VARIANTS(x4_update_cache_variants,
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
+@@ -120,9 +120,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x24),
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -131,9 +131,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x25),
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -142,9 +142,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x14),
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -153,9 +153,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x15),
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -164,9 +164,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x36),
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 80, 2, 1, 2),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status),
+@@ -176,9 +176,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x34),
+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ SPINAND_HAS_CR_FEAT_BIT,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -187,9 +187,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x35),
+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ SPINAND_HAS_CR_FEAT_BIT,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status)),
+@@ -198,9 +198,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x46),
+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ SPINAND_HAS_CR_FEAT_BIT,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status),
+@@ -210,9 +210,9 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x47),
+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 2),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
++ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
++ &x4_write_cache_variants,
++ &x4_update_cache_variants),
+ SPINAND_HAS_CR_FEAT_BIT,
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status),
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/457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
new file mode 100644
index 0000000..ecd2b71
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/457-mtd-spinand-micron-Add-support-for-MT29F2G01AAAED.patch
@@ -0,0 +1,104 @@
+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
+
+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
+--- 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,
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
++/* Micron MT29F2G01AAAED Device */
++static SPINAND_OP_VARIANTS(x4_read_cache_variants,
++ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
++
++static SPINAND_OP_VARIANTS(x1_write_cache_variants,
++ SPINAND_PROG_LOAD(true, 0, NULL, 0));
++
++static SPINAND_OP_VARIANTS(x1_update_cache_variants,
++ SPINAND_PROG_LOAD(false, 0, NULL, 0));
++
+ static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+ {
+@@ -74,6 +87,47 @@ static const struct mtd_ooblayout_ops micron_8_ooblayout = {
+ .free = micron_8_ooblayout_free,
+ };
+
++static int micron_4_ooblayout_ecc(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
++{
++ struct spinand_device *spinand = mtd_to_spinand(mtd);
++
++ if (section >= spinand->base.memorg.pagesize /
++ mtd->ecc_step_size)
++ return -ERANGE;
++
++ region->offset = (section * 16) + 8;
++ region->length = 8;
++
++ return 0;
++}
++
++static int micron_4_ooblayout_free(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
++{
++ struct spinand_device *spinand = mtd_to_spinand(mtd);
++
++ if (section >= spinand->base.memorg.pagesize /
++ mtd->ecc_step_size)
++ return -ERANGE;
++
++ if (section) {
++ region->offset = 16 * section;
++ region->length = 8;
++ } else {
++ /* section 0 has two bytes reserved for the BBM */
++ region->offset = 2;
++ region->length = 6;
++ }
++
++ return 0;
++}
++
++static const struct mtd_ooblayout_ops micron_4_ooblayout = {
++ .ecc = micron_4_ooblayout_ecc,
++ .free = micron_4_ooblayout_free,
++};
++
+ static int micron_select_target(struct spinand_device *spinand,
+ unsigned int target)
+ {
+@@ -217,6 +271,16 @@ static const struct spinand_info micron_spinand_table[] = {
+ SPINAND_ECCINFO(µn_8_ooblayout,
+ micron_8_ecc_get_status),
+ SPINAND_SELECT_TARGET(micron_select_target)),
++ /* M69A 2Gb 3.3V */
++ SPINAND_INFO("MT29F2G01AAAED",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x9F),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 80, 2, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&x4_read_cache_variants,
++ &x1_write_cache_variants,
++ &x1_update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(µn_4_ooblayout, NULL)),
+ };
+
+ static int micron_spinand_init(struct spinand_device *spinand)
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/470-mtd-spinand-toshiba-Rename-function-name-to-change-suffix-and-prefix-8Gbit.patch
new file mode 100644
index 0000000..80672e6
--- /dev/null
+++ b/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
@@ -0,0 +1,170 @@
+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)
+
+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(-)
+
+--- 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
+ static SPINAND_OP_VARIANTS(update_cache_variants,
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
+
+-static int tc58cxgxsx_ooblayout_ecc(struct mtd_info *mtd, int section,
+- struct mtd_oob_region *region)
++static int tx58cxgxsxraix_ooblayout_ecc(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
+ {
+ if (section > 0)
+ return -ERANGE;
+@@ -37,8 +37,8 @@ static int tc58cxgxsx_ooblayout_ecc(stru
+ return 0;
+ }
+
+-static int tc58cxgxsx_ooblayout_free(struct mtd_info *mtd, int section,
+- struct mtd_oob_region *region)
++static int tx58cxgxsxraix_ooblayout_free(struct mtd_info *mtd, int section,
++ struct mtd_oob_region *region)
+ {
+ if (section > 0)
+ return -ERANGE;
+@@ -50,13 +50,13 @@ static int tc58cxgxsx_ooblayout_free(str
+ return 0;
+ }
+
+-static const struct mtd_ooblayout_ops tc58cxgxsx_ooblayout = {
+- .ecc = tc58cxgxsx_ooblayout_ecc,
+- .free = tc58cxgxsx_ooblayout_free,
++static const struct mtd_ooblayout_ops tx58cxgxsxraix_ooblayout = {
++ .ecc = tx58cxgxsxraix_ooblayout_ecc,
++ .free = tx58cxgxsxraix_ooblayout_free,
+ };
+
+-static int tc58cxgxsx_ecc_get_status(struct spinand_device *spinand,
+- u8 status)
++static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
++ u8 status)
+ {
+ struct nand_device *nand = spinand_to_nand(spinand);
+ u8 mbf = 0;
+@@ -95,7 +95,7 @@ static int tc58cxgxsx_ecc_get_status(str
+
+ static const struct spinand_info toshiba_spinand_table[] = {
+ /* 3.3V 1Gb */
+- SPINAND_INFO("TC58CVG0S3",
++ SPINAND_INFO("TC58CVG0S3HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ /* 3.3V 2Gb */
+- SPINAND_INFO("TC58CVG1S3",
++ SPINAND_INFO("TC58CVG1S3HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ /* 3.3V 4Gb */
+- SPINAND_INFO("TC58CVG2S0",
++ SPINAND_INFO("TC58CVG2S0HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 3.3V 4Gb */
++ SPINAND_INFO("TC58CVG2S0HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xED),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ /* 1.8V 1Gb */
+- SPINAND_INFO("TC58CYG0S3",
++ SPINAND_INFO("TC58CYG0S3HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ /* 1.8V 2Gb */
+- SPINAND_INFO("TC58CYG1S3",
++ SPINAND_INFO("TC58CYG1S3HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ /* 1.8V 4Gb */
+- SPINAND_INFO("TC58CYG2S0",
++ SPINAND_INFO("TC58CYG2S0HRAIG",
+ 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
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+- SPINAND_ECCINFO(&tc58cxgxsx_ooblayout,
+- tc58cxgxsx_ecc_get_status)),
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops toshiba_spinand_manuf_ops = {
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/471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
new file mode 100644
index 0000000..ffa1ad8
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/471-mtd-spinand-toshiba-Support-for-new-Kioxia-Serial-NAND.patch
@@ -0,0 +1,205 @@
+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
+
+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
+--- 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,
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
+
++static SPINAND_OP_VARIANTS(write_cache_x4_variants,
++ SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
++ SPINAND_PROG_LOAD(true, 0, NULL, 0));
++
++static SPINAND_OP_VARIANTS(update_cache_x4_variants,
++ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
++ SPINAND_PROG_LOAD(false, 0, NULL, 0));
++
++/**
++ * Backward compatibility for 1st generation Serial NAND devices
++ * which don't support Quad Program Load operation.
++ */
+ 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,
+ }
+
+ static const struct spinand_info toshiba_spinand_table[] = {
+- /* 3.3V 1Gb */
++ /* 3.3V 1Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
+- /* 3.3V 2Gb */
++ /* 3.3V 2Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
+- /* 3.3V 4Gb */
++ /* 3.3V 4Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
+- /* 3.3V 4Gb */
+- SPINAND_INFO("TC58CVG2S0HRAIJ",
+- SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xED),
+- NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
+- NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+- &write_cache_variants,
+- &update_cache_variants),
+- 0,
+- SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+- tx58cxgxsxraix_ecc_get_status)),
+- /* 1.8V 1Gb */
++ /* 1.8V 1Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
+- /* 1.8V 2Gb */
++ /* 1.8V 2Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
+- /* 1.8V 4Gb */
++ /* 1.8V 4Gb (1st generation) */
+ 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[] = {
+ 0,
+ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
+ tx58cxgxsxraix_ecc_get_status)),
++
++ /*
++ * 2nd generation serial nand has HOLD_D which is equivalent to
++ * QE_BIT.
++ */
++ /* 3.3V 1Gb (2nd generation) */
++ SPINAND_INFO("TC58CVG0S3HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE2),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 3.3V 2Gb (2nd generation) */
++ SPINAND_INFO("TC58CVG1S3HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xEB),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 3.3V 4Gb (2nd generation) */
++ SPINAND_INFO("TC58CVG2S0HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xED),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 3.3V 8Gb (2nd generation) */
++ SPINAND_INFO("TH58CVG3S0HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
++ NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 1.8V 1Gb (2nd generation) */
++ SPINAND_INFO("TC58CYG0S3HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD2),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 1.8V 2Gb (2nd generation) */
++ SPINAND_INFO("TC58CYG1S3HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xDB),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 1.8V 4Gb (2nd generation) */
++ SPINAND_INFO("TC58CYG2S0HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xDD),
++ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
++ /* 1.8V 8Gb (2nd generation) */
++ SPINAND_INFO("TH58CYG3S0HRAIJ",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD4),
++ NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_x4_variants,
++ &update_cache_x4_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&tx58cxgxsxraix_ooblayout,
++ tx58cxgxsxraix_ecc_get_status)),
+ };
+
+ static const struct spinand_manufacturer_ops toshiba_spinand_manuf_ops = {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/768-net-sfp-cope-with-SFPs-that-set-both-LOS-normal-and-.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/768-net-sfp-cope-with-SFPs-that-set-both-LOS-normal-and-.patch
new file mode 100644
index 0000000..fbbaae1
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/768-net-sfp-cope-with-SFPs-that-set-both-LOS-normal-and-.patch
@@ -0,0 +1,94 @@
+From da5bc1832b325b15e4cca3b63861ecf48be870ef Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Sun, 10 Jan 2021 10:58:32 +0000
+Subject: [PATCH] net: sfp: cope with SFPs that set both LOS normal and LOS
+ inverted
+
+The SFP MSA defines two option bits in byte 65 to indicate how the
+Rx_LOS signal on SFP pin 8 behaves:
+
+bit 2 - Loss of Signal implemented, signal inverted from standard
+ definition in SFP MSA (often called "Signal Detect").
+bit 1 - Loss of Signal implemented, signal as defined in SFP MSA
+ (often called "Rx_LOS").
+
+Clearly, setting both bits results in a meaningless situation: it would
+mean that LOS is implemented in both the normal sense (1 = signal loss)
+and inverted sense (0 = signal loss).
+
+Unfortunately, there are modules out there which set both bits, which
+will be initially interpret as "inverted" sense, and then, if the LOS
+signal changes state, we will toggle between LINK_UP and WAIT_LOS
+states.
+
+Change our LOS handling to give well defined behaviour: only interpret
+these bits as meaningful if exactly one is set, otherwise treat it as
+if LOS is not implemented.
+
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Link: https://lore.kernel.org/r/E1kyYQa-0004iR-CU@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/phy/sfp.c | 36 ++++++++++++++++++++++--------------
+ 1 file changed, 22 insertions(+), 14 deletions(-)
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -1430,15 +1430,19 @@ static void sfp_sm_link_down(struct sfp
+
+ static void sfp_sm_link_check_los(struct sfp *sfp)
+ {
+- unsigned int los = sfp->state & SFP_F_LOS;
++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++ bool los = false;
+
+ /* If neither SFP_OPTIONS_LOS_INVERTED nor SFP_OPTIONS_LOS_NORMAL
+- * are set, we assume that no LOS signal is available.
++ * are set, we assume that no LOS signal is available. If both are
++ * set, we assume LOS is not implemented (and is meaningless.)
+ */
+- if (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED))
+- los ^= SFP_F_LOS;
+- else if (!(sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL)))
+- los = 0;
++ if (los_options == los_inverted)
++ los = !(sfp->state & SFP_F_LOS);
++ else if (los_options == los_normal)
++ los = !!(sfp->state & SFP_F_LOS);
+
+ if (los)
+ sfp_sm_next(sfp, SFP_S_WAIT_LOS, 0);
+@@ -1448,18 +1452,22 @@ static void sfp_sm_link_check_los(struct
+
+ static bool sfp_los_event_active(struct sfp *sfp, unsigned int event)
+ {
+- return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
+- event == SFP_E_LOS_LOW) ||
+- (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
+- event == SFP_E_LOS_HIGH);
++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++
++ return (los_options == los_inverted && event == SFP_E_LOS_LOW) ||
++ (los_options == los_normal && event == SFP_E_LOS_HIGH);
+ }
+
+ static bool sfp_los_event_inactive(struct sfp *sfp, unsigned int event)
+ {
+- return (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_INVERTED) &&
+- event == SFP_E_LOS_HIGH) ||
+- (sfp->id.ext.options & cpu_to_be16(SFP_OPTIONS_LOS_NORMAL) &&
+- event == SFP_E_LOS_LOW);
++ const __be16 los_inverted = cpu_to_be16(SFP_OPTIONS_LOS_INVERTED);
++ const __be16 los_normal = cpu_to_be16(SFP_OPTIONS_LOS_NORMAL);
++ __be16 los_options = sfp->id.ext.options & (los_inverted | los_normal);
++
++ return (los_options == los_inverted && event == SFP_E_LOS_HIGH) ||
++ (los_options == los_normal && event == SFP_E_LOS_LOW);
+ }
+
+ static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch
new file mode 100644
index 0000000..e90977c
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-1-net-dsa-Move-VLAN-filtering-syncing-out-of-dsa_switc.patch
@@ -0,0 +1,75 @@
+From dee0f71c39afdaa30af7b94af420ca1d5c0f0349 Mon Sep 17 00:00:00 2001
+From: Tobias Waldekranz <tobias@waldekranz.com>
+Date: Mon, 24 Jan 2022 22:09:43 +0100
+Subject: [PATCH 5.4 1/2] net: dsa: Move VLAN filtering syncing out of
+ dsa_switch_bridge_leave
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit 381a730182f1d174e1950cd4e63e885b1c302051 upstream.
+
+Most of dsa_switch_bridge_leave was, in fact, dealing with the syncing
+of VLAN filtering for switches on which that is a global
+setting. Separate the two phases to prepare for the cross-chip related
+bugfix in the following commit.
+
+Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Marek Behún <kabel@kernel.org>
+---
+ net/dsa/switch.c | 31 ++++++++++++++++++++++---------
+ 1 file changed, 22 insertions(+), 9 deletions(-)
+
+--- a/net/dsa/switch.c
++++ b/net/dsa/switch.c
+@@ -65,19 +65,12 @@ static int dsa_switch_bridge_join(struct
+ return 0;
+ }
+
+-static int dsa_switch_bridge_leave(struct dsa_switch *ds,
+- struct dsa_notifier_bridge_info *info)
++static int dsa_switch_sync_vlan_filtering(struct dsa_switch *ds,
++ struct dsa_notifier_bridge_info *info)
+ {
+ bool unset_vlan_filtering = br_vlan_enabled(info->br);
+ int err, i;
+
+- if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
+- ds->ops->port_bridge_leave(ds, info->port, info->br);
+-
+- if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
+- ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
+- info->br);
+-
+ /* If the bridge was vlan_filtering, the bridge core doesn't trigger an
+ * event for changing vlan_filtering setting upon slave ports leaving
+ * it. That is a good thing, because that lets us handle it and also
+@@ -103,6 +96,26 @@ static int dsa_switch_bridge_leave(struc
+ if (err && err != EOPNOTSUPP)
+ return err;
+ }
++
++ return 0;
++}
++
++static int dsa_switch_bridge_leave(struct dsa_switch *ds,
++ struct dsa_notifier_bridge_info *info)
++{
++ int err;
++
++ if (ds->index == info->sw_index && ds->ops->port_bridge_leave)
++ ds->ops->port_bridge_leave(ds, info->port, info->br);
++
++ if (ds->index != info->sw_index && ds->ops->crosschip_bridge_leave)
++ ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
++ info->br);
++
++ err = dsa_switch_sync_vlan_filtering(ds, info);
++ if (err)
++ return err;
++
+ return 0;
+ }
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-2-net-dsa-Avoid-cross-chip-syncing-of-VLAN-filtering.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-2-net-dsa-Avoid-cross-chip-syncing-of-VLAN-filtering.patch
new file mode 100644
index 0000000..983cc45
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/781-v5.18-2-net-dsa-Avoid-cross-chip-syncing-of-VLAN-filtering.patch
@@ -0,0 +1,58 @@
+From f6edb463510bd936f143907468fc0bf0762b87bf Mon Sep 17 00:00:00 2001
+From: Tobias Waldekranz <tobias@waldekranz.com>
+Date: Mon, 24 Jan 2022 22:09:44 +0100
+Subject: [PATCH 5.4 2/2] net: dsa: Avoid cross-chip syncing of VLAN filtering
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit 108dc8741c203e9d6ce4e973367f1bac20c7192b upstream.
+
+Changes to VLAN filtering are not applicable to cross-chip
+notifications.
+
+On a system like this:
+
+.-----. .-----. .-----.
+| sw1 +---+ sw2 +---+ sw3 |
+'-1-2-' '-1-2-' '-1-2-'
+
+Before this change, upon sw1p1 leaving a bridge, a call to
+dsa_port_vlan_filtering would also be made to sw2p1 and sw3p1.
+
+In this scenario:
+
+.---------. .-----. .-----.
+| sw1 +---+ sw2 +---+ sw3 |
+'-1-2-3-4-' '-1-2-' '-1-2-'
+
+When sw1p4 would leave a bridge, dsa_port_vlan_filtering would be
+called for sw2 and sw3 with a non-existing port - leading to array
+out-of-bounds accesses and crashes on mv88e6xxx.
+
+Fixes: d371b7c92d19 ("net: dsa: Unset vlan_filtering when ports leave the bridge")
+Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Marek Behún <kabel@kernel.org>
+---
+ net/dsa/switch.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/net/dsa/switch.c
++++ b/net/dsa/switch.c
+@@ -112,9 +112,11 @@ static int dsa_switch_bridge_leave(struc
+ ds->ops->crosschip_bridge_leave(ds, info->sw_index, info->port,
+ info->br);
+
+- err = dsa_switch_sync_vlan_filtering(ds, info);
+- if (err)
+- return err;
++ if (ds->index == info->sw_index) {
++ err = dsa_switch_sync_vlan_filtering(ds, info);
++ if (err)
++ return err;
++ }
+
+ return 0;
+ }
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0001-net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2.0-w.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0001-net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2.0-w.patch
index 1901054..39f4b27 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0001-net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2.0-w.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0001-net-sfp-VSOL-V2801F-CarlitoxxPro-CPGOS03-0490-v2.0-w.patch
@@ -68,7 +68,7 @@
msgs[1].len = this_len;
-@@ -1569,6 +1579,28 @@ static int sfp_sm_mod_hpower(struct sfp
+@@ -1577,6 +1587,28 @@ static int sfp_sm_mod_hpower(struct sfp
return 0;
}
@@ -97,7 +97,7 @@
static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
{
/* SFP module inserted - read I2C data */
-@@ -1577,14 +1609,20 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1585,14 +1617,20 @@ static int sfp_sm_mod_probe(struct sfp *
u8 check;
int ret;
@@ -120,7 +120,7 @@
dev_err(sfp->dev, "EEPROM short read: %d\n", ret);
return -EAGAIN;
}
-@@ -1612,6 +1650,21 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1620,6 +1658,21 @@ static int sfp_sm_mod_probe(struct sfp *
}
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0002-net-sfp-add-workaround-for-Realtek-RTL8672-and-RTL96.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0002-net-sfp-add-workaround-for-Realtek-RTL8672-and-RTL96.patch
index 27ae97c..8c95284 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0002-net-sfp-add-workaround-for-Realtek-RTL8672-and-RTL96.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/backport-5.4/852-v5.10-0002-net-sfp-add-workaround-for-Realtek-RTL8672-and-RTL96.patch
@@ -102,7 +102,7 @@
err = sfp_read(sfp, true, 0, &sfp->diag, sizeof(sfp->diag));
if (err < 0) {
if (sfp->hwmon_tries--) {
-@@ -1579,26 +1585,30 @@ static int sfp_sm_mod_hpower(struct sfp
+@@ -1587,26 +1593,30 @@ static int sfp_sm_mod_hpower(struct sfp
return 0;
}
@@ -149,7 +149,7 @@
}
static int sfp_sm_mod_probe(struct sfp *sfp, bool report)
-@@ -1609,11 +1619,11 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1617,11 +1627,11 @@ static int sfp_sm_mod_probe(struct sfp *
u8 check;
int ret;
@@ -165,7 +165,7 @@
ret = sfp_read(sfp, false, 0, &id.base, sizeof(id.base));
if (ret < 0) {
-@@ -1627,6 +1637,33 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1635,6 +1645,33 @@ static int sfp_sm_mod_probe(struct sfp *
return -EAGAIN;
}
@@ -199,7 +199,7 @@
/* Cotsworks do not seem to update the checksums when they
* do the final programming with the final module part number,
* serial number and date code.
-@@ -1650,9 +1687,6 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1658,9 +1695,6 @@ static int sfp_sm_mod_probe(struct sfp *
}
}
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 d050883..1c5cf64 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,7 +163,25 @@
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://430-mtd-spinand-macronix-Add-support-for-MX31LF1GE4BC.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 \
@@ -209,6 +227,7 @@
file://757-v5.8-net-dsa-tag_rtl4_a-Implement-Realtek-4-byte-A-tag.patch \
file://758-v5.8-net-dsa-rtl8366rb-Support-the-CPU-DSA-tag.patch \
file://765-v5.12-net-dsa-automatically-bring-up-DSA-master-when-openi.patch \
+ file://768-net-sfp-cope-with-SFPs-that-set-both-LOS-normal-and-.patch \
file://770-v5.12-net-bridge-notify-switchdev-of-disappearance-of-old-.patch \
file://771-v5.12-net-dsa-be-louder-when-a-non-legacy-FDB-operation-fa.patch \
file://772-v5.12-net-dsa-don-t-use-switchdev_notifier_fdb_info-in-dsa.patch \
@@ -216,6 +235,8 @@
file://774-v5.12-net-dsa-exit-early-in-dsa_slave_switchdev_event-if-w.patch \
file://775-v5.12-net-dsa-listen-for-SWITCHDEV_-FDB-DEL-_ADD_TO_DEVICE.patch \
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://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.5-hwmon-Driver-for-disk-and-solid-state-drives-with-te.patch \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/defconfig b/recipes-kernel/linux/linux-mediatek-5.4/generic/defconfig
index aba2911..73ba6af 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/defconfig
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/defconfig
@@ -652,6 +652,7 @@
# CONFIG_BPFILTER is not set
CONFIG_BPF_JIT=y
# CONFIG_BPF_JIT_ALWAYS_ON is not set
+# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set
# CONFIG_BPF_STREAM_PARSER is not set
CONFIG_BPF_SYSCALL=y
# CONFIG_BPQETHER is not set
@@ -1871,6 +1872,7 @@
CONFIG_HARDENED_USERCOPY=y
# CONFIG_HARDENED_USERCOPY_FALLBACK is not set
# CONFIG_HARDENED_USERCOPY_PAGESPAN is not set
+CONFIG_HARDEN_BRANCH_HISTORY=y
CONFIG_HARDEN_EL2_VECTORS=y
# CONFIG_HARDLOCKUP_DETECTOR is not set
# CONFIG_HAVE_AOUT is not set
@@ -3055,6 +3057,7 @@
# CONFIG_MISDN_NETJET is not set
# CONFIG_MISDN_SPEEDFAX is not set
# CONFIG_MISDN_W6692 is not set
+CONFIG_MITIGATE_SPECTRE_BRANCH_HISTORY=y
# CONFIG_MKISS is not set
# CONFIG_MLX4_CORE is not set
# CONFIG_MLX4_EN is not set
@@ -3315,7 +3318,6 @@
# CONFIG_MTD_UIMAGE_SPLIT is not set
# CONFIG_MTD_VIRT_CONCAT is not set
# CONFIG_MTK_MMC is not set
-# CONFIG_MTK_SPI_NAND is not set
CONFIG_MULTIUSER=y
# CONFIG_MUTEX_SPIN_ON_OWNER is not set
# CONFIG_MV643XX_ETH is not set
@@ -3813,7 +3815,6 @@
# CONFIG_NLS_MAC_ROMANIAN is not set
# CONFIG_NLS_MAC_TURKISH is not set
# CONFIG_NLS_UTF8 is not set
-# CONFIG_NMBM is not set
CONFIG_NMI_LOG_BUF_SHIFT=13
# CONFIG_NOA1305 is not set
# CONFIG_NOP_USB_XCEIV is not set
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/220-gc_sections.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/220-gc_sections.patch
index fdfaf51..da85f16 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/220-gc_sections.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/220-gc_sections.patch
@@ -72,7 +72,7 @@
--- a/arch/arm/kernel/vmlinux.lds.h
+++ b/arch/arm/kernel/vmlinux.lds.h
-@@ -22,13 +22,13 @@
+@@ -22,7 +22,7 @@
#define ARM_MMU_DISCARD(x)
#else
#define ARM_MMU_KEEP(x)
@@ -80,6 +80,8 @@
+#define ARM_MMU_DISCARD(x) KEEP(x)
#endif
+ /*
+@@ -41,7 +41,7 @@
#define PROC_INFO \
. = ALIGN(4); \
__proc_info_begin = .; \
@@ -88,7 +90,7 @@
__proc_info_end = .;
#define HYPERVISOR_TEXT \
-@@ -39,11 +39,11 @@
+@@ -52,11 +52,11 @@
#define IDMAP_TEXT \
ALIGN_FUNCTION(); \
__idmap_text_start = .; \
@@ -102,7 +104,7 @@
__hyp_idmap_text_end = .;
#define ARM_DISCARD \
-@@ -86,12 +86,12 @@
+@@ -99,12 +99,12 @@
. = ALIGN(8); \
.ARM.unwind_idx : { \
__start_unwind_idx = .; \
@@ -117,20 +119,21 @@
__stop_unwind_tab = .; \
}
-@@ -102,14 +102,14 @@
- #define ARM_VECTORS \
- __vectors_start = .; \
- .vectors 0xffff0000 : AT(__vectors_start) { \
-- *(.vectors) \
-+ KEEP(*(.vectors)) \
- } \
- . = __vectors_start + SIZEOF(.vectors); \
- __vectors_end = .; \
+@@ -116,7 +116,7 @@
+ __vectors_lma = .; \
+ OVERLAY 0xffff0000 : NOCROSSREFS AT(__vectors_lma) { \
+ .vectors { \
+- *(.vectors) \
++ KEEP(*(.vectors)) \
+ } \
+ .vectors.bhb.loop8 { \
+ *(.vectors.bhb.loop8) \
+@@ -134,7 +134,7 @@
\
- __stubs_start = .; \
- .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_start) { \
+ __stubs_lma = .; \
+ .stubs ADDR(.vectors) + 0x1000 : AT(__stubs_lma) { \
- *(.stubs) \
+ KEEP(*(.stubs)) \
} \
- . = __stubs_start + SIZEOF(.stubs); \
- __stubs_end = .; \
+ ARM_LMA(__stubs, .stubs); \
+ . = __stubs_lma + SIZEOF(.stubs); \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/251-sound_kconfig.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/251-sound_kconfig.patch
index f593417..e0ab4ee 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/251-sound_kconfig.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/251-sound_kconfig.patch
@@ -92,7 +92,7 @@
bool
--- a/lib/Kconfig
+++ b/lib/Kconfig
-@@ -402,16 +402,16 @@ config BCH_CONST_T
+@@ -401,16 +401,16 @@ config BCH_CONST_T
# Textsearch support is select'ed if needed
#
config TEXTSEARCH
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/902-debloat_proc.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/902-debloat_proc.patch
index c680e7b..0309b3c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/902-debloat_proc.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/hack-5.4/902-debloat_proc.patch
@@ -330,7 +330,7 @@
--- a/net/core/sock.c
+++ b/net/core/sock.c
-@@ -3643,6 +3643,8 @@ static __net_initdata struct pernet_oper
+@@ -3641,6 +3641,8 @@ static __net_initdata struct pernet_oper
static int __init proto_init(void)
{
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/447-mtd-spinand-gigadevice-Add-support-for-GD5F4GQ4xC.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/447-mtd-spinand-gigadevice-Add-support-for-GD5F4GQ4xC.patch
deleted file mode 100644
index e1fcb15..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/447-mtd-spinand-gigadevice-Add-support-for-GD5F4GQ4xC.patch
+++ /dev/null
@@ -1,87 +0,0 @@
-From 30521ccfb4597f91b9e5c7967acef9c7c85e58a8 Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Wed, 12 Aug 2020 22:50:26 +0200
-Subject: [PATCH v2 447/447] mtd: spinand: gigadevice: Add support for
- GD5F4GQ4xC
-
-This adds support for the following 4GiB chips:
-GD5F4GQ4RCYIG 1.8V
-GD5F4GQ4UCYIG 3.3V
-
-The datasheet can be found here:
-https://www.novitronic.ch/sixcms/media.php/2/DS-00173-GD5F4GQ4xCxIG-Rev1.574695.pdf
-
-The GD5F4GQ4UCYIGT (3.3V) version is used on the Imagination
-Technologies Creator Ci40 (Marduk), the 1.8V version was not tested.
-
-This device only works in single SPI mode and not in dual or quad mode
-for me on this board.
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- drivers/mtd/nand/spi/gigadevice.c | 49 +++++++++++++++++++++++++++++++
- 1 file changed, 49 insertions(+)
-
---- a/drivers/mtd/nand/spi/gigadevice.c
-+++ b/drivers/mtd/nand/spi/gigadevice.c
-@@ -132,6 +132,35 @@ static const struct mtd_ooblayout_ops gd
- .free = gd5fxgq4_variant2_ooblayout_free,
- };
-
-+static int gd5fxgq4xc_ooblayout_256_ecc(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *oobregion)
-+{
-+ if (section)
-+ return -ERANGE;
-+
-+ oobregion->offset = 128;
-+ oobregion->length = 128;
-+
-+ return 0;
-+}
-+
-+static int gd5fxgq4xc_ooblayout_256_free(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *oobregion)
-+{
-+ if (section)
-+ return -ERANGE;
-+
-+ oobregion->offset = 1;
-+ oobregion->length = 127;
-+
-+ return 0;
-+}
-+
-+static const struct mtd_ooblayout_ops gd5fxgq4xc_oob_256_ops = {
-+ .ecc = gd5fxgq4xc_ooblayout_256_ecc,
-+ .free = gd5fxgq4xc_ooblayout_256_free,
-+};
-+
- static int gd5fxgq4uexxg_ecc_get_status(struct spinand_device *spinand,
- u8 status)
- {
-@@ -222,6 +251,24 @@ static const struct spinand_info gigadev
- SPINAND_HAS_QE_BIT,
- SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
- gd5fxgq4xa_ecc_get_status)),
-+ SPINAND_INFO("GD5F4GQ4RC", 0xa468,
-+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ SPINAND_HAS_QE_BIT,
-+ SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops,
-+ gd5fxgq4ufxxg_ecc_get_status)),
-+ SPINAND_INFO("GD5F4GQ4UC", 0xb468,
-+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants_f,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ SPINAND_HAS_QE_BIT,
-+ SPINAND_ECCINFO(&gd5fxgq4xc_oob_256_ops,
-+ gd5fxgq4ufxxg_ecc_get_status)),
- SPINAND_INFO("GD5F1GQ4UExxG", 0xd1,
- NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
- NAND_ECCREQ(8, 512),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/530-jffs2_make_lzma_available.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/530-jffs2_make_lzma_available.patch
index 052db7e..4d47e03 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/530-jffs2_make_lzma_available.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/530-jffs2_make_lzma_available.patch
@@ -1087,7 +1087,7 @@
#define JFFS2_NODE_ACCURATE 0x2000
--- a/lib/Kconfig
+++ b/lib/Kconfig
-@@ -303,6 +303,12 @@ config ZSTD_DECOMPRESS
+@@ -302,6 +302,12 @@ config ZSTD_DECOMPRESS
source "lib/xz/Kconfig"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/630-packet_socket_type.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/630-packet_socket_type.patch
index df1de5a..0e6feec 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/630-packet_socket_type.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/630-packet_socket_type.patch
@@ -87,7 +87,7 @@
if (!net_eq(dev_net(dev), sock_net(sk)))
goto drop;
-@@ -3293,6 +3295,7 @@ static int packet_create(struct net *net
+@@ -3296,6 +3298,7 @@ static int packet_create(struct net *net
mutex_init(&po->pg_vec_lock);
po->rollover = NULL;
po->prot_hook.func = packet_rcv;
@@ -95,7 +95,7 @@
if (sock->type == SOCK_PACKET)
po->prot_hook.func = packet_rcv_spkt;
-@@ -3930,6 +3933,16 @@ packet_setsockopt(struct socket *sock, i
+@@ -3939,6 +3942,16 @@ packet_setsockopt(struct socket *sock, i
po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
return 0;
}
@@ -112,7 +112,7 @@
default:
return -ENOPROTOOPT;
}
-@@ -3986,6 +3999,13 @@ static int packet_getsockopt(struct sock
+@@ -3995,6 +4008,13 @@ static int packet_getsockopt(struct sock
case PACKET_VNET_HDR:
val = po->has_vnet_hdr;
break;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/739-net-avoid-tx-fault-with-Nokia-GPON-module.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/739-net-avoid-tx-fault-with-Nokia-GPON-module.patch
index 6648d10..4c5f99a 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/739-net-avoid-tx-fault-with-Nokia-GPON-module.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/739-net-avoid-tx-fault-with-Nokia-GPON-module.patch
@@ -47,7 +47,7 @@
#if IS_ENABLED(CONFIG_HWMON)
struct sfp_diag diag;
-@@ -1742,6 +1753,12 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1750,6 +1761,12 @@ static int sfp_sm_mod_probe(struct sfp *
if (ret < 0)
return ret;
@@ -60,7 +60,7 @@
return 0;
}
-@@ -1947,11 +1964,12 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1955,11 +1972,12 @@ static void sfp_sm_main(struct sfp *sfp,
break;
if (sfp->state & SFP_F_TX_FAULT) {
@@ -77,7 +77,7 @@
if (timeout > T_WAIT)
timeout -= T_WAIT;
else
-@@ -1968,8 +1986,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1976,8 +1994,8 @@ static void sfp_sm_main(struct sfp *sfp,
case SFP_S_INIT:
if (event == SFP_E_TIMEOUT && sfp->state & SFP_F_TX_FAULT) {
@@ -88,7 +88,7 @@
*/
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
sfp->sm_retries == 5);
-@@ -1988,7 +2006,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1996,7 +2014,7 @@ static void sfp_sm_main(struct sfp *sfp,
case SFP_S_INIT_TX_FAULT:
if (event == SFP_E_TIMEOUT) {
sfp_module_tx_fault_reset(sfp);
@@ -97,7 +97,7 @@
}
break;
-@@ -2012,7 +2030,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2020,7 +2038,7 @@ static void sfp_sm_main(struct sfp *sfp,
case SFP_S_TX_FAULT:
if (event == SFP_E_TIMEOUT) {
sfp_module_tx_fault_reset(sfp);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/740-net-sfp-remove-incomplete-100BASE-FX-and-100BASE-LX-.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/740-net-sfp-remove-incomplete-100BASE-FX-and-100BASE-LX-.patch
index 1abc34e..e439d19 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/740-net-sfp-remove-incomplete-100BASE-FX-and-100BASE-LX-.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/740-net-sfp-remove-incomplete-100BASE-FX-and-100BASE-LX-.patch
@@ -30,7 +30,7 @@
if (phylink_test(link_modes, 1000baseX_Full))
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -1505,18 +1505,7 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1513,18 +1513,7 @@ static void sfp_sm_fault(struct sfp *sfp
static void sfp_sm_probe_for_phy(struct sfp *sfp)
{
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/743-net-sfp-add-module-start-stop-upstream-notifications.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/743-net-sfp-add-module-start-stop-upstream-notifications.patch
index ba1b5b5..5020013 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/743-net-sfp-add-module-start-stop-upstream-notifications.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/743-net-sfp-add-module-start-stop-upstream-notifications.patch
@@ -78,7 +78,7 @@
[SFP_S_WAIT] = "wait",
[SFP_S_INIT] = "init",
[SFP_S_INIT_TX_FAULT] = "init_tx_fault",
-@@ -1918,6 +1920,8 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1926,6 +1928,8 @@ static void sfp_sm_main(struct sfp *sfp,
if (sfp->sm_state == SFP_S_LINK_UP &&
sfp->sm_dev_state == SFP_DEV_UP)
sfp_sm_link_down(sfp);
@@ -87,7 +87,7 @@
if (sfp->mod_phy)
sfp_sm_phy_detach(sfp);
sfp_module_tx_disable(sfp);
-@@ -1985,6 +1989,10 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1993,6 +1997,10 @@ static void sfp_sm_main(struct sfp *sfp,
* clear. Probe for the PHY and check the LOS state.
*/
sfp_sm_probe_for_phy(sfp);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/753-net-sfp-add-support-for-Clause-45-PHYs.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/753-net-sfp-add-support-for-Clause-45-PHYs.patch
index dcd1ba7..f7c4bc1 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/753-net-sfp-add-support-for-Clause-45-PHYs.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/753-net-sfp-add-support-for-Clause-45-PHYs.patch
@@ -43,7 +43,7 @@
err = sfp_add_phy(sfp->sfp_bus, phy);
if (err) {
phy_device_remove(phy);
-@@ -1503,10 +1510,32 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1511,10 +1518,32 @@ static void sfp_sm_fault(struct sfp *sfp
}
}
@@ -78,7 +78,7 @@
}
static int sfp_module_parse_power(struct sfp *sfp)
-@@ -1566,6 +1595,13 @@ static int sfp_sm_mod_hpower(struct sfp
+@@ -1574,6 +1603,13 @@ static int sfp_sm_mod_hpower(struct sfp
return -EAGAIN;
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/754-net-sfp-fix-unbind.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/754-net-sfp-fix-unbind.patch
index c31922e..6872973 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/754-net-sfp-fix-unbind.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/754-net-sfp-fix-unbind.patch
@@ -15,7 +15,7 @@
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -2431,6 +2431,10 @@ static int sfp_remove(struct platform_de
+@@ -2439,6 +2439,10 @@ static int sfp_remove(struct platform_de
sfp_unregister_socket(sfp->sfp_bus);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/755-net-sfp-fix-hwmon.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/755-net-sfp-fix-hwmon.patch
index a18e480..be3b19b 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/755-net-sfp-fix-hwmon.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/755-net-sfp-fix-hwmon.patch
@@ -15,7 +15,7 @@
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -1883,6 +1883,10 @@ static void sfp_sm_module(struct sfp *sf
+@@ -1891,6 +1891,10 @@ static void sfp_sm_module(struct sfp *sf
break;
}
@@ -26,7 +26,7 @@
sfp_sm_mod_next(sfp, SFP_MOD_WAITDEV, 0);
/* fall through */
case SFP_MOD_WAITDEV:
-@@ -1932,15 +1936,6 @@ static void sfp_sm_module(struct sfp *sf
+@@ -1940,15 +1944,6 @@ static void sfp_sm_module(struct sfp *sf
case SFP_MOD_ERROR:
break;
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
index ba4f8c4..c8e3cf5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/756-net-sfp-use-a-definition-for-the-fault-recovery-atte.patch
@@ -26,7 +26,7 @@
/* SFP module presence detection is poor: the three MOD DEF signals are
* the same length on the PCB, which means it's possible for MOD DEF 0 to
* connect before the I2C bus on MOD DEF 1/2.
-@@ -1972,7 +1980,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1980,7 +1988,7 @@ static void sfp_sm_main(struct sfp *sfp,
sfp_module_tx_enable(sfp);
/* Initialise the fault clearance retries */
@@ -35,7 +35,7 @@
/* We need to check the TX_FAULT state, which is not defined
* while TX_DISABLE is asserted. The earliest we want to do
-@@ -2012,7 +2020,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2020,7 +2028,7 @@ static void sfp_sm_main(struct sfp *sfp,
* or t_start_up, so assume there is a fault.
*/
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
@@ -44,7 +44,7 @@
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
* clear. Probe for the PHY and check the LOS state.
-@@ -2025,7 +2033,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2033,7 +2041,7 @@ static void sfp_sm_main(struct sfp *sfp,
sfp_sm_link_check_los(sfp);
/* Reset the fault retry count */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/757-net-sfp-rename-sm_retries.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/757-net-sfp-rename-sm_retries.patch
index 13f3b6c..a8d3f32 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/757-net-sfp-rename-sm_retries.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/757-net-sfp-rename-sm_retries.patch
@@ -22,7 +22,7 @@
struct sfp_eeprom_id id;
unsigned int module_power_mW;
-@@ -1506,7 +1506,7 @@ static bool sfp_los_event_inactive(struc
+@@ -1514,7 +1514,7 @@ static bool sfp_los_event_inactive(struc
static void sfp_sm_fault(struct sfp *sfp, unsigned int next_state, bool warn)
{
@@ -31,7 +31,7 @@
dev_err(sfp->dev,
"module persistently indicates fault, disabling\n");
sfp_sm_next(sfp, SFP_S_TX_DISABLE, 0);
-@@ -1980,7 +1980,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -1988,7 +1988,7 @@ static void sfp_sm_main(struct sfp *sfp,
sfp_module_tx_enable(sfp);
/* Initialise the fault clearance retries */
@@ -40,7 +40,7 @@
/* We need to check the TX_FAULT state, which is not defined
* while TX_DISABLE is asserted. The earliest we want to do
-@@ -2020,7 +2020,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2028,7 +2028,7 @@ static void sfp_sm_main(struct sfp *sfp,
* or t_start_up, so assume there is a fault.
*/
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
@@ -49,7 +49,7 @@
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
* clear. Probe for the PHY and check the LOS state.
-@@ -2033,7 +2033,7 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2041,7 +2041,7 @@ static void sfp_sm_main(struct sfp *sfp,
sfp_sm_link_check_los(sfp);
/* Reset the fault retry count */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/758-net-sfp-error-handling-for-phy-probe.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/758-net-sfp-error-handling-for-phy-probe.patch
index dfa772d..5964ed5 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/758-net-sfp-error-handling-for-phy-probe.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/758-net-sfp-error-handling-for-phy-probe.patch
@@ -55,7 +55,7 @@
}
static void sfp_sm_link_up(struct sfp *sfp)
-@@ -1529,21 +1531,24 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1537,21 +1539,24 @@ static void sfp_sm_fault(struct sfp *sfp
* Clause 45 copper SFP+ modules (10G) appear to switch their interface
* mode according to the negotiated line speed.
*/
@@ -83,7 +83,7 @@
}
static int sfp_module_parse_power(struct sfp *sfp)
-@@ -2025,7 +2030,10 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2033,7 +2038,10 @@ static void sfp_sm_main(struct sfp *sfp,
init_done: /* TX_FAULT deasserted or we timed out with TX_FAULT
* clear. Probe for the PHY and check the LOS state.
*/
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/759-net-sfp-re-attempt-probing-for-phy.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/759-net-sfp-re-attempt-probing-for-phy.patch
index aebb6b0..27e2187 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/759-net-sfp-re-attempt-probing-for-phy.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/759-net-sfp-re-attempt-probing-for-phy.patch
@@ -69,7 +69,7 @@
if (IS_ERR(phy)) {
dev_err(sfp->dev, "mdiobus scan returned %ld\n", PTR_ERR(phy));
return PTR_ERR(phy);
-@@ -1954,6 +1961,7 @@ static void sfp_sm_module(struct sfp *sf
+@@ -1962,6 +1969,7 @@ static void sfp_sm_module(struct sfp *sf
static void sfp_sm_main(struct sfp *sfp, unsigned int event)
{
unsigned long timeout;
@@ -77,7 +77,7 @@
/* Some events are global */
if (sfp->sm_state != SFP_S_DOWN &&
-@@ -2027,22 +2035,39 @@ static void sfp_sm_main(struct sfp *sfp,
+@@ -2035,22 +2043,39 @@ static void sfp_sm_main(struct sfp *sfp,
sfp_sm_fault(sfp, SFP_S_INIT_TX_FAULT,
sfp->sm_fault_retries == N_FAULT_INIT);
} else if (event == SFP_E_TIMEOUT || event == SFP_E_TX_CLEAR) {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/771-net-sfp-add-mode-quirk-Ubiquiti-UFiber-Instant.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/771-net-sfp-add-mode-quirk-Ubiquiti-UFiber-Instant.patch
new file mode 100644
index 0000000..e48b474
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/771-net-sfp-add-mode-quirk-Ubiquiti-UFiber-Instant.patch
@@ -0,0 +1,93 @@
+From f0b4f847673299577c29b71d3f3acd3c313d81b7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <pali@kernel.org>
+Date: Mon, 25 Jan 2021 16:02:28 +0100
+Subject: net: sfp: add mode quirk for GPON module Ubiquiti U-Fiber Instant
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The Ubiquiti U-Fiber Instant SFP GPON module has nonsensical information
+stored in its EEPROM. It claims to support all transceiver types including
+10G Ethernet. Clear all claimed modes and set only 1000baseX_Full, which is
+the only one supported.
+
+This module has also phys_id set to SFF, and the SFP subsystem currently
+does not allow to use SFP modules detected as SFFs. Add exception for this
+module so it can be detected as supported.
+
+This change finally allows to detect and use SFP GPON module Ubiquiti
+U-Fiber Instant on Linux system.
+
+EEPROM content of this SFP module is (where XX is serial number):
+
+00: 02 04 0b ff ff ff ff ff ff ff ff 03 0c 00 14 c8 ???........??.??
+10: 00 00 00 00 55 42 4e 54 20 20 20 20 20 20 20 20 ....UBNT
+20: 20 20 20 20 00 18 e8 29 55 46 2d 49 4e 53 54 41 .??)UF-INSTA
+30: 4e 54 20 20 20 20 20 20 34 20 20 20 05 1e 00 36 NT 4 ??.6
+40: 00 06 00 00 55 42 4e 54 XX XX XX XX XX XX XX XX .?..UBNTXXXXXXXX
+50: 20 20 20 20 31 34 30 31 32 33 20 20 60 80 02 41 140123 `??A
+
+Signed-off-by: Pali Rohár <pali@kernel.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/phy/sfp-bus.c | 15 +++++++++++++++
+ drivers/net/phy/sfp.c | 17 +++++++++++++++--
+ 2 files changed, 30 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/phy/sfp-bus.c
++++ b/drivers/net/phy/sfp-bus.c
+@@ -44,6 +44,17 @@ static void sfp_quirk_2500basex(const st
+ phylink_set(modes, 2500baseX_Full);
+ }
+
++static void sfp_quirk_ubnt_uf_instant(const struct sfp_eeprom_id *id,
++ unsigned long *modes)
++{
++ /* Ubiquiti U-Fiber Instant module claims that support all transceiver
++ * types including 10G Ethernet which is not truth. So clear all claimed
++ * modes and set only one mode which module supports: 1000baseX_Full.
++ */
++ phylink_zero(modes);
++ phylink_set(modes, 1000baseX_Full);
++}
++
+ static const struct sfp_quirk sfp_quirks[] = {
+ {
+ // Alcatel Lucent G-010S-P can operate at 2500base-X, but
+@@ -63,6 +74,10 @@ static const struct sfp_quirk sfp_quirks
+ .vendor = "HUAWEI",
+ .part = "MA5671A",
+ .modes = sfp_quirk_2500basex,
++ }, {
++ .vendor = "UBNT",
++ .part = "UF-INSTANT",
++ .modes = sfp_quirk_ubnt_uf_instant,
+ },
+ };
+
+--- a/drivers/net/phy/sfp.c
++++ b/drivers/net/phy/sfp.c
+@@ -273,8 +273,21 @@ static const struct sff_data sff_data =
+
+ static bool sfp_module_supported(const struct sfp_eeprom_id *id)
+ {
+- return id->base.phys_id == SFF8024_ID_SFP &&
+- id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP;
++ if (id->base.phys_id == SFF8024_ID_SFP &&
++ id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP)
++ return true;
++
++ /* SFP GPON module Ubiquiti U-Fiber Instant has in its EEPROM stored
++ * phys id SFF instead of SFP. Therefore mark this module explicitly
++ * as supported based on vendor name and pn match.
++ */
++ if (id->base.phys_id == SFF8024_ID_SFF_8472 &&
++ id->base.phys_ext_id == SFP_PHYS_EXT_ID_SFP &&
++ !memcmp(id->base.vendor_name, "UBNT ", 16) &&
++ !memcmp(id->base.vendor_pn, "UF-INSTANT ", 16))
++ return true;
++
++ return false;
+ }
+
+ static const struct sff_data sfp_data = {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/772-net-sfp-relax-bitrate-devided-check.patch b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/772-net-sfp-relax-bitrate-devided-check.patch
new file mode 100644
index 0000000..672d2d0
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/generic/pending-5.4/772-net-sfp-relax-bitrate-devided-check.patch
@@ -0,0 +1,44 @@
+From 7a77233ec6d114322e2c4f71b4e26dbecd9ea8a7 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@armlinux.org.uk>
+Date: Wed, 9 Dec 2020 11:22:54 +0000
+Subject: net: sfp: relax bitrate-derived mode check
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Do not check the encoding when deriving 1000BASE-X from the bitrate
+when no other modes are discovered. Some GPON modules (VSOL V2801F
+and CarlitoxxPro CPGOS03-0490 v2.0) indicate NRZ encoding with a
+1200Mbaud bitrate, but should be driven with 1000BASE-X on the host
+side.
+
+Tested-by: Pali Rohár <pali@kernel.org>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/sfp-bus.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/phy/sfp-bus.c
++++ b/drivers/net/phy/sfp-bus.c
+@@ -349,14 +349,13 @@ void sfp_parse_support(struct sfp_bus *b
+ }
+
+ /* If we haven't discovered any modes that this module supports, try
+- * the encoding and bitrate to determine supported modes. Some BiDi
+- * modules (eg, 1310nm/1550nm) are not 1000BASE-BX compliant due to
+- * the differing wavelengths, so do not set any transceiver bits.
++ * the bitrate to determine supported modes. Some BiDi modules (eg,
++ * 1310nm/1550nm) are not 1000BASE-BX compliant due to the differing
++ * wavelengths, so do not set any transceiver bits.
+ */
+ if (bitmap_empty(modes, __ETHTOOL_LINK_MODE_MASK_NBITS)) {
+- /* If the encoding and bit rate allows 1000baseX */
+- if (id->base.encoding == SFF8024_ENCODING_8B10B && br_nom &&
+- br_min <= 1300 && br_max >= 1200)
++ /* If the bit rate allows 1000baseX */
++ if (br_nom && br_min <= 1300 && br_max >= 1200)
+ phylink_set(modes, 1000baseX_Full);
+ }
+
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 620dca6..dd5eed0 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
@@ -44,7 +44,6 @@
file://431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch \
file://432-mtd-bcm47xxpart-detect-T_Meter-partition.patch \
file://435-mtd-add-routerbootpart-parser-config.patch \
- file://447-mtd-spinand-gigadevice-Add-support-for-GD5F4GQ4xC.patch \
file://450-mtd-spi-nor-allow-NOR-driver-to-write-fewer-bytes-th.patch \
file://460-mtd-cfi_cmdset_0002-no-erase_suspend.patch \
file://461-mtd-cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch \
@@ -122,6 +121,8 @@
file://766-net-dsa-Include-bridge-addresses-in-assisted-CPU-por.patch \
file://767-net-dsa-Sync-static-FDB-entries-on-foreign-interface.patch \
file://768-net-dsa-mv88e6xxx-Request-assisted-learning-on-CPU-port.patch \
+ file://771-net-sfp-add-mode-quirk-Ubiquiti-UFiber-Instant.patch \
+ file://772-net-sfp-relax-bitrate-devided-check.patch \
file://800-bcma-get-SoC-device-struct-copy-its-DMA-params-to-th.patch \
file://810-pci_disable_common_quirks.patch \
file://811-pci_disable_usb_common_quirks.patch \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986-clkitg.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986-clkitg.dtsi
index 70b56f2..b148f6d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986-clkitg.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986-clkitg.dtsi
@@ -152,8 +152,8 @@
<&topckgen CK_TOP_SPINFI_BCK>,
<&topckgen CK_TOP_I2C_BCK>,
<&topckgen CK_TOP_PEXTP_TL>,
- <&topckgen CK_TOP_EMMC_250M>,
- <&topckgen CK_TOP_EMMC_416M>,
+ <&clk40m>,
+ <&clk40m>,
<&topckgen CK_TOP_F_26M_ADC_CK>,
<&topckgen CK_TOP_SYSAXI>,
<&topckgen CK_TOP_NETSYS_WED_MCU>,
@@ -176,8 +176,8 @@
<&topckgen CK_TOP_PWM_SEL>,
<&topckgen CK_TOP_I2C_SEL>,
<&topckgen CK_TOP_PEXTP_TL_SEL>,
- <&topckgen CK_TOP_EMMC_250M_SEL >,
- <&topckgen CK_TOP_EMMC_416M_SEL >,
+ <&clk40m>,
+ <&clk40m>,
<&topckgen CK_TOP_F_26M_ADC_SEL>,
<&topckgen CK_TOP_DRAMC_SEL>,
<&topckgen CK_TOP_DRAMC_MD32_SEL>,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a-2500wan-gsw-spim-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a-2500wan-gsw-spim-nand-rfb.dts
index cb80e99..6f2d966 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a-2500wan-gsw-spim-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a-2500wan-gsw-spim-nand-rfb.dts
@@ -3,7 +3,7 @@
#include "mt7986a-pinctrl.dtsi"
#include "mt7986-spim-nand-partition.dtsi"
/ {
- model = "MediaTek MT7986b gsw RFB";
+ model = "MediaTek MT7986a gsw RFB";
compatible = "mediatek,mt7986a-2500wan-gsw-spim-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
@@ -145,7 +145,7 @@
port6: port@6 {
compatible = "mediatek,mt753x-port";
- mediatek,ssc-on;
+ /* mediatek,ssc-on; */
reg = <6>;
phy-mode = "sgmii";
fixed-link {
@@ -157,7 +157,7 @@
&hnat {
mtketh-wan = "eth1";
- mtketh-lan = "lan";
+ mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
@@ -204,9 +204,6 @@
&wbsys {
mediatek,mtd-eeprom = <&factory 0x0000>;
status = "okay";
- pinctrl-names = "default", "dbdc";
- pinctrl-0 = <&wf_2g_5g_pins>;
- pinctrl-1 = <&wf_dbdc_pins>;
};
&pio {
@@ -226,39 +223,4 @@
mediatek,pull-down-adv = <0>; /* bias-disable */
};
};
-
- wf_2g_5g_pins: wf_2g_5g-pins {
- mux {
- function = "wifi";
- groups = "wf_2g", "wf_5g";
- };
- conf {
- pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
- "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
- "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
- "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
- "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
- "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
- "WF1_TOP_CLK", "WF1_TOP_DATA";
- drive-strength = <MTK_DRIVE_4mA>;
- };
- };
-
- wf_dbdc_pins: wf_dbdc-pins {
- mux {
- function = "wifi";
- groups = "wf_dbdc";
- };
- conf {
- pins = "WF0_HB1", "WF0_HB2", "WF0_HB3", "WF0_HB4",
- "WF0_HB0", "WF0_HB0_B", "WF0_HB5", "WF0_HB6",
- "WF0_HB7", "WF0_HB8", "WF0_HB9", "WF0_HB10",
- "WF0_TOP_CLK", "WF0_TOP_DATA", "WF1_HB1",
- "WF1_HB2", "WF1_HB3", "WF1_HB4", "WF1_HB0",
- "WF1_HB5", "WF1_HB6", "WF1_HB7", "WF1_HB8",
- "WF1_TOP_CLK", "WF1_TOP_DATA";
- drive-strength = <MTK_DRIVE_4mA>;
- };
- };
-
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-2500wan-gsw-spim-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-2500wan-gsw-spim-nand-rfb.dts
index 840b52f..d6eee2c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-2500wan-gsw-spim-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-2500wan-gsw-spim-nand-rfb.dts
@@ -4,7 +4,7 @@
#include "mt7986-spim-nand-partition.dtsi"
/ {
model = "MediaTek MT7986b gsw RFB";
- compatible = "mediatek,mt7986b-gsw-spim-snand-rfb";
+ compatible = "mediatek,mt7986b-2500wan-gsw-spim-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
@@ -121,7 +121,7 @@
port6: port@6 {
compatible = "mediatek,mt753x-port";
- mediatek,ssc-on;
+ /* mediatek,ssc-on; */
reg = <6>;
phy-mode = "sgmii";
fixed-link {
@@ -133,7 +133,7 @@
&hnat {
mtketh-wan = "eth1";
- mtketh-lan = "lan";
+ mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-snfi-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-snfi-nand-rfb.dts
index b260808..06efb78 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-snfi-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b-snfi-nand-rfb.dts
@@ -4,7 +4,7 @@
#include "mt7986-snfi-nand-partition.dtsi"
/ {
model = "MediaTek MT7986b RFB";
- compatible = "mediatek,mt7986b-snfi-snand-rfb";
+ compatible = "mediatek,mt7986b-2500wan-snfi-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
index ad1dbfa..ea663eb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-snfi-nand-2500wan-p5.dts
@@ -2,7 +2,7 @@
#include "mt7981.dtsi"
/ {
model = "MediaTek MT7981 RFB";
- compatible = "mediatek,mt7981-snand-pcie-2500wan-p5-rfb";
+ compatible = "mediatek,mt7981-snfi-snand-pcie-2500wan-p5-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
index 904d529..6c24709 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981-spim-nand-2500wan-gmac2.dts
@@ -2,7 +2,7 @@
#include "mt7981.dtsi"
/ {
model = "MediaTek MT7981 RFB";
- compatible = "mediatek,mt7981-spim-snand-rfb";
+ compatible = "mediatek,mt7981-spim-snand-2500wan-gmac2-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-clkitg.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-clkitg.dtsi
index 70b56f2..b148f6d 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-clkitg.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986-clkitg.dtsi
@@ -152,8 +152,8 @@
<&topckgen CK_TOP_SPINFI_BCK>,
<&topckgen CK_TOP_I2C_BCK>,
<&topckgen CK_TOP_PEXTP_TL>,
- <&topckgen CK_TOP_EMMC_250M>,
- <&topckgen CK_TOP_EMMC_416M>,
+ <&clk40m>,
+ <&clk40m>,
<&topckgen CK_TOP_F_26M_ADC_CK>,
<&topckgen CK_TOP_SYSAXI>,
<&topckgen CK_TOP_NETSYS_WED_MCU>,
@@ -176,8 +176,8 @@
<&topckgen CK_TOP_PWM_SEL>,
<&topckgen CK_TOP_I2C_SEL>,
<&topckgen CK_TOP_PEXTP_TL_SEL>,
- <&topckgen CK_TOP_EMMC_250M_SEL >,
- <&topckgen CK_TOP_EMMC_416M_SEL >,
+ <&clk40m>,
+ <&clk40m>,
<&topckgen CK_TOP_F_26M_ADC_SEL>,
<&topckgen CK_TOP_DRAMC_SEL>,
<&topckgen CK_TOP_DRAMC_MD32_SEL>,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-2500wan-gsw-spim-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-2500wan-gsw-spim-nand-rfb.dts
index 21d5dc8..6f2d966 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-2500wan-gsw-spim-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a-2500wan-gsw-spim-nand-rfb.dts
@@ -3,7 +3,7 @@
#include "mt7986a-pinctrl.dtsi"
#include "mt7986-spim-nand-partition.dtsi"
/ {
- model = "MediaTek MT7986b gsw RFB";
+ model = "MediaTek MT7986a gsw RFB";
compatible = "mediatek,mt7986a-2500wan-gsw-spim-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
@@ -145,7 +145,7 @@
port6: port@6 {
compatible = "mediatek,mt753x-port";
- mediatek,ssc-on;
+ /* mediatek,ssc-on; */
reg = <6>;
phy-mode = "sgmii";
fixed-link {
@@ -157,7 +157,7 @@
&hnat {
mtketh-wan = "eth1";
- mtketh-lan = "lan";
+ mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-2500wan-gsw-spim-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-2500wan-gsw-spim-nand-rfb.dts
index 840b52f..d6eee2c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-2500wan-gsw-spim-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-2500wan-gsw-spim-nand-rfb.dts
@@ -4,7 +4,7 @@
#include "mt7986-spim-nand-partition.dtsi"
/ {
model = "MediaTek MT7986b gsw RFB";
- compatible = "mediatek,mt7986b-gsw-spim-snand-rfb";
+ compatible = "mediatek,mt7986b-2500wan-gsw-spim-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
@@ -121,7 +121,7 @@
port6: port@6 {
compatible = "mediatek,mt753x-port";
- mediatek,ssc-on;
+ /* mediatek,ssc-on; */
reg = <6>;
phy-mode = "sgmii";
fixed-link {
@@ -133,7 +133,7 @@
&hnat {
mtketh-wan = "eth1";
- mtketh-lan = "lan";
+ mtketh-lan = "eth0";
mtketh-max-gmac = <2>;
status = "okay";
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-snfi-nand-rfb.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-snfi-nand-rfb.dts
index b260808..06efb78 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-snfi-nand-rfb.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b-snfi-nand-rfb.dts
@@ -4,7 +4,7 @@
#include "mt7986-snfi-nand-partition.dtsi"
/ {
model = "MediaTek MT7986b RFB";
- compatible = "mediatek,mt7986b-snfi-snand-rfb";
+ compatible = "mediatek,mt7986b-2500wan-snfi-snand-rfb";
chosen {
bootargs = "console=ttyS0,115200n1 loglevel=8 \
earlycon=uart8250,mmio32,0x11002000";
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 1bf43b3..a50c25f 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
@@ -485,10 +485,9 @@
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
}
-static void mtk_mac_link_up(struct phylink_config *config,
- struct phy_device *phy,
- unsigned int mode, phy_interface_t interface,
- int speed, int duplex, bool tx_pause, bool rx_pause)
+static void mtk_mac_link_up(struct phylink_config *config, unsigned int mode,
+ phy_interface_t interface,
+ struct phy_device *phy)
{
struct mtk_mac *mac = container_of(config, struct mtk_mac,
phylink_config);
@@ -2679,7 +2678,7 @@
netif_start_queue(dev);
phy_node = of_parse_phandle(mac->of_node, "phy-handle", 0);
if (!phy_node) {
- regmap_write(eth->sgmii->regmap[0], SGMSYS_QPHY_PWR_STATE_CTRL, 0);
+ regmap_write(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, 0);
}
return 0;
}
@@ -2723,9 +2722,9 @@
val |= BMCR_PDOWN;
_mtk_mdio_write(eth, 0, 0, val);
}else {
- regmap_read(eth->sgmii->regmap[0], SGMSYS_QPHY_PWR_STATE_CTRL, &val);
+ regmap_read(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, &val);
val |= SGMII_PHYA_PWD;
- regmap_write(eth->sgmii->regmap[0], SGMSYS_QPHY_PWR_STATE_CTRL, val);
+ regmap_write(eth->sgmii->regmap[mac->id], SGMSYS_QPHY_PWR_STATE_CTRL, val);
}
//GMAC RX disable
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 a31c4f6..4cd18bc 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
@@ -364,7 +364,7 @@
#define MTK_CHK_DDONE_EN BIT(28)
#define MTK_DMAD_WR_WDONE BIT(26)
#define MTK_WCOMP_EN BIT(24)
-#define MTK_RESV_BUF (0x40 << 16)
+#define MTK_RESV_BUF (0x80 << 16)
#define MTK_MUTLI_CNT (0x4 << 12)
/* QDMA Reset Index Register */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
index 58a83b8..68aad32 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
@@ -351,7 +351,7 @@
/* enable FOE */
cr_set_bits(hnat_priv->ppe_base[ppe_id] + PPE_FLOW_CFG,
- BIT_UDP_IP4F_NAT_EN | BIT_IPV4_NAT_EN | BIT_IPV4_NAPT_EN |
+ BIT_IPV4_NAT_EN | BIT_IPV4_NAPT_EN |
BIT_IPV4_NAT_FRAG_EN | BIT_IPV4_HASH_GREK |
BIT_IPV4_DSL_EN | BIT_IPV6_6RD_EN |
BIT_IPV6_3T_ROUTE_EN | BIT_IPV6_5T_ROUTE_EN);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
index a5403a8..69f1c21 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_debugfs.c
@@ -1036,10 +1036,52 @@
return single_open(file, hnat_whnat_show, file->private_data);
}
+static ssize_t hnat_whnat_write(struct file *file, const char __user *buf,
+ size_t length, loff_t *offset)
+{
+ char line[64] = {0};
+ struct net_device *dev;
+ int enable;
+ char name[32];
+ size_t size;
+
+ if (length >= sizeof(line))
+ return -EINVAL;
+
+ if (copy_from_user(line, buf, length))
+ return -EFAULT;
+
+ if (sscanf(line, "%s %d", name, &enable) != 2)
+ return -EFAULT;
+
+ line[length] = '\0';
+
+ dev = dev_get_by_name(&init_net, name);
+
+ if (dev) {
+ if (enable) {
+ mtk_ppe_dev_register_hook(dev);
+ pr_info("register wifi extern if = %s\n", dev->name);
+ } else {
+ mtk_ppe_dev_unregister_hook(dev);
+ pr_info("unregister wifi extern if = %s\n", dev->name);
+ }
+ } else {
+ pr_info("no such device!\n");
+ }
+
+ size = strlen(line);
+ *offset += size;
+
+ return length;
+}
+
+
static const struct file_operations hnat_whnat_fops = {
.open = hnat_whnat_open,
.read = seq_read,
.llseek = seq_lseek,
+ .write = hnat_whnat_write,
.release = single_release,
};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 24275a0..8d199ef 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -1027,7 +1027,6 @@
entry.bfib1.vpm = (entry.bfib1.vlan_layer) ? 1 : 0;
entry.bfib1.ttl = 1;
entry.bfib1.cah = 1;
- entry.bfib1.ka = 1;
entry.bfib1.time_stamp = (hnat_priv->data->version == MTK_HNAT_V4) ?
readl(hnat_priv->fe_base + 0x0010) & (0xFF) :
readl(hnat_priv->fe_base + 0x0010) & (0x7FFF);
@@ -1108,6 +1107,8 @@
return 0;
entry.bfib1.pkt_type = foe->udib1.pkt_type; /* Get packte type state*/
+ entry.bfib1.state = foe->udib1.state;
+
#if defined(CONFIG_MEDIATEK_NETSYS_V2)
entry.bfib1.sp = foe->udib1.sp;
#endif
@@ -1558,13 +1559,13 @@
if (!whnat)
entry.bfib1.state = BIND;
+ wmb();
memcpy(foe, &entry, sizeof(entry));
/*reset statistic for this entry*/
if (hnat_priv->data->per_flow_accounting)
memset(&hnat_priv->acct[skb_hnat_ppe(skb)][skb_hnat_entry(skb)],
0, sizeof(struct mib_entry));
- wmb();
skb_hnat_filled(skb) = HNAT_INFO_FILLED;
return 0;
@@ -1574,6 +1575,7 @@
{
struct foe_entry *entry;
struct ethhdr *eth;
+ struct hnat_bind_info_blk bfib1_tx;
if (skb_hnat_alg(skb) || !is_hnat_info_filled(skb) ||
!is_magic_tag_valid(skb) || !IS_SPACE_AVAILABLE_HEAD(skb))
@@ -1604,6 +1606,7 @@
return NF_ACCEPT;
eth = eth_hdr(skb);
+ memcpy(&bfib1_tx, &entry->bfib1, sizeof(entry->bfib1));
/*not bind multicast if PPE mcast not enable*/
if (!hnat_priv->data->mcast) {
@@ -1619,7 +1622,7 @@
/* Some mt_wifi virtual interfaces, such as apcli,
* will change the smac for specail purpose.
*/
- switch (entry->bfib1.pkt_type) {
+ switch (bfib1_tx.pkt_type) {
case IPV4_HNAPT:
case IPV4_HNAT:
entry->ipv4_hnapt.smac_hi = swab32(*((u32 *)eth->h_source));
@@ -1636,24 +1639,18 @@
}
if (skb->vlan_tci) {
- entry->bfib1.vlan_layer += 1;
- entry->bfib1.vpm = 1;
+ bfib1_tx.vlan_layer = 1;
+ bfib1_tx.vpm = 1;
if (IS_IPV4_GRP(entry)) {
entry->ipv4_hnapt.etype = htons(ETH_P_8021Q);
- if(entry->ipv4_hnapt.vlan1)
- entry->ipv4_hnapt.vlan2 = skb->vlan_tci;
- else
- entry->ipv4_hnapt.vlan1 = skb->vlan_tci;
+ entry->ipv4_hnapt.vlan1 = skb->vlan_tci;
} else if (IS_IPV6_GRP(entry)) {
entry->ipv6_5t_route.etype = htons(ETH_P_8021Q);
- if(entry->ipv6_5t_route.vlan1)
- entry->ipv6_5t_route.vlan2 = skb->vlan_tci;
- else
- entry->ipv6_5t_route.vlan1 = skb->vlan_tci;
+ entry->ipv6_5t_route.vlan1 = skb->vlan_tci;
}
} else {
- entry->bfib1.vpm = 0;
- entry->bfib1.vlan_layer = 0;
+ bfib1_tx.vpm = 0;
+ bfib1_tx.vlan_layer = 0;
}
/* MT7622 wifi hw_nat not support QoS */
@@ -1666,7 +1663,6 @@
entry->ipv4_hnapt.winfo.bssid = skb_hnat_bss_id(skb);
entry->ipv4_hnapt.winfo.wcid = skb_hnat_wc_id(skb);
#if defined(CONFIG_MEDIATEK_NETSYS_V2)
- entry->ipv4_hnapt.iblk2.fqos = (IS_HQOS_MODE) ? 1 : 0;
entry->ipv4_hnapt.iblk2.rxid = skb_hnat_rx_id(skb);
entry->ipv4_hnapt.iblk2.winfoi = 1;
#else
@@ -1676,8 +1672,8 @@
#endif
} else {
if (IS_GMAC1_MODE && !hnat_dsa_is_enable(hnat_priv)) {
- entry->bfib1.vpm = 1;
- entry->bfib1.vlan_layer = 1;
+ bfib1_tx.vpm = 1;
+ bfib1_tx.vlan_layer = 1;
if (FROM_GE_LAN(skb))
entry->ipv4_hnapt.vlan1 = 1;
@@ -1687,8 +1683,8 @@
if (IS_HQOS_MODE &&
(FROM_GE_LAN(skb) || FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))) {
- entry->bfib1.vpm = 0;
- entry->bfib1.vlan_layer = 1;
+ bfib1_tx.vpm = 0;
+ bfib1_tx.vlan_layer = 1;
entry->ipv4_hnapt.etype = htons(HQOS_MAGIC_TAG);
entry->ipv4_hnapt.vlan1 = skb_hnat_entry(skb);
entry->ipv4_hnapt.iblk2.fqos = 1;
@@ -1704,7 +1700,6 @@
entry->ipv6_5t_route.winfo.bssid = skb_hnat_bss_id(skb);
entry->ipv6_5t_route.winfo.wcid = skb_hnat_wc_id(skb);
#if defined(CONFIG_MEDIATEK_NETSYS_V2)
- entry->ipv6_5t_route.iblk2.fqos = (IS_HQOS_MODE) ? 1 : 0;
entry->ipv6_5t_route.iblk2.rxid = skb_hnat_rx_id(skb);
entry->ipv6_5t_route.iblk2.winfoi = 1;
#else
@@ -1714,8 +1709,8 @@
#endif
} else {
if (IS_GMAC1_MODE && !hnat_dsa_is_enable(hnat_priv)) {
- entry->bfib1.vpm = 1;
- entry->bfib1.vlan_layer = 1;
+ bfib1_tx.vpm = 1;
+ bfib1_tx.vlan_layer = 1;
if (FROM_GE_LAN(skb))
entry->ipv6_5t_route.vlan1 = 1;
@@ -1725,8 +1720,8 @@
if (IS_HQOS_MODE &&
(FROM_GE_LAN(skb) || FROM_GE_WAN(skb) || FROM_GE_VIRTUAL(skb))) {
- entry->bfib1.vpm = 0;
- entry->bfib1.vlan_layer = 1;
+ bfib1_tx.vpm = 0;
+ bfib1_tx.vlan_layer = 1;
entry->ipv6_5t_route.etype = htons(HQOS_MAGIC_TAG);
entry->ipv6_5t_route.vlan1 = skb_hnat_entry(skb);
entry->ipv6_5t_route.iblk2.fqos = 1;
@@ -1735,7 +1730,9 @@
entry->ipv6_5t_route.iblk2.dp = gmac_no;
}
- entry->bfib1.state = BIND;
+ bfib1_tx.state = BIND;
+ wmb();
+ memcpy(&entry->bfib1, &bfib1_tx, sizeof(bfib1_tx));
return NF_ACCEPT;
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/Makefile b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/Makefile
deleted file mode 100644
index 25cc107..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-#always build-in
-obj-y += mt_wifi_mtd.o
-obj-y += pci_mediatek_rbus.o
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/mt_wifi_mtd.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/mt_wifi_mtd.c
deleted file mode 100644
index 9294c73..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/mt_wifi_mtd.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <asm/io.h>
-#include <linux/mtd/mtd.h>
-#include <linux/mtd/map.h>
-#include <linux/mtd/concat.h>
-#include <linux/mtd/partitions.h>
-#if defined (CONFIG_MIPS)
-#include <asm/addrspace.h>
-#endif
-
-int mt_mtd_write_nm_wifi(char *name, loff_t to, size_t len, const u_char *buf)
-{
- int ret = -1;
- size_t rdlen, wrlen;
- struct mtd_info *mtd;
- struct erase_info ei;
- u_char *bak = NULL;
-
- mtd = get_mtd_device_nm(name);
- if (IS_ERR(mtd))
- return -1;
-
- if (len > mtd->erasesize) {
- put_mtd_device(mtd);
- return -E2BIG;
- }
-
- bak = kmalloc(mtd->erasesize, GFP_KERNEL);
- if (bak == NULL) {
- put_mtd_device(mtd);
- return -ENOMEM;
- }
-
- ret = mtd_read(mtd, 0, mtd->erasesize, &rdlen, bak);
-
- if (ret != 0) {
- put_mtd_device(mtd);
- kfree(bak);
- return ret;
- }
-
- if (rdlen != mtd->erasesize)
- printk("warning: ra_mtd_write: rdlen is not equal to erasesize\n");
-
- memcpy(bak + to, buf, len);
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))
- ei.mtd = mtd;
- ei.callback = NULL;
- ei.priv = 0;
-#endif
- ei.addr = 0;
- ei.len = mtd->erasesize;
- ret = mtd_erase(mtd, &ei);
-
- if (ret != 0) {
- put_mtd_device(mtd);
- kfree(bak);
- return ret;
- }
-
- ret = mtd_write(mtd, 0, mtd->erasesize, &wrlen, bak);
-
-
-
- put_mtd_device(mtd);
- kfree(bak);
- return ret;
-}
-EXPORT_SYMBOL(mt_mtd_write_nm_wifi);
-
-
-int mt_mtd_read_nm_wifi(char *name, loff_t from, size_t len, u_char *buf)
-{
- int ret;
- size_t rdlen;
- struct mtd_info *mtd;
-
- mtd = get_mtd_device_nm(name);
- if (IS_ERR(mtd))
- return -1;
-
- ret = mtd_read(mtd, from, len, &rdlen, buf);
-
- if (rdlen != len)
- printk("warning: ra_mtd_read_nm: rdlen is not equal to len\n");
-
- put_mtd_device(mtd);
-
- return ret;
-}
-EXPORT_SYMBOL(mt_mtd_read_nm_wifi);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/pci_mediatek_rbus.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/pci_mediatek_rbus.c
deleted file mode 100644
index 840834d..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/wireless/wifi_utility/pci_mediatek_rbus.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (c) 2017 MediaTek Inc.
- * Author: Star Chang <star.chang@mediatek.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/irqdomain.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/of_address.h>
-#include <linux/of_irq.h>
-#include <linux/of_pci.h>
-#include <linux/of_platform.h>
-#include <linux/pci.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-#include <linux/resource.h>
-#include <linux/types.h>
-#include <linux/pinctrl/consumer.h>
-
-
-/*platform device & platform driver match name*/
-#define OF_RBUS_NAME "mediatek,wbsys"
-#define OF_PIO_NAME "mediatek,mt7622-pctl-a-syscfg"
-
-#define RBUS_VENDOR_ID_OFFSET 0
-#define RBUS_CHIP_ID_OFFSET 2
-#define RBUS_BAR_OFFSET 0x10
-#define RBUS_DEFAULT_CHIP_ID 0x7622
-#define RBUS_DEFAULT_VEND_ID 0x14c3
-#define RBUS_TSSI_CTRL_OFFSET 0x34
-#define RBUS_TSSI_CTRL_MASK 0x1
-#define RBUS_PA_LNA_CTRL_OFFSET 0x38
-#define RBUS_PA_LNA_CTRL_MASK 0x3
-
-#define GPIO_G2_MISC_OFFSET 0x00000AF0
-#define GPIO_G2_MISC_MASK 0xffffff00
-
-static char rbus_string[] = "rbus";
-unsigned int dev_second_irq = 0;
-unsigned int multi_intr_2nd = 0;
-unsigned int multi_intr_3rd = 0;
-unsigned int multi_intr_4th = 0;
-EXPORT_SYMBOL(dev_second_irq);
-EXPORT_SYMBOL(multi_intr_2nd);
-EXPORT_SYMBOL(multi_intr_3rd);
-EXPORT_SYMBOL(multi_intr_4th);
-
-static const struct of_device_id rbus_of_ids[] = {
- { .compatible = OF_RBUS_NAME, },
- { },
-};
-
-struct rbus_dev {
- char name[36];
- struct device *dev;
- struct resource *res;
- struct list_head resources;
- unsigned int base_addr;
- unsigned int irq;
- unsigned int chip_id;
- unsigned int vend_id;
-};
-
-enum {
- TSSI_MODE_DIS=0,
- TSSI_MODE_EN=1
-};
-
-enum {
- IPA_ILNA_MODE=0,
- IPA_ELNA_MODE=1,
- EPA_ELNA_MODE=2,
- EPA_ILNA_MODE=3
-};
-
-#define RBUS_IO_READ32(_A, _R, _pV) (*(_pV) = readl((void *)(_A + _R)))
-#define RBUS_IO_WRITE32(_A, _R, _V) writel(_V, (void *)(_A + _R))
-
-/*fake configure space*/
-static unsigned char rbus_conf_space[] = {
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x76, 0xc3, 0x14,
- 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x60, 0x61, 0x12, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x05, 0x78, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0xc3, 0x01, 0x08, 0x00, 0x00, 0x00,
- 0x10, 0x00, 0x02, 0x00, 0x40, 0x83, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x12, 0x8c, 0x40, 0x01,
- 0x43, 0x00, 0x12, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-static int
-rbus_tssi_config(struct platform_device *pdev, unsigned char mode)
-{
- struct device_node *node = NULL;
- unsigned long addr;
- unsigned int value = 0;
-
- node = of_find_compatible_node(NULL, NULL, OF_PIO_NAME);
- if (!node) {
- dev_err(&pdev->dev, "%s(): can't find node for %s\n", __func__, OF_PIO_NAME);
- return -ENODEV;
- }
-
- addr = (unsigned long) of_iomap(node, 0);
- RBUS_IO_READ32(addr, GPIO_G2_MISC_OFFSET, &value);
-
- if (mode == TSSI_MODE_EN) {
- value &= GPIO_G2_MISC_MASK;
- RBUS_IO_WRITE32(addr, GPIO_G2_MISC_OFFSET, value);
- }
-
- RBUS_IO_READ32(addr, GPIO_G2_MISC_OFFSET, &value);
- return 0;
-}
-
-static int
-rbus_pa_lan_config(struct platform_device *pdev, unsigned int devfn, unsigned char mode)
-{
- struct pinctrl *p;
- struct pinctrl_state *s;
- unsigned char state[32] = "";
- int ret = 0;
-
- if (mode != IPA_ELNA_MODE && mode != EPA_ELNA_MODE)
- return ret;
-
- p = devm_pinctrl_get(&pdev->dev);
-
- if (!p) {
- dev_err(&pdev->dev, "%s(): can't get pinctrl by dev:%p\n", __func__, &pdev->dev);
- return ret;
- }
-
- strncpy(state, "state_epa", sizeof("state_epa"));
-
- s = pinctrl_lookup_state(p, state);
-
- if (!s) {
- dev_err(&pdev->dev, "%s(): can't find pinctrl state: %s\n", __func__, state);
- return ret;
- }
-
- ret = pinctrl_select_state(p, s);
-
- if (ret < 0)
- dev_err(&pdev->dev, "%s(): pinctrl select to %s fail!, ret=%d\n", __func__, state, ret);
-
- return ret;
-}
-
-static void
-rbus_init_config(struct rbus_dev *rbus)
-{
- rbus_conf_space[RBUS_VENDOR_ID_OFFSET] = rbus->vend_id & 0xff;
- rbus_conf_space[RBUS_VENDOR_ID_OFFSET + 1] = (rbus->vend_id >> 8) & 0xff;
- rbus_conf_space[RBUS_CHIP_ID_OFFSET] = rbus->chip_id & 0xff;
- rbus_conf_space[RBUS_CHIP_ID_OFFSET + 1] = (rbus->chip_id >> 8) & 0xff;
- rbus_conf_space[RBUS_BAR_OFFSET + 3] = (rbus->base_addr >> 24) & 0xff;
- rbus_conf_space[RBUS_BAR_OFFSET + 2] = (rbus->base_addr >> 16) & 0xff;
- rbus_conf_space[RBUS_BAR_OFFSET + 1] = (rbus->base_addr >> 8) & 0xff;
-}
-
-static int
-rbus_read_config(struct pci_bus *bus, unsigned int devfn, int where,
- int size, u32 *value)
-{
- u32 *cr;
-
- if(where >= sizeof(rbus_conf_space))
- return PCIBIOS_BUFFER_TOO_SMALL;
-
- cr = (u32 *) &rbus_conf_space[where];
-
- if(devfn == 0)
- *value = *cr;
- return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-rbus_write_config(struct pci_bus *bus, unsigned int devfn, int where,
- int size, u32 value)
-{
- int i;
- struct platform_device *pdev = bus->sysdata;
-
- if (devfn != 0)
- goto end;
-
- for (i = 0 ; i < size ; i++) {
- rbus_conf_space[where + i] = (value << (i * 8)) & 0xff;
- }
- /*handle vendor specific action*/
- switch(where) {
- case RBUS_TSSI_CTRL_OFFSET:
- rbus_tssi_config(pdev, (value & RBUS_TSSI_CTRL_MASK));
- break;
- case RBUS_PA_LNA_CTRL_OFFSET:
- rbus_pa_lan_config(pdev, devfn, (value & RBUS_PA_LNA_CTRL_MASK));
- break;
- default:
- break;
- }
-end:
- return PCIBIOS_SUCCESSFUL;
-}
-
-
-struct pci_ops rbus_ops = {
- .read = rbus_read_config,
- .write = rbus_write_config,
-};
-
-static int rbus_add_port(struct rbus_dev *rbus,
- struct platform_device *pdev)
-{
- struct pci_bus *bus;
- struct pci_dev *pci;
-
- bus = pci_scan_root_bus(&pdev->dev, 0, &rbus_ops,
- pdev, &rbus->resources);
-
- if (!bus)
- return -ENOMEM;
-
- pci_bus_add_devices(bus);
-
- pci = pci_scan_single_device(bus, 0);
-
- if (pci) {
- /*re-assign hw resource*/
- pci->irq = rbus->irq;
- pci->resource[0].start = rbus->res->start;
- pci->resource[0].end = rbus->res->end;
- }
- return 0;
-}
-
-static int rbus_add_res(struct rbus_dev *rbus)
-{
- struct device *dev = rbus->dev;
- struct platform_device *pdev = to_platform_device(dev);
- struct resource bus_range;
-
- INIT_LIST_HEAD(&rbus->resources);
- /*resource allocate*/
- rbus->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- rbus->irq = platform_get_irq(pdev, 0);
- rbus->base_addr = (unsigned int)rbus->res->start;
- if (rbus->chip_id == 0x7629)
- dev_second_irq = platform_get_irq(pdev, 1);
- else if (rbus->chip_id == 0x7986) {
- multi_intr_2nd = platform_get_irq(pdev, 1);
- multi_intr_3rd = platform_get_irq(pdev, 2);
- multi_intr_4th = platform_get_irq(pdev, 3);
- }
-
- pci_add_resource(&rbus->resources, rbus->res);
-
- bus_range = (struct resource) {
- .name = "rbus_range",
- .start = 0,
- .end = 0xff,
- .flags = IORESOURCE_BUS,
- };
-
- pci_add_resource(&rbus->resources, &bus_range);
- return 0;
-}
-
-/*
-*
-*/
-static int rbus_probe(struct platform_device *pdev)
-{
- struct device_node *node = NULL;
- struct rbus_dev *rbus;
-
- node = of_find_compatible_node(NULL, NULL, OF_RBUS_NAME);
- if (!node)
- return -ENODEV;
-
- rbus = devm_kzalloc(&pdev->dev, sizeof(*rbus), GFP_KERNEL);
- if (!rbus)
- return -ENOMEM;
-
- rbus->dev = &pdev->dev;
-
- if (of_property_read_u32_index(node, "chip_id", 0, &rbus->chip_id)) {
- rbus->chip_id = RBUS_DEFAULT_CHIP_ID;
- }
-
- if (of_property_read_u32_index(node, "vend_id", 0, &rbus->vend_id)) {
- rbus->vend_id = RBUS_DEFAULT_VEND_ID;
- }
- /*set priv_data to pdev*/
- snprintf(rbus->name,sizeof(rbus->name),"mediatek-rbus");
- platform_set_drvdata(pdev, rbus);
- rbus_add_res(rbus);
- /*init config, need run before add port*/
- rbus_init_config(rbus);
- /*add pci bus & device*/
- rbus_add_port(rbus, pdev);
- return -ENODEV;
-}
-
-/*
-*
-*/
-static int rbus_remove(struct platform_device *pdev)
-{
- struct rbus_dev *rbus = platform_get_drvdata(pdev);
- dev_err(&pdev->dev, "remove rbus name: %s\n", rbus->name);
- return 0;
-}
-
-
-/*
-* global resource preparing
-*/
-static struct platform_driver rbus_driver = {
- .probe = rbus_probe,
- .remove = rbus_remove,
- .driver = {
- .name = rbus_string,
- .owner = THIS_MODULE,
-#ifdef CONFIG_OF
- .of_match_table = rbus_of_ids,
-#endif /*CONFIG_OF*/
- },
-};
-
-/* PCIe driver does not allow module unload */
-static int __init rbus_init(void)
-{
- return platform_driver_probe(&rbus_driver, rbus_probe);
-}
-
-subsys_initcall_sync(rbus_init);
-
-MODULE_DESCRIPTION("Mediatek RBUS host controller driver");
-MODULE_LICENSE("GPL v2");
-
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-declaration.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-declaration.h
index f517e20..70db398 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-declaration.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-declaration.h
@@ -13,6 +13,7 @@
DEVICE_ATTR_DECLARED(RG_USB20_HSTX_SRCTRL);
DEVICE_ATTR_DECLARED(RG_USB20_DISCTH);
DEVICE_ATTR_DECLARED(RG_CHGDT_EN);
+ DEVICE_ATTR_DECLARED(reg);
#define HQA_INFORMACTION_COLLECTS() do {\
ECHO_HQA(USB20_PHY_USBPHYACR0, RG_USB20_INTR_EN, 1); \
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-statement.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-statement.h
index b929342..e898a26 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-statement.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/unusual-statement.h
@@ -13,4 +13,5 @@
UNUSUAL_DEVICE_ATTR(RG_USB20_HSTX_SRCTRL),
UNUSUAL_DEVICE_ATTR(RG_USB20_DISCTH),
UNUSUAL_DEVICE_ATTR(RG_CHGDT_EN),
+UNUSUAL_DEVICE_ATTR(reg),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-chgdt-en.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-chgdt-en.c
index 13626c1..575680e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-chgdt-en.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-chgdt-en.c
@@ -21,6 +21,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -64,8 +65,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -139,7 +140,7 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES)
goto error;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-discth.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-discth.c
index 66a024a..83a94bd 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-discth.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-discth.c
@@ -21,6 +21,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -66,8 +67,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -141,7 +142,7 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES)
goto error;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-hstx-srctrl.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-hstx-srctrl.c
index a7791cf..a387798 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-hstx-srctrl.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-hstx-srctrl.c
@@ -21,6 +21,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -66,8 +67,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -141,7 +142,7 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES)
goto error;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-intr-en.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-intr-en.c
index acdaf8b..3922c73 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-intr-en.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-intr-en.c
@@ -21,6 +21,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -65,8 +66,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -140,7 +141,7 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES)
goto error;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-reg.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-reg.c
new file mode 100644
index 0000000..366747d
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-reg.c
@@ -0,0 +1,392 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * xHCI host controller toolkit driver for intr-en
+ *
+ * Copyright (C) 2021 MediaTek Inc.
+ *
+ * Author: Zhanyong Wang <zhanyong.wang@mediatek.com>
+ */
+
+
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/usb.h>
+#include "xhci-mtk.h"
+#include "xhci-mtk-test.h"
+#include "xhci-mtk-unusual.h"
+
+#define REGS_LIMIT_XHCI 0x1000
+#define REGS_LIMIT_MU3D 0x2e00
+static ssize_t reg_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
+ ssize_t cnt = 0;
+
+ cnt += sprintf(buf + cnt,
+ "SSUSB register operation interface help info.\n"
+ " rx - read xhci reg: offset [len]\n"
+ " rm - read mu3d reg: offset [len]\n"
+ " ri - read ippc reg: offset [len]\n"
+ " rp - read phy reg: offset [len]\n"
+ " wx - write xhci reg: offset value\n"
+ " wm - write mu3d reg: offset value\n"
+ " wi - write ippc reg: offset value\n"
+ " wp - write phy reg: offset value\n"
+ " sx - set xhci mac reg bits: offset bit_start mask value\n"
+ " sm - set mu3d mac reg bits: offset bit_start mask value\n"
+ " si - set ippc reg bits: offset bit_start mask value\n"
+ " sp - set phy reg bits: offset bit_start mask value\n"
+ " px - print xhci mac reg bits: offset bit_start mask\n"
+ " pm - print mu3d mac reg bits: offset bit_start mask\n"
+ " pi - print ippc reg bits: offset bit_start mask\n"
+ " pp - print phy reg bits: offset bit_start mask\n"
+ " NOTE: numbers should be HEX, except bit_star(DEC)\n");
+
+ if (mtk->hqa_pos) {
+ cnt += sprintf(buf + cnt, "%s", mtk->hqa_buf);
+ mtk->hqa_pos = 0;
+ }
+
+ return cnt;
+}
+
+/* base address: return value; limit is put into @limit */
+static void __iomem *get_reg_base_limit(struct xhci_hcd_mtk *mtk,
+ const char *buf, u32 *limit)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct platform_device *device = to_platform_device(mtk->dev);
+ void __iomem *base = NULL;
+ struct device_node *node = mtk->dev->of_node;
+ u32 io = 0;
+ u32 range = 0;
+ u32 len = 0;
+ int index = 0;
+ int ret = 0;
+
+ switch (buf[1]) {
+ case 'x':
+ ret = query_reg_addr(device, &io, &range, "mac");
+ if (ret) break;
+
+ base = ioremap(io, range);
+
+ xhci_info(xhci, "xhci's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ hqa_info (mtk, "xhci's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ break;
+ case 'm':
+ if (!mtk->has_ippc)
+ device = to_platform_device(device->dev.parent);
+
+ ret = query_reg_addr(device, &io, &range, "mac");
+ if (ret) break;
+
+ if (mtk->has_ippc) {
+ io += REGS_LIMIT_XHCI;
+ range = REGS_LIMIT_MU3D;
+ }
+
+ base = ioremap(io, range);
+ xhci_info(xhci, "mu3d's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ hqa_info (mtk, "mu3d's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ break;
+ case 'i':
+ ret = query_reg_addr(device, &io, &range, "ippc");
+ if (ret) break;
+
+ base = ioremap(io, range);
+ xhci_info(xhci, "ippc's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ hqa_info (mtk, "ippc's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ break;
+ case 'p':
+ ret = query_phy_addr(node, &index, &io, &len, PHY_TYPE_USB3);
+ if (ret && ret != -EACCES) break;
+
+ range = io & 0x0000FFFF;
+ range += len;
+
+ io &= 0xFFFF0000;
+
+ base = ioremap(io, range);
+ xhci_info(xhci, "phy's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ hqa_info (mtk, "phy's reg: [0x%08X ~ 0x%08X]\n",
+ io, io + range);
+ break;
+ default:
+ base = NULL;
+ }
+
+ *limit = range;
+
+ return base;
+}
+
+static void ssusb_write_reg(struct xhci_hcd_mtk *mtk, const char *buf)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ void __iomem *base;
+ u32 offset = 0;
+ u32 value = 0;
+ u32 old_val = 0;
+ u32 limit = 0;
+ u32 param;
+
+ param = sscanf(buf, "%*s 0x%x 0x%x", &offset, &value);
+ xhci_info(xhci, "params-%d (offset: %#x, value: %#x)\n",
+ param, offset, value);
+ hqa_info (mtk, "params-%d (offset: %#x, value: %#x)\n",
+ param, offset, value);
+
+ base = get_reg_base_limit(mtk, buf, &limit);
+ if (!base || (param != 2)) {
+ xhci_err(xhci, "params are invalid!\n");
+ hqa_info(mtk, "params are invalid since %p, %u!\n",
+ base, param);
+ return;
+ }
+
+ offset &= ~0x3; /* 4-bytes align */
+ if (offset >= limit) {
+ xhci_err(xhci, "reg's offset overrun!\n");
+ hqa_info(mtk, "reg's offset overrun since %u >= %u!\n",
+ offset, limit);
+ return;
+ }
+ old_val = readl(base + offset);
+ writel(value, base + offset);
+ xhci_info(xhci, "0x%8.8x : 0x%8.8x --> 0x%8.8x\n", offset, old_val,
+ readl(base + offset));
+ hqa_info (mtk, "0x%8.8x : 0x%8.8x --> 0x%8.8x\n", offset, old_val,
+ readl(base + offset));
+
+ base = (void __iomem *)((unsigned long)base & 0xFFFF0000);
+ iounmap(base);
+}
+
+static void read_single_reg(struct xhci_hcd_mtk *mtk,
+ void __iomem *base, u32 offset, u32 limit)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ u32 value;
+
+ offset &= ~0x3; /* 4-bytes align */
+ if (offset >= limit) {
+ xhci_err(xhci, "reg's offset overrun!\n");
+ hqa_info(mtk, "reg's offset overrun since %u >= %u!\n",
+ offset, limit);
+ return;
+ }
+ value = readl(base + offset);
+ xhci_err(xhci, "0x%8.8x : 0x%8.8x\n", offset, value);
+ hqa_info(mtk, "0x%8.8x : 0x%8.8x\n", offset, value);
+}
+
+static void read_multi_regs(struct xhci_hcd_mtk *mtk,
+ void __iomem *base, u32 offset, u32 len, u32 limit)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ int i;
+
+ /* at least 4 ints */
+ offset &= ~0xF;
+ len = (len + 0x3) & ~0x3;
+
+ if (offset + len > limit) {
+ xhci_err(xhci, "reg's offset overrun!\n");
+ hqa_info(mtk, "reg's offset overrun since %u > %u!\n",
+ offset + len, limit);
+ return;
+ }
+
+ len >>= 2;
+ xhci_info(xhci, "read regs [%#x, %#x)\n", offset, offset + (len << 4));
+ hqa_info (mtk, "read regs [%#x, %#x)\n", offset, offset + (len << 4));
+ for (i = 0; i < len; i++) {
+ xhci_err(xhci, "0x%8.8x : 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x\n",
+ offset, readl(base + offset),
+ readl(base + offset + 0x4),
+ readl(base + offset + 0x8),
+ readl(base + offset + 0xc));
+ hqa_info(mtk, "0x%8.8x : 0x%8.8x 0x%8.8x 0x%8.8x 0x%8.8x\n",
+ offset, readl(base + offset),
+ readl(base + offset + 0x4),
+ readl(base + offset + 0x8),
+ readl(base + offset + 0xc));
+ offset += 0x10;
+ }
+}
+
+static void ssusb_read_regs(struct xhci_hcd_mtk *mtk, const char *buf)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ void __iomem *base;
+ u32 offset = 0;
+ u32 len = 0;
+ u32 limit = 0;
+ u32 param;
+
+ param = sscanf(buf, "%*s 0x%x 0x%x", &offset, &len);
+ xhci_info(xhci, "params-%d (offset: %#x, len: %#x)\n",
+ param, offset, len);
+ hqa_info (mtk, "params-%d (offset: %#x, len: %#x)\n",
+ param, offset, len);
+
+ base = get_reg_base_limit(mtk, buf, &limit);
+ if (!base || !param) {
+ xhci_err(xhci, "params are invalid!\n");
+ hqa_info(mtk, "params are invalid since %p, %u!\n",
+ base, param);
+ return;
+ }
+
+ if (param == 1)
+ read_single_reg(mtk, base, offset, limit);
+ else
+ read_multi_regs(mtk, base, offset, len, limit);
+
+ base = (void __iomem *)((unsigned long)base & 0xFFFF0000);
+ iounmap(base);
+}
+
+static void ssusb_set_reg_bits(struct xhci_hcd_mtk *mtk, const char *buf)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ void __iomem *base;
+ u32 offset = 0;
+ u32 bit_start = 0;
+ u32 mask = 0;
+ u32 value = 0;
+ u32 old_val = 0;
+ u32 new_val = 0;
+ u32 limit = 0;
+ u32 param;
+
+ param = sscanf(buf, "%*s 0x%x %d 0x%x 0x%x",
+ &offset, &bit_start, &mask, &value);
+ xhci_info(xhci, "params-%d (offset:%#x,bit_start:%d,mask:%#x,value:%#x)\n",
+ param, offset, bit_start, mask, value);
+ hqa_info(mtk, "params-%d (offset:%#x,bit_start:%d,mask:%#x,value:%#x)\n",
+ param, offset, bit_start, mask, value);
+
+ base = get_reg_base_limit(mtk, buf, &limit);
+ if (!base || (param != 4) || (bit_start > 31)) {
+ xhci_err(xhci, "params are invalid!\n");
+ hqa_info(mtk, "params are invalid since %p, %u, %u\n",
+ base, param, bit_start);
+ return;
+ }
+
+ offset &= ~0x3; /* 4-bytes align */
+ if (offset >= limit) {
+ xhci_err(xhci, "reg's offset overrun!\n");
+ hqa_info(mtk, "reg's offset overrun since %u >= %u!\n",
+ offset, limit);
+ return;
+ }
+ old_val = readl(base + offset);
+ new_val = old_val;
+ new_val &= ~(mask << bit_start);
+ new_val |= (value << bit_start);
+ writel(new_val, base + offset);
+ xhci_info(xhci, "0x%8.8x : 0x%8.8x --> 0x%8.8x\n", offset, old_val,
+ readl(base + offset));
+ hqa_info (mtk, "0x%8.8x : 0x%8.8x --> 0x%8.8x\n", offset, old_val,
+ readl(base + offset));
+
+ base = (void __iomem *)((unsigned long)base & 0xFFFF0000);
+ iounmap(base);
+}
+
+static void ssusb_print_reg_bits(struct xhci_hcd_mtk *mtk, const char *buf)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ void __iomem *base;
+ u32 offset = 0;
+ u32 bit_start = 0;
+ u32 mask = 0;
+ u32 old_val = 0;
+ u32 new_val = 0;
+ u32 limit = 0;
+ u32 param;
+
+ param = sscanf(buf, "%*s 0x%x %d 0x%x", &offset, &bit_start, &mask);
+ xhci_info(xhci, "params-%d (offset: %#x, bit_start: %d, mask: %#x)\n",
+ param, offset, bit_start, mask);
+ hqa_info (mtk, "params-%d (offset: %#x, bit_start: %d, mask: %#x)\n",
+ param, offset, bit_start, mask);
+
+ base = get_reg_base_limit(mtk, buf, &limit);
+ if (!base || (param != 3) || (bit_start > 31)) {
+ xhci_err(xhci, "params are invalid!\n");
+ hqa_info(mtk, "params are invalid since %p, %u, %u\n",
+ base, param, bit_start);
+ return;
+ }
+
+ offset &= ~0x3; /* 4-bytes align */
+ if (offset >= limit) {
+ xhci_err(xhci, "reg's offset overrun!\n");
+ hqa_info(mtk, "reg's offset overrun since %u >= %u!\n",
+ offset, limit);
+ return;
+ }
+
+ old_val = readl(base + offset);
+ new_val = old_val;
+ new_val >>= bit_start;
+ new_val &= mask;
+ xhci_info(xhci, "0x%8.8x : 0x%8.8x (0x%x)\n", offset, old_val, new_val);
+ hqa_info (mtk, "0x%8.8x : 0x%8.8x (0x%x)\n", offset, old_val, new_val);
+
+ base = (void __iomem *)((unsigned long)base & 0xFFFF0000);
+ iounmap(base);
+}
+
+static ssize_t
+reg_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t n)
+{
+ struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+
+ xhci_info(xhci, "cmd:%s\n", buf);
+ hqa_info (mtk, "cmd:%s\n", buf);
+
+ switch (buf[0]) {
+ case 'w':
+ ssusb_write_reg(mtk, buf);
+ break;
+ case 'r':
+ ssusb_read_regs(mtk, buf);
+ break;
+ case 's':
+ ssusb_set_reg_bits(mtk, buf);
+ break;
+ case 'p':
+ ssusb_print_reg_bits(mtk, buf);
+ break;
+ default:
+ xhci_err(xhci, "No such cmd\n");
+ hqa_info(mtk, "No such cmd\n");
+ }
+
+ return n;
+}
+DEVICE_ATTR_RW(reg);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-term-vref.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-term-vref.c
index 3b40ef9..31861be 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-term-vref.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-term-vref.c
@@ -22,6 +22,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -67,8 +68,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -143,7 +144,7 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES)
goto error;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.c
index 4939e55..36564d2 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.c
@@ -16,6 +16,8 @@
#include <linux/kobject.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>
#include <dt-bindings/phy/phy.h>
#include "../core/usb.h"
#include "xhci-mtk.h"
@@ -32,20 +34,50 @@
int argc, char **argv);
static int t_test_enumerate_bus(struct xhci_hcd_mtk *mtk,
int argc, char **argv);
+static int t_debug_port(struct xhci_hcd_mtk *mtk, int argc, char **argv);
static int t_power_u1u2(struct xhci_hcd_mtk *mtk, int argc, char **argv);
#define PORT_PLS_VALUE(p) ((p >> 5) & 0xf)
+/* ip_xhci_cap register */
+#define CAP_U3_PORT_NUM(p) ((p) & 0xff)
+#define CAP_U2_PORT_NUM(p) (((p) >> 8) & 0xff)
#define MAX_NAME_SIZE 32
#define MAX_ARG_SIZE 4
+struct class_info {
+ int class;
+ char *class_name;
+};
+
+static const struct class_info clas_info[] = {
+ /* max. 5 chars. per name string */
+ {USB_CLASS_PER_INTERFACE, ">ifc"},
+ {USB_CLASS_AUDIO, "audio"},
+ {USB_CLASS_COMM, "comm."},
+ {USB_CLASS_HID, "HID"},
+ {USB_CLASS_PHYSICAL, "PID"},
+ {USB_CLASS_STILL_IMAGE, "still"},
+ {USB_CLASS_PRINTER, "print"},
+ {USB_CLASS_MASS_STORAGE, "stor."},
+ {USB_CLASS_HUB, "hub"},
+ {USB_CLASS_CDC_DATA, "data"},
+ {USB_CLASS_CSCID, "scard"},
+ {USB_CLASS_CONTENT_SEC, "c-sec"},
+ {USB_CLASS_VIDEO, "video"},
+ {USB_CLASS_WIRELESS_CONTROLLER, "wlcon"},
+ {USB_CLASS_MISC, "misc"},
+ {USB_CLASS_APP_SPEC, "app."},
+ {USB_CLASS_VENDOR_SPEC, "vend."},
+ {-1, "unk."} /* leave as last */
+};
+
struct hqa_test_cmd {
char name[MAX_NAME_SIZE];
int (*cb_func)(struct xhci_hcd_mtk *mtk, int argc, char **argv);
char *discription;
};
-
struct hqa_test_cmd xhci_mtk_hqa_cmds[] = {
{"test.j", &t_test_j, "Test_J"},
{"test.k", &t_test_k, "Test_K"},
@@ -56,10 +88,20 @@
{"test.enumbus", &t_test_enumerate_bus, "Enumerate Bus"},
{"test.getdesc", &t_test_get_device_descriptor,
"Get Device Discriptor"},
+ {"test.debug", &t_debug_port, "debug Port infor"},
{"pm.u1u2", &t_power_u1u2, "Port U1,U2"},
{"", NULL, ""},
};
+static const char *class_decode(const int class)
+{
+ int i;
+
+ for (i = 0; clas_info[i].class != -1; i++)
+ if (clas_info[i].class == class)
+ break;
+ return clas_info[i].class_name;
+}
int call_hqa_func(struct xhci_hcd_mtk *mtk, char *buf)
{
@@ -256,6 +298,82 @@
return retval;
}
+static void show_string(struct usb_device *udev, char *id, char *string)
+{
+ if (!string)
+ return;
+ dev_info(&udev->dev, "%s: %s\n", id, string);
+}
+
+static void announce_device(struct usb_device *udev)
+{
+ u16 bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice);
+
+ dev_info(&udev->dev,
+ "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%2x.%02x\n",
+ le16_to_cpu(udev->descriptor.idVendor),
+ le16_to_cpu(udev->descriptor.idProduct),
+ bcdDevice >> 8, bcdDevice & 0xff);
+ dev_info(&udev->dev,
+ "New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
+ udev->descriptor.iManufacturer,
+ udev->descriptor.iProduct,
+ udev->descriptor.iSerialNumber);
+ show_string(udev, "Product", udev->product);
+ show_string(udev, "Manufacturer", udev->manufacturer);
+ show_string(udev, "SerialNumber", udev->serial);
+}
+
+static int t_debug_port(struct xhci_hcd_mtk *mtk, int argc, char **argv)
+{
+ struct usb_hcd *hcd = mtk->hcd;
+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct usb_device *usb2_rh;
+ struct usb_device *udev;
+ long port_id;
+ const struct usb_device_descriptor *desc;
+ u16 bcdUSB;
+ u16 bcdDevice;
+
+ port_id = 2;
+
+ if (argc > 1 && kstrtol(argv[1], 10, &port_id))
+ xhci_err(xhci, "mu3h %s get port-id failed\n", __func__);
+
+ xhci_err(xhci, "mu3h %s test port%d\n", __func__, (int)port_id);
+
+
+ usb2_rh = hcd->self.root_hub;
+ udev = usb_hub_find_child(usb2_rh, port_id - 1);
+ if (udev == NULL) {
+ xhci_err(xhci, "mu3h %s usb_hub_find_child(..., %i) failed\n", __func__, (int)port_id);
+ return -EPERM;
+ }
+
+ dev_info(&udev->dev, "%s\n", usb_state_string(udev->state));
+ if (udev && udev->state == USB_STATE_CONFIGURED) {
+ announce_device(udev);
+ desc = (const struct usb_device_descriptor *)&udev->descriptor;
+ bcdUSB = le16_to_cpu(desc->bcdUSB);
+ bcdDevice = le16_to_cpu(desc->bcdDevice);
+
+ dev_info(&udev->dev, "D: Ver=%2x.%02x Cls=%02x(%-5s) Sub=%02x Prot=%02x MxPS=%2d #Cfgs=%3d\n",
+ bcdUSB >> 8, bcdUSB & 0xff,
+ desc->bDeviceClass,
+ class_decode(desc->bDeviceClass),
+ desc->bDeviceSubClass,
+ desc->bDeviceProtocol,
+ desc->bMaxPacketSize0,
+ desc->bNumConfigurations);
+
+ dev_info(&udev->dev, "P: Vendor=%04x ProdID=%04x Rev=%2x.%02x\n",
+ le16_to_cpu(desc->idVendor),
+ le16_to_cpu(desc->idProduct),
+ bcdDevice >> 8, bcdDevice & 0xff);
+ }
+
+ return 0;
+}
static int t_test_suspend(struct xhci_hcd_mtk *mtk, int argc, char **argv)
{
@@ -447,33 +565,43 @@
u32 val;
u32 ports;
int len = 0;
- int bufLen = PAGE_SIZE;
struct hqa_test_cmd *hqa;
int i;
- len += snprintf(buf+len, bufLen-len, "info:\n");
- len += snprintf(buf+len, bufLen-len,
+ len += sprintf(buf+len, "info:\n");
+ len += sprintf(buf+len,
"\techo -n item port-id > hqa\n");
- len += snprintf(buf+len, bufLen-len,
+ len += sprintf(buf+len,
"\tport-id : based on number of usb3-port, e.g.\n");
- len += snprintf(buf+len, bufLen-len,
+ len += sprintf(buf+len,
"\t\txHCI with 1 u3p, 2 u2p: 1st u2p-id is 2(1+1), 2nd is 3\n");
- len += snprintf(buf+len, bufLen-len, "items:\n");
+ len += sprintf(buf+len, "items:\n");
for (i = 0; i < ARRAY_SIZE(xhci_mtk_hqa_cmds); i++) {
hqa = &xhci_mtk_hqa_cmds[i];
- len += snprintf(buf+len, bufLen-len,
+ len += sprintf(buf+len,
"\t%s: %s\n", hqa->name, hqa->discription);
}
ports = mtk->num_u3_ports + mtk->num_u2_ports;
- for (i = mtk->num_u3_ports + 1; i <= ports; i++) {
- addr = &xhci->op_regs->port_power_base +
+ for (i = 1; i <= ports; i++) {
+ addr = &xhci->op_regs->port_status_base +
NUM_PORT_REGS * ((i - 1) & 0xff);
val = readl(addr);
- len += snprintf(buf+len, bufLen-len,
- "USB20 Port%i PORTMSC[31,28] 4b'0000: 0x%08X\n",
- i, val);
+ if (i <= mtk->num_u3_ports)
+ len += sprintf(buf + len,
+ "USB30 Port%i: 0x%08X\n", i, val);
+ else {
+ len += sprintf(buf + len,
+ "USB20 Port%i: 0x%08X\n", i, val);
+
+ addr = &xhci->op_regs->port_power_base +
+ NUM_PORT_REGS * ((i - 1) & 0xff);
+ val = readl(addr);
+ len += sprintf(buf+len,
+ "USB20 Port%i PORTMSC[31,28] 4b'0000: 0x%08X\n",
+ i, val);
+ }
}
return len;
@@ -511,17 +639,17 @@
int ports;
cnt += sprintf(buf + cnt, "usb3hqa usage:\n");
- cnt += sprintf(buf + cnt, " echo u3port >usb3hqa\n");
+ cnt += sprintf(buf + cnt, " echo [u3port] >usb3hqa\n");
ports = mtk->num_u3_ports + mtk->num_u2_ports;
for (i = 1; i <= ports; i++) {
addr = &xhci->op_regs->port_status_base +
NUM_PORT_REGS * ((i - 1) & 0xff);
val = readl(addr);
- if (i < mtk->num_u3_ports)
+ if (i <= mtk->num_u3_ports)
cnt += sprintf(buf + cnt,
"USB30 Port%i: 0x%08X\n", i, val);
- else
+ else
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
}
@@ -554,8 +682,8 @@
words = sscanf(buf, "%d", &port);
if ((words != 1) ||
(port < 1 || port > mtk->num_u3_ports)) {
- hqa_info(mtk, "usb3hqa: param number:%i, port:%i failure\n",
- words, port);
+ hqa_info(mtk, "usb3hqa: param number:%i, port:%i (%i) failure\n",
+ words, port, mtk->num_u3_ports);
return -EINVAL;
}
@@ -580,9 +708,16 @@
int hqa_create_attr(struct device *dev)
{
- int idx, err = 0;
- int num = ARRAY_SIZE(mu3h_hqa_attr_list);
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
+ struct usb_hcd *hcd = mtk->hcd;
+ struct mu3c_ippc_regs __iomem *ippc = mtk->ippc_regs;
+ struct platform_device *device = to_platform_device(dev);
+ int num = ARRAY_SIZE(mu3h_hqa_attr_list);
+ int idx;
+ int err = 0;
+ u32 value;
+ u32 addr = hcd->rsrc_start;
+ u32 length;
if (dev == NULL || mtk == NULL)
return -EINVAL;
@@ -593,6 +728,19 @@
if (!mtk->hqa_buf)
return -ENOMEM;
+ if (!mtk->has_ippc) {
+ err = query_reg_addr(device, &addr, &length, "ippc");
+ if (err)
+ return -EINVAL;
+
+ mtk->ippc_regs = ioremap(addr, length);
+ }
+
+ ippc = mtk->ippc_regs;
+ value = readl(&ippc->ip_xhci_cap);
+ mtk->num_u3_ports = CAP_U3_PORT_NUM(value);
+ mtk->num_u2_ports = CAP_U2_PORT_NUM(value);
+
for (idx = 0; idx < num; idx++) {
err = device_create_file(dev, mu3h_hqa_attr_list[idx]);
if (err)
@@ -614,4 +762,8 @@
kfree(mtk->hqa_buf);
mtk->hqa_size = 0;
mtk->hqa_pos = 0;
+ if (!mtk->has_ippc) {
+ iounmap(mtk->ippc_regs);
+ mtk->ippc_regs = NULL;
+ }
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.h
index 83e1542..7f76d29 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-test.h
@@ -15,6 +15,8 @@
#ifdef CONFIG_USB_XHCI_MTK_DEBUGFS
int hqa_create_attr(struct device *dev);
void hqa_remove_attr(struct device *dev);
+void ssusb_remap_ip_regs(struct device *dev);
+
#else
static inline int hqa_create_attr(struct device *dev)
{
@@ -23,5 +25,8 @@
static inline void hqa_remove_attr(struct device *dev)
{
}
+static inline void ssusb_remap_ip_regs(struct device *dev)
+{
+}
#endif
#endif /* __XHCI_MTK_TEST_H */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.c
index 14d7d0b..01029fb 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.c
@@ -13,7 +13,6 @@
#include <linux/usb.h>
#include <linux/of.h>
#include <linux/of_address.h>
-#include <dt-bindings/phy/phy.h>
#include "xhci-mtk.h"
#include "xhci-mtk-test.h"
#include "xhci-mtk-unusual.h"
@@ -127,42 +126,81 @@
return value;
}
-int query_phy_addr(struct device_node *np, int *start, u32 *addr, u32 *length)
+int query_phy_addr(struct device_node *np, int *start, u32 *addr, u32 *length, int type)
{
int ret = -EPERM;
struct of_phandle_args args;
struct resource res;
+ struct device_node *node = np;
int numphys = 0;
int index;
- if (start == NULL || addr == NULL || length == NULL)
+ if (np == NULL || start == NULL || addr == NULL || length == NULL)
return -EINVAL;
- numphys = of_count_phandle_with_args(np, "phys", "#phy-cells");
- for ( index = *start; (numphys > 0) && index < numphys; index++) {
- ret = of_parse_phandle_with_args(np, "phys", "#phy-cells",
+ while (node) {
+ numphys = of_count_phandle_with_args(node,
+ "phys", "#phy-cells");
+ for (index = *start;
+ (numphys > 0) && index < numphys; index++) {
+ ret = of_parse_phandle_with_args(node,
+ "phys", "#phy-cells",
index, &args);
- if (ret < 0)
- break;
+ if (ret < 0)
+ break;
+
+ if (args.args[0] == type) {
+ ret = of_address_to_resource(args.np,
+ 0, &res);
+ if (ret < 0) {
+ of_node_put(args.np);
+ break;
+ }
- if (args.args[0] == PHY_TYPE_USB2) {
- ret = of_address_to_resource(args.np, 0, &res);
- if (ret < 0) {
+ *addr = res.start;
+ *length = (u32)resource_size(&res);
+ *start = index;
+ if (!of_device_is_available(args.np))
+ ret = -EACCES;
+
of_node_put(args.np);
break;
}
+ }
+ if (index < numphys)
+ break;
- *addr = res.start;
- *length = (u32)resource_size(&res);
- *start = index;
- if (!of_device_is_available(args.np))
- ret = -EACCES;
+ node = node->parent;
+ }
+
+ ret = index < numphys ? ret : -EPERM;
+ return ret;
+}
- of_node_put(args.np);
+int query_reg_addr(struct platform_device *pdev, u32 *addr, u32 *length, const char* name)
+{
+ int ret = -EPERM;
+ struct resource *pres;
+ struct platform_device *device = pdev;
+
+ if (pdev == NULL || addr == NULL || length == NULL)
+ return -EINVAL;
+
+ while (device) {
+ pres = platform_get_resource_byname(device, IORESOURCE_MEM, name);
+ if (pres != NULL) {
+ *addr = pres->start;
+ *length = (u32)resource_size(pres);
+ ret = 0;
break;
}
+
+ if (device->dev.parent == NULL)
+ break;
+
+ device = to_platform_device(device->dev.parent);
}
- ret = index < numphys ? ret : -EPERM;
return ret;
}
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.h
index ddbf4e3..0bc6dd8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-unusual.h
@@ -10,6 +10,8 @@
#ifndef __XHCI_MTK_UNUSUAL_H
#define __XHCI_MTK_UNUSUAL_H
+#include <dt-bindings/phy/phy.h>
+
#define HQA_PREFIX_SIZE 4*1024
#define BIT_WIDTH_1 1
@@ -131,7 +133,10 @@
u32 shift, const char *buf);
u32 bin2str(u32 value, u32 width, char *buffer);
int query_phy_addr(struct device_node *np, int *start,
- u32 *addr, u32 *length);
+ u32 *addr, u32 *length, int type);
+int query_reg_addr(struct platform_device *pdev, u32 *addr,
+ u32 *length, const char* name);
+
static inline int remaining(struct xhci_hcd_mtk *mtk)
{
u32 surplus = 0;
@@ -178,7 +183,12 @@
return 0;
};
static inline int query_phy_addr(struct device_node *np, int *start,
- u32 *addr, u32 *length)
+ u32 *addr, u32 *length, int type)
+{
+ return -EPERM;
+}
+static inline int query_reg_addr(struct platform_device *pdev, u32 *addr,
+ u32 *length, const char* name)
{
return -EPERM;
}
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-vrt-vref.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-vrt-vref.c
index ec0ef75..1a6d611 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-vrt-vref.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/usb/host/xhci-mtk-vrt-vref.c
@@ -21,6 +21,7 @@
struct xhci_hcd_mtk *mtk = dev_get_drvdata(dev);
struct usb_hcd *hcd = mtk->hcd;
struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+ struct device_node *node = dev->of_node;
ssize_t cnt = 0;
void __iomem *addr;
u32 val;
@@ -66,8 +67,8 @@
cnt += sprintf(buf + cnt,
"USB20 Port%i: 0x%08X\n", i, val);
- ret = query_phy_addr(dev->of_node,
- &index, &io, &length);
+ ret = query_phy_addr(node,
+ &index, &io, &length, PHY_TYPE_USB2);
if (ret && ret != -EACCES) {
if (ret == -EPERM)
cnt += sprintf(buf + cnt,
@@ -95,7 +96,7 @@
}
if (mtk->hqa_pos) {
- cnt += sprintf(buf + cnt, "%s", mtk->hqa_buf);
+ cnt += sprintf(buf + cnt, "%s", mtk->hqa_buf);
mtk->hqa_pos = 0;
}
@@ -142,8 +143,8 @@
hqa_info(mtk, " params: %i %i %s\n",
port, index, str);
- ret = query_phy_addr(node, &index, &io, &length);
- if (ret && ret != -EACCES)
+ ret = query_phy_addr(node, &index, &io, &length, PHY_TYPE_USB2);
+ if (ret && ret != -EACCES)
goto error;
io += (length != 0x100) ? 0x300 : 0;
@@ -156,7 +157,7 @@
iounmap(addr);
ret = n;
-
+
error:
kfree(str);
return ret;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/mtk_nl80211_inc/mtk_vendor_nl80211.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/mtk_nl80211_inc/mtk_vendor_nl80211.h
deleted file mode 100755
index 22ada41..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/mtk_nl80211_inc/mtk_vendor_nl80211.h
+++ /dev/null
@@ -1,667 +0,0 @@
-/*
- * Copyright (c) [2020], MediaTek Inc. All rights reserved.
- *
- * This software/firmware and related documentation ("MediaTek Software") are
- * protected under relevant copyright laws.
- * The information contained herein is confidential and proprietary to
- * MediaTek Inc. and/or its licensors.
- * Except as otherwise provided in the applicable licensing terms with
- * MediaTek Inc. and/or its licensors, any reproduction, modification, use or
- * disclosure of MediaTek Software, and information contained herein, in whole
- * or in part, shall be strictly prohibited.
-*/
-
-#ifndef __MTK_VENDOR_NL80211_H
-#define __MTK_VENDOR_NL80211_H
-/*
- * This header file defines the userspace API to the wireless stack. Please
- * be careful not to break things - i.e. don't move anything around or so
- * unless you can demonstrate that it breaks neither API nor ABI.
- *
- */
-
-#include <linux/types.h>
-
-#ifndef GNU_PACKED
-#define GNU_PACKED __attribute__ ((packed))
-#endif /* GNU_PACKED */
-
-#define MTK_NL80211_VENDOR_ID 0x0ce7
-
-/**
- * enum mtk_nl80211_vendor_commands - supported mtk nl80211 vendor commands
- *
- * @MTK_NL80211_VENDOR_SUBCMD_UNSPEC: Reserved value 0
- * @MTK_NL80211_VENDOR_SUBCMD_TEST: Test for nl80211command/event
- * @MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0x000000ae:
- * @MTK_NL80211_VENDOR_SUBCMD_CSI_CTRL = 0x000000c2:
- * @MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL:
- * @MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_DOT11V_WNM:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_WAPP:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_CH_MONITOR:
- * @MTK_NL80211_VENDOR_SUBCMD_BSS_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_MAP_R3:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_HS_ANQP_RSP:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_HS:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_OFFCH_SCAN:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_DFS_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_WSC:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_MBO_MSG:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_RRM_COMMAND:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_QOS:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_CAP: command to get capability information
- * from wifi driver, it requres mtk_nl80211_vendor_attr_get_cap attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_GET_RUNTIME_INFO: command to get run time information
- * from wifi driver, it requres mtk_nl80211_vendor_attr_get_runtime_info attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_GET_STATISTIC: command to get statistic information
- * from wifi driver, it requres mtk_nl80211_vendor_attr_get_static_info attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_GET_SRG_BITMAP:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_STATIC_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_WNM:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_HS:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_WSC:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_DFS_ZERO_WAIT:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_FRAME:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_APCLI_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_BBP:
- * @MTK_NL80211_VENDOR_SUBCMD_MAC: command to set or get mac register
- * information to/from wifi driver, require mtk_nl80211_vendor_attrs_mac
- * attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_E2P:
- * @MTK_NL80211_VENDOR_SUBCMD_ATE:
- * @MTK_NL80211_VENDOR_SUBCMD_STATISTICS: command to get statistic information
- * in string from wifi driver, this command is used to be compatible with
- * old iwpriv stat command, it requres mtk_nl80211_vendor_attrs_statistics
- * attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_ADD_PMKID_CACHE:
- * @MTK_NL80211_VENDOR_SUBCMD_RADIUS_DATA:
- * @MTK_NL80211_VENDOR_SUBCMD_GSITESURVEY:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_MAC_TABLE:
- * @MTK_NL80211_VENDOR_SUBCMD_STATIC_WEP_COPY:
- * @MTK_NL80211_VENDOR_SUBCMD_WSC_PROFILE:
- * @MTK_NL80211_VENDOR_SUBCMD_RF:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_WSC_PROFILE_U32_ITEM:
- * @MTK_NL80211_VENDOR_SUBCMD_QUERY_BATABLE:
- * @MTK_NL80211_VENDOR_SUBCMD_RD:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_FT_PARAM:
- * @MTK_NL80211_VENDOR_SUBCMD_SET_WSCOOB:
- * @MTK_NL80211_VENDOR_SUBCMD_WSC_CALLBACK:
- * @MTK_NL80211_VENDOR_SUBCMD_RX_STATISTICS:
- * @MTK_NL80211_VENDOR_SUBCMD_GET_DRIVER_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_STA_VLAN:
- * @MTK_NL80211_VENDOR_SUBCMD_PHY_STATE:
- * @MTK_NL80211_VENDOR_SUBCMD_VENDOR_SET: command to set old iwpriv set command
- * string to wifi driver, it requires mtk_nl80211_vendor_attrs_vendor_set attributes,
- * please note that this command is just used to be compatible with old iwpriv
- * set command, and it will be discarded in some time.
- *
- * @MTK_NL80211_VENDOR_SUBCMD_VENDOR_SHOW: command to set old iwpriv show command
- * string to wifi driver, require mtk_nl80211_vendor_attrs_vendor_show attributes,
- * please note that this command is just used to be compatible with old iwpriv
- * show command, and it will be discarded in some time.
- *
- * @MTK_NL80211_VENDOR_SUBCMD_HS:
- * @MTK_NL80211_VENDOR_SUBCMD_WNM:
- * @MTK_NL80211_VENDOR_SUBCMD_MBO_MSG:
- * @MTK_NL80211_VENDOR_SUBCMD_NEIGHBOR_REPORT:
- * @MTK_NL80211_VENDOR_SUBCMD_OFFCHANNEL_INFO:
- * @MTK_NL80211_VENDOR_SUBCMD_OCE_MSG:
- * @MTK_NL80211_VENDOR_SUBCMD_WAPP_REQ: command to set or get wapp requred
- * information from wifi driver, require mtk_nl80211_vendor_attr_wapp_req attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_SET_AP_SECURITY: command to set ap security configurations
- * to a specific bss in wifi driver, it requires mtk_nl80211_vendor_attrs_ap_security
- * attributes.
- * @MTK_NL80211_VENDOR_SUBCMD_SET_AP_VOW: command to set ap vow configurations
- * it requires mtk_nl80211_vendor_attrs_ap_vow attributes.
- * @MTK_NL80211_VENDOR_CMD_MAX: highest used command number
- * @__MTK_NL80211_VENDOR_CMD_AFTER_LAST: internal use
- */
-enum mtk_nl80211_vendor_commands {
- MTK_NL80211_VENDOR_SUBCMD_UNSPEC = 0,
- MTK_NL80211_VENDOR_SUBCMD_TEST = 1,
-
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_SUBCMD_AMNT_CTRL = 0x000000ae,
- MTK_NL80211_VENDOR_SUBCMD_CSI_CTRL = 0x000000c2,
- MTK_NL80211_VENDOR_SUBCMD_RFEATURE_CTRL,
- MTK_NL80211_VENDOR_SUBCMD_WIRELESS_CTRL,
- MTK_NL80211_VENDOR_SUBCMD_SET_DOT11V_WNM,
- MTK_NL80211_VENDOR_SUBCMD_SET_WAPP,
- MTK_NL80211_VENDOR_SUBCMD_SET_CH_MONITOR,
- MTK_NL80211_VENDOR_SUBCMD_BSS_INFO,
- MTK_NL80211_VENDOR_SUBCMD_SET_MAP_R3,
- MTK_NL80211_VENDOR_SUBCMD_SET_HS_ANQP_RSP,
- MTK_NL80211_VENDOR_SUBCMD_SET_HS,
- MTK_NL80211_VENDOR_SUBCMD_SET_OFFCH_SCAN,
- MTK_NL80211_VENDOR_SUBCMD_SET_DFS_INFO,
- MTK_NL80211_VENDOR_SUBCMD_SET_WSC,
- MTK_NL80211_VENDOR_SUBCMD_SET_MBO_MSG,
- MTK_NL80211_VENDOR_SUBCMD_SET_RRM_COMMAND,
- MTK_NL80211_VENDOR_SUBCMD_SET_QOS,
- MTK_NL80211_VENDOR_SUBCMD_GET_CAP,
- MTK_NL80211_VENDOR_SUBCMD_GET_RUNTIME_INFO,
- MTK_NL80211_VENDOR_SUBCMD_GET_STATISTIC,
- MTK_NL80211_VENDOR_SUBCMD_GET_SRG_BITMAP,
- MTK_NL80211_VENDOR_SUBCMD_GET_STATIC_INFO,
- MTK_NL80211_VENDOR_SUBCMD_GET_WNM,
- MTK_NL80211_VENDOR_SUBCMD_GET_HS,
- MTK_NL80211_VENDOR_SUBCMD_GET_WSC,
- MTK_NL80211_VENDOR_SUBCMD_GET_DFS_ZERO_WAIT,
- MTK_NL80211_VENDOR_SUBCMD_GET_FRAME,
- MTK_NL80211_VENDOR_SUBCMD_GET_APCLI_INFO,
- MTK_NL80211_VENDOR_SUBCMD_BBP,
- MTK_NL80211_VENDOR_SUBCMD_MAC,
- MTK_NL80211_VENDOR_SUBCMD_E2P,
- MTK_NL80211_VENDOR_SUBCMD_ATE,
- MTK_NL80211_VENDOR_SUBCMD_STATISTICS,
- MTK_NL80211_VENDOR_SUBCMD_ADD_PMKID_CACHE,
- MTK_NL80211_VENDOR_SUBCMD_RADIUS_DATA,
- MTK_NL80211_VENDOR_SUBCMD_GSITESURVEY,
- MTK_NL80211_VENDOR_SUBCMD_GET_MAC_TABLE,
- MTK_NL80211_VENDOR_SUBCMD_STATIC_WEP_COPY,
- MTK_NL80211_VENDOR_SUBCMD_WSC_PROFILE ,
- MTK_NL80211_VENDOR_SUBCMD_RF,
- MTK_NL80211_VENDOR_SUBCMD_SET_WSC_PROFILE_U32_ITEM,
- MTK_NL80211_VENDOR_SUBCMD_QUERY_BATABLE,
- MTK_NL80211_VENDOR_SUBCMD_RD,
- MTK_NL80211_VENDOR_SUBCMD_SET_FT_PARAM,
- MTK_NL80211_VENDOR_SUBCMD_SET_WSCOOB,
- MTK_NL80211_VENDOR_SUBCMD_WSC_CALLBACK,
- MTK_NL80211_VENDOR_SUBCMD_RX_STATISTICS,
- MTK_NL80211_VENDOR_SUBCMD_GET_DRIVER_INFO,
- MTK_NL80211_VENDOR_SUBCMD_STA_VLAN,
- MTK_NL80211_VENDOR_SUBCMD_PHY_STATE,
- MTK_NL80211_VENDOR_SUBCMD_VENDOR_SET,
- MTK_NL80211_VENDOR_SUBCMD_VENDOR_SHOW,
- MTK_NL80211_VENDOR_SUBCMD_HS,
- MTK_NL80211_VENDOR_SUBCMD_WNM,
- MTK_NL80211_VENDOR_SUBCMD_MBO_MSG,
- MTK_NL80211_VENDOR_SUBCMD_NEIGHBOR_REPORT,
- MTK_NL80211_VENDOR_SUBCMD_OFFCHANNEL_INFO,
- MTK_NL80211_VENDOR_SUBCMD_OCE_MSG,
- MTK_NL80211_VENDOR_SUBCMD_WAPP_REQ,
- MTK_NL80211_VENDOR_SUBCMD_SET_AP_SECURITY,
- MTK_NL80211_VENDOR_SUBCMD_SET_AP_VOW,
- /* add new commands above here */
- /* used to define NL80211_CMD_MAX below */
- __MTK_NL80211_VENDOR_CMD_AFTER_LAST,
- MTK_NL80211_VENDOR_CMD_MAX = __MTK_NL80211_VENDOR_CMD_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_events - MediaTek nl80211 asynchoronous event identifiers
- *
- * @MTK_NL80211_VENDOR_EVENT_UNSPEC: Reserved value 0
- *
- * @MTK_NL80211_VENDOR_EVENT_TEST: Test for nl80211command/event
- */
-enum mtk_nl80211_vendor_events {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_EVENT_UNSPEC = 0,
- MTK_NL80211_VENDOR_EVENT_TEST,
-
- MTK_NL80211_VENDOR_EVENT_RSP_WAPP_EVENT,
-
- /* add new events above here */
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_test - Specifies the values for vendor test
- * command MTK_NL80211_VENDOR_ATTR_TEST
- * @MTK_NL80211_VENDOR_ATTR_TEST:enable nl80211 test
- */
-enum mtk_nl80211_vendor_attr_test {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_TEST_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_TEST,
-
- __MTK_NL80211_VENDOR_ATTR_TEST_LAST,
- MTK_NL80211_VENDOR_ATTR_TEST_MAX =
- __MTK_NL80211_VENDOR_ATTR_TEST_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_event_test - Specifies the values for vendor test
- * event MTK_NL80211_VENDOR_ATTR_TEST
- * @MTK_NL80211_VENDOR_ATTR_TEST:receive nl80211 test event
- */
-enum mtk_nl80211_vendor_attr_event_test {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_EVENT_TEST_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_EVENT_TEST,
-
- __MTK_NL80211_VENDOR_ATTR_EVENT_TEST_LAST,
- MTK_NL80211_VENDOR_ATTR_EVENT_TEST_MAX =
- __MTK_NL80211_VENDOR_ATTR_EVENT_TEST_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_wnm - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_SET_DOT11V_WNM.
- * Information in these attributes is used to set/get wnm information
- * to/from driver from/to user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_WNM_CMD:
- * @MTK_NL80211_VENDOR_ATTR_WNM_BTM_REQ: BTM request frame
- * @MTK_NL80211_VENDOR_ATTR_WNM_BTM_RSP:
- */
-enum mtk_nl80211_vendor_attrs_dot11v_wnm {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_CMD,
- MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_BTM_REQ,
- MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_BTM_RSP,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_AFTER_LAST,
- MTK_NL80211_VENDOR_DOT11V_WNM_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_DOT11V_WNM_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_vendor_set - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_VENDOR_SET.
- * Information in these attributes is used to set information
- * to driver from user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_VENDOR_SET_CMD_STR: command string
- */
-enum mtk_nl80211_vendor_attrs_vendor_set {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_VENDOR_SET_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_VENDOR_SET_CMD_STR,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_VENDOR_SET_AFTER_LAST,
- MTK_NL80211_VENDOR_ATTR_VENDOR_SET_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_VENDOR_SET_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_vendor_show - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_VENDOR_SHOW.
- * Information in these attributes is used to get information
- * from driver to user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_CMD_STR: command string
- * @MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_RSP_STR: show rsp string buffer
- */
-enum mtk_nl80211_vendor_attrs_vendor_show {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_CMD_STR,
- MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_RSP_STR,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_AFTER_LAST,
- MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_VENDOR_SHOW_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_statistics - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_STATISTICS.
- * Information in these attributes is used to get wnm information
- * to/from driver from/to user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_STATISTICS_STR: statistic information string
- */
-enum mtk_nl80211_vendor_attrs_statistics {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_STATISTICS_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_STATISTICS_STR,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_STATISTICS_AFTER_LAST,
- MTK_NL80211_VENDOR_ATTR_STATISTICS_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_STATISTICS_AFTER_LAST - 1
-};
-
-/**
- * structure mac_param - This structure defines the payload format of
- * MTK_NL80211_VENDOR_ATTR_MAC_WRITE_PARAM and MTK_NL80211_VENDOR_ATTR_MAC_SHOW_PARAM.
- * Information in this structure is used to get/set mac register information
- * from/to driver.
- *
- * @start: start mac address
- * @end: end mac address
- * @value: value for the mac register
- */
-struct GNU_PACKED mac_param {
- unsigned int start;
- unsigned int end;
- unsigned int value;
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_mac - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_MAC.
- * Information in these attributes is used to get/set mac information
- * from/to driver.
- *
- * @MTK_NL80211_VENDOR_ATTR_MAC_WRITE_PARAM: params, refer to struct GNU_PACKED mac_param
- * @MTK_NL80211_VENDOR_ATTR_MAC_SHOW_PARAM: params, refer to struct GNU_PACKED mac_param
- * @MTK_NL80211_VENDOR_ATTR_MAC_RSP_STR: RSP string
- */
-enum mtk_nl80211_vendor_attrs_mac {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_MAC_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_MAC_WRITE_PARAM,
- MTK_NL80211_VENDOR_ATTR_MAC_SHOW_PARAM,
- MTK_NL80211_VENDOR_ATTR_MAC_RSP_STR,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_MAC_AFTER_LAST,
- MTK_NL80211_VENDOR_ATTR_MAC_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_MAC_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_vendor_attr_authmode - This enum defines the value of
- * MTK_NL80211_VENDOR_ATTR_AP_SECURITY_AUTHMODE.
- * Information in these attributes is used set auth mode of a specific bss.
- */
-enum mtk_vendor_attr_authmode {
- NL80211_AUTH_OPEN,
- NL80211_AUTH_SHARED,
- NL80211_AUTH_WEPAUTO,
- NL80211_AUTH_WPA,
- NL80211_AUTH_WPAPSK,
- NL80211_AUTH_WPANONE,
- NL80211_AUTH_WPA2,
- NL80211_AUTH_WPA2MIX,
- NL80211_AUTH_WPA2PSK,
- NL80211_AUTH_WPA3,
- NL80211_AUTH_WPA3_192,
- NL80211_AUTH_WPA3PSK,
- NL80211_AUTH_WPA2PSKWPA3PSK,
- NL80211_AUTH_WPA2PSKMIXWPA3PSK,
- NL80211_AUTH_WPA1WPA2,
- NL80211_AUTH_WPAPSKWPA2PSK,
- NL80211_AUTH_WPA_AES_WPA2_TKIPAES,
- NL80211_AUTH_WPA_AES_WPA2_TKIP,
- NL80211_AUTH_WPA_TKIP_WPA2_AES,
- NL80211_AUTH_WPA_TKIP_WPA2_TKIPAES,
- NL80211_AUTH_WPA_TKIPAES_WPA2_AES,
- NL80211_AUTH_WPA_TKIPAES_WPA2_TKIPAES,
- NL80211_AUTH_WPA_TKIPAES_WPA2_TKIP,
- NL80211_AUTH_OWE,
- NL80211_AUTH_FILS_SHA256,
- NL80211_AUTH_FILS_SHA384,
- NL80211_AUTH_WAICERT,
- NL80211_AUTH_WAIPSK,
- NL80211_AUTH_DPP,
- NL80211_AUTH_DPPWPA2PSK,
- NL80211_AUTH_DPPWPA3PSK,
- NL80211_AUTH_DPPWPA3PSKWPA2PSK,
- NL80211_AUTH_WPA2_ENT_OSEN
-};
-
-/**
- * enum mtk_vendor_attr_encryptype - This enum defines the value of
- * MTK_NL80211_VENDOR_ATTR_AP_SECURITY_ENCRYPTYPE.
- * Information in these attributes is used set encryption type of a specific bss.
- */
-enum mtk_vendor_attr_encryptype {
- NL80211_ENCRYPTYPE_NONE,
- NL80211_ENCRYPTYPE_WEP,
- NL80211_ENCRYPTYPE_TKIP,
- NL80211_ENCRYPTYPE_AES,
- NL80211_ENCRYPTYPE_CCMP128,
- NL80211_ENCRYPTYPE_CCMP256,
- NL80211_ENCRYPTYPE_GCMP128,
- NL80211_ENCRYPTYPE_GCMP256,
- NL80211_ENCRYPTYPE_TKIPAES,
- NL80211_ENCRYPTYPE_TKIPCCMP128,
- NL80211_ENCRYPTYPE_WPA_AES_WPA2_TKIPAES,
- NL80211_ENCRYPTYPE_WPA_AES_WPA2_TKIP,
- NL80211_ENCRYPTYPE_WPA_TKIP_WPA2_AES,
- NL80211_ENCRYPTYPE_WPA_TKIP_WPA2_TKIPAES,
- NL80211_ENCRYPTYPE_WPA_TKIPAES_WPA2_AES,
- NL80211_ENCRYPTYPE_WPA_TKIPAES_WPA2_TKIPAES,
- NL80211_ENCRYPTYPE_WPA_TKIPAES_WPA2_TKIP,
- NL80211_ENCRYPTYPE_SMS4
-};
-
-#define MAX_WEP_KEY_LEN 32
-/**
- * structure wep_key_param - This structure defines the payload format of
- * MTK_NL80211_VENDOR_ATTR_AP_SECURITY_WEPKEY. Information in this structure
- * is used to set wep key information to a specific bss in wifi driver.
- *
- * @key_idx: key index
- * @key_len: key length
- * @key: key value
- */
-struct GNU_PACKED wep_key_param {
- unsigned char key_idx;
- unsigned int key_len;
- unsigned char key[MAX_WEP_KEY_LEN];
-};
-
-/**
- * structure vow_group_en_param - This structure defines the payload format of
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_ATC_EN_INFO &
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_BW_CTL_EN_INFO.
- * Information in this structure is used to set vow airtime control enable configuration
- * to a specific group in wifi driver.
- *
- * @group: vow group
- * @en: Enable/Disable
- */
-struct GNU_PACKED vow_group_en_param {
- unsigned int group;
- unsigned int en;
-};
-
-/**
- * structure vow_group_en_param - This structure defines the payload format of
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATE_INFO &
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATE_INFO.
- * Information in this structure is used to set vow airtime rate configuration
- * to a specific group in wifi driver.
- *
- * @group: vow group
- * @rate: vow rate
- */
-struct GNU_PACKED vow_rate_param {
- unsigned int group;
- unsigned int rate;
-};
-
-/**
- * structure vow_group_en_param - This structure defines the payload format of
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATIO_INFO &
- * MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATIO_INFO.
- * Information in this structure is used to set vow airtime ratio configuration
- * to a specific group in wifi driver.
- *
- * @group: vow group
- * @ratio: vow ratio
- */
-struct GNU_PACKED vow_ratio_param {
- unsigned int group;
- unsigned int ratio;
-};
-
-/**
- * enum mtk_nl80211_vendor_attrs_ap_vow - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_SET_AP_VOW.
- * Information in these attributes is used to set vow configuration
- * to driver from user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_ATF_EN_INFO: u8, air time fairness enable attributes
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_ATC_EN_INFO: refer to vow_group_en_param
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_BW_EN_INFO: u8, air time bw enalbe attributes
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_BW_CTL_EN_INFO: refer to vow_group_en_param
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATE_INFO: refer to vow_rate_param
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATE_INFO: refer to vow_rate_param
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATIO_INFO: refer to vow_ratio_param
- * @MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATIO_INFO: refer to vow_ratio_param
- */
-enum mtk_nl80211_vendor_attrs_ap_vow{
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_AP_VOW_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_ATF_EN_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_ATC_EN_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_BW_EN_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_BW_CTL_EN_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATE_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATE_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_MIN_RATIO_INFO,
- MTK_NL80211_VENDOR_ATTR_AP_VOW_MAX_RATIO_INFO,
- __MTK_NL80211_VENDOR_ATTR_AP_VOW_AFTER_LAST,
- MTK_NL80211_VENDOR_AP_VOW_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_AP_VOW_AFTER_LAST - 1
-};
-/**
- * enum mtk_nl80211_vendor_attrs_ap_security - This enum defines
- * attributes required for MTK_NL80211_VENDOR_SUBCMD_SET_AP_SECURITY.
- * Information in these attributes is used to set security information
- * to driver from user application.
- *
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_AUTHMODE: u32, auth mode attributes, refer to mtk_vendor_attr_authmode
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_ENCRYPTYPE: u32, encryptype, refer to mtk_vendor_attr_encryptype
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_REKEYINTERVAL: u32, rekey interval in seconds
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_REKEYMETHOD: u8, 0-by time, 1-by pkt count
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_DEFAULTKEYID: u8, default key index
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_WEPKEY: refer to wep_key_param
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PASSPHRASE: string
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF: u8 1-support pmf, 0-not support pmf
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF_REQUIRE: u8 1-pmf is required, 0-pmf is not required
- * @MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF_SHA256: u8 1-pmfsha256 is desired, 0-pmfsha256 is not desired
- */
-enum mtk_nl80211_vendor_attrs_ap_security {
-/* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_INVALID = 0,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_AUTHMODE,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_ENCRYPTYPE,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_REKEYINTERVAL,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_REKEYMETHOD,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_DEFAULTKEYID,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_WEPKEY,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PASSPHRASE,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF_CAPABLE,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF_REQUIRE,
- MTK_NL80211_VENDOR_ATTR_AP_SECURITY_PMF_SHA256,
- /* add attributes here, update the policy in nl80211.c */
-
- __MTK_NL80211_VENDOR_ATTR_AP_SECURITY_AFTER_LAST,
- MTK_NL80211_VENDOR_AP_SECURITY_ATTR_MAX = __MTK_NL80211_VENDOR_ATTR_AP_SECURITY_AFTER_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_get_static_info - Specifies the vendor attribute values
- * to get static info
- */
-enum mtk_nl80211_vendor_attr_get_static_info {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_CHIP_ID,
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_DRIVER_VER,
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_COEXISTENCE,
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_WIFI_VER,
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_WAPP_SUPPORT_VER,
-
- __MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_LAST,
- MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_MAX =
- __MTK_NL80211_VENDOR_ATTR_GET_STATIC_INFO_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_get_runtime_info - Specifies the vendor attribute values
- * to get runtime info
- */
-enum mtk_nl80211_vendor_attr_get_runtime_info {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_MAX_NUM_OF_STA,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_CHAN_LIST,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_OP_CLASS,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_BSS_INFO,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_NOP_CHANNEL_LIST,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_WMODE,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_WAPP_WSC_PROFILES,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_PMK_BY_PEER_MAC,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_802_11_AUTHENTICATION_MODE,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_802_11_MAC_ADDRESS,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_GET_802_11_CURRENTCHANNEL,
-
- __MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_LAST,
- MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_MAX =
- __MTK_NL80211_VENDOR_ATTR_GET_RUNTIME_INFO_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_get_statistic - Specifies the vendor attribute values
- * to get statistic info
- */
-enum mtk_nl80211_vendor_attr_get_statistic {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_GET_STATISTIC_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_GET_802_11_STATISTICS,
- MTK_NL80211_VENDOR_ATTR_GET_TX_PWR,
- MTK_NL80211_VENDOR_ATTR_GET_AP_METRICS,
- MTK_NL80211_VENDOR_ATTR_GET_802_11_PER_BSS_STATISTICS,
- MTK_NL80211_VENDOR_ATTR_GET_CPU_TEMPERATURE,
-
- _MTK_NL80211_VENDOR_ATTR_GET_STATISTIC_LAST,
- MTK_NL80211_VENDOR_ATTR_GET_STATISTIC_MAX =
- _MTK_NL80211_VENDOR_ATTR_GET_STATISTIC_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_wapp_req - Specifies the vendor attribute values
- * to request wifi info
- */
-enum mtk_nl80211_vendor_attr_wapp_req {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_WAPP_REQ_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_WAPP_REQ,
-
- __MTK_NL80211_VENDOR_ATTR_WAPP_REQ_LAST,
- MTK_NL80211_VENDOR_ATTR_WAPP_REQ_MAX =
- __MTK_NL80211_VENDOR_ATTR_WAPP_REQ_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_event_rsp_wapp_event - Specifies the vendor attribute values
- * to get wifi info event
- */
-enum mtk_nl80211_vendor_attr_event_rsp_wapp_event {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_EVENT_RSP_WAPP_EVENT_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_EVENT_RSP_WAPP_EVENT,
-
- __MTK_NL80211_VENDOR_ATTR_EVENT_RSP_WAPP_EVENT_LAST,
- MTK_NL80211_VENDOR_ATTR_EVENT_RSP_WAPP_EVENT_MAX =
- __MTK_NL80211_VENDOR_ATTR_EVENT_RSP_WAPP_EVENT_LAST - 1
-};
-
-/**
- * enum mtk_nl80211_vendor_attr_get_cap - Specifies the vendor attribute values
- * to get capability info
- */
-enum mtk_nl80211_vendor_attr_get_cap {
- /* don't change the order or add anything between, this is ABI! */
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_INVALID = 0,
-
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_CAC_CAP,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_MISC_CAP,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_HT_CAP,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_VHT_CAP,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_WF6_CAPABILTY,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_HE_CAP,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_QUERY_11H_CAPABILITY,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_QUERY_RRM_CAPABILITY,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_QUERY_KVR_CAPABILITY,
-
-
- __MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_LAST,
- MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_MAX =
- __MTK_NL80211_VENDOR_ATTR_GET_CAP_INFO_LAST - 1
-};
-
-#endif /* __MTK_VENDOR_NL80211_H */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/mt_wlan_cmm_oid.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/mt_wlan_cmm_oid.h
deleted file mode 100644
index ce31b3b..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/mt_wlan_cmm_oid.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- ***************************************************************************
- * Mediatek Tech Inc.
- * 4F, No. 2 Technology 5th Rd.
- * Science-based Industrial Park
- * Hsin-chu, Taiwan, R.O.C.
- *
- * (c) Copyright 2020-2021, Mediatek Technology, Inc.
- *
- * All rights reserved. Mediatek's source code is an unpublished work and the
- * use of a copyright notice does not imply otherwise. This source code
- * contains confidential trade secret material of Mediatek Tech. Any attemp
- * or participation in deciphering, decoding, reverse engineering or in any
- * way altering the source code is stricitly prohibited, unless the prior
- * written consent of Mediatek Technology, Inc. is obtained.
- ***************************************************************************
-
- Module Name:
- wapp_cmm_type.h
-
- Abstract:
-
- Revision History:
- Who When What
- -------- ---------- ----------------------------------------------
-*/
-/* This file is used by wifi driver and wapp.
- Keep data structure sync */
-
-#define OID_802_11_APCLI_ENABLE 0x09B0
-#define OID_802_11_AUTO_ROAM 0x09B1
-#define OID_802_11_APCLI_BSSID 0x09B2
-#define OID_802_11_APPROXY_REFRESH 0x09B3
-#define OID_802_11_AUTH_MODE 0x09B4
-#define OID_802_11_APCLI_PMFMFPC 0x09B5
-#define OID_802_11_APCLI_SSID 0x09B6
-#define OID_802_11_APCLI_WPAPSK 0x09B7
-#define OID_802_11_APCLI_AUTH_MODE 0x09B8
-#define OID_802_11_APCLI_ENCRY_TYPE 0x09B9
-#define OID_802_11_ACL_ADDENTRY 0x09BA
-#define OID_802_11_ACL_DELENTRY 0x09BB
-#define OID_802_11_ACL_CLEARALL 0x09BC
-#define OID_802_11_ACCESS_POLICY 0x09BD
-#define OID_802_11_APCLI_AUTO_CONNECT 0x09BE
-#define OID_802_11_BCNREQ 0x09BF
-#define OID_802_11_BLADD 0x09C0
-#define OID_802_11_BLDEL 0x09C1
-#define OID_802_11_BHBSS 0x09C2
-#define OID_802_11_SET_CHANNEL 0x09C3
-#define OID_802_11_DPP_ENABLE 0x09C4
-#define OID_802_11_DISCONNECT_STA 0x09C5
-#define OID_802_11_DEFAULT_KEYID 0x09C6
-#define OID_802_11_DISCONNECT_ALL_STA 0x09C7
-#define OID_802_11_ENCRYP_TYPE 0x09C8
-#define OID_802_11_FHBSS 0x09C9
-#define OID_802_11_HTBSSCOEX 0x09CA
-#define OID_802_11_HIDE_SSID 0x09CB
-#define OID_802_11_HTBW 0x09CC
-#define OID_802_11_KEY1 0x09CD
-#define OID_802_11_MAP_CHANNEL 0x09CE
-#define OID_802_11_MNT_ENABLE 0x09CF
-#define OID_802_11_MNT_RULE 0x09D0
-#define OID_802_11_MNT_STA0 0x09D1
-#define OID_802_11_MAP_CHANNEL_ENABLE 0x09D2
-#define OID_802_11_MAP_ENABLE 0x09D3
-#define OID_802_11_PMFMFPC 0x09D4
-#define OID_802_11_RADIOON 0x09D5
-#define OID_802_11_SITESURVEY 0x09D6
-#define OID_802_11_TS_BH_PRIMARY_VID 0x09D7
-#define OID_802_11_TS_BH_PRIMARY_PCP 0x09D8
-#define OID_802_11_TS_BH_VID 0x09D9
-#define OID_802_11_TS_FH_VID 0x09DA
-#define OID_802_11_TRANSPARENT_VID 0x09DB
-#define OID_802_11_VHTBW 0x09DC
-#define OID_802_11_V10_CONVERTER 0x09DD
-#define OID_802_11_WSC_STOP 0x09DE
-#define OID_802_11_WSCCONF_MODE 0x09DF
-#define OID_802_11_WSC_MODE 0x09E0
-#define OID_802_11_WSC_GET_CONF 0x09E1
-#define OID_802_11_WSCCONF_STATUS 0x09E2
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/wapp_cmm_type.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/wapp_cmm_type.h
deleted file mode 100755
index d9216c9..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/include/uapi/linux/wapp/wapp_cmm_type.h
+++ /dev/null
@@ -1,1139 +0,0 @@
-/*
- ***************************************************************************
- * Mediatek Tech Inc.
- * 4F, No. 2 Technology 5th Rd.
- * Science-based Industrial Park
- * Hsin-chu, Taiwan, R.O.C.
- *
- * (c) Copyright 2002-2011, Mediatek Technology, Inc.
- *
- * All rights reserved. Mediatek's source code is an unpublished work and the
- * use of a copyright notice does not imply otherwise. This source code
- * contains confidential trade secret material of Mediatek Tech. Any attemp
- * or participation in deciphering, decoding, reverse engineering or in any
- * way altering the source code is stricitly prohibited, unless the prior
- * written consent of Mediatek Technology, Inc. is obtained.
- ***************************************************************************
-
- Module Name:
- wapp_cmm_type.h
-
- Abstract:
-
- Revision History:
- Who When What
- -------- ---------- ----------------------------------------------
-*/
-/* This file is used by wifi driver and wapp.
- Keep data structure sync */
-
-#ifndef __WAPP_TYPES_H__
-#define __WAPP_TYPES_H__
-
-//#include <linux/if_ether.h>
-#ifdef WAPP_SUPPORT
-#define MAX_BSSLOAD_THRD 100
-#endif /* WAPP_SUPPORT */
-
-#ifndef GNU_PACKED
-#define GNU_PACKED (__attribute__ ((packed)))
-#endif /* GNU_PACKED */
-
-#ifndef MAC_ADDR_LEN
-#define MAC_ADDR_LEN 6
-#endif
-#ifndef LEN_PMK
-#define LEN_PMK 32
-#endif
-#ifndef LEN_PMK_MAX
-#define LEN_PMK_MAX 48
-#endif
-#ifndef LEN_PMKID
-#define LEN_PMKID 16
-#endif
-#ifndef LEN_MAX_PTK
-#define LEN_MAX_PTK 88
-#endif
-#ifndef LEN_PSK
-#define LEN_PSK 64
-#endif
-#ifndef LEN_MAX_URI
-#define LEN_MAX_URI 120
-#endif
-
-#ifndef AC_NUM
-#define AC_NUM 4
-#endif
-#define MAX_HE_MCS_LEN 12
-#define MAX_OP_CLASS 16
-#define MAX_LEN_OF_SSID 32
-#define MAX_NUM_OF_CHANNELS 59 // 14 channels @2.4G + 12@UNII(lower/middle) + 16@HiperLAN2 + 11@UNII(upper) + 0@Japan + 1 as NULL termination
-#define ASSOC_REQ_LEN 154
-#define ASSOC_REQ_LEN_MAX 512
-#define PREQ_IE_LEN 200
-#define BCN_RPT_LEN 200
-#define IWSC_MAX_SUB_MASK_LIST_COUNT 3
-#define WMODE_CAP_N(_x) (((_x) & (WMODE_GN | WMODE_AN)) != 0)
-#define WMODE_CAP_AC(_x) (((_x) & (WMODE_AC)) != 0)
-#define WMODE_CAP_AX(_x) ((_x) & (WMODE_AX_24G | WMODE_AX_5G | WMODE_AX_6G))
-#define WMODE_CAP(_x, _mode) (((_x) & (_mode)) != 0)
-
-#define MAX_SUPPORT_INF_NUM 17 * MAX_NUM_OF_RADIO /* 16MBSS+1APCLI */
-#define MAX_NUM_OF_WAPP_CHANNELS 59
-#define MAX_PROFILE_CNT 4
-#define PER_EVENT_LIST_MAX_NUM 5
-#define DAEMON_NEIGHBOR_REPORT_MAX_NUM 128
-#define VERSION_WAPP_CMM "v3.0.0.1"
-#ifdef MAP_R3_WF6
-#define MAX_TID 4
-#endif
-typedef enum {
- WAPP_STA_INVALID,
- WAPP_STA_DISCONNECTED,
- WAPP_STA_CONNECTED,
-} WAPP_STA_STATE;
-
-typedef enum {
- WAPP_BSS_STOP = 0,
- WAPP_BSS_START,
-} WAPP_BSS_STATE;
-
-typedef enum {
- WAPP_AUTH = 0,
- WAPP_ASSOC,
- WAPP_EAPOL
-} WAPP_CNNCT_STAGE;
-
-typedef enum {
- WAPP_BSSLOAD_NORMAL = 0,
- WAPP_BSSLOAD_HIGH,
- WAPP_BSSLOAD_LOW,
-} WAPP_BSSLOAD_STATE;
-
-typedef enum {
- NOT_FAILURE = 0,
- AP_NOT_READY,
- ACL_CHECK_FAIL,
- BSSID_NOT_FOUND,
- BSSID_MISMATCH,
- BSSID_IF_NOT_READY,
- BND_STRG_CONNECT_CHECK_FAIL,
- DISALLOW_NEW_ASSOCI,
- EZ_CONNECT_DISALLOW,
- EZ_SETUP_FUNC_DISABLED,
- FT_ERROR,
- GO_UPDATE_NOT_COMPLETE,
- MLME_NO_RESOURCE,
- MLME_ASSOC_REJ_TEMP,
- MLME_UNABLE_HANDLE_STA,
- MLME_EZ_CNNCT_LOOP,
- MLME_REQ_WITH_INVALID_PARAM,
- MLME_REJECT_TIMEOUT,
- MLME_UNSPECIFY_FAILURE,
- NOT_FOUND_IN_RADIUS_ACL,
- PEER_REQ_SANITY_FAIL,
-} WAPP_CNNCT_FAIL_REASON_LIST;
-
-typedef enum {
- WAPP_APCLI_DISASSOCIATED = 0,
- WAPP_APCLI_ASSOCIATED,
-} WAPP_APCLI_ASSOC_STATE;
-
-typedef enum {
- WAPP_DEV_QUERY_RSP = 1,
- WAPP_HT_CAP_QUERY_RSP,
- WAPP_VHT_CAP_QUERY_RSP,
- WAPP_HE_CAP_QUERY_RSP,
- WAPP_MISC_CAP_QUERY_RSP,
- WAPP_CLI_QUERY_RSP,
- WAPP_CLI_LIST_QUERY_RSP,
- WAPP_CLI_JOIN_EVENT,
- WAPP_CLI_LEAVE_EVENT,
- WAPP_CLI_PROBE_EVENT,
- WAPP_CHN_LIST_RSP,
- WAPP_OP_CLASS_RSP,
- WAPP_BSS_INFO_RSP,
- WAPP_AP_METRIC_RSP,
- WAPP_CH_UTIL_QUERY_RSP,
- WAPP_AP_CONFIG_RSP,
- WAPP_APCLI_QUERY_RSP,
- MAP_BH_STA_WPS_DONE,
- MAP_TRIGGER_RSSI_STEER,
- WAPP_RCEV_BCN_REPORT,
- WAPP_RCEV_BCN_REPORT_COMPLETE,
- WAPP_RCEV_MONITOR_INFO,
- WAPP_BSSLOAD_RSP,
- WAPP_BSSLOAD_CROSSING,
- WAPP_BSS_STATE_CHANGE,
- WAPP_CH_CHANGE,
- WAPP_TX_POWER_CHANGE,
- WAPP_APCLI_ASSOC_STATE_CHANGE,
- WAPP_STA_RSSI_RSP,
- WAPP_CLI_ACTIVE_CHANGE,
- WAPP_CSA_EVENT,
- WAPP_STA_CNNCT_REJ,
- WAPP_APCLI_RSSI_RSP,
- WAPP_SCAN_RESULT_RSP,
- WAPP_MAP_VENDOR_IE,
- WAPP_WSC_SCAN_COMP_NOTIF,
- WAPP_MAP_WSC_CONFIG,
- WAPP_WSC_EAPOL_START_NOTIF,
- WAPP_WSC_EAPOL_COMPLETE_NOTIF,
- WAPP_SCAN_COMPLETE_NOTIF,
- WAPP_A4_ENTRY_MISSING_NOTIF,
- WAPP_RADAR_DETECT_NOTIF,
- WAPP_APCLI_ASSOC_STATE_CHANGE_VENDOR10,
- WAPP_CAC_STOP, //MAP R2
- WAPP_STA_DISASSOC_EVENT,
- WAPP_RADIO_METRIC_RSP,
- WAPP_DPP_ACTION_FRAME_RECEIVED,
- WAPP_DPP_ACTION_FRAME_STATUS,
- WAPP_DPP_CCE_RSP,
- WAPP_CAC_PERIOD_EVENT,
- WAPP_UNSAFE_CHANNEL_EVENT,
- WAPP_BAND_STATUS_CHANGE_EVENT,
- WAPP_STA_INFO,
- WAPP_R3_RECONFIG_TRIGGER,
- WAPP_R3_DPP_URI_INFO,
- WAPP_NO_STA_CONNECT_TIMEOUT_EVENT,
- WAPP_NO_DATA_TRAFFIC_TIMEOUT_EVENT,
- WAPP_WIFI_UP_EVENT,
- WAPP_WIFI_DOWN_EVENT,
- WAPP_QOS_ACTION_FRAME_EVENT = 70,
- WAPP_MSCS_CLASSIFIER_PARAM_EVENT,
- WAPP_VEND_SPEC_UP_TUPLE_EVENT,
- WAPP_CH_CHANGE_R3,
- WAPP_SELF_SRG_BITMAP_EVENT,
- WAPP_UPLINK_TRAFFIC_EVENT,
- WAPP_CONFIG_WPS_EVENT,
-} WAPP_EVENT_ID;
-
-typedef enum {
- WAPP_DEV_QUERY_REQ = 1,
- WAPP_HT_CAP_QUERY_REQ,
- WAPP_VHT_CAP_QUERY_REQ,
- WAPP_HE_CAP_QUERY_REQ,
- WAPP_MISC_CAP_QUERY_REQ,
- WAPP_CLI_QUERY_REQ,
- WAPP_CLI_LIST_QUERY_REQ,
- WAPP_CHN_LIST_QUERY_REQ,
- WAPP_OP_CLASS_QUERY_REQ,
- WAPP_BSS_INFO_QUERY_REQ,
- WAPP_AP_METRIC_QUERY_REQ,
- WAPP_CH_UTIL_QUERY_REQ,
- WAPP_APCLI_QUERY_REQ,
- WAPP_BSS_START_REQ,
- WAPP_BSS_STOP_REQ,
- WAPP_TXPWR_PRCTG_REQ,
- WAPP_STEERING_POLICY_SET_REQ,
- WAPP_BSS_LOAD_THRD_SET_REQ,
- WAPP_AP_CONFIG_SET_REQ,
- WAPP_BSSLOAD_QUERY_REQ,
- WAPP_HECAP_QUERY_REQ,
- WAPP_STA_RSSI_QUERY_REQ,
- WAPP_APCLI_RSSI_QUERY_REQ,
- WAPP_GET_SCAN_RESULTS,
- WAPP_SEND_NULL_FRAMES,
- WAPP_WSC_PBC_EXEC,
- WAPP_WSC_SET_BH_PROFILE,
- WAPP_SET_SCAN_BH_SSIDS,
- WAPP_SET_AVOID_SCAN_CAC,
-#ifdef MAP_R2
- WAPP_RADIO_METRICS_REQ,
-#endif
-#ifdef DPP_R2_SUPPORT
- WAPP_GET_CCE_RESULT,
-#endif
- WAPP_SET_SRG_BITMAP,
- WAPP_SET_TOPOLOGY_UPDATE,
- WAPP_SET_SRG_UPLINK_STATUS,
-} WAPP_REQ_ID;
-
-typedef enum {
- PARAM_DGAF_DISABLED,
- PARAM_PROXY_ARP,
- PARAM_L2_FILTER,
- PARAM_ICMPV4_DENY,
- PARAM_MMPDU_SIZE,
- PARAM_EXTERNAL_ANQP_SERVER_TEST,
- PARAM_GAS_COME_BACK_DELAY,
- PARAM_WNM_NOTIFICATION,
- PARAM_QOSMAP,
- PARAM_WNM_BSS_TRANSITION_MANAGEMENT,
-} WAPP_PARAM;
-
-typedef struct GNU_PACKED _WAPP_CONNECT_FAILURE_REASON {
- u8 connect_stage;
- u16 reason;
-} WAPP_CONNECT_FAILURE_REASON;
-
-typedef struct GNU_PACKED _wapp_dev_info {
- u32 ifindex;
- u8 ifname[IFNAMSIZ];
- u8 mac_addr[MAC_ADDR_LEN];
- u8 dev_type;
- u8 radio_id;
- u16 wireless_mode;
- uintptr_t adpt_id;
- u8 dev_active;
-} wapp_dev_info;
-
-typedef struct GNU_PACKED _wdev_ht_cap {
- u8 tx_stream;
- u8 rx_stream;
- u8 sgi_20;
- u8 sgi_40;
- u8 ht_40;
-} wdev_ht_cap;
-
-typedef struct GNU_PACKED _wdev_vht_cap {
- u8 sup_tx_mcs[2];
- u8 sup_rx_mcs[2];
- u8 tx_stream;
- u8 rx_stream;
- u8 sgi_80;
- u8 sgi_160;
- u8 vht_160;
- u8 vht_8080;
- u8 su_bf;
- u8 mu_bf;
-} wdev_vht_cap;
-
-typedef struct GNU_PACKED _wdev_he_cap {
- unsigned char he_mcs_len;
- unsigned char he_mcs[MAX_HE_MCS_LEN];
- unsigned char tx_stream;
- unsigned char rx_stream;
- unsigned char he_8080;
- unsigned char he_160;
- unsigned char su_bf_cap;
- unsigned char mu_bf_cap;
- unsigned char ul_mu_mimo_cap;
- unsigned char ul_mu_mimo_ofdma_cap;
- unsigned char dl_mu_mimo_ofdma_cap;
- unsigned char ul_ofdma_cap;
- unsigned char dl_ofdma_cap;
- unsigned char gi; /* 0:auto;1:800;2:1600;3:3200 */
-} wdev_he_cap;
-
-
-#ifdef MAP_R2
-typedef struct GNU_PACKED _wdev_extended_ap_metrics {
- u32 uc_tx;
- u32 uc_rx;
- u32 mc_tx;
- u32 mc_rx;
- u32 bc_tx;
- u32 bc_rx;
-} wdev_extended_ap_metric;
-
-
-typedef struct GNU_PACKED _wdev_sta_extended_info {
-#if 0
- u8 bssid[MAC_ADDR_LEN];
-#endif
- u32 last_data_ul_rate;
- u32 last_data_dl_rate;
- u32 utilization_rx;
- u32 utilization_tx;
-} wdev_sta_ext_info;
-
-typedef struct GNU_PACKED _wdev_extended_sta_metrics {
-#if 0
- u8 sta_mac[MAC_ADDR_LEN];
- u8 extended_info_cnt;
-#endif
- wdev_sta_ext_info sta_info;
-} wdev_extended_sta_metrics;
-
-#endif
-typedef struct GNU_PACKED _wapp_cac_info {
- u8 channel;
- u8 ret;
- u8 cac_timer;
-} wapp_cac_info;
-#ifdef MAP_R2
-typedef enum cac_mode
-{
- CONTINUOUS_CAC,
- DEDICATED_CAC,
- REDUCED_MIMO_CAC,
-} CAC_MODE;
-#endif
-
-
-typedef struct GNU_PACKED _wdev_misc_cap {
- u8 max_num_of_cli;
- u8 max_num_of_bss;
- u8 num_of_bss;
- u8 max_num_of_block_cli;
-} wdev_misc_cap;
-
-struct GNU_PACKED he_nss{
- u16 nss_80:2;
- u16 nss_160:2;
- u16 nss_8080:2;
-};
-
-struct GNU_PACKED map_cli_cap {
- u16 bw:2;
- u16 phy_mode:3;
- u16 nss:2;
- u16 btm_capable:1;
- u16 rrm_capable:1;
- u16 mbo_capable:1;
- struct he_nss nss_he;
-};
-
-#ifdef MAP_R3_WF6
-struct GNU_PACKED assoc_wifi6_sta_info {
- unsigned char tid;
- unsigned char tid_q_size;
-};
-
-typedef struct GNU_PACKED _wdev_wf6_cap {
- unsigned char he_mcs_len;
- unsigned char he_mcs[MAX_HE_MCS_LEN];
- unsigned char tx_stream;
- unsigned char rx_stream;
- unsigned char he_8080;
- unsigned char he_160;
- unsigned char su_bf_cap;
- unsigned char mu_bf_cap;
- unsigned char ul_mu_mimo_cap;
- unsigned char ul_mu_mimo_ofdma_cap;
- unsigned char dl_mu_mimo_ofdma_cap;
- unsigned char ul_ofdma_cap;
- unsigned char dl_ofdma_cap;
- unsigned char agent_role;
- unsigned char su_beamformee_status;
- unsigned char beamformee_sts_less80;
- unsigned char beamformee_sts_more80;
- unsigned char max_user_dl_tx_mu_mimo;
- unsigned char max_user_ul_rx_mu_mimo;
- unsigned char max_user_dl_tx_ofdma;
- unsigned char max_user_ul_rx_ofdma;
- unsigned char rts_status;
- unsigned char mu_rts_status;
- unsigned char m_bssid_status;
- unsigned char mu_edca_status;
- unsigned char twt_requester_status;
- unsigned char twt_responder_status;
-} wdev_wf6_cap;
-
-typedef struct GNU_PACKED _wdev_wf6_cap_roles {
- unsigned char role_supp;
- wdev_wf6_cap wf6_role[2];
-} wdev_wf6_cap_roles;
-#endif
-
-typedef struct GNU_PACKED _wapp_client_info {
- u8 mac_addr[MAC_ADDR_LEN];
- u8 bssid[MAC_ADDR_LEN];
- u8 sta_status; /* WAPP_STA_STATE */
- u16 assoc_time;
- u16 downlink;
- u16 uplink;
- signed char uplink_rssi;
- /*traffic stats*/
- u32 bytes_sent;
- u32 bytes_received;
- u32 packets_sent;
- u32 packets_received;
- u32 tx_packets_errors;
- u32 rx_packets_errors;
- u32 retransmission_count;
- u16 link_availability;
- u16 assoc_req_len;
- u8 bLocalSteerDisallow;
- u8 bBTMSteerDisallow;
- u8 status;
- /* ht_cap */
- /* vht_cap */
-
- /* Throughput for Tx/Rx */
- u32 tx_tp;
- u32 rx_tp;
- struct map_cli_cap cli_caps;
-#ifdef MAP_R2
- wdev_extended_sta_metrics ext_metric_info;
-#endif
- u16 disassoc_reason;
-#ifdef MAP_R2
- u8 IsReassoc;
-#endif
- u8 is_APCLI;
-#ifdef MAP_R3_WF6
- u8 tid_cnt;
- struct assoc_wifi6_sta_info status_tlv[MAX_TID];
-#endif
-} wapp_client_info;
-
-struct GNU_PACKED chnList {
- u8 channel;
- u8 pref;
- u16 cac_timer;
-};
-
-typedef struct GNU_PACKED _wdev_chn_info {
- u8 op_ch;
- u8 op_class;
- u16 band; /* 24g; 5g1; 5g2 */
- u8 ch_list_num;
- u8 non_op_chn_num;
- u16 dl_mcs;
- struct chnList ch_list[32];
- u8 non_op_ch_list[32];
- u8 AutoChannelSkipListNum;
- u8 AutoChannelSkipList[MAX_NUM_OF_CHANNELS + 1];
-} wdev_chn_info;
-
-struct GNU_PACKED opClassInfo {
- u8 op_class;
- u8 num_of_ch;
- u8 ch_list[13];
-};
-
-typedef struct GNU_PACKED _wdev_op_class_info {
- u8 num_of_op_class;
- struct opClassInfo opClassInfo[MAX_OP_CLASS];
-} wdev_op_class_info;
-
-struct GNU_PACKED opClassInfoExt {
- u8 op_class;
- u8 num_of_ch;
- u8 ch_list[MAX_NUM_OF_CHANNELS];
-};
-
-struct GNU_PACKED _wdev_op_class_info_ext {
- u8 num_of_op_class;
- struct opClassInfoExt opClassInfoExt[MAX_OP_CLASS];
-};
-
-typedef struct GNU_PACKED _wdev_bss_info {
- u8 if_addr[MAC_ADDR_LEN];
- u8 bssid[MAC_ADDR_LEN];
- char ssid[MAX_LEN_OF_SSID + 1];
- u8 SsidLen;
- u8 map_role;
- u32 auth_mode;
- u32 enc_type;
- u8 key_len;
- u8 key[64 + 1];
- u8 hidden_ssid;
-} wdev_bss_info;
-
-typedef struct GNU_PACKED _wsc_apcli_config {
- char ssid[MAX_LEN_OF_SSID + 1];
- u8 SsidLen;
- u16 AuthType;
- u16 EncrType;
- u8 Key[64];
- u16 KeyLength;
- u8 KeyIndex;
- u8 bssid[MAC_ADDR_LEN];
- u8 peer_map_role;
- u8 own_map_role;
-} wsc_apcli_config;
-
-typedef struct GNU_PACKED _wsc_apcli_config_msg {
- u32 profile_count;
- wsc_apcli_config apcli_config[0];
-} wsc_apcli_config_msg, *p_wsc_apcli_config_msg;
-
-typedef struct GNU_PACKED _wdev_ap_metric {
- u8 bssid[MAC_ADDR_LEN];
- u8 cu;
- u8 ESPI_AC[AC_NUM][3];
-#ifdef MAP_R2
- wdev_extended_ap_metric ext_ap_metric;
-#endif
-} wdev_ap_metric;
-
-#ifdef MAP_R2
-typedef struct GNU_PACKED _wdev_radio_metric {
- u8 cu_noise;
- u8 cu_tx;
- u8 cu_rx;
- u8 cu_other;
- u32 edcca;
-} wdev_radio_metric;
-#endif
-typedef struct GNU_PACKED _wdev_ap_config {
- u8 sta_report_on_cop;
- u8 sta_report_not_cop;
- u8 rssi_steer;
-} wdev_ap_config;
-
-struct GNU_PACKED pwr_limit {
- u8 op_class;
- u8 max_pwr;
-};
-
-typedef struct GNU_PACKED _wdev_tx_power {
- u8 num_of_op_class;
- struct pwr_limit tx_pwr_limit[MAX_OP_CLASS];
- u16 tx_pwr;
-} wdev_tx_power;
-
-/*Driver detects sta needed to steer*/
-typedef struct GNU_PACKED _wdev_steer_sta {
- u8 mac_addr[MAC_ADDR_LEN];
-} wdev_steer_sta;
-
-typedef struct GNU_PACKED _wapp_probe_info {
- u8 mac_addr[MAC_ADDR_LEN];
- u8 channel;
- signed char rssi;
- u8 preq_len;
- u8 preq[PREQ_IE_LEN];
-} wapp_probe_info;
-
-typedef struct GNU_PACKED _wapp_bcn_rpt_info {
- u8 sta_addr[MAC_ADDR_LEN];
- u8 last_fragment;
- u16 bcn_rpt_len;
- u8 bcn_rpt[BCN_RPT_LEN];
-} wapp_bcn_rpt_info;
-
-typedef struct GNU_PACKED wapp_bhsta_info {
- u8 mac_addr[MAC_ADDR_LEN];
- u8 connected_bssid[MAC_ADDR_LEN];
- u8 peer_map_enable;
-} wapp_bhsta_info;
-
-typedef struct GNU_PACKED _wdev_steer_policy {
- u8 steer_policy;
- u8 cu_thr;
- u8 rcpi_thr;
-} wdev_steer_policy;
-
-typedef struct GNU_PACKED _bssload_threshold {
- u8 high_bssload_thrd;
- u8 low_bssload_thrd;
-} bssload_threshold;
-
-typedef struct GNU_PACKED _wapp_bssload_info {
- u16 sta_cnt;
- u8 ch_util;
- u16 AvalAdmCap;
-} wapp_bssload_info;
-
-/* By air monitor*/
-typedef struct GNU_PACKED _wapp_mnt_info {
- u8 sta_addr[MAC_ADDR_LEN];
- signed char rssi;
-} wapp_mnt_info;
-
-typedef struct GNU_PACKED _wapp_csa_info {
- u8 new_channel;
-} wapp_csa_info;
-
-#ifdef WPS_UNCONFIG_FEATURE_SUPPORT
-struct GNU_PACKED wapp_wps_config_info {
- u8 SSID[33]; /* mandatory */
- u8 channel;
- u16 AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */
- u16 EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */
- u8 Key[64]; /* mandatory, Maximum 64 byte */
- u16 KeyLength;
- u8 MacAddr[MAC_ADDR_LEN]; /* mandatory, AP MAC address */
- u8 bss_role; /*0-Fronthaul, 1-Backhaul*/
- u8 index;
-};
-#endif
-typedef struct GNU_PACKED _wapp_bss_state_info {
- u32 interface_index;
- WAPP_BSS_STATE bss_state;
-} wapp_bss_state_info;
-
-typedef struct GNU_PACKED _wapp_ch_change_info {
- u32 interface_index;
- u8 new_ch;/*New channel IEEE number*/
- u8 op_class;
-} wapp_ch_change_info;
-
-typedef struct GNU_PACKED _wapp_txpower_change_info {
- u32 interface_index;
- u16 new_tx_pwr;/*New TX power*/
-} wapp_txpower_change_info;
-
-typedef struct GNU_PACKED _wapp_apcli_association_info {
- u32 interface_index;
- WAPP_APCLI_ASSOC_STATE apcli_assoc_state;
- signed char rssi;
- signed char PeerMAPEnable;
-} wapp_apcli_association_info;
-
-typedef struct GNU_PACKED _wapp_bssload_crossing_info {
- u32 interface_index;
- u8 bssload_high_thrd;
- u8 bssload_low_thrd;
- u8 bssload;
-} wapp_bssload_crossing_info;
-
-typedef struct GNU_PACKED _wapp_sta_cnnct_rejected_info {
- u32 interface_index;
- u8 sta_mac[MAC_ADDR_LEN];
- u8 bssid[MAC_ADDR_LEN];
- WAPP_CONNECT_FAILURE_REASON cnnct_fail;
-#ifdef MAP_R2
- u16 assoc_status_code;
- u16 assoc_reason_code;
-#endif
-} wapp_sta_cnnct_rej_info;
-
-struct GNU_PACKED map_vendor_ie
-{
- u8 type;
- u8 subtype;
- u8 root_distance;
- u8 connectivity_to_controller;
- u16 uplink_rate;
- u8 uplink_bssid[MAC_ADDR_LEN];
- u8 bssid_5g[MAC_ADDR_LEN];
- u8 bssid_2g[MAC_ADDR_LEN];
-};
-
-typedef struct _qbss_load_param {
- u8 bValid; /* 1: variable contains valid value */
- u16 StaNum;
- u8 ChannelUtilization;
- u16 RemainingAdmissionControl; /* in unit of 32-us */
-} QBSS_LOAD_PARM, *PQBSS_LOAD_PARM;
-
-#ifdef MAP_R2
-typedef struct GNU_PACKED _wapp_qbss_load {
- u8 bValid;/*1: variable contains valid value*/
- u16 StaNum;
- u8 ChannelUtilization;
- u16 RemainingAdmissionControl;/*in unit of 32-us*/
-} WAPP_QBSS_LOAD_PARM;
-
-#endif
-#ifdef MAP_6E_SUPPORT
-struct GNU_PACKED map_rnr {
- u8 channel;
- u8 op;
- u8 cce_ind;
-};
-#endif
-
-#ifdef DPP_R2_SUPPORT
-struct GNU_PACKED cce_vendor_ie
-{
- u8 value;
-};
-
-#define MAX_CCE_CHANNEL 128
-
-struct GNU_PACKED cce_vendor_ie_result {
- u8 num;
- u8 cce_ch[MAX_CCE_CHANNEL];//channel list, on which beacon includes cce ie
-};
-#endif
-
-struct GNU_PACKED scan_bss_info {
- u8 Bssid[MAC_ADDR_LEN];
- u8 Channel;
- u8 CentralChannel;
- signed char Rssi;
- signed char MinSNR;
- u8 Privacy;
-
- u8 SsidLen;
- u8 Ssid[MAX_LEN_OF_SSID];
-
- u16 AuthMode;
- u16 EncrypType;
- wdev_ht_cap ht_cap;
- wdev_vht_cap vht_cap;
- wdev_he_cap he_cap;
- u8 map_vendor_ie_found;
- struct map_vendor_ie map_info;
-#ifdef MAP_R2
- WAPP_QBSS_LOAD_PARM QbssLoad;
-#endif
-#ifdef MAP_6E_SUPPORT
- struct map_rnr rnr_6e;
-#endif
-};
-struct GNU_PACKED wapp_scan_info {
- u32 interface_index;
- u8 more_bss;
- u8 bss_count;
- struct scan_bss_info bss[0];
-};
-
-struct GNU_PACKED wapp_wsc_scan_info {
- u8 bss_count;
- u8 Uuid[16];
-};
-
-struct GNU_PACKED radar_notif_s
-{
- u32 channel;
- u32 status;
- u32 bw;
-};
-
-#ifdef WIFI_MD_COEX_SUPPORT
-struct GNU_PACKED unsafe_channel_notif_s
-{
- u32 ch_bitmap[4];
-};
-
-struct GNU_PACKED band_status_change {
- u8 status; /*0-radio temporarily cannot be used, 1-radio can be used*/
-};
-#endif
-
-typedef struct GNU_PACKED _NDIS_802_11_SSID {
- u32 SsidLength; /* length of SSID field below, in bytes; */
- /* this can be zero. */
- char Ssid[MAX_LEN_OF_SSID]; /* SSID information field */
-} NDIS_802_11_SSID, *PNDIS_802_11_SSID;
-struct GNU_PACKED nop_channel_list_s
-{
- u8 channel_count;
- u8 channel_list[MAX_NUM_OF_WAPP_CHANNELS];
-};
-
-/* WSC configured credential */
-typedef struct _WSC_CREDENTIAL {
- NDIS_802_11_SSID SSID; /* mandatory */
- u16 AuthType; /* mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk */
- u16 EncrType; /* mandatory, 1: none, 2: wep, 4: tkip, 8: aes */
- u8 Key[64]; /* mandatory, Maximum 64 byte */
- u16 KeyLength;
- u8 MacAddr[MAC_ADDR_LEN]; /* mandatory, AP MAC address */
- u8 KeyIndex; /* optional, default is 1 */
- u8 bFromUPnP; /* TRUE: This credential is from external UPnP registrar */
- u8 bss_role; /*0-Fronthaul, 1-Backhaul*/
- u8 DevPeerRole; /* Device role for the peer device sending M8 */
- u16 IpConfigMethod;
- u32 RegIpv4Addr;
- u32 Ipv4SubMask;
- u32 EnrIpv4Addr;
- u32 AvaIpv4SubmaskList[IWSC_MAX_SUB_MASK_LIST_COUNT];
-} WSC_CREDENTIAL, *PWSC_CREDENTIAL;
-
-struct scan_SSID
-{
- char ssid[MAX_LEN_OF_SSID+ 1];
- unsigned char SsidLen;
-};
-
-struct vendor_map_element {
- u8 eid;
- u8 length;
- char oui[3]; /* 0x50 6F 9A */
- char mtk_ie_element[4];
- char type;
- char subtype;
- char root_distance;
- char controller_connectivity;
- short uplink_rate;
- char uplink_bssid[MAC_ADDR_LEN];
- char _5g_bssid[MAC_ADDR_LEN];
- char _2g_bssid[MAC_ADDR_LEN];
-};
-
-struct GNU_PACKED scan_BH_ssids
-{
- unsigned long scan_cookie;
- unsigned char scan_channel_count;
- unsigned char scan_channel_list[32];
- unsigned char profile_cnt;
- struct scan_SSID scan_SSID_val[MAX_PROFILE_CNT];
-};
-
-struct GNU_PACKED action_frm_data {
- u32 ifindex;
- u8 bssid[MAC_ADDR_LEN];
- u8 destination_addr[MAC_ADDR_LEN];
- u8 transmitter_addr[MAC_ADDR_LEN];
- u32 chan;
- u32 wait_time;
- u32 no_cck;
- u32 frm_len;
- u16 seq_no;
- char frm[0];
-};
-
-struct GNU_PACKED roc_req {
- u32 ifindex;
- u32 chan;
- u32 wait_time;
-};
-
-#ifdef DPP_SUPPORT
-struct GNU_PACKED wapp_dpp_action_frame {
- u8 src[MAC_ADDR_LEN];
- u32 wapp_dpp_frame_id_no;
- u32 chan;
- u32 frm_len;
- u32 is_gas;
- u8 frm[0];
-};
-
-struct GNU_PACKED wapp_dpp_frm_tx_status {
- u8 tx_success;
- u16 seq_no;
-};
-
-struct GNU_PACKED pmk_req {
- u32 ifindex;
- u8 pmk[LEN_PMK];
- u8 pmk_len;
- u8 pmkid[LEN_PMKID];
- u8 authenticator_addr[MAC_ADDR_LEN];
- u8 supplicant_addr[MAC_ADDR_LEN];
- int timeout;
- int akmp;
- u8 ssid[MAX_LEN_OF_SSID];
- size_t ssidlen;
-};
-#endif /*DPP_SUPPORT*/
-#ifdef MAP_R3
-struct GNU_PACKED wapp_sta_info {
- u8 src[MAC_ADDR_LEN];
- char ssid[MAX_LEN_OF_SSID + 1];
- unsigned char SsidLen;
- u8 passphrase[LEN_PSK];
- u8 pmk_len;
- u8 pmk[LEN_PMK_MAX];
- u8 ptk_len;
- u8 ptk[LEN_MAX_PTK];
-};
-
-struct GNU_PACKED wapp_uri_info {
- u8 src_mac[MAC_ADDR_LEN];
- u8 uri_len;
- u8 rcvd_uri[LEN_MAX_URI];
-};
-#endif /* MAP_R3 */
-
-struct GNU_PACKED wapp_srg_bitmap {
- u32 color_31_0;
- u32 color_63_32;
- u32 bssid_31_0;
- u32 bssid_63_32;
-};
-
-struct GNU_PACKED wapp_mesh_sr_info {
- u8 sr_mode;
- u8 ul_traffic_status;
- struct wapp_srg_bitmap bm_info;
-};
-
-struct GNU_PACKED wapp_mesh_sr_topology {
- u8 map_dev_count;
- u8 map_dev_sr_support_mode;
- u8 self_role;
- u8 map_remote_al_mac[MAC_ADDR_LEN];
- u8 map_remote_fh_bssid[MAC_ADDR_LEN];
- u8 map_remote_bh_mac[MAC_ADDR_LEN];
- unsigned char ssid_len;
- unsigned char ssid[MAX_LEN_OF_SSID + 1];
-};
-
-typedef union GNU_PACKED _wapp_event_data {
- wapp_dev_info dev_info;
- wdev_ht_cap ht_cap;
- wdev_vht_cap vht_cap;
- wdev_misc_cap misc_cap;
- wapp_client_info cli_info;
- wdev_chn_info chn_list;
- wdev_op_class_info op_class;
- wdev_bss_info bss_info;
- wdev_ap_metric ap_metrics;
- wdev_ap_config ap_conf;
- wdev_tx_power tx_pwr;
- wdev_steer_sta str_sta;
- wapp_probe_info probe_info;
- wapp_bcn_rpt_info bcn_rpt_info;
- wapp_bssload_info bssload_info;
- wapp_bssload_crossing_info bssload_crossing_info;
- wapp_mnt_info mnt_info;
- wapp_bss_state_info bss_state_info;
- wapp_ch_change_info ch_change_info;
- wapp_txpower_change_info txpwr_change_info;
- wapp_apcli_association_info apcli_association_info;
- wapp_bhsta_info bhsta_info;
- wapp_csa_info csa_info;
- wapp_sta_cnnct_rej_info sta_cnnct_rej_info;
- u8 ch_util;
- struct wapp_scan_info scan_info;
- struct wapp_wsc_scan_info wsc_scan_info;
- u32 a4_missing_entry_ip;
- struct radar_notif_s radar_notif;
-#ifdef WPS_UNCONFIG_FEATURE_SUPPORT
- struct wapp_wps_config_info wps_conf_info;
-#endif
- wapp_cac_info cac_info;
-#ifdef MAP_R2
- wdev_extended_ap_metric ext_ap_metrics;
- wdev_radio_metric radio_metrics;
-#endif
-#ifdef DPP_SUPPORT
- u32 wapp_dpp_frame_id_no;
- struct wapp_dpp_action_frame frame;
- struct wapp_dpp_frm_tx_status tx_status;
-#ifdef DPP_R2_SUPPORT
- struct cce_vendor_ie_result cce_ie_result;
-#endif
-#endif /*DPP_SUPPORT*/
- unsigned char cac_enable;
-#ifdef WIFI_MD_COEX_SUPPORT
- struct unsafe_channel_notif_s unsafe_ch_notif;
- struct band_status_change band_status;
-#endif
-#ifdef MAP_R3
- struct wapp_sta_info sta_info;
- struct wapp_uri_info uri_info;
-#endif /* MAP_R3 */
-#ifdef QOS_R1
- u8 *qos_frm;
-#endif
- u8 ifname[IFNAMSIZ];
-#ifdef MAP_R3
- struct wapp_mesh_sr_info mesh_sr_info;
-#endif /* MAP_R3 */
-} wapp_event_data;
-struct GNU_PACKED _wapp_event2_data {
- wapp_client_info cli_info;
-};
-typedef struct GNU_PACKED _wapp_req_data {
- u32 ifindex;
- u8 mac_addr[MAC_ADDR_LEN];
- u32 value;
- bssload_threshold bssload_thrd;
- wdev_steer_policy str_policy;
- wdev_ap_config ap_conf;
- WSC_CREDENTIAL bh_wsc_profile;
- struct scan_BH_ssids scan_bh_ssids;
-#ifdef MAP_R3
- struct wapp_srg_bitmap bm_info;
- u8 band_index;
- struct wapp_mesh_sr_topology topology_update;
-#endif /* MAP_R3 */
-} wapp_req_data;
-
-struct GNU_PACKED wapp_req {
- u8 req_id;
- u8 data_len;
- wapp_req_data data;
-};
-
-struct GNU_PACKED wapp_event {
- u8 len;
- u8 event_id;
- u32 ifindex;
- wapp_event_data data;
-};
-struct GNU_PACKED wapp_event2 {
- u8 len;
- u8 event_id;
- u32 ifindex;
- struct _wapp_event2_data data;
-};
-typedef struct GNU_PACKED _tbtt_info_set {
- u8 NrAPTbttOffset;
- u32 ShortBssid;
-} tbtt_info_set;
-
-typedef struct GNU_PACKED _wapp_nr_info
-{
- u8 Bssid[MAC_ADDR_LEN];
- u32 BssidInfo;
- u8 RegulatoryClass;
- u8 ChNum;
- u8 PhyType;
- u8 CandidatePrefSubID;
- u8 CandidatePrefSubLen;
- u8 CandidatePref;
- /* extra sec info */
- u32 akm;
- u32 cipher;
- u8 TbttInfoSetNum;
- tbtt_info_set TbttInfoSet;
- u8 Rssi;
-} wapp_nr_info;
-
-/* for NR IE , append Bssid ~ CandidatePref */
-#define NEIGHBOR_REPORT_IE_SIZE sizeof(wapp_nr_info) - 15
-
-
-typedef struct daemon_nr_list {
- u8 CurrListNum;
- wapp_nr_info NRInfo[DAEMON_NEIGHBOR_REPORT_MAX_NUM];
-} DAEMON_NR_LIST, *P_DAEMON_NR_LIST;
-
-typedef struct GNU_PACKED daemon_neighbor_report_list {
- u8 Newlist;
- u8 TotalNum;
- u8 CurrNum;
- u8 reserved;
- wapp_nr_info EvtNRInfo[PER_EVENT_LIST_MAX_NUM];
-} DAEMON_EVENT_NR_LIST, *P_DAEMON_EVENT_NR_LIST;
-
-
-typedef struct GNU_PACKED neighbor_report_msg {
- DAEMON_EVENT_NR_LIST evt_nr_list;
-} DAEMON_NR_MSG, *P_DAEMON_NR_MSG;
-
-
-/* for coverting wireless mode to string */
-enum WIFI_MODE {
- WMODE_INVALID = 0,
- WMODE_A = 1 << 0,
- WMODE_B = 1 << 1,
- WMODE_G = 1 << 2,
- WMODE_GN = 1 << 3,
- WMODE_AN = 1 << 4,
- WMODE_AC = 1 << 5,
- WMODE_AX_24G = 1 << 6,
- WMODE_AX_5G = 1 << 7,
- WMODE_AX_6G = 1 << 8,
- WMODE_COMP = 9, /* total types of supported wireless mode, add this value once yow add new type */
-};
-typedef union GNU_PACKED _RRM_BSSID_INFO
-{
- struct GNU_PACKED
- {
-#ifdef RT_BIG_ENDIAN
- u32 Reserved:18;
- u32 FTM:1;
- u32 VHT:1;
- u32 HT:1;
- u32 MobilityDomain:1;
- u32 ImmediateBA:1;
- u32 DelayBlockAck:1;
- u32 RRM:1;
- u32 APSD:1;
- u32 Qos:1;
- u32 SpectrumMng:1;
- u32 KeyScope:1;
- u32 Security:1;
- u32 APReachAble:2;
-#else
- u32 APReachAble:2;
- u32 Security:1;
- u32 KeyScope:1;
- u32 SpectrumMng:1;
- u32 Qos:1;
- u32 APSD:1;
- u32 RRM:1;
- u32 DelayBlockAck:1;
- u32 ImmediateBA:1;
- u32 MobilityDomain:1;
- u32 HT:1;
- u32 VHT:1;
- u32 FTM:1;
- u32 Reserved:18;
-#endif
- } field;
- u32 word;
-} RRM_BSSID_INFO, *PRRM_BSSID_INFO;
-#endif /* __WAPP_TYPES_H__ */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/401-pinctrl-add-mt7986-driver-32bit.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/401-pinctrl-add-mt7986-driver-32bit.patch
new file mode 100644
index 0000000..5022e49
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/401-pinctrl-add-mt7986-driver-32bit.patch
@@ -0,0 +1,28 @@
+diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
+index 701f9af..9109f91 100644
+--- a/drivers/pinctrl/mediatek/Kconfig
++++ b/drivers/pinctrl/mediatek/Kconfig
+@@ -100,6 +100,11 @@ config PINCTRL_MT7622
+ default ARM64 && ARCH_MEDIATEK
+ select PINCTRL_MTK_MOORE
+
++config PINCTRL_MT7986
++ bool "Mediatek MT7986 pin control"
++ depends on OF
++ select PINCTRL_MTK_MOORE
++
+ config PINCTRL_MT8173
+ bool "Mediatek MT8173 pin control"
+ depends on OF
+diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
+index a74325a..d408585 100644
+--- a/drivers/pinctrl/mediatek/Makefile
++++ b/drivers/pinctrl/mediatek/Makefile
+@@ -15,6 +15,7 @@ obj-$(CONFIG_PINCTRL_MT6797) += pinctrl-mt6797.o
+ obj-$(CONFIG_PINCTRL_MT7622) += pinctrl-mt7622.o
+ obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
+ obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
++obj-$(CONFIG_PINCTRL_MT7986) += pinctrl-mt7986.o
+ obj-$(CONFIG_PINCTRL_MT8173) += pinctrl-mt8173.o
+ obj-$(CONFIG_PINCTRL_MT8183) += pinctrl-mt8183.o
+ obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-add_armv7_support_for_panther.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/999-add_armv7_support_for_panther.patch
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-add_armv7_support_for_panther.patch
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/999-add_armv7_support_for_panther.patch
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986-32bit.cfg b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/mt7986-32bit.cfg
similarity index 100%
rename from recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986-32bit.cfg
rename to recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-32bit-5.4/mt7986-32bit.cfg
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0101-add-mtk-wifi-utility-rbus.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0101-add-mtk-wifi-utility-rbus.patch
deleted file mode 100644
index 211324b..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0101-add-mtk-wifi-utility-rbus.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -urN a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
---- a/drivers/net/wireless/Makefile 2020-05-08 12:16:50.030922777 +0800
-+++ b/drivers/net/wireless/Makefile 2020-05-08 12:16:55.718755223 +0800
-@@ -12,6 +12,7 @@
- obj-$(CONFIG_WLAN_VENDOR_INTERSIL) += intersil/
- obj-$(CONFIG_WLAN_VENDOR_MARVELL) += marvell/
- obj-$(CONFIG_WLAN_VENDOR_MEDIATEK) += mediatek/
-+obj-y += wifi_utility/
- obj-$(CONFIG_WLAN_VENDOR_RALINK) += ralink/
- obj-$(CONFIG_WLAN_VENDOR_REALTEK) += realtek/
- obj-$(CONFIG_WLAN_VENDOR_RSI) += rsi/
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch
new file mode 100644
index 0000000..5c18ea0
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0303-mtd-spinand-disable-on-die-ECC.patch
@@ -0,0 +1,31 @@
+From b341f120cfc9ca1dfd48364b7f36ac2c1fbdea43 Mon Sep 17 00:00:00 2001
+From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
+Date: Wed, 3 Apr 2019 16:30:01 +0800
+Subject: [PATCH 3/6] mtd: spinand: disable on-die ECC
+
+Change-Id: I9745adaed5295202fabbe8ab8947885c57a5b847
+Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
+---
+ drivers/mtd/nand/spi/core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/spi/core.c
++++ b/drivers/mtd/nand/spi/core.c
+@@ -491,7 +491,7 @@ static int spinand_mtd_read(struct mtd_i
+ int ret = 0;
+
+ if (ops->mode != MTD_OPS_RAW && spinand->eccinfo.ooblayout)
+- enable_ecc = true;
++ enable_ecc = false;
+
+ mutex_lock(&spinand->lock);
+
+@@ -539,7 +539,7 @@ static int spinand_mtd_write(struct mtd_
+ int ret = 0;
+
+ if (ops->mode != MTD_OPS_RAW && mtd->ooblayout)
+- enable_ecc = true;
++ enable_ecc = false;
+
+ mutex_lock(&spinand->lock);
+
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch
index a49b921..13a9a51 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0600-net-phylink-propagate-resolved-link-config-via-mac_l.patch
@@ -109,6 +109,22 @@
{
struct mvpp2_port *port = mvpp2_phylink_to_port(config);
u32 val;
+--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -449,9 +449,10 @@ static void mtk_mac_link_down(struct phy
+ mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
+ }
+
+-static void mtk_mac_link_up(struct phylink_config *config, unsigned int mode,
+- phy_interface_t interface,
+- struct phy_device *phy)
++static void mtk_mac_link_up(struct phylink_config *config,
++ struct phy_device *phy,
++ unsigned int mode, phy_interface_t interface,
++ int speed, int duplex, bool tx_pause, bool rx_pause)
+ {
+ struct mtk_mac *mac = container_of(config, struct mtk_mac,
+ phylink_config);
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -925,8 +925,10 @@ static void stmmac_mac_link_down(struct
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0671-add-micron-MT29F4G01ABAFD-spi-nand-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0671-add-micron-MT29F4G01ABAFD-spi-nand-support.patch
deleted file mode 100644
index 40833c0..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0671-add-micron-MT29F4G01ABAFD-spi-nand-support.patch
+++ /dev/null
@@ -1,111 +0,0 @@
---- a/drivers/mtd/nand/spi/micron.c
-+++ b/drivers/mtd/nand/spi/micron.c
-@@ -18,7 +18,9 @@
- #define MICRON_STATUS_ECC_4TO6_BITFLIPS (3 << 4)
- #define MICRON_STATUS_ECC_7TO8_BITFLIPS (5 << 4)
-
--static SPINAND_OP_VARIANTS(read_cache_variants,
-+#define MICRON_CFG_CR BIT(0)
-+
-+static SPINAND_OP_VARIANTS(quadio_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),
- SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
-@@ -26,46 +28,46 @@ static SPINAND_OP_VARIANTS(read_cache_va
- SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
- SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
-
--static SPINAND_OP_VARIANTS(write_cache_variants,
-+static SPINAND_OP_VARIANTS(x4_write_cache_variants,
- SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
- SPINAND_PROG_LOAD(true, 0, NULL, 0));
-
--static SPINAND_OP_VARIANTS(update_cache_variants,
-+static SPINAND_OP_VARIANTS(x4_update_cache_variants,
- SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
- SPINAND_PROG_LOAD(false, 0, NULL, 0));
-
--static int mt29f2g01abagd_ooblayout_ecc(struct mtd_info *mtd, int section,
-- struct mtd_oob_region *region)
-+static int micron_8_ooblayout_ecc(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *region)
- {
- if (section)
- return -ERANGE;
-
-- region->offset = 64;
-- region->length = 64;
-+ region->offset = mtd->oobsize / 2;
-+ region->length = mtd->oobsize / 2;
-
- return 0;
- }
-
--static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section,
-- struct mtd_oob_region *region)
-+static int micron_8_ooblayout_free(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *region)
- {
- if (section)
- return -ERANGE;
-
- /* Reserve 2 bytes for the BBM. */
- region->offset = 2;
-- region->length = 62;
-+ region->length = (mtd->oobsize / 2) - 2;
-
- return 0;
- }
-
--static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = {
-- .ecc = mt29f2g01abagd_ooblayout_ecc,
-- .free = mt29f2g01abagd_ooblayout_free,
-+static const struct mtd_ooblayout_ops micron_8_ooblayout = {
-+ .ecc = micron_8_ooblayout_ecc,
-+ .free = micron_8_ooblayout_free,
- };
-
--static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand,
-- u8 status)
-+static int micron_8_ecc_get_status(struct spinand_device *spinand,
-+ u8 status)
- {
- switch (status & MICRON_STATUS_ECC_MASK) {
- case STATUS_ECC_NO_BITFLIPS:
-@@ -94,12 +96,21 @@ static const struct spinand_info micron_
- SPINAND_INFO("MT29F2G01ABAGD", 0x24,
- NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 2, 1, 1),
- NAND_ECCREQ(8, 512),
-- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-- &write_cache_variants,
-- &update_cache_variants),
-+ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
-+ &x4_write_cache_variants,
-+ &x4_update_cache_variants),
- 0,
-- SPINAND_ECCINFO(&mt29f2g01abagd_ooblayout,
-- mt29f2g01abagd_ecc_get_status)),
-+ SPINAND_ECCINFO(µn_8_ooblayout,
-+ micron_8_ecc_get_status)),
-+ SPINAND_INFO("MT29F4G01ABAFD", 0x34,
-+ NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&quadio_read_cache_variants,
-+ &x4_write_cache_variants,
-+ &x4_update_cache_variants),
-+ SPINAND_HAS_CR_FEAT_BIT,
-+ SPINAND_ECCINFO(µn_8_ooblayout,
-+ micron_8_ecc_get_status)),
- };
-
- static int micron_spinand_detect(struct spinand_device *spinand)
---- a/include/linux/mtd/spinand.h
-+++ b/include/linux/mtd/spinand.h
-@@ -270,6 +270,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/mediatek/patches-5.4/0672-add-F50L1G41LB-and-GD5F1GQ5UExxG-snand-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0672-add-F50L1G41LB-and-GD5F1GQ5UExxG-snand-support.patch
deleted file mode 100644
index 63eee5d..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/0672-add-F50L1G41LB-and-GD5F1GQ5UExxG-snand-support.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Index: linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c
-===================================================================
---- linux-5.4.158.orig/drivers/mtd/nand/spi/gigadevice.c
-+++ linux-5.4.158/drivers/mtd/nand/spi/gigadevice.c
-@@ -36,6 +36,15 @@ static SPINAND_OP_VARIANTS(read_cache_va
- SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
- SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
-
-+/* Q5 devices, QUADIO: Dummy bytes only valid for 1 GBit variants */
-+static SPINAND_OP_VARIANTS(gd5f1gq5_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),
-+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
-+ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
-+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
-+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
-+
- static SPINAND_OP_VARIANTS(write_cache_variants,
- SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
- SPINAND_PROG_LOAD(true, 0, NULL, 0));
-@@ -223,7 +232,54 @@ static int gd5fxgq4ufxxg_ecc_get_status(
- return -EINVAL;
- }
-
-+static int esmt_1_ooblayout_ecc(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *region)
-+{
-+ if (section > 3)
-+ return -ERANGE;
-+
-+ region->offset = (16 * section) + 8;
-+ region->length = 8;
-+
-+ return 0;
-+}
-+
-+static int esmt_1_ooblayout_free(struct mtd_info *mtd, int section,
-+ struct mtd_oob_region *region)
-+{
-+ if (section > 3)
-+ return -ERANGE;
-+
-+ region->offset = (16 * section) + 2;
-+ region->length = 6;
-+
-+ return 0;
-+}
-+
-+static const struct mtd_ooblayout_ops esmt_1_ooblayout = {
-+ .ecc = esmt_1_ooblayout_ecc,
-+ .free = esmt_1_ooblayout_free,
-+};
-+
- static const struct spinand_info gigadevice_spinand_table[] = {
-+ SPINAND_INFO("F50L1G41LB", 0x01,
-+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
-+ NAND_ECCREQ(8, 512),
-+ SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ 0,
-+ SPINAND_ECCINFO(&esmt_1_ooblayout,
-+ NULL)),
-+ SPINAND_INFO("GD5F1GQ5UExxG", 0x51,
-+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
-+ NAND_ECCREQ(4, 512),
-+ SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
-+ &write_cache_variants,
-+ &update_cache_variants),
-+ SPINAND_HAS_QE_BIT,
-+ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
-+ gd5fxgq4xa_ecc_get_status)),
- SPINAND_INFO("GD5F1GQ4xA", 0xF1,
- NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
- NAND_ECCREQ(8, 512),
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1004_remove_eth_transmit_timeout_hw_reset.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1004_remove_eth_transmit_timeout_hw_reset.patch
deleted file mode 100755
index 69a0acb..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1004_remove_eth_transmit_timeout_hw_reset.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: linux-5.4.143/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-===================================================================
---- linux-5.4.143.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-+++ linux-5.4.143/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -2483,9 +2483,7 @@ static void mtk_tx_timeout(struct net_de
- eth->netdev[mac->id]->stats.tx_errors++;
- netif_err(eth, tx_err, dev,
- "transmit timed out\n");
-- schedule_work(ð->pending_work);
- }
--
- static irqreturn_t mtk_handle_irq_rx(int irq, void *priv)
- {
- struct mtk_napi *rx_napi = priv;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1005-mtkhnat-fix-pse-hang-for-multi-stations.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1005-mtkhnat-fix-pse-hang-for-multi-stations.patch
deleted file mode 100644
index aaf1794..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/1005-mtkhnat-fix-pse-hang-for-multi-stations.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
-index c0794e37..2968eb68 100644
---- a/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
-+++ b/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
-@@ -250,6 +250,7 @@ static int hnat_start(int ppe_id)
- writel(0, hnat_priv->ppe_base[ppe_id] + PPE_DFT_CPORT); /* pdma */
- /* writel(0x55555555, hnat_priv->ppe_base[ppe_id] + PPE_DFT_CPORT); */ /* qdma */
- cr_set_field(hnat_priv->ppe_base[ppe_id] + PPE_GLO_CFG, TTL0_DRP, 0);
-+ cr_set_field(hnat_priv->ppe_base[ppe_id] + PPE_GLO_CFG, MCAST_TB_EN, 1);
-
- if (hnat_priv->data->version == MTK_HNAT_V4) {
- writel(0xcb777, hnat_priv->ppe_base[ppe_id] + PPE_DFT_CPORT1);
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/401-pinctrl-add-mt7986-driver.patch
index 5022e49..a02873d 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/401-pinctrl-add-mt7986-driver.patch
@@ -2,13 +2,15 @@
index 701f9af..9109f91 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
-@@ -100,6 +100,11 @@ config PINCTRL_MT7622
+@@ -100,6 +100,13 @@ config PINCTRL_MT7622
default ARM64 && ARCH_MEDIATEK
select PINCTRL_MTK_MOORE
+config PINCTRL_MT7986
+ bool "Mediatek MT7986 pin control"
+ depends on OF
++ depends on ARM64 || COMPILE_TEST
++ default ARM64 && ARCH_MEDIATEK
+ select PINCTRL_MTK_MOORE
+
config PINCTRL_MT8173
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/412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
new file mode 100644
index 0000000..32bce58
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/412-mtd-spinand-gigadevice-Add-support-for-F50L1G41LB-and-GD5F1GQ5UExxG.patch
@@ -0,0 +1,44 @@
+--- 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
+ SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
+
++/* Q5 devices, QUADIO: Dummy bytes only valid for 1 GBit variants */
++static SPINAND_OP_VARIANTS(gd5f1gq5_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),
++ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
++
+ 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(
+ }
+
+ static const struct spinand_info gigadevice_spinand_table[] = {
++ SPINAND_INFO("F50L1G41LB",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ 0,
++ SPINAND_ECCINFO(&gd5fxgq4xa_ooblayout,
++ gd5fxgq4xa_ecc_get_status)),
+ 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
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(4, 512),
+- SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
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/413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
new file mode 100644
index 0000000..83e4c71
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/413-mtd-spinand-gigadevice-Add-support-for-GD5FxGQxUExxG-GD5FxGQxUExxH-and-GD5FxGMxUExxG-series.patch
@@ -0,0 +1,128 @@
+--- 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
+ SPINAND_PAGE_READ_FROM_CACHE_OP_3A(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0));
+
+-/* Q5 devices, QUADIO: Dummy bytes only valid for 1 GBit variants */
+-static SPINAND_OP_VARIANTS(gd5f1gq5_read_cache_variants,
++/* For Q5 devices, QUADIO use different dummy byte settings */
++/* Q5 1Gb */
++static SPINAND_OP_VARIANTS(dummy2_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),
+ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
+@@ -48,6 +49,15 @@ static SPINAND_OP_VARIANTS(gd5f1gq5_read
+ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
+ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
+
++/* Q5 2Gb & 4Gb */
++static SPINAND_OP_VARIANTS(dummy4_read_cache_variants,
++ SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 4, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 2, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_X2_OP(0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
++ SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
++
+ 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
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
+ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(8, 512),
+- SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
++ SPINAND_INFO_OP_VARIANTS(&dummy2_read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+@@ -309,7 +319,87 @@ static const struct spinand_info gigadev
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(4, 512),
+- SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
++ SPINAND_INFO_OP_VARIANTS(&dummy2_read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F2GQ5UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x52),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F4GQ6UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x55),
++ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&dummy4_read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F1GM7UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x91),
++ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq4uexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F2GM7UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x92),
++ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq4uexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F4GM8UExxG",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x95),
++ NAND_MEMORG(1, 2048, 128, 64, 4096, 80, 1, 1, 1),
++ NAND_ECCREQ(8, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq4uexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F1GQ5UExxH",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x31),
++ NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F2GQ5UExxH",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x32),
++ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
++ &write_cache_variants,
++ &update_cache_variants),
++ SPINAND_HAS_QE_BIT,
++ SPINAND_ECCINFO(&gd5fxgqx_variant2_ooblayout,
++ gd5fxgq5xexxg_ecc_get_status)),
++ SPINAND_INFO("GD5F4GQ6UExxH",
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x32),
++ NAND_MEMORG(1, 2048, 64, 64, 4096, 80, 1, 1, 1),
++ NAND_ECCREQ(4, 512),
++ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
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/9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
index 738d9b2..452b237 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/9001-PATCH-1-2-xHCI-MT7986-USB-2.0-USBIF-compliance-toolkit.patch
@@ -1,4 +1,4 @@
-From b4048b5efd1ac39f85d86dedbf54a9b614d17d64 Mon Sep 17 00:00:00 2001
+From 9deb29cc86b8fdee6702f8d575f08f9a214cf90a Mon Sep 17 00:00:00 2001
From: Zhanyong Wang <zhanyong.wang@mediatek.com>
Date: Thu, 27 May 2021 11:44:17 +0800
Subject: [PATCH 1/2] xHCI: MT7986 USB 2.0 USBIF compliance toolkit
@@ -8,12 +8,12 @@
Signed-off-by: Zhanyong Wang <zhanyong.wang@mediatek.com>
---
drivers/usb/host/Kconfig | 9 +++++++++
- drivers/usb/host/Makefile | 8 ++++++++
+ drivers/usb/host/Makefile | 9 +++++++++
drivers/usb/host/xhci-mtk.c | 5 ++++-
drivers/usb/host/xhci-mtk.h | 7 +++++++
drivers/usb/host/xhci.c | 2 +-
drivers/usb/host/xhci.h | 1 +
- 6 files changed, 30 insertions(+), 2 deletions(-)
+ 6 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 79b2e79dddd0..12b1bf9aa043 100644
@@ -36,10 +36,10 @@
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..704237831a58 100644
+index b191361257cc..612c855adfa1 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
-@@ -21,6 +21,14 @@ endif
+@@ -21,6 +21,15 @@ endif
ifneq ($(CONFIG_USB_XHCI_MTK), )
xhci-hcd-y += xhci-mtk-sch.o
@@ -51,6 +51,7 @@
+ xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-hstx-srctrl.o
+ xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-discth.o
+ xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-chgdt-en.o
++ xhci-hcd-$(CONFIG_USB_XHCI_MTK_DEBUGFS) += xhci-mtk-reg.o
endif
xhci-plat-hcd-y := xhci-plat.o
@@ -105,7 +106,7 @@
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 4bb850370bb6..710ccbe5a3b8 100644
+index 1c8070023161..cf004950bc00 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -713,7 +713,7 @@ EXPORT_SYMBOL_GPL(xhci_run);
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/9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch
index 356ae99..14c32a8 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/9002-PATCH-1-1-usb-add-embedded-Host-feature-support.patch
@@ -1,4 +1,4 @@
-From 801da3c9fd916d3743b8af174f4ef4aefc071981 Mon Sep 17 00:00:00 2001
+From 5b28b61fb9c88e3d2f7c7057929d55e54bc17966 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 2/2] usb: add embedded Host feature support
@@ -20,10 +20,10 @@
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
-index 303e8b3c1bda..b8c96ac26886 100644
+index 4cf0dc7f330d..f2f330606d0c 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
-@@ -2419,6 +2419,8 @@ static int usb_enumerate_device(struct usb_device *udev)
+@@ -2422,6 +2422,8 @@ static int usb_enumerate_device(struct usb_device *udev)
if (err < 0)
dev_dbg(&udev->dev, "HNP fail, %d\n", err);
}
@@ -32,7 +32,7 @@
return -ENOTSUPP;
}
-@@ -4778,9 +4780,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
+@@ -4779,9 +4781,10 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
goto fail;
}
if (r) {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9999-null-test.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9999-null-test.patch
deleted file mode 100644
index e69de29..0000000
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/9999-null-test.patch
+++ /dev/null
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 2fbfbf9..c99ccdc 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
@@ -13,12 +13,12 @@
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://0101-add-mtk-wifi-utility-rbus.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 \
+ file://0303-mtd-spinand-disable-on-die-ECC.patch \
file://0306-spi-spi-mem-MediaTek-Add-SPI-NAND-Flash-interface-dr.patch \
file://0307-dts-mt7629-add-snand-support.patch \
file://0308-dts-mt7622-add-snand-support.patch \
@@ -31,7 +31,7 @@
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://0600-net-phylink-propagate-resolved-link-config-via-mac_l.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 \
@@ -43,8 +43,6 @@
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://0671-add-micron-MT29F4G01ABAFD-spi-nand-support.patch \
- file://0672-add-F50L1G41LB-and-GD5F1GQ5UExxG-snand-support.patch \
file://0701-fix-mtk-nfi-driver-dependency.patch \
file://0801-mtk-sd-add-mt7986-support.patch \
file://0900-bt-mtk-serial-fix.patch \
@@ -61,8 +59,6 @@
file://1001-mtkhnat-ipv6-fix-pskb-expand-head-limitation.patch \
file://1002-mtkhnat-add-support-for-virtual-interface-acceleration.patch \
file://1003-dts-mt7622-rfb-change-to-ax-mtd-layout.patch \
- file://1004_remove_eth_transmit_timeout_hw_reset.patch \
- file://1005-mtkhnat-fix-pse-hang-for-multi-stations.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 \
@@ -74,6 +70,8 @@
file://400-mtd-add-mtk-snand-driver.patch \
file://401-pinctrl-add-mt7986-driver.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://500-auxadc-add-auxadc-32k-clk.patch \
file://730-net-ethernet-mtk_eth_soc-add-mtk-dsa-tag-rx-offload.patch \
file://738-mt7531-gsw-internal_phy_calibration.patch \
@@ -95,7 +93,5 @@
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 \
- file://999-add_armv7_support_for_panther.patch \
- file://9999-null-test.patch \
+ file://9010-iwconfig-wireless-rate-fix.patch;apply=no \
"