Skip to content

Commit 48ae555

Browse files
joabreudavem330
authored andcommitted
net: stmmac: Add XGMAC 2.10 HWIF entry
Add a new entry to HWIF table for XGMAC 2.10. For now we fill it with empty callbacks which will be added in posterior patches. Signed-off-by: Jose Abreu <joabreu@synopsys.com> Cc: David S. Miller <davem@davemloft.net> Cc: Joao Pinto <jpinto@synopsys.com> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ff50eda commit 48ae555

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,14 @@
3636
#include "mmc.h"
3737

3838
/* Synopsys Core versions */
39-
#define DWMAC_CORE_3_40 0x34
40-
#define DWMAC_CORE_3_50 0x35
41-
#define DWMAC_CORE_4_00 0x40
42-
#define DWMAC_CORE_4_10 0x41
43-
#define DWMAC_CORE_5_00 0x50
44-
#define DWMAC_CORE_5_10 0x51
39+
#define DWMAC_CORE_3_40 0x34
40+
#define DWMAC_CORE_3_50 0x35
41+
#define DWMAC_CORE_4_00 0x40
42+
#define DWMAC_CORE_4_10 0x41
43+
#define DWMAC_CORE_5_00 0x50
44+
#define DWMAC_CORE_5_10 0x51
45+
#define DWXGMAC_CORE_2_10 0x21
46+
4547
#define STMMAC_CHAN0 0 /* Always supported and default for all chips */
4648

4749
/* These need to be power of two, and >= 4 */

drivers/net/ethernet/stmicro/stmmac/hwif.c

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)
7272
static const struct stmmac_hwif_entry {
7373
bool gmac;
7474
bool gmac4;
75+
bool xgmac;
7576
u32 min_id;
7677
const struct stmmac_regs_off regs;
7778
const void *desc;
@@ -87,6 +88,7 @@ static const struct stmmac_hwif_entry {
8788
{
8889
.gmac = false,
8990
.gmac4 = false,
91+
.xgmac = false,
9092
.min_id = 0,
9193
.regs = {
9294
.ptp_off = PTP_GMAC3_X_OFFSET,
@@ -103,6 +105,7 @@ static const struct stmmac_hwif_entry {
103105
}, {
104106
.gmac = true,
105107
.gmac4 = false,
108+
.xgmac = false,
106109
.min_id = 0,
107110
.regs = {
108111
.ptp_off = PTP_GMAC3_X_OFFSET,
@@ -119,6 +122,7 @@ static const struct stmmac_hwif_entry {
119122
}, {
120123
.gmac = false,
121124
.gmac4 = true,
125+
.xgmac = false,
122126
.min_id = 0,
123127
.regs = {
124128
.ptp_off = PTP_GMAC4_OFFSET,
@@ -135,6 +139,7 @@ static const struct stmmac_hwif_entry {
135139
}, {
136140
.gmac = false,
137141
.gmac4 = true,
142+
.xgmac = false,
138143
.min_id = DWMAC_CORE_4_00,
139144
.regs = {
140145
.ptp_off = PTP_GMAC4_OFFSET,
@@ -151,6 +156,7 @@ static const struct stmmac_hwif_entry {
151156
}, {
152157
.gmac = false,
153158
.gmac4 = true,
159+
.xgmac = false,
154160
.min_id = DWMAC_CORE_4_10,
155161
.regs = {
156162
.ptp_off = PTP_GMAC4_OFFSET,
@@ -167,6 +173,7 @@ static const struct stmmac_hwif_entry {
167173
}, {
168174
.gmac = false,
169175
.gmac4 = true,
176+
.xgmac = false,
170177
.min_id = DWMAC_CORE_5_10,
171178
.regs = {
172179
.ptp_off = PTP_GMAC4_OFFSET,
@@ -180,11 +187,29 @@ static const struct stmmac_hwif_entry {
180187
.tc = &dwmac510_tc_ops,
181188
.setup = dwmac4_setup,
182189
.quirks = NULL,
183-
}
190+
}, {
191+
.gmac = false,
192+
.gmac4 = false,
193+
.xgmac = true,
194+
.min_id = DWXGMAC_CORE_2_10,
195+
.regs = {
196+
.ptp_off = 0,
197+
.mmc_off = 0,
198+
},
199+
.desc = NULL,
200+
.dma = NULL,
201+
.mac = NULL,
202+
.hwtimestamp = NULL,
203+
.mode = NULL,
204+
.tc = NULL,
205+
.setup = NULL,
206+
.quirks = NULL,
207+
},
184208
};
185209

186210
int stmmac_hwif_init(struct stmmac_priv *priv)
187211
{
212+
bool needs_xgmac = priv->plat->has_xgmac;
188213
bool needs_gmac4 = priv->plat->has_gmac4;
189214
bool needs_gmac = priv->plat->has_gmac;
190215
const struct stmmac_hwif_entry *entry;
@@ -195,7 +220,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
195220

196221
if (needs_gmac) {
197222
id = stmmac_get_id(priv, GMAC_VERSION);
198-
} else if (needs_gmac4) {
223+
} else if (needs_gmac4 || needs_xgmac) {
199224
id = stmmac_get_id(priv, GMAC4_VERSION);
200225
} else {
201226
id = 0;
@@ -229,6 +254,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
229254
continue;
230255
if (needs_gmac4 ^ entry->gmac4)
231256
continue;
257+
if (needs_xgmac ^ entry->xgmac)
258+
continue;
232259
/* Use synopsys_id var because some setups can override this */
233260
if (priv->synopsys_id < entry->min_id)
234261
continue;

include/linux/stmmac.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,6 @@ struct plat_stmmacenet_data {
190190
bool tso_en;
191191
int mac_port_sel_speed;
192192
bool en_tx_lpi_clockgating;
193+
int has_xgmac;
193194
};
194195
#endif

0 commit comments

Comments
 (0)