From patchwork Wed Jun 27 18:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140376 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1226204ljj; Wed, 27 Jun 2018 11:31:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcXcpPxW8T+CKXYY2SbD6dvh+ag2yJQGGG6ontpSZerA2rwKdJiJVsBroGYa4arwXCE/nnd X-Received: by 2002:a62:6141:: with SMTP id v62-v6mr6971379pfb.197.1530124281835; Wed, 27 Jun 2018 11:31:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530124281; cv=none; d=google.com; s=arc-20160816; b=ZtBhQa8HbSk1tGdUQ4Jt13bVP1s0VqKf70BJ8c5tm0+UrpvBdHfw5B+07srr5/+pHS /V4TvH6xuSvQCJMABZA7teRAjjhSBhIAwY3a+st0YAKbdoehwNxc7yDYkN/vtIiwELg0 1rU++Y6jjqufhnC3XAc8wBmKcjCjSB8EbjyyqtVuaNenK3cqpQ9TbTPma12luG+bAYA2 t/U6iCHOWDAocVlUw+hb6XzyEicMSHNriE5h26137dUclWxdfE5+PZ0KNKN3TIOcq5th 7eLa3Q9vdBmiEkTZms20qBeaS3QL7sL+uQxRxmAbyOtHawTK4F9WLdFOyHL5Fp2xfeOE 0zwQ== 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=6GHaI4cTK+Vmw5Cw5lPUQreMOr9Z/tgoaZVxaPZpNxU=; b=wzCRfVUko2xYVWTLqPPqHCdt5biBvRJ6jXwJr20d8TYsosnVxaUPiedxAw1y+xfB+K fYFi3GvWvBEEHuOUechlS9yV/P/Jm2KLp0RmqLzglHxoJLv0OSGcd8MDWY5xgp9N+3nU vH7M880k0rdQ9nNjIYD3xJRdvrLBHYcmNRHXS+1uJ3CpxrwLiGUjySOrZ6A7GCOZuM1b 45cp3DEdjEWnmWQdMTtTKtK6yaia8yJetFgSbtOREl0juiW4ki/NjRDP8t22Q0pX+NpU mtFhmcBeknKS5FQzVDFtFKs6TD+yBYlhL/T6A3TPNIfjcSbTR2dMypai7JCNXECvJQko +HDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QSlnA5MY; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 a66-v6si4504706pfe.364.2018.06.27.11.31.21; Wed, 27 Jun 2018 11:31:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=QSlnA5MY; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S965905AbeF0SbT (ORCPT + 9 others); Wed, 27 Jun 2018 14:31:19 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:45104 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965892AbeF0SbQ (ORCPT ); Wed, 27 Jun 2018 14:31:16 -0400 X-Greylist: delayed 871 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Jun 2018 14:31:14 EDT Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w5RIGWvQ081687; Wed, 27 Jun 2018 13:16:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530123392; bh=6GHaI4cTK+Vmw5Cw5lPUQreMOr9Z/tgoaZVxaPZpNxU=; h=From:To:CC:Subject:Date; b=QSlnA5MYlvE7Sm3m6zebRgqpQ1ui0gSFRKQvq5jbrYr/vcoylngtsLWsdLBSzRo2E 74+0WY1HIVpbVZMfAXjKgt9DfpSweIP3pD5RhVcFtKTDQTmkyl4uZoM2wGbdpBpHrm JuGSD2XONvu4Irwou3jLtpxjDHOzXq4THeMa8eSA= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5RIGWIh014380; Wed, 27 Jun 2018 13:16:32 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 27 Jun 2018 13:16:31 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 27 Jun 2018 13:16:31 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5RIGVR1000861; Wed, 27 Jun 2018 13:16:31 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.173.184]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w5RIGVx02147; Wed, 27 Jun 2018 13:16:31 -0500 (CDT) From: Dan Murphy To: , CC: , Dan Murphy Subject: [PATCH 1/2] net: phy: DP83TC811: Add INT_STAT3 Date: Wed, 27 Jun 2018 13:16:17 -0500 Message-ID: <20180627181618.23463-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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add INT_STAT3 interrupt setting and clearing. Also fixed writing to INT_STAT2 when disabling the interrupts as there was a double write to INT_STAT1. Signed-off-by: Dan Murphy --- drivers/net/phy/dp83tc811.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) -- 2.17.0.582.gccdcbd54c diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c index 081d99aa3985..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,13 +226,29 @@ 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); if (err < 0) return err; - err = phy_write(phydev, MII_DP83811_INT_STAT1, 0); + 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; From patchwork Wed Jun 27 18:16:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 140377 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1226273ljj; Wed, 27 Jun 2018 11:31:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKD+1BQ9gY4WHowSvGKdQvi6XrF8GYi1N9LU/Lv26ETIbJTFzcn43q9CraO8p6Gdk6Y0+6v X-Received: by 2002:a17:902:5ac3:: with SMTP id g3-v6mr7210416plm.90.1530124286002; Wed, 27 Jun 2018 11:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530124285; cv=none; d=google.com; s=arc-20160816; b=dVLBNz7kED+dRorS1r8qWagAgB0W0Q3u++u8ckm1EXxEyU6I/s8GMUiLdv2LZpegqI NL439ubNuAWCpQIhuQwzOHHKSRNPKs4gvJzP0qj5hnnyx+T/145PUg7dg7nHK6aXS0w9 loLBsOWE1WhZtwdawguC0QuR9I0kWoWgABgA4b0bfXwDbtR9Eu+dJYkurma3qnktIwFV pjpNgVc+BXW77+hwkAZqqDNR0urnRyWZoYULXUpca/E0byirxIBADZjVsIv2LDEGIAU7 E6YpFlv4xdTWvad+8YXDdVBt0+HS+P+++48jbcyt5wbv5SHTnvVrd1OEPGThnbdrwRqr 1dcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=F0rQXLg7+0EoPXScPZrn9GvnO8gzyMMKp4bxKxjSLu0=; b=aQQ2eLczC4horeL3iwTHXiw7NKUAFCooQ5xazw4L8R+To/Bg5VHLveFHGyQtwl4UJ0 vInn8gIQqiZUPgIcYcAGlLY5lXOiaUgBLK8CNT/Th5gWoeVkpWHiLLI2QhERhsWUvbI1 7pz4NXV/tPeYFKDVClJpCsMtkyqjZJlb7liDKaaL1RnkR4ipnwzeT+vofrV6z3+dhf9Y w+40NYKH1y+hmr3Np7Ut58Xjye7W1uUAyDd0+Lha6Wde1gXTRi/tB/t/JsnKYfvh7674 rnG4KheiA26mOKyMpIm/BdtAne7pZ6P7n9Y/B+u8S2rIJyn5U5FKXXCeVmAAx6UFRMIS ORew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=HXs2GXwd; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 a66-v6si4504706pfe.364.2018.06.27.11.31.25; Wed, 27 Jun 2018 11:31:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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=HXs2GXwd; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S965900AbeF0SbR (ORCPT + 9 others); Wed, 27 Jun 2018 14:31:17 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:45104 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965852AbeF0SbP (ORCPT ); Wed, 27 Jun 2018 14:31:15 -0400 X-Greylist: delayed 871 seconds by postgrey-1.27 at vger.kernel.org; Wed, 27 Jun 2018 14:31:14 EDT Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w5RIGWe1081691; Wed, 27 Jun 2018 13:16:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1530123392; bh=F0rQXLg7+0EoPXScPZrn9GvnO8gzyMMKp4bxKxjSLu0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=HXs2GXwdtd87x5mesDA7q6ZLNpAsnlOGdM/szhJocnw3veovPsZr3d7HTJCZ98aEI Ul+cYZVGVpJ6fILpaHy/CeAKqMl8Vq5jajlinYYML//2JlAMtSVXgj7oi9pNf90vt9 ilMmhiN9F+oYOL9RYAHKgp7EaIskoJg0XwTjH358= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5RIGW3L014389; Wed, 27 Jun 2018 13:16:32 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 27 Jun 2018 13:16:32 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 27 Jun 2018 13:16:32 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5RIGW1v013854; Wed, 27 Jun 2018 13:16:32 -0500 Received: from localhost (a0272616local-lt.dhcp.ti.com [172.22.173.184]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id w5RIGVx02154; Wed, 27 Jun 2018 13:16:31 -0500 (CDT) From: Dan Murphy To: , CC: , Dan Murphy Subject: [PATCH 2/2] net: phy: DP83TC811: Fix SGMII enable/disable Date: Wed, 27 Jun 2018 13:16:18 -0500 Message-ID: <20180627181618.23463-2-dmurphy@ti.com> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20180627181618.23463-1-dmurphy@ti.com> References: <20180627181618.23463-1-dmurphy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If SGMII was selected in the DT then the device should write the SGMII enable bit. If SGMII is not selected in the DT then the SGMII bit should be disabled. Signed-off-by: Dan Murphy --- arch/arm/configs/omap2plus_defconfig | 1 + drivers/net/phy/dp83tc811.c | 20 +++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) -- 2.17.0.582.gccdcbd54c diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 06fb948ecfb3..30857d5b7a6c 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig @@ -182,6 +182,7 @@ CONFIG_TI_CPTS=y CONFIG_AT803X_PHY=y CONFIG_DP83848_PHY=y CONFIG_DP83867_PHY=y +CONFIG_DP83TC811_PHY=y CONFIG_MICREL_PHY=y CONFIG_SMSC_PHY=y CONFIG_PPP=m diff --git a/drivers/net/phy/dp83tc811.c b/drivers/net/phy/dp83tc811.c index f8653f5d8789..78cad134a79e 100644 --- a/drivers/net/phy/dp83tc811.c +++ b/drivers/net/phy/dp83tc811.c @@ -284,21 +284,19 @@ static int dp83811_config_init(struct phy_device *phydev) if (err < 0) return err; + value = phy_read(phydev, MII_DP83811_SGMII_CTRL); if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { - value = phy_read(phydev, MII_DP83811_SGMII_CTRL); - if (!(value & DP83811_SGMII_EN)) { - err = phy_write(phydev, MII_DP83811_SGMII_CTRL, + err = phy_write(phydev, MII_DP83811_SGMII_CTRL, (DP83811_SGMII_EN | value)); - if (err < 0) - return err; - } else { - err = phy_write(phydev, MII_DP83811_SGMII_CTRL, - (~DP83811_SGMII_EN & value)); - if (err < 0) - return err; - } + } else { + err = phy_write(phydev, MII_DP83811_SGMII_CTRL, + (~DP83811_SGMII_EN & value)); } + if (err < 0) + + return err; + value = DP83811_WOL_MAGIC_EN | DP83811_WOL_SECURE_ON | DP83811_WOL_EN; return phy_write_mmd(phydev, DP83811_DEVADDR, MII_DP83811_WOL_CFG,