Lines Matching +full:1588 +full:- +full:2008
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later
3 * Copyright 2008 - 2015 Freescale Semiconductor Inc.
18 /* Transmit Inter-Packet Gap Length Register (TX_IPG_LENGTH) */
86 u32 tx_ipg_len; /* 0x044 Transmitter inter-packet-gap */
96 u32 type_1588v2; /* 0x06c Type field for 1588v2 */
131 u32 reserved100[2]; /* 100-108 */
205 iowrite32be(tmp0, ®s->mac_addr_0); in set_mac_address()
206 iowrite32be(tmp1, ®s->mac_addr_1); in set_mac_address()
211 cfg->promiscuous_mode_enable = false; in set_dflts()
212 cfg->pause_ignore = false; in set_dflts()
213 cfg->tx_ipg_length = DEFAULT_TX_IPG_LENGTH; in set_dflts()
214 cfg->max_frame_length = DEFAULT_MAX_FRAME_LENGTH; in set_dflts()
215 cfg->pause_quant = DEFAULT_PAUSE_QUANT; in set_dflts()
225 if (cfg->promiscuous_mode_enable) in init()
227 if (cfg->pause_ignore) in init()
231 iowrite32be(tmp, ®s->command_config); in init()
234 iowrite32be((u32)cfg->max_frame_length, ®s->maxfrm); in init()
236 iowrite32be(cfg->pause_quant, ®s->pause_quant); in init()
238 /* clear all pending events and set-up interrupts */ in init()
239 iowrite32be(0xffffffff, ®s->ievent); in init()
240 iowrite32be(ioread32be(®s->imask) | exception_mask, ®s->imask); in init()
247 if (!tgec->exception_cb) { in check_init_parameters()
249 return -EINVAL; in check_init_parameters()
251 if (!tgec->event_cb) { in check_init_parameters()
253 return -EINVAL; in check_init_parameters()
326 struct tgec_regs __iomem *regs = tgec->regs; in tgec_err_exception()
330 event = ioread32be(®s->ievent) & in tgec_err_exception()
334 event &= ioread32be(®s->imask); in tgec_err_exception()
336 iowrite32be(event, ®s->ievent); in tgec_err_exception()
339 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_REM_FAULT); in tgec_err_exception()
341 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_LOC_FAULT); in tgec_err_exception()
343 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_TX_ECC_ER); in tgec_err_exception()
345 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_TX_FIFO_UNFL); in tgec_err_exception()
347 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_TX_FIFO_OVFL); in tgec_err_exception()
349 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_TX_ER); in tgec_err_exception()
351 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_FIFO_OVFL); in tgec_err_exception()
353 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_ECC_ER); in tgec_err_exception()
355 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_JAB_FRM); in tgec_err_exception()
357 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_OVRSZ_FRM); in tgec_err_exception()
359 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_RUNT_FRM); in tgec_err_exception()
361 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_FRAG_FRM); in tgec_err_exception()
363 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_LEN_ER); in tgec_err_exception()
365 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_CRC_ER); in tgec_err_exception()
367 tgec->exception_cb(tgec->dev_id, FM_MAC_EX_10G_RX_ALIGN_ER); in tgec_err_exception()
372 fman_unregister_intr(tgec->fm, FMAN_MOD_MAC, tgec->mac_id, in free_init_resources()
376 free_hash_table(tgec->multicast_addr_hash); in free_init_resources()
377 tgec->multicast_addr_hash = NULL; in free_init_resources()
380 free_hash_table(tgec->unicast_addr_hash); in free_init_resources()
381 tgec->unicast_addr_hash = NULL; in free_init_resources()
395 struct tgec_regs __iomem *regs = tgec->regs; in tgec_set_promiscuous()
398 tmp = ioread32be(®s->command_config); in tgec_set_promiscuous()
403 iowrite32be(tmp, ®s->command_config); in tgec_set_promiscuous()
412 struct tgec_regs __iomem *regs = tgec->regs; in tgec_set_tx_pause_frames()
414 iowrite32be((u32)pause_time, ®s->pause_quant); in tgec_set_tx_pause_frames()
421 struct tgec_regs __iomem *regs = tgec->regs; in tgec_accept_rx_pause_frames()
424 tmp = ioread32be(®s->command_config); in tgec_accept_rx_pause_frames()
429 iowrite32be(tmp, ®s->command_config); in tgec_accept_rx_pause_frames()
444 struct fman_mac *tgec = mac_dev->fman_mac; in tgec_link_up()
445 struct tgec_regs __iomem *regs = tgec->regs; in tgec_link_up()
452 mac_dev->update_speed(mac_dev, speed); in tgec_link_up()
454 tmp = ioread32be(®s->command_config); in tgec_link_up()
456 iowrite32be(tmp, ®s->command_config); in tgec_link_up()
462 struct fman_mac *tgec = fman_config_to_mac(config)->fman_mac; in tgec_link_down()
463 struct tgec_regs __iomem *regs = tgec->regs; in tgec_link_down()
466 tmp = ioread32be(®s->command_config); in tgec_link_down()
468 iowrite32be(tmp, ®s->command_config); in tgec_link_down()
480 tgec->addr = ENET_ADDR_TO_UINT64(*p_enet_addr); in tgec_modify_mac_address()
481 set_mac_address(tgec->regs, (const u8 *)(*p_enet_addr)); in tgec_modify_mac_address()
489 struct tgec_regs __iomem *regs = tgec->regs; in tgec_add_hash_mac_address()
499 return -EINVAL; in tgec_add_hash_mac_address()
510 return -ENOMEM; in tgec_add_hash_mac_address()
511 hash_entry->addr = addr; in tgec_add_hash_mac_address()
512 INIT_LIST_HEAD(&hash_entry->node); in tgec_add_hash_mac_address()
514 list_add_tail(&hash_entry->node, in tgec_add_hash_mac_address()
515 &tgec->multicast_addr_hash->lsts[hash]); in tgec_add_hash_mac_address()
516 iowrite32be((hash | TGEC_HASH_MCAST_EN), ®s->hashtable_ctrl); in tgec_add_hash_mac_address()
524 struct tgec_regs __iomem *regs = tgec->regs; in tgec_set_allmulti()
529 ®s->hashtable_ctrl); in tgec_set_allmulti()
533 ®s->hashtable_ctrl); in tgec_set_allmulti()
536 tgec->allmulti_enabled = enable; in tgec_set_allmulti()
543 struct tgec_regs __iomem *regs = tgec->regs; in tgec_set_tstamp()
546 tmp = ioread32be(®s->command_config); in tgec_set_tstamp()
553 iowrite32be(tmp, ®s->command_config); in tgec_set_tstamp()
561 struct tgec_regs __iomem *regs = tgec->regs; in tgec_del_hash_mac_address()
575 list_for_each(pos, &tgec->multicast_addr_hash->lsts[hash]) { in tgec_del_hash_mac_address()
577 if (hash_entry && hash_entry->addr == addr) { in tgec_del_hash_mac_address()
578 list_del_init(&hash_entry->node); in tgec_del_hash_mac_address()
584 if (!tgec->allmulti_enabled) { in tgec_del_hash_mac_address()
585 if (list_empty(&tgec->multicast_addr_hash->lsts[hash])) in tgec_del_hash_mac_address()
587 ®s->hashtable_ctrl); in tgec_del_hash_mac_address()
596 struct tgec_regs __iomem *regs = tgec->regs; in tgec_set_exception()
602 tgec->exceptions |= bit_mask; in tgec_set_exception()
604 tgec->exceptions &= ~bit_mask; in tgec_set_exception()
607 return -EINVAL; in tgec_set_exception()
610 iowrite32be(ioread32be(®s->imask) | bit_mask, ®s->imask); in tgec_set_exception()
612 iowrite32be(ioread32be(®s->imask) & ~bit_mask, ®s->imask); in tgec_set_exception()
624 (fman_reset_mac(tgec->fm, tgec->mac_id) != 0)) { in tgec_init()
626 return -EINVAL; in tgec_init()
633 cfg = tgec->cfg; in tgec_init()
635 if (tgec->addr) { in tgec_init()
636 MAKE_ENET_ADDR_FROM_UINT64(tgec->addr, eth_addr); in tgec_init()
637 set_mac_address(tgec->regs, (const u8 *)eth_addr); in tgec_init()
642 if (tgec->fm_rev_info.major <= 2) in tgec_init()
643 tgec->exceptions &= ~(TGEC_IMASK_REM_FAULT | in tgec_init()
646 err = init(tgec->regs, cfg, tgec->exceptions); in tgec_init()
654 err = fman_set_mac_max_frame(tgec->fm, tgec->mac_id, in tgec_init()
655 cfg->max_frame_length); in tgec_init()
659 return -EINVAL; in tgec_init()
663 if (tgec->fm_rev_info.major == 2) { in tgec_init()
664 struct tgec_regs __iomem *regs = tgec->regs; in tgec_init()
668 tmp = (ioread32be(®s->tx_ipg_len) & in tgec_init()
671 iowrite32be(tmp, ®s->tx_ipg_len); in tgec_init()
674 tgec->multicast_addr_hash = alloc_hash_table(TGEC_HASH_TABLE_SIZE); in tgec_init()
675 if (!tgec->multicast_addr_hash) { in tgec_init()
678 return -ENOMEM; in tgec_init()
681 tgec->unicast_addr_hash = alloc_hash_table(TGEC_HASH_TABLE_SIZE); in tgec_init()
682 if (!tgec->unicast_addr_hash) { in tgec_init()
685 return -ENOMEM; in tgec_init()
688 fman_register_intr(tgec->fm, FMAN_MOD_MAC, tgec->mac_id, in tgec_init()
692 tgec->cfg = NULL; in tgec_init()
701 kfree(tgec->cfg); in tgec_free()
726 tgec->cfg = cfg; in tgec_config()
730 tgec->regs = mac_dev->vaddr; in tgec_config()
731 tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr); in tgec_config()
732 tgec->mac_id = params->mac_id; in tgec_config()
733 tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT | in tgec_config()
748 tgec->exception_cb = params->exception_cb; in tgec_config()
749 tgec->event_cb = params->event_cb; in tgec_config()
750 tgec->dev_id = mac_dev; in tgec_config()
751 tgec->fm = params->fm; in tgec_config()
754 fman_get_revision(tgec->fm, &tgec->fm_rev_info); in tgec_config()
766 mac_dev->phylink_ops = &tgec_mac_ops; in tgec_initialization()
767 mac_dev->set_promisc = tgec_set_promiscuous; in tgec_initialization()
768 mac_dev->change_addr = tgec_modify_mac_address; in tgec_initialization()
769 mac_dev->add_hash_mac_addr = tgec_add_hash_mac_address; in tgec_initialization()
770 mac_dev->remove_hash_mac_addr = tgec_del_hash_mac_address; in tgec_initialization()
771 mac_dev->set_exception = tgec_set_exception; in tgec_initialization()
772 mac_dev->set_allmulti = tgec_set_allmulti; in tgec_initialization()
773 mac_dev->set_tstamp = tgec_set_tstamp; in tgec_initialization()
774 mac_dev->set_multi = fman_set_multi; in tgec_initialization()
775 mac_dev->enable = tgec_enable; in tgec_initialization()
776 mac_dev->disable = tgec_disable; in tgec_initialization()
778 mac_dev->fman_mac = tgec_config(mac_dev, params); in tgec_initialization()
779 if (!mac_dev->fman_mac) { in tgec_initialization()
780 err = -EINVAL; in tgec_initialization()
789 if (mac_dev->phy_if == PHY_INTERFACE_MODE_XGMII) in tgec_initialization()
790 mac_dev->phy_if = PHY_INTERFACE_MODE_XAUI; in tgec_initialization()
793 mac_dev->phylink_config.supported_interfaces); in tgec_initialization()
794 mac_dev->phylink_config.mac_capabilities = in tgec_initialization()
797 tgec = mac_dev->fman_mac; in tgec_initialization()
798 tgec->cfg->max_frame_length = fman_get_max_frm(); in tgec_initialization()
809 ioread32be(&tgec->regs->tgec_id)); in tgec_initialization()
813 tgec_free(mac_dev->fman_mac); in tgec_initialization()