Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932717AbcK1K5g (ORCPT ); Mon, 28 Nov 2016 05:57:36 -0500 Received: from mail-co1nam03on0045.outbound.protection.outlook.com ([104.47.40.45]:10080 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932105AbcK1K45 (ORCPT ); Mon, 28 Nov 2016 05:56:57 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:1416;Count:15 From: Harini Katakam To: , , CC: , , , Subject: [PATCH] net: macb: Write only necessary bits in NCR in macb reset Date: Mon, 28 Nov 2016 14:53:49 +0530 Message-ID: <1480325029-39224-1-git-send-email-harinik@xilinx.com> X-Mailer: git-send-email 2.1.1 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.0.0.1202-22726.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-IncomingHeaderCount: 15 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(189002)(199003)(9786002)(36756003)(38730400001)(4001430100002)(39380400001)(8676002)(36386004)(92566002)(63266004)(189998001)(5003940100001)(39060400001)(77096006)(39450400002)(39410400001)(39400400001)(81156014)(81166006)(33646002)(107886002)(6666003)(305945005)(2201001)(356003)(5001770100001)(5660300001)(48376002)(626004)(7846002)(50466002)(4326007)(47776003)(106466001)(50226002)(50986999)(8936002)(2906002)(107986001)(21314002);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR02MB067;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2NAM02FT038;1:7jtjg3s9FbIF/h+OIo/7/pT6DZajCI1PYGRKPd1/Tx6AiS+3KrFo+ddW1mRtkzGUWxgXhBMFhdZVFKxM4JO0SJP8zpO8gjXJjxR4akyqkIgTaxXw20TfBUtw/xeA22wBS6i/l8ecUcXKyZOBK+FxgaqH9aC83dlxSNNFHPV27eEzfT7MXCgIZNH8/cRsdd3mqqBWPKr8JfD8Gj9/wsuEHNaeWwI0JsLKGxDd2cgWrka1fG0qouDmHt4vAOfO8qvOeCRBDuFaulzEACwVCoI8RK0e4RxHTIfa3RjeYKG/hNzApTp5wphj8SW4ptiQh6Ah717qXtrZXthDCKe105FbhoTXlE65jREaP/0WSb8atb6fDW1f9MOPLzIolLJNnD2GiueqWAoa2Hzwsplqy5hjKfmWRB2Jau+yasK6qFDu3/rarpFqNMKeHiDgdY7B1i9VqLq42o7eFTtzpFzCz/iLnvD1iIWAyrbdaNZgfyTl4lqpQDWzM32bK+QfVNVv35BMllPuFApfHj2bbIT6zL2sZ3NVzGWYsChdT/YDNzNECckxQqkmJDSH/yl8dAAKC0OylkAjHTFQEztIABjuRhGFRGVjzmrefF5P0Rg0Frr2MTM= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: aa10aae1-15cc-4b7b-ecb1-08d417704836 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:BLUPR02MB067; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB067;3:ek2b+79dA/VlrNPbKK9cEihsxEluRIqTSl03LzvmYmWrkdGj2rTlE6A8pr4f8kRAa2vCdH1cMCo1xkvZLXicS2RFST0uFGfgt/0o2brm3i7fOohYNggKRtB0PKFDRS1jHFK5trtojxsYVwEXGFSDICzm7jzPaWoTvfWDh+bxA1IsmpJ4wi3QBRo/H7/pnJngEzXa2iHfHHLnl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AmhMGU+hmOMS4o3J5ezH1ILQSW5w== X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB067;31:ilQMJIMClCXFztVdtVMve5u841+IpXjXMIIAgmUzGwiGWFP1MFh933v3L90en8Np7oEM7kOITjGsmimThs/+NUd/VJM/2PmgzZN1hq3fbayQ4vPMxoyGirpvMzjSJmPJWUFuHuSc7ATn++qmrRklJdwI/UeRAFUG6z7ot5dbvuJA8arm2BLAaA6Wxd/XqVbSYCT8tK0M4/AWZyAUOxhu26ZwamHoF55adoXZcyBLYcg9AHY0GmpoCuu4Ng/Fg8/KuxnHTslkogoMXPAE31DHKw==;20:Y+487fpe/Bk5hYxsbk7eThRm9SNApV7b1R9EXbhvkErnR/8B07pte61Rl65nR1FsZChCyUKJrZ5MHaPVg6ENGHAJCt6MURTDdfTeWaaqDMQRTnzZhQDB7+/lNaxyuIWmCLidx+KwuPxt/6vCvAenTfbXJ5C5p1z71T1iRIavbTp9mvrtu08vKytRyB14hPch4WvqV+JJpjeRHj+LnkqUyzS44A6oLswIgShy0v+0vFmXwENBaKzl+QWlEEiWl2/94qU0ujgEVzNEGmLh/Y6n1OKBdk3PgJVtUA8mtKDcLcU4pyXSChPM8M6n8a+4vnktryJnGCarmAFSnYrAcDQNXDWIl1nQQkF23dScuVNz07+tWRWATsXSGvdfq5GPIU2p2ItNMhbjTT2UBGCj58IkNsiHB4LTwOO+jZY9Y8IA6BXVHTVQZ1QPcYP1CaHgXHw5brRbJK4gLDuH9DY9XuiPxeLXJWlxlHZjLcQLSbsyAg0El/TWZTUGLu2YgAlGUJ1E X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040361)(6045199)(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(13018025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(6061324)(20161123560025)(20161123555025)(20161123564025)(20161123562025);SRVR:BLUPR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gg/7bapAaxYO9XLXdbc?= =?us-ascii?Q?iothZLe37oy255AeGPu8tsO0PNdxe4yLD+Z2k5jXwfFe3t1Zf+fEvH/W7HCM?= =?us-ascii?Q?A/CdsJLnmBBzk39jJDtbydVR5v74mEZkAQobPwcBNJXEyzfHFbfeimrxP44M?= =?us-ascii?Q?L6IzKVZxQ=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB067;6:yYgZFdNq42EN2fCUH/YbhngTYMSAPliYCTa/6tdZaFK+yc/MAcjYgMsdxTKdlm6zwKEWW6p1rvrQSlN7jAm6yROcWqwaWajpcKw8MZa6edvr2D2qTEkkjz0F2cTYq8f0NndXty7zPK25tdpvDggU9DcADfmPsTF4JV1d5FMnrP12U+vh3D4lCAqbNlDblCBWTnaM70KcgxVsdl3eMsEMaJyV7uDboWKzY9gQbnQs9ZX61hDcZC+LNHZ8eMEkrr6ZxzUpw/u63tqpJt25eIrQ0Lx6TFkmQK0ARiCdbs7ejBdxg8BpcYN1WNgRv5XKZ4fxShiJMXXUStBS8PK1RYXBazW3aaXBeehN0gc532NrphvOvsP1idgn8SVdgtugloLf/GylXdPmbiwIvQPkyyySO7DmSSEjrv8qKBI4mldmifh8S7cNB8QY0VM9vMUAqGgI/XQh0ZJXhIxfDvBX+NPESCh34TAYyUQM908j9D1xo8wE4XiAfAIc9i2QSjhtpxIn;5:JJyefRYDeV0I8ye19i63C0dB82Zio+nK9ZYpjEctybh//7ouh4zhknoA6FwRzyMBzH0pYBX1JlbMLg3BIEvZIS2GDNRBRFBkoib8DP0/S8f8+MUFM6YtNwKMUa4kj1llzTJcbqLSK10pvEnMaXtvzQ==;24:zTsTNJ6R30OAfcYDO6PFrGA2U6OpobxoHFeYHYXsUA1ftnwSESJUdcCTKvaLScA6eZQTXMGUeXMwmuLY7SjxfaspPQZoV3jwcbP6Prs9+tg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB067;7:n6yXjZCewrA8PMIltICyYNQtzMuo6tYKnov/DRo/ZHUhaVgprY71agYKySwabzfeAAuOf1nWwtucZKKm+1jWruT4RjlPzkLTDzyLPgLbLPP/3KFJxBv1xUwP1gvzOWHye8vWggLJxLjlfDsWkRdATBYGfBJ1knLpRt+ehgUiEOvdCzG4msKZtnwTLuBjMRh1QWaQNtrPXoo2kw6zkFJEzq/f71+c/qjfuTrhMOxcFG1NT/6mvJq/sjOubTKV5deT4KSZ3VLNoo0bwb/iMrZmSIydaqsK64er5tZPi1OLecdXjG0gF8sAKBtESYh6Ku9mzpCRMnuOp8hkRhRu2gi99lLMDHJycAAGwFEU9g1ZUIUxAVNSm6mSPPcXd0ePBWxOV/tdmMvOcBm3zoyZcrvG+1Dva+CB67Dhm/crOx4SmFsK4C410foFJH5/wzOtp2hJJSJ/Q5l1hI2ZlRoR6Yw3cw== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2016 09:23:57.9386 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB067 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1179 Lines: 37 In macb_reset_hw, use read-modify-write to disable RX and TX. This way exiting settings and reserved bits wont be disturbed. Use the same method for clearing statistics as well. Signed-off-by: Harini Katakam --- drivers/net/ethernet/cadence/macb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 0e489bb..80ccfc4 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1743,15 +1743,18 @@ static void macb_init_rings(struct macb *bp) static void macb_reset_hw(struct macb *bp) { struct macb_queue *queue; - unsigned int q; + unsigned int q, ctrl; /* Disable RX and TX (XXX: Should we halt the transmission * more gracefully?) */ - macb_writel(bp, NCR, 0); + ctrl = macb_readl(bp, NCR); + ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE)); + macb_writel(bp, NCR, ctrl); /* Clear the stats registers (XXX: Update stats first?) */ - macb_writel(bp, NCR, MACB_BIT(CLRSTAT)); + ctrl |= MACB_BIT(CLRSTAT); + macb_writel(bp, NCR, ctrl); /* Clear all status flags */ macb_writel(bp, TSR, -1); -- 2.7.4