Commit Graph

29 Commits (fec8fe806963c96a6506c2aebc3572d3a11f285f)

Author SHA1 Message Date
LoveSy 3a8efaef00 ramips: mmc: Fix init for MT7628AN
There is another thing about crc to do when initialize SD card on
MT7628.
This commit is to fix this init issue.

Signed-off-by: LoveSy <shana@zju.edu.cn>
6 years ago
Felix Fietkau 2601e34fad ramips: ethernet: disable fraglist support
The code has some remaining issues that cause ethernet hangs, so
disable it for now until we can get it fixed

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 0c285bd081 ramips: ethernet: use own page_frag_cache
Using the NAPI or netdev frag cache along with other drivers can lead to
32 KiB pages being held for a long time, despite only being used for
very few page fragment.
This can happen if the ethernet driver grabs one or two fragments for rx
ring refill, while other drivers use (and free up) the remaining
fragments. The 32 KiB higher-order page can only be freed once all users
have freed their fragments, which only happens after the rings of all
drivers holding the fragments have wrapped around.

Depending on the traffic patterns, this can waste a lot of memory and
look a lot like a memory leak

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 01df4a2565 ramips: ethernet: use skb_free_frag to free fragments
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 9a4253b81f ramips: improve ethernet driver performance with GRO/TSO
GRO stores packets as fraglist. If they are routed back to the ethernet
device, they need to be re-segmented if the driver does not support
sending fraglists.
Add the missing support for that, along with a missing feature flag that
allows full routed GRO->TSO offload.
Considerably reduces CPU utilization for routing

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Mathias Kresin 5da2c68d00 ramips: mt7621: fix mtu setting with kernel 4.14
Since kernel 4.10 commit 61e84623ace3 ("net: centralize net_device
min/max MTU checking"), the range of mtu is [min_mtu, max_mtu], which
is [68, 1500] by default.

It's necessary to set a max_mtu if a mtu > 1500 is supported.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Felix Fietkau ec502cd3fe ramips: rename ethernet driver folder to the same one that upstream uses
Preparation for sharing offload code with the mediatek target through
generic files/

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Rosen Penev 66cc6dd6c4 ramips: mmc: Add back some non-mt7621 code that staging removed
This reverts commit 8a570921b5.

This seems to have been accidentally reverted. This fixes mt7620 and
mt7628.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Daniel Golle <daniel@makrotopia.org>
6 years ago
John Crispin 8a570921b5 Revert "ramips: Add back some non-mt7621 code that staging removed"
This reverts commit 048e41f649.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Rosen Penev 048e41f649 ramips: Add back some non-mt7621 code that staging removed
Staging is meant only for mt7621 but for OpenWrt more is needed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Rosen Penev fec205f654 ramips: mmc: Sync with staging driver
Mostly whitespace cleanups. Some unneeded code was removed.

MMC init was also moved to the probe function as in
6069bdd

The cleanup commits are over 100, making it hard to do them individually.

Tested on GnuBee PC1 with an SD card being used as swap.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
v2: Fixed compile issue with mt7620
6 years ago
John Crispin 7e15e21766 Revert "ramips: mmc: Sync with staging drivers"
This reverts commit 2d401925b9.

Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
Wei Yongjun 87c254c87e staging: mt7621-eth: fix return value check in mt7621_gsw_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: f079b6406348 ("staging: mt7621-eth: add gigabit switch driver (GSW)")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years ago
Wei Yongjun edec251870 staging: mt7621-eth: fix return value check in mtk_connect_phy_node()
In case of error, the function of_phy_connect() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years ago
Wei Yongjun c4ae54dfab staging: mt7621-eth: fix return value check in mtk_probe()
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Fixes: e3cbf478f846 ("staging: mt7621-eth: add the drivers core files")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years ago
Rosen Penev 2d401925b9 ramips: mmc: Sync with staging drivers
Mostly whitespace cleanups. Some unneeded code was removed.

MMC init was also moved to the probe function as in
6069bdd087

The cleanup commits are over 100, making it hard to do them individually.

Tested on GnuBee PC1 with an SD card being used as swap.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Felix Fietkau 6069bdd087 ramips: move mtk-mmc init to probe function to avoid breaking NAND flash
The driver messes with the pin control settings - MMC and NAND are
mutually exclusive

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 173d93ea23 ramips: fix locking issues in the ethernet driver
The stats update needs to protect against being interrupted by a tasklet
The u64 stats seqlock needs to be initialized

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau ceff5d8c82 ramips: add missing unlock in fe_phy_link_adjust
Based on patch by Neil Brown

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
John Crispin bfed382540 ramips: fix build error caused by missing ifdef guard in hwnat code
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago
John Crispin 424a9ae128 ramips: implement hardware NAT offload for MT7621
Supports IPv4 flow offloading on MT7621 for Routing, SNAT and DNAT

Supported are regular ethernet->ethernet connections, including one
802.1q VLAN and/or PPPoE encapsulation

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
NeilBrown f27336e115 ramips: mtk-mmc: don't advertise highmem support.
of_dma_configure() sets a default ->dma_mask of
DMA_BIT_MASK(32), claiming devices can DMA from
the full 32bit address space.
The mtk-mmc driver does not support access to
highmem pages, so it is really limited to the
bottom 512M (actually 448M due to 64M of IO space).
Setting ->dma_mask to NULL causes mmc_setup_queue()
to fall-back to using BLK_BOUNCE_HIGH to tell the
block layer to use a bounce-buffer for any highmem
pages requiring IO.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 6a621f4bd9 ramips: fix BUG_ON on mtk-mmc driver probe
Our .dts files only have one device defined and this is unlikely to
change, so statically initialize host->id to 0.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau f9b2d369a6 ramips: move mtk-mmc driver code out of patches-*/ and into files-*/
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau a276002079 ramips: remove dead (and potentially crashy) code in mt7621 gsw init
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Felix Fietkau 147b679891 ramips: rename ethernet priv->device field to dev to match upstream
Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Pawel Dembicki 39b5218434 ramips: mt7620: power up ephy port 4
In some boards port 4 of mt7620 switch is powered down in bootloader
configuration as lan/wan package leak mitigation.

Reset ephy port 4 to default settings to power up the port.

Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
[clarify issue in commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Felix Fietkau 8a59f9590e ramips: fix MT7621 switch driver IRQ storm on init with linux 4.14
The hardware emits some interrupts while initializing and handling them
can mess up the state or cause infinite loops.
Fix this by disabling IRQs during init and re-enabling them afterwards

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Roman Yeryomin f4e5880d0f ramips: preliminary support for 4.14
- removed upstreamed patches
- 0901-spansion_nand_id_fix.patch is disabled, not clear if it's needed

Signed-off-by: Roman Yeryomin <roman@advem.lv>
Signed-off-by: John Crispin <john@phrozen.org>
6 years ago