tg3: Set initial carrier state to off.
[pandora-kernel.git] / drivers / net / ethernet / broadcom / tg3.c
index bdb0869..3829321 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (C) 2001, 2002, 2003, 2004 David S. Miller (davem@redhat.com)
  * Copyright (C) 2001, 2002, 2003 Jeff Garzik (jgarzik@pobox.com)
  * Copyright (C) 2004 Sun Microsystems Inc.
- * Copyright (C) 2005-2012 Broadcom Corporation.
+ * Copyright (C) 2005-2013 Broadcom Corporation.
  *
  * Firmware is:
  *     Derived from proprietary unpublished source code,
@@ -44,6 +44,7 @@
 #include <linux/prefetch.h>
 #include <linux/dma-mapping.h>
 #include <linux/firmware.h>
+#include <linux/ssb/ssb_driver_gige.h>
 #include <linux/hwmon.h>
 #include <linux/hwmon-sysfs.h>
 
@@ -93,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
 
 #define DRV_MODULE_NAME                "tg3"
 #define TG3_MAJ_NUM                    3
-#define TG3_MIN_NUM                    128
+#define TG3_MIN_NUM                    129
 #define DRV_MODULE_VERSION     \
        __stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
-#define DRV_MODULE_RELDATE     "December 03, 2012"
+#define DRV_MODULE_RELDATE     "January 06, 2013"
 
 #define RESET_KIND_SHUTDOWN    0
 #define RESET_KIND_INIT                1
@@ -263,6 +264,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
                        TG3_DRV_DATA_FLAG_5705_10_100},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5721)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5722)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5750)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751M)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5751F),
@@ -330,6 +332,10 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_tbl) = {
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)},
        {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57766)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5762)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5725)},
+       {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5727)},
        {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)},
        {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)},
        {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
@@ -570,7 +576,9 @@ static void _tw32_flush(struct tg3 *tp, u32 off, u32 val, u32 usec_wait)
 static inline void tw32_mailbox_flush(struct tg3 *tp, u32 off, u32 val)
 {
        tp->write32_mbox(tp, off, val);
-       if (!tg3_flag(tp, MBOX_WRITE_REORDER) && !tg3_flag(tp, ICH_WORKAROUND))
+       if (tg3_flag(tp, FLUSH_POSTED_WRITES) ||
+           (!tg3_flag(tp, MBOX_WRITE_REORDER) &&
+            !tg3_flag(tp, ICH_WORKAROUND)))
                tp->read32_mbox(tp, off);
 }
 
@@ -580,7 +588,8 @@ static void tg3_write32_tx_mbox(struct tg3 *tp, u32 off, u32 val)
        writel(val, mbox);
        if (tg3_flag(tp, TXD_MBOX_HWBUG))
                writel(val, mbox);
-       if (tg3_flag(tp, MBOX_WRITE_REORDER))
+       if (tg3_flag(tp, MBOX_WRITE_REORDER) ||
+           tg3_flag(tp, FLUSH_POSTED_WRITES))
                readl(mbox);
 }
 
@@ -1088,7 +1097,8 @@ static void tg3_switch_clocks(struct tg3 *tp)
 
 #define PHY_BUSY_LOOPS 5000
 
-static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
+static int __tg3_readphy(struct tg3 *tp, unsigned int phy_addr, int reg,
+                        u32 *val)
 {
        u32 frame_val;
        unsigned int loops;
@@ -1104,7 +1114,7 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
 
        *val = 0x0;
 
-       frame_val  = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
+       frame_val  = ((phy_addr << MI_COM_PHY_ADDR_SHIFT) &
                      MI_COM_PHY_ADDR_MASK);
        frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
                      MI_COM_REG_ADDR_MASK);
@@ -1141,7 +1151,13 @@ static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
        return ret;
 }
 
