mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-31 16:35:44 +00:00
kernel: bump 5.15 to 5.15.115
Manually rebased:
backport-5.15/603-v5.19-page_pool-Add-recycle-stats-to-page_pool_put_page_bu.patch
pending-5.15/723-net-mt7531-ensure-all-MACs-are-powered-down-before-r.patch*
Removed upstreamed:
generic-backport/610-v6.3-net-page_pool-use-in_softirq-instead.patch[1]
backport-5.15/705-12-v6.0-net-dsa-mt7530-rework-mt753-01-_setup.patch[2]
backport-5.15/790-v6.4-0010-net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch[3]
backport-5.15/703-10-v5.16-net-dsa-introduce-helpers-for-iterating-through-port.patch[4]
All other patches automatically rebased.
* Modified to define the variable i as suggested by DragonBluep in PR discussion.
See: https://github.com/openwrt/openwrt/pull/12823#issuecomment-1578518576
1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=3af319d5147454dc63665ef451229c674b538377
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=0753c1ef24194580f7165ae6e259b59a851392f2
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.115&id=5a7266feaa6d708fc6880a161786eaa884ef3c8e
4. 9902f91cf6
Build system: x86_64
Build-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Run-tested: bcm2711/RPi4B, ramips/tplink_archer-a6-v3, filogic/xiaomi_redmi-router-ax6000-ubootmod
Signed-off-by: John Audia <therealgraysky@proton.me>
This commit is contained in:
parent
bcdf861519
commit
5714660643
@ -1,2 +1,2 @@
|
||||
LINUX_VERSION-5.15 = .114
|
||||
LINUX_KERNEL_HASH-5.15.114 = e981ea5d219f77735bf5a3f7e84a8af578df8ac3e1c4ff1b0649e2b0795277d2
|
||||
LINUX_VERSION-5.15 = .115
|
||||
LINUX_KERNEL_HASH-5.15.115 = 1b076860779235e90519e867c1ec78c7a34d1125d8fdba787ff495c7c14f1214
|
||||
|
@ -87,9 +87,9 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
help
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -26,6 +26,13 @@
|
||||
|
||||
#define BIAS_MAX LONG_MAX
|
||||
@@ -49,6 +49,13 @@ static void page_pool_producer_unlock(st
|
||||
spin_unlock_bh(&pool->ring.producer_lock);
|
||||
}
|
||||
|
||||
+#ifdef CONFIG_PAGE_POOL_STATS
|
||||
+/* alloc_stat_inc is intended to be used in softirq context */
|
||||
@ -101,7 +101,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static int page_pool_init(struct page_pool *pool,
|
||||
const struct page_pool_params *params)
|
||||
{
|
||||
@@ -117,8 +124,10 @@ static struct page *page_pool_refill_all
|
||||
@@ -140,8 +147,10 @@ static struct page *page_pool_refill_all
|
||||
int pref_nid; /* preferred NUMA node */
|
||||
|
||||
/* Quicker fallback, avoid locks when ring is empty */
|
||||
@ -113,7 +113,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
/* Softirq guarantee CPU and thus NUMA node is stable. This,
|
||||
* assumes CPU refilling driver RX-ring will also run RX-NAPI.
|
||||
@@ -148,14 +157,17 @@ static struct page *page_pool_refill_all
|
||||
@@ -171,14 +180,17 @@ static struct page *page_pool_refill_all
|
||||
* This limit stress on page buddy alloactor.
|
||||
*/
|
||||
page_pool_return_page(pool, page);
|
||||
@ -132,7 +132,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
spin_unlock(&r->consumer_lock);
|
||||
return page;
|
||||
@@ -170,6 +182,7 @@ static struct page *__page_pool_get_cach
|
||||
@@ -193,6 +205,7 @@ static struct page *__page_pool_get_cach
|
||||
if (likely(pool->alloc.count)) {
|
||||
/* Fast-path */
|
||||
page = pool->alloc.cache[--pool->alloc.count];
|
||||
@ -140,7 +140,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
} else {
|
||||
page = page_pool_refill_alloc_cache(pool);
|
||||
}
|
||||
@@ -241,6 +254,7 @@ static struct page *__page_pool_alloc_pa
|
||||
@@ -264,6 +277,7 @@ static struct page *__page_pool_alloc_pa
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
page_pool_set_pp_info(pool, page);
|
||||
|
||||
/* Track how many pages are held 'in-flight' */
|
||||
@@ -295,10 +309,12 @@ static struct page *__page_pool_alloc_pa
|
||||
@@ -318,10 +332,12 @@ static struct page *__page_pool_alloc_pa
|
||||
}
|
||||
|
||||
/* Return last page */
|
||||
|
@ -53,7 +53,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
/* A page_pool is strictly tied to a single RX-queue being
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -29,8 +29,15 @@
|
||||
@@ -52,8 +52,15 @@ static void page_pool_producer_unlock(st
|
||||
#ifdef CONFIG_PAGE_POOL_STATS
|
||||
/* alloc_stat_inc is intended to be used in softirq context */
|
||||
#define alloc_stat_inc(pool, __stat) (pool->alloc_stats.__stat++)
|
||||
@ -69,7 +69,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
#endif
|
||||
|
||||
static int page_pool_init(struct page_pool *pool,
|
||||
@@ -80,6 +87,12 @@ static int page_pool_init(struct page_po
|
||||
@@ -103,6 +110,12 @@ static int page_pool_init(struct page_po
|
||||
pool->p.flags & PP_FLAG_PAGE_FRAG)
|
||||
return -EINVAL;
|
||||
|
||||
@ -82,7 +82,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if (ptr_ring_init(&pool->ring, ring_qsize, GFP_KERNEL) < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -412,7 +425,12 @@ static bool page_pool_recycle_in_ring(st
|
||||
@@ -435,7 +448,12 @@ static bool page_pool_recycle_in_ring(st
|
||||
else
|
||||
ret = ptr_ring_produce_bh(&pool->ring, page);
|
||||
|
||||
@ -96,7 +96,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
}
|
||||
|
||||
/* Only allow direct recycling in special circumstances, into the
|
||||
@@ -423,11 +441,14 @@ static bool page_pool_recycle_in_ring(st
|
||||
@@ -446,11 +464,14 @@ static bool page_pool_recycle_in_ring(st
|
||||
static bool page_pool_recycle_in_cache(struct page *page,
|
||||
struct page_pool *pool)
|
||||
{
|
||||
@ -112,7 +112,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -482,6 +503,7 @@ __page_pool_put_page(struct page_pool *p
|
||||
@@ -505,6 +526,7 @@ __page_pool_put_page(struct page_pool *p
|
||||
* doing refcnt based recycle tricks, meaning another process
|
||||
* will be invoking put_page.
|
||||
*/
|
||||
@ -120,7 +120,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
/* Do not replace this with page_pool_return_page() */
|
||||
page_pool_release_page(pool, page);
|
||||
put_page(page);
|
||||
@@ -495,6 +517,7 @@ void page_pool_put_page(struct page_pool
|
||||
@@ -518,6 +540,7 @@ void page_pool_put_page(struct page_pool
|
||||
page = __page_pool_put_page(pool, page, dma_sync_size, allow_direct);
|
||||
if (page && !page_pool_recycle_in_ring(pool, page)) {
|
||||
/* Cache full, fallback to free pages */
|
||||
@ -128,7 +128,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
page_pool_return_page(pool, page);
|
||||
}
|
||||
}
|
||||
@@ -641,6 +664,9 @@ static void page_pool_free(struct page_p
|
||||
@@ -665,6 +688,9 @@ static void page_pool_free(struct page_p
|
||||
if (pool->p.flags & PP_FLAG_DMA_MAP)
|
||||
put_device(pool->p.dev);
|
||||
|
||||
|
@ -43,7 +43,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
struct page_pool {
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -35,6 +35,31 @@
|
||||
@@ -58,6 +58,31 @@ static void page_pool_producer_unlock(st
|
||||
struct page_pool_recycle_stats __percpu *s = pool->recycle_stats; \
|
||||
this_cpu_inc(s->__stat); \
|
||||
} while (0)
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -36,6 +36,12 @@
|
||||
@@ -59,6 +59,12 @@ static void page_pool_producer_unlock(st
|
||||
this_cpu_inc(s->__stat); \
|
||||
} while (0)
|
||||
|
||||
@ -29,7 +29,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
bool page_pool_get_stats(struct page_pool *pool,
|
||||
struct page_pool_stats *stats)
|
||||
{
|
||||
@@ -63,6 +69,7 @@ EXPORT_SYMBOL(page_pool_get_stats);
|
||||
@@ -86,6 +92,7 @@ EXPORT_SYMBOL(page_pool_get_stats);
|
||||
#else
|
||||
#define alloc_stat_inc(pool, __stat)
|
||||
#define recycle_stat_inc(pool, __stat)
|
||||
@ -37,9 +37,9 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
#endif
|
||||
|
||||
static int page_pool_init(struct page_pool *pool,
|
||||
@@ -569,9 +576,13 @@ void page_pool_put_page_bulk(struct page
|
||||
@@ -593,9 +600,13 @@ void page_pool_put_page_bulk(struct page
|
||||
/* Bulk producer into ptr_ring page_pool cache */
|
||||
page_pool_ring_lock(pool);
|
||||
in_softirq = page_pool_producer_lock(pool);
|
||||
for (i = 0; i < bulk_len; i++) {
|
||||
- if (__ptr_ring_produce(&pool->ring, data[i]))
|
||||
- break; /* ring full */
|
||||
@ -50,6 +50,6 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
+ }
|
||||
}
|
||||
+ recycle_stat_add(pool, ring, i);
|
||||
page_pool_ring_unlock(pool);
|
||||
page_pool_producer_unlock(pool, in_softirq);
|
||||
|
||||
/* Hopefully all pages was return into ptr_ring */
|
||||
|
@ -62,7 +62,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
#include <trace/events/page_pool.h>
|
||||
|
||||
@@ -42,6 +43,20 @@
|
||||
@@ -65,6 +66,20 @@ static void page_pool_producer_unlock(st
|
||||
this_cpu_add(s->__stat, val); \
|
||||
} while (0)
|
||||
|
||||
@ -83,7 +83,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
bool page_pool_get_stats(struct page_pool *pool,
|
||||
struct page_pool_stats *stats)
|
||||
{
|
||||
@@ -50,7 +65,13 @@ bool page_pool_get_stats(struct page_poo
|
||||
@@ -73,7 +88,13 @@ bool page_pool_get_stats(struct page_poo
|
||||
if (!stats)
|
||||
return false;
|
||||
|
||||
@ -98,7 +98,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
const struct page_pool_recycle_stats *pcpu =
|
||||
@@ -66,6 +87,46 @@ bool page_pool_get_stats(struct page_poo
|
||||
@@ -89,6 +110,46 @@ bool page_pool_get_stats(struct page_poo
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(page_pool_get_stats);
|
||||
|
@ -48,7 +48,7 @@ Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
int xdp_rxq_info_reg(struct xdp_rxq_info *xdp_rxq,
|
||||
--- a/net/core/xdp.c
|
||||
+++ b/net/core/xdp.c
|
||||
@@ -376,12 +376,38 @@ static void __xdp_return(void *data, str
|
||||
@@ -409,12 +409,38 @@ static void __xdp_return(void *data, str
|
||||
|
||||
void xdp_return_frame(struct xdp_frame *xdpf)
|
||||
{
|
||||
@ -87,7 +87,7 @@ Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
__xdp_return(xdpf->data, &xdpf->mem, true, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(xdp_return_frame_rx_napi);
|
||||
@@ -417,7 +443,7 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
@@ -450,7 +476,7 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
struct xdp_mem_allocator *xa;
|
||||
|
||||
if (mem->type != MEM_TYPE_PAGE_POOL) {
|
||||
@ -96,7 +96,7 @@ Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -436,12 +462,38 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
@@ -469,12 +495,38 @@ void xdp_return_frame_bulk(struct xdp_fr
|
||||
bq->xa = rhashtable_lookup(mem_id_ht, &mem->id, mem_id_rht_params);
|
||||
}
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
From: Qingfang DENG <qingfang.deng@siflower.com.cn>
|
||||
Date: Fri, 3 Feb 2023 09:16:11 +0800
|
||||
Subject: [PATCH] net: page_pool: use in_softirq() instead
|
||||
|
||||
We use BH context only for synchronization, so we don't care if it's
|
||||
actually serving softirq or not.
|
||||
|
||||
As a side node, in case of threaded NAPI, in_serving_softirq() will
|
||||
return false because it's in process context with BH off, making
|
||||
page_pool_recycle_in_cache() unreachable.
|
||||
|
||||
Signed-off-by: Qingfang DENG <qingfang.deng@siflower.com.cn>
|
||||
---
|
||||
|
||||
--- a/include/net/page_pool.h
|
||||
+++ b/include/net/page_pool.h
|
||||
@@ -357,7 +357,7 @@ static inline void page_pool_nid_changed
|
||||
static inline void page_pool_ring_lock(struct page_pool *pool)
|
||||
__acquires(&pool->ring.producer_lock)
|
||||
{
|
||||
- if (in_serving_softirq())
|
||||
+ if (in_softirq())
|
||||
spin_lock(&pool->ring.producer_lock);
|
||||
else
|
||||
spin_lock_bh(&pool->ring.producer_lock);
|
||||
@@ -366,7 +366,7 @@ static inline void page_pool_ring_lock(s
|
||||
static inline void page_pool_ring_unlock(struct page_pool *pool)
|
||||
__releases(&pool->ring.producer_lock)
|
||||
{
|
||||
- if (in_serving_softirq())
|
||||
+ if (in_softirq())
|
||||
spin_unlock(&pool->ring.producer_lock);
|
||||
else
|
||||
spin_unlock_bh(&pool->ring.producer_lock);
|
||||
--- a/net/core/page_pool.c
|
||||
+++ b/net/core/page_pool.c
|
||||
@@ -512,8 +512,8 @@ static void page_pool_return_page(struct
|
||||
static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
|
||||
{
|
||||
int ret;
|
||||
- /* BH protection not needed if current is serving softirq */
|
||||
- if (in_serving_softirq())
|
||||
+ /* BH protection not needed if current is softirq */
|
||||
+ if (in_softirq())
|
||||
ret = ptr_ring_produce(&pool->ring, page);
|
||||
else
|
||||
ret = ptr_ring_produce_bh(&pool->ring, page);
|
||||
@@ -576,7 +576,7 @@ __page_pool_put_page(struct page_pool *p
|
||||
page_pool_dma_sync_for_device(pool, page,
|
||||
dma_sync_size);
|
||||
|
||||
- if (allow_direct && in_serving_softirq() &&
|
||||
+ if (allow_direct && in_softirq() &&
|
||||
page_pool_recycle_in_cache(page, pool))
|
||||
return NULL;
|
||||
|
@ -94,7 +94,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
/*
|
||||
* Configuration data for this switch.
|
||||
*/
|
||||
@@ -584,6 +589,13 @@ struct dsa_switch_ops {
|
||||
@@ -612,6 +617,13 @@ struct dsa_switch_ops {
|
||||
enum dsa_tag_protocol mprot);
|
||||
int (*change_tag_protocol)(struct dsa_switch *ds, int port,
|
||||
enum dsa_tag_protocol proto);
|
||||
|
@ -26,7 +26,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/include/net/dsa.h
|
||||
+++ b/include/net/dsa.h
|
||||
@@ -626,6 +626,8 @@ struct dsa_switch_ops {
|
||||
@@ -654,6 +654,8 @@ struct dsa_switch_ops {
|
||||
/*
|
||||
* PHYLINK integration
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/include/net/dsa.h
|
||||
+++ b/include/net/dsa.h
|
||||
@@ -626,8 +626,8 @@ struct dsa_switch_ops {
|
||||
@@ -654,8 +654,8 @@ struct dsa_switch_ops {
|
||||
/*
|
||||
* PHYLINK integration
|
||||
*/
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/include/net/dsa.h
|
||||
+++ b/include/net/dsa.h
|
||||
@@ -631,6 +631,9 @@ struct dsa_switch_ops {
|
||||
@@ -659,6 +659,9 @@ struct dsa_switch_ops {
|
||||
void (*phylink_validate)(struct dsa_switch *ds, int port,
|
||||
unsigned long *supported,
|
||||
struct phylink_link_state *state);
|
||||
|
@ -1,68 +0,0 @@
|
||||
From 82b318983c515f29b8b3a0dad9f6a5fe8a68a7f4 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Date: Wed, 20 Oct 2021 20:49:49 +0300
|
||||
Subject: [PATCH] net: dsa: introduce helpers for iterating through ports using
|
||||
dp
|
||||
|
||||
Since the DSA conversion from the ds->ports array into the dst->ports
|
||||
list, the DSA API has encouraged driver writers, as well as the core
|
||||
itself, to write inefficient code.
|
||||
|
||||
Currently, code that wants to filter by a specific type of port when
|
||||
iterating, like {!unused, user, cpu, dsa}, uses the dsa_is_*_port helper.
|
||||
Under the hood, this uses dsa_to_port which iterates again through
|
||||
dst->ports. But the driver iterates through the port list already, so
|
||||
the complexity is quadratic for the typical case of a single-switch
|
||||
tree.
|
||||
|
||||
This patch introduces some iteration helpers where the iterator is
|
||||
already a struct dsa_port *dp, so that the other variant of the
|
||||
filtering functions, dsa_port_is_{unused,user,cpu_dsa}, can be used
|
||||
directly on the iterator. This eliminates the second lookup.
|
||||
|
||||
These functions can be used both by the core and by drivers.
|
||||
|
||||
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
include/net/dsa.h | 28 ++++++++++++++++++++++++++++
|
||||
1 file changed, 28 insertions(+)
|
||||
|
||||
--- a/include/net/dsa.h
|
||||
+++ b/include/net/dsa.h
|
||||
@@ -476,6 +476,34 @@ static inline bool dsa_is_user_port(stru
|
||||
return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_USER;
|
||||
}
|
||||
|
||||
+#define dsa_tree_for_each_user_port(_dp, _dst) \
|
||||
+ list_for_each_entry((_dp), &(_dst)->ports, list) \
|
||||
+ if (dsa_port_is_user((_dp)))
|
||||
+
|
||||
+#define dsa_switch_for_each_port(_dp, _ds) \
|
||||
+ list_for_each_entry((_dp), &(_ds)->dst->ports, list) \
|
||||
+ if ((_dp)->ds == (_ds))
|
||||
+
|
||||
+#define dsa_switch_for_each_port_safe(_dp, _next, _ds) \
|
||||
+ list_for_each_entry_safe((_dp), (_next), &(_ds)->dst->ports, list) \
|
||||
+ if ((_dp)->ds == (_ds))
|
||||
+
|
||||
+#define dsa_switch_for_each_port_continue_reverse(_dp, _ds) \
|
||||
+ list_for_each_entry_continue_reverse((_dp), &(_ds)->dst->ports, list) \
|
||||
+ if ((_dp)->ds == (_ds))
|
||||
+
|
||||
+#define dsa_switch_for_each_available_port(_dp, _ds) \
|
||||
+ dsa_switch_for_each_port((_dp), (_ds)) \
|
||||
+ if (!dsa_port_is_unused((_dp)))
|
||||
+
|
||||
+#define dsa_switch_for_each_user_port(_dp, _ds) \
|
||||
+ dsa_switch_for_each_port((_dp), (_ds)) \
|
||||
+ if (dsa_port_is_user((_dp)))
|
||||
+
|
||||
+#define dsa_switch_for_each_cpu_port(_dp, _ds) \
|
||||
+ dsa_switch_for_each_port((_dp), (_ds)) \
|
||||
+ if (dsa_port_is_cpu((_dp)))
|
||||
+
|
||||
static inline u32 dsa_user_ports(struct dsa_switch *ds)
|
||||
{
|
||||
u32 mask = 0;
|
@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2412,6 +2412,32 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
@@ -2444,6 +2444,32 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static bool
|
||||
mt7530_phy_mode_supported(struct dsa_switch *ds, int port,
|
||||
const struct phylink_link_state *state)
|
||||
@@ -2448,6 +2474,37 @@ static bool mt7531_is_rgmii_port(struct
|
||||
@@ -2480,6 +2506,37 @@ static bool mt7531_is_rgmii_port(struct
|
||||
return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static bool
|
||||
mt7531_phy_mode_supported(struct dsa_switch *ds, int port,
|
||||
const struct phylink_link_state *state)
|
||||
@@ -2924,6 +2981,18 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
@@ -2956,6 +3013,18 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static void
|
||||
mt7530_mac_port_validate(struct dsa_switch *ds, int port,
|
||||
unsigned long *supported)
|
||||
@@ -3159,6 +3228,7 @@ static const struct dsa_switch_ops mt753
|
||||
@@ -3191,6 +3260,7 @@ static const struct dsa_switch_ops mt753
|
||||
.port_vlan_del = mt7530_port_vlan_del,
|
||||
.port_mirror_add = mt753x_port_mirror_add,
|
||||
.port_mirror_del = mt753x_port_mirror_del,
|
||||
@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.phylink_validate = mt753x_phylink_validate,
|
||||
.phylink_mac_link_state = mt753x_phylink_mac_link_state,
|
||||
.phylink_mac_config = mt753x_phylink_mac_config,
|
||||
@@ -3176,6 +3246,7 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3208,6 +3278,7 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_read = mt7530_phy_read,
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
@ -129,7 +129,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.phy_mode_supported = mt7530_phy_mode_supported,
|
||||
.mac_port_validate = mt7530_mac_port_validate,
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
@@ -3187,6 +3258,7 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3219,6 +3290,7 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_read = mt7530_phy_read,
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
@ -137,7 +137,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.phy_mode_supported = mt7530_phy_mode_supported,
|
||||
.mac_port_validate = mt7530_mac_port_validate,
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
@@ -3199,6 +3271,7 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3231,6 +3303,7 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_write = mt7531_ind_phy_write,
|
||||
.pad_setup = mt7531_pad_setup,
|
||||
.cpu_port_config = mt7531_cpu_port_config,
|
||||
@ -145,7 +145,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.phy_mode_supported = mt7531_phy_mode_supported,
|
||||
.mac_port_validate = mt7531_mac_port_validate,
|
||||
.mac_port_get_state = mt7531_phylink_mac_link_state,
|
||||
@@ -3261,6 +3334,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3293,6 +3366,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
*/
|
||||
if (!priv->info->sw_setup || !priv->info->pad_setup ||
|
||||
!priv->info->phy_read || !priv->info->phy_write ||
|
||||
|
@ -21,7 +21,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2438,37 +2438,6 @@ static void mt7530_mac_port_get_caps(str
|
||||
@@ -2470,37 +2470,6 @@ static void mt7530_mac_port_get_caps(str
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static bool mt7531_is_rgmii_port(struct mt7530_priv *priv, u32 port)
|
||||
{
|
||||
return (port == 5) && (priv->p5_intf_sel != P5_INTF_SEL_GMAC5_SGMII);
|
||||
@@ -2505,44 +2474,6 @@ static void mt7531_mac_port_get_caps(str
|
||||
@@ -2537,44 +2506,6 @@ static void mt7531_mac_port_get_caps(str
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static int
|
||||
mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state)
|
||||
{
|
||||
@@ -2797,9 +2728,6 @@ mt753x_phylink_mac_config(struct dsa_swi
|
||||
@@ -2829,9 +2760,6 @@ mt753x_phylink_mac_config(struct dsa_swi
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
u32 mcr_cur, mcr_new;
|
||||
|
||||
@ -114,7 +114,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
switch (port) {
|
||||
case 0 ... 4: /* Internal phy */
|
||||
if (state->interface != PHY_INTERFACE_MODE_GMII)
|
||||
@@ -3015,12 +2943,6 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
@@ -3047,12 +2975,6 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
|
||||
@ -127,7 +127,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
phylink_set_port_modes(mask);
|
||||
|
||||
if (state->interface != PHY_INTERFACE_MODE_TRGMII &&
|
||||
@@ -3247,7 +3169,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3279,7 +3201,6 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
.mac_port_get_caps = mt7530_mac_port_get_caps,
|
||||
@ -135,7 +135,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_validate = mt7530_mac_port_validate,
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
.mac_port_config = mt7530_mac_config,
|
||||
@@ -3259,7 +3180,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3291,7 +3212,6 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
.mac_port_get_caps = mt7530_mac_port_get_caps,
|
||||
@ -143,7 +143,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_validate = mt7530_mac_port_validate,
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
.mac_port_config = mt7530_mac_config,
|
||||
@@ -3272,7 +3192,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3304,7 +3224,6 @@ static const struct mt753x_info mt753x_t
|
||||
.pad_setup = mt7531_pad_setup,
|
||||
.cpu_port_config = mt7531_cpu_port_config,
|
||||
.mac_port_get_caps = mt7531_mac_port_get_caps,
|
||||
@ -151,7 +151,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_validate = mt7531_mac_port_validate,
|
||||
.mac_port_get_state = mt7531_phylink_mac_link_state,
|
||||
.mac_port_config = mt7531_mac_config,
|
||||
@@ -3335,7 +3254,6 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3367,7 +3286,6 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
if (!priv->info->sw_setup || !priv->info->pad_setup ||
|
||||
!priv->info->phy_read || !priv->info->phy_write ||
|
||||
!priv->info->mac_port_get_caps ||
|
||||
|
@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2967,11 +2967,6 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
@@ -2999,11 +2999,6 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
|
||||
linkmode_and(supported, supported, mask);
|
||||
linkmode_and(state->advertising, state->advertising, mask);
|
||||
|
@ -23,7 +23,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2545,12 +2545,13 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
@@ -2577,12 +2577,13 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
}
|
||||
|
||||
static void mt7531_sgmii_validate(struct mt7530_priv *priv, int port,
|
||||
@ -38,7 +38,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
phylink_set(supported, 2500baseX_Full);
|
||||
phylink_set(supported, 2500baseT_Full);
|
||||
}
|
||||
@@ -2923,16 +2924,18 @@ static void mt753x_phylink_get_caps(stru
|
||||
@@ -2955,16 +2956,18 @@ static void mt753x_phylink_get_caps(stru
|
||||
|
||||
static void
|
||||
mt7530_mac_port_validate(struct dsa_switch *ds, int port,
|
||||
@ -58,7 +58,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2955,12 +2958,13 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
@@ -2987,12 +2990,13 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
}
|
||||
|
||||
/* This switch only supports 1G full-duplex. */
|
||||
|
@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2544,19 +2544,6 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
@@ -2576,19 +2576,6 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static void
|
||||
mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port,
|
||||
unsigned int mode, phy_interface_t interface,
|
||||
@@ -2923,51 +2910,21 @@ static void mt753x_phylink_get_caps(stru
|
||||
@@ -2955,51 +2942,21 @@ static void mt753x_phylink_get_caps(stru
|
||||
}
|
||||
|
||||
static void
|
||||
@ -97,7 +97,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
linkmode_and(supported, supported, mask);
|
||||
linkmode_and(state->advertising, state->advertising, mask);
|
||||
@@ -3168,7 +3125,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3200,7 +3157,6 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
.mac_port_get_caps = mt7530_mac_port_get_caps,
|
||||
@ -105,7 +105,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
.mac_port_config = mt7530_mac_config,
|
||||
},
|
||||
@@ -3179,7 +3135,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3211,7 +3167,6 @@ static const struct mt753x_info mt753x_t
|
||||
.phy_write = mt7530_phy_write,
|
||||
.pad_setup = mt7530_pad_clk_setup,
|
||||
.mac_port_get_caps = mt7530_mac_port_get_caps,
|
||||
@ -113,7 +113,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_get_state = mt7530_phylink_mac_link_state,
|
||||
.mac_port_config = mt7530_mac_config,
|
||||
},
|
||||
@@ -3191,7 +3146,6 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3223,7 +3178,6 @@ static const struct mt753x_info mt753x_t
|
||||
.pad_setup = mt7531_pad_setup,
|
||||
.cpu_port_config = mt7531_cpu_port_config,
|
||||
.mac_port_get_caps = mt7531_mac_port_get_caps,
|
||||
@ -121,7 +121,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.mac_port_get_state = mt7531_phylink_mac_link_state,
|
||||
.mac_port_config = mt7531_mac_config,
|
||||
.mac_pcs_an_restart = mt7531_sgmii_restart_an,
|
||||
@@ -3253,7 +3207,6 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3285,7 +3239,6 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
if (!priv->info->sw_setup || !priv->info->pad_setup ||
|
||||
!priv->info->phy_read || !priv->info->phy_write ||
|
||||
!priv->info->mac_port_get_caps ||
|
||||
|
@ -33,7 +33,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
/* String, offset, and register size in bytes if different from 4 bytes */
|
||||
static const struct mt7530_mib_desc mt7530_mib[] = {
|
||||
MIB_DESC(1, 0x00, "TxDrop"),
|
||||
@@ -2544,12 +2549,11 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
@@ -2576,12 +2581,11 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
unsigned int val;
|
||||
|
||||
/* For adjusting speed and duplex of SGMII force mode. */
|
||||
@@ -2575,6 +2579,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw
|
||||
@@ -2607,6 +2611,9 @@ mt7531_sgmii_link_up_force(struct dsa_sw
|
||||
|
||||
/* MT7531 SGMII 1G force mode can only work in full duplex mode,
|
||||
* no matter MT7531_SGMII_FORCE_HALF_DUPLEX is set or not.
|
||||
@ -60,7 +60,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
*/
|
||||
if ((speed == SPEED_10 || speed == SPEED_100) &&
|
||||
duplex != DUPLEX_FULL)
|
||||
@@ -2650,9 +2657,10 @@ static int mt7531_sgmii_setup_mode_an(st
|
||||
@@ -2682,9 +2689,10 @@ static int mt7531_sgmii_setup_mode_an(st
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
u32 val;
|
||||
|
||||
/* Only restart AN when AN is enabled */
|
||||
@@ -2709,6 +2717,24 @@ mt753x_mac_config(struct dsa_switch *ds,
|
||||
@@ -2741,6 +2749,24 @@ mt753x_mac_config(struct dsa_switch *ds,
|
||||
return priv->info->mac_port_config(ds, port, mode, state->interface);
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static void
|
||||
mt753x_phylink_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
|
||||
const struct phylink_link_state *state)
|
||||
@@ -2770,17 +2796,6 @@ unsupported:
|
||||
@@ -2802,17 +2828,6 @@ unsupported:
|
||||
mt7530_write(priv, MT7530_PMCR_P(port), mcr_new);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
static void mt753x_phylink_mac_link_down(struct dsa_switch *ds, int port,
|
||||
unsigned int mode,
|
||||
phy_interface_t interface)
|
||||
@@ -2790,16 +2805,13 @@ static void mt753x_phylink_mac_link_down
|
||||
@@ -2822,16 +2837,13 @@ static void mt753x_phylink_mac_link_down
|
||||
mt7530_clear(priv, MT7530_PMCR_P(port), PMCR_LINK_SETTINGS_MASK);
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
}
|
||||
|
||||
static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port,
|
||||
@@ -2812,8 +2824,6 @@ static void mt753x_phylink_mac_link_up(s
|
||||
@@ -2844,8 +2856,6 @@ static void mt753x_phylink_mac_link_up(s
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
u32 mcr;
|
||||
|
||||
@ -148,7 +148,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
mcr = PMCR_RX_EN | PMCR_TX_EN | PMCR_FORCE_LNK;
|
||||
|
||||
/* MT753x MAC works in 1G full duplex mode for all up-clocked
|
||||
@@ -2891,6 +2901,8 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
@@ -2923,6 +2933,8 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
return ret;
|
||||
mt7530_write(priv, MT7530_PMCR_P(port),
|
||||
PMCR_CPU_PORT_SETTING(priv->id));
|
||||
@ -157,7 +157,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
mt753x_phylink_mac_link_up(ds, port, MLO_AN_FIXED, interface, NULL,
|
||||
speed, DUPLEX_FULL, true, true);
|
||||
|
||||
@@ -2930,16 +2942,13 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
@@ -2962,16 +2974,13 @@ mt753x_phylink_validate(struct dsa_switc
|
||||
linkmode_and(state->advertising, state->advertising, mask);
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
pmsr = mt7530_read(priv, MT7530_PMSR_P(port));
|
||||
|
||||
state->link = (pmsr & PMSR_LINK);
|
||||
@@ -2966,8 +2975,6 @@ mt7530_phylink_mac_link_state(struct dsa
|
||||
@@ -2998,8 +3007,6 @@ mt7530_phylink_mac_link_state(struct dsa
|
||||
state->pause |= MLO_PAUSE_RX;
|
||||
if (pmsr & PMSR_TX_FC)
|
||||
state->pause |= MLO_PAUSE_TX;
|
||||
@ -187,7 +187,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -3009,32 +3016,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
@@ -3041,32 +3048,49 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
@@ -3047,6 +3071,13 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3079,6 +3103,13 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
@ -263,7 +263,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3108,9 +3139,8 @@ static const struct dsa_switch_ops mt753
|
||||
@@ -3140,9 +3171,8 @@ static const struct dsa_switch_ops mt753
|
||||
.port_mirror_del = mt753x_port_mirror_del,
|
||||
.phylink_get_caps = mt753x_phylink_get_caps,
|
||||
.phylink_validate = mt753x_phylink_validate,
|
||||
@ -274,7 +274,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.phylink_mac_link_down = mt753x_phylink_mac_link_down,
|
||||
.phylink_mac_link_up = mt753x_phylink_mac_link_up,
|
||||
.get_mac_eee = mt753x_get_mac_eee,
|
||||
@@ -3120,36 +3150,34 @@ static const struct dsa_switch_ops mt753
|
||||
@@ -3152,36 +3182,34 @@ static const struct dsa_switch_ops mt753
|
||||
static const struct mt753x_info mt753x_table[] = {
|
||||
[ID_MT7621] = {
|
||||
.id = ID_MT7621,
|
||||
@ -314,7 +314,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
},
|
||||
};
|
||||
|
||||
@@ -3207,7 +3235,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3239,7 +3267,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
if (!priv->info->sw_setup || !priv->info->pad_setup ||
|
||||
!priv->info->phy_read || !priv->info->phy_write ||
|
||||
!priv->info->mac_port_get_caps ||
|
||||
|
@ -20,7 +20,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2921,25 +2921,16 @@ static void mt753x_phylink_get_caps(stru
|
||||
@@ -2953,25 +2953,16 @@ static void mt753x_phylink_get_caps(stru
|
||||
priv->info->mac_port_get_caps(ds, port, config);
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
}
|
||||
|
||||
static void mt7530_pcs_get_state(struct phylink_pcs *pcs,
|
||||
@@ -3041,12 +3032,14 @@ static void mt7530_pcs_an_restart(struct
|
||||
@@ -3073,12 +3064,14 @@ static void mt7530_pcs_an_restart(struct
|
||||
}
|
||||
|
||||
static const struct phylink_pcs_ops mt7530_pcs_ops = {
|
||||
@ -70,7 +70,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
.pcs_get_state = mt7531_pcs_get_state,
|
||||
.pcs_config = mt753x_pcs_config,
|
||||
.pcs_an_restart = mt7531_pcs_an_restart,
|
||||
@@ -3138,7 +3131,6 @@ static const struct dsa_switch_ops mt753
|
||||
@@ -3170,7 +3163,6 @@ static const struct dsa_switch_ops mt753
|
||||
.port_mirror_add = mt753x_port_mirror_add,
|
||||
.port_mirror_del = mt753x_port_mirror_del,
|
||||
.phylink_get_caps = mt753x_phylink_get_caps,
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2918,6 +2918,12 @@ static void mt753x_phylink_get_caps(stru
|
||||
@@ -2950,6 +2950,12 @@ static void mt753x_phylink_get_caps(stru
|
||||
config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
|
||||
MAC_10 | MAC_100 | MAC_1000FD;
|
||||
|
||||
|
@ -81,7 +81,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -3056,9 +3056,16 @@ static int
|
||||
@@ -3088,9 +3088,16 @@ static int
|
||||
mt753x_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
@ -100,7 +100,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -3070,13 +3077,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3102,13 +3109,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
|
@ -1,75 +0,0 @@
|
||||
From 1f0dfd443eea7fc3e818e96f7c8264913ba41859 Mon Sep 17 00:00:00 2001
|
||||
From: Frank Wunderlich <frank-w@public-files.de>
|
||||
Date: Fri, 10 Jun 2022 19:05:38 +0200
|
||||
Subject: [PATCH 12/13] net: dsa: mt7530: rework mt753[01]_setup
|
||||
|
||||
Enumerate available cpu-ports instead of using hardcoded constant.
|
||||
|
||||
Suggested-by: Vladimir Oltean <olteanv@gmail.com>
|
||||
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
||||
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
---
|
||||
drivers/net/dsa/mt7530.c | 25 +++++++++++++++++++++----
|
||||
1 file changed, 21 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2101,11 +2101,12 @@ static int
|
||||
mt7530_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
+ struct device_node *dn = NULL;
|
||||
struct device_node *phy_node;
|
||||
struct device_node *mac_np;
|
||||
struct mt7530_dummy_poll p;
|
||||
phy_interface_t interface;
|
||||
- struct device_node *dn;
|
||||
+ struct dsa_port *cpu_dp;
|
||||
u32 id, val;
|
||||
int ret, i;
|
||||
|
||||
@@ -2113,7 +2114,19 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
* controller also is the container for two GMACs nodes representing
|
||||
* as two netdev instances.
|
||||
*/
|
||||
- dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent;
|
||||
+ dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
||||
+ dn = cpu_dp->master->dev.of_node->parent;
|
||||
+ /* It doesn't matter which CPU port is found first,
|
||||
+ * their masters should share the same parent OF node
|
||||
+ */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (!dn) {
|
||||
+ dev_err(ds->dev, "parent OF node of DSA master not found");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
ds->assisted_learning_on_cpu_port = true;
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
|
||||
@@ -2286,6 +2299,7 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
struct mt7530_dummy_poll p;
|
||||
+ struct dsa_port *cpu_dp;
|
||||
u32 val, id;
|
||||
int ret, i;
|
||||
|
||||
@@ -2360,8 +2374,11 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
CORE_PLL_GROUP4, val);
|
||||
|
||||
/* BPDU to CPU port */
|
||||
- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
||||
- BIT(MT7530_CPU_PORT));
|
||||
+ dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
||||
+ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
||||
+ BIT(cpu_dp->index));
|
||||
+ break;
|
||||
+ }
|
||||
mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
|
||||
MT753X_BPDU_CPU_ONLY);
|
||||
|
@ -68,7 +68,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static inline bool dsa_is_unused_port(struct dsa_switch *ds, int p)
|
||||
{
|
||||
return dsa_to_port(ds, p)->type == DSA_PORT_TYPE_UNUSED;
|
||||
@@ -949,6 +959,13 @@ struct dsa_switch_ops {
|
||||
@@ -977,6 +987,13 @@ struct dsa_switch_ops {
|
||||
int (*tag_8021q_vlan_add)(struct dsa_switch *ds, int port, u16 vid,
|
||||
u16 flags);
|
||||
int (*tag_8021q_vlan_del)(struct dsa_switch *ds, int port, u16 vid);
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2721,9 +2721,6 @@ mt7531_mac_config(struct dsa_switch *ds,
|
||||
@@ -2736,9 +2736,6 @@ mt7531_mac_config(struct dsa_switch *ds,
|
||||
case PHY_INTERFACE_MODE_NA:
|
||||
case PHY_INTERFACE_MODE_1000BASEX:
|
||||
case PHY_INTERFACE_MODE_2500BASEX:
|
||||
@ -29,7 +29,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
return mt7531_sgmii_setup_mode_force(priv, port, interface);
|
||||
default:
|
||||
return -EINVAL;
|
||||
@@ -2799,13 +2796,6 @@ unsupported:
|
||||
@@ -2814,13 +2811,6 @@ unsupported:
|
||||
return;
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mcr_cur = mt7530_read(priv, MT7530_PMCR_P(port));
|
||||
mcr_new = mcr_cur;
|
||||
mcr_new &= ~PMCR_LINK_SETTINGS_MASK;
|
||||
@@ -2942,6 +2932,9 @@ static void mt753x_phylink_get_caps(stru
|
||||
@@ -2957,6 +2947,9 @@ static void mt753x_phylink_get_caps(stru
|
||||
config->mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
|
||||
MAC_10 | MAC_100 | MAC_1000FD;
|
||||
|
||||
@ -53,7 +53,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
/* This driver does not make use of the speed, duplex, pause or the
|
||||
* advertisement in its mac_config, so it is safe to mark this driver
|
||||
* as non-legacy.
|
||||
@@ -3007,6 +3000,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
@@ -3022,6 +3015,7 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
|
||||
status = mt7530_read(priv, MT7531_PCS_CONTROL_1(port));
|
||||
state->link = !!(status & MT7531_SGMII_LINK_STATUS);
|
||||
@ -61,7 +61,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if (state->interface == PHY_INTERFACE_MODE_SGMII &&
|
||||
(status & MT7531_SGMII_AN_ENABLE)) {
|
||||
val = mt7530_read(priv, MT7531_PCS_SPEED_ABILITY(port));
|
||||
@@ -3037,16 +3031,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
@@ -3052,16 +3046,44 @@ mt7531_sgmii_pcs_get_state_an(struct mt7
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
}
|
||||
|
||||
static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
|
||||
@@ -3087,6 +3109,8 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3102,6 +3124,8 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
priv->pcs[i].pcs.ops = priv->info->pcs_ops;
|
||||
priv->pcs[i].priv = priv;
|
||||
priv->pcs[i].port = i;
|
||||
|
@ -81,7 +81,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
#include <linux/phylink.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
@@ -2573,128 +2574,11 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
@@ -2588,128 +2589,11 @@ static int mt7531_rgmii_setup(struct mt7
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
static int
|
||||
mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
|
||||
phy_interface_t interface)
|
||||
@@ -2717,11 +2601,11 @@ mt7531_mac_config(struct dsa_switch *ds,
|
||||
@@ -2732,11 +2616,11 @@ mt7531_mac_config(struct dsa_switch *ds,
|
||||
phydev = dp->slave->phydev;
|
||||
return mt7531_rgmii_setup(priv, port, interface, phydev);
|
||||
case PHY_INTERFACE_MODE_SGMII:
|
||||
@ -224,7 +224,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2746,11 +2630,11 @@ mt753x_phylink_mac_select_pcs(struct dsa
|
||||
@@ -2761,11 +2645,11 @@ mt753x_phylink_mac_select_pcs(struct dsa
|
||||
|
||||
switch (interface) {
|
||||
case PHY_INTERFACE_MODE_TRGMII:
|
||||
@ -238,7 +238,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
@@ -2991,86 +2875,6 @@ static void mt7530_pcs_get_state(struct
|
||||
@@ -3006,86 +2890,6 @@ static void mt7530_pcs_get_state(struct
|
||||
state->pause |= MLO_PAUSE_TX;
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
static int mt753x_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
|
||||
phy_interface_t interface,
|
||||
const unsigned long *advertising,
|
||||
@@ -3090,18 +2894,57 @@ static const struct phylink_pcs_ops mt75
|
||||
@@ -3105,18 +2909,57 @@ static const struct phylink_pcs_ops mt75
|
||||
.pcs_an_restart = mt7530_pcs_an_restart,
|
||||
};
|
||||
|
||||
@ -389,7 +389,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
int i, ret;
|
||||
|
||||
/* Initialise the PCS devices */
|
||||
@@ -3109,8 +2952,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3124,8 +2967,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
priv->pcs[i].pcs.ops = priv->info->pcs_ops;
|
||||
priv->pcs[i].priv = priv;
|
||||
priv->pcs[i].port = i;
|
||||
@ -398,7 +398,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
}
|
||||
|
||||
ret = priv->info->sw_setup(ds);
|
||||
@@ -3125,6 +2966,16 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3140,6 +2981,16 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
@ -415,7 +415,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3216,7 +3067,7 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3231,7 +3082,7 @@ static const struct mt753x_info mt753x_t
|
||||
},
|
||||
[ID_MT7531] = {
|
||||
.id = ID_MT7531,
|
||||
@ -424,7 +424,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
.sw_setup = mt7531_setup,
|
||||
.phy_read = mt7531_ind_phy_read,
|
||||
.phy_write = mt7531_ind_phy_write,
|
||||
@@ -3324,7 +3175,7 @@ static void
|
||||
@@ -3339,7 +3190,7 @@ static void
|
||||
mt7530_remove(struct mdio_device *mdiodev)
|
||||
{
|
||||
struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
|
||||
@ -433,7 +433,7 @@ Tested-by: Frank Wunderlich <frank-w@public-files.de>
|
||||
|
||||
if (!priv)
|
||||
return;
|
||||
@@ -3343,6 +3194,10 @@ mt7530_remove(struct mdio_device *mdiode
|
||||
@@ -3358,6 +3209,10 @@ mt7530_remove(struct mdio_device *mdiode
|
||||
mt7530_free_irq(priv);
|
||||
|
||||
dsa_unregister_switch(priv->ds);
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2926,26 +2926,56 @@ static const struct regmap_bus mt7531_re
|
||||
@@ -2941,26 +2941,56 @@ static const struct regmap_bus mt7531_re
|
||||
.reg_update_bits = mt7530_regmap_update_bits,
|
||||
};
|
||||
|
||||
@ -88,7 +88,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
int i, ret;
|
||||
|
||||
/* Initialise the PCS devices */
|
||||
@@ -2967,15 +2997,11 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -2982,15 +3012,11 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
|
@ -19,7 +19,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2899,7 +2899,7 @@ static int mt7530_regmap_read(void *cont
|
||||
@@ -2914,7 +2914,7 @@ static int mt7530_regmap_read(void *cont
|
||||
{
|
||||
struct mt7530_priv *priv = context;
|
||||
|
||||
@ -28,7 +28,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -2907,23 +2907,25 @@ static int mt7530_regmap_write(void *con
|
||||
@@ -2922,23 +2922,25 @@ static int mt7530_regmap_write(void *con
|
||||
{
|
||||
struct mt7530_priv *priv = context;
|
||||
|
||||
@ -62,7 +62,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -2949,6 +2951,9 @@ mt7531_create_sgmii(struct mt7530_priv *
|
||||
@@ -2964,6 +2966,9 @@ mt7531_create_sgmii(struct mt7530_priv *
|
||||
mt7531_pcs_config[i]->reg_stride = 4;
|
||||
mt7531_pcs_config[i]->reg_base = MT7531_SGMII_REG_BASE(5 + i);
|
||||
mt7531_pcs_config[i]->max_register = 0x17c;
|
||||
|
@ -133,7 +133,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2895,22 +2916,6 @@ static const struct phylink_pcs_ops mt75
|
||||
@@ -2910,22 +2931,6 @@ static const struct phylink_pcs_ops mt75
|
||||
.pcs_an_restart = mt7530_pcs_an_restart,
|
||||
};
|
||||
|
||||
@ -156,7 +156,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static void
|
||||
mt7530_mdio_regmap_lock(void *mdio_lock)
|
||||
{
|
||||
@@ -2923,7 +2928,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc
|
||||
@@ -2938,7 +2943,7 @@ mt7530_mdio_regmap_unlock(void *mdio_loc
|
||||
mutex_unlock(mdio_lock);
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
.reg_write = mt7530_regmap_write,
|
||||
.reg_read = mt7530_regmap_read,
|
||||
};
|
||||
@@ -2956,7 +2961,7 @@ mt7531_create_sgmii(struct mt7530_priv *
|
||||
@@ -2971,7 +2976,7 @@ mt7531_create_sgmii(struct mt7530_priv *
|
||||
mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock;
|
||||
|
||||
regmap = devm_regmap_init(priv->dev,
|
||||
@ -174,7 +174,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mt7531_pcs_config[i]);
|
||||
if (IS_ERR(regmap)) {
|
||||
ret = PTR_ERR(regmap);
|
||||
@@ -3121,6 +3126,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match)
|
||||
@@ -3136,6 +3141,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match)
|
||||
static int
|
||||
mt7530_probe(struct mdio_device *mdiodev)
|
||||
{
|
||||
@ -182,7 +182,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
struct mt7530_priv *priv;
|
||||
struct device_node *dn;
|
||||
|
||||
@@ -3200,6 +3206,21 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3215,6 +3221,21 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
mutex_init(&priv->reg_mutex);
|
||||
dev_set_drvdata(&mdiodev->dev, priv);
|
||||
|
||||
|
@ -18,7 +18,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -3007,12 +3007,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3022,12 +3022,6 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
@ -31,7 +31,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3129,6 +3123,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3144,6 +3138,7 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
static struct regmap_config *regmap_config;
|
||||
struct mt7530_priv *priv;
|
||||
struct device_node *dn;
|
||||
@ -39,7 +39,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
dn = mdiodev->dev.of_node;
|
||||
|
||||
@@ -3221,6 +3216,12 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3236,6 +3231,12 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
if (IS_ERR(priv->regmap))
|
||||
return PTR_ERR(priv->regmap);
|
||||
|
||||
|
@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -3135,44 +3135,21 @@ static const struct of_device_id mt7530_
|
||||
@@ -3150,44 +3150,21 @@ static const struct of_device_id mt7530_
|
||||
MODULE_DEVICE_TABLE(of, mt7530_of_match);
|
||||
|
||||
static int
|
||||
@ -67,7 +67,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if (!priv->info)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -3186,23 +3163,53 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3201,23 +3178,53 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
return -EINVAL;
|
||||
|
||||
priv->id = priv->info->id;
|
||||
@ -131,7 +131,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
priv->reset = devm_gpiod_get_optional(&mdiodev->dev, "reset",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(priv->reset)) {
|
||||
@@ -3211,12 +3218,15 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3226,12 +3233,15 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -3253,6 +3253,17 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
@@ -3268,6 +3268,17 @@ mt7530_probe(struct mdio_device *mdiodev
|
||||
}
|
||||
|
||||
static void
|
||||
@ -35,7 +35,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mt7530_remove(struct mdio_device *mdiodev)
|
||||
{
|
||||
struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
|
||||
@@ -3271,16 +3282,11 @@ mt7530_remove(struct mdio_device *mdiode
|
||||
@@ -3286,16 +3297,11 @@ mt7530_remove(struct mdio_device *mdiode
|
||||
dev_err(priv->dev, "Failed to disable io pwr: %d\n",
|
||||
ret);
|
||||
|
||||
|
@ -1,143 +0,0 @@
|
||||
From 7f54cc9772ced2d76ac11832f0ada43798443ac9 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Mon, 3 Apr 2023 02:19:02 +0100
|
||||
Subject: [PATCH 13/16] net: dsa: mt7530: split-off common parts from
|
||||
mt7531_setup
|
||||
|
||||
MT7988 shares a significant part of the setup function with MT7531.
|
||||
Split-off those parts into a shared function which is going to be used
|
||||
also by mt7988_setup.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++------------------
|
||||
1 file changed, 55 insertions(+), 44 deletions(-)
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2348,11 +2348,64 @@ mt7530_setup(struct dsa_switch *ds)
|
||||
}
|
||||
|
||||
static int
|
||||
+mt7531_setup_common(struct dsa_switch *ds)
|
||||
+{
|
||||
+ struct mt7530_priv *priv = ds->priv;
|
||||
+ struct dsa_port *cpu_dp;
|
||||
+ int ret, i;
|
||||
+
|
||||
+ /* BPDU to CPU port */
|
||||
+ dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
||||
+ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
||||
+ BIT(cpu_dp->index));
|
||||
+ break;
|
||||
+ }
|
||||
+ mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
|
||||
+ MT753X_BPDU_CPU_ONLY);
|
||||
+
|
||||
+ /* Enable and reset MIB counters */
|
||||
+ mt7530_mib_reset(ds);
|
||||
+
|
||||
+ for (i = 0; i < MT7530_NUM_PORTS; i++) {
|
||||
+ /* Disable forwarding by default on all ports */
|
||||
+ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
|
||||
+ PCR_MATRIX_CLR);
|
||||
+
|
||||
+ /* Disable learning by default on all ports */
|
||||
+ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS);
|
||||
+
|
||||
+ mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR);
|
||||
+
|
||||
+ if (dsa_is_cpu_port(ds, i)) {
|
||||
+ ret = mt753x_cpu_port_enable(ds, i);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ mt7530_port_disable(ds, i);
|
||||
+
|
||||
+ /* Set default PVID to 0 on all user ports */
|
||||
+ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK,
|
||||
+ G0_PORT_VID_DEF);
|
||||
+ }
|
||||
+
|
||||
+ /* Enable consistent egress tag */
|
||||
+ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK,
|
||||
+ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
|
||||
+ }
|
||||
+
|
||||
+ /* Flush the FDB table */
|
||||
+ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
mt7531_setup(struct dsa_switch *ds)
|
||||
{
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
struct mt7530_dummy_poll p;
|
||||
- struct dsa_port *cpu_dp;
|
||||
u32 val, id;
|
||||
int ret, i;
|
||||
|
||||
@@ -2426,44 +2479,7 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
mt7531_ind_c45_phy_write(priv, MT753X_CTRL_PHY_ADDR, MDIO_MMD_VEND2,
|
||||
CORE_PLL_GROUP4, val);
|
||||
|
||||
- /* BPDU to CPU port */
|
||||
- dsa_switch_for_each_cpu_port(cpu_dp, ds) {
|
||||
- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK,
|
||||
- BIT(cpu_dp->index));
|
||||
- break;
|
||||
- }
|
||||
- mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
|
||||
- MT753X_BPDU_CPU_ONLY);
|
||||
-
|
||||
- /* Enable and reset MIB counters */
|
||||
- mt7530_mib_reset(ds);
|
||||
-
|
||||
- for (i = 0; i < MT7530_NUM_PORTS; i++) {
|
||||
- /* Disable forwarding by default on all ports */
|
||||
- mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
|
||||
- PCR_MATRIX_CLR);
|
||||
-
|
||||
- /* Disable learning by default on all ports */
|
||||
- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS);
|
||||
-
|
||||
- mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR);
|
||||
-
|
||||
- if (dsa_is_cpu_port(ds, i)) {
|
||||
- ret = mt753x_cpu_port_enable(ds, i);
|
||||
- if (ret)
|
||||
- return ret;
|
||||
- } else {
|
||||
- mt7530_port_disable(ds, i);
|
||||
-
|
||||
- /* Set default PVID to 0 on all user ports */
|
||||
- mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK,
|
||||
- G0_PORT_VID_DEF);
|
||||
- }
|
||||
-
|
||||
- /* Enable consistent egress tag */
|
||||
- mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK,
|
||||
- PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT));
|
||||
- }
|
||||
+ mt7531_setup_common(ds);
|
||||
|
||||
/* Setup VLAN ID 0 for VLAN-unaware bridges */
|
||||
ret = mt7530_setup_vlan0(priv);
|
||||
@@ -2473,11 +2489,6 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
ds->assisted_learning_on_cpu_port = true;
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
|
||||
- /* Flush the FDB table */
|
||||
- ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL);
|
||||
- if (ret < 0)
|
||||
- return ret;
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static u32
|
||||
mt7530_mii_read(struct mt7530_priv *priv, u32 reg)
|
||||
{
|
||||
@@ -2944,72 +2895,6 @@ static const struct phylink_pcs_ops mt75
|
||||
@@ -2948,72 +2899,6 @@ static const struct phylink_pcs_ops mt75
|
||||
.pcs_an_restart = mt7530_pcs_an_restart,
|
||||
};
|
||||
|
||||
@ -489,7 +489,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static int
|
||||
mt753x_setup(struct dsa_switch *ds)
|
||||
{
|
||||
@@ -3068,7 +2953,7 @@ static int mt753x_set_mac_eee(struct dsa
|
||||
@@ -3072,7 +2957,7 @@ static int mt753x_set_mac_eee(struct dsa
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
.get_tag_protocol = mtk_get_tag_protocol,
|
||||
.setup = mt753x_setup,
|
||||
.get_strings = mt7530_get_strings,
|
||||
@@ -3102,8 +2987,9 @@ static const struct dsa_switch_ops mt753
|
||||
@@ -3106,8 +2991,9 @@ static const struct dsa_switch_ops mt753
|
||||
.get_mac_eee = mt753x_get_mac_eee,
|
||||
.set_mac_eee = mt753x_set_mac_eee,
|
||||
};
|
||||
@ -509,7 +509,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
[ID_MT7621] = {
|
||||
.id = ID_MT7621,
|
||||
.pcs_ops = &mt7530_pcs_ops,
|
||||
@@ -3136,16 +3022,9 @@ static const struct mt753x_info mt753x_t
|
||||
@@ -3140,16 +3026,9 @@ static const struct mt753x_info mt753x_t
|
||||
.mac_port_config = mt7531_mac_config,
|
||||
},
|
||||
};
|
||||
@ -528,7 +528,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mt7530_probe_common(struct mt7530_priv *priv)
|
||||
{
|
||||
struct device *dev = priv->dev;
|
||||
@@ -3182,88 +3061,9 @@ mt7530_probe_common(struct mt7530_priv *
|
||||
@@ -3186,88 +3065,9 @@ mt7530_probe_common(struct mt7530_priv *
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -619,7 +619,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mt7530_remove_common(struct mt7530_priv *priv)
|
||||
{
|
||||
if (priv->irq)
|
||||
@@ -3274,57 +3074,6 @@ mt7530_remove_common(struct mt7530_priv
|
||||
@@ -3278,57 +3078,6 @@ mt7530_remove_common(struct mt7530_priv
|
||||
mutex_destroy(&priv->reg_mutex);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
if (!priv->irq_domain) {
|
||||
dev_err(dev, "failed to create IRQ domain\n");
|
||||
return -ENOMEM;
|
||||
@@ -2507,6 +2555,25 @@ static void mt7531_mac_port_get_caps(str
|
||||
@@ -2511,6 +2559,25 @@ static void mt7531_mac_port_get_caps(str
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static int
|
||||
mt753x_pad_setup(struct dsa_switch *ds, const struct phylink_link_state *state)
|
||||
{
|
||||
@@ -2583,6 +2650,17 @@ static bool mt753x_is_mac_port(u32 port)
|
||||
@@ -2587,6 +2654,17 @@ static bool mt753x_is_mac_port(u32 port)
|
||||
}
|
||||
|
||||
static int
|
||||
@ -294,7 +294,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
|
||||
phy_interface_t interface)
|
||||
{
|
||||
@@ -2652,7 +2730,8 @@ mt753x_phylink_mac_config(struct dsa_swi
|
||||
@@ -2656,7 +2734,8 @@ mt753x_phylink_mac_config(struct dsa_swi
|
||||
|
||||
switch (port) {
|
||||
case 0 ... 4: /* Internal phy */
|
||||
@ -304,7 +304,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
goto unsupported;
|
||||
break;
|
||||
case 5: /* 2nd cpu port with phy of port 0 or 4 / external phy */
|
||||
@@ -2730,7 +2809,8 @@ static void mt753x_phylink_mac_link_up(s
|
||||
@@ -2734,7 +2813,8 @@ static void mt753x_phylink_mac_link_up(s
|
||||
/* MT753x MAC works in 1G full duplex mode for all up-clocked
|
||||
* variants.
|
||||
*/
|
||||
@ -314,7 +314,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
(phy_interface_mode_is_8023z(interface))) {
|
||||
speed = SPEED_1000;
|
||||
duplex = DUPLEX_FULL;
|
||||
@@ -2810,6 +2890,21 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
@@ -2814,6 +2894,21 @@ mt7531_cpu_port_config(struct dsa_switch
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
static void mt753x_phylink_get_caps(struct dsa_switch *ds, int port,
|
||||
struct phylink_config *config)
|
||||
{
|
||||
@@ -2955,6 +3050,27 @@ static int mt753x_set_mac_eee(struct dsa
|
||||
@@ -2959,6 +3054,27 @@ static int mt753x_set_mac_eee(struct dsa
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
const struct dsa_switch_ops mt7530_switch_ops = {
|
||||
.get_tag_protocol = mtk_get_tag_protocol,
|
||||
.setup = mt753x_setup,
|
||||
@@ -3023,6 +3139,17 @@ const struct mt753x_info mt753x_table[]
|
||||
@@ -3027,6 +3143,17 @@ const struct mt753x_info mt753x_table[]
|
||||
.mac_port_get_caps = mt7531_mac_port_get_caps,
|
||||
.mac_port_config = mt7531_mac_config,
|
||||
},
|
||||
|
@ -73,7 +73,7 @@ Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||
}
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -3017,6 +3017,12 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
@@ -3021,6 +3021,12 @@ mt753x_setup(struct dsa_switch *ds)
|
||||
if (ret && priv->irq)
|
||||
mt7530_free_irq_common(priv);
|
||||
|
||||
|
@ -10,12 +10,21 @@ The datasheet [1] explicit describes it as requirement for a reset.
|
||||
|
||||
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
|
||||
---
|
||||
drivers/net/dsa/mt7530.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
drivers/net/dsa/mt7530.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/drivers/net/dsa/mt7530.c
|
||||
+++ b/drivers/net/dsa/mt7530.c
|
||||
@@ -2440,6 +2440,10 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
@@ -2412,7 +2412,7 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
struct mt7530_priv *priv = ds->priv;
|
||||
struct mt7530_dummy_poll p;
|
||||
u32 val, id;
|
||||
- int ret;
|
||||
+ int ret, i;
|
||||
|
||||
/* Reset whole chip through gpio pin or memory-mapped registers for
|
||||
* different type of hardware
|
||||
@@ -2444,6 +2444,10 @@ mt7531_setup(struct dsa_switch *ds)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user