Lines Matching +full:only +full:- +full:1 +full:- +full:8 +full:v
1 // SPDX-License-Identifier: GPL-2.0
2 /* $Date: 2006/04/28 19:20:06 $ $RCSfile: vsc7326.c,v $ $Revision: 1.19 $ */
15 /* The egress WM value 0x01a01fff should be used only when the
17 * for disabling the T2/MAC flow-control. When the interface is
40 spin_lock_bh(&adapter->mac_lock); in vsc_read()
48 } while (((status & 1) == 0) && (i < 50)); in vsc_read()
59 ((addr&0x01fe)>>1), *val); */ in vsc_read()
60 spin_unlock_bh(&adapter->mac_lock); in vsc_read()
65 spin_lock_bh(&adapter->mac_lock); in vsc_write()
70 ((addr&0x01fe)>>1), data); */ in vsc_write()
71 spin_unlock_bh(&adapter->mac_lock); in vsc_write()
81 val &= ~1; in vsc7326_full_reset()
87 mdelay(1); in vsc7326_full_reset()
90 mdelay(1); in vsc7326_full_reset()
108 { REG_AGE_INC(1), 0x00000000 },
119 { REG_TEST(1,0), 0x00000022 },
121 { REG_TOP_BOTTOM(1,0), 0x00120000 },
123 { REG_HIGH_LOW_WM(1,0), WM_DISABLE },
125 { REG_CT_THRHLD(1,0), 0x00000000 },
129 { REG_TEST(1,0), 0x00000020 },
140 { /* Port 1 */
142 { REG_DBG(1), 0x000004f0 },
143 { REG_HDX(1), 0x00073101 },
144 { REG_TEST(0,1), 0x00000022 },
145 { REG_TEST(1,1), 0x00000022 },
146 { REG_TOP_BOTTOM(0,1), 0x007e003f },
147 { REG_TOP_BOTTOM(1,1), 0x00240012 },
148 { REG_HIGH_LOW_WM(0,1), 0x07460757 },
149 { REG_HIGH_LOW_WM(1,1), WM_DISABLE },
150 { REG_CT_THRHLD(0,1), 0x00000000 },
151 { REG_CT_THRHLD(1,1), 0x00000000 },
152 { REG_BUCKE(1), 0x0002ffff },
153 { REG_BUCKI(1), 0x0002ffff },
154 { REG_TEST(0,1), 0x00000020 },
155 { REG_TEST(1,1), 0x00000020 },
157 { REG_MAX_LEN(1), 0x00002710 },
158 { REG_PORT_FAIL(1), 0x00000002 },
159 { REG_NORMALIZER(1), 0x00000a64 },
160 { REG_DENORM(1), 0x00000010 },
161 { REG_STICK_BIT(1), 0x03baa370 },
162 { REG_DEV_SETUP(1), 0x00000083 },
163 { REG_DEV_SETUP(1), 0x00000082 },
164 { REG_MODE_CFG(1), 0x0200259f },
171 { REG_TEST(1,2), 0x00000022 },
173 { REG_TOP_BOTTOM(1,2), 0x00360024 },
175 { REG_HIGH_LOW_WM(1,2), WM_DISABLE },
177 { REG_CT_THRHLD(1,2), 0x00000000 },
181 { REG_TEST(1,2), 0x00000020 },
197 { REG_TEST(1,3), 0x00000022 },
199 { REG_TOP_BOTTOM(1,3), 0x00480036 },
201 { REG_HIGH_LOW_WM(1,3), WM_DISABLE },
203 { REG_CT_THRHLD(1,3), 0x00000000 },
207 { REG_TEST(1,3), 0x00000020 },
245 data = ((0x00 << 24) | ((address & 0xff) << 16) | (0x00 << 8) | in bist_rd()
252 if ((result & (1 << 9)) != 0x0) in bist_rd()
254 else if ((result & (1 << 8)) != 0x0) in bist_rd()
275 data = ((0x01 << 24) | ((address & 0xff) << 16) | (value << 8) | in bist_wr()
282 if ((result & (1 << 27)) != 0x0) in bist_wr()
284 else if ((result & (1 << 26)) != 0x0) in bist_wr()
305 column = ((bist_rd(adapter,moduleid, 0x0e)<<8) + in check_bist()
385 int port = mac->instance->index; in mac_set_address()
387 vsc_write(mac->adapter, REG_MAC_LOW_ADDR(port), in mac_set_address()
388 (addr[3] << 16) | (addr[4] << 8) | addr[5]); in mac_set_address()
389 vsc_write(mac->adapter, REG_MAC_HIGH_ADDR(port), in mac_set_address()
390 (addr[0] << 16) | (addr[1] << 8) | addr[2]); in mac_set_address()
392 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &val); in mac_set_address()
394 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, val | (port << 28)); in mac_set_address()
396 vsc_write(mac->adapter, REG_ING_FFILT_MASK0, in mac_set_address()
397 0xffff0000 | (addr[4] << 8) | addr[5]); in mac_set_address()
398 vsc_write(mac->adapter, REG_ING_FFILT_MASK1, in mac_set_address()
399 0xffff0000 | (addr[2] << 8) | addr[3]); in mac_set_address()
400 vsc_write(mac->adapter, REG_ING_FFILT_MASK2, in mac_set_address()
401 0xffff0000 | (addr[0] << 8) | addr[1]); in mac_set_address()
408 int port = mac->instance->index; in mac_get_address()
410 vsc_read(mac->adapter, REG_MAC_LOW_ADDR(port), &addr_lo); in mac_get_address()
411 vsc_read(mac->adapter, REG_MAC_HIGH_ADDR(port), &addr_hi); in mac_get_address()
414 addr[1] = (u8) (addr_hi >> 8); in mac_get_address()
417 addr[4] = (u8) (addr_lo >> 8); in mac_get_address()
425 int index = mac->instance->index; in mac_reset()
427 run_table(mac->adapter, vsc7326_portinit[index], in mac_reset()
435 u32 v; in mac_set_rx_mode() local
436 int port = mac->instance->index; in mac_set_rx_mode()
438 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &v); in mac_set_rx_mode()
439 v |= 1 << 12; in mac_set_rx_mode()
442 v &= ~(1 << (port + 16)); in mac_set_rx_mode()
444 v |= 1 << (port + 16); in mac_set_rx_mode()
446 vsc_write(mac->adapter, REG_ING_FFILT_UM_EN, v); in mac_set_rx_mode()
452 int port = mac->instance->index; in mac_set_mtu()
455 vsc_write(mac->adapter, REG_MAX_LEN(port), mtu + 14 + 4); in mac_set_mtu()
462 u32 v; in mac_set_speed_duplex_fc() local
463 int enable, port = mac->instance->index; in mac_set_speed_duplex_fc()
467 return -1; in mac_set_speed_duplex_fc()
469 return -1; in mac_set_speed_duplex_fc()
472 vsc_read(mac->adapter, REG_MODE_CFG(port), &v); in mac_set_speed_duplex_fc()
473 enable = v & 3; /* save tx/rx enables */ in mac_set_speed_duplex_fc()
474 v &= ~0xf; in mac_set_speed_duplex_fc()
475 v |= 4; /* full duplex */ in mac_set_speed_duplex_fc()
477 v |= 8; /* GigE */ in mac_set_speed_duplex_fc()
478 enable |= v; in mac_set_speed_duplex_fc()
479 vsc_write(mac->adapter, REG_MODE_CFG(port), v); in mac_set_speed_duplex_fc()
482 v = 0x82; in mac_set_speed_duplex_fc()
484 v = 0x84; in mac_set_speed_duplex_fc()
486 v = 0x86; in mac_set_speed_duplex_fc()
487 vsc_write(mac->adapter, REG_DEV_SETUP(port), v | 1); /* reset */ in mac_set_speed_duplex_fc()
488 vsc_write(mac->adapter, REG_DEV_SETUP(port), v); in mac_set_speed_duplex_fc()
489 vsc_read(mac->adapter, REG_DBG(port), &v); in mac_set_speed_duplex_fc()
490 v &= ~0xff00; in mac_set_speed_duplex_fc()
492 v |= 0x400; in mac_set_speed_duplex_fc()
494 v |= 0x2000; in mac_set_speed_duplex_fc()
496 v |= 0xff00; in mac_set_speed_duplex_fc()
497 vsc_write(mac->adapter, REG_DBG(port), v); in mac_set_speed_duplex_fc()
499 vsc_write(mac->adapter, REG_TX_IFG(port), in mac_set_speed_duplex_fc()
511 vsc_write(mac->adapter, REG_MODE_CFG(port), enable); in mac_set_speed_duplex_fc()
515 vsc_read(mac->adapter, REG_PAUSE_CFG(port), &v); in mac_set_speed_duplex_fc()
516 v &= 0xfff0ffff; in mac_set_speed_duplex_fc()
517 v |= 0x20000; /* xon/xoff */ in mac_set_speed_duplex_fc()
519 v |= 0x40000; in mac_set_speed_duplex_fc()
521 v |= 0x80000; in mac_set_speed_duplex_fc()
523 v |= 0x10000; in mac_set_speed_duplex_fc()
524 vsc_write(mac->adapter, REG_PAUSE_CFG(port), v); in mac_set_speed_duplex_fc()
531 int port = mac->instance->index; in mac_enable()
534 vsc_write(mac->adapter, REG_HIGH_LOW_WM(1,port), WM_ENABLE); in mac_enable()
536 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_enable()
540 val |= 1; in mac_enable()
541 vsc_write(mac->adapter, REG_MODE_CFG(port), val); in mac_enable()
548 int i, port = mac->instance->index; in mac_disable()
553 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_disable()
558 vsc_write(mac->adapter, REG_MODE_CFG(port), val); in mac_disable()
559 vsc_read(mac->adapter, REG_MODE_CFG(port), &val); in mac_disable()
563 vsc_write(mac->adapter, CRA(4, port, i), 0); in mac_disable()
566 memset(&mac->stats, 0, sizeof(struct cmac_statistics)); in mac_disable()
573 u32 v, lo; in rmon_update() local
575 vsc_read(mac->adapter, addr, &v); in rmon_update()
577 *stat = *stat - lo + v; in rmon_update()
579 if (v == 0) in rmon_update()
582 if (v < lo) in rmon_update()
583 *stat += (1ULL << 32); in rmon_update()
610 /* Tx stats (skip collision stats as we are full-duplex only) */ in port_stats_update()
618 unsigned int port = mac->instance->index; in port_stats_update()
619 u64 *stats = (u64 *)&mac->stats; in port_stats_update()
623 rmon_update(mac, CRA(0x4, port, p->reg), stats + p->offset); in port_stats_update()
625 rmon_update(mac, REG_TX_OK_BYTES(port), &mac->stats.TxOctetsOK); in port_stats_update()
626 rmon_update(mac, REG_RX_OK_BYTES(port), &mac->stats.RxOctetsOK); in port_stats_update()
627 rmon_update(mac, REG_RX_BAD_BYTES(port), &mac->stats.RxOctetsBad); in port_stats_update()
632 * RMON counters into the port statistics. Since the counters are only 32 bits
636 * To cut down on reading costs we update only the octet counters at each tick
643 mac->instance->ticks >= MAJOR_UPDATE_TICKS) { in mac_update_statistics()
645 mac->instance->ticks = 0; in mac_update_statistics()
647 int port = mac->instance->index; in mac_update_statistics()
650 &mac->stats.RxOctetsOK); in mac_update_statistics()
652 &mac->stats.RxOctetsBad); in mac_update_statistics()
654 &mac->stats.TxOctetsOK); in mac_update_statistics()
655 mac->instance->ticks++; in mac_update_statistics()
657 return &mac->stats; in mac_update_statistics()
692 mac->ops = &vsc7326_ops; in vsc7326_mac_create()
693 mac->instance = (cmac_instance *)(mac + 1); in vsc7326_mac_create()
694 mac->adapter = adapter; in vsc7326_mac_create()
696 mac->instance->index = index; in vsc7326_mac_create()
697 mac->instance->ticks = 0; in vsc7326_mac_create()
705 udelay(1); in vsc7326_mac_create()