-static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
+static int tg3_readphy(struct tg3 *tp, int reg, u32 *val)
+{
+       return __tg3_readphy(tp, tp->phy_addr, reg, val);
+}
+
+static int __tg3_writephy(struct tg3 *tp, unsigned int phy_addr, int reg,
+                         u32 val)
 {
        u32 frame_val;
        unsigned int loops;
@@ -1159,7 +1175,7 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
 
        tg3_ape_lock(tp, tp->phy_ape_lock);
 
-       frame_val  = ((tp->phy_addr << MI_COM_PHY_ADDR_SHIFT) &
+       frame_val  = ((phy_addr << MI_COM_PHY_ADDR_SHIFT) &
                      MI_COM_PHY_ADDR_MASK);
        frame_val |= ((reg << MI_COM_REG_ADDR_SHIFT) &
                      MI_COM_REG_ADDR_MASK);
@@ -1194,6 +1210,11 @@ static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
        return ret;
 }
 
+static int tg3_writephy(struct tg3 *tp, int reg, u32 val)
+{
+       return __tg3_writephy(tp, tp->phy_addr, reg, val);
+}
+
 static int tg3_phy_cl45_write(struct tg3 *tp, u32 devad, u32 addr, u32 val)
 {
        int err;
@@ -1778,6 +1799,11 @@ static int tg3_poll_fw(struct tg3 *tp)
        int i;
        u32 val;
 
+       if (tg3_flag(tp, IS_SSB_CORE)) {
+               /* We don't use firmware. */
+               return 0;
+       }
+
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906) {
                /* Wait up to 20ms for init done. */
                for (i = 0; i < 200; i++) {
@@ -2013,8 +2039,8 @@ static int tg3_phy_init(struct tg3 *tp)
        phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
 
        /* Attach the MAC to the PHY. */
-       phydev = phy_connect(tp->dev, dev_name(&phydev->dev), tg3_adjust_link,
-                            phydev->dev_flags, phydev->interface);
+       phydev = phy_connect(tp->dev, dev_name(&phydev->dev),
+                            tg3_adjust_link, phydev->interface);
        if (IS_ERR(phydev)) {
                dev_err(&tp->pdev->dev, "Could not attach to PHY\n");
                return PTR_ERR(phydev);
@@ -2644,6 +2670,9 @@ out:
                tg3_writephy(tp, MII_TG3_FET_PTEST, 0x12);
        }
 
+       if (tp->pci_chip_rev_id == CHIPREV_ID_5762_A0)
+               tg3_phydsp_write(tp, 0xffb, 0x4000);
+
        tg3_phy_toggle_automdix(tp, 1);
        tg3_phy_set_wirespeed(tp);
        return 0;
@@ -3447,6 +3476,13 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
                tw32_f(offset + CPU_MODE,  CPU_MODE_HALT);
                udelay(10);
        } else {
+               /*
+                * There is only an Rx CPU for the 5750 derivative in the
+                * BCM4785.
+                */
+               if (tg3_flag(tp, IS_SSB_CORE))
+                       return 0;
+
                for (i = 0; i < 10000; i++) {
                        tw32(offset + CPU_STATE, 0xffffffff);
                        tw32(offset + CPU_MODE,  CPU_MODE_HALT);
@@ -3914,8 +3950,9 @@ static int tg3_power_down_prepare(struct tg3 *tp)
        tg3_frob_aux_power(tp, true);
 
        /* Workaround for unstable PLL clock */
-       if ((GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX) ||
-           (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_BX)) {
+       if ((!tg3_flag(tp, IS_SSB_CORE)) &&
+           ((GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_AX) ||
+            (GET_CHIP_REV(tp->pci_chip_rev_id) == CHIPREV_5750_BX))) {
                u32 val = tr32(0x7d00);
 
                val &= ~((1 << 16) | (1 << 4) | (1 << 2) | (1 << 1) | 1);
@@ -4049,6 +4086,7 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)
                        tg3_phydsp_write(tp, MII_TG3_DSP_TAP26, val);
                        /* Fall through */
                case ASIC_REV_5720:
+               case ASIC_REV_5762:
                        if (!tg3_phydsp_read(tp, MII_TG3_DSP_CH34TP2, &val))
                                tg3_phydsp_write(tp, MII_TG3_DSP_CH34TP2, val |
                                                 MII_TG3_DSP_CH34TP2_HIBW01);
@@ -4435,6 +4473,15 @@ relink:
        if (current_link_up == 0 || (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)) {
                tg3_phy_copper_begin(tp);
 
+               if (tg3_flag(tp, ROBOSWITCH)) {
+                       current_link_up = 1;
+                       /* FIXME: when BCM5325 switch is used use 100 MBit/s */
+                       current_speed = SPEED_1000;
+                       current_duplex = DUPLEX_FULL;
+                       tp->link_config.active_speed = current_speed;
+                       tp->link_config.active_duplex = current_duplex;
+               }
+
                tg3_readphy(tp, MII_BMSR, &bmsr);
                if ((!tg3_readphy(tp, MII_BMSR, &bmsr) && (bmsr & BMSR_LSTATUS)) ||
                    (tp->mac_mode & MAC_MODE_PORT_INT_LPBACK))
@@ -4453,6 +4500,26 @@ relink:
        else
                tp->mac_mode |= MAC_MODE_PORT_MODE_GMII;
 
+       /* In order for the 5750 core in BCM4785 chip to work properly
+        * in RGMII mode, the Led Control Register must be set up.
+        */
+       if (tg3_flag(tp, RGMII_MODE)) {
+               u32 led_ctrl = tr32(MAC_LED_CTRL);
+               led_ctrl &= ~(LED_CTRL_1000MBPS_ON | LED_CTRL_100MBPS_ON);
+
+               if (tp->link_config.active_speed == SPEED_10)
+                       led_ctrl |= LED_CTRL_LNKLED_OVERRIDE;
+               else if (tp->link_config.active_speed == SPEED_100)
+                       led_ctrl |= (LED_CTRL_LNKLED_OVERRIDE |
+                                    LED_CTRL_100MBPS_ON);
+               else if (tp->link_config.active_speed == SPEED_1000)
+                       led_ctrl |= (LED_CTRL_LNKLED_OVERRIDE |
+                                    LED_CTRL_1000MBPS_ON);
+
+               tw32(MAC_LED_CTRL, led_ctrl);
+               udelay(40);
+       }
+
        tp->mac_mode &= ~MAC_MODE_HALF_DUPLEX;
        if (tp->link_config.active_duplex == DUPLEX_HALF)
                tp->mac_mode |= MAC_MODE_HALF_DUPLEX;
@@ -5496,7 +5563,8 @@ static int tg3_setup_phy(struct tg3 *tp, int force_reset)
 
        val = (2 << TX_LENGTHS_IPG_CRS_SHIFT) |
              (6 << TX_LENGTHS_IPG_SHIFT);
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                val |= tr32(MAC_TX_LENGTHS) &
                       (TX_LENGTHS_JMB_FRM_LEN_MSK |
                        TX_LENGTHS_CNT_DWN_VAL_MSK);
@@ -5785,10 +5853,8 @@ static void tg3_dump_state(struct tg3 *tp)
        u32 *regs;
 
        regs = kzalloc(TG3_REG_BLK_SIZE, GFP_ATOMIC);
-       if (!regs) {
-               netdev_err(tp->dev, "Failed allocating register dump buffer\n");
+       if (!regs)
                return;
-       }
 
        if (tg3_flag(tp, PCI_EXPRESS)) {
                /* Read up to but not including private PCI registers */
@@ -8431,6 +8497,16 @@ static int tg3_chip_reset(struct tg3 *tp)
                tw32(0x5000, 0x400);
        }
 
+       if (tg3_flag(tp, IS_SSB_CORE)) {
+               /*
+                * BCM4785: In order to avoid repercussions from using
+                * potentially defective internal ROM, stop the Rx RISC CPU,
+                * which is not required.
+                */
+               tg3_stop_fw(tp);
+               tg3_halt_cpu(tp, RX_CPU_BASE);
+       }
+
        tw32(GRC_MODE, tp->grc_mode);
 
        if (tp->pci_chip_rev_id == CHIPREV_ID_5705_A0) {
@@ -8687,7 +8763,8 @@ static void tg3_rings_reset(struct tg3 *tp)
                limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 16;
        else if (tg3_flag(tp, 5717_PLUS))
                limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 4;
-       else if (tg3_flag(tp, 57765_CLASS))
+       else if (tg3_flag(tp, 57765_CLASS) ||
+                GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE * 2;
        else
                limit = NIC_SRAM_SEND_RCB + TG3_BDINFO_SIZE;
@@ -8704,6 +8781,7 @@ static void tg3_rings_reset(struct tg3 *tp)
        else if (!tg3_flag(tp, 5705_PLUS))
                limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE * 16;
        else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
+                GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762 ||
                 tg3_flag(tp, 57765_CLASS))
                limit = NIC_SRAM_RCV_RET_RCB + TG3_BDINFO_SIZE * 4;
        else
@@ -8994,9 +9072,12 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
 
        /* Enable MAC control of LPI */
        if (tp->phy_flags & TG3_PHYFLG_EEE_CAP) {
-               tw32_f(TG3_CPMU_EEE_LNKIDL_CTRL,
-                      TG3_CPMU_EEE_LNKIDL_PCIE_NL0 |
-                      TG3_CPMU_EEE_LNKIDL_UART_IDL);
+               val = TG3_CPMU_EEE_LNKIDL_PCIE_NL0 |
+                     TG3_CPMU_EEE_LNKIDL_UART_IDL;
+               if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0)
+                       val |= TG3_CPMU_EEE_LNKIDL_APE_TX_MT;
+
+               tw32_f(TG3_CPMU_EEE_LNKIDL_CTRL, val);
 
                tw32_f(TG3_CPMU_EEE_CTRL,
                       TG3_CPMU_EEE_CTRL_EXIT_20_1_US);
@@ -9099,7 +9180,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                }
 
                if (GET_CHIP_REV(tp->pci_chip_rev_id) != CHIPREV_57765_AX) {
-                       u32 grc_mode = tr32(GRC_MODE);
+                       u32 grc_mode;
+
+                       /* Fix transmit hangs */
+                       val = tr32(TG3_CPMU_PADRNG_CTL);
+                       val |= TG3_CPMU_PADRNG_CTL_RDIV2;
+                       tw32(TG3_CPMU_PADRNG_CTL, val);
+
+                       grc_mode = tr32(GRC_MODE);
 
                        /* Access the lower 1K of DL PCIE block registers. */
                        val = grc_mode & ~GRC_MODE_PCIE_PORT_MASK;
@@ -9171,7 +9259,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                if (tp->pci_chip_rev_id == CHIPREV_ID_57765_A0)
                        val &= ~DMA_RWCTRL_CRDRDR_RDMA_MRRS_MSK;
                if (!tg3_flag(tp, 57765_CLASS) &&
-                   GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717)
+                   GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5717 &&
+                   GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
                        val |= DMA_RWCTRL_TAGGED_STAT_WA;
                tw32(TG3PCI_DMA_RW_CTRL, val | tp->dma_rwctrl);
        } else if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5784 &&
@@ -9323,7 +9412,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                        tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_MAXLEN_FLAGS,
                             val | BDINFO_FLAGS_USE_EXT_RECV);
                        if (!tg3_flag(tp, USE_JUMBO_BDFLAG) ||
-                           tg3_flag(tp, 57765_CLASS))
+                           tg3_flag(tp, 57765_CLASS) ||
+                           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                                tw32(RCVDBDI_JUMBO_BD + TG3_BDINFO_NIC_ADDR,
                                     NIC_SRAM_RX_JUMBO_BUFFER_DESC);
                } else {
@@ -9365,7 +9455,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
              (6 << TX_LENGTHS_IPG_SHIFT) |
              (32 << TX_LENGTHS_SLOT_TIME_SHIFT);
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                val |= tr32(MAC_TX_LENGTHS) &
                       (TX_LENGTHS_JMB_FRM_LEN_MSK |
                        TX_LENGTHS_CNT_DWN_VAL_MSK);
@@ -9409,6 +9500,14 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
        if (tg3_flag(tp, PCI_EXPRESS))
                rdmac_mode |= RDMAC_MODE_FIFO_LONG_BURST;
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766) {
+               tp->dma_limit = 0;
+               if (tp->dev->mtu <= ETH_DATA_LEN) {
+                       rdmac_mode |= RDMAC_MODE_JMB_2K_MMRR;
+                       tp->dma_limit = TG3_TX_BD_DMA_MAX_2K;
+               }
+       }
+
        if (tg3_flag(tp, HW_TSO_1) ||
            tg3_flag(tp, HW_TSO_2) ||
            tg3_flag(tp, HW_TSO_3))
@@ -9419,7 +9518,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780)
                rdmac_mode |= RDMAC_MODE_IPV6_LSO_EN;
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                rdmac_mode |= tr32(RDMAC_MODE) & RDMAC_MODE_H2BNC_VLAN_DET;
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5761 ||
@@ -9427,8 +9527,16 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5785 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 ||
            tg3_flag(tp, 57765_PLUS)) {
-               val = tr32(TG3_RDMA_RSRVCTRL_REG);
-               if (tp->pci_chip_rev_id == CHIPREV_ID_5719_A0) {
+               u32 tgtreg;
+
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
+                       tgtreg = TG3_RDMA_RSRVCTRL_REG2;
+               else
+                       tgtreg = TG3_RDMA_RSRVCTRL_REG;
+
+               val = tr32(tgtreg);
+               if (tp->pci_chip_rev_id == CHIPREV_ID_5719_A0 ||
+                   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762) {
                        val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |
                                 TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK |
                                 TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK);
@@ -9436,14 +9544,21 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
                               TG3_RDMA_RSRVCTRL_FIFO_LWM_1_5K |
                               TG3_RDMA_RSRVCTRL_FIFO_HWM_1_5K;
                }
-               tw32(TG3_RDMA_RSRVCTRL_REG,
-                    val | TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX);
+               tw32(tgtreg, val | TG3_RDMA_RSRVCTRL_FIFO_OFLW_FIX);
        }
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
-               val = tr32(TG3_LSO_RD_DMA_CRPTEN_CTRL);
-               tw32(TG3_LSO_RD_DMA_CRPTEN_CTRL, val |
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762) {
+               u32 tgtreg;
+
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
+                       tgtreg = TG3_LSO_RD_DMA_CRPTEN_CTRL2;
+               else
+                       tgtreg = TG3_LSO_RD_DMA_CRPTEN_CTRL;
+
+               val = tr32(tgtreg);
+               tw32(tgtreg, val |
                     TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_BD_4K |
                     TG3_LSO_RD_DMA_CRPTEN_CTRL_BLEN_LSO_4K);
        }
@@ -9676,7 +9791,8 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5906)
                tp->tx_mode |= TX_MODE_MBUF_LOCKUP_FIX;
 
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762) {
                val = TX_MODE_JMB_FRM_LEN | TX_MODE_CNT_DN_MODE;
                tp->tx_mode &= ~val;
                tp->tx_mode |= tr32(MAC_TX_MODE) & val;
@@ -10064,6 +10180,11 @@ static void tg3_timer(unsigned long __opaque)
            tg3_flag(tp, 57765_CLASS))
                tg3_chk_missed_msi(tp);
 
