Lines Matching full:fec
49 #include <linux/fsl/bestcomm/fec.h>
53 #define DRIVER_NAME "mpc52xx-fec"
62 struct mpc52xx_fec __iomem *fec; member
107 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_set_paddr() local
109 out_be32(&fec->paddr1, *(const u32 *)(&mac[0])); in mpc52xx_fec_set_paddr()
110 out_be32(&fec->paddr2, (*(const u16 *)(&mac[4]) << 16) | FEC_PADDR2_TYPE); in mpc52xx_fec_set_paddr()
174 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_adjust_link() local
181 rcntrl = in_be32(&fec->r_cntrl); in mpc52xx_fec_adjust_link()
182 tcntrl = in_be32(&fec->x_cntrl); in mpc52xx_fec_adjust_link()
191 out_be32(&fec->r_cntrl, rcntrl); in mpc52xx_fec_adjust_link()
192 out_be32(&fec->x_cntrl, tcntrl); in mpc52xx_fec_adjust_link()
447 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_interrupt() local
450 ievent = in_be32(&fec->ievent); in mpc52xx_fec_interrupt()
456 out_be32(&fec->ievent, ievent); /* clear pending events */ in mpc52xx_fec_interrupt()
458 /* on fifo error, soft-reset fec */ in mpc52xx_fec_interrupt()
487 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_get_stats() local
489 stats->rx_bytes = in_be32(&fec->rmon_r_octets); in mpc52xx_fec_get_stats()
490 stats->rx_packets = in_be32(&fec->rmon_r_packets); in mpc52xx_fec_get_stats()
491 stats->rx_errors = in_be32(&fec->rmon_r_crc_align) + in mpc52xx_fec_get_stats()
492 in_be32(&fec->rmon_r_undersize) + in mpc52xx_fec_get_stats()
493 in_be32(&fec->rmon_r_oversize) + in mpc52xx_fec_get_stats()
494 in_be32(&fec->rmon_r_frag) + in mpc52xx_fec_get_stats()
495 in_be32(&fec->rmon_r_jab); in mpc52xx_fec_get_stats()
497 stats->tx_bytes = in_be32(&fec->rmon_t_octets); in mpc52xx_fec_get_stats()
498 stats->tx_packets = in_be32(&fec->rmon_t_packets); in mpc52xx_fec_get_stats()
499 stats->tx_errors = in_be32(&fec->rmon_t_crc_align) + in mpc52xx_fec_get_stats()
500 in_be32(&fec->rmon_t_undersize) + in mpc52xx_fec_get_stats()
501 in_be32(&fec->rmon_t_oversize) + in mpc52xx_fec_get_stats()
502 in_be32(&fec->rmon_t_frag) + in mpc52xx_fec_get_stats()
503 in_be32(&fec->rmon_t_jab); in mpc52xx_fec_get_stats()
505 stats->multicast = in_be32(&fec->rmon_r_mc_pkt); in mpc52xx_fec_get_stats()
506 stats->collisions = in_be32(&fec->rmon_t_col); in mpc52xx_fec_get_stats()
509 stats->rx_length_errors = in_be32(&fec->rmon_r_undersize) in mpc52xx_fec_get_stats()
510 + in_be32(&fec->rmon_r_oversize) in mpc52xx_fec_get_stats()
511 + in_be32(&fec->rmon_r_frag) in mpc52xx_fec_get_stats()
512 + in_be32(&fec->rmon_r_jab); in mpc52xx_fec_get_stats()
513 stats->rx_over_errors = in_be32(&fec->r_macerr); in mpc52xx_fec_get_stats()
514 stats->rx_crc_errors = in_be32(&fec->ieee_r_crc); in mpc52xx_fec_get_stats()
515 stats->rx_frame_errors = in_be32(&fec->ieee_r_align); in mpc52xx_fec_get_stats()
516 stats->rx_fifo_errors = in_be32(&fec->rmon_r_drop); in mpc52xx_fec_get_stats()
517 stats->rx_missed_errors = in_be32(&fec->rmon_r_drop); in mpc52xx_fec_get_stats()
521 stats->tx_carrier_errors = in_be32(&fec->ieee_t_cserr); in mpc52xx_fec_get_stats()
522 stats->tx_fifo_errors = in_be32(&fec->rmon_t_drop); in mpc52xx_fec_get_stats()
523 stats->tx_heartbeat_errors = in_be32(&fec->ieee_t_sqe); in mpc52xx_fec_get_stats()
524 stats->tx_window_errors = in_be32(&fec->ieee_t_lcol); in mpc52xx_fec_get_stats()
536 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_reset_stats() local
538 out_be32(&fec->mib_control, FEC_MIB_DISABLE); in mpc52xx_fec_reset_stats()
539 memset_io(&fec->rmon_t_drop, 0, in mpc52xx_fec_reset_stats()
542 out_be32(&fec->mib_control, 0); in mpc52xx_fec_reset_stats()
553 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_set_multicast_list() local
556 rx_control = in_be32(&fec->r_cntrl); in mpc52xx_fec_set_multicast_list()
560 out_be32(&fec->r_cntrl, rx_control); in mpc52xx_fec_set_multicast_list()
563 out_be32(&fec->r_cntrl, rx_control); in mpc52xx_fec_set_multicast_list()
566 out_be32(&fec->gaddr1, 0xffffffff); in mpc52xx_fec_set_multicast_list()
567 out_be32(&fec->gaddr2, 0xffffffff); in mpc52xx_fec_set_multicast_list()
581 out_be32(&fec->gaddr1, gaddr1); in mpc52xx_fec_set_multicast_list()
582 out_be32(&fec->gaddr2, gaddr2); in mpc52xx_fec_set_multicast_list()
596 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_hw_init() local
600 out_be32(&fec->ecntrl, FEC_ECNTRL_RESET); in mpc52xx_fec_hw_init()
602 if ((in_be32(&fec->ecntrl) & FEC_ECNTRL_RESET) == 0) in mpc52xx_fec_hw_init()
607 dev_err(&dev->dev, "FEC Reset timeout!\n"); in mpc52xx_fec_hw_init()
610 out_be32(&fec->op_pause, FEC_OP_PAUSE_OPCODE | 0x20); in mpc52xx_fec_hw_init()
615 out_be32(&fec->rfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7); in mpc52xx_fec_hw_init()
616 out_be32(&fec->tfifo_cntrl, FEC_FIFO_CNTRL_FRAME | FEC_FIFO_CNTRL_LTG_7); in mpc52xx_fec_hw_init()
619 out_be32(&fec->rfifo_alarm, 0x0000030c); in mpc52xx_fec_hw_init()
620 out_be32(&fec->tfifo_alarm, 0x00000100); in mpc52xx_fec_hw_init()
623 out_be32(&fec->x_wmrk, FEC_FIFO_WMRK_256B); in mpc52xx_fec_hw_init()
626 out_be32(&fec->xmit_fsm, FEC_XMIT_FSM_APPEND_CRC | FEC_XMIT_FSM_ENABLE_CRC); in mpc52xx_fec_hw_init()
627 out_be32(&fec->iaddr1, 0x00000000); /* No individual filter */ in mpc52xx_fec_hw_init()
628 out_be32(&fec->iaddr2, 0x00000000); /* No individual filter */ in mpc52xx_fec_hw_init()
632 * before fec stuff (even on resume) */ in mpc52xx_fec_hw_init()
633 out_be32(&fec->mii_speed, priv->mdio_speed); in mpc52xx_fec_hw_init()
640 * This function is called to start or restart the FEC during a link
647 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_start() local
654 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status) & tmp); in mpc52xx_fec_start()
655 out_be32(&fec->tfifo_status, in_be32(&fec->tfifo_status) & tmp); in mpc52xx_fec_start()
658 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_ENABLE_IS_RESET); in mpc52xx_fec_start()
678 out_be32(&fec->r_cntrl, rcntrl); in mpc52xx_fec_start()
679 out_be32(&fec->x_cntrl, tcntrl); in mpc52xx_fec_start()
682 out_be32(&fec->ievent, 0xffffffff); in mpc52xx_fec_start()
685 out_be32(&fec->imask, FEC_IMASK_ENABLE); in mpc52xx_fec_start()
688 out_be32(&fec->ecntrl, FEC_ECNTRL_ETHER_EN); in mpc52xx_fec_start()
689 out_be32(&fec->r_des_active, 0x01000000); in mpc52xx_fec_start()
696 * stop all activity on fec and empty dma buffers
701 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_stop() local
705 out_be32(&fec->imask, 0); in mpc52xx_fec_stop()
733 /* Stop FEC */ in mpc52xx_fec_stop()
734 out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN); in mpc52xx_fec_stop()
737 /* reset fec and bestcomm tasks */
741 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_reset() local
745 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status)); in mpc52xx_fec_reset()
746 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO); in mpc52xx_fec_reset()
830 /* Reserve FEC control zone */ in mpc52xx_fec_probe()
860 priv->fec = ioremap(mem.start, sizeof(struct mpc52xx_fec)); in mpc52xx_fec_probe()
862 if (!priv->fec) { in mpc52xx_fec_probe()
897 struct mpc52xx_fec __iomem *fec = priv->fec; in mpc52xx_fec_probe() local
904 *(u32 *)(&addr[0]) = in_be32(&fec->paddr1); in mpc52xx_fec_probe()
905 *(u16 *)(&addr[4]) = in_be32(&fec->paddr2) >> 16; in mpc52xx_fec_probe()
968 iounmap(priv->fec); in mpc52xx_fec_probe()
996 iounmap(priv->fec); in mpc52xx_fec_remove()
1029 { .compatible = "fsl,mpc5200b-fec", },
1030 { .compatible = "fsl,mpc5200-fec", },
1031 { .compatible = "mpc5200-fec", },
1080 MODULE_DESCRIPTION("Ethernet driver for the Freescale MPC52xx FEC");