From patchwork Wed Nov 2 17:08:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Mason X-Patchwork-Id: 9409573 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 223166022E for ; Wed, 2 Nov 2016 17:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E33F2A499 for ; Wed, 2 Nov 2016 17:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 031862A4A7; Wed, 2 Nov 2016 17:11:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B24AE2A499 for ; Wed, 2 Nov 2016 17:11:01 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1z2Z-0000Qd-B8; Wed, 02 Nov 2016 17:09:31 +0000 Received: from mail-pf0-x229.google.com ([2607:f8b0:400e:c00::229]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c1z2G-0000IS-7g for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2016 17:09:13 +0000 Received: by mail-pf0-x229.google.com with SMTP id n85so15090660pfi.1 for ; Wed, 02 Nov 2016 10:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B6nJChFVtEyYZpvj7BByAVb8GzbUTsEAGIWSl7rLQ7Y=; b=KajXJfpxTePTf7jCKlKt/rA5But/dSP5JfBKk5YtsjMedRyl713Z3Pkn0fVNRwL87N 13vZSqtb8KGykQYr15dutb//8V5kAY1js04vV8KtLW53dwUqN8tZKSXIV1ZmgIGsOLRJ jhneAN36jztY0Y3wzjCV1Y0g6adDbhTILZ6rA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B6nJChFVtEyYZpvj7BByAVb8GzbUTsEAGIWSl7rLQ7Y=; b=N6gzfnUc+FwYEZS5IrTHJ9+wsfYUT+taVasEAz9hWardWoTR6kE+BTiBzNkGvBbVzN QG0n2ez3R0StfTfAY+9b4+GlRkhmf+0Q6eAI1OClAPm38JDu0XZnqDcCwyHpWAT5Vqn9 ZmSYqM/ElUD2Z+c652zEoIbObYdO/L5ERDS5fU0ECAzm8EB6GlrnPPZIFi4LQhcLQaPd 7YdX5jPwtiVvrQ6VCqYLYSv3hJOBv1npYC/iA/5a6QrrIZaRhsPvdkhuhJXzCmdzC91n VevkAeYWIO6olkMzZRqhD9Ii6tJ8seWeO+tLuMQNe0ApqbFhoVw6x6Tx8WZGRZORMoIU tUAw== X-Gm-Message-State: ABUngvdxbB6qq/hq/4PKqr9N4NwTu2UGK/jQb56TJT76Tils75mnBzKlvquu0AaTCEuJjSeR X-Received: by 10.98.81.129 with SMTP id f123mr8745912pfb.36.1478106531205; Wed, 02 Nov 2016 10:08:51 -0700 (PDT) Received: from venom.rtp.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id 4sm6090726pfg.66.2016.11.02.10.08.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Nov 2016 10:08:50 -0700 (PDT) From: Jon Mason To: David Miller , Rob Herring , Mark Rutland , Florian Fainelli Subject: [PATCH v5 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Date: Wed, 2 Nov 2016 13:08:02 -0400 Message-Id: <1478106488-11779-2-git-send-email-jon.mason@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478106488-11779-1-git-send-email-jon.mason@broadcom.com> References: <1478106488-11779-1-git-send-email-jon.mason@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161102_100912_376416_580C3F95 X-CRM114-Status: GOOD ( 12.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, rafal@milecki.pl, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add a helper function to read the AUXCTL register for the BCM54xx. This mirrors the bcm54xx_auxctl_write function already present in the code. Signed-off-by: Jon Mason Reviewed-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 10 ++++++++++ include/linux/brcmphy.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 583ef8a..3a64b3d 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -30,6 +30,16 @@ MODULE_DESCRIPTION("Broadcom PHY driver"); MODULE_AUTHOR("Maciej W. Rozycki"); MODULE_LICENSE("GPL"); +static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum) +{ + /* The register must be written to both the Shadow Register Select and + * the Shadow Read Register Selector + */ + phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | + regnum << MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT); + return phy_read(phydev, MII_BCM54XX_AUX_CTL); +} + static int bcm54xx_auxctl_write(struct phy_device *phydev, u16 regnum, u16 val) { return phy_write(phydev, MII_BCM54XX_AUX_CTL, regnum | val); diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 60def78..0ed6691 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -110,6 +110,7 @@ #define MII_BCM54XX_AUXCTL_MISC_FORCE_AMDIX 0x0200 #define MII_BCM54XX_AUXCTL_MISC_RDSEL_MISC 0x7000 #define MII_BCM54XX_AUXCTL_SHDWSEL_MISC 0x0007 +#define MII_BCM54XX_AUXCTL_SHDWSEL_READ_SHIFT 12 #define MII_BCM54XX_AUXCTL_SHDWSEL_MASK 0x0007