+       if (tg3_flag(tp, FLUSH_POSTED_WRITES)) {
+               /* BCM4785: Flush posted writes from GbE to host memory. */
+               tr32(HOSTCC_MODE);
+       }
+
        if (!tg3_flag(tp, TAGGED_STATUS)) {
                /* All of this garbage is because when using non-tagged
                 * IRQ status the mailbox/status_block protocol the chip
@@ -12357,7 +12478,8 @@ static int tg3_test_memory(struct tg3 *tp)
 
        if (tg3_flag(tp, 5717_PLUS))
                mem_tbl = mem_tbl_5717;
-       else if (tg3_flag(tp, 57765_CLASS))
+       else if (tg3_flag(tp, 57765_CLASS) ||
+                GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                mem_tbl = mem_tbl_57765;
        else if (tg3_flag(tp, 5755_PLUS))
                mem_tbl = mem_tbl_5755;
@@ -12937,7 +13059,8 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        return -EAGAIN;
 
                spin_lock_bh(&tp->lock);
-               err = tg3_readphy(tp, data->reg_num & 0x1f, &mii_regval);
+               err = __tg3_readphy(tp, data->phy_id & 0x1f,
+                                   data->reg_num & 0x1f, &mii_regval);
                spin_unlock_bh(&tp->lock);
 
                data->val_out = mii_regval;
@@ -12953,7 +13076,8 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                        return -EAGAIN;
 
                spin_lock_bh(&tp->lock);
-               err = tg3_writephy(tp, data->reg_num & 0x1f, data->val_in);
+               err = __tg3_writephy(tp, data->phy_id & 0x1f,
+                                    data->reg_num & 0x1f, data->val_in);
                spin_unlock_bh(&tp->lock);
 
                return err;
@@ -13698,6 +13822,22 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
        nvcfg1 = tr32(NVRAM_CFG1);
        nvmpinstrp = nvcfg1 & NVRAM_CFG1_5752VENDOR_MASK;
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762) {
+               if (!(nvcfg1 & NVRAM_CFG1_5762VENDOR_MASK)) {
+                       tg3_flag_set(tp, NO_NVRAM);
+                       return;
+               }
+
+               switch (nvmpinstrp) {
+               case FLASH_5762_EEPROM_HD:
+                       nvmpinstrp = FLASH_5720_EEPROM_HD;
+                       break;
+               case FLASH_5762_EEPROM_LD:
+                       nvmpinstrp = FLASH_5720_EEPROM_LD;
+                       break;
+               }
+       }
+
        switch (nvmpinstrp) {
        case FLASH_5720_EEPROM_HD:
        case FLASH_5720_EEPROM_LD:
@@ -13743,7 +13883,8 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
                        tp->nvram_size = TG3_NVRAM_SIZE_1MB;
                        break;
                default:
-                       tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+                       if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
+                               tp->nvram_size = TG3_NVRAM_SIZE_128KB;
                        break;
                }
                break;
@@ -13789,7 +13930,8 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
                        tp->nvram_size = TG3_NVRAM_SIZE_1MB;
                        break;
                default:
-                       tp->nvram_size = TG3_NVRAM_SIZE_128KB;
+                       if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
+                               tp->nvram_size = TG3_NVRAM_SIZE_128KB;
                        break;
                }
                break;
@@ -13801,11 +13943,30 @@ static void tg3_get_5720_nvram_info(struct tg3 *tp)
        tg3_nvram_get_pagesize(tp, nvcfg1);
        if (tp->nvram_pagesize != 264 && tp->nvram_pagesize != 528)
                tg3_flag_set(tp, NO_NVRAM_ADDR_TRANS);
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762) {
+               u32 val;
+
+               if (tg3_nvram_read(tp, 0, &val))
+                       return;
+
+               if (val != TG3_EEPROM_MAGIC &&
+                   (val & TG3_EEPROM_MAGIC_FW_MSK) != TG3_EEPROM_MAGIC_FW)
+                       tg3_flag_set(tp, NO_NVRAM);
+       }
 }
 
 /* Chips other than 5700/5701 use the NVRAM for fetching info. */
 static void tg3_nvram_init(struct tg3 *tp)
 {
+       if (tg3_flag(tp, IS_SSB_CORE)) {
+               /* No NVRAM and EEPROM on the SSB Broadcom GigE core. */
+               tg3_flag_clear(tp, NVRAM);
+               tg3_flag_clear(tp, NVRAM_BUFFERED);
+               tg3_flag_set(tp, NO_NVRAM);
+               return;
+       }
+
        tw32_f(GRC_EEPROM_ADDR,
             (EEPROM_ADDR_FSM_RESET |
              (EEPROM_DEFAULT_CLOCK_PERIOD <<
@@ -13850,7 +14011,8 @@ static void tg3_nvram_init(struct tg3 *tp)
                else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
                         GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719)
                        tg3_get_5717_nvram_info(tp);
-               else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+               else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+                        GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                        tg3_get_5720_nvram_info(tp);
                else
                        tg3_get_nvram_info(tp);
@@ -14152,6 +14314,39 @@ done:
                device_set_wakeup_capable(&tp->pdev->dev, false);
 }
 
+static int tg3_ape_otp_read(struct tg3 *tp, u32 offset, u32 *val)
+{
+       int i, err;
+       u32 val2, off = offset * 8;
+
+       err = tg3_nvram_lock(tp);
+       if (err)
+               return err;
+
+       tg3_ape_write32(tp, TG3_APE_OTP_ADDR, off | APE_OTP_ADDR_CPU_ENABLE);
+       tg3_ape_write32(tp, TG3_APE_OTP_CTRL, APE_OTP_CTRL_PROG_EN |
+                       APE_OTP_CTRL_CMD_RD | APE_OTP_CTRL_START);
+       tg3_ape_read32(tp, TG3_APE_OTP_CTRL);
+       udelay(10);
+
+       for (i = 0; i < 100; i++) {
+               val2 = tg3_ape_read32(tp, TG3_APE_OTP_STATUS);
+               if (val2 & APE_OTP_STATUS_CMD_DONE) {
+                       *val = tg3_ape_read32(tp, TG3_APE_OTP_RD_DATA);
+                       break;
+               }
+               udelay(10);
+       }
+
+       tg3_ape_write32(tp, TG3_APE_OTP_CTRL, 0);
+
+       tg3_nvram_unlock(tp);
+       if (val2 & APE_OTP_STATUS_CMD_DONE)
+               return 0;
+
+       return -EBUSY;
+}
+
 static int tg3_issue_otp_command(struct tg3 *tp, u32 cmd)
 {
        int i;
@@ -14298,10 +14493,19 @@ static int tg3_phy_probe(struct tg3 *tp)
                         * subsys device table.
                         */
                        p = tg3_lookup_by_subsys(tp);
-                       if (!p)
+                       if (p) {
+                               tp->phy_id = p->phy_id;
+                       } else if (!tg3_flag(tp, IS_SSB_CORE)) {
+                               /* For now we saw the IDs 0xbc050cd0,
+                                * 0xbc050f80 and 0xbc050c30 on devices
+                                * connected to an BCM4785 and there are
+                                * probably more. Just assume that the phy is
+                                * supported when it is connected to a SSB core
+                                * for now.
+                                */
                                return -ENODEV;
+                       }
 
-                       tp->phy_id = p->phy_id;
                        if (!tp->phy_id ||
                            tp->phy_id == TG3_PHY_ID_BCM8002)
                                tp->phy_flags |= TG3_PHYFLG_PHY_SERDES;
@@ -14311,7 +14515,8 @@ static int tg3_phy_probe(struct tg3 *tp)
        if (!(tp->phy_flags & TG3_PHYFLG_ANY_SERDES) &&
            (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
             GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
-            (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 &&
+            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762 ||
+            (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 &&
              tp->pci_chip_rev_id != CHIPREV_ID_5717_A0) ||
             (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57765 &&
              tp->pci_chip_rev_id != CHIPREV_ID_57765_A0)))
@@ -14691,6 +14896,8 @@ static void tg3_read_dash_ver(struct tg3 *tp)
 
        if (tg3_flag(tp, APE_HAS_NCSI))
                fwtype = "NCSI";
+       else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725)
+               fwtype = "SMASH";
        else
                fwtype = "DASH";
 
@@ -14704,6 +14911,31 @@ static void tg3_read_dash_ver(struct tg3 *tp)
                 (apedata & APE_FW_VERSION_BLDMSK));
 }
 
+static void tg3_read_otp_ver(struct tg3 *tp)
+{
+       u32 val, val2;
+
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) != ASIC_REV_5762)
+               return;
+
+       if (!tg3_ape_otp_read(tp, OTP_ADDRESS_MAGIC0, &val) &&
+           !tg3_ape_otp_read(tp, OTP_ADDRESS_MAGIC0 + 4, &val2) &&
+           TG3_OTP_MAGIC0_VALID(val)) {
+               u64 val64 = (u64) val << 32 | val2;
+               u32 ver = 0;
+               int i, vlen;
+
+               for (i = 0; i < 7; i++) {
+                       if ((val64 & 0xff) == 0)
+                               break;
+                       ver = val64 & 0xff;
+                       val64 >>= 8;
+               }
+               vlen = strlen(tp->fw_ver);
+               snprintf(&tp->fw_ver[vlen], TG3_VER_SIZE - vlen, " .%02d", ver);
+       }
+}
+
 static void tg3_read_fw_ver(struct tg3 *tp)
 {
        u32 val;
@@ -14714,6 +14946,7 @@ static void tg3_read_fw_ver(struct tg3 *tp)
 
        if (tg3_flag(tp, NO_NVRAM)) {
                strcat(tp->fw_ver, "sb");
+               tg3_read_otp_ver(tp);
                return;
        }
 
@@ -14800,7 +15033,10 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg)
                    tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717_C ||
                    tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
                    tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
