/[packages]/backports/8/kernel/current/SOURCES/net-dsa-microchip-move-tag_protocol-to-ksz_common.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/net-dsa-microchip-move-tag_protocol-to-ksz_common.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1881590 - (show annotations) (download)
Mon Aug 29 03:49:40 2022 UTC (18 months, 4 weeks ago) by tmb
File size: 4835 byte(s)
- add current -stable queue
- io_uring: fix issue with io_write() not always undoing sb_start_write()
- HID: input: fix uclogic tablets


1 From 740047cfcfef2608e5e90a41d5f22206978a92c0 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 17 Jun 2022 14:12:47 +0530
4 Subject: net: dsa: microchip: move tag_protocol to ksz_common
5
6 From: Arun Ramadoss <arun.ramadoss@microchip.com>
7
8 [ Upstream commit 534a0431e9e68959e2c0d71c141d5b911d66ad7c ]
9
10 This patch move the dsa hook get_tag_protocol to ksz_common file. And
11 the tag_protocol is returned based on the dev->chip_id.
12
13 Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
14 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
15 Signed-off-by: Sasha Levin <sashal@kernel.org>
16 ---
17 drivers/net/dsa/microchip/ksz8795.c | 13 +------------
18 drivers/net/dsa/microchip/ksz9477.c | 14 +-------------
19 drivers/net/dsa/microchip/ksz_common.c | 24 ++++++++++++++++++++++++
20 drivers/net/dsa/microchip/ksz_common.h | 2 ++
21 4 files changed, 28 insertions(+), 25 deletions(-)
22
23 diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
24 index 3cc51ee5fb6cc..041956e3c7b1a 100644
25 --- a/drivers/net/dsa/microchip/ksz8795.c
26 +++ b/drivers/net/dsa/microchip/ksz8795.c
27 @@ -898,17 +898,6 @@ static void ksz8_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val)
28 }
29 }
30
31 -static enum dsa_tag_protocol ksz8_get_tag_protocol(struct dsa_switch *ds,
32 - int port,
33 - enum dsa_tag_protocol mp)
34 -{
35 - struct ksz_device *dev = ds->priv;
36 -
37 - /* ksz88x3 uses the same tag schema as KSZ9893 */
38 - return ksz_is_ksz88x3(dev) ?
39 - DSA_TAG_PROTO_KSZ9893 : DSA_TAG_PROTO_KSZ8795;
40 -}
41 -
42 static u32 ksz8_sw_get_phy_flags(struct dsa_switch *ds, int port)
43 {
44 /* Silicon Errata Sheet (DS80000830A):
45 @@ -1394,7 +1383,7 @@ static void ksz8_get_caps(struct dsa_switch *ds, int port,
46 }
47
48 static const struct dsa_switch_ops ksz8_switch_ops = {
49 - .get_tag_protocol = ksz8_get_tag_protocol,
50 + .get_tag_protocol = ksz_get_tag_protocol,
51 .get_phy_flags = ksz8_sw_get_phy_flags,
52 .setup = ksz8_setup,
53 .phy_read = ksz_phy_read16,
54 diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
55 index bcfdd505ca79a..31be767027feb 100644
56 --- a/drivers/net/dsa/microchip/ksz9477.c
57 +++ b/drivers/net/dsa/microchip/ksz9477.c
58 @@ -276,18 +276,6 @@ static void ksz9477_port_init_cnt(struct ksz_device *dev, int port)
59 mutex_unlock(&mib->cnt_mutex);
60 }
61
62 -static enum dsa_tag_protocol ksz9477_get_tag_protocol(struct dsa_switch *ds,
63 - int port,
64 - enum dsa_tag_protocol mp)
65 -{
66 - enum dsa_tag_protocol proto = DSA_TAG_PROTO_KSZ9477;
67 - struct ksz_device *dev = ds->priv;
68 -
69 - if (dev->features & IS_9893)
70 - proto = DSA_TAG_PROTO_KSZ9893;
71 - return proto;
72 -}
73 -
74 static int ksz9477_phy_read16(struct dsa_switch *ds, int addr, int reg)
75 {
76 struct ksz_device *dev = ds->priv;
77 @@ -1329,7 +1317,7 @@ static int ksz9477_setup(struct dsa_switch *ds)
78 }
79
80 static const struct dsa_switch_ops ksz9477_switch_ops = {
81 - .get_tag_protocol = ksz9477_get_tag_protocol,
82 + .get_tag_protocol = ksz_get_tag_protocol,
83 .setup = ksz9477_setup,
84 .phy_read = ksz9477_phy_read16,
85 .phy_write = ksz9477_phy_write16,
86 diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
87 index 4511e99823f57..0713a40685fa9 100644
88 --- a/drivers/net/dsa/microchip/ksz_common.c
89 +++ b/drivers/net/dsa/microchip/ksz_common.c
90 @@ -930,6 +930,30 @@ void ksz_port_stp_state_set(struct dsa_switch *ds, int port,
91 }
92 EXPORT_SYMBOL_GPL(ksz_port_stp_state_set);
93
94 +enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
95 + int port, enum dsa_tag_protocol mp)
96 +{
97 + struct ksz_device *dev = ds->priv;
98 + enum dsa_tag_protocol proto = DSA_TAG_PROTO_NONE;
99 +
100 + if (dev->chip_id == KSZ8795_CHIP_ID ||
101 + dev->chip_id == KSZ8794_CHIP_ID ||
102 + dev->chip_id == KSZ8765_CHIP_ID)
103 + proto = DSA_TAG_PROTO_KSZ8795;
104 +
105 + if (dev->chip_id == KSZ8830_CHIP_ID ||
106 + dev->chip_id == KSZ9893_CHIP_ID)
107 + proto = DSA_TAG_PROTO_KSZ9893;
108 +
109 + if (dev->chip_id == KSZ9477_CHIP_ID ||
110 + dev->chip_id == KSZ9897_CHIP_ID ||
111 + dev->chip_id == KSZ9567_CHIP_ID)
112 + proto = DSA_TAG_PROTO_KSZ9477;
113 +
114 + return proto;
115 +}
116 +EXPORT_SYMBOL_GPL(ksz_get_tag_protocol);
117 +
118 static int ksz_switch_detect(struct ksz_device *dev)
119 {
120 u8 id1, id2;
121 diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
122 index e6bc5fb2b1303..21db6f79035fa 100644
123 --- a/drivers/net/dsa/microchip/ksz_common.h
124 +++ b/drivers/net/dsa/microchip/ksz_common.h
125 @@ -231,6 +231,8 @@ int ksz_port_mdb_del(struct dsa_switch *ds, int port,
126 int ksz_enable_port(struct dsa_switch *ds, int port, struct phy_device *phy);
127 void ksz_get_strings(struct dsa_switch *ds, int port,
128 u32 stringset, uint8_t *buf);
129 +enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds,
130 + int port, enum dsa_tag_protocol mp);
131
132 /* Common register access functions */
133
134 --
135 2.35.1
136

  ViewVC Help
Powered by ViewVC 1.1.30