[OpenWrt-Devel] [RFC 0/9] Using the mainline mtk-eth-soc driver for MT7621

Bjørn Mork bjorn at mork.no
Mon Oct 15 06:24:54 EDT 2018


This is NOT READY for merge.

( This code can also be found in a github branch, in case you find that
  easier to review:
   https://github.com/bmork/LEDE/tree/mt7621-with-mainline-eth-driver )


Hoping for some early feedback in case what I am doing here is
completely out of the question. Which it very well might be...

The primary questions are:
 - Is it OK to rename the out-of-tree ramips ethernet directory to
   avoid conflict with the mainline mediatek ethernet drivers?
 - Is it OK to let the MT7621 use the mainline driver, while the rest
   of the ramips target still use the out-of-tree
 - If OK, is the method I use here fine, or is there some better way
   to create a split of this type?

My final goal is supporting MT7621 devices where the second ethernet
gmac is connected to something else than the internal switch.  I have
one such device, the ZyXEL WAP6805, with a Quantenna 5G module
connected by RGMII to the MT7621.  Patches for this device is included
primarily as an example of how the per-device driver change is done.

Using the mainline driver also means converting to DSA, similar to the
mediatek target.  So this also serves as an example of how that change
can be done (The recent discussion about DSA configration was the
trigger that made me submit this unfinished work now).  Note that this
is for new devices only. Support for migrating existing configs to DSA
is not (yet) part of this work.


The first two patches in the series can be safely ignored by anyone
not specifically interested in the ZyXEL WAP6805.  They only add basic
support for this device.

The 3rd patch renames the out-of-tree driver directory from "mediatek"
to "ramips" to enable this driver to co-exist with the mainline
driver.

Patch 4 imports all OpenWRT patches from the mediatek target, on the
assumption that the drivers for these two tagets should be kept in
sync.

Patch 5 has all the necessary magic to acually enable MT7621 support
in the mainline driver.  Please note how few these changes really are.

Patch 6 works around an issue where the ethernet devices would lock up
due to a sofirq busy loop. I'll admit that I don't full understand the
issue, or why it should affect this driver and not the out-of-tree
version.  But I wonder of this is really the issue seen by a number of
people reporting lockups and driver resets with MT7621?

Patch 7 modifies the mt7621.dtsi to be compatible with the mainline
driver, while keeping compatibility with the out-of-tree driver.

Patch 8 adds the mainline driver configuration as a virtual package,
enabling per-device switching from out-of-tree to mainline driver.

Patch 9 shows how the changes necessary to switch the WAP6805 device
to the mainline driver. This serves as documentation of the
process. Most of the patch concerns adding DSA support to the DTS.


Bjørn Mork (9):
  wap6805: add Mitrastar uImage tool
  wap6805: add board definition and DTS
  ramips: rename out-of-tree net driver to "ralink"
  mt7621: import mtk_eth_soc and mt7530 patches from the mediatek target
  mt7621: enable mainline driver
  mt7621: fix softirq loop
  mt7621: update dtsi
  mt7621 dsa: add virtual DSA kernel package
  wap6805: use mtk-eth-soc driver with DSA

 include/image-commands.mk                          |  10 +
 .../linux/ramips/base-files/etc/board.d/02_network |   3 +
 .../ramips/base-files/etc/board.d/03_gpio_switches |   3 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   6 +-
 target/linux/ramips/dts/WAP6805.dts                | 201 +++++
 target/linux/ramips/dts/mt7621.dtsi                |   5 +-
 .../drivers/net/ethernet/mediatek/Kconfig          |  70 --
 .../drivers/net/ethernet/mediatek/Makefile         |  22 -
 .../files-4.14/drivers/net/ethernet/ralink/Kconfig |  70 ++
 .../drivers/net/ethernet/ralink/Makefile           |  22 +
 .../net/ethernet/{mediatek => ralink}/esw_rt3050.c |   0
 .../net/ethernet/{mediatek => ralink}/esw_rt3050.h |   2 +-
 .../net/ethernet/{mediatek => ralink}/ethtool.c    |   0
 .../net/ethernet/{mediatek => ralink}/ethtool.h    |   0
 .../net/ethernet/{mediatek => ralink}/gsw_mt7620.c |   0
 .../net/ethernet/{mediatek => ralink}/gsw_mt7620.h |   0
 .../net/ethernet/{mediatek => ralink}/gsw_mt7621.c |   0
 .../net/ethernet/{mediatek => ralink}/mdio.c       |   2 +-
 .../net/ethernet/{mediatek => ralink}/mdio.h       |   2 +-
 .../ethernet/{mediatek => ralink}/mdio_mt7620.c    |   0
 .../ethernet/{mediatek => ralink}/mdio_rt2880.c    |   0
 .../ethernet/{mediatek => ralink}/mdio_rt2880.h    |   0
 .../net/ethernet/{mediatek => ralink}/mt7530.c     |   0
 .../net/ethernet/{mediatek => ralink}/mt7530.h     |   0
 .../ethernet/{mediatek => ralink}/mtk_debugfs.c    |   0
 .../ethernet/{mediatek => ralink}/mtk_eth_soc.c    |  12 +-
 .../ethernet/{mediatek => ralink}/mtk_eth_soc.h    |   0
 .../ethernet/{mediatek => ralink}/mtk_offload.c    |   6 +-
 .../ethernet/{mediatek => ralink}/mtk_offload.h    |   0
 .../net/ethernet/{mediatek => ralink}/soc_mt7620.c |   0
 .../net/ethernet/{mediatek => ralink}/soc_mt7621.c |   0
 .../net/ethernet/{mediatek => ralink}/soc_rt2880.c |   0
 .../net/ethernet/{mediatek => ralink}/soc_rt3050.c |   0
 .../net/ethernet/{mediatek => ralink}/soc_rt3883.c |   0
 target/linux/ramips/image/mt7621.mk                |  25 +-
 target/linux/ramips/modules.mk                     |  26 +
 target/linux/ramips/mt7620/config-4.14             |  14 +-
 target/linux/ramips/mt7621/config-4.14             |  13 +-
 target/linux/ramips/mt76x8/config-4.14             |  10 +-
 .../0027-net-next-mediatek-fix-DQL-support.patch   |  92 ++
 ...iatek-add-support-for-GMAC2-wired-to-ext-.patch |  26 +
 .../ramips/patches-4.14/0033-dsa-multi-cpu.patch   | 268 ++++++
 ...5-net-mediatek-disable-RX-VLan-offloading.patch |  47 +
 ...diatek-honour-special-tag-bit-inside-RX-D.patch |  50 ++
 ...diatek-enable-special-tag-indication-for-.patch |  41 +
 ...a-mediatek-tell-GDMA-when-we-are-turning-.patch |  43 +
 .../0046-net-mediatek-add-irq-delay.patch          |  21 +
 .../0051-net-mediatek-increase-tx_timeout.patch    |  21 +
 .../ramips/patches-4.14/0062-mdio-atomic.patch     |  14 +
 .../ramips/patches-4.14/0063-atomic-sleep.patch    |  46 +
 ...k-remove-superfluous-pin-setup-for-MT7622.patch | 102 +++
 .../ramips/patches-4.14/2200-mt7621-eth-dsa.patch  | 121 +++
 .../2201-mt7621-eth-fix-napi-int.patch             |  22 +
 .../patches-4.14/700-add-net-ethernet-ralink.patch |  20 +
 target/linux/ramips/rt288x/config-4.14             |  10 +-
 target/linux/ramips/rt305x/config-4.14             |   8 +-
 target/linux/ramips/rt3883/config-4.14             |  10 +-
 tools/firmware-utils/Makefile                      |   1 +
 tools/firmware-utils/src/mkmitrastar.c             | 958 +++++++++++++++++++++
 60 files changed, 2307 insertions(+), 141 deletions(-)
 create mode 100644 target/linux/ramips/dts/WAP6805.dts
 delete mode 100644 target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Kconfig
 delete mode 100644 target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/Makefile
 create mode 100644 target/linux/ramips/files-4.14/drivers/net/ethernet/ralink/Kconfig
 create mode 100644 target/linux/ramips/files-4.14/drivers/net/ethernet/ralink/Makefile
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/esw_rt3050.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/esw_rt3050.h (95%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/ethtool.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/ethtool.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/gsw_mt7620.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/gsw_mt7620.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/gsw_mt7621.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mdio.c (98%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mdio.h (96%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mdio_mt7620.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mdio_rt2880.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mdio_rt2880.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mt7530.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mt7530.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mtk_debugfs.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mtk_eth_soc.c (99%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mtk_eth_soc.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mtk_offload.c (99%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/mtk_offload.h (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/soc_mt7620.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/soc_mt7621.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/soc_rt2880.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/soc_rt3050.c (100%)
 rename target/linux/ramips/files-4.14/drivers/net/ethernet/{mediatek => ralink}/soc_rt3883.c (100%)
 create mode 100644 target/linux/ramips/patches-4.14/0027-net-next-mediatek-fix-DQL-support.patch
 create mode 100644 target/linux/ramips/patches-4.14/0032-net-dsa-mediatek-add-support-for-GMAC2-wired-to-ext-.patch
 create mode 100644 target/linux/ramips/patches-4.14/0033-dsa-multi-cpu.patch
 create mode 100644 target/linux/ramips/patches-4.14/0035-net-mediatek-disable-RX-VLan-offloading.patch
 create mode 100644 target/linux/ramips/patches-4.14/0042-net-next-mediatek-honour-special-tag-bit-inside-RX-D.patch
 create mode 100644 target/linux/ramips/patches-4.14/0043-net-next-mediatek-enable-special-tag-indication-for-.patch
 create mode 100644 target/linux/ramips/patches-4.14/0044-net-next-dsa-mediatek-tell-GDMA-when-we-are-turning-.patch
 create mode 100644 target/linux/ramips/patches-4.14/0046-net-mediatek-add-irq-delay.patch
 create mode 100644 target/linux/ramips/patches-4.14/0051-net-mediatek-increase-tx_timeout.patch
 create mode 100644 target/linux/ramips/patches-4.14/0062-mdio-atomic.patch
 create mode 100644 target/linux/ramips/patches-4.14/0063-atomic-sleep.patch
 create mode 100644 target/linux/ramips/patches-4.14/0175-net-mediatek-remove-superfluous-pin-setup-for-MT7622.patch
 create mode 100644 target/linux/ramips/patches-4.14/2200-mt7621-eth-dsa.patch
 create mode 100644 target/linux/ramips/patches-4.14/2201-mt7621-eth-fix-napi-int.patch
 create mode 100644 target/linux/ramips/patches-4.14/700-add-net-ethernet-ralink.patch
 create mode 100644 tools/firmware-utils/src/mkmitrastar.c

-- 
2.11.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list