-                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720)
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 ||
+                   tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727)
                        reg = TG3PCI_GEN2_PRODID_ASICREV;
                else if (tp->pdev->device == TG3PCI_DEVICE_TIGON3_57781 ||
                         tp->pdev->device == TG3PCI_DEVICE_TIGON3_57785 ||
@@ -14837,7 +15073,8 @@ static void tg3_detect_asic_rev(struct tg3 *tp, u32 misc_ctrl_reg)
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57766)
                tg3_flag_set(tp, 57765_CLASS);
 
-       if (tg3_flag(tp, 57765_CLASS) || tg3_flag(tp, 5717_PLUS))
+       if (tg3_flag(tp, 57765_CLASS) || tg3_flag(tp, 5717_PLUS) ||
+            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                tg3_flag_set(tp, 57765_PLUS);
 
        /* Intentionally exclude ASIC_REV_5906 */
@@ -15128,7 +15365,8 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                tg3_flag_set(tp, LRG_PROD_RING_CAP);
 
        if (tg3_flag(tp, 57765_PLUS) &&
@@ -15329,21 +15567,23 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
                                              &val);
                        tp->pci_fn = val & 0x7;
                }
-       } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717) {
-               tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val);
-               if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) ==
-                   NIC_SRAM_CPMUSTAT_SIG) {
-                       tp->pci_fn = val & TG3_CPMU_STATUS_FMSK_5717;
-                       tp->pci_fn = tp->pci_fn ? 1 : 0;
-               }
-       } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
+       } else if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717 ||
+                  GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
                   GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720) {
                tg3_read_mem(tp, NIC_SRAM_CPMU_STATUS, &val);
-               if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) ==
-                   NIC_SRAM_CPMUSTAT_SIG) {
+               if ((val & NIC_SRAM_CPMUSTAT_SIG_MSK) != NIC_SRAM_CPMUSTAT_SIG)
+                       val = tr32(TG3_CPMU_STATUS);
+
+               if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5717)
+                       tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5717) ? 1 : 0;
+               else
                        tp->pci_fn = (val & TG3_CPMU_STATUS_FMSK_5719) >>
                                     TG3_CPMU_STATUS_FSHFT_5719;
