From patchwork Sun Feb 23 16:58:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 3704381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 040CA9F2ED for ; Sun, 23 Feb 2014 16:59:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1B060201C7 for ; Sun, 23 Feb 2014 16:59:28 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1AAB2015D for ; Sun, 23 Feb 2014 16:59:26 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WHcOe-0006jx-FS; Sun, 23 Feb 2014 16:59:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WHcOc-0005Wy-2D; Sun, 23 Feb 2014 16:59:18 +0000 Received: from mail-ea0-x22d.google.com ([2a00:1450:4013:c01::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WHcOY-0005WZ-G1 for linux-arm-kernel@lists.infradead.org; Sun, 23 Feb 2014 16:59:15 +0000 Received: by mail-ea0-f173.google.com with SMTP id n15so1486104ead.4 for ; Sun, 23 Feb 2014 08:58:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Y/O7gnOPdB09PCFgO6GsdNA+r70Gs1fkuhGd/ukRNZg=; b=nfl1W+9JetMevWnBc+YLGFXtG5Bq0DK5X7sq6V1P++8tiEXpIK2KaXRVVhuW1lsNlO vGzjsRa2uRebRznPAx/EaDc7QPjGc6kEtKpWIPorboXiu8tXiYWOSSU8upn6Jk2t3L/w kKtsIjT8G9uABdxxV/bk+R4CzXvxoxqXG1nZn2mwwNAgGoo6p3Vgc0KclhVmqPpWM6Zl 9Ot19sDtplgdC+I/NVL8OR7CP/o2FS5LWauPXbOY4ej7lfUUeVJCgn1uTg0zgE6zjHrS cpubNEYbYOopUPCn5mH5pEZkkdcmIfCJmlPwcBigsW28Z5e8G03NoSnCh33xnsEv+Beu 5/LQ== X-Received: by 10.15.56.8 with SMTP id x8mr19409127eew.83.1393174729060; Sun, 23 Feb 2014 08:58:49 -0800 (PST) Received: from topkick.lan (dslc-082-083-251-183.pools.arcor-ip.net. [82.83.251.183]) by mx.google.com with ESMTPSA id g1sm53095238eet.6.2014.02.23.08.58.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Feb 2014 08:58:48 -0800 (PST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH] net: phy: add suspend_halted module param Date: Sun, 23 Feb 2014 17:58:39 +0100 Message-Id: <1393174719-20806-1-git-send-email-sebastian.hesselbarth@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140223_115914_710928_579515D6 X-CRM114-Status: GOOD ( 12.34 ) X-Spam-Score: -2.0 (--) Cc: Andrew Lunn , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Miller , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP commit 1211ce53077164e0d34641d0ca5fb4d4a7574498 ("net: phy: resume/suspend PHYs on attach/detach") introduced a feature to suspend PHYs when entering halted state. Unfortunately, not all bootloaders properly power-up PHYs on reset and fail to access ethernet because the PHY is still powered down. Therefore, we add a boolean module parameter suspend_halted with default value of true. Disabling that parameter prevents PHYs from being suspended when entering halted state. Signed-off-by: Sebastian Hesselbarth Reported-by: Andrew Lunn Acked-by: Florian Fainelli --- Andrew, can you please re-test if disabling the feature does work on your board? I tried a bunch of mine, but none failed to power-up the PHY in u-boot. Cc: David Miller Cc: Florian Fainelli Cc: Andrew Lunn Cc: netdev@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/phy/phy_device.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 4b03e63639b7..671eea0eb5db 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -40,6 +40,10 @@ MODULE_DESCRIPTION("PHY library"); MODULE_AUTHOR("Andy Fleming"); MODULE_LICENSE("GPL"); +static bool suspend_halted = true; +module_param(suspend_halted, bool, 0644); +MODULE_PARM_DESC(suspend_halted, "Suspend PHYs when entering halted state."); + void phy_device_free(struct phy_device *phydev) { put_device(&phydev->dev); @@ -685,6 +689,12 @@ int phy_suspend(struct phy_device *phydev) struct phy_driver *phydrv = to_phy_driver(phydev->dev.driver); struct ethtool_wolinfo wol; + /* Some bootloaders do not power-up PHYs properly after reset, + * allow to disable the suspend halted PHYs feature. + */ + if (!suspend_halted) + return -ENOSYS; + /* If the device has WOL enabled, we cannot suspend the PHY */ wol.cmd = ETHTOOL_GWOL; phy_ethtool_get_wol(phydev, &wol);