mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 01:59:02 +00:00
8590531048
Manually rebased: bcm4908/patches-5.15/071-v6.1-0001-net-broadcom-bcm4908_enet-handle-EPROBE_DEFER-when-g.patch bcm53xx/patches-5.15/180-usb-xhci-add-support-for-performing-fake-doorbell.patch ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch[*] Removed upstreamed: backport-5.15/735-v6.5-net-bgmac-postpone-turning-IRQs-off-to-avoid-SoC-han.patch[1] backport-5.15/817-v6.5-01-leds-trigger-netdev-Recheck-NETDEV_LED_MODE_LINKUP-o.patch[2] pending-5.15/143-jffs2-reduce-stack-usage-in-jffs2_build_xattr_subsys.patch[3] pending-5.15/160-workqueue-fix-enum-type-for-gcc-13.patch[4] bcm53xx/patches-5.15/036-v6.5-0003-ARM-dts-BCM5301X-Drop-clock-names-from-the-SPI-node.patch[5] bcm53xx/patches-5.15/036-v6.5-0015-ARM-dts-BCM5301X-fix-duplex-full-full-duplex.patch[6] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=02474292a44205c1eb5a03634ead155a3c9134f4 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=86b93cbfe104e99fd3d25a49748b99fb88101573 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=79b9ab357b6f5675007f4c02ff8765cbd8dc06a2 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=d528faa9e828b9fc46dfb684a2a9fd8c2e860ed8 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=5899bc4058e89d5110a23797ff94439c53b77c25 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.123&id=95afd2c7c7d26087730dc938709e025a303e5499 Build system: x86/64 Build-tested: ramips/tplink_archer-a6-v3 Run-tested: ramips/tplink_archer-a6-v3 Co-authored-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John Audia <therealgraysky@proton.me> [rebased ipq40xx/patches-5.15/902-dts-ipq4019-ap-dk04.1.patch ] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
154 lines
4.8 KiB
Diff
154 lines
4.8 KiB
Diff
From 4e35e80750b33727e606be9e7ce447bde2e0deb7 Mon Sep 17 00:00:00 2001
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Tue, 7 Mar 2023 15:55:35 +0000
|
|
Subject: [PATCH 3/7] net: ethernet: mtk_eth_soc: rely on num_devs and remove
|
|
MTK_MAC_COUNT
|
|
|
|
Get rid of MTK_MAC_COUNT since it is a duplicated of eth->soc->num_devs.
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
|
---
|
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 30 ++++++++++-----------
|
|
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 -
|
|
2 files changed, 15 insertions(+), 16 deletions(-)
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -900,7 +900,7 @@ static void mtk_stats_update(struct mtk_
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->mac[i] || !eth->mac[i]->hw_stats)
|
|
continue;
|
|
if (spin_trylock(ð->mac[i]->hw_stats->stats_lock)) {
|
|
@@ -1403,7 +1403,7 @@ static int mtk_queue_stopped(struct mtk_
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->netdev[i])
|
|
continue;
|
|
if (netif_queue_stopped(eth->netdev[i]))
|
|
@@ -1417,7 +1417,7 @@ static void mtk_wake_queue(struct mtk_et
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->netdev[i])
|
|
continue;
|
|
netif_tx_wake_all_queues(eth->netdev[i]);
|
|
@@ -1908,7 +1908,7 @@ static int mtk_poll_rx(struct napi_struc
|
|
!(trxd.rxd4 & RX_DMA_SPECIAL_TAG))
|
|
mac = RX_DMA_GET_SPORT(trxd.rxd4) - 1;
|
|
|
|
- if (unlikely(mac < 0 || mac >= MTK_MAC_COUNT ||
|
|
+ if (unlikely(mac < 0 || mac >= eth->soc->num_devs ||
|
|
!eth->netdev[mac]))
|
|
goto release_desc;
|
|
|
|
@@ -2937,7 +2937,7 @@ static void mtk_dma_free(struct mtk_eth
|
|
const struct mtk_soc_data *soc = eth->soc;
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++)
|
|
+ for (i = 0; i < soc->num_devs; i++)
|
|
if (eth->netdev[i])
|
|
netdev_reset_queue(eth->netdev[i]);
|
|
if (eth->scratch_ring) {
|
|
@@ -3091,7 +3091,7 @@ static void mtk_gdm_config(struct mtk_et
|
|
if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
|
|
return;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
u32 val = mtk_r32(eth, MTK_GDMA_FWD_CFG(i));
|
|
|
|
/* default setup the forward port to send frame to PDMA */
|
|
@@ -3704,7 +3704,7 @@ static int mtk_hw_init(struct mtk_eth *e
|
|
* up with the more appropriate value when mtk_mac_config call is being
|
|
* invoked.
|
|
*/
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
struct net_device *dev = eth->netdev[i];
|
|
|
|
mtk_w32(eth, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(i));
|
|
@@ -3892,7 +3892,7 @@ static void mtk_pending_work(struct work
|
|
mtk_prepare_for_reset(eth);
|
|
|
|
/* stop all devices to make sure that dma is properly shut down */
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->netdev[i] || !netif_running(eth->netdev[i]))
|
|
continue;
|
|
|
|
@@ -3908,7 +3908,7 @@ static void mtk_pending_work(struct work
|
|
mtk_hw_init(eth, true);
|
|
|
|
/* restart DMA and enable IRQs */
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!test_bit(i, &restart))
|
|
continue;
|
|
|
|
@@ -3936,7 +3936,7 @@ static int mtk_free_dev(struct mtk_eth *
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->netdev[i])
|
|
continue;
|
|
free_netdev(eth->netdev[i]);
|
|
@@ -3955,7 +3955,7 @@ static int mtk_unreg_dev(struct mtk_eth
|
|
{
|
|
int i;
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
struct mtk_mac *mac;
|
|
if (!eth->netdev[i])
|
|
continue;
|
|
@@ -4259,7 +4259,7 @@ static int mtk_add_mac(struct mtk_eth *e
|
|
}
|
|
|
|
id = be32_to_cpup(_id);
|
|
- if (id >= MTK_MAC_COUNT) {
|
|
+ if (id >= eth->soc->num_devs) {
|
|
dev_err(eth->dev, "%d is not a valid mac id\n", id);
|
|
return -EINVAL;
|
|
}
|
|
@@ -4400,7 +4400,7 @@ void mtk_eth_set_dma_device(struct mtk_e
|
|
|
|
rtnl_lock();
|
|
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
dev = eth->netdev[i];
|
|
|
|
if (!dev || !(dev->flags & IFF_UP))
|
|
@@ -4727,7 +4727,7 @@ static int mtk_remove(struct platform_de
|
|
int i;
|
|
|
|
/* stop all devices to make sure that dma is properly shut down */
|
|
- for (i = 0; i < MTK_MAC_COUNT; i++) {
|
|
+ for (i = 0; i < eth->soc->num_devs; i++) {
|
|
if (!eth->netdev[i])
|
|
continue;
|
|
mtk_stop(eth->netdev[i]);
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
@@ -33,7 +33,6 @@
|
|
#define MTK_TX_DMA_BUF_LEN_V2 0xffff
|
|
#define MTK_QDMA_RING_SIZE 2048
|
|
#define MTK_DMA_SIZE 512
|
|
-#define MTK_MAC_COUNT 2
|
|
#define MTK_RX_ETH_HLEN (VLAN_ETH_HLEN + ETH_FCS_LEN)
|
|
#define MTK_RX_HLEN (NET_SKB_PAD + MTK_RX_ETH_HLEN + NET_IP_ALIGN)
|
|
#define MTK_DMA_DUMMY_DESC 0xffffffff
|