Lines Matching +full:3 +full:- +full:port
1 // SPDX-License-Identifier: GPL-2.0
16 * interface is down (MAC port disabled). This is a workaround
17 * for disabling the T2/MAC flow-control. When the interface is
40 spin_lock_bh(&adapter->mac_lock); in vsc_read()
60 spin_unlock_bh(&adapter->mac_lock); in vsc_read()
65 spin_lock_bh(&adapter->mac_lock); in vsc_write()
71 spin_unlock_bh(&adapter->mac_lock); in vsc_write()
114 { /* Port 0 */
130 /* Port config */
140 { /* Port 1 */
156 /* Port config */
166 { /* Port 2 */
182 /* Port config */
192 { /* Port 3 */
194 { REG_DBG(3), 0x000004f0 },
195 { REG_HDX(3), 0x00073101 },
196 { REG_TEST(0,3), 0x00000022 },
197 { REG_TEST(1,3), 0x00000022 },
198 { REG_TOP_BOTTOM(0,3), 0x00fc00bd },
199 { REG_TOP_BOTTOM(1,3), 0x00480036 },
200 { REG_HIGH_LOW_WM(0,3), 0x07460757 },
201 { REG_HIGH_LOW_WM(1,3), WM_DISABLE },
202 { REG_CT_THRHLD(0,3), 0x00000000 },
203 { REG_CT_THRHLD(1,3), 0x00000000 },
204 { REG_BUCKE(3), 0x0002ffff },
205 { REG_BUCKI(3), 0x0002ffff },
206 { REG_TEST(0,3), 0x00000020 },
207 { REG_TEST(1,3), 0x00000020 },
208 /* Port config */
209 { REG_MAX_LEN(3), 0x00002710 },
210 { REG_PORT_FAIL(3), 0x00000002 },
211 { REG_NORMALIZER(3), 0x00000a64 },
212 { REG_DENORM(3), 0x00000010 },
213 { REG_STICK_BIT(3), 0x03baa370 },
214 { REG_DEV_SETUP(3), 0x00000083 },
215 { REG_DEV_SETUP(3), 0x00000082 },
216 { REG_MODE_CFG(3), 0x0200259f },
307 if ((result & 3) != 0x3) in check_bist()
322 int port = 0; in run_bist_all() local
328 for (port = 0; port < 12; port++) in run_bist_all()
329 vsc_write(adapter, REG_DEV_SETUP(port), 0x0); in run_bist_all()
352 for (port = 0; port < 12; port++) in run_bist_all()
353 vsc_write(adapter, REG_DEV_SETUP(port), 0x1); in run_bist_all()
385 int port = mac->instance->index; in mac_set_address() local
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()
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()
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()
408 int port = mac->instance->index; in mac_get_address() local
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()
416 addr[3] = (u8) (addr_lo >> 16); in mac_get_address()
422 /* This is intended to reset a port, not the whole MAC */
425 int index = mac->instance->index; in mac_reset()
427 run_table(mac->adapter, vsc7326_portinit[index], in mac_reset()
436 int port = mac->instance->index; in mac_set_rx_mode() local
438 vsc_read(mac->adapter, REG_ING_FFILT_UM_EN, &v); 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() local
455 vsc_write(mac->adapter, REG_MAX_LEN(port), mtu + 14 + 4); in mac_set_mtu()
463 int enable, port = mac->instance->index; in mac_set_speed_duplex_fc() local
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()
479 vsc_write(mac->adapter, REG_MODE_CFG(port), v); 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()
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()
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() local
533 /* Write the correct WM value when the port is enabled. */ 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()
541 vsc_write(mac->adapter, REG_MODE_CFG(port), val); in mac_enable()
548 int i, port = mac->instance->index; in mac_disable() local
550 /* Reset the port, this also writes the correct WM value */ 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()
575 vsc_read(mac->adapter, addr, &v); in rmon_update()
577 *stat = *stat - lo + v; 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() local
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
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() local
649 rmon_update(mac, REG_RX_OK_BYTES(port), in mac_update_statistics()
650 &mac->stats.RxOctetsOK); in mac_update_statistics()
651 rmon_update(mac, REG_RX_BAD_BYTES(port), in mac_update_statistics()
652 &mac->stats.RxOctetsBad); in mac_update_statistics()
653 rmon_update(mac, REG_TX_OK_BYTES(port), 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()