Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44f3b503 authored by Nithin Sujir's avatar Nithin Sujir Committed by David S. Miller
Browse files

tg3: Skip powering down function 0 on certain serdes devices



On the 5718, 5719 and 5720 serdes devices, powering down function 0
results in all the other ports being powered down. Add code to skip
function 0 power down.

v2:
 - Modify tg3_phy_power_bug() function to use a switch instead of a
   complicated if statement. Suggested by Joe Perches.

Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarMichael Chan <mchan@broadcom.com>
Signed-off-by: default avatarNithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dbbffe68
Loading
Loading
Loading
Loading
+26 −6
Original line number Original line Diff line number Diff line
@@ -2957,6 +2957,31 @@ static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
	return 0;
	return 0;
}
}


static bool tg3_phy_power_bug(struct tg3 *tp)
{
	switch (tg3_asic_rev(tp)) {
	case ASIC_REV_5700:
	case ASIC_REV_5704:
		return true;
	case ASIC_REV_5780:
		if (tp->phy_flags & TG3_PHYFLG_MII_SERDES)
			return true;
		return false;
	case ASIC_REV_5717:
		if (!tp->pci_fn)
			return true;
		return false;
	case ASIC_REV_5719:
	case ASIC_REV_5720:
		if ((tp->phy_flags & TG3_PHYFLG_PHY_SERDES) &&
		    !tp->pci_fn)
			return true;
		return false;
	}

	return false;
}

static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
{
{
	u32 val;
	u32 val;
@@ -3016,12 +3041,7 @@ static void tg3_power_down_phy(struct tg3 *tp, bool do_low_power)
	/* The PHY should not be powered down on some chips because
	/* The PHY should not be powered down on some chips because
	 * of bugs.
	 * of bugs.
	 */
	 */
	if (tg3_asic_rev(tp) == ASIC_REV_5700 ||
	if (tg3_phy_power_bug(tp))
	    tg3_asic_rev(tp) == ASIC_REV_5704 ||
	    (tg3_asic_rev(tp) == ASIC_REV_5780 &&
	     (tp->phy_flags & TG3_PHYFLG_MII_SERDES)) ||
	    (tg3_asic_rev(tp) == ASIC_REV_5717 &&
	     !tp->pci_fn))
		return;
		return;


	if (tg3_chip_rev(tp) == CHIPREV_5784_AX ||
	if (tg3_chip_rev(tp) == CHIPREV_5784_AX ||