From patchwork Mon Jun 30 01:35:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vince Bridgers X-Patchwork-Id: 365475 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0E17F1400D4 for ; Mon, 30 Jun 2014 11:39:35 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbaF3Bja (ORCPT ); Sun, 29 Jun 2014 21:39:30 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:41397 "EHLO mail-ob0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753857AbaF3BjT (ORCPT ); Sun, 29 Jun 2014 21:39:19 -0400 Received: by mail-ob0-f177.google.com with SMTP id uy5so7795624obc.22 for ; Sun, 29 Jun 2014 18:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7ZKhkYJt8/FEPb3GOkxR/tsiUka6jcCu4pa9FANizj8=; b=cJsAYx/Ppl/dTherYwVWfQSk1tkchlde4OX4TfgtTVTrpM2fZ5YPzry0/DzsGYd6tc sInEP/TGsf0NKxkWzP7BWb29f824hDY11si/et43y15gmm3/uwCWPo7O3Pv4/Wqh7rgi r6uZRTEewvqGE0MQ/ssHqKE9Br+vPegD3EE+HSQMi7lLc9XVcXIcvewE+wpBsqUM5yBX OsxPeAQwes9ikMu0lU5Ll3l7AXnWfNRr4vEu+n4QqpLGOohvTuJHPQZgEsr/NDOX3aP9 NxnPOz9+Zr+yLx3G42aIZuW4ODO1qiJXvLpdHkr++ZIck44hReewAix8SZ77k2gE42GS o4ig== X-Received: by 10.182.112.134 with SMTP id iq6mr37839432obb.34.1404092358811; Sun, 29 Jun 2014 18:39:18 -0700 (PDT) Received: from vince-Latitude-E6320.gateway.2wire.net (99-61-67-66.lightspeed.austtx.sbcglobal.net. [99.61.67.66]) by mx.google.com with ESMTPSA id db13sm65695421oec.15.2014.06.29.18.39.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Jun 2014 18:39:18 -0700 (PDT) From: Vince Bridgers To: f.fainelli@gmail.com, rdunlap@infradead.org, davem@davemloft.net, netdev@vger.kernel.org Cc: vbridgers2013@gmail.com, vbridger@altera.com Subject: [PATCH net v4 2/3] net: libphy: Add stubs to hook IEEE MMD Register reads and writes Date: Sun, 29 Jun 2014 20:35:23 -0500 Message-Id: <1404092124-18704-3-git-send-email-vbridgers2013@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404092124-18704-1-git-send-email-vbridgers2013@gmail.com> References: <1404092124-18704-1-git-send-email-vbridgers2013@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The Micrel ksz9021 PHY does not support standard IEEE standard MMD extended register access, therefore requires stubs to fail the read register method and do nothing for the write register method when libphy attempts to read and/or configure Energy Efficient Ethernet features in PHYS that do support those features. This problem was observed on an Altera Cyclone V SOC development kit that uses the Synopsys EMAC and the Micrel ksz9021 PHY. This patch was tested on the same board, and Energy Efficient Ethernet is now disabled as expected since the Micrel PHY does not support that feature. Signed-off-by: Vince Bridgers Reviewed-by: Florian Fainelli --- V4: Correct error when editing for V3 V3: Remove unnecessary returns from void functions. V2: Split libphy and Micrel specific changes into 2 patches based on review comments --- drivers/net/phy/micrel.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index bc7c7d2..40ff138 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -420,6 +420,26 @@ static int ksz8873mll_config_aneg(struct phy_device *phydev) return 0; } +/* This routine returns -1 as an indication to the caller that the + * Micrel ksz9021 10/100/1000 PHY does not support standard IEEE + * MMD extended PHY registers. + */ +static int +ksz9021_rd_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum, + int regnum) +{ + return -1; +} + +/* This routine does nothing since the Micrel ksz9021 does not support + * standard IEEE MMD extended PHY registers. + */ +static void +ksz9021_wr_mmd_phyreg(struct phy_device *phydev, int ptrad, int devnum, + int regnum, u32 val) +{ +} + static struct phy_driver ksphy_driver[] = { { .phy_id = PHY_ID_KS8737, @@ -565,6 +585,8 @@ static struct phy_driver ksphy_driver[] = { .config_intr = ksz9021_config_intr, .suspend = genphy_suspend, .resume = genphy_resume, + .rd_mmd_indirect = ksz9021_rd_mmd_phyreg, + .wr_mmd_indirect = ksz9021_wr_mmd_phyreg, .driver = { .owner = THIS_MODULE, }, }, { .phy_id = PHY_ID_KSZ9031,