From f4d949b404855c7a643f810dbca0ad85088bd185 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 3 Jan 2023 22:42:45 +0100 Subject: [PATCH 01/12] generic: 5.15: backport qca8k fixup for mgmt and mdio read/write Backport qca8k fixup for mgmt and mdio read/write for kernel 5.15 fixup port dropping and configuration issue. Signed-off-by: Christian Marangi Reviewed-by: Robert Marko --- ...x-wrong-length-value-for-mgmt-eth-pa.patch | 102 +++++++++++ ...sa-tag_qca-fix-wrong-MGMT_DATA2-size.patch | 34 ++++ ...qca8k-cache-lo-and-hi-for-mdio-write.patch | 172 ++++++++++++++++++ ...ntroduce-single-mii-read-write-lo-hi.patch | 150 +++++++++++++++ ...prove-mdio-master-read-write-by-usin.patch | 73 ++++++++ 5 files changed, 531 insertions(+) create mode 100644 target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch create mode 100644 target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch create mode 100644 target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch create mode 100644 target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch create mode 100644 target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch diff --git a/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch b/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch new file mode 100644 index 0000000000..b61e7ede49 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-01-net-dsa-qca8k-fix-wrong-length-value-for-mgmt-eth-pa.patch @@ -0,0 +1,102 @@ +From 9807ae69746196ee4bbffe7d22d22ab2b61c6ed0 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:32 +0100 +Subject: [PATCH 1/5] net: dsa: qca8k: fix wrong length value for mgmt eth + packet + +The assumption that Documentation was right about how this value work was +wrong. It was discovered that the length value of the mgmt header is in +step of word size. + +As an example to process 4 byte of data the correct length to set is 2. +To process 8 byte 4, 12 byte 6, 16 byte 8... + +Odd values will always return the next size on the ack packet. +(length of 3 (6 byte) will always return 8 bytes of data) + +This means that a value of 15 (0xf) actually means reading/writing 32 bytes +of data instead of 16 bytes. This behaviour is totally absent and not +documented in the switch Documentation. + +In fact from Documentation the max value that mgmt eth can process is +16 byte of data while in reality it can process 32 bytes at once. + +To handle this we always round up the length after deviding it for word +size. We check if the result is odd and we round another time to align +to what the switch will provide in the ack packet. +The workaround for the length limit of 15 is still needed as the length +reg max value is 0xf(15) + +Reported-by: Ronald Wahl +Tested-by: Ronald Wahl +Fixes: 90386223f44e ("net: dsa: qca8k: add support for larger read/write size with mgmt Ethernet") +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 45 +++++++++++++++++++++++++------- + 1 file changed, 35 insertions(+), 10 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -146,7 +146,16 @@ static void qca8k_rw_reg_ack_handler(str + + command = get_unaligned_le32(&mgmt_ethhdr->command); + cmd = FIELD_GET(QCA_HDR_MGMT_CMD, command); ++ + len = FIELD_GET(QCA_HDR_MGMT_LENGTH, command); ++ /* Special case for len of 15 as this is the max value for len and needs to ++ * be increased before converting it from word to dword. ++ */ ++ if (len == 15) ++ len++; ++ ++ /* We can ignore odd value, we always round up them in the alloc function. */ ++ len *= sizeof(u16); + + /* Make sure the seq match the requested packet */ + if (get_unaligned_le32(&mgmt_ethhdr->seq) == mgmt_eth_data->seq) +@@ -193,17 +202,33 @@ static struct sk_buff *qca8k_alloc_mdio_ + if (!skb) + return NULL; + +- /* Max value for len reg is 15 (0xf) but the switch actually return 16 byte +- * Actually for some reason the steps are: +- * 0: nothing +- * 1-4: first 4 byte +- * 5-6: first 12 byte +- * 7-15: all 16 byte ++ /* Hdr mgmt length value is in step of word size. ++ * As an example to process 4 byte of data the correct length to set is 2. ++ * To process 8 byte 4, 12 byte 6, 16 byte 8... ++ * ++ * Odd values will always return the next size on the ack packet. ++ * (length of 3 (6 byte) will always return 8 bytes of data) ++ * ++ * This means that a value of 15 (0xf) actually means reading/writing 32 bytes ++ * of data. ++ * ++ * To correctly calculate the length we devide the requested len by word and ++ * round up. ++ * On the ack function we can skip the odd check as we already handle the ++ * case here. + */ +- if (len == 16) +- real_len = 15; +- else +- real_len = len; ++ real_len = DIV_ROUND_UP(len, sizeof(u16)); ++ ++ /* We check if the result len is odd and we round up another time to ++ * the next size. (length of 3 will be increased to 4 as switch will always ++ * return 8 bytes) ++ */ ++ if (real_len % sizeof(u16) != 0) ++ real_len++; ++ ++ /* Max reg value is 0xf(15) but switch will always return the next size (32 byte) */ ++ if (real_len == 16) ++ real_len--; + + skb_reset_mac_header(skb); + skb_set_network_header(skb, skb->len); diff --git a/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch b/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch new file mode 100644 index 0000000000..55ecb1eb42 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-02-net-dsa-tag_qca-fix-wrong-MGMT_DATA2-size.patch @@ -0,0 +1,34 @@ +From d9dba91be71f03cc75bcf39fc0d5d99ff33f1ae0 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:33 +0100 +Subject: [PATCH 2/5] net: dsa: tag_qca: fix wrong MGMT_DATA2 size + +It was discovered that MGMT_DATA2 can contain up to 28 bytes of data +instead of the 12 bytes written in the Documentation by accounting the +limit of 16 bytes declared in Documentation subtracting the first 4 byte +in the packet header. + +Update the define with the real world value. + +Tested-by: Ronald Wahl +Fixes: c2ee8181fddb ("net: dsa: tag_qca: add define for handling mgmt Ethernet packet") +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + include/linux/dsa/tag_qca.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/include/linux/dsa/tag_qca.h ++++ b/include/linux/dsa/tag_qca.h +@@ -40,8 +40,8 @@ + QCA_HDR_MGMT_COMMAND_LEN + \ + QCA_HDR_MGMT_DATA1_LEN) + +-#define QCA_HDR_MGMT_DATA2_LEN 12 /* Other 12 byte for the mdio data */ +-#define QCA_HDR_MGMT_PADDING_LEN 34 /* Padding to reach the min Ethernet packet */ ++#define QCA_HDR_MGMT_DATA2_LEN 28 /* Other 28 byte for the mdio data */ ++#define QCA_HDR_MGMT_PADDING_LEN 18 /* Padding to reach the min Ethernet packet */ + + #define QCA_HDR_MGMT_PKT_LEN (QCA_HDR_MGMT_HEADER_LEN + \ + QCA_HDR_LEN + \ diff --git a/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch b/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch new file mode 100644 index 0000000000..c8e22fd1b8 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-03-Revert-net-dsa-qca8k-cache-lo-and-hi-for-mdio-write.patch @@ -0,0 +1,172 @@ +From 03cb9e6d0b32b768e3d9d473c5c4ca1100877664 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:34 +0100 +Subject: [PATCH 3/5] Revert "net: dsa: qca8k: cache lo and hi for mdio write" + +This reverts commit 2481d206fae7884cd07014fd1318e63af35e99eb. + +The Documentation is very confusing about the topic. +The cache logic for hi and lo is wrong and actually miss some regs to be +actually written. + +What the Documentation actually intended was that it's possible to skip +writing hi OR lo if half of the reg is not needed to be written or read. + +Revert the change in favor of a better and correct implementation. + +Reported-by: Ronald Wahl +Signed-off-by: Christian Marangi +Cc: stable@vger.kernel.org # v5.18+ +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 61 +++++++------------------------- + drivers/net/dsa/qca/qca8k.h | 5 --- + 2 files changed, 12 insertions(+), 54 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -37,44 +37,6 @@ qca8k_split_addr(u32 regaddr, u16 *r1, u + } + + static int +-qca8k_set_lo(struct qca8k_priv *priv, int phy_id, u32 regnum, u16 lo) +-{ +- u16 *cached_lo = &priv->mdio_cache.lo; +- struct mii_bus *bus = priv->bus; +- int ret; +- +- if (lo == *cached_lo) +- return 0; +- +- ret = bus->write(bus, phy_id, regnum, lo); +- if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit lo register\n"); +- +- *cached_lo = lo; +- return 0; +-} +- +-static int +-qca8k_set_hi(struct qca8k_priv *priv, int phy_id, u32 regnum, u16 hi) +-{ +- u16 *cached_hi = &priv->mdio_cache.hi; +- struct mii_bus *bus = priv->bus; +- int ret; +- +- if (hi == *cached_hi) +- return 0; +- +- ret = bus->write(bus, phy_id, regnum, hi); +- if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit hi register\n"); +- +- *cached_hi = hi; +- return 0; +-} +- +-static int + qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) + { + int ret; +@@ -97,7 +59,7 @@ qca8k_mii_read32(struct mii_bus *bus, in + } + + static void +-qca8k_mii_write32(struct qca8k_priv *priv, int phy_id, u32 regnum, u32 val) ++qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) + { + u16 lo, hi; + int ret; +@@ -105,9 +67,12 @@ qca8k_mii_write32(struct qca8k_priv *pri + lo = val & 0xffff; + hi = (u16)(val >> 16); + +- ret = qca8k_set_lo(priv, phy_id, regnum, lo); ++ ret = bus->write(bus, phy_id, regnum, lo); + if (ret >= 0) +- ret = qca8k_set_hi(priv, phy_id, regnum + 1, hi); ++ ret = bus->write(bus, phy_id, regnum + 1, hi); ++ if (ret < 0) ++ dev_err_ratelimited(&bus->dev, ++ "failed to write qca8k 32bit register\n"); + } + + static int +@@ -442,7 +407,7 @@ qca8k_regmap_write(void *ctx, uint32_t r + if (ret < 0) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +@@ -475,7 +440,7 @@ qca8k_regmap_update_bits(void *ctx, uint + + val &= ~mask; + val |= write_val; +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + exit: + mutex_unlock(&bus->mdio_lock); +@@ -750,14 +715,14 @@ qca8k_mdio_write(struct qca8k_priv *priv + if (ret) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -787,7 +752,7 @@ qca8k_mdio_read(struct qca8k_priv *priv, + if (ret) + goto exit; + +- qca8k_mii_write32(priv, 0x10 | r2, r1, val); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); +@@ -798,7 +763,7 @@ qca8k_mdio_read(struct qca8k_priv *priv, + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(priv, 0x10 | r2, r1, 0); ++ qca8k_mii_write32(bus, 0x10 | r2, r1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -1914,8 +1879,6 @@ qca8k_sw_probe(struct mdio_device *mdiod + } + + priv->mdio_cache.page = 0xffff; +- priv->mdio_cache.lo = 0xffff; +- priv->mdio_cache.hi = 0xffff; + + /* Check the detected switch id */ + ret = qca8k_read_switch_id(priv); +--- a/drivers/net/dsa/qca/qca8k.h ++++ b/drivers/net/dsa/qca/qca8k.h +@@ -375,11 +375,6 @@ struct qca8k_mdio_cache { + * mdio writes + */ + u16 page; +-/* lo and hi can also be cached and from Documentation we can skip one +- * extra mdio write if lo or hi is didn't change. +- */ +- u16 lo; +- u16 hi; + }; + + struct qca8k_priv { diff --git a/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch b/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch new file mode 100644 index 0000000000..c0320ad6f9 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-04-net-dsa-qca8k-introduce-single-mii-read-write-lo-hi.patch @@ -0,0 +1,150 @@ +From cfbd6de588ef659c198083205dc954a6d3ed2aec Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:35 +0100 +Subject: [PATCH 4/5] net: dsa: qca8k: introduce single mii read/write lo/hi + +It may be useful to read/write just the lo or hi half of a reg. + +This is especially useful for phy poll with the use of mdio master. +The mdio master reg is composed by the first 16 bit related to setup and +the other half with the returned data or data to write. + +Refactor the mii function to permit single mii read/write of lo or hi +half of the reg. + +Tested-by: Ronald Wahl +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 106 ++++++++++++++++++++++++------- + 1 file changed, 84 insertions(+), 22 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -37,42 +37,104 @@ qca8k_split_addr(u32 regaddr, u16 *r1, u + } + + static int +-qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++qca8k_mii_write_lo(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) + { + int ret; ++ u16 lo; + +- ret = bus->read(bus, phy_id, regnum); +- if (ret >= 0) { +- *val = ret; +- ret = bus->read(bus, phy_id, regnum + 1); +- *val |= ret << 16; +- } ++ lo = val & 0xffff; ++ ret = bus->write(bus, phy_id, regnum, lo); ++ if (ret < 0) ++ dev_err_ratelimited(&bus->dev, ++ "failed to write qca8k 32bit lo register\n"); ++ ++ return ret; ++} + +- if (ret < 0) { ++static int ++qca8k_mii_write_hi(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++{ ++ int ret; ++ u16 hi; ++ ++ hi = (u16)(val >> 16); ++ ret = bus->write(bus, phy_id, regnum, hi); ++ if (ret < 0) + dev_err_ratelimited(&bus->dev, +- "failed to read qca8k 32bit register\n"); +- *val = 0; +- return ret; +- } ++ "failed to write qca8k 32bit hi register\n"); + ++ return ret; ++} ++ ++static int ++qca8k_mii_read_lo(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++{ ++ int ret; ++ ++ ret = bus->read(bus, phy_id, regnum); ++ if (ret < 0) ++ goto err; ++ ++ *val = ret & 0xffff; + return 0; ++ ++err: ++ dev_err_ratelimited(&bus->dev, ++ "failed to read qca8k 32bit lo register\n"); ++ *val = 0; ++ ++ return ret; + } + +-static void +-qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++static int ++qca8k_mii_read_hi(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) + { +- u16 lo, hi; + int ret; + +- lo = val & 0xffff; +- hi = (u16)(val >> 16); ++ ret = bus->read(bus, phy_id, regnum); ++ if (ret < 0) ++ goto err; + +- ret = bus->write(bus, phy_id, regnum, lo); +- if (ret >= 0) +- ret = bus->write(bus, phy_id, regnum + 1, hi); ++ *val = ret << 16; ++ return 0; ++ ++err: ++ dev_err_ratelimited(&bus->dev, ++ "failed to read qca8k 32bit hi register\n"); ++ *val = 0; ++ ++ return ret; ++} ++ ++static int ++qca8k_mii_read32(struct mii_bus *bus, int phy_id, u32 regnum, u32 *val) ++{ ++ u32 hi, lo; ++ int ret; ++ ++ *val = 0; ++ ++ ret = qca8k_mii_read_lo(bus, phy_id, regnum, &lo); + if (ret < 0) +- dev_err_ratelimited(&bus->dev, +- "failed to write qca8k 32bit register\n"); ++ goto err; ++ ++ ret = qca8k_mii_read_hi(bus, phy_id, regnum + 1, &hi); ++ if (ret < 0) ++ goto err; ++ ++ *val = lo | hi; ++ ++err: ++ return ret; ++} ++ ++static void ++qca8k_mii_write32(struct mii_bus *bus, int phy_id, u32 regnum, u32 val) ++{ ++ if (qca8k_mii_write_lo(bus, phy_id, regnum, val) < 0) ++ return; ++ ++ qca8k_mii_write_hi(bus, phy_id, regnum + 1, val); + } + + static int diff --git a/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch b/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch new file mode 100644 index 0000000000..4cbb66cf35 --- /dev/null +++ b/target/linux/generic/backport-5.15/777-v6.2-05-net-dsa-qca8k-improve-mdio-master-read-write-by-usin.patch @@ -0,0 +1,73 @@ +From a4165830ca237f2b3318faf62562bce8ce12a389 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 29 Dec 2022 17:33:36 +0100 +Subject: [PATCH 5/5] net: dsa: qca8k: improve mdio master read/write by using + single lo/hi + +Improve mdio master read/write by using singe mii read/write lo/hi. + +In a read and write we need to poll the mdio master regs in a busy loop +to check for a specific bit present in the upper half of the reg. We can +ignore the other half since it won't contain useful data. This will save +an additional useless read for each read and write operation. + +In a read operation the returned data is present in the mdio master reg +lower half. We can ignore the other half since it won't contain useful +data. This will save an additional useless read for each read operation. + +In a read operation it's needed to just set the hi half of the mdio +master reg as the lo half will be replaced by the result. This will save +an additional useless write for each read operation. + +Tested-by: Ronald Wahl +Signed-off-by: Christian Marangi +Signed-off-by: David S. Miller +--- + drivers/net/dsa/qca/qca8k-8xxx.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/net/dsa/qca/qca8k-8xxx.c ++++ b/drivers/net/dsa/qca/qca8k-8xxx.c +@@ -740,9 +740,9 @@ qca8k_mdio_busy_wait(struct mii_bus *bus + + qca8k_split_addr(reg, &r1, &r2, &page); + +- ret = read_poll_timeout(qca8k_mii_read32, ret1, !(val & mask), 0, ++ ret = read_poll_timeout(qca8k_mii_read_hi, ret1, !(val & mask), 0, + QCA8K_BUSY_WAIT_TIMEOUT * USEC_PER_MSEC, false, +- bus, 0x10 | r2, r1, &val); ++ bus, 0x10 | r2, r1 + 1, &val); + + /* Check if qca8k_read has failed for a different reason + * before returnting -ETIMEDOUT +@@ -784,7 +784,7 @@ qca8k_mdio_write(struct qca8k_priv *priv + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, 0); + + mutex_unlock(&bus->mdio_lock); + +@@ -814,18 +814,18 @@ qca8k_mdio_read(struct qca8k_priv *priv, + if (ret) + goto exit; + +- qca8k_mii_write32(bus, 0x10 | r2, r1, val); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, val); + + ret = qca8k_mdio_busy_wait(bus, QCA8K_MDIO_MASTER_CTRL, + QCA8K_MDIO_MASTER_BUSY); + if (ret) + goto exit; + +- ret = qca8k_mii_read32(bus, 0x10 | r2, r1, &val); ++ ret = qca8k_mii_read_lo(bus, 0x10 | r2, r1, &val); + + exit: + /* even if the busy_wait timeouts try to clear the MASTER_EN */ +- qca8k_mii_write32(bus, 0x10 | r2, r1, 0); ++ qca8k_mii_write_hi(bus, 0x10 | r2, r1 + 1, 0); + + mutex_unlock(&bus->mdio_lock); + From 1036545b0026dbf30da0c805d9c639bb688fa8e5 Mon Sep 17 00:00:00 2001 From: Bjoern Dobe Date: Thu, 29 Dec 2022 18:19:37 +0100 Subject: [PATCH 02/12] ipq40xx: fix wlan mac address for Aruba AP-303H Assigns the correct mac address from nvmen to the wlan interfaces. This Mac address corresponds to the label "Wireless MAC" on the device and the stock firmware. Removes duplicate entry of calibration variant for both radios. Fixes: cfc13c44595d ("ipq40xx: utilize nvmem-cells for macs & (pre-)calibration data") Reviewed-by: Robert Marko Signed-off-by: Bjoern Dobe --- .../files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts index fba6209d99..86f4514317 100644 --- a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4029-ap-303h.dts @@ -359,6 +359,10 @@ macaddr_mfginfo_1d: macaddr@1d { reg = <0x1d 0x6>; }; + + macaddr_mfginfo_45: macaddr@45 { + reg = <0x45 0x6>; + }; }; partition@3a0000 { @@ -454,17 +458,15 @@ &wifi0 { status = "okay"; - qcom,ath10k-calibration-variant = "Aruba-AP-303"; nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_1000>, <&macaddr_mfginfo_1d>; + nvmem-cells = <&precal_art_1000>, <&macaddr_mfginfo_45>; qcom,ath10k-calibration-variant = "Aruba-AP-303"; }; &wifi1 { status = "okay"; - qcom,ath10k-calibration-variant = "Aruba-AP-303"; nvmem-cell-names = "pre-calibration", "mac-address"; - nvmem-cells = <&precal_art_5000>, <&macaddr_mfginfo_1d>; + nvmem-cells = <&precal_art_5000>, <&macaddr_mfginfo_45>; mac-address-increment = <1>; qcom,ath10k-calibration-variant = "Aruba-AP-303"; }; From f655923b362e9f2d70672eee9c1fa82550a145a6 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 4 Jan 2023 19:26:16 +0100 Subject: [PATCH 03/12] CI: build: fix external toolchain use with release tag tests When a new tag for a release is created, the just checkout repo from github actions will already have such tag locally created. This will result in git fetch --tags failing with error rejecting the remote tag with (would clobber existing tag). Add -f option to overwrite any local tags and always fetch them from remote. Fixes: e24a1e6f6d7f ("CI: build: add support for external toolchains from stable branch") Signed-off-by: Christian Marangi --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 42db3669ac..c892857999 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -169,7 +169,7 @@ jobs: fi if [ -n "$major_ver" ]; then - git fetch --tags + git fetch --tags -f latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)" if [ -n "$latest_tag" ]; then TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//') From c4b806d5c4ccc653968620e6e9aec93bc4e370e5 Mon Sep 17 00:00:00 2001 From: Marian Sarcinschi Date: Fri, 23 Dec 2022 01:56:09 +0200 Subject: [PATCH 04/12] ramips: add missing LEDs to Asus RT-AX53U This patch adds the missing LEDs to Asus RT-AX53U. Based on PR #10400 and patch provided in #11068 - enable the two LEDs controlled by mt7915e for wireless; - add label to power LED so it works properly and fix formatting; - add the USB LED; - switch LEDs are best left to be controlled by hardware for now. Co-Authored-By: Ivan Rozhuk Co-Authored-By: Shiji Yang Co-Authored-By: Hartmut Birr Tested-by: Felix Baumann Tested-by: Marian Sarcinschi Signed-off-by: Marian Sarcinschi --- target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts | 14 ++++++++++++-- target/linux/ramips/image/mt7621.mk | 3 ++- .../ramips/mt7621/base-files/etc/board.d/01_leds | 5 +++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts index 6a5cb0d719..cbd6a3ce07 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts +++ b/target/linux/ramips/dts/mt7621_asus_rt-ax53u.dts @@ -26,11 +26,21 @@ leds { compatible = "gpio-leds"; - led_power: led-0 { + led_power: power { + label = "blue:power"; color = ; - function = LED_FUNCTION_POWER; + function = LED_FUNCTION_POWER; gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; + + led_usb { + label = "blue:usb"; + color = ; + function = LED_FUNCTION_USB; + gpios = <&gpio 14 GPIO_ACTIVE_LOW>; + trigger-sources = <&ehci_port2>; + linux,default-trigger = "usbport"; + }; }; keys { diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 75022f9708..cd7e10e7dc 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -307,7 +307,8 @@ define Device/asus_rt-ax53u IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ check-size - DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools + DEVICE_PACKAGES := kmod-mt7915e kmod-usb3 uboot-envtools \ + kmod-usb-ledtrig-usbport endef TARGET_DEVICES += asus_rt-ax53u diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 6e8d35ea49..9e0eaac941 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -19,6 +19,11 @@ asus,rp-ac87) ucidef_set_led_rssi "rssimed-wlan1" "RSSIMED" "green:rssimed-wlan1" "wlan1" "40" "100" ucidef_set_led_rssi "rssihigh-wlan1" "RSSIHIGH" "green:rssihigh-wlan1" "wlan1" "70" "100" ;; +asus,rt-ax53u) + ucidef_set_led_usbport "usb" "USB" "blue:usb" "usb1-port2" + ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "mt76-phy0" "phy0tpt" + ucidef_set_led_wlan "wlan5g" "WiFi 5GHz" "mt76-phy1" "phy1tpt" + ;; asus,rt-n56u-b1) ucidef_set_led_netdev "lan" "LAN link" "blue:lan" "br-lan" ucidef_set_led_netdev "wan" "WAN link" "blue:wan" "wan" From 665c2154ef122d10dfffeca95538ebdff82653b5 Mon Sep 17 00:00:00 2001 From: Nikolay Martynov Date: Wed, 14 Dec 2022 20:26:38 -0500 Subject: [PATCH 05/12] ramips: add basic support for tp-link er605-v2 This is a MT7621-based device with 128MB NAND flash, 256MB RAM, and a USB port. The board has headers to attach console. In order for them to work two solder bridges near those pads need to be made. The defice has the following partition table: ``` 0x000000000000-0x000000080000 : "u-boot" 0x000000080000-0x000000100000 : "u-boot-env" 0x000000100000-0x000000140000 : "factory" 0x000000140000-0x000007e00000 : "firmware" 0x000007e00000-0x000008000000 : "panic-ops" ``` `firmware` partition contains UBI volumes. Unfortunately I accidentally wiped partition and I no longer have access to it. `firmware` partition contains 'secondary' U-Boot which is run by 'first' u-boot. It also contains various configuration partitions that include device info and MAC address. There also seems to be 'primary' and 'backup' set of 'main' volumes. U-boot has `mtkupgrade` command that just overrides data on firmware partitions. Firmware file provided by TP-Link cannot be used with that command. U-boot also has 'recovery' http server. Unfortunately I was not able to make it work with manufacturer's firmware. Manufacturer's firmware essentially contains multiple UBI volumes along with 'partition table'. Unfortunately I no longer can properly run manufacturer's firmware so I cannot at the moment try to a support for building 'factory' images. This patch adds support for initramfs image as well as sysupgrade image. This seems to be pretty standard MT7621 board otherwise. Things that work: * network * leds * usb * factory MAC detection Signed-off-by: Nikolay Martynov --- .../base-files/files/lib/functions/system.sh | 11 ++ .../ramips/dts/mt7621_tplink_er605-v2.dts | 180 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 18 ++ .../mt7621/base-files/etc/board.d/02_network | 9 + .../mt7621/base-files/lib/upgrade/platform.sh | 6 + 5 files changed, 224 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_tplink_er605-v2.dts diff --git a/package/base-files/files/lib/functions/system.sh b/package/base-files/files/lib/functions/system.sh index 176c10d065..94ccc02bb8 100644 --- a/package/base-files/files/lib/functions/system.sh +++ b/package/base-files/files/lib/functions/system.sh @@ -129,6 +129,17 @@ mtd_get_mac_encrypted_deco() { echo $macaddr } +mtd_get_mac_uci_config_ubi() { + local volumename="$1" + + . /lib/upgrade/nand.sh + + local ubidev=$(nand_attach_ubi $CI_UBIPART) + local part=$(nand_find_volume $ubidev $volumename) + + cat "/dev/$part" | sed -n 's/^\s*option macaddr\s*'"'"'\?\([0-9A-F:]\+\)'"'"'\?/\1/Ip' +} + mtd_get_mac_text() { local mtdname=$1 local offset=$(($2)) diff --git a/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts new file mode 100644 index 0000000000..3381e598bd --- /dev/null +++ b/target/linux/ramips/dts/mt7621_tplink_er605-v2.dts @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "mt7621.dtsi" + +#include +#include +#include + +/ { + model = "TP-Link ER605 v2"; + compatible = "tplink,er605-v2", "mediatek,mt7621-soc"; + + chosen { + bootargs = "console=ttyS0,115200 noinitrd"; + }; + + aliases { + led-boot = &led_system; + led-failsafe = &led_system; + led-running = &led_system; + led-upgrade = &led_system; + label-mac-device = &gmac0; + }; + + leds { + compatible = "gpio-leds"; + + led_usb: usb { + label = "green:usb"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + + led_power: power { + label = "green:power"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + default-state = "on"; + }; + + led_system: system { + label = "green:system"; + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + default-state = "keep"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset button"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + reg_usb_vbus: regulator-usb { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio 10 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; +}; + +&gmac0 { + label = "dsa"; +}; + +&gmac1 { + status = "okay"; + label = "eth0"; + phy-handle = <ðphy0>; +}; + + +&switch0 { + ports { + port@0 { + status = "disabled"; + }; + + port@1 { + status = "okay"; + label = "eth1"; + }; + + port@2 { + status = "okay"; + label = "eth2"; + }; + + port@3 { + status = "okay"; + label = "eth3"; + }; + + port@4 { + status = "okay"; + label = "eth4"; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "u-boot-env"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "factory"; + reg = <0x100000 0x40000>; + read-only; + }; + + partition@140000 { + label = "firmware"; + reg = <0x140000 0x7cc0000>; + }; + + partition@7e00000 { + label = "panic-ops"; + reg = <0x7e00000 0x200000>; + }; + }; +}; + + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&state_default { + gpio { + groups = "uart2", "uart3", "pcie", "jtag"; + function = "gpio"; + }; +}; + +&spi0 { + status = "disabled"; +}; + +&xhci { + vusb33-supply = <®_3p3v>; + vbus-supply = <®_usb_vbus>; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index cd7e10e7dc..9804b70e16 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1961,6 +1961,24 @@ define Device/tplink_eap615-wall-v1 endef TARGET_DEVICES += tplink_eap615-wall-v1 +define Device/tplink_er605-v2 + $(Device/dsa-migration) + DEVICE_VENDOR := TP-Link + DEVICE_MODEL := ER605 + DEVICE_VARIANT := v2 + DEVICE_PACKAGES := -wpad-basic-wolfssl kmod-usb3 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 4096k + KERNEL_IN_UBI := 1 + KERNEL_LOADADDR := 0x82000000 + KERNEL := kernel-bin | relocate-kernel 0x80001000 | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb + IMAGES += sysupgrade.tar + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata + IMAGE_SIZE := 127744k +endef +TARGET_DEVICES += tplink_er605-v2 + define Device/tplink_mr600-v2-eu $(Device/dsa-migration) $(Device/tplink-v2) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index b7121db64f..f0ac4f1c4f 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -99,6 +99,9 @@ ramips_setup_interfaces() tplink,eap615-wall-v1) ucidef_set_interface_lan "lan0 lan1 lan2 lan3" ;; + tplink,er605-v2) + ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4" "eth0" + ;; tplink,tl-wpa8631p-v3) ucidef_set_interface_lan "lan1 lan2 lan3 plc0" ;; @@ -225,6 +228,12 @@ ramips_setup_macs() label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base") lan_mac=$label_mac ;; + tplink,er605-v2) + CI_UBIPART="firmware" + label_mac=$(mtd_get_mac_uci_config_ubi "tddp") + lan_mac=$label_mac + wan_mac=$(macaddr_add "$label_mac" 1) + ;; tplink,mr600-v2-eu) label_mac=$(cat "/sys/class/net/eth0/address") wwan_mac=$(macaddr_add $label_mac 1) diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index c665820169..fd856e6b3a 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -124,6 +124,12 @@ platform_do_upgrade() { iodata_mstc_upgrade_prepare "0x1fe75" nand_do_upgrade "$1" ;; + tplink,er605-v2) + echo "Upgrading tplink,er605-v2" + CI_UBIPART="firmware" + CI_KERNPART="kernel" + nand_do_upgrade "$1" + ;; ubnt,edgerouter-x|\ ubnt,edgerouter-x-sfp) platform_upgrade_ubnt_erx "$1" From 0eefea2ed77d6bb6b7e15339b79222351126f94c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 31 Dec 2022 12:50:18 +0000 Subject: [PATCH 06/12] ramips: enable Wi-Fi LED support for Zbtlink ZBT-WE1326 Add LED properties to PCIe node to enable Wi-Fi LED support. Signed-off-by: Shiji Yang --- .../ramips/dts/mt7621_zbtlink_zbt-we1326.dts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts index 6aafe385ae..4e30dfb6c9 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we1326.dts @@ -122,18 +122,30 @@ }; &pcie0 { - wifi0: mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; }; }; &pcie1 { - wifi1: mt76@0,0 { + wifi1: wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; ieee80211-freq-limit = <2400000 2500000>; + + led { + led-sources = <0>; + led-active-low; + }; }; }; From 6760c7cbe55ceb18bdffac6274c01dd614a54555 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Sat, 31 Dec 2022 12:51:16 +0000 Subject: [PATCH 07/12] ramips: enable Wi-Fi LED support for Afoundry EW1200 Add LED properties to PCIe node to enable Wi-Fi LED support. Signed-off-by: Shiji Yang --- .../linux/ramips/dts/mt7621_afoundry_ew1200.dts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts index 119acd977c..8d33f542dc 100644 --- a/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts +++ b/target/linux/ramips/dts/mt7621_afoundry_ew1200.dts @@ -90,18 +90,30 @@ }; &pcie0 { - mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x8000>; ieee80211-freq-limit = <5000000 6000000>; + + led { + led-sources = <2>; + led-active-low; + }; }; }; &pcie1 { - mt76@0,0 { + wifi@0,0 { + compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; mediatek,mtd-eeprom = <&factory 0x0000>; ieee80211-freq-limit = <2400000 2500000>; + + led { + led-sources = <0>; + led-active-low; + }; }; }; From d187861a283b9461e9ea32e9fd7e6bf7055655e1 Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Sun, 25 Dec 2022 11:57:35 +0800 Subject: [PATCH 08/12] toolchain/nasm: update to 2.16.01 ChangeLog: Version 2.16.01 _This is a documentation update release only._ (*) Fix the creation of the table of contents in the HTML version of the documentation. Version 2.16 (*) Support for the `rdf' format has been discontinued and all the RDOFF utilities has been removed. (*) The `--reproducible' option now leaves the filename field in the COFF object format blank. This was always rather useless since it is only 18 characters long; as such debug formats have to carry their own filename information anyway. (*) Fix handling of MASM-syntax reserved memory (e.g. `dw ?') when used in structure definitions. (*) The preprocessor now supports functions, which can be less verbose and more convenient than the equivalent code implemented using directives. See section 4.4. (*) Fix the handling of `%00' in the preprocessor. (*) Fix incorrect handling of path names affecting error messages, dependency generation, and debug format output. (*) Support for the RDOFF output format and the RDOFF tools have been removed. The RDOFF tools had already been broken since at least NASM 2.14. For flat code the ELF output format recommended; for segmented code the `obj' (OMF) output format. (*) New facility: preprocessor functions. Preprocessor functions, which are expanded similarly to single-line macros, can greatly simplify code that in the past would have required a lengthy list of directives and intermediate macros. See section 4.4. (*) Single-line macros can now declare parameters (using a `&&' prefix) that creates a quoted string, but does _not_ requote an already quoted string. See section 4.2.1. (*) Instruction table updated per public information available as of November 2022. (*) All warnings in the preprocessor have now been assigned warning classes. See appendix A. (*) Fix the invalid use of `RELA'-type relocations instead of `REL'- type relocations when generating DWARF debug information for the `elf32' output format. (*) Fix the handling `at' in `istruc' when the structure contains local labels. See section 5.9.2. (*) When assembling with `--reproducible', don't encode the filename in the COFF header for the `coff', `win32' or `win64' output formats. The COFF header only has space for an 18-character filename, which makes this field rather useless in the first place. Debug output data, if enabled, is not affected. (*) Fix incorrect size calculation when using MASM syntax for non- byte reservations (e.g. `dw ?'.) (*) Allow forcing an instruction in 64-bit mode to have a (possibly redundant) REX prefix, using the syntax `{rex}' as a prefix. (*) Add a `{vex}' prefix to enforce VEX (AVX) encoding of an instruction, either using the 2- or 3-byte VEX prefixes. (*) The `CPU' directive has been augmented to allow control of generation of VEX (AVX) versus EVEX (AVX-512) instruction formats, see section 7.11. (*) Some recent instructions that previously have been only available using EVEX encodings are now also encodable using VEX (AVX) encodings. For backwards compatibility these encodings are not enabled by default, but can be generated either via an explicit `{vex}' prefix or by specifying either `CPU LATEVEX' or `CPU NOEVEX'; see section 7.11. (*) Document the already existing `%unimacro' directive. See section 4.5.12. (*) Fix a code range generation bug in the DWARF debug format (incorrect information in the `DW_AT_high_pc' field) for the ELF output formats. This bug happened to cancel out with a bug in older versions of the GNU binutils linker, but breaks with other linkers and updated or other linkers that expect the spec to be followed. (*) Fix segment symbols with addends, e.g. `jmp _TEXT+10h:0' in output formats that support segment relocations, e.g. the `obj' format. (*) Fix various crashes and hangs on invalid input. Signed-off-by: Linhui Liu --- toolchain/nasm/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/toolchain/nasm/Makefile b/toolchain/nasm/Makefile index f733c52912..64bb5e7751 100644 --- a/toolchain/nasm/Makefile +++ b/toolchain/nasm/Makefile @@ -5,12 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nasm -PKG_VERSION:=2.15.05 +PKG_VERSION:=2.16.01 PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz - -PKG_HASH:=3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f +PKG_HASH:=c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558 HOST_BUILD_PARALLEL:=1 From 0820d620123a03b6db6642acb6e950d22ffb030f Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Tue, 27 Dec 2022 00:30:07 +0100 Subject: [PATCH 09/12] lantiq-xrx200: fix wan LED on o2 box 6431 The WIFI LED already worked for me with the latest openwrt 22.03 version. Wifi LED did not with an older 22.x version (in gluon - there phy0radio did nothing but phy0tpt did show activity the WAN interface has the name "wan" and not "pppoe-wan" on this device fixes #7757 (and FS#2987) Signed-off-by: Florian Maurer --- target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds index bac3ed2b53..8f59538b83 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/01_leds @@ -28,7 +28,10 @@ arcadyan,arv7519rw22) ucidef_set_led_netdev "lan" "lan" "green:lan" "eth0.1" ;; arcadyan,vgv7510kw22-nor|\ -arcadyan,vgv7510kw22-brn|\ +arcadyan,vgv7510kw22-brn) + ucidef_set_led_netdev "internet" "internet" "$led_internet" "wan" + ucidef_set_led_wlan "wifi" "wifi" "green:wlan" "phy0radio" + ;; zyxel,p-2812hnu-f1|\ zyxel,p-2812hnu-f3) ucidef_set_led_wlan "wifi" "wifi" "green:wlan" "phy0radio" From aa6c8c38eac8a96f3143644454806250dbe8903d Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 22 Dec 2022 23:51:16 +0100 Subject: [PATCH 10/12] ath79: convert Netgear WNDAP360 WiFis to nvmem-cells Pull the calibration data from the nvmem subsystem. This allows us to move userspace caldata extraction into the device-tree definition. Merge art into partition node. Signed-off-by: Nick Hainke --- .../ath79/dts/ar7161_netgear_wndap360.dts | 55 ++++++++++--------- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 6 +- target/linux/ath79/image/generic.mk | 2 +- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts index 35c5dd36d2..21dc423c35 100644 --- a/target/linux/ath79/dts/ar7161_netgear_wndap360.dts +++ b/target/linux/ath79/dts/ar7161_netgear_wndap360.dts @@ -107,10 +107,34 @@ read-only; }; - art: partition@7f0000 { + partition@7f0000 { label = "art"; reg = <0x7f0000 0x010000>; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; + }; + + macaddr_art_120c: macaddr@120c { + reg = <0x120c 0x6>; + }; + + macaddr_art_520c: macaddr@520c { + reg = <0x520c 0x6>; + }; + + calibration_art_1000: calibration@1000 { + reg = <0x1000 0xeb8>; + }; + + calibration_art_5000: calibration@5000 { + reg = <0x5000 0xeb8>; + }; }; }; }; @@ -122,9 +146,8 @@ ath9k0: wifi@0,11 { compatible = "pci168c,0029"; reg = <0x8800 0 0 0 0>; - qca,no-eeprom; - nvmem-cells = <&macaddr_art_120c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_120c>, <&calibration_art_1000>; + nvmem-cell-names = "mac-address", "calibration"; #gpio-cells = <2>; gpio-controller; }; @@ -132,30 +155,10 @@ ath9k1: wifi@0,12 { compatible = "pci168c,0029"; reg = <0x9000 0 0 0 0>; - qca,no-eeprom; - nvmem-cells = <&macaddr_art_520c>; - nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_art_520c>, <&calibration_art_5000>; + nvmem-cell-names = "mac-address", "calibration"; mac-address-increment = <1>; #gpio-cells = <2>; gpio-controller; }; }; - - -&art { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_art_0: macaddr@0 { - reg = <0x0 0x6>; - }; - - macaddr_art_120c: macaddr@120c { - reg = <0x120c 0x6>; - }; - - macaddr_art_520c: macaddr@520c { - reg = <0x520c 0x6>; - }; -}; diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index df7f1fc0ce..961f5f46aa 100644 --- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -124,8 +124,7 @@ case "$FIRMWARE" in "ath9k-eeprom-pci-0000:00:11.0.bin") case $board in buffalo,wzr-600dhp|\ - buffalo,wzr-hp-ag300h|\ - netgear,wndap360) + buffalo,wzr-hp-ag300h) caldata_extract "art" 0x1000 0xeb8 ;; dlink,dir-825-b1|\ @@ -144,8 +143,7 @@ case "$FIRMWARE" in "ath9k-eeprom-pci-0000:00:12.0.bin") case $board in buffalo,wzr-600dhp|\ - buffalo,wzr-hp-ag300h|\ - netgear,wndap360) + buffalo,wzr-hp-ag300h) caldata_extract "art" 0x5000 0xeb8 ;; dlink,dir-825-b1|\ diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index d66684a124..a19412498a 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1763,7 +1763,7 @@ define Device/netgear_wndap360 $(Device/netgear_generic) SOC := ar7161 DEVICE_MODEL := WNDAP360 - DEVICE_PACKAGES := kmod-leds-reset kmod-owl-loader + DEVICE_PACKAGES := kmod-leds-reset IMAGE_SIZE := 7744k BLOCKSIZE := 256k KERNEL := kernel-bin | append-dtb | gzip | uImage gzip From 7801e814dd62c98dcce3c11b3c9db86318279038 Mon Sep 17 00:00:00 2001 From: Ignas Poklad Date: Sun, 18 Dec 2022 15:14:36 +0100 Subject: [PATCH 11/12] ramips: add Unielec U7621-06 32M build target Add 32M build target Rest of the details as per commit 46ab81e405d2 ("ramips add support for UniElec U7621-06") Signed-off-by: Ignas Poklad --- .../dts/mt7621_unielec_u7621-06-32m.dts | 78 +++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 12 +++ 2 files changed, 90 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts b/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts new file mode 100644 index 0000000000..dc9a9773a2 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06-32m.dts @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright(c) 2017 Kristian Evensen . + * Copyright(c) 2017 Piotr Dymacz . + * Copyright(c) 2018 Nishant Sharma . + * All rights reserved. + */ + +#include "mt7621_unielec_u7621-06.dtsi" + +/ { + compatible = "unielec,u7621-06-32m", "unielec,u7621-06", "mediatek,mt7621-soc"; + model = "UniElec U7621-06 (32M flash)"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x1fb0000>; + }; + }; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9804b70e16..1b4e1dc039 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -2147,6 +2147,18 @@ define Device/unielec_u7621-06-16m endef TARGET_DEVICES += unielec_u7621-06-16m +define Device/unielec_u7621-06-32m + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 32448k + DEVICE_VENDOR := UniElec + DEVICE_MODEL := U7621-06 + DEVICE_VARIANT := 32M + DEVICE_PACKAGES := kmod-ata-ahci kmod-sdhci-mt7620 kmod-usb3 -wpad-basic-wolfssl + SUPPORTED_DEVICES += unielec,u7621-06-32m +endef +TARGET_DEVICES += unielec_u7621-06-32m + define Device/unielec_u7621-06-64m $(Device/dsa-migration) $(Device/uimage-lzma-loader) From 87b9825521b846e2fc25b1ba683354410307f84b Mon Sep 17 00:00:00 2001 From: Linhui Liu Date: Tue, 3 Jan 2023 09:35:34 +0800 Subject: [PATCH 12/12] ncurses: update to 6.4 Update to the latest released version. Signed-off-by: Linhui Liu --- package/libs/ncurses/Makefile | 6 ++--- .../100-ncurses-5.6-20080112-urxvt.patch | 2 +- .../101-ncurses-5.6-20080628-kbs.patch | 26 +++++++++---------- .../patches/102-ncurses-5.9-gcc-5.patch | 2 +- .../patches/103-ncurses-ar-determinism.patch | 4 +-- .../libs/ncurses/patches/900-terminfo.patch | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 14f74082af..29261a4cd0 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses PKG_CPE_ID:=cpe:/a:gnu:ncurses -PKG_VERSION:=6.3 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=6.4 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059 +PKG_HASH:=6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=README diff --git a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch index 2fdbb7b0be..70d64bd8e1 100644 --- a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch +++ b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6616,6 +6616,172 @@ rxvt-cygwin-native|rxvt terminal emulato +@@ -6886,6 +6886,172 @@ rxvt-cygwin-native|rxvt terminal emulato rxvt-16color|rxvt with 16 colors like aixterm, ncv#32, use=ibm+16color, use=rxvt, diff --git a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch index 2d299197b0..9f00350a46 100644 --- a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch +++ b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch @@ -1,14 +1,14 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -4815,6 +4815,7 @@ xterm+nofkeys|building block for xterm f - # This version reflects the current xterm features. - xterm-new|modern xterm terminal emulator, +@@ -4984,6 +4984,7 @@ xterm-xfree86|xterm terminal emulator (X + + xterm+nofkeys|building block for xterm fkey-variants, npc, + kbs=\177, kcbt=\E[Z, kent=\EOM, nel=\EE, use=ecma+index, - use=ansi+rep, use=ecma+strikeout, use=xterm+pcfkeys, - use=xterm+nofkeys, -@@ -6416,6 +6417,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 + use=ansi+rep, use=ecma+strikeout, use=vt420+lrmm, + use=xterm+sm+1006, use=xterm+tmux, use=ecma+italics, +@@ -6689,6 +6690,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, cols#80, it#8, lines#24, @@ -16,24 +16,24 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -@@ -6425,7 +6427,7 @@ rxvt-basic|rxvt terminal base (X Window +@@ -6698,7 +6700,7 @@ rxvt-basic|rxvt terminal base (X Window enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is1=\E[?47l\E=\E[?1l, - is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, - rmul=\E[24m, -@@ -8060,6 +8062,7 @@ dumb-emacs-ansi|Emacs dumb terminal with - screen|VT 100/ANSI X3.64 virtual terminal, + rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, +@@ -8347,6 +8349,7 @@ dumb-emacs-ansi|Emacs dumb terminal with + screen-base|VT 100/ANSI X3.64 virtual terminal (base), OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, + kbs=\177, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -@@ -8071,7 +8074,7 @@ screen|VT 100/ANSI X3.64 virtual termina +@@ -8358,7 +8361,7 @@ screen-base|VT 100/ANSI X3.64 virtual te dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, @@ -42,7 +42,7 @@ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -@@ -8199,6 +8202,7 @@ screen.xterm-r6|screen customized for X1 +@@ -8500,6 +8503,7 @@ screen.xterm-r6|screen customized for X1 # on Solaris because Sun's curses implementation gets confused. screen.teraterm|disable ncv in teraterm, ncv#127, diff --git a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch index a6398acf8e..5f1461b7b0 100644 --- a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch +++ b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch @@ -15,7 +15,7 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh -@@ -511,11 +511,22 @@ sed -n -f $ED1 \ +@@ -512,11 +512,22 @@ sed -n -f $ED1 \ -e 's/gen_$//' \ -e 's/ / /g' >>$TMP diff --git a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch index 5ef8ab7ab0..a4599130cc 100644 --- a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch +++ b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch @@ -1,6 +1,6 @@ --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -505,7 +505,7 @@ AC_CACHE_CHECK(for options to update arc +@@ -523,7 +523,7 @@ AC_CACHE_CHECK(for options to update arc ;; (*) cf_cv_ar_flags=unknown @@ -11,7 +11,7 @@ # check if $ARFLAGS already contains this choice --- a/configure +++ b/configure -@@ -5072,7 +5072,7 @@ else +@@ -5110,7 +5110,7 @@ else ;; (*) cf_cv_ar_flags=unknown diff --git a/package/libs/ncurses/patches/900-terminfo.patch b/package/libs/ncurses/patches/900-terminfo.patch index 96d78cde34..86e3bc16b2 100644 --- a/package/libs/ncurses/patches/900-terminfo.patch +++ b/package/libs/ncurses/patches/900-terminfo.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6240,12 +6240,11 @@ konsole-xf3x|KDE console window with key +@@ -6514,12 +6514,11 @@ konsole-xf3x|KDE console window with key # The value for kbs (see konsole-vt100) reflects local customization rather # than the settings used for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm,