sfc: Add support for SFN4111T
[firefly-linux-kernel-4.4.55.git] / drivers / net / sfc / falcon.c
index fde4e7912c39167ad90048a181120b4ef80c5361..84771a7920997b0c6879b410874ee972fd334ae4 100644 (file)
@@ -826,7 +826,7 @@ static void falcon_handle_rx_not_ok(struct efx_rx_queue *rx_queue,
 #endif
 
        if (unlikely(rx_ev_eth_crc_err && EFX_WORKAROUND_10750(efx) &&
-                    efx->phy_type == PHY_TYPE_10XPRESS))
+                    efx->phy_type == PHY_TYPE_SFX7101))
                tenxpress_crc_err(efx);
 }
 
@@ -910,22 +910,20 @@ static void falcon_handle_global_event(struct efx_channel *channel,
                                       efx_qword_t *event)
 {
        struct efx_nic *efx = channel->efx;
-       bool is_phy_event = false, handled = false;
+       bool handled = false;
 
-       /* Check for interrupt on either port.  Some boards have a
-        * single PHY wired to the interrupt line for port 1. */
        if (EFX_QWORD_FIELD(*event, G_PHY0_INTR) ||
            EFX_QWORD_FIELD(*event, G_PHY1_INTR) ||
-           EFX_QWORD_FIELD(*event, XG_PHY_INTR))
-               is_phy_event = true;
+           EFX_QWORD_FIELD(*event, XG_PHY_INTR) ||
+           EFX_QWORD_FIELD(*event, XFP_PHY_INTR)) {
+               efx->phy_op->clear_interrupt(efx);
+               queue_work(efx->workqueue, &efx->phy_work);
+               handled = true;
+       }
 
        if ((falcon_rev(efx) >= FALCON_REV_B0) &&
-           EFX_QWORD_FIELD(*event, XG_MNT_INTR_B0))
-               is_phy_event = true;
-
-       if (is_phy_event) {
-               efx->phy_op->clear_interrupt(efx);
-               queue_work(efx->workqueue, &efx->reconfigure_work);
+           EFX_QWORD_FIELD(*event, XG_MNT_INTR_B0)) {
+               queue_work(efx->workqueue, &efx->mac_work);
                handled = true;
        }
 
@@ -2247,8 +2245,12 @@ static void falcon_init_mdio(struct mii_if_info *gmii)
 static int falcon_probe_phy(struct efx_nic *efx)
 {
        switch (efx->phy_type) {
-       case PHY_TYPE_10XPRESS:
-               efx->phy_op = &falcon_tenxpress_phy_ops;
+       case PHY_TYPE_SFX7101:
+               efx->phy_op = &falcon_sfx7101_phy_ops;
+               break;
+       case PHY_TYPE_SFT9001A:
+       case PHY_TYPE_SFT9001B:
+               efx->phy_op = &falcon_sft9001_phy_ops;
                break;
        case PHY_TYPE_XFP:
                efx->phy_op = &falcon_xfp_phy_ops;
@@ -2969,6 +2971,13 @@ int falcon_init_nic(struct efx_nic *efx)
        EFX_SET_OWORD_FIELD(temp, ONCHIP_SRAM, 1);
        falcon_write(efx, &temp, NIC_STAT_REG);
 
+       /* Set the source of the GMAC clock */
+       if (falcon_rev(efx) == FALCON_REV_B0) {
+               falcon_read(efx, &temp, GPIO_CTL_REG_KER);
+               EFX_SET_OWORD_FIELD(temp, GPIO_USE_NIC_CLK, true);
+               falcon_write(efx, &temp, GPIO_CTL_REG_KER);
+       }
+
        /* Set buffer table mode */
        EFX_POPULATE_OWORD_1(temp, BUF_TBL_MODE, BUF_TBL_MODE_FULL);
        falcon_write(efx, &temp, BUF_TBL_CFG_REG_KER);