Patchwork [v2,net,1/2] tg3: Skip powering down function 0 on certain serdes devices

login
register
mail settings
Submitter Nithin Sujir
Date May 13, 2013, 9:04 p.m.
Message ID <1368479056-11780-2-git-send-email-nsujir@broadcom.com>
Download mbox | patch
Permalink /patch/243539/
State Accepted
Delegated to: David Miller
Headers show

Comments

Nithin Sujir - May 13, 2013, 9:04 p.m.
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: Michael Chan <mchan@broadcom.com>
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)
Joe Perches - May 14, 2013, 6:08 p.m.
On Mon, 2013-05-13 at 14:04 -0700, Nithin Nayak Sujir wrote:
> 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.

Hi Nithin.  5718?  I'm confused a bit by the commit message.

> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
[]
> +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;
> +	}
> +

Where is the 5718 in this?
What is the 5718?
There is no #define for it.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nithin Sujir - May 14, 2013, 6:17 p.m.
On 05/14/2013 11:08 AM, Joe Perches wrote:
> On Mon, 2013-05-13 at 14:04 -0700, Nithin Nayak Sujir wrote:
>> 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.
>
> Hi Nithin.  5718?  I'm confused a bit by the commit message.
>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> []
>> +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;
>> +	}
>> +
>
> Where is the 5718 in this?
> What is the 5718?
> There is no #define for it.
>

The 5718 is another device in the same family as the 5719 and 5720. There is no 
case or define for the ASIC_REV because it has the same asic revision as the 5719.

However, it is a separate device and you can find it in the pci table and in the 
code as TG3PCI_DEVICE_TIGON3_5718.


>
>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 728d42a..781be76 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -2957,6 +2957,31 @@  static int tg3_5700_link_polarity(struct tg3 *tp, u32 speed)
 	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)
 {
 	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
 	 * of bugs.
 	 */
-	if (tg3_asic_rev(tp) == ASIC_REV_5700 ||
-	    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))
+	if (tg3_phy_power_bug(tp))
 		return;
 
 	if (tg3_chip_rev(tp) == CHIPREV_5784_AX ||