From patchwork Thu Oct 6 22:27:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Collins X-Patchwork-Id: 164279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 90734B6FD7 for ; Tue, 12 Jun 2012 09:05:53 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDgA-0004IU-ET; Mon, 11 Jun 2012 23:05:46 +0000 Received: from mail-pz0-f49.google.com ([209.85.210.49]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1SeDdC-0003hC-Dr for kernel-team@lists.ubuntu.com; Mon, 11 Jun 2012 23:02:42 +0000 Received: by mail-pz0-f49.google.com with SMTP id m1so6348994dad.8 for ; Mon, 11 Jun 2012 16:02:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:in-reply-to:references:from:date:subject:to; bh=b6/RLTCOANDx93tdO3JUHn6AjpY6+hamxY13+rkPo/Q=; b=ObNn7y8qaCppWFApbA55w8/mjFq7PKcKPXX+tlnFEBp0YFjxy7y8HWUSf63Okh/l2D AY2NQg6KNN5LvDbjrrfkLt06YNy4V7QGHQvJAxUfA3HhE/0Bx4bPKZ/x6Asa4/qiYUcz 2P2pmkna2/XfaO6KCy4GpbjVe+uzxP7UtvTKskXRbsQtqEW63MzfjWe0SVDoGu/yvJld 2+RL9XZP6oziu29RYlxh87ek42RTAznU2ntb2TR2Coa04cZafGRh8vdXq8OUSl5bpt67 Z5ca03MAWhWW/qfVsuzu/49XI4LcyYXFKPL7G4sIBnafnvZgw4FI+qw1aLDveQvT4gW2 yoCA== Received: by 10.68.195.102 with SMTP id id6mr31400045pbc.120.1339455761996; Mon, 11 Jun 2012 16:02:41 -0700 (PDT) Received: from localhost (ip68-13-200-36.hr.hr.cox.net. [68.13.200.36]) by mx.google.com with ESMTPS id ob9sm19939866pbb.28.2012.06.11.16.02.39 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 16:02:41 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Mon, 11 Jun 2012 19:02:37 -0400 Message-Id: In-Reply-To: References: From: Madalin Bucur Date: Thu, 6 Oct 2011 22:27:25 +0000 Subject: [PATCH 20/27] UBUNTU: SAUCE: net/phy: avoid reaching an unsupported speed and duplex combination To: kernel-team@lists.ubuntu.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com - phy_force_reduction() may get the interface into a speed and duplex combination that is not supported by the device; - wait PHY_FORCE_TIMEOUT before each speed/duplex reduction in forced mode This patch is being maintained and will eventually be merged upstream by Freescale directly. The powerpc-e500mc flavour uses this. Signed-off-by: Madalin Bucur Signed-off-by: Ben Collins --- drivers/net/phy/phy.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 2c16be0..0825a78 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -6,7 +6,7 @@ * * Author: Andy Fleming * - * Copyright (c) 2004 Freescale Semiconductor, Inc. + * Copyright (c) 2004,2011 Freescale Semiconductor, Inc. * Copyright (c) 2006, 2007 Maciej W. Rozycki * * This program is free software; you can redistribute it and/or modify it @@ -479,6 +479,10 @@ static void phy_force_reduction(struct phy_device *phydev) idx = phy_find_valid(idx, phydev->supported); + /* Avoid reaching an invalid speed and duplex combination */ + if (!(settings[idx].setting & phydev->supported)) + return; + phydev->speed = settings[idx].speed; phydev->duplex = settings[idx].duplex; @@ -869,6 +873,8 @@ void phy_state_machine(struct work_struct *work) if (0 == phydev->link_timeout--) { phy_force_reduction(phydev); needs_aneg = 1; + phydev->link_timeout = + PHY_FORCE_TIMEOUT; } }