aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Abreu <Jose.Abreu@synopsys.com>2018-08-08 04:04:29 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-09 14:16:28 -0400
commit48ae5554a076c1bca31448d60263e4038def9f6f (patch)
treeb66a6703864c0c865daec4ec5d4503e3d25cc76f
parentff50eda44d08587322efb73c5489ac3fec271830 (diff)
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>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/common.h14
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/hwif.c31
-rw-r--r--include/linux/stmmac.h1
3 files changed, 38 insertions, 8 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index 78fd0f8b8e81..3fb81acbd274 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -36,12 +36,14 @@
36#include "mmc.h" 36#include "mmc.h"
37 37
38/* Synopsys Core versions */ 38/* Synopsys Core versions */
39#define DWMAC_CORE_3_40 0x34 39#define DWMAC_CORE_3_40 0x34
40#define DWMAC_CORE_3_50 0x35 40#define DWMAC_CORE_3_50 0x35
41#define DWMAC_CORE_4_00 0x40 41#define DWMAC_CORE_4_00 0x40
42#define DWMAC_CORE_4_10 0x41 42#define DWMAC_CORE_4_10 0x41
43#define DWMAC_CORE_5_00 0x50 43#define DWMAC_CORE_5_00 0x50
44#define DWMAC_CORE_5_10 0x51 44#define DWMAC_CORE_5_10 0x51
45#define DWXGMAC_CORE_2_10 0x21
46
45#define STMMAC_CHAN0 0 /* Always supported and default for all chips */ 47#define STMMAC_CHAN0 0 /* Always supported and default for all chips */
46 48
47/* These need to be power of two, and >= 4 */ 49/* These need to be power of two, and >= 4 */
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c
index 1f50e83cafb2..24f5ff175aa4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/hwif.c
+++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c
@@ -72,6 +72,7 @@ static int stmmac_dwmac4_quirks(struct stmmac_priv *priv)
72static const struct stmmac_hwif_entry { 72static const struct stmmac_hwif_entry {
73 bool gmac; 73 bool gmac;
74 bool gmac4; 74 bool gmac4;
75 bool xgmac;
75 u32 min_id; 76 u32 min_id;
76 const struct stmmac_regs_off regs; 77 const struct stmmac_regs_off regs;
77 const void *desc; 78 const void *desc;
@@ -87,6 +88,7 @@ static const struct stmmac_hwif_entry {
87 { 88 {
88 .gmac = false, 89 .gmac = false,
89 .gmac4 = false, 90 .gmac4 = false,
91 .xgmac = false,
90 .min_id = 0, 92 .min_id = 0,
91 .regs = { 93 .regs = {
92 .ptp_off = PTP_GMAC3_X_OFFSET, 94 .ptp_off = PTP_GMAC3_X_OFFSET,
@@ -103,6 +105,7 @@ static const struct stmmac_hwif_entry {
103 }, { 105 }, {
104 .gmac = true, 106 .gmac = true,
105 .gmac4 = false, 107 .gmac4 = false,
108 .xgmac = false,
106 .min_id = 0, 109 .min_id = 0,
107 .regs = { 110 .regs = {
108 .ptp_off = PTP_GMAC3_X_OFFSET, 111 .ptp_off = PTP_GMAC3_X_OFFSET,
@@ -119,6 +122,7 @@ static const struct stmmac_hwif_entry {
119 }, { 122 }, {
120 .gmac = false, 123 .gmac = false,
121 .gmac4 = true, 124 .gmac4 = true,
125 .xgmac = false,
122 .min_id = 0, 126 .min_id = 0,
123 .regs = { 127 .regs = {
124 .ptp_off = PTP_GMAC4_OFFSET, 128 .ptp_off = PTP_GMAC4_OFFSET,
@@ -135,6 +139,7 @@ static const struct stmmac_hwif_entry {
135 }, { 139 }, {
136 .gmac = false, 140 .gmac = false,
137 .gmac4 = true, 141 .gmac4 = true,
142 .xgmac = false,
138 .min_id = DWMAC_CORE_4_00, 143 .min_id = DWMAC_CORE_4_00,
139 .regs = { 144 .regs = {
140 .ptp_off = PTP_GMAC4_OFFSET, 145 .ptp_off = PTP_GMAC4_OFFSET,
@@ -151,6 +156,7 @@ static const struct stmmac_hwif_entry {
151 }, { 156 }, {
152 .gmac = false, 157 .gmac = false,
153 .gmac4 = true, 158 .gmac4 = true,
159 .xgmac = false,
154 .min_id = DWMAC_CORE_4_10, 160 .min_id = DWMAC_CORE_4_10,
155 .regs = { 161 .regs = {
156 .ptp_off = PTP_GMAC4_OFFSET, 162 .ptp_off = PTP_GMAC4_OFFSET,
@@ -167,6 +173,7 @@ static const struct stmmac_hwif_entry {
167 }, { 173 }, {
168 .gmac = false, 174 .gmac = false,
169 .gmac4 = true, 175 .gmac4 = true,
176 .xgmac = false,
170 .min_id = DWMAC_CORE_5_10, 177 .min_id = DWMAC_CORE_5_10,
171 .regs = { 178 .regs = {
172 .ptp_off = PTP_GMAC4_OFFSET, 179 .ptp_off = PTP_GMAC4_OFFSET,
@@ -180,11 +187,29 @@ static const struct stmmac_hwif_entry {
180 .tc = &dwmac510_tc_ops, 187 .tc = &dwmac510_tc_ops,
181 .setup = dwmac4_setup, 188 .setup = dwmac4_setup,
182 .quirks = NULL, 189 .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 },
184}; 208};
185 209
186int stmmac_hwif_init(struct stmmac_priv *priv) 210int stmmac_hwif_init(struct stmmac_priv *priv)
187{ 211{
212 bool needs_xgmac = priv->plat->has_xgmac;
188 bool needs_gmac4 = priv->plat->has_gmac4; 213 bool needs_gmac4 = priv->plat->has_gmac4;
189 bool needs_gmac = priv->plat->has_gmac; 214 bool needs_gmac = priv->plat->has_gmac;
190 const struct stmmac_hwif_entry *entry; 215 const struct stmmac_hwif_entry *entry;
@@ -195,7 +220,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
195 220
196 if (needs_gmac) { 221 if (needs_gmac) {
197 id = stmmac_get_id(priv, GMAC_VERSION); 222 id = stmmac_get_id(priv, GMAC_VERSION);
198 } else if (needs_gmac4) { 223 } else if (needs_gmac4 || needs_xgmac) {
199 id = stmmac_get_id(priv, GMAC4_VERSION); 224 id = stmmac_get_id(priv, GMAC4_VERSION);
200 } else { 225 } else {
201 id = 0; 226 id = 0;
@@ -229,6 +254,8 @@ int stmmac_hwif_init(struct stmmac_priv *priv)
229 continue; 254 continue;
230 if (needs_gmac4 ^ entry->gmac4) 255 if (needs_gmac4 ^ entry->gmac4)
231 continue; 256 continue;
257 if (needs_xgmac ^ entry->xgmac)
258 continue;
232 /* Use synopsys_id var because some setups can override this */ 259 /* Use synopsys_id var because some setups can override this */
233 if (priv->synopsys_id < entry->min_id) 260 if (priv->synopsys_id < entry->min_id)
234 continue; 261 continue;
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index 32feac5bbd75..c43e9a01b892 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -190,5 +190,6 @@ struct plat_stmmacenet_data {
190 bool tso_en; 190 bool tso_en;
191 int mac_port_sel_speed; 191 int mac_port_sel_speed;
192 bool en_tx_lpi_clockgating; 192 bool en_tx_lpi_clockgating;
193 int has_xgmac;
193}; 194};
194#endif 195#endif