1*3833Sxw161283 /*
2*3833Sxw161283 * CDDL HEADER START
3*3833Sxw161283 *
4*3833Sxw161283 * The contents of this file are subject to the terms of the
5*3833Sxw161283 * Common Development and Distribution License (the "License").
6*3833Sxw161283 * You may not use this file except in compliance with the License.
7*3833Sxw161283 *
8*3833Sxw161283 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*3833Sxw161283 * or http://www.opensolaris.org/os/licensing.
10*3833Sxw161283 * See the License for the specific language governing permissions
11*3833Sxw161283 * and limitations under the License.
12*3833Sxw161283 *
13*3833Sxw161283 * When distributing Covered Code, include this CDDL HEADER in each
14*3833Sxw161283 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*3833Sxw161283 * If applicable, add the following below this CDDL HEADER, with the
16*3833Sxw161283 * fields enclosed by brackets "[]" replaced with your own identifying
17*3833Sxw161283 * information: Portions Copyright [yyyy] [name of copyright owner]
18*3833Sxw161283 *
19*3833Sxw161283 * CDDL HEADER END
20*3833Sxw161283 */
21*3833Sxw161283
22*3833Sxw161283 /*
23*3833Sxw161283 * Copyright (C) 2003-2005 Chelsio Communications. All rights reserved.
24*3833Sxw161283 */
25*3833Sxw161283
26*3833Sxw161283 #pragma ident "%Z%%M% %I% %E% SMI"
27*3833Sxw161283
28*3833Sxw161283 /* Driver for Vitesse VSC7326 (Schaumburg) MAC */
29*3833Sxw161283
30*3833Sxw161283 #include "gmac.h"
31*3833Sxw161283 #include "elmer0.h"
32*3833Sxw161283 #include "vsc7326_reg.h"
33*3833Sxw161283
34*3833Sxw161283 FILE_IDENT("@(#) $Id: vsc7326.c,v 1.17 2005/10/29 05:42:36 sbardone Exp $");
35*3833Sxw161283
36*3833Sxw161283 /* Update fast changing statistics every 15 seconds */
37*3833Sxw161283 #define STATS_TICK_SECS 15
38*3833Sxw161283 /* 30 minutes for full statistics update */
39*3833Sxw161283 #define MAJOR_UPDATE_TICKS (1800 / STATS_TICK_SECS)
40*3833Sxw161283
41*3833Sxw161283 #define MAX_MTU 9600
42*3833Sxw161283
43*3833Sxw161283 struct init_table {
44*3833Sxw161283 u32 addr;
45*3833Sxw161283 u32 data;
46*3833Sxw161283 };
47*3833Sxw161283
48*3833Sxw161283 struct _cmac_instance {
49*3833Sxw161283 u32 index;
50*3833Sxw161283 u32 ticks;
51*3833Sxw161283 };
52*3833Sxw161283
53*3833Sxw161283 #define INITBLOCK_SLEEP 0xffffffff
54*3833Sxw161283
vsc_read(adapter_t * adapter,u32 addr,u32 * val)55*3833Sxw161283 static void vsc_read(adapter_t *adapter, u32 addr, u32 *val)
56*3833Sxw161283 {
57*3833Sxw161283 u32 status, vlo, vhi;
58*3833Sxw161283 int i;
59*3833Sxw161283
60*3833Sxw161283 MAC_LOCK(adapter->mac_lock);
61*3833Sxw161283 (void) t1_tpi_read(adapter, (addr << 2) + 4, &vlo);
62*3833Sxw161283 i = 0;
63*3833Sxw161283 do {
64*3833Sxw161283 (void) t1_tpi_read(adapter, (REG_LOCAL_STATUS << 2) + 4, &vlo);
65*3833Sxw161283 (void) t1_tpi_read(adapter, REG_LOCAL_STATUS << 2, &vhi);
66*3833Sxw161283 status = (vhi << 16) | vlo;
67*3833Sxw161283 i++;
68*3833Sxw161283 } while (((status & 1) == 0) && (i < 50));
69*3833Sxw161283 if (i == 50)
70*3833Sxw161283 CH_ERR("Invalid tpi read from MAC, breaking loop.\n");
71*3833Sxw161283
72*3833Sxw161283 (void) t1_tpi_read(adapter, (REG_LOCAL_DATA << 2) + 4, &vlo);
73*3833Sxw161283 (void) t1_tpi_read(adapter, REG_LOCAL_DATA << 2, &vhi);
74*3833Sxw161283
75*3833Sxw161283 *val = (vhi << 16) | vlo;
76*3833Sxw161283
77*3833Sxw161283 /* CH_ERR("rd: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
78*3833Sxw161283 ((addr&0xe000)>>13), ((addr&0x1e00)>>9),
79*3833Sxw161283 ((addr&0x01fe)>>1), *val); */
80*3833Sxw161283 MAC_UNLOCK(adapter->mac_lock);
81*3833Sxw161283 }
82*3833Sxw161283
vsc_write(adapter_t * adapter,u32 addr,u32 data)83*3833Sxw161283 static void vsc_write(adapter_t *adapter, u32 addr, u32 data)
84*3833Sxw161283 {
85*3833Sxw161283 MAC_LOCK(adapter->mac_lock);
86*3833Sxw161283 (void) t1_tpi_write(adapter, (addr << 2) + 4, data & 0xFFFF);
87*3833Sxw161283 (void) t1_tpi_write(adapter, addr << 2, (data >> 16) & 0xFFFF);
88*3833Sxw161283 /* CH_ERR("wr: block: 0x%x sublock: 0x%x reg: 0x%x data: 0x%x\n",
89*3833Sxw161283 ((addr&0xe000)>>13), ((addr&0x1e00)>>9),
90*3833Sxw161283 ((addr&0x01fe)>>1), data); */
91*3833Sxw161283 MAC_UNLOCK(adapter->mac_lock);
92*3833Sxw161283 }
93*3833Sxw161283
94*3833Sxw161283 /* Hard reset the MAC. This wipes out *all* configuration. */
vsc7326_full_reset(adapter_t * adapter)95*3833Sxw161283 static void vsc7326_full_reset(adapter_t* adapter)
96*3833Sxw161283 {
97*3833Sxw161283 u32 val;
98*3833Sxw161283 u32 result = 0xffff;
99*3833Sxw161283
100*3833Sxw161283 (void) t1_tpi_read(adapter, A_ELMER0_GPO, &val);
101*3833Sxw161283 val &= ~1;
102*3833Sxw161283 (void) t1_tpi_write(adapter, A_ELMER0_GPO, val);
103*3833Sxw161283 DELAY_US(2);
104*3833Sxw161283 val |= 0x1; /* Enable mac MAC itself */
105*3833Sxw161283 val |= 0x800; /* Turn off the red LED */
106*3833Sxw161283 (void) t1_tpi_write(adapter, A_ELMER0_GPO, val);
107*3833Sxw161283 DELAY_MS(1);
108*3833Sxw161283 vsc_write(adapter, REG_SW_RESET, 0x80000001);
109*3833Sxw161283 do {
110*3833Sxw161283 DELAY_MS(1);
111*3833Sxw161283 vsc_read(adapter, REG_SW_RESET, &result);
112*3833Sxw161283 } while (result != 0x0);
113*3833Sxw161283 }
114*3833Sxw161283
115*3833Sxw161283 static struct init_table vsc7326_reset[] = {
116*3833Sxw161283 { REG_IFACE_MODE, 0x00000000 },
117*3833Sxw161283 { REG_CRC_CFG, 0x00000020 },
118*3833Sxw161283 { REG_PLL_CLK_SPEED, 0x00050c00 },
119*3833Sxw161283 { REG_PLL_CLK_SPEED, 0x00050c00 },
120*3833Sxw161283 { REG_MSCH, 0x00002f14 },
121*3833Sxw161283 { REG_SPI4_MISC, 0x00040409 },
122*3833Sxw161283 { REG_SPI4_DESKEW, 0x00080000 },
123*3833Sxw161283 { REG_SPI4_ING_SETUP2, 0x08080004 },
124*3833Sxw161283 { REG_SPI4_ING_SETUP0, 0x04111004 },
125*3833Sxw161283 { REG_SPI4_EGR_SETUP0, 0x80001a04 },
126*3833Sxw161283 { REG_SPI4_ING_SETUP1, 0x02010000 },
127*3833Sxw161283 { REG_AGE_INC(0), 0x00000000 },
128*3833Sxw161283 { REG_AGE_INC(1), 0x00000000 },
129*3833Sxw161283 { REG_ING_CONTROL, 0x0a200011 },
130*3833Sxw161283 { REG_EGR_CONTROL, 0xa0010091 },
131*3833Sxw161283 };
132*3833Sxw161283
133*3833Sxw161283 static struct init_table vsc7326_portinit[4][22] = {
134*3833Sxw161283 { /* Port 0 */
135*3833Sxw161283 /* FIFO setup */
136*3833Sxw161283 { REG_DBG(0), 0x000004f0 },
137*3833Sxw161283 { REG_HDX(0), 0x00073101 },
138*3833Sxw161283 { REG_TEST(0,0), 0x00000022 },
139*3833Sxw161283 { REG_TEST(1,0), 0x00000022 },
140*3833Sxw161283 { REG_TOP_BOTTOM(0,0), 0x003f0000 },
141*3833Sxw161283 { REG_TOP_BOTTOM(1,0), 0x00120000 },
142*3833Sxw161283 { REG_HIGH_LOW_WM(0,0), 0x07460757 },
143*3833Sxw161283 { REG_HIGH_LOW_WM(1,0), 0x01a01fff },
144*3833Sxw161283 { REG_CT_THRHLD(0,0), 0x00000000 },
145*3833Sxw161283 { REG_CT_THRHLD(1,0), 0x00000000 },
146*3833Sxw161283 { REG_BUCKE(0), 0x0002ffff },
147*3833Sxw161283 { REG_BUCKI(0), 0x0002ffff },
148*3833Sxw161283 { REG_TEST(0,0), 0x00000020 },
149*3833Sxw161283 { REG_TEST(1,0), 0x00000020 },
150*3833Sxw161283 /* Port config */
151*3833Sxw161283 { REG_MAX_LEN(0), 0x00002710 },
152*3833Sxw161283 { REG_PORT_FAIL(0), 0x00000002 },
153*3833Sxw161283 { REG_NORMALIZER(0), 0x00000a64 },
154*3833Sxw161283 { REG_DENORM(0), 0x00000010 },
155*3833Sxw161283 { REG_STICK_BIT(0), 0x03baa370 },
156*3833Sxw161283 { REG_DEV_SETUP(0), 0x00000083 },
157*3833Sxw161283 { REG_DEV_SETUP(0), 0x00000082 },
158*3833Sxw161283 { REG_MODE_CFG(0), 0x0200259f },
159*3833Sxw161283 },
160*3833Sxw161283 { /* Port 1 */
161*3833Sxw161283 /* FIFO setup */
162*3833Sxw161283 { REG_DBG(1), 0x000004f0 },
163*3833Sxw161283 { REG_HDX(1), 0x00073101 },
164*3833Sxw161283 { REG_TEST(0,1), 0x00000022 },
165*3833Sxw161283 { REG_TEST(1,1), 0x00000022 },
166*3833Sxw161283 { REG_TOP_BOTTOM(0,1), 0x007e003f },
167*3833Sxw161283 { REG_TOP_BOTTOM(1,1), 0x00240012 },
168*3833Sxw161283 { REG_HIGH_LOW_WM(0,1), 0x07460757 },
169*3833Sxw161283 { REG_HIGH_LOW_WM(1,1), 0x01a01fff },
170*3833Sxw161283 { REG_CT_THRHLD(0,1), 0x00000000 },
171*3833Sxw161283 { REG_CT_THRHLD(1,1), 0x00000000 },
172*3833Sxw161283 { REG_BUCKE(1), 0x0002ffff },
173*3833Sxw161283 { REG_BUCKI(1), 0x0002ffff },
174*3833Sxw161283 { REG_TEST(0,1), 0x00000020 },
175*3833Sxw161283 { REG_TEST(1,1), 0x00000020 },
176*3833Sxw161283 /* Port config */
177*3833Sxw161283 { REG_MAX_LEN(1), 0x00002710 },
178*3833Sxw161283 { REG_PORT_FAIL(1), 0x00000002 },
179*3833Sxw161283 { REG_NORMALIZER(1), 0x00000a64 },
180*3833Sxw161283 { REG_DENORM(1), 0x00000010 },
181*3833Sxw161283 { REG_STICK_BIT(1), 0x03baa370 },
182*3833Sxw161283 { REG_DEV_SETUP(1), 0x00000083 },
183*3833Sxw161283 { REG_DEV_SETUP(1), 0x00000082 },
184*3833Sxw161283 { REG_MODE_CFG(1), 0x0200259f },
185*3833Sxw161283 },
186*3833Sxw161283 { /* Port 2 */
187*3833Sxw161283 /* FIFO setup */
188*3833Sxw161283 { REG_DBG(2), 0x000004f0 },
189*3833Sxw161283 { REG_HDX(2), 0x00073101 },
190*3833Sxw161283 { REG_TEST(0,2), 0x00000022 },
191*3833Sxw161283 { REG_TEST(1,2), 0x00000022 },
192*3833Sxw161283 { REG_TOP_BOTTOM(0,2), 0x00bd007e },
193*3833Sxw161283 { REG_TOP_BOTTOM(1,2), 0x00360024 },
194*3833Sxw161283 { REG_HIGH_LOW_WM(0,2), 0x07460757 },
195*3833Sxw161283 { REG_HIGH_LOW_WM(1,2), 0x01a01fff },
196*3833Sxw161283 { REG_CT_THRHLD(0,2), 0x00000000 },
197*3833Sxw161283 { REG_CT_THRHLD(1,2), 0x00000000 },
198*3833Sxw161283 { REG_BUCKE(2), 0x0002ffff },
199*3833Sxw161283 { REG_BUCKI(2), 0x0002ffff },
200*3833Sxw161283 { REG_TEST(0,2), 0x00000020 },
201*3833Sxw161283 { REG_TEST(1,2), 0x00000020 },
202*3833Sxw161283 /* Port config */
203*3833Sxw161283 { REG_MAX_LEN(2), 0x00002710 },
204*3833Sxw161283 { REG_PORT_FAIL(2), 0x00000002 },
205*3833Sxw161283 { REG_NORMALIZER(2), 0x00000a64 },
206*3833Sxw161283 { REG_DENORM(2), 0x00000010 },
207*3833Sxw161283 { REG_STICK_BIT(2), 0x03baa370 },
208*3833Sxw161283 { REG_DEV_SETUP(2), 0x00000083 },
209*3833Sxw161283 { REG_DEV_SETUP(2), 0x00000082 },
210*3833Sxw161283 { REG_MODE_CFG(2), 0x0200259f },
211*3833Sxw161283 },
212*3833Sxw161283 { /* Port 3 */
213*3833Sxw161283 /* FIFO setup */
214*3833Sxw161283 { REG_DBG(3), 0x000004f0 },
215*3833Sxw161283 { REG_HDX(3), 0x00073101 },
216*3833Sxw161283 { REG_TEST(0,3), 0x00000022 },
217*3833Sxw161283 { REG_TEST(1,3), 0x00000022 },
218*3833Sxw161283 { REG_TOP_BOTTOM(0,3), 0x00fc00bd },
219*3833Sxw161283 { REG_TOP_BOTTOM(1,3), 0x00480036 },
220*3833Sxw161283 { REG_HIGH_LOW_WM(0,3), 0x07460757 },
221*3833Sxw161283 { REG_HIGH_LOW_WM(1,3), 0x01a01fff },
222*3833Sxw161283 { REG_CT_THRHLD(0,3), 0x00000000 },
223*3833Sxw161283 { REG_CT_THRHLD(1,3), 0x00000000 },
224*3833Sxw161283 { REG_BUCKE(3), 0x0002ffff },
225*3833Sxw161283 { REG_BUCKI(3), 0x0002ffff },
226*3833Sxw161283 { REG_TEST(0,3), 0x00000020 },
227*3833Sxw161283 { REG_TEST(1,3), 0x00000020 },
228*3833Sxw161283 /* Port config */
229*3833Sxw161283 { REG_MAX_LEN(3), 0x00002710 },
230*3833Sxw161283 { REG_PORT_FAIL(3), 0x00000002 },
231*3833Sxw161283 { REG_NORMALIZER(3), 0x00000a64 },
232*3833Sxw161283 { REG_DENORM(3), 0x00000010 },
233*3833Sxw161283 { REG_STICK_BIT(3), 0x03baa370 },
234*3833Sxw161283 { REG_DEV_SETUP(3), 0x00000083 },
235*3833Sxw161283 { REG_DEV_SETUP(3), 0x00000082 },
236*3833Sxw161283 { REG_MODE_CFG(3), 0x0200259f },
237*3833Sxw161283 },
238*3833Sxw161283 };
239*3833Sxw161283
run_table(adapter_t * adapter,struct init_table * ib,int len)240*3833Sxw161283 static void run_table(adapter_t *adapter, struct init_table *ib, int len)
241*3833Sxw161283 {
242*3833Sxw161283 int i;
243*3833Sxw161283
244*3833Sxw161283 for (i = 0; i < len; i++) {
245*3833Sxw161283 if (ib[i].addr == INITBLOCK_SLEEP) {
246*3833Sxw161283 DELAY_US( ib[i].data );
247*3833Sxw161283 CH_ERR("sleep %d us\n",ib[i].data);
248*3833Sxw161283 } else {
249*3833Sxw161283 vsc_write( adapter, ib[i].addr, ib[i].data );
250*3833Sxw161283 }
251*3833Sxw161283 }
252*3833Sxw161283 }
253*3833Sxw161283
bist_rd(adapter_t * adapter,int moduleid,int address)254*3833Sxw161283 static int bist_rd(adapter_t *adapter, int moduleid, int address)
255*3833Sxw161283 {
256*3833Sxw161283 int data=0;
257*3833Sxw161283 u32 result=0;
258*3833Sxw161283
259*3833Sxw161283 if( (address != 0x0) &&
260*3833Sxw161283 (address != 0x1) &&
261*3833Sxw161283 (address != 0x2) &&
262*3833Sxw161283 (address != 0xd) &&
263*3833Sxw161283 (address != 0xe))
264*3833Sxw161283 CH_ERR("No bist address: 0x%x\n", address);
265*3833Sxw161283
266*3833Sxw161283 data = ((0x00 << 24) | ((address & 0xff) << 16) | (0x00 << 8) |
267*3833Sxw161283 ((moduleid & 0xff) << 0));
268*3833Sxw161283 vsc_write(adapter, REG_RAM_BIST_CMD, data);
269*3833Sxw161283
270*3833Sxw161283 DELAY_US(10);
271*3833Sxw161283
272*3833Sxw161283 vsc_read(adapter, REG_RAM_BIST_RESULT, &result);
273*3833Sxw161283 if((result & (1<<9)) != 0x0)
274*3833Sxw161283 CH_ERR("Still in bist read: 0x%x\n", result);
275*3833Sxw161283 else if((result & (1<<8)) != 0x0)
276*3833Sxw161283 CH_ERR("bist read error: 0x%x\n", result);
277*3833Sxw161283
278*3833Sxw161283 return(result & 0xff);
279*3833Sxw161283 }
280*3833Sxw161283
bist_wr(adapter_t * adapter,int moduleid,int address,int value)281*3833Sxw161283 static int bist_wr(adapter_t *adapter, int moduleid, int address, int value)
282*3833Sxw161283 {
283*3833Sxw161283 int data=0;
284*3833Sxw161283 u32 result=0;
285*3833Sxw161283
286*3833Sxw161283 if( (address != 0x0) &&
287*3833Sxw161283 (address != 0x1) &&
288*3833Sxw161283 (address != 0x2) &&
289*3833Sxw161283 (address != 0xd) &&
290*3833Sxw161283 (address != 0xe))
291*3833Sxw161283 CH_ERR("No bist address: 0x%x\n", address);
292*3833Sxw161283
293*3833Sxw161283 if( value>255 )
294*3833Sxw161283 CH_ERR("Suspicious write out of range value: 0x%x\n", value);
295*3833Sxw161283
296*3833Sxw161283 data = ((0x01 << 24) | ((address & 0xff) << 16) | (value << 8) |
297*3833Sxw161283 ((moduleid & 0xff) << 0));
298*3833Sxw161283 vsc_write(adapter, REG_RAM_BIST_CMD, data);
299*3833Sxw161283
300*3833Sxw161283 DELAY_US(5);
301*3833Sxw161283
302*3833Sxw161283 vsc_read(adapter, REG_RAM_BIST_CMD, &result);
303*3833Sxw161283 if((result & (1<<27)) != 0x0)
304*3833Sxw161283 CH_ERR("Still in bist write: 0x%x\n", result);
305*3833Sxw161283 else if((result & (1<<26)) != 0x0)
306*3833Sxw161283 CH_ERR("bist write error: 0x%x\n", result);
307*3833Sxw161283
308*3833Sxw161283 return(0);
309*3833Sxw161283 }
310*3833Sxw161283
run_bist(adapter_t * adapter,int moduleid)311*3833Sxw161283 static int run_bist(adapter_t *adapter, int moduleid)
312*3833Sxw161283 {
313*3833Sxw161283 /*run bist*/
314*3833Sxw161283 (void) bist_wr(adapter,moduleid, 0x00, 0x02);
315*3833Sxw161283 (void) bist_wr(adapter,moduleid, 0x01, 0x01);
316*3833Sxw161283
317*3833Sxw161283 return(0);
318*3833Sxw161283 }
319*3833Sxw161283
check_bist(adapter_t * adapter,int moduleid)320*3833Sxw161283 static int check_bist(adapter_t *adapter, int moduleid)
321*3833Sxw161283 {
322*3833Sxw161283 int result=0;
323*3833Sxw161283 int column=0;
324*3833Sxw161283 /*check bist*/
325*3833Sxw161283 result = bist_rd(adapter,moduleid, 0x02);
326*3833Sxw161283 column = ((bist_rd(adapter,moduleid, 0x0e)<<8) +
327*3833Sxw161283 (bist_rd(adapter,moduleid, 0x0d)));
328*3833Sxw161283 if ((result & 3) != 0x3)
329*3833Sxw161283 CH_ERR("Result: 0x%x BIST error in ram %d, column: 0x%04x\n",
330*3833Sxw161283 result, moduleid, column);
331*3833Sxw161283 return(0);
332*3833Sxw161283 }
333*3833Sxw161283
enable_mem(adapter_t * adapter,int moduleid)334*3833Sxw161283 static int enable_mem(adapter_t *adapter, int moduleid)
335*3833Sxw161283 {
336*3833Sxw161283 /*enable mem*/
337*3833Sxw161283 (void) bist_wr(adapter,moduleid, 0x00, 0x00);
338*3833Sxw161283 return(0);
339*3833Sxw161283 }
340*3833Sxw161283
run_bist_all(adapter_t * adapter)341*3833Sxw161283 static int run_bist_all(adapter_t *adapter)
342*3833Sxw161283 {
343*3833Sxw161283 int port=0;
344*3833Sxw161283 u32 val=0;
345*3833Sxw161283
346*3833Sxw161283 vsc_write(adapter, REG_MEM_BIST, 0x5);
347*3833Sxw161283 vsc_read(adapter, REG_MEM_BIST, &val);
348*3833Sxw161283
349*3833Sxw161283 for(port=0; port<12; port++){
350*3833Sxw161283 vsc_write(adapter, REG_DEV_SETUP(port), 0x0);
351*3833Sxw161283 }
352*3833Sxw161283
353*3833Sxw161283 DELAY_US(300);
354*3833Sxw161283 vsc_write(adapter, REG_SPI4_MISC, 0x00040409);
355*3833Sxw161283 DELAY_US(300);
356*3833Sxw161283
357*3833Sxw161283 (void) run_bist(adapter,13);
358*3833Sxw161283 (void) run_bist(adapter,14);
359*3833Sxw161283 (void) run_bist(adapter,20);
360*3833Sxw161283 (void) run_bist(adapter,21);
361*3833Sxw161283 DELAY_MS(200);
362*3833Sxw161283 (void) check_bist(adapter,13);
363*3833Sxw161283 (void) check_bist(adapter,14);
364*3833Sxw161283 (void) check_bist(adapter,20);
365*3833Sxw161283 (void) check_bist(adapter,21);
366*3833Sxw161283 DELAY_US(100);
367*3833Sxw161283 (void) enable_mem(adapter,13);
368*3833Sxw161283 (void) enable_mem(adapter,14);
369*3833Sxw161283 (void) enable_mem(adapter,20);
370*3833Sxw161283 (void) enable_mem(adapter,21);
371*3833Sxw161283 DELAY_US(300);
372*3833Sxw161283 vsc_write(adapter, REG_SPI4_MISC, 0x60040400);
373*3833Sxw161283 DELAY_US(300);
374*3833Sxw161283 for(port=0; port<12; port++){
375*3833Sxw161283 vsc_write(adapter, REG_DEV_SETUP(port), 0x1);
376*3833Sxw161283 }
377*3833Sxw161283 DELAY_US(300);
378*3833Sxw161283 vsc_write(adapter, REG_MEM_BIST, 0x0);
379*3833Sxw161283 DELAY_MS(10);
380*3833Sxw161283 return(0);
381*3833Sxw161283 }
382*3833Sxw161283
383*3833Sxw161283 /* ARGSUSED */
mac_intr_handler(struct cmac * mac)384*3833Sxw161283 static int mac_intr_handler(struct cmac *mac)
385*3833Sxw161283 {
386*3833Sxw161283 return 0;
387*3833Sxw161283 }
388*3833Sxw161283
389*3833Sxw161283 /* ARGSUSED */
mac_intr_enable(struct cmac * mac)390*3833Sxw161283 static int mac_intr_enable(struct cmac *mac)
391*3833Sxw161283 {
392*3833Sxw161283 return 0;
393*3833Sxw161283 }
394*3833Sxw161283
395*3833Sxw161283 /* ARGSUSED */
mac_intr_disable(struct cmac * mac)396*3833Sxw161283 static int mac_intr_disable(struct cmac *mac)
397*3833Sxw161283 {
398*3833Sxw161283 return 0;
399*3833Sxw161283 }
400*3833Sxw161283
401*3833Sxw161283 /* ARGSUSED */
mac_intr_clear(struct cmac * mac)402*3833Sxw161283 static int mac_intr_clear(struct cmac *mac)
403*3833Sxw161283 {
404*3833Sxw161283 return 0;
405*3833Sxw161283 }
406*3833Sxw161283
407*3833Sxw161283 /* Expect MAC address to be in network byte order. */
mac_set_address(struct cmac * mac,u8 addr[6])408*3833Sxw161283 static int mac_set_address(struct cmac* mac, u8 addr[6])
409*3833Sxw161283 {
410*3833Sxw161283 u32 val;
411*3833Sxw161283 int port = mac->instance->index;
412*3833Sxw161283
413*3833Sxw161283 vsc_write(mac->adapter, REG_MAC_LOW_ADDR(port),
414*3833Sxw161283 (addr[3] << 16) | (addr[4] << 8) | addr[5]);
415*3833Sxw161283 vsc_write(mac->adapter, REG_MAC_HIGH_ADDR(port),
416*3833Sxw161283 (addr[0] << 16) | (addr[1] << 8) | addr[2]);
417*3833Sxw161283
418*3833Sxw161283 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &val);
419*3833Sxw161283 val &= ~0xf0000000;
420*3833Sxw161283 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, val | (port << 28));
421*3833Sxw161283
422*3833Sxw161283 vsc_write(mac->adapter, REG_ING_FFILT_MASK0,
423*3833Sxw161283 0xffff0000 | (addr[4] << 8) | addr[5]);
424*3833Sxw161283 vsc_write(mac->adapter, REG_ING_FFILT_MASK1,
425*3833Sxw161283 0xffff0000 | (addr[2] << 8) | addr[3]);
426*3833Sxw161283 vsc_write(mac->adapter, REG_ING_FFILT_MASK2,
427*3833Sxw161283 0xffff0000 | (addr[0] << 8) | addr[1]);
428*3833Sxw161283 return 0;
429*3833Sxw161283 }
430*3833Sxw161283
mac_get_address(struct cmac * mac,u8 addr[6])431*3833Sxw161283 static int mac_get_address(struct cmac *mac, u8 addr[6])
432*3833Sxw161283 {
433*3833Sxw161283 u32 addr_lo, addr_hi;
434*3833Sxw161283 int port = mac->instance->index;
435*3833Sxw161283
436*3833Sxw161283 vsc_read(mac->adapter, REG_MAC_LOW_ADDR(port), &addr_lo);
437*3833Sxw161283 vsc_read(mac->adapter, REG_MAC_HIGH_ADDR(port), &addr_hi);
438*3833Sxw161283
439*3833Sxw161283 addr[0] = (u8) (addr_hi >> 16);
440*3833Sxw161283 addr[1] = (u8) (addr_hi >> 8);
441*3833Sxw161283 addr[2] = (u8) addr_hi;
442*3833Sxw161283 addr[3] = (u8) (addr_lo >> 16);
443*3833Sxw161283 addr[4] = (u8) (addr_lo >> 8);
444*3833Sxw161283 addr[5] = (u8) addr_lo;
445*3833Sxw161283 return 0;
446*3833Sxw161283 }
447*3833Sxw161283
448*3833Sxw161283 /* This is intended to reset a port, not the whole MAC */
mac_reset(struct cmac * mac)449*3833Sxw161283 static int mac_reset(struct cmac *mac)
450*3833Sxw161283 {
451*3833Sxw161283 int index = mac->instance->index;
452*3833Sxw161283
453*3833Sxw161283 run_table(mac->adapter, vsc7326_portinit[index],
454*3833Sxw161283 DIMOF(vsc7326_portinit[index]));
455*3833Sxw161283
456*3833Sxw161283 return 0;
457*3833Sxw161283 }
458*3833Sxw161283
mac_set_rx_mode(struct cmac * mac,struct t1_rx_mode * rm)459*3833Sxw161283 static int mac_set_rx_mode(struct cmac *mac, struct t1_rx_mode *rm)
460*3833Sxw161283 {
461*3833Sxw161283 u32 v;
462*3833Sxw161283 int port = mac->instance->index;
463*3833Sxw161283
464*3833Sxw161283 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &v);
465*3833Sxw161283 v |= 1 << 12;
466*3833Sxw161283
467*3833Sxw161283 if (t1_rx_mode_promisc(rm))
468*3833Sxw161283 v &= ~(1 << (port + 16));
469*3833Sxw161283 else
470*3833Sxw161283 v |= 1 << (port + 16);
471*3833Sxw161283
472*3833Sxw161283 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, v);
473*3833Sxw161283 return 0;
474*3833Sxw161283 }
475*3833Sxw161283
mac_set_mtu(struct cmac * mac,int mtu)476*3833Sxw161283 static int mac_set_mtu(struct cmac *mac, int mtu)
477*3833Sxw161283 {
478*3833Sxw161283 int port = mac->instance->index;
479*3833Sxw161283
480*3833Sxw161283 if (mtu > MAX_MTU)
481*3833Sxw161283 return -EINVAL;
482*3833Sxw161283
483*3833Sxw161283 /* max_len includes header and FCS */
484*3833Sxw161283 vsc_write(mac->adapter, REG_MAX_LEN(port), mtu + 14 + 4);
485*3833Sxw161283 return 0;
486*3833Sxw161283 }
487*3833Sxw161283
mac_set_speed_duplex_fc(struct cmac * mac,int speed,int duplex,int fc)488*3833Sxw161283 static int mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex,
489*3833Sxw161283 int fc)
490*3833Sxw161283 {
491*3833Sxw161283 u32 v;
492*3833Sxw161283 int enable, port = mac->instance->index;
493*3833Sxw161283
494*3833Sxw161283 if (speed >= 0 && speed != SPEED_10 && speed != SPEED_100 &&
495*3833Sxw161283 speed != SPEED_1000)
496*3833Sxw161283 return -1;
497*3833Sxw161283 if (duplex > 0 && duplex != DUPLEX_FULL)
498*3833Sxw161283 return -1;
499*3833Sxw161283
500*3833Sxw161283 if (speed >= 0) {
501*3833Sxw161283 vsc_read(mac->adapter, REG_MODE_CFG(port), &v);
502*3833Sxw161283 enable = v & 3; /* save tx/rx enables */
503*3833Sxw161283 v &= ~0xf;
504*3833Sxw161283 v |= 4; /* full duplex */
505*3833Sxw161283 if (speed == SPEED_1000)
506*3833Sxw161283 v |= 8; /* GigE */
507*3833Sxw161283 enable |= v;
508*3833Sxw161283 vsc_write(mac->adapter, REG_MODE_CFG(port), v);
509*3833Sxw161283
510*3833Sxw161283 if (speed == SPEED_1000)
511*3833Sxw161283 v = 0x82;
512*3833Sxw161283 else if (speed == SPEED_100)
513*3833Sxw161283 v = 0x84;
514*3833Sxw161283 else /* SPEED_10 */
515*3833Sxw161283 v = 0x86;
516*3833Sxw161283 vsc_write(mac->adapter, REG_DEV_SETUP(port), v | 1); /* reset */
517*3833Sxw161283 vsc_write(mac->adapter, REG_DEV_SETUP(port), v);
518*3833Sxw161283 vsc_read(mac->adapter, REG_DBG(port), &v);
519*3833Sxw161283 v &= ~0xff00;
520*3833Sxw161283 if (speed == SPEED_1000)
521*3833Sxw161283 v |= 0x400;
522*3833Sxw161283 else if (speed == SPEED_100)
523*3833Sxw161283 v |= 0x2000;
524*3833Sxw161283 else /* SPEED_10 */
525*3833Sxw161283 v |= 0xff00;
526*3833Sxw161283 vsc_write(mac->adapter, REG_DBG(port), v);
527*3833Sxw161283
528*3833Sxw161283 vsc_write(mac->adapter, REG_TX_IFG(port),
529*3833Sxw161283 speed == SPEED_1000 ? 5 : 0x11);
530*3833Sxw161283 if (duplex == DUPLEX_HALF)
531*3833Sxw161283 enable = 0x0; /* 100 or 10 */
532*3833Sxw161283 else if (speed == SPEED_1000)
533*3833Sxw161283 enable = 0xc;
534*3833Sxw161283 else /* SPEED_100 or 10 */
535*3833Sxw161283 enable = 0x4;
536*3833Sxw161283 enable |= 0x9 << 10; /* IFG1 */
537*3833Sxw161283 enable |= 0x6 << 6; /* IFG2 */
538*3833Sxw161283 enable |= 0x1 << 4; /* VLAN */
539*3833Sxw161283 enable |= 0x3; /* RX/TX EN */
540*3833Sxw161283 vsc_write(mac->adapter, REG_MODE_CFG(port), enable);
541*3833Sxw161283
542*3833Sxw161283 }
543*3833Sxw161283
544*3833Sxw161283 vsc_read(mac->adapter, REG_PAUSE_CFG(port), &v);
545*3833Sxw161283 v &= 0xfff0ffff;
546*3833Sxw161283 v |= 0x20000; /* xon/xoff */
547*3833Sxw161283 if (fc & PAUSE_RX)
548*3833Sxw161283 v |= 0x40000;
549*3833Sxw161283 if (fc & PAUSE_TX)
550*3833Sxw161283 v |= 0x80000;
551*3833Sxw161283 if (fc == (PAUSE_RX | PAUSE_TX))
552*3833Sxw161283 v |= 0x10000;
553*3833Sxw161283 vsc_write(mac->adapter, REG_PAUSE_CFG(port), v);
554*3833Sxw161283 return 0;
555*3833Sxw161283 }
556*3833Sxw161283
mac_enable(struct cmac * mac,int which)557*3833Sxw161283 static int mac_enable(struct cmac *mac, int which)
558*3833Sxw161283 {
559*3833Sxw161283 u32 val;
560*3833Sxw161283 int port = mac->instance->index;
561*3833Sxw161283
562*3833Sxw161283 vsc_read(mac->adapter, REG_MODE_CFG(port), &val);
563*3833Sxw161283 if (which & MAC_DIRECTION_RX)
564*3833Sxw161283 val |= 0x2;
565*3833Sxw161283 if (which & MAC_DIRECTION_TX)
566*3833Sxw161283 val |= 1;
567*3833Sxw161283 vsc_write(mac->adapter, REG_MODE_CFG(port), val);
568*3833Sxw161283 return 0;
569*3833Sxw161283 }
570*3833Sxw161283
mac_disable(struct cmac * mac,int which)571*3833Sxw161283 static int mac_disable(struct cmac *mac, int which)
572*3833Sxw161283 {
573*3833Sxw161283 u32 val;
574*3833Sxw161283 int i, port = mac->instance->index;
575*3833Sxw161283
576*3833Sxw161283 /* Reset the port */
577*3833Sxw161283 (void) mac_reset(mac);
578*3833Sxw161283
579*3833Sxw161283 vsc_read(mac->adapter, REG_MODE_CFG(port), &val);
580*3833Sxw161283 if (which & MAC_DIRECTION_RX)
581*3833Sxw161283 val &= ~0x2;
582*3833Sxw161283 if (which & MAC_DIRECTION_TX)
583*3833Sxw161283 val &= ~0x1;
584*3833Sxw161283 vsc_write(mac->adapter, REG_MODE_CFG(port), val);
585*3833Sxw161283 vsc_read(mac->adapter, REG_MODE_CFG(port), &val);
586*3833Sxw161283
587*3833Sxw161283 /* Clear stats */
588*3833Sxw161283 for (i = 0; i <= 0x3a; ++i)
589*3833Sxw161283 vsc_write(mac->adapter, CRA(4, port, i), 0);
590*3833Sxw161283
591*3833Sxw161283 /* Clear sofware counters */
592*3833Sxw161283 memset(&mac->stats, 0, sizeof(struct cmac_statistics));
593*3833Sxw161283
594*3833Sxw161283 return 0;
595*3833Sxw161283 }
596*3833Sxw161283
rmon_update(struct cmac * mac,unsigned int addr,u64 * stat)597*3833Sxw161283 static void rmon_update(struct cmac *mac, unsigned int addr, u64 *stat)
598*3833Sxw161283 {
599*3833Sxw161283 u32 v, lo;
600*3833Sxw161283
601*3833Sxw161283 vsc_read(mac->adapter, addr, &v);
602*3833Sxw161283 lo = *stat;
603*3833Sxw161283 *stat = *stat - lo + v;
604*3833Sxw161283
605*3833Sxw161283 if (v == 0)
606*3833Sxw161283 return;
607*3833Sxw161283
608*3833Sxw161283 if (v < lo)
609*3833Sxw161283 *stat += (1ULL << 32);
610*3833Sxw161283 }
611*3833Sxw161283
port_stats_update(struct cmac * mac)612*3833Sxw161283 static void port_stats_update(struct cmac *mac)
613*3833Sxw161283 {
614*3833Sxw161283 int port = mac->instance->index;
615*3833Sxw161283
616*3833Sxw161283 /* Rx stats */
617*3833Sxw161283 rmon_update(mac, REG_RX_OK_BYTES(port), &mac->stats.RxOctetsOK);
618*3833Sxw161283 rmon_update(mac, REG_RX_BAD_BYTES(port), &mac->stats.RxOctetsBad);
619*3833Sxw161283 rmon_update(mac, REG_RX_UNICAST(port), &mac->stats.RxUnicastFramesOK);
620*3833Sxw161283 rmon_update(mac, REG_RX_MULTICAST(port),
621*3833Sxw161283 &mac->stats.RxMulticastFramesOK);
622*3833Sxw161283 rmon_update(mac, REG_RX_BROADCAST(port),
623*3833Sxw161283 &mac->stats.RxBroadcastFramesOK);
624*3833Sxw161283 rmon_update(mac, REG_CRC(port), &mac->stats.RxFCSErrors);
625*3833Sxw161283 rmon_update(mac, REG_RX_ALIGNMENT(port), &mac->stats.RxAlignErrors);
626*3833Sxw161283 rmon_update(mac, REG_RX_OVERSIZE(port),
627*3833Sxw161283 &mac->stats.RxFrameTooLongErrors);
628*3833Sxw161283 rmon_update(mac, REG_RX_PAUSE(port), &mac->stats.RxPauseFrames);
629*3833Sxw161283 rmon_update(mac, REG_RX_JABBERS(port), &mac->stats.RxJabberErrors);
630*3833Sxw161283 rmon_update(mac, REG_RX_FRAGMENTS(port), &mac->stats.RxRuntErrors);
631*3833Sxw161283 rmon_update(mac, REG_RX_UNDERSIZE(port), &mac->stats.RxRuntErrors);
632*3833Sxw161283 rmon_update(mac, REG_RX_SYMBOL_CARRIER(port),
633*3833Sxw161283 &mac->stats.RxSymbolErrors);
634*3833Sxw161283 rmon_update(mac, REG_RX_SIZE_1519_TO_MAX(port),
635*3833Sxw161283 &mac->stats.RxJumboFramesOK);
636*3833Sxw161283
637*3833Sxw161283 /* Tx stats (skip collision stats as we are full-duplex only) */
638*3833Sxw161283 rmon_update(mac, REG_TX_OK_BYTES(port), &mac->stats.TxOctetsOK);
639*3833Sxw161283 rmon_update(mac, REG_TX_UNICAST(port), &mac->stats.TxUnicastFramesOK);
640*3833Sxw161283 rmon_update(mac, REG_TX_MULTICAST(port),
641*3833Sxw161283 &mac->stats.TxMulticastFramesOK);
642*3833Sxw161283 rmon_update(mac, REG_TX_BROADCAST(port),
643*3833Sxw161283 &mac->stats.TxBroadcastFramesOK);
644*3833Sxw161283 rmon_update(mac, REG_TX_PAUSE(port), &mac->stats.TxPauseFrames);
645*3833Sxw161283 rmon_update(mac, REG_TX_UNDERRUN(port), &mac->stats.TxUnderrun);
646*3833Sxw161283 rmon_update(mac, REG_TX_SIZE_1519_TO_MAX(port),
647*3833Sxw161283 &mac->stats.TxJumboFramesOK);
648*3833Sxw161283 }
649*3833Sxw161283
650*3833Sxw161283 /*
651*3833Sxw161283 * This function is called periodically to accumulate the current values of the
652*3833Sxw161283 * RMON counters into the port statistics. Since the counters are only 32 bits
653*3833Sxw161283 * some of them can overflow in less than a minute at GigE speeds, so this
654*3833Sxw161283 * function should be called every 30 seconds or so.
655*3833Sxw161283 *
656*3833Sxw161283 * To cut down on reading costs we update only the octet counters at each tick
657*3833Sxw161283 * and do a full update at major ticks, which can be every 30 minutes or more.
658*3833Sxw161283 */
mac_update_statistics(struct cmac * mac,int flag)659*3833Sxw161283 static const struct cmac_statistics *mac_update_statistics(struct cmac *mac,
660*3833Sxw161283 int flag)
661*3833Sxw161283 {
662*3833Sxw161283 if (flag == MAC_STATS_UPDATE_FULL ||
663*3833Sxw161283 mac->instance->ticks >= MAJOR_UPDATE_TICKS) {
664*3833Sxw161283 port_stats_update(mac);
665*3833Sxw161283 mac->instance->ticks = 0;
666*3833Sxw161283 } else {
667*3833Sxw161283 int port = mac->instance->index;
668*3833Sxw161283
669*3833Sxw161283 rmon_update(mac, REG_RX_OK_BYTES(port),
670*3833Sxw161283 &mac->stats.RxOctetsOK);
671*3833Sxw161283 rmon_update(mac, REG_RX_BAD_BYTES(port),
672*3833Sxw161283 &mac->stats.RxOctetsBad);
673*3833Sxw161283 rmon_update(mac, REG_TX_OK_BYTES(port),
674*3833Sxw161283 &mac->stats.TxOctetsOK);
675*3833Sxw161283 mac->instance->ticks++;
676*3833Sxw161283 }
677*3833Sxw161283 return &mac->stats;
678*3833Sxw161283 }
679*3833Sxw161283
mac_destroy(struct cmac * mac)680*3833Sxw161283 static void mac_destroy(struct cmac *mac)
681*3833Sxw161283 {
682*3833Sxw161283 t1_os_free((void *)mac, sizeof(*mac) + sizeof(cmac_instance));
683*3833Sxw161283 }
684*3833Sxw161283
685*3833Sxw161283 #ifdef C99_NOT_SUPPORTED
686*3833Sxw161283 static struct cmac_ops vsc7326_ops = {
687*3833Sxw161283 mac_destroy,
688*3833Sxw161283 mac_reset,
689*3833Sxw161283 mac_intr_enable,
690*3833Sxw161283 mac_intr_disable,
691*3833Sxw161283 mac_intr_clear,
692*3833Sxw161283 mac_intr_handler,
693*3833Sxw161283 mac_enable,
694*3833Sxw161283 mac_disable,
695*3833Sxw161283 NULL,
696*3833Sxw161283 NULL,
697*3833Sxw161283 mac_set_mtu,
698*3833Sxw161283 mac_set_rx_mode,
699*3833Sxw161283 mac_set_speed_duplex_fc,
700*3833Sxw161283 NULL,
701*3833Sxw161283 mac_update_statistics,
702*3833Sxw161283 mac_get_address,
703*3833Sxw161283 mac_set_address
704*3833Sxw161283 };
705*3833Sxw161283 #else
706*3833Sxw161283 static struct cmac_ops vsc7326_ops = {
707*3833Sxw161283 .destroy = mac_destroy,
708*3833Sxw161283 .reset = mac_reset,
709*3833Sxw161283 .interrupt_handler = mac_intr_handler,
710*3833Sxw161283 .interrupt_enable = mac_intr_enable,
711*3833Sxw161283 .interrupt_disable = mac_intr_disable,
712*3833Sxw161283 .interrupt_clear = mac_intr_clear,
713*3833Sxw161283 .enable = mac_enable,
714*3833Sxw161283 .disable = mac_disable,
715*3833Sxw161283 .set_mtu = mac_set_mtu,
716*3833Sxw161283 .set_rx_mode = mac_set_rx_mode,
717*3833Sxw161283 .set_speed_duplex_fc = mac_set_speed_duplex_fc,
718*3833Sxw161283 .statistics_update = mac_update_statistics,
719*3833Sxw161283 .macaddress_get = mac_get_address,
720*3833Sxw161283 .macaddress_set = mac_set_address,
721*3833Sxw161283 };
722*3833Sxw161283 #endif
723*3833Sxw161283
vsc7326_mac_create(adapter_t * adapter,int index)724*3833Sxw161283 static struct cmac *vsc7326_mac_create(adapter_t *adapter, int index)
725*3833Sxw161283 {
726*3833Sxw161283 struct cmac *mac;
727*3833Sxw161283 u32 val;
728*3833Sxw161283 int i;
729*3833Sxw161283
730*3833Sxw161283 mac = t1_os_malloc_wait_zero(sizeof(*mac) + sizeof(cmac_instance));
731*3833Sxw161283 if (!mac) return NULL;
732*3833Sxw161283
733*3833Sxw161283 mac->ops = &vsc7326_ops;
734*3833Sxw161283 mac->instance = (cmac_instance *)(mac + 1);
735*3833Sxw161283 mac->adapter = adapter;
736*3833Sxw161283
737*3833Sxw161283 mac->instance->index = index;
738*3833Sxw161283 mac->instance->ticks = 0;
739*3833Sxw161283
740*3833Sxw161283 i = 0;
741*3833Sxw161283 do {
742*3833Sxw161283 u32 vhi, vlo;
743*3833Sxw161283
744*3833Sxw161283 vhi = vlo = 0;
745*3833Sxw161283 (void) t1_tpi_read(adapter, (REG_LOCAL_STATUS << 2) + 4, &vlo);
746*3833Sxw161283 DELAY_US(1);
747*3833Sxw161283 (void) t1_tpi_read(adapter, REG_LOCAL_STATUS << 2, &vhi);
748*3833Sxw161283 DELAY_US(5);
749*3833Sxw161283 val = (vhi << 16) | vlo;
750*3833Sxw161283 } while ((++i < 10000) && (val == 0xffffffff));
751*3833Sxw161283
752*3833Sxw161283 return mac;
753*3833Sxw161283 }
754*3833Sxw161283
vsc7326_mac_reset(adapter_t * adapter)755*3833Sxw161283 static int vsc7326_mac_reset(adapter_t *adapter)
756*3833Sxw161283 {
757*3833Sxw161283 vsc7326_full_reset(adapter);
758*3833Sxw161283 (void) run_bist_all(adapter);
759*3833Sxw161283 run_table(adapter, vsc7326_reset, DIMOF(vsc7326_reset));
760*3833Sxw161283 return 0;
761*3833Sxw161283 }
762*3833Sxw161283
763*3833Sxw161283 struct gmac t1_vsc7326_ops = {
764*3833Sxw161283 STATS_TICK_SECS,
765*3833Sxw161283 vsc7326_mac_create,
766*3833Sxw161283 vsc7326_mac_reset
767*3833Sxw161283 };
768