From patchwork Fri Nov 4 05:10:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Mason X-Patchwork-Id: 9411915 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 6AB6060585 for ; Fri, 4 Nov 2016 05:13:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B9D22B06D for ; Fri, 4 Nov 2016 05:13:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8042B087; Fri, 4 Nov 2016 05:13:18 +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 E1BAA2B06D for ; Fri, 4 Nov 2016 05:13:17 +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 1c2Wn7-000676-US; Fri, 04 Nov 2016 05:11:49 +0000 Received: from mail-pf0-x236.google.com ([2607:f8b0:400e:c00::236]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c2Wmr-0005zt-Rv for linux-arm-kernel@lists.infradead.org; Fri, 04 Nov 2016 05:11:34 +0000 Received: by mail-pf0-x236.google.com with SMTP id n85so44661861pfi.1 for ; Thu, 03 Nov 2016 22:11:13 -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=p1sXQCt/cJ5E/YH/skZvplk7ZFIdHZY3j/KzSzK9vXY=; b=Lfmf3ObKl6DXF7IARgQCflJPCm1hVN4HNW8H+W+GJx0ahM3j18vxq852FHYcMBJ63+ iE3IjjsPwsewi646p6qyLdy+zAWrB+yns9g/UOGht876EIqrE4W5hWX2yPA5qgiHeQVj OMWXRl10y9+w7+RluJK0Ax8xovlt+NvtAyEjc= 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=p1sXQCt/cJ5E/YH/skZvplk7ZFIdHZY3j/KzSzK9vXY=; b=fEZFivfJJO91PFN+870PQj3vNYuLzTIaA36jOJPUKTBBLj1rT1VOuVNONoqLfDrh27 Bh8g41csNwbu9u8XI8JAesEyWz4+gi0jFamNpLeoA9V4CscNpdOCFmbeItikJTh0qE7m T0ck5ZGkeqF0bj39+G2lw48Mrjv6T7eKvvnYtyKNOwflc7kFxwPTo0whgebKTopO+WzV LP7RBp6bxAjXvuMNzNVPfSUv4YXGwe4Bl0SVv7XAE67+beT0AcIyYlotQi2+OozjH+Nj h8wH1ZtlwpbbFsAS6t43+tD/mb9WdHmZbT3Af5L5DKDU3mRZBCeKL2ntpWUKQwTsFhQq 0a7g== X-Gm-Message-State: ABUngvcTQJ10fYxDM97R2Saiiz5maX5TY935X6i+v7ZCps7fC067G/ET56sEfpQrRA/2qVgt X-Received: by 10.98.200.203 with SMTP id i72mr23281831pfk.181.1478236272752; Thu, 03 Nov 2016 22:11:12 -0700 (PDT) Received: from venom.rtp.broadcom.com ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id 64sm5028338pfu.17.2016.11.03.22.11.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Nov 2016 22:11:12 -0700 (PDT) From: Jon Mason To: David Miller , Rob Herring , Mark Rutland , Florian Fainelli Subject: [PATCH v6 1/7] net: phy: broadcom: add bcm54xx_auxctl_read Date: Fri, 4 Nov 2016 01:10:56 -0400 Message-Id: <1478236262-3351-2-git-send-email-jon.mason@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478236262-3351-1-git-send-email-jon.mason@broadcom.com> References: <1478236262-3351-1-git-send-email-jon.mason@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161103_221134_064394_91839B61 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