-               }
+       }
+
+       if (tg3_flag(tp, FLUSH_POSTED_WRITES)) {
+               tp->write32_tx_mbox = tg3_write_flush_reg32;
+               tp->write32_rx_mbox = tg3_write_flush_reg32;
        }
 
        /* Get eeprom hw config before calling tg3_set_power_state().
@@ -15406,6 +15646,10 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
                                              GRC_LCLCTRL_GPIO_OUTPUT0;
        }
 
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
+               tp->grc_local_ctrl |=
+                       tr32(GRC_LOCAL_CTRL) & GRC_LCLCTRL_GPIO_UART_SEL;
+
        /* Switch out of Vaux if it is a NIC */
        tg3_pwrsrc_switch_to_vmain(tp);
 
@@ -15496,7 +15740,8 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
 
        /* Initialize data/descriptor byte/word swapping. */
        val = tr32(GRC_MODE);
-       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+       if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                val &= (GRC_MODE_BYTE_SWAP_B2HRX_DATA |
                        GRC_MODE_WORD_SWAP_B2HRX_DATA |
                        GRC_MODE_B2HRX_ENABLE |
@@ -15658,7 +15903,6 @@ static int tg3_get_macaddr_sparc(struct tg3 *tp)
        addr = of_get_property(dp, "local-mac-address", &len);
        if (addr && len == 6) {
                memcpy(dev->dev_addr, addr, 6);
-               memcpy(dev->perm_addr, dev->dev_addr, 6);
                return 0;
        }
        return -ENODEV;
@@ -15669,7 +15913,6 @@ static int tg3_get_default_macaddr_sparc(struct tg3 *tp)
        struct net_device *dev = tp->dev;
 
        memcpy(dev->dev_addr, idprom->id_ethaddr, 6);
-       memcpy(dev->perm_addr, idprom->id_ethaddr, 6);
        return 0;
 }
 #endif
