From patchwork Fri Jun 29 15:35:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140613 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp993562ljj; Fri, 29 Jun 2018 08:36:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqJNbKul2mxDmsOU/mUjKA0UzVHXvTT7xPK8QWpUwKRWm55HmR1a8B7tbWgtACWxC/hxnq X-Received: by 2002:a17:902:8f86:: with SMTP id z6-v6mr10896584plo.38.1530286587088; Fri, 29 Jun 2018 08:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530286587; cv=none; d=google.com; s=arc-20160816; b=RDgI3m7g4ZqwMZvYXBHyq//SW/+QmjraqwUp4oX+JkRV/zpJx/CJBzWl3kzD8XsM6G EocZo26G8pF1oNGfLbcp+QF2VTgll/qkfBrxzXD+n9Dg5GyobPPfSJNNqtDj5XZSPYJ4 zIspdAi0MsOztsPaS1rzxEb8qT0OItZ+F9bqK5NYBwHIK2AFvoVpODnWX3u6mUEXUViX YsCW1NqNZbfCSuWFITtBrKSo7P3nHhkBeBFCJxFlKqXS9HFmPu7rNaCweuMkbHJWP2Yw OVCODHbaD0ri6Ax9J3ntD3SgOkziu8ox31ODYLZQuvbr436Q9HVh8Iya3DEYJUmh93kf Uf4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=RPhTbVnvi256NBldU8FbitfughbHmZpBL5A4omRqQ8M=; b=Wsly079FUTM61dFfIrr1u/CtqnezYrO2ODraCbpbiKMJHBp6jgc8ZmVu3sFXQARStf Fy78qwVNXkZzGqmOAatm8fN/j4YL7B7so4MlIZUlxUGYrWmpf4dU8zNXPKuisobIVyZN HUpQ8bCAgv/elvBzHRN1xMchNwP7IA+tZTdMkYduSAjsnV2HPaSPAgmwXe/gHzzrHQ/x p33w36uobBN3z2er0A930+z9bTchHgC7OsXQzLLGuM+HPKAZ3A4EGhFMMrI2V/pN1T0C Y7xhjC3o3yi99IUMvc+QLNXJLw1/IknRdUq4jN8tUTNAYG+UzUKSTVCU3/ISHBOU/EeI dLjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JgNq3J9o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12-v6si9232285pls.311.2018.06.29.08.36.26; Fri, 29 Jun 2018 08:36:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JgNq3J9o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966028AbeF2PgI (ORCPT + 31 others); Fri, 29 Jun 2018 11:36:08 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:43136 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752225AbeF2PgG (ORCPT ); Fri, 29 Jun 2018 11:36:06 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w5TFZwHa114884; Fri, 29 Jun 2018 10:35:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530286558; bh=RPhTbVnvi256NBldU8FbitfughbHmZpBL5A4omRqQ8M=; h=From:To:CC:Subject:Date; b=JgNq3J9o4vyv7y8nUgwBSrT/2y4quRJ0n06/rGWcm/JYBlA6x25SdInn/YcUoMMlR S+LTRL8PJ/TpUp1HaY2p6NjuqYK1KtjJqDBeHfn0S73aQBualPfOfv7p4dxh2oMu1O PBdW7PeV5J7v6MsaZ87Md8+fdXD+IFyZ3VjBpsTA= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5TFZwA9011194; Fri, 29 Jun 2018 10:35:58 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 29 Jun 2018 10:35:57 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 29 Jun 2018 10:35:57 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5TFZv7K019307; Fri, 29 Jun 2018 10:35:57 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.149.121]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w5TFZvx17690; Fri, 29 Jun 2018 10:35:57 -0500 (CDT) From: Dan Murphy To: , CC: , , Dan Murphy Subject: [PATCH net-next v2 1/2] net: phy: DP83TC811: Add INT_STAT3 Date: Fri, 29 Jun 2018 10:35:45 -0500 Message-ID: <20180629153546.24107-1-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add INT_STAT3 interrupt setting and clearing support. Signed-off-by: Dan Murphy --- v2 - Removed bug fix removal of writing INT_STAT1 twice when disabling interrupts drivers/net/phy/dp83tc811.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.17.0.582.gccdcbd54c diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c index 49ac678eb2dc..f8653f5d8789 100644 --- a/drivers/net/phy/dp83tc811.c +++ b/drivers/net/phy/dp83tc811.c @@ -21,6 +21,7 @@ #define MII_DP83811_SGMII_CTRL 0x09 #define MII_DP83811_INT_STAT1 0x12 #define MII_DP83811_INT_STAT2 0x13 +#define MII_DP83811_INT_STAT3 0x18 #define MII_DP83811_RESET_CTRL 0x1f #define DP83811_HW_RESET BIT(15) @@ -44,6 +45,11 @@ #define DP83811_OVERVOLTAGE_INT_EN BIT(6) #define DP83811_UNDERVOLTAGE_INT_EN BIT(7) +/* INT_STAT3 bits */ +#define DP83811_LPS_INT_EN BIT(0) +#define DP83811_NO_FRAME_INT_EN BIT(3) +#define DP83811_POR_DONE_INT_EN BIT(4) + #define MII_DP83811_RXSOP1 0x04a5 #define MII_DP83811_RXSOP2 0x04a6 #define MII_DP83811_RXSOP3 0x04a7 @@ -81,6 +87,10 @@ static int dp83811_ack_interrupt(struct phy_device *phydev) if (err < 0) return err; + err = phy_read(phydev, MII_DP83811_INT_STAT3); + if (err < 0) + return err; + return 0; } @@ -216,6 +226,18 @@ static int dp83811_config_intr(struct phy_device *phydev) DP83811_UNDERVOLTAGE_INT_EN); err = phy_write(phydev, MII_DP83811_INT_STAT2, misr_status); + if (err < 0) + return err; + + misr_status = phy_read(phydev, MII_DP83811_INT_STAT3); + if (misr_status < 0) + return misr_status; + + misr_status |= (DP83811_LPS_INT_EN | + DP83811_NO_FRAME_INT_EN | + DP83811_POR_DONE_INT_EN); + + err = phy_write(phydev, MII_DP83811_INT_STAT3, misr_status); } else { err = phy_write(phydev, MII_DP83811_INT_STAT1, 0); @@ -223,6 +245,10 @@ static int dp83811_config_intr(struct phy_device *phydev) return err; err = phy_write(phydev, MII_DP83811_INT_STAT2, 0); + if (err < 0) + return err; + + err = phy_write(phydev, MII_DP83811_INT_STAT3, 0); } return err;