blob: 97e3a0f83429b16e02f39d1f75154a11efe85528 [file] [log] [blame]
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2/* Distributed Switch Architecture VSC9953 driver
3 * Copyright (C) 2020, Maxim Kochetkov <fido_max@inbox.ru>
4 */
5#include <linux/types.h>
6#include <soc/mscc/ocelot_vcap.h>
7#include <soc/mscc/ocelot_sys.h>
8#include <soc/mscc/ocelot.h>
9#include <linux/of_platform.h>
Ioana Ciornei588d0552020-08-30 11:34:02 +030010#include <linux/pcs-lynx.h>
Maxim Kochetkov84705fc2020-07-13 19:57:10 +030011#include <linux/packing.h>
12#include <linux/iopoll.h>
13#include "felix.h"
14
15#define VSC9953_VCAP_IS2_CNT 1024
16#define VSC9953_VCAP_IS2_ENTRY_WIDTH 376
17#define VSC9953_VCAP_PORT_CNT 10
18
Vladimir Oltean123d2312020-09-18 13:57:48 +030019#define MSCC_MIIM_CMD_OPR_WRITE BIT(1)
20#define MSCC_MIIM_CMD_OPR_READ BIT(2)
21#define MSCC_MIIM_CMD_WRDATA_SHIFT 4
22#define MSCC_MIIM_CMD_REGAD_SHIFT 20
23#define MSCC_MIIM_CMD_PHYAD_SHIFT 25
24#define MSCC_MIIM_CMD_VLD BIT(31)
Maxim Kochetkov84705fc2020-07-13 19:57:10 +030025
26static const u32 vsc9953_ana_regmap[] = {
27 REG(ANA_ADVLEARN, 0x00b500),
28 REG(ANA_VLANMASK, 0x00b504),
29 REG_RESERVED(ANA_PORT_B_DOMAIN),
30 REG(ANA_ANAGEFIL, 0x00b50c),
31 REG(ANA_ANEVENTS, 0x00b510),
32 REG(ANA_STORMLIMIT_BURST, 0x00b514),
33 REG(ANA_STORMLIMIT_CFG, 0x00b518),
34 REG(ANA_ISOLATED_PORTS, 0x00b528),
35 REG(ANA_COMMUNITY_PORTS, 0x00b52c),
36 REG(ANA_AUTOAGE, 0x00b530),
37 REG(ANA_MACTOPTIONS, 0x00b534),
38 REG(ANA_LEARNDISC, 0x00b538),
39 REG(ANA_AGENCTRL, 0x00b53c),
40 REG(ANA_MIRRORPORTS, 0x00b540),
41 REG(ANA_EMIRRORPORTS, 0x00b544),
42 REG(ANA_FLOODING, 0x00b548),
43 REG(ANA_FLOODING_IPMC, 0x00b54c),
44 REG(ANA_SFLOW_CFG, 0x00b550),
45 REG(ANA_PORT_MODE, 0x00b57c),
46 REG_RESERVED(ANA_CUT_THRU_CFG),
47 REG(ANA_PGID_PGID, 0x00b600),
48 REG(ANA_TABLES_ANMOVED, 0x00b4ac),
49 REG(ANA_TABLES_MACHDATA, 0x00b4b0),
50 REG(ANA_TABLES_MACLDATA, 0x00b4b4),
51 REG_RESERVED(ANA_TABLES_STREAMDATA),
52 REG(ANA_TABLES_MACACCESS, 0x00b4b8),
53 REG(ANA_TABLES_MACTINDX, 0x00b4bc),
54 REG(ANA_TABLES_VLANACCESS, 0x00b4c0),
55 REG(ANA_TABLES_VLANTIDX, 0x00b4c4),
56 REG_RESERVED(ANA_TABLES_ISDXACCESS),
57 REG_RESERVED(ANA_TABLES_ISDXTIDX),
58 REG(ANA_TABLES_ENTRYLIM, 0x00b480),
59 REG_RESERVED(ANA_TABLES_PTP_ID_HIGH),
60 REG_RESERVED(ANA_TABLES_PTP_ID_LOW),
61 REG_RESERVED(ANA_TABLES_STREAMACCESS),
62 REG_RESERVED(ANA_TABLES_STREAMTIDX),
63 REG_RESERVED(ANA_TABLES_SEQ_HISTORY),
64 REG_RESERVED(ANA_TABLES_SEQ_MASK),
65 REG_RESERVED(ANA_TABLES_SFID_MASK),
66 REG_RESERVED(ANA_TABLES_SFIDACCESS),
67 REG_RESERVED(ANA_TABLES_SFIDTIDX),
68 REG_RESERVED(ANA_MSTI_STATE),
69 REG_RESERVED(ANA_OAM_UPM_LM_CNT),
70 REG_RESERVED(ANA_SG_ACCESS_CTRL),
71 REG_RESERVED(ANA_SG_CONFIG_REG_1),
72 REG_RESERVED(ANA_SG_CONFIG_REG_2),
73 REG_RESERVED(ANA_SG_CONFIG_REG_3),
74 REG_RESERVED(ANA_SG_CONFIG_REG_4),
75 REG_RESERVED(ANA_SG_CONFIG_REG_5),
76 REG_RESERVED(ANA_SG_GCL_GS_CONFIG),
77 REG_RESERVED(ANA_SG_GCL_TI_CONFIG),
78 REG_RESERVED(ANA_SG_STATUS_REG_1),
79 REG_RESERVED(ANA_SG_STATUS_REG_2),
80 REG_RESERVED(ANA_SG_STATUS_REG_3),
81 REG(ANA_PORT_VLAN_CFG, 0x000000),
82 REG(ANA_PORT_DROP_CFG, 0x000004),
83 REG(ANA_PORT_QOS_CFG, 0x000008),
84 REG(ANA_PORT_VCAP_CFG, 0x00000c),
85 REG(ANA_PORT_VCAP_S1_KEY_CFG, 0x000010),
86 REG(ANA_PORT_VCAP_S2_CFG, 0x00001c),
87 REG(ANA_PORT_PCP_DEI_MAP, 0x000020),
88 REG(ANA_PORT_CPU_FWD_CFG, 0x000060),
89 REG(ANA_PORT_CPU_FWD_BPDU_CFG, 0x000064),
90 REG(ANA_PORT_CPU_FWD_GARP_CFG, 0x000068),
91 REG(ANA_PORT_CPU_FWD_CCM_CFG, 0x00006c),
92 REG(ANA_PORT_PORT_CFG, 0x000070),
93 REG(ANA_PORT_POL_CFG, 0x000074),
94 REG_RESERVED(ANA_PORT_PTP_CFG),
95 REG_RESERVED(ANA_PORT_PTP_DLY1_CFG),
96 REG_RESERVED(ANA_PORT_PTP_DLY2_CFG),
97 REG_RESERVED(ANA_PORT_SFID_CFG),
98 REG(ANA_PFC_PFC_CFG, 0x00c000),
99 REG_RESERVED(ANA_PFC_PFC_TIMER),
100 REG_RESERVED(ANA_IPT_OAM_MEP_CFG),
101 REG_RESERVED(ANA_IPT_IPT),
102 REG_RESERVED(ANA_PPT_PPT),
103 REG_RESERVED(ANA_FID_MAP_FID_MAP),
104 REG(ANA_AGGR_CFG, 0x00c600),
105 REG(ANA_CPUQ_CFG, 0x00c604),
106 REG_RESERVED(ANA_CPUQ_CFG2),
107 REG(ANA_CPUQ_8021_CFG, 0x00c60c),
108 REG(ANA_DSCP_CFG, 0x00c64c),
109 REG(ANA_DSCP_REWR_CFG, 0x00c74c),
110 REG(ANA_VCAP_RNG_TYPE_CFG, 0x00c78c),
111 REG(ANA_VCAP_RNG_VAL_CFG, 0x00c7ac),
112 REG_RESERVED(ANA_VRAP_CFG),
113 REG_RESERVED(ANA_VRAP_HDR_DATA),
114 REG_RESERVED(ANA_VRAP_HDR_MASK),
115 REG(ANA_DISCARD_CFG, 0x00c7d8),
116 REG(ANA_FID_CFG, 0x00c7dc),
117 REG(ANA_POL_PIR_CFG, 0x00a000),
118 REG(ANA_POL_CIR_CFG, 0x00a004),
119 REG(ANA_POL_MODE_CFG, 0x00a008),
120 REG(ANA_POL_PIR_STATE, 0x00a00c),
121 REG(ANA_POL_CIR_STATE, 0x00a010),
122 REG_RESERVED(ANA_POL_STATE),
123 REG(ANA_POL_FLOWC, 0x00c280),
124 REG(ANA_POL_HYST, 0x00c2ec),
125 REG_RESERVED(ANA_POL_MISC_CFG),
126};
127
128static const u32 vsc9953_qs_regmap[] = {
129 REG(QS_XTR_GRP_CFG, 0x000000),
130 REG(QS_XTR_RD, 0x000008),
131 REG(QS_XTR_FRM_PRUNING, 0x000010),
132 REG(QS_XTR_FLUSH, 0x000018),
133 REG(QS_XTR_DATA_PRESENT, 0x00001c),
134 REG(QS_XTR_CFG, 0x000020),
135 REG(QS_INJ_GRP_CFG, 0x000024),
136 REG(QS_INJ_WR, 0x00002c),
137 REG(QS_INJ_CTRL, 0x000034),
138 REG(QS_INJ_STATUS, 0x00003c),
139 REG(QS_INJ_ERR, 0x000040),
140 REG_RESERVED(QS_INH_DBG),
141};
142
Vladimir Olteanc1c39932020-09-30 01:27:23 +0300143static const u32 vsc9953_vcap_regmap[] = {
144 /* VCAP_CORE_CFG */
145 REG(VCAP_CORE_UPDATE_CTRL, 0x000000),
146 REG(VCAP_CORE_MV_CFG, 0x000004),
147 /* VCAP_CORE_CACHE */
148 REG(VCAP_CACHE_ENTRY_DAT, 0x000008),
149 REG(VCAP_CACHE_MASK_DAT, 0x000108),
150 REG(VCAP_CACHE_ACTION_DAT, 0x000208),
151 REG(VCAP_CACHE_CNT_DAT, 0x000308),
152 REG(VCAP_CACHE_TG_DAT, 0x000388),
Vladimir Oltean20968052020-09-30 01:27:26 +0300153 /* VCAP_CONST */
154 REG(VCAP_CONST_VCAP_VER, 0x000398),
155 REG(VCAP_CONST_ENTRY_WIDTH, 0x00039c),
156 REG(VCAP_CONST_ENTRY_CNT, 0x0003a0),
157 REG(VCAP_CONST_ENTRY_SWCNT, 0x0003a4),
158 REG(VCAP_CONST_ENTRY_TG_WIDTH, 0x0003a8),
159 REG(VCAP_CONST_ACTION_DEF_CNT, 0x0003ac),
160 REG(VCAP_CONST_ACTION_WIDTH, 0x0003b0),
161 REG(VCAP_CONST_CNT_WIDTH, 0x0003b4),
162 REG_RESERVED(VCAP_CONST_CORE_CNT),
163 REG_RESERVED(VCAP_CONST_IF_CNT),
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300164};
165
166static const u32 vsc9953_qsys_regmap[] = {
167 REG(QSYS_PORT_MODE, 0x003600),
168 REG(QSYS_SWITCH_PORT_MODE, 0x003630),
169 REG(QSYS_STAT_CNT_CFG, 0x00365c),
170 REG(QSYS_EEE_CFG, 0x003660),
171 REG(QSYS_EEE_THRES, 0x003688),
172 REG(QSYS_IGR_NO_SHARING, 0x00368c),
173 REG(QSYS_EGR_NO_SHARING, 0x003690),
174 REG(QSYS_SW_STATUS, 0x003694),
175 REG(QSYS_EXT_CPU_CFG, 0x0036c0),
176 REG_RESERVED(QSYS_PAD_CFG),
177 REG(QSYS_CPU_GROUP_MAP, 0x0036c8),
178 REG_RESERVED(QSYS_QMAP),
179 REG_RESERVED(QSYS_ISDX_SGRP),
180 REG_RESERVED(QSYS_TIMED_FRAME_ENTRY),
181 REG_RESERVED(QSYS_TFRM_MISC),
182 REG_RESERVED(QSYS_TFRM_PORT_DLY),
183 REG_RESERVED(QSYS_TFRM_TIMER_CFG_1),
184 REG_RESERVED(QSYS_TFRM_TIMER_CFG_2),
185 REG_RESERVED(QSYS_TFRM_TIMER_CFG_3),
186 REG_RESERVED(QSYS_TFRM_TIMER_CFG_4),
187 REG_RESERVED(QSYS_TFRM_TIMER_CFG_5),
188 REG_RESERVED(QSYS_TFRM_TIMER_CFG_6),
189 REG_RESERVED(QSYS_TFRM_TIMER_CFG_7),
190 REG_RESERVED(QSYS_TFRM_TIMER_CFG_8),
191 REG(QSYS_RED_PROFILE, 0x003724),
192 REG(QSYS_RES_QOS_MODE, 0x003764),
193 REG(QSYS_RES_CFG, 0x004000),
194 REG(QSYS_RES_STAT, 0x004004),
195 REG(QSYS_EGR_DROP_MODE, 0x003768),
196 REG(QSYS_EQ_CTRL, 0x00376c),
197 REG_RESERVED(QSYS_EVENTS_CORE),
198 REG_RESERVED(QSYS_QMAXSDU_CFG_0),
199 REG_RESERVED(QSYS_QMAXSDU_CFG_1),
200 REG_RESERVED(QSYS_QMAXSDU_CFG_2),
201 REG_RESERVED(QSYS_QMAXSDU_CFG_3),
202 REG_RESERVED(QSYS_QMAXSDU_CFG_4),
203 REG_RESERVED(QSYS_QMAXSDU_CFG_5),
204 REG_RESERVED(QSYS_QMAXSDU_CFG_6),
205 REG_RESERVED(QSYS_QMAXSDU_CFG_7),
206 REG_RESERVED(QSYS_PREEMPTION_CFG),
207 REG(QSYS_CIR_CFG, 0x000000),
208 REG_RESERVED(QSYS_EIR_CFG),
209 REG(QSYS_SE_CFG, 0x000008),
210 REG(QSYS_SE_DWRR_CFG, 0x00000c),
211 REG_RESERVED(QSYS_SE_CONNECT),
212 REG_RESERVED(QSYS_SE_DLB_SENSE),
213 REG(QSYS_CIR_STATE, 0x000044),
214 REG_RESERVED(QSYS_EIR_STATE),
215 REG_RESERVED(QSYS_SE_STATE),
216 REG(QSYS_HSCH_MISC_CFG, 0x003774),
217 REG_RESERVED(QSYS_TAG_CONFIG),
218 REG_RESERVED(QSYS_TAS_PARAM_CFG_CTRL),
219 REG_RESERVED(QSYS_PORT_MAX_SDU),
220 REG_RESERVED(QSYS_PARAM_CFG_REG_1),
221 REG_RESERVED(QSYS_PARAM_CFG_REG_2),
222 REG_RESERVED(QSYS_PARAM_CFG_REG_3),
223 REG_RESERVED(QSYS_PARAM_CFG_REG_4),
224 REG_RESERVED(QSYS_PARAM_CFG_REG_5),
225 REG_RESERVED(QSYS_GCL_CFG_REG_1),
226 REG_RESERVED(QSYS_GCL_CFG_REG_2),
227 REG_RESERVED(QSYS_PARAM_STATUS_REG_1),
228 REG_RESERVED(QSYS_PARAM_STATUS_REG_2),
229 REG_RESERVED(QSYS_PARAM_STATUS_REG_3),
230 REG_RESERVED(QSYS_PARAM_STATUS_REG_4),
231 REG_RESERVED(QSYS_PARAM_STATUS_REG_5),
232 REG_RESERVED(QSYS_PARAM_STATUS_REG_6),
233 REG_RESERVED(QSYS_PARAM_STATUS_REG_7),
234 REG_RESERVED(QSYS_PARAM_STATUS_REG_8),
235 REG_RESERVED(QSYS_PARAM_STATUS_REG_9),
236 REG_RESERVED(QSYS_GCL_STATUS_REG_1),
237 REG_RESERVED(QSYS_GCL_STATUS_REG_2),
238};
239
240static const u32 vsc9953_rew_regmap[] = {
241 REG(REW_PORT_VLAN_CFG, 0x000000),
242 REG(REW_TAG_CFG, 0x000004),
243 REG(REW_PORT_CFG, 0x000008),
244 REG(REW_DSCP_CFG, 0x00000c),
245 REG(REW_PCP_DEI_QOS_MAP_CFG, 0x000010),
246 REG_RESERVED(REW_PTP_CFG),
247 REG_RESERVED(REW_PTP_DLY1_CFG),
248 REG_RESERVED(REW_RED_TAG_CFG),
249 REG(REW_DSCP_REMAP_DP1_CFG, 0x000610),
250 REG(REW_DSCP_REMAP_CFG, 0x000710),
251 REG_RESERVED(REW_STAT_CFG),
252 REG_RESERVED(REW_REW_STICKY),
253 REG_RESERVED(REW_PPT),
254};
255
256static const u32 vsc9953_sys_regmap[] = {
257 REG(SYS_COUNT_RX_OCTETS, 0x000000),
258 REG(SYS_COUNT_RX_MULTICAST, 0x000008),
259 REG(SYS_COUNT_RX_SHORTS, 0x000010),
260 REG(SYS_COUNT_RX_FRAGMENTS, 0x000014),
261 REG(SYS_COUNT_RX_JABBERS, 0x000018),
262 REG(SYS_COUNT_RX_64, 0x000024),
263 REG(SYS_COUNT_RX_65_127, 0x000028),
264 REG(SYS_COUNT_RX_128_255, 0x00002c),
265 REG(SYS_COUNT_RX_256_1023, 0x000030),
266 REG(SYS_COUNT_RX_1024_1526, 0x000034),
267 REG(SYS_COUNT_RX_1527_MAX, 0x000038),
268 REG(SYS_COUNT_RX_LONGS, 0x000048),
269 REG(SYS_COUNT_TX_OCTETS, 0x000100),
270 REG(SYS_COUNT_TX_COLLISION, 0x000110),
271 REG(SYS_COUNT_TX_DROPS, 0x000114),
272 REG(SYS_COUNT_TX_64, 0x00011c),
273 REG(SYS_COUNT_TX_65_127, 0x000120),
274 REG(SYS_COUNT_TX_128_511, 0x000124),
275 REG(SYS_COUNT_TX_512_1023, 0x000128),
276 REG(SYS_COUNT_TX_1024_1526, 0x00012c),
277 REG(SYS_COUNT_TX_1527_MAX, 0x000130),
278 REG(SYS_COUNT_TX_AGING, 0x000178),
279 REG(SYS_RESET_CFG, 0x000318),
280 REG_RESERVED(SYS_SR_ETYPE_CFG),
281 REG(SYS_VLAN_ETYPE_CFG, 0x000320),
282 REG(SYS_PORT_MODE, 0x000324),
283 REG(SYS_FRONT_PORT_MODE, 0x000354),
284 REG(SYS_FRM_AGING, 0x00037c),
285 REG(SYS_STAT_CFG, 0x000380),
286 REG_RESERVED(SYS_SW_STATUS),
287 REG_RESERVED(SYS_MISC_CFG),
288 REG_RESERVED(SYS_REW_MAC_HIGH_CFG),
289 REG_RESERVED(SYS_REW_MAC_LOW_CFG),
290 REG_RESERVED(SYS_TIMESTAMP_OFFSET),
291 REG(SYS_PAUSE_CFG, 0x00044c),
292 REG(SYS_PAUSE_TOT_CFG, 0x000478),
293 REG(SYS_ATOP, 0x00047c),
294 REG(SYS_ATOP_TOT_CFG, 0x0004a8),
295 REG(SYS_MAC_FC_CFG, 0x0004ac),
296 REG(SYS_MMGT, 0x0004d4),
297 REG_RESERVED(SYS_MMGT_FAST),
298 REG_RESERVED(SYS_EVENTS_DIF),
299 REG_RESERVED(SYS_EVENTS_CORE),
300 REG_RESERVED(SYS_CNT),
301 REG_RESERVED(SYS_PTP_STATUS),
302 REG_RESERVED(SYS_PTP_TXSTAMP),
303 REG_RESERVED(SYS_PTP_NXT),
304 REG_RESERVED(SYS_PTP_CFG),
305 REG_RESERVED(SYS_RAM_INIT),
306 REG_RESERVED(SYS_CM_ADDR),
307 REG_RESERVED(SYS_CM_DATA_WR),
308 REG_RESERVED(SYS_CM_DATA_RD),
309 REG_RESERVED(SYS_CM_OP),
310 REG_RESERVED(SYS_CM_DATA),
311};
312
313static const u32 vsc9953_gcb_regmap[] = {
314 REG(GCB_SOFT_RST, 0x000008),
315 REG(GCB_MIIM_MII_STATUS, 0x0000ac),
316 REG(GCB_MIIM_MII_CMD, 0x0000b4),
317 REG(GCB_MIIM_MII_DATA, 0x0000b8),
318};
319
320static const u32 vsc9953_dev_gmii_regmap[] = {
321 REG(DEV_CLOCK_CFG, 0x0),
322 REG(DEV_PORT_MISC, 0x4),
323 REG_RESERVED(DEV_EVENTS),
324 REG(DEV_EEE_CFG, 0xc),
325 REG_RESERVED(DEV_RX_PATH_DELAY),
326 REG_RESERVED(DEV_TX_PATH_DELAY),
327 REG_RESERVED(DEV_PTP_PREDICT_CFG),
328 REG(DEV_MAC_ENA_CFG, 0x10),
329 REG(DEV_MAC_MODE_CFG, 0x14),
330 REG(DEV_MAC_MAXLEN_CFG, 0x18),
331 REG(DEV_MAC_TAGS_CFG, 0x1c),
332 REG(DEV_MAC_ADV_CHK_CFG, 0x20),
333 REG(DEV_MAC_IFG_CFG, 0x24),
334 REG(DEV_MAC_HDX_CFG, 0x28),
335 REG_RESERVED(DEV_MAC_DBG_CFG),
336 REG(DEV_MAC_FC_MAC_LOW_CFG, 0x30),
337 REG(DEV_MAC_FC_MAC_HIGH_CFG, 0x34),
338 REG(DEV_MAC_STICKY, 0x38),
339 REG_RESERVED(PCS1G_CFG),
340 REG_RESERVED(PCS1G_MODE_CFG),
341 REG_RESERVED(PCS1G_SD_CFG),
342 REG_RESERVED(PCS1G_ANEG_CFG),
343 REG_RESERVED(PCS1G_ANEG_NP_CFG),
344 REG_RESERVED(PCS1G_LB_CFG),
345 REG_RESERVED(PCS1G_DBG_CFG),
346 REG_RESERVED(PCS1G_CDET_CFG),
347 REG_RESERVED(PCS1G_ANEG_STATUS),
348 REG_RESERVED(PCS1G_ANEG_NP_STATUS),
349 REG_RESERVED(PCS1G_LINK_STATUS),
350 REG_RESERVED(PCS1G_LINK_DOWN_CNT),
351 REG_RESERVED(PCS1G_STICKY),
352 REG_RESERVED(PCS1G_DEBUG_STATUS),
353 REG_RESERVED(PCS1G_LPI_CFG),
354 REG_RESERVED(PCS1G_LPI_WAKE_ERROR_CNT),
355 REG_RESERVED(PCS1G_LPI_STATUS),
356 REG_RESERVED(PCS1G_TSTPAT_MODE_CFG),
357 REG_RESERVED(PCS1G_TSTPAT_STATUS),
358 REG_RESERVED(DEV_PCS_FX100_CFG),
359 REG_RESERVED(DEV_PCS_FX100_STATUS),
360};
361
362static const u32 *vsc9953_regmap[TARGET_MAX] = {
363 [ANA] = vsc9953_ana_regmap,
364 [QS] = vsc9953_qs_regmap,
365 [QSYS] = vsc9953_qsys_regmap,
366 [REW] = vsc9953_rew_regmap,
367 [SYS] = vsc9953_sys_regmap,
Vladimir Olteane3aea292020-09-30 01:27:25 +0300368 [S0] = vsc9953_vcap_regmap,
Vladimir Olteana61e3652020-09-30 01:27:24 +0300369 [S1] = vsc9953_vcap_regmap,
Vladimir Olteanc1c39932020-09-30 01:27:23 +0300370 [S2] = vsc9953_vcap_regmap,
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300371 [GCB] = vsc9953_gcb_regmap,
372 [DEV_GMII] = vsc9953_dev_gmii_regmap,
373};
374
375/* Addresses are relative to the device's base address */
376static const struct resource vsc9953_target_io_res[TARGET_MAX] = {
377 [ANA] = {
378 .start = 0x0280000,
379 .end = 0x028ffff,
380 .name = "ana",
381 },
382 [QS] = {
383 .start = 0x0080000,
384 .end = 0x00800ff,
385 .name = "qs",
386 },
387 [QSYS] = {
388 .start = 0x0200000,
389 .end = 0x021ffff,
390 .name = "qsys",
391 },
392 [REW] = {
393 .start = 0x0030000,
394 .end = 0x003ffff,
395 .name = "rew",
396 },
397 [SYS] = {
398 .start = 0x0010000,
399 .end = 0x001ffff,
400 .name = "sys",
401 },
Vladimir Olteane3aea292020-09-30 01:27:25 +0300402 [S0] = {
403 .start = 0x0040000,
404 .end = 0x00403ff,
405 .name = "s0",
406 },
Vladimir Olteana61e3652020-09-30 01:27:24 +0300407 [S1] = {
408 .start = 0x0050000,
409 .end = 0x00503ff,
410 .name = "s1",
411 },
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300412 [S2] = {
413 .start = 0x0060000,
414 .end = 0x00603ff,
415 .name = "s2",
416 },
417 [PTP] = {
418 .start = 0x0090000,
419 .end = 0x00900cb,
420 .name = "ptp",
421 },
422 [GCB] = {
423 .start = 0x0070000,
424 .end = 0x00701ff,
425 .name = "devcpu_gcb",
426 },
427};
428
429static const struct resource vsc9953_port_io_res[] = {
430 {
431 .start = 0x0100000,
432 .end = 0x010ffff,
433 .name = "port0",
434 },
435 {
436 .start = 0x0110000,
437 .end = 0x011ffff,
438 .name = "port1",
439 },
440 {
441 .start = 0x0120000,
442 .end = 0x012ffff,
443 .name = "port2",
444 },
445 {
446 .start = 0x0130000,
447 .end = 0x013ffff,
448 .name = "port3",
449 },
450 {
451 .start = 0x0140000,
452 .end = 0x014ffff,
453 .name = "port4",
454 },
455 {
456 .start = 0x0150000,
457 .end = 0x015ffff,
458 .name = "port5",
459 },
460 {
461 .start = 0x0160000,
462 .end = 0x016ffff,
463 .name = "port6",
464 },
465 {
466 .start = 0x0170000,
467 .end = 0x017ffff,
468 .name = "port7",
469 },
470 {
471 .start = 0x0180000,
472 .end = 0x018ffff,
473 .name = "port8",
474 },
475 {
476 .start = 0x0190000,
477 .end = 0x019ffff,
478 .name = "port9",
479 },
480};
481
482static const struct reg_field vsc9953_regfields[REGFIELD_MAX] = {
483 [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 10, 10),
484 [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 9),
485 [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24),
486 [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22),
487 [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21),
488 [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20),
489 [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19),
490 [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18),
491 [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17),
492 [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16),
493 [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15),
494 [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13),
495 [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12),
496 [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11),
497 [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10),
498 [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9),
499 [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8),
500 [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7),
501 [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6),
502 [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5),
503 [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4),
504 [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3),
505 [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2),
506 [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1),
507 [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0),
508 [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 16, 16),
509 [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 11, 12),
510 [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 10),
511 [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 7, 7),
512 [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 6, 6),
513 [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 5, 5),
514 [GCB_SOFT_RST_SWC_RST] = REG_FIELD(GCB_SOFT_RST, 0, 0),
515 [GCB_MIIM_MII_STATUS_PENDING] = REG_FIELD(GCB_MIIM_MII_STATUS, 2, 2),
516 [GCB_MIIM_MII_STATUS_BUSY] = REG_FIELD(GCB_MIIM_MII_STATUS, 3, 3),
517 /* Replicated per number of ports (11), register size 4 per port */
518 [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 13, 13, 11, 4),
519 [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 11, 4),
520 [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 11, 4),
521 [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 11, 4),
522 [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 11, 4),
523 [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 4, 5, 11, 4),
524 [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 2, 3, 11, 4),
525 [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 11, 4),
526 [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 11, 20, 11, 4),
527 [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 10, 11, 4),
528 [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 11, 4),
529};
530
531static const struct ocelot_stat_layout vsc9953_stats_layout[] = {
532 { .offset = 0x00, .name = "rx_octets", },
533 { .offset = 0x01, .name = "rx_unicast", },
534 { .offset = 0x02, .name = "rx_multicast", },
535 { .offset = 0x03, .name = "rx_broadcast", },
536 { .offset = 0x04, .name = "rx_shorts", },
537 { .offset = 0x05, .name = "rx_fragments", },
538 { .offset = 0x06, .name = "rx_jabbers", },
539 { .offset = 0x07, .name = "rx_crc_align_errs", },
540 { .offset = 0x08, .name = "rx_sym_errs", },
541 { .offset = 0x09, .name = "rx_frames_below_65_octets", },
542 { .offset = 0x0A, .name = "rx_frames_65_to_127_octets", },
543 { .offset = 0x0B, .name = "rx_frames_128_to_255_octets", },
544 { .offset = 0x0C, .name = "rx_frames_256_to_511_octets", },
545 { .offset = 0x0D, .name = "rx_frames_512_to_1023_octets", },
546 { .offset = 0x0E, .name = "rx_frames_1024_to_1526_octets", },
547 { .offset = 0x0F, .name = "rx_frames_over_1526_octets", },
548 { .offset = 0x10, .name = "rx_pause", },
549 { .offset = 0x11, .name = "rx_control", },
550 { .offset = 0x12, .name = "rx_longs", },
551 { .offset = 0x13, .name = "rx_classified_drops", },
552 { .offset = 0x14, .name = "rx_red_prio_0", },
553 { .offset = 0x15, .name = "rx_red_prio_1", },
554 { .offset = 0x16, .name = "rx_red_prio_2", },
555 { .offset = 0x17, .name = "rx_red_prio_3", },
556 { .offset = 0x18, .name = "rx_red_prio_4", },
557 { .offset = 0x19, .name = "rx_red_prio_5", },
558 { .offset = 0x1A, .name = "rx_red_prio_6", },
559 { .offset = 0x1B, .name = "rx_red_prio_7", },
560 { .offset = 0x1C, .name = "rx_yellow_prio_0", },
561 { .offset = 0x1D, .name = "rx_yellow_prio_1", },
562 { .offset = 0x1E, .name = "rx_yellow_prio_2", },
563 { .offset = 0x1F, .name = "rx_yellow_prio_3", },
564 { .offset = 0x20, .name = "rx_yellow_prio_4", },
565 { .offset = 0x21, .name = "rx_yellow_prio_5", },
566 { .offset = 0x22, .name = "rx_yellow_prio_6", },
567 { .offset = 0x23, .name = "rx_yellow_prio_7", },
568 { .offset = 0x24, .name = "rx_green_prio_0", },
569 { .offset = 0x25, .name = "rx_green_prio_1", },
570 { .offset = 0x26, .name = "rx_green_prio_2", },
571 { .offset = 0x27, .name = "rx_green_prio_3", },
572 { .offset = 0x28, .name = "rx_green_prio_4", },
573 { .offset = 0x29, .name = "rx_green_prio_5", },
574 { .offset = 0x2A, .name = "rx_green_prio_6", },
575 { .offset = 0x2B, .name = "rx_green_prio_7", },
576 { .offset = 0x40, .name = "tx_octets", },
577 { .offset = 0x41, .name = "tx_unicast", },
578 { .offset = 0x42, .name = "tx_multicast", },
579 { .offset = 0x43, .name = "tx_broadcast", },
580 { .offset = 0x44, .name = "tx_collision", },
581 { .offset = 0x45, .name = "tx_drops", },
582 { .offset = 0x46, .name = "tx_pause", },
583 { .offset = 0x47, .name = "tx_frames_below_65_octets", },
584 { .offset = 0x48, .name = "tx_frames_65_to_127_octets", },
585 { .offset = 0x49, .name = "tx_frames_128_255_octets", },
586 { .offset = 0x4A, .name = "tx_frames_256_511_octets", },
587 { .offset = 0x4B, .name = "tx_frames_512_1023_octets", },
588 { .offset = 0x4C, .name = "tx_frames_1024_1526_octets", },
589 { .offset = 0x4D, .name = "tx_frames_over_1526_octets", },
590 { .offset = 0x4E, .name = "tx_yellow_prio_0", },
591 { .offset = 0x4F, .name = "tx_yellow_prio_1", },
592 { .offset = 0x50, .name = "tx_yellow_prio_2", },
593 { .offset = 0x51, .name = "tx_yellow_prio_3", },
594 { .offset = 0x52, .name = "tx_yellow_prio_4", },
595 { .offset = 0x53, .name = "tx_yellow_prio_5", },
596 { .offset = 0x54, .name = "tx_yellow_prio_6", },
597 { .offset = 0x55, .name = "tx_yellow_prio_7", },
598 { .offset = 0x56, .name = "tx_green_prio_0", },
599 { .offset = 0x57, .name = "tx_green_prio_1", },
600 { .offset = 0x58, .name = "tx_green_prio_2", },
601 { .offset = 0x59, .name = "tx_green_prio_3", },
602 { .offset = 0x5A, .name = "tx_green_prio_4", },
603 { .offset = 0x5B, .name = "tx_green_prio_5", },
604 { .offset = 0x5C, .name = "tx_green_prio_6", },
605 { .offset = 0x5D, .name = "tx_green_prio_7", },
606 { .offset = 0x5E, .name = "tx_aged", },
607 { .offset = 0x80, .name = "drop_local", },
608 { .offset = 0x81, .name = "drop_tail", },
609 { .offset = 0x82, .name = "drop_yellow_prio_0", },
610 { .offset = 0x83, .name = "drop_yellow_prio_1", },
611 { .offset = 0x84, .name = "drop_yellow_prio_2", },
612 { .offset = 0x85, .name = "drop_yellow_prio_3", },
613 { .offset = 0x86, .name = "drop_yellow_prio_4", },
614 { .offset = 0x87, .name = "drop_yellow_prio_5", },
615 { .offset = 0x88, .name = "drop_yellow_prio_6", },
616 { .offset = 0x89, .name = "drop_yellow_prio_7", },
617 { .offset = 0x8A, .name = "drop_green_prio_0", },
618 { .offset = 0x8B, .name = "drop_green_prio_1", },
619 { .offset = 0x8C, .name = "drop_green_prio_2", },
620 { .offset = 0x8D, .name = "drop_green_prio_3", },
621 { .offset = 0x8E, .name = "drop_green_prio_4", },
622 { .offset = 0x8F, .name = "drop_green_prio_5", },
623 { .offset = 0x90, .name = "drop_green_prio_6", },
624 { .offset = 0x91, .name = "drop_green_prio_7", },
625};
626
Vladimir Olteane3aea292020-09-30 01:27:25 +0300627static const struct vcap_field vsc9953_vcap_es0_keys[] = {
628 [VCAP_ES0_EGR_PORT] = { 0, 4},
629 [VCAP_ES0_IGR_PORT] = { 4, 4},
630 [VCAP_ES0_RSV] = { 8, 2},
631 [VCAP_ES0_L2_MC] = { 10, 1},
632 [VCAP_ES0_L2_BC] = { 11, 1},
633 [VCAP_ES0_VID] = { 12, 12},
634 [VCAP_ES0_DP] = { 24, 1},
635 [VCAP_ES0_PCP] = { 25, 3},
636};
637
638static const struct vcap_field vsc9953_vcap_es0_actions[] = {
639 [VCAP_ES0_ACT_PUSH_OUTER_TAG] = { 0, 2},
640 [VCAP_ES0_ACT_PUSH_INNER_TAG] = { 2, 1},
641 [VCAP_ES0_ACT_TAG_A_TPID_SEL] = { 3, 2},
642 [VCAP_ES0_ACT_TAG_A_VID_SEL] = { 5, 1},
643 [VCAP_ES0_ACT_TAG_A_PCP_SEL] = { 6, 2},
644 [VCAP_ES0_ACT_TAG_A_DEI_SEL] = { 8, 2},
645 [VCAP_ES0_ACT_TAG_B_TPID_SEL] = { 10, 2},
646 [VCAP_ES0_ACT_TAG_B_VID_SEL] = { 12, 1},
647 [VCAP_ES0_ACT_TAG_B_PCP_SEL] = { 13, 2},
648 [VCAP_ES0_ACT_TAG_B_DEI_SEL] = { 15, 2},
649 [VCAP_ES0_ACT_VID_A_VAL] = { 17, 12},
650 [VCAP_ES0_ACT_PCP_A_VAL] = { 29, 3},
651 [VCAP_ES0_ACT_DEI_A_VAL] = { 32, 1},
652 [VCAP_ES0_ACT_VID_B_VAL] = { 33, 12},
653 [VCAP_ES0_ACT_PCP_B_VAL] = { 45, 3},
654 [VCAP_ES0_ACT_DEI_B_VAL] = { 48, 1},
655 [VCAP_ES0_ACT_RSV] = { 49, 24},
656 [VCAP_ES0_ACT_HIT_STICKY] = { 73, 1},
657};
658
Vladimir Olteana61e3652020-09-30 01:27:24 +0300659static const struct vcap_field vsc9953_vcap_is1_keys[] = {
660 [VCAP_IS1_HK_TYPE] = { 0, 1},
661 [VCAP_IS1_HK_LOOKUP] = { 1, 2},
662 [VCAP_IS1_HK_IGR_PORT_MASK] = { 3, 11},
663 [VCAP_IS1_HK_RSV] = { 14, 10},
664 /* VCAP_IS1_HK_OAM_Y1731 not supported */
665 [VCAP_IS1_HK_L2_MC] = { 24, 1},
666 [VCAP_IS1_HK_L2_BC] = { 25, 1},
667 [VCAP_IS1_HK_IP_MC] = { 26, 1},
668 [VCAP_IS1_HK_VLAN_TAGGED] = { 27, 1},
669 [VCAP_IS1_HK_VLAN_DBL_TAGGED] = { 28, 1},
670 [VCAP_IS1_HK_TPID] = { 29, 1},
671 [VCAP_IS1_HK_VID] = { 30, 12},
672 [VCAP_IS1_HK_DEI] = { 42, 1},
673 [VCAP_IS1_HK_PCP] = { 43, 3},
674 /* Specific Fields for IS1 Half Key S1_NORMAL */
675 [VCAP_IS1_HK_L2_SMAC] = { 46, 48},
676 [VCAP_IS1_HK_ETYPE_LEN] = { 94, 1},
677 [VCAP_IS1_HK_ETYPE] = { 95, 16},
678 [VCAP_IS1_HK_IP_SNAP] = {111, 1},
679 [VCAP_IS1_HK_IP4] = {112, 1},
680 /* Layer-3 Information */
681 [VCAP_IS1_HK_L3_FRAGMENT] = {113, 1},
682 [VCAP_IS1_HK_L3_FRAG_OFS_GT0] = {114, 1},
683 [VCAP_IS1_HK_L3_OPTIONS] = {115, 1},
684 [VCAP_IS1_HK_L3_DSCP] = {116, 6},
685 [VCAP_IS1_HK_L3_IP4_SIP] = {122, 32},
686 /* Layer-4 Information */
687 [VCAP_IS1_HK_TCP_UDP] = {154, 1},
688 [VCAP_IS1_HK_TCP] = {155, 1},
689 [VCAP_IS1_HK_L4_SPORT] = {156, 16},
690 [VCAP_IS1_HK_L4_RNG] = {172, 8},
691 /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */
692 [VCAP_IS1_HK_IP4_INNER_TPID] = { 46, 1},
693 [VCAP_IS1_HK_IP4_INNER_VID] = { 47, 12},
694 [VCAP_IS1_HK_IP4_INNER_DEI] = { 59, 1},
695 [VCAP_IS1_HK_IP4_INNER_PCP] = { 60, 3},
696 [VCAP_IS1_HK_IP4_IP4] = { 63, 1},
697 [VCAP_IS1_HK_IP4_L3_FRAGMENT] = { 64, 1},
698 [VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0] = { 65, 1},
699 [VCAP_IS1_HK_IP4_L3_OPTIONS] = { 66, 1},
700 [VCAP_IS1_HK_IP4_L3_DSCP] = { 67, 6},
701 [VCAP_IS1_HK_IP4_L3_IP4_DIP] = { 73, 32},
702 [VCAP_IS1_HK_IP4_L3_IP4_SIP] = {105, 32},
703 [VCAP_IS1_HK_IP4_L3_PROTO] = {137, 8},
704 [VCAP_IS1_HK_IP4_TCP_UDP] = {145, 1},
705 [VCAP_IS1_HK_IP4_TCP] = {146, 1},
706 [VCAP_IS1_HK_IP4_L4_RNG] = {147, 8},
707 [VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE] = {155, 32},
708};
709
710static const struct vcap_field vsc9953_vcap_is1_actions[] = {
711 [VCAP_IS1_ACT_DSCP_ENA] = { 0, 1},
712 [VCAP_IS1_ACT_DSCP_VAL] = { 1, 6},
713 [VCAP_IS1_ACT_QOS_ENA] = { 7, 1},
714 [VCAP_IS1_ACT_QOS_VAL] = { 8, 3},
715 [VCAP_IS1_ACT_DP_ENA] = { 11, 1},
716 [VCAP_IS1_ACT_DP_VAL] = { 12, 1},
717 [VCAP_IS1_ACT_PAG_OVERRIDE_MASK] = { 13, 8},
718 [VCAP_IS1_ACT_PAG_VAL] = { 21, 8},
719 [VCAP_IS1_ACT_RSV] = { 29, 11},
720 [VCAP_IS1_ACT_VID_REPLACE_ENA] = { 40, 1},
721 [VCAP_IS1_ACT_VID_ADD_VAL] = { 41, 12},
722 [VCAP_IS1_ACT_FID_SEL] = { 53, 2},
723 [VCAP_IS1_ACT_FID_VAL] = { 55, 13},
724 [VCAP_IS1_ACT_PCP_DEI_ENA] = { 68, 1},
725 [VCAP_IS1_ACT_PCP_VAL] = { 69, 3},
726 [VCAP_IS1_ACT_DEI_VAL] = { 72, 1},
727 [VCAP_IS1_ACT_VLAN_POP_CNT_ENA] = { 73, 1},
728 [VCAP_IS1_ACT_VLAN_POP_CNT] = { 74, 2},
729 [VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA] = { 76, 4},
730 [VCAP_IS1_ACT_HIT_STICKY] = { 80, 1},
731};
732
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300733static struct vcap_field vsc9953_vcap_is2_keys[] = {
734 /* Common: 41 bits */
735 [VCAP_IS2_TYPE] = { 0, 4},
736 [VCAP_IS2_HK_FIRST] = { 4, 1},
737 [VCAP_IS2_HK_PAG] = { 5, 8},
738 [VCAP_IS2_HK_IGR_PORT_MASK] = { 13, 11},
739 [VCAP_IS2_HK_RSV2] = { 24, 1},
740 [VCAP_IS2_HK_HOST_MATCH] = { 25, 1},
741 [VCAP_IS2_HK_L2_MC] = { 26, 1},
742 [VCAP_IS2_HK_L2_BC] = { 27, 1},
743 [VCAP_IS2_HK_VLAN_TAGGED] = { 28, 1},
744 [VCAP_IS2_HK_VID] = { 29, 12},
745 [VCAP_IS2_HK_DEI] = { 41, 1},
746 [VCAP_IS2_HK_PCP] = { 42, 3},
747 /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */
748 [VCAP_IS2_HK_L2_DMAC] = { 45, 48},
749 [VCAP_IS2_HK_L2_SMAC] = { 93, 48},
750 /* MAC_ETYPE (TYPE=000) */
751 [VCAP_IS2_HK_MAC_ETYPE_ETYPE] = {141, 16},
752 [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0] = {157, 16},
753 [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1] = {173, 8},
754 [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2] = {181, 3},
755 /* MAC_LLC (TYPE=001) */
756 [VCAP_IS2_HK_MAC_LLC_L2_LLC] = {141, 40},
757 /* MAC_SNAP (TYPE=010) */
758 [VCAP_IS2_HK_MAC_SNAP_L2_SNAP] = {141, 40},
759 /* MAC_ARP (TYPE=011) */
760 [VCAP_IS2_HK_MAC_ARP_SMAC] = { 45, 48},
761 [VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK] = { 93, 1},
762 [VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK] = { 94, 1},
763 [VCAP_IS2_HK_MAC_ARP_LEN_OK] = { 95, 1},
764 [VCAP_IS2_HK_MAC_ARP_TARGET_MATCH] = { 96, 1},
765 [VCAP_IS2_HK_MAC_ARP_SENDER_MATCH] = { 97, 1},
766 [VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN] = { 98, 1},
767 [VCAP_IS2_HK_MAC_ARP_OPCODE] = { 99, 2},
768 [VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP] = {101, 32},
769 [VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP] = {133, 32},
770 [VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP] = {165, 1},
771 /* IP4_TCP_UDP / IP4_OTHER common */
772 [VCAP_IS2_HK_IP4] = { 45, 1},
773 [VCAP_IS2_HK_L3_FRAGMENT] = { 46, 1},
774 [VCAP_IS2_HK_L3_FRAG_OFS_GT0] = { 47, 1},
775 [VCAP_IS2_HK_L3_OPTIONS] = { 48, 1},
776 [VCAP_IS2_HK_IP4_L3_TTL_GT0] = { 49, 1},
777 [VCAP_IS2_HK_L3_TOS] = { 50, 8},
778 [VCAP_IS2_HK_L3_IP4_DIP] = { 58, 32},
779 [VCAP_IS2_HK_L3_IP4_SIP] = { 90, 32},
780 [VCAP_IS2_HK_DIP_EQ_SIP] = {122, 1},
781 /* IP4_TCP_UDP (TYPE=100) */
782 [VCAP_IS2_HK_TCP] = {123, 1},
Vladimir Oltean7a023072020-09-22 01:56:37 +0300783 [VCAP_IS2_HK_L4_DPORT] = {124, 16},
784 [VCAP_IS2_HK_L4_SPORT] = {140, 16},
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300785 [VCAP_IS2_HK_L4_RNG] = {156, 8},
786 [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {164, 1},
787 [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {165, 1},
Vladimir Oltean7a023072020-09-22 01:56:37 +0300788 [VCAP_IS2_HK_L4_FIN] = {166, 1},
789 [VCAP_IS2_HK_L4_SYN] = {167, 1},
790 [VCAP_IS2_HK_L4_RST] = {168, 1},
791 [VCAP_IS2_HK_L4_PSH] = {169, 1},
792 [VCAP_IS2_HK_L4_ACK] = {170, 1},
793 [VCAP_IS2_HK_L4_URG] = {171, 1},
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300794 /* IP4_OTHER (TYPE=101) */
795 [VCAP_IS2_HK_IP4_L3_PROTO] = {123, 8},
796 [VCAP_IS2_HK_L3_PAYLOAD] = {131, 56},
797 /* IP6_STD (TYPE=110) */
798 [VCAP_IS2_HK_IP6_L3_TTL_GT0] = { 45, 1},
799 [VCAP_IS2_HK_L3_IP6_SIP] = { 46, 128},
800 [VCAP_IS2_HK_IP6_L3_PROTO] = {174, 8},
801};
802
803static struct vcap_field vsc9953_vcap_is2_actions[] = {
804 [VCAP_IS2_ACT_HIT_ME_ONCE] = { 0, 1},
805 [VCAP_IS2_ACT_CPU_COPY_ENA] = { 1, 1},
806 [VCAP_IS2_ACT_CPU_QU_NUM] = { 2, 3},
807 [VCAP_IS2_ACT_MASK_MODE] = { 5, 2},
808 [VCAP_IS2_ACT_MIRROR_ENA] = { 7, 1},
809 [VCAP_IS2_ACT_LRN_DIS] = { 8, 1},
810 [VCAP_IS2_ACT_POLICE_ENA] = { 9, 1},
811 [VCAP_IS2_ACT_POLICE_IDX] = { 10, 8},
812 [VCAP_IS2_ACT_POLICE_VCAP_ONLY] = { 21, 1},
813 [VCAP_IS2_ACT_PORT_MASK] = { 22, 10},
814 [VCAP_IS2_ACT_ACL_ID] = { 44, 6},
815 [VCAP_IS2_ACT_HIT_CNT] = { 50, 32},
816};
817
Vladimir Oltean20968052020-09-30 01:27:26 +0300818static struct vcap_props vsc9953_vcap_props[] = {
Vladimir Olteane3aea292020-09-30 01:27:25 +0300819 [VCAP_ES0] = {
820 .action_type_width = 0,
821 .action_table = {
822 [ES0_ACTION_TYPE_NORMAL] = {
823 .width = 73, /* HIT_STICKY not included */
824 .count = 1,
825 },
826 },
827 .target = S0,
828 .keys = vsc9953_vcap_es0_keys,
829 .actions = vsc9953_vcap_es0_actions,
830 },
Vladimir Olteana61e3652020-09-30 01:27:24 +0300831 [VCAP_IS1] = {
832 .action_type_width = 0,
833 .action_table = {
834 [IS1_ACTION_TYPE_NORMAL] = {
835 .width = 80, /* HIT_STICKY not included */
836 .count = 4,
837 },
838 },
839 .target = S1,
840 .keys = vsc9953_vcap_is1_keys,
841 .actions = vsc9953_vcap_is1_actions,
842 },
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300843 [VCAP_IS2] = {
844 .tg_width = 2,
845 .sw_count = 4,
846 .entry_count = VSC9953_VCAP_IS2_CNT,
847 .entry_width = VSC9953_VCAP_IS2_ENTRY_WIDTH,
848 .action_count = VSC9953_VCAP_IS2_CNT +
849 VSC9953_VCAP_PORT_CNT + 2,
850 .action_width = 101,
851 .action_type_width = 1,
852 .action_table = {
853 [IS2_ACTION_TYPE_NORMAL] = {
854 .width = 44,
855 .count = 2
856 },
857 [IS2_ACTION_TYPE_SMAC_SIP] = {
858 .width = 6,
859 .count = 4
860 },
861 },
862 .counter_words = 4,
863 .counter_width = 32,
Vladimir Olteanc1c39932020-09-30 01:27:23 +0300864 .target = S2,
865 .keys = vsc9953_vcap_is2_keys,
866 .actions = vsc9953_vcap_is2_actions,
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300867 },
868};
869
870#define VSC9953_INIT_TIMEOUT 50000
871#define VSC9953_GCB_RST_SLEEP 100
872#define VSC9953_SYS_RAMINIT_SLEEP 80
873#define VCS9953_MII_TIMEOUT 10000
874
875static int vsc9953_gcb_soft_rst_status(struct ocelot *ocelot)
876{
877 int val;
878
879 ocelot_field_read(ocelot, GCB_SOFT_RST_SWC_RST, &val);
880
881 return val;
882}
883
884static int vsc9953_sys_ram_init_status(struct ocelot *ocelot)
885{
886 int val;
887
888 ocelot_field_read(ocelot, SYS_RESET_CFG_MEM_INIT, &val);
889
890 return val;
891}
892
893static int vsc9953_gcb_miim_pending_status(struct ocelot *ocelot)
894{
895 int val;
896
897 ocelot_field_read(ocelot, GCB_MIIM_MII_STATUS_PENDING, &val);
898
899 return val;
900}
901
902static int vsc9953_gcb_miim_busy_status(struct ocelot *ocelot)
903{
904 int val;
905
906 ocelot_field_read(ocelot, GCB_MIIM_MII_STATUS_BUSY, &val);
907
908 return val;
909}
910
911static int vsc9953_mdio_write(struct mii_bus *bus, int phy_id, int regnum,
912 u16 value)
913{
914 struct ocelot *ocelot = bus->priv;
915 int err, cmd, val;
916
917 /* Wait while MIIM controller becomes idle */
918 err = readx_poll_timeout(vsc9953_gcb_miim_pending_status, ocelot,
919 val, !val, 10, VCS9953_MII_TIMEOUT);
920 if (err) {
921 dev_err(ocelot->dev, "MDIO write: pending timeout\n");
922 goto out;
923 }
924
925 cmd = MSCC_MIIM_CMD_VLD | (phy_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
926 (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) |
927 (value << MSCC_MIIM_CMD_WRDATA_SHIFT) |
928 MSCC_MIIM_CMD_OPR_WRITE;
929
930 ocelot_write(ocelot, cmd, GCB_MIIM_MII_CMD);
931
932out:
933 return err;
934}
935
936static int vsc9953_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
937{
938 struct ocelot *ocelot = bus->priv;
939 int err, cmd, val;
940
941 /* Wait until MIIM controller becomes idle */
942 err = readx_poll_timeout(vsc9953_gcb_miim_pending_status, ocelot,
943 val, !val, 10, VCS9953_MII_TIMEOUT);
944 if (err) {
945 dev_err(ocelot->dev, "MDIO read: pending timeout\n");
946 goto out;
947 }
948
949 /* Write the MIIM COMMAND register */
950 cmd = MSCC_MIIM_CMD_VLD | (phy_id << MSCC_MIIM_CMD_PHYAD_SHIFT) |
951 (regnum << MSCC_MIIM_CMD_REGAD_SHIFT) | MSCC_MIIM_CMD_OPR_READ;
952
953 ocelot_write(ocelot, cmd, GCB_MIIM_MII_CMD);
954
955 /* Wait while read operation via the MIIM controller is in progress */
956 err = readx_poll_timeout(vsc9953_gcb_miim_busy_status, ocelot,
957 val, !val, 10, VCS9953_MII_TIMEOUT);
958 if (err) {
959 dev_err(ocelot->dev, "MDIO read: busy timeout\n");
960 goto out;
961 }
962
963 val = ocelot_read(ocelot, GCB_MIIM_MII_DATA);
964
965 err = val & 0xFFFF;
966out:
967 return err;
968}
969
Vladimir Olteanc129fc52020-09-18 13:57:46 +0300970/* CORE_ENA is in SYS:SYSTEM:RESET_CFG
971 * MEM_INIT is in SYS:SYSTEM:RESET_CFG
972 * MEM_ENA is in SYS:SYSTEM:RESET_CFG
973 */
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300974static int vsc9953_reset(struct ocelot *ocelot)
975{
976 int val, err;
977
978 /* soft-reset the switch core */
979 ocelot_field_write(ocelot, GCB_SOFT_RST_SWC_RST, 1);
980
981 err = readx_poll_timeout(vsc9953_gcb_soft_rst_status, ocelot, val, !val,
982 VSC9953_GCB_RST_SLEEP, VSC9953_INIT_TIMEOUT);
983 if (err) {
984 dev_err(ocelot->dev, "timeout: switch core reset\n");
985 return err;
986 }
987
988 /* initialize switch mem ~40us */
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300989 ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_ENA, 1);
Vladimir Oltean9a73f0b2020-09-18 13:57:45 +0300990 ocelot_field_write(ocelot, SYS_RESET_CFG_MEM_INIT, 1);
Maxim Kochetkov84705fc2020-07-13 19:57:10 +0300991
992 err = readx_poll_timeout(vsc9953_sys_ram_init_status, ocelot, val, !val,
993 VSC9953_SYS_RAMINIT_SLEEP,
994 VSC9953_INIT_TIMEOUT);
995 if (err) {
996 dev_err(ocelot->dev, "timeout: switch sram init\n");
997 return err;
998 }
999
1000 /* enable switch core */
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001001 ocelot_field_write(ocelot, SYS_RESET_CFG_CORE_ENA, 1);
1002
1003 return 0;
1004}
1005
1006static void vsc9953_phylink_validate(struct ocelot *ocelot, int port,
1007 unsigned long *supported,
1008 struct phylink_link_state *state)
1009{
1010 struct ocelot_port *ocelot_port = ocelot->ports[port];
1011 __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
1012
1013 if (state->interface != PHY_INTERFACE_MODE_NA &&
1014 state->interface != ocelot_port->phy_mode) {
1015 bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
1016 return;
1017 }
1018
1019 phylink_set_port_modes(mask);
1020 phylink_set(mask, Autoneg);
1021 phylink_set(mask, Pause);
1022 phylink_set(mask, Asym_Pause);
1023 phylink_set(mask, 10baseT_Full);
1024 phylink_set(mask, 10baseT_Half);
1025 phylink_set(mask, 100baseT_Full);
1026 phylink_set(mask, 100baseT_Half);
1027 phylink_set(mask, 1000baseT_Full);
1028
1029 if (state->interface == PHY_INTERFACE_MODE_INTERNAL) {
1030 phylink_set(mask, 2500baseT_Full);
1031 phylink_set(mask, 2500baseX_Full);
1032 }
1033
1034 bitmap_and(supported, supported, mask,
1035 __ETHTOOL_LINK_MODE_MASK_NBITS);
1036 bitmap_and(state->advertising, state->advertising, mask,
1037 __ETHTOOL_LINK_MODE_MASK_NBITS);
1038}
1039
1040static int vsc9953_prevalidate_phy_mode(struct ocelot *ocelot, int port,
1041 phy_interface_t phy_mode)
1042{
1043 switch (phy_mode) {
1044 case PHY_INTERFACE_MODE_INTERNAL:
1045 if (port != 8 && port != 9)
1046 return -ENOTSUPP;
1047 return 0;
1048 case PHY_INTERFACE_MODE_SGMII:
1049 case PHY_INTERFACE_MODE_QSGMII:
1050 /* Not supported on internal to-CPU ports */
1051 if (port == 8 || port == 9)
1052 return -ENOTSUPP;
1053 return 0;
1054 default:
1055 return -ENOTSUPP;
1056 }
1057}
1058
1059/* Watermark encode
1060 * Bit 9: Unit; 0:1, 1:16
1061 * Bit 8-0: Value to be multiplied with unit
1062 */
1063static u16 vsc9953_wm_enc(u16 value)
1064{
1065 if (value >= BIT(9))
1066 return BIT(9) | (value / 16);
1067
1068 return value;
1069}
1070
1071static const struct ocelot_ops vsc9953_ops = {
1072 .reset = vsc9953_reset,
1073 .wm_enc = vsc9953_wm_enc,
1074};
1075
1076static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
1077{
1078 struct felix *felix = ocelot_to_felix(ocelot);
1079 struct device *dev = ocelot->dev;
1080 struct mii_bus *bus;
1081 int port;
1082 int rc;
1083
1084 felix->pcs = devm_kcalloc(dev, felix->info->num_ports,
1085 sizeof(struct phy_device *),
1086 GFP_KERNEL);
1087 if (!felix->pcs) {
1088 dev_err(dev, "failed to allocate array for PCS PHYs\n");
1089 return -ENOMEM;
1090 }
1091
1092 bus = devm_mdiobus_alloc(dev);
1093 if (!bus)
1094 return -ENOMEM;
1095
1096 bus->name = "VSC9953 internal MDIO bus";
1097 bus->read = vsc9953_mdio_read;
1098 bus->write = vsc9953_mdio_write;
1099 bus->parent = dev;
1100 bus->priv = ocelot;
1101 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev));
1102
1103 /* Needed in order to initialize the bus mutex lock */
1104 rc = mdiobus_register(bus);
1105 if (rc < 0) {
1106 dev_err(dev, "failed to register MDIO bus\n");
1107 return rc;
1108 }
1109
1110 felix->imdio = bus;
1111
1112 for (port = 0; port < felix->info->num_ports; port++) {
1113 struct ocelot_port *ocelot_port = ocelot->ports[port];
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001114 int addr = port + 4;
Ioana Ciornei588d0552020-08-30 11:34:02 +03001115 struct mdio_device *pcs;
1116 struct lynx_pcs *lynx;
1117
1118 if (dsa_is_unused_port(felix->ds, port))
1119 continue;
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001120
1121 if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL)
1122 continue;
1123
Ioana Ciornei588d0552020-08-30 11:34:02 +03001124 pcs = mdio_device_create(felix->imdio, addr);
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001125 if (IS_ERR(pcs))
1126 continue;
1127
Ioana Ciornei588d0552020-08-30 11:34:02 +03001128 lynx = lynx_pcs_create(pcs);
1129 if (!lynx) {
1130 mdio_device_free(pcs);
1131 continue;
1132 }
1133
1134 felix->pcs[port] = lynx;
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001135
1136 dev_info(dev, "Found PCS at internal MDIO address %d\n", addr);
1137 }
1138
1139 return 0;
1140}
1141
Vladimir Olteanccfdbab2020-09-18 13:57:50 +03001142static void vsc9953_mdio_bus_free(struct ocelot *ocelot)
1143{
1144 struct felix *felix = ocelot_to_felix(ocelot);
1145 int port;
1146
1147 for (port = 0; port < ocelot->num_phys_ports; port++) {
1148 struct lynx_pcs *pcs = felix->pcs[port];
1149
1150 if (!pcs)
1151 continue;
1152
1153 mdio_device_free(pcs->mdio);
1154 lynx_pcs_destroy(pcs);
1155 }
1156 mdiobus_unregister(felix->imdio);
1157}
1158
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001159static void vsc9953_xmit_template_populate(struct ocelot *ocelot, int port)
1160{
1161 struct ocelot_port *ocelot_port = ocelot->ports[port];
1162 u8 *template = ocelot_port->xmit_template;
1163 u64 bypass, dest, src;
Vladimir Oltean51241972020-09-26 22:32:04 +03001164 __be32 *prefix;
1165 u8 *injection;
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001166
1167 /* Set the source port as the CPU port module and not the
1168 * NPI port
1169 */
1170 src = ocelot->num_phys_ports;
1171 dest = BIT(port);
1172 bypass = true;
1173
Vladimir Oltean51241972020-09-26 22:32:04 +03001174 injection = template + OCELOT_SHORT_PREFIX_LEN;
1175 prefix = (__be32 *)template;
1176
1177 packing(injection, &bypass, 127, 127, OCELOT_TAG_LEN, PACK, 0);
1178 packing(injection, &dest, 67, 57, OCELOT_TAG_LEN, PACK, 0);
1179 packing(injection, &src, 46, 43, OCELOT_TAG_LEN, PACK, 0);
1180
1181 *prefix = cpu_to_be32(0x88800005);
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001182}
1183
1184static const struct felix_info seville_info_vsc9953 = {
1185 .target_io_res = vsc9953_target_io_res,
1186 .port_io_res = vsc9953_port_io_res,
1187 .regfields = vsc9953_regfields,
1188 .map = vsc9953_regmap,
1189 .ops = &vsc9953_ops,
1190 .stats_layout = vsc9953_stats_layout,
1191 .num_stats = ARRAY_SIZE(vsc9953_stats_layout),
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001192 .vcap = vsc9953_vcap_props,
Vladimir Olteana63ed922020-09-18 04:07:25 +03001193 .shared_queue_sz = 2048 * 1024,
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001194 .num_mact_rows = 2048,
1195 .num_ports = 10,
1196 .mdio_bus_alloc = vsc9953_mdio_bus_alloc,
Vladimir Olteanccfdbab2020-09-18 13:57:50 +03001197 .mdio_bus_free = vsc9953_mdio_bus_free,
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001198 .phylink_validate = vsc9953_phylink_validate,
1199 .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode,
1200 .xmit_template_populate = vsc9953_xmit_template_populate,
1201};
1202
1203static int seville_probe(struct platform_device *pdev)
1204{
1205 struct dsa_switch *ds;
1206 struct ocelot *ocelot;
1207 struct resource *res;
1208 struct felix *felix;
1209 int err;
1210
1211 felix = kzalloc(sizeof(struct felix), GFP_KERNEL);
1212 if (!felix) {
1213 err = -ENOMEM;
1214 dev_err(&pdev->dev, "Failed to allocate driver memory\n");
1215 goto err_alloc_felix;
1216 }
1217
1218 platform_set_drvdata(pdev, felix);
1219
1220 ocelot = &felix->ocelot;
1221 ocelot->dev = &pdev->dev;
1222 felix->info = &seville_info_vsc9953;
1223
1224 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1225 felix->switch_base = res->start;
1226
1227 ds = kzalloc(sizeof(struct dsa_switch), GFP_KERNEL);
1228 if (!ds) {
1229 err = -ENOMEM;
1230 dev_err(&pdev->dev, "Failed to allocate DSA switch\n");
1231 goto err_alloc_ds;
1232 }
1233
1234 ds->dev = &pdev->dev;
1235 ds->num_ports = felix->info->num_ports;
1236 ds->ops = &felix_switch_ops;
1237 ds->priv = ocelot;
1238 felix->ds = ds;
1239
1240 err = dsa_register_switch(ds);
1241 if (err) {
1242 dev_err(&pdev->dev, "Failed to register DSA switch: %d\n", err);
1243 goto err_register_ds;
1244 }
1245
1246 return 0;
1247
1248err_register_ds:
1249 kfree(ds);
1250err_alloc_ds:
1251err_alloc_felix:
1252 kfree(felix);
1253 return err;
1254}
1255
1256static int seville_remove(struct platform_device *pdev)
1257{
1258 struct felix *felix;
1259
1260 felix = platform_get_drvdata(pdev);
1261
1262 dsa_unregister_switch(felix->ds);
1263
1264 kfree(felix->ds);
1265 kfree(felix);
1266
1267 return 0;
1268}
1269
1270static const struct of_device_id seville_of_match[] = {
1271 { .compatible = "mscc,vsc9953-switch" },
1272 { },
1273};
1274MODULE_DEVICE_TABLE(of, seville_of_match);
1275
Vladimir Olteand60bc622020-09-18 13:57:53 +03001276static struct platform_driver seville_vsc9953_driver = {
Maxim Kochetkov84705fc2020-07-13 19:57:10 +03001277 .probe = seville_probe,
1278 .remove = seville_remove,
1279 .driver = {
1280 .name = "mscc_seville",
1281 .of_match_table = of_match_ptr(seville_of_match),
1282 },
1283};
Vladimir Olteand60bc622020-09-18 13:57:53 +03001284module_platform_driver(seville_vsc9953_driver);
1285
1286MODULE_DESCRIPTION("Seville Switch driver");
1287MODULE_LICENSE("GPL v2");