@@ -15679,12 +15922,19 @@ static int tg3_get_device_address(struct tg3 *tp)
        struct net_device *dev = tp->dev;
        u32 hi, lo, mac_offset;
        int addr_ok = 0;
+       int err;
 
 #ifdef CONFIG_SPARC
        if (!tg3_get_macaddr_sparc(tp))
                return 0;
 #endif
 
+       if (tg3_flag(tp, IS_SSB_CORE)) {
+               err = ssb_gige_get_macaddr(tp->pdev, &dev->dev_addr[0]);
+               if (!err && is_valid_ether_addr(&dev->dev_addr[0]))
+                       return 0;
+       }
+
        mac_offset = 0x7c;
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704 ||
            tg3_flag(tp, 5780_CLASS)) {
@@ -15746,7 +15996,6 @@ static int tg3_get_device_address(struct tg3 *tp)
 #endif
                return -EINVAL;
        }
-       memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
        return 0;
 }
 
@@ -16045,6 +16294,8 @@ static int tg3_test_dma(struct tg3 *tp)
                        tp->dma_rwctrl |= 0x001b000f;
                }
        }
+       if (tg3_flag(tp, ONE_DMA_AT_ONCE))
+               tp->dma_rwctrl |= DMA_RWCTRL_ONE_DMA;
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5703 ||
            GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5704)
