From e2ceb8dd93ace2e82fe136e1900b6830ac11049d Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 3 Apr 2020 11:52:35 +0200 Subject: [PATCH] mediatek: more v5.4 fixes These are all backports and/or on their way upstream. Signed-off-by: John Crispin --- ...dts-add-wmac-support-for-mt7622-rfb1.patch | 36 ++++++++++------- .../0400-eth-fix-rx-vlan-hw-offload.patch | 23 +++++++++++ .../0401-eth-fix-eth1-tx-timeout.patch | 39 +++++++++++++++++++ .../patches-5.4/0900-bt-mtk-serial-fix.patch | 33 ++++++++++++++++ 4 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 target/linux/mediatek/patches-5.4/0400-eth-fix-rx-vlan-hw-offload.patch create mode 100644 target/linux/mediatek/patches-5.4/0401-eth-fix-eth1-tx-timeout.patch create mode 100644 target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch diff --git a/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch b/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch index 463602e552..7e24596fb8 100644 --- a/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch +++ b/target/linux/mediatek/patches-5.4/0310-dts-add-wmac-support-for-mt7622-rfb1.patch @@ -1,26 +1,27 @@ -diff --git a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -index 1ec68de..44cc80c 100644 ---- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts -@@ -105,6 +105,18 @@ - regulator-boot-on; - regulator-always-on; +diff -urN a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi +--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi 2020-03-31 14:47:46.554212143 +0800 ++++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi 2020-03-31 14:47:32.322642377 +0800 +@@ -712,6 +712,17 @@ + status = "disabled"; }; -+ + + wmac: wmac@18000000 { + compatible = "mediatek,mt7622-wmac"; + reg = <0 0x18000000 0 0x100000>; + interrupts = ; + + mediatek,infracfg = <&infracfg>; -+ status = "okay"; ++ status = "disabled"; + + power-domains = <&scpsys MT7622_POWER_DOMAIN_WB>; -+ mediatek,mtd-eeprom = <&factory 0x0000>; + }; - }; - - &bch { ++ + ssusbsys: ssusbsys@1a000000 { + compatible = "mediatek,mt7622-ssusbsys", + "syscon"; +diff -urN a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts 2020-03-31 14:48:15.769329276 +0800 ++++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts 2020-03-31 14:47:54.545970592 +0800 @@ -579,7 +591,7 @@ reg = <0x140000 0x0080000>; }; @@ -30,3 +31,12 @@ index 1ec68de..44cc80c 100644 label = "Factory"; reg = <0x1c0000 0x0040000>; }; +@@ -636,3 +636,8 @@ + pinctrl-0 = <&watchdog_pins>; + status = "okay"; + }; ++ ++&wmac { ++ mediatek,mtd-eeprom = <&factory 0x0000>; ++ status = "okay"; ++}; diff --git a/target/linux/mediatek/patches-5.4/0400-eth-fix-rx-vlan-hw-offload.patch b/target/linux/mediatek/patches-5.4/0400-eth-fix-rx-vlan-hw-offload.patch new file mode 100644 index 0000000000..f04b07fa53 --- /dev/null +++ b/target/linux/mediatek/patches-5.4/0400-eth-fix-rx-vlan-hw-offload.patch @@ -0,0 +1,23 @@ +diff -urN a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2020-03-31 16:05:24.398403054 +0800 ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2020-03-31 16:05:39.142008780 +0800 +@@ -1284,7 +1284,7 @@ + skb->protocol = eth_type_trans(skb, netdev); + + if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX && +- RX_DMA_VID(trxd.rxd3)) ++ (trxd.rxd2 & RX_DMA_VTAG)) + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), + RX_DMA_VID(trxd.rxd3)); + skb_record_rx_queue(skb, 0); +diff -urN a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h 2020-03-31 16:05:29.726260583 +0800 ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h 2020-03-31 16:05:43.493892389 +0800 +@@ -293,6 +293,7 @@ + #define RX_DMA_LSO BIT(30) + #define RX_DMA_PLEN0(_x) (((_x) & 0x3fff) << 16) + #define RX_DMA_GET_PLEN0(_x) (((_x) >> 16) & 0x3fff) ++#define RX_DMA_VTAG BIT(15) + + /* QDMA descriptor rxd3 */ + #define RX_DMA_VID(_x) ((_x) & 0xfff) diff --git a/target/linux/mediatek/patches-5.4/0401-eth-fix-eth1-tx-timeout.patch b/target/linux/mediatek/patches-5.4/0401-eth-fix-eth1-tx-timeout.patch new file mode 100644 index 0000000000..c882cbbfe3 --- /dev/null +++ b/target/linux/mediatek/patches-5.4/0401-eth-fix-eth1-tx-timeout.patch @@ -0,0 +1,39 @@ +diff -urN b/drivers/net/ethernet/mediatek/mtk_eth_soc.c c/drivers/net/ethernet/mediatek/mtk_eth_soc.c +--- b/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2020-03-31 16:05:39.142008780 +0800 ++++ c/drivers/net/ethernet/mediatek/mtk_eth_soc.c 2020-03-31 16:08:12.422190657 +0800 +@@ -1090,17 +1090,6 @@ + } + } + +-static void mtk_stop_queue(struct mtk_eth *eth) +-{ +- int i; +- +- for (i = 0; i < MTK_MAC_COUNT; i++) { +- if (!eth->netdev[i]) +- continue; +- netif_stop_queue(eth->netdev[i]); +- } +-} +- + static int mtk_start_xmit(struct sk_buff *skb, struct net_device *dev) + { + struct mtk_mac *mac = netdev_priv(dev); +@@ -1121,7 +1110,7 @@ + + tx_num = mtk_cal_txd_req(skb); + if (unlikely(atomic_read(&ring->free_count) <= tx_num)) { +- mtk_stop_queue(eth); ++ netif_stop_queue(dev); + netif_err(eth, tx_queued, dev, + "Tx Ring full when queue awake!\n"); + spin_unlock(ð->page_lock); +@@ -1147,7 +1136,7 @@ + goto drop; + + if (unlikely(atomic_read(&ring->free_count) <= ring->thresh)) +- mtk_stop_queue(eth); ++ netif_stop_queue(dev); + + spin_unlock(ð->page_lock); + diff --git a/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch b/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch new file mode 100644 index 0000000000..6d4cce276b --- /dev/null +++ b/target/linux/mediatek/patches-5.4/0900-bt-mtk-serial-fix.patch @@ -0,0 +1,33 @@ +--- a/drivers/tty/serial/8250/8250.h ++++ b/drivers/tty/serial/8250/8250.h +@@ -80,6 +80,7 @@ struct serial8250_config { + #define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: + * STOP PARITY EPAR SPAR WLEN5 WLEN6 + */ ++#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ + + #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ + #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ +--- a/drivers/tty/serial/8250/8250_port.c ++++ b/drivers/tty/serial/8250/8250_port.c +@@ -297,7 +297,7 @@ static const struct serial8250_config ua + .tx_loadsz = 16, + .fcr = UART_FCR_ENABLE_FIFO | + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, +- .flags = UART_CAP_FIFO, ++ .flags = UART_CAP_FIFO | UART_CAP_NMOD, + }, + [PORT_NPCM] = { + .name = "Nuvoton 16550", +@@ -2648,6 +2648,11 @@ serial8250_do_set_termios(struct uart_po + unsigned long flags; + unsigned int baud, quot, frac = 0; + ++ if (up->capabilities & UART_CAP_NMOD) { ++ termios->c_cflag = 0; ++ return; ++ } ++ + if (up->capabilities & UART_CAP_MINI) { + termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR); + if ((termios->c_cflag & CSIZE) == CS5 ||