@@ -16253,6 +16504,7 @@ static char *tg3_phy_string(struct tg3 *tp)
        case TG3_PHY_ID_BCM57765:       return "57765";
        case TG3_PHY_ID_BCM5719C:       return "5719C";
        case TG3_PHY_ID_BCM5720C:       return "5720C";
+       case TG3_PHY_ID_BCM5762:        return "5762C";
        case TG3_PHY_ID_BCM8002:        return "8002/serdes";
        case 0:                 return "serdes";
        default:                return "unknown";
@@ -16389,6 +16641,18 @@ static int tg3_init_one(struct pci_dev *pdev,
        else
                tp->msg_enable = TG3_DEF_MSG_ENABLE;
 
+       if (pdev_is_ssb_gige_core(pdev)) {
+               tg3_flag_set(tp, IS_SSB_CORE);
+               if (ssb_gige_must_flush_posted_writes(pdev))
+                       tg3_flag_set(tp, FLUSH_POSTED_WRITES);
+               if (ssb_gige_one_dma_at_once(pdev))
+                       tg3_flag_set(tp, ONE_DMA_AT_ONCE);
+               if (ssb_gige_have_roboswitch(pdev))
+                       tg3_flag_set(tp, ROBOSWITCH);
+               if (ssb_gige_is_rgmii(pdev))
+                       tg3_flag_set(tp, RGMII_MODE);
+       }
+
        /* The word/byte swap controls here control register access byte
         * swapping.  DMA data byte swapping is controlled in the GRC_MODE
         * setting below.
@@ -16429,7 +16693,10 @@ static int tg3_init_one(struct pci_dev *pdev,
            tp->pdev->device == TG3PCI_DEVICE_TIGON3_5717_C ||
            tp->pdev->device == TG3PCI_DEVICE_TIGON3_5718 ||
            tp->pdev->device == TG3PCI_DEVICE_TIGON3_5719 ||
-           tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720) {
+           tp->pdev->device == TG3PCI_DEVICE_TIGON3_5720 ||
+           tp->pdev->device == TG3PCI_DEVICE_TIGON3_5762 ||
+           tp->pdev->device == TG3PCI_DEVICE_TIGON3_5725 ||
+           tp->pdev->device == TG3PCI_DEVICE_TIGON3_5727) {
                tg3_flag_set(tp, ENABLE_APE);
                tp->aperegs = pci_ioremap_bar(pdev, BAR_2);
                if (!tp->aperegs) {
@@ -16624,7 +16891,8 @@ static int tg3_init_one(struct pci_dev *pdev,
        pci_set_drvdata(pdev, dev);
 
        if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5719 ||
-           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720)
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5720 ||
+           GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5762)
                tg3_flag_set(tp, PTP_CAPABLE);
 
        if (tg3_flag(tp, 5717_PLUS)) {
@@ -16634,6 +16902,8 @@ static int tg3_init_one(struct pci_dev *pdev,
 
        tg3_timer_init(tp);
 
+       tg3_carrier_off(tp);
+
        err = register_netdev(dev);
        if (err) {
                dev_err(&pdev->dev, "Cannot register net device, aborting\n");