Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755942AbcK2F4z (ORCPT ); Tue, 29 Nov 2016 00:56:55 -0500 Received: from mail-cys01nam02on0051.outbound.protection.outlook.com ([104.47.37.51]:3808 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752592AbcK2F4r (ORCPT ); Tue, 29 Nov 2016 00:56:47 -0500 X-Greylist: delayed 73017 seconds by postgrey-1.27 at vger.kernel.org; Tue, 29 Nov 2016 00:56:47 EST 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:1412;Count:15 From: Harini Katakam To: , , CC: , , , Subject: [PATCH v2] net: macb: Write only necessary bits in NCR in macb reset Date: Tue, 29 Nov 2016 11:26:25 +0530 Message-ID: <1480398985-24037-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)(199003)(189002)(50226002)(92566002)(4001430100002)(81156014)(81166006)(8936002)(5660300001)(9786002)(626004)(50986999)(107886002)(2201001)(5001770100001)(63266004)(8676002)(5003940100001)(189998001)(50466002)(36386004)(356003)(47776003)(39400400001)(36756003)(39410400001)(39380400001)(39060400001)(39450400002)(77096006)(7846002)(48376002)(305945005)(6666003)(33646002)(4326007)(2906002)(106466001)(38730400001)(107986001)(21314002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR02MB2391;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1NAM02FT023;1:pUgXJozyh91vUBOuX22DfzCbJ52t4FHedWLwIrKQGTgVOSkDPz8GMAyc/yLq50rpgTIqeIeSBZK60cmrtKNL1bx0VLzcGqQafVZOdLqohFQ3WEMryny3+y8U6hYXSIwZoPHuG3b97YVedRsHWIJIDHwMv5+BaQn3ST20XzSXyc2Vgb+VWGkWDWCgzSvZHiwBwYvHLSlRR1V6lrP0UGCUWm3ut7nAcGEN/UrLUhFrs5sG0PUN+HVC8ZJ7L+WpQVf0+RHI0fTUeTbcReNd/DUWEKSnPLT0VXA6OGgzQjZNPQ0ZYZOCZhTYxza+rhPvdAmFI3ZXkc9u/qpWpYaSIUzf8aZgUzKbSE1I+bIps9SU+HRPr4as8SVBOlAXYyhoMWhCSCEqedwipN2fimEGbOD0O8CrBgmU/yBPfOtdZP6fn4BMkFYjBSkSEG+vMZsFNdp5SQEzTR9Qt71RlFCkkGCJ1f4xzYPMeqmbb1K2EgM2GzgojoJI5YqYqR10qvtCaK28UI4rs02IuSwu3ncmaYHPZRi70NU7eS4RSaz902nW9/+haQWyLh0nDQQ0RiyvLDBKuGib4dZnXy8VN01P/BqUwElwR59W/xT+5tKMQJDRGX0= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7a285f73-67cb-452d-5070-08d4181c7f92 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:CY4PR02MB2391; X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2391;3:/s1X62E7Ugh6X5MMpxS9XyLDOxuMwEOk2y7J7zxHDguPcVLTtkrjZTuyzKavmWudo1ZBVN3ZGpI5F/5W3+ddtBlauhigku/PoRJnIjTaQC4l6xa5wh6s1uOikIV54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2144So=;20:lRPR/0LMdGA/8SIeQpmjCXC/8RGcm+jNWg7HB/UXhnXAP0uJEa2lJvLlCZPTS2Nilin0/607W5jVLqX+tUxioH/OMt4kXZPqwHz+okplUu9162+dgQEe98t/yup9C4rd40h/K/WfOPmf2tqqBPw5G67aWlly4o5nyWkXy7MYRtJQzs868hGrLB0zCrWDpa9arZPnOjdXymtKYXGmCllW+FCLaYwFRC4Modtt8/7mM8h3b6oR9JplIe8PA3sBXNJKWEaK5uLmMusybJQi7/gm/WJIhaen/wLCvA2+WeZZRP54Qntwjn/lfokXT8B0O0n0AJwUjY63on1viQeWS5R03O89tjOBLv2rwXFZm8eJtD/18IYj+bRozCGCK9fV8phfDHcbags52i7H9yYn3R/Dt+qlSVJeZTEJ9EnDQm33TtzJakc+ajOHiEAWBCfhb8/eXNeebNbZYuwvI+QI2ykCCT7ePNO4n2lyzCSvTIfZLeMOYE1/u1WFDULFO4S5CD9b 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)(5005006)(13024025)(13018025)(13023025)(13015025)(13017025)(8121501046)(3002001)(10201501046)(6055026)(6041248)(6061324)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(6072148);SRVR:CY4PR02MB2391;BCL:0;PCL:0;RULEID:;SRVR:CY4PR02MB2391; X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2391;4:xLxR9b1fTxQejuu5KKiHrutWBaReTjnAuKHmDb2GNW4QQf1BsKD0TCggymsGHydWBqbWj1UnqnKHFK5q0JIXN+njd879D7dF7gb9Vr0zpo+u2rJcEKEBuJgy51akBOb0rY5/KqZA+/X+hzzdc23YBAlQ2NXK04qs1BetYZvKyARuS3KDweABinww+T6upFEof7NaObk0ycVo8bgh1M2Mr5/P4zRgqZfCRzmw3rseONonNC4u/WdMZQRYA4JKXT/LCf99l+int+BIOXeIYb5j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VC+W39A5TPqvwn0sLQJ?= =?us-ascii?Q?Eom+Ot9WbqOnmXRYDw4thEu4lh3iqedCWZgBMQNBdZkanSGRurQ2kihMBwRh?= =?us-ascii?Q?jXpxBQl1CAAQW9ogQYVjaVq4M15p6thGD6RW0GpeJnX0HdpSPtW9SYb47bhB?= =?us-ascii?Q?iHSFbtt+2YIk5ant6lwJQRlshfsTKuul8Zo60VU80+XcFqun3O8ej+s3nxvx?= =?us-ascii?Q?+7O5Iko7I0PnyeSqIECjWmh3SFD2BpNOlURE6f88TmuMGg7pVYgBXmgI7+R4?= =?us-ascii?Q?c+DsFwR5cyRUrgjUFqY3ClW/3rRN/Slq5yjLbfq3CQVTzx33gau83gJNOXnC?= =?us-ascii?Q?lAR5ZiNtfWgZp1l0S8DcOU10W56onPvK6CbngeTaPi8llbhmXDW6uP8e4G8B?= =?us-ascii?Q?oq7nS2q19AXBv1nrBcEny2vl6nGV3pDegL9Ys6t2P6ukH+NPt7N/9Sp6b0qr?= =?us-ascii?Q?z+J7UMf73fwpxoMA3Vhyab6uKhOftndHEv9oVb8lplNTQApgRfDakglP1OLC?= =?us-ascii?Q?CWJl4T7SLeyPbNCUjlmBxembCYT23Punpou5mEtB+RDYPvbJwxWGHdaMiehH?= =?us-ascii?Q?mslgOBdwpHvyGounVBK6RRgIeyGK1H5mIB6mUVeRJ5INKkKg0i+MnF2r8/zo?= =?us-ascii?Q?+gK9re4ieDdtfUUHROyzYtBOCZGXrAeJtF0r/oYwvCBZGs5m3bHZrZ6oZq8x?= =?us-ascii?Q?coSamiYiXQ0syrslxVv3k05adIUknFrOOi6z0HM/7Ct1bYUo3XjuncJAjXlD?= =?us-ascii?Q?nblu2cwF5U=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY4PR02MB2391;6:nkR0NyluoXVb9uV5Lhbnef41xIhZbvhUBaXvb+xQ9B8v2XnRHQ2ELDWnMM8vWkWKAeGguSuYGBnxAOx0K0jXFh6cuSoyntF8sLtraqGdzgtdWs9tHw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K/KinA6uns+rnrThvWybBSMS8sSo9625emIdkL4fTf0JMCfu86Ax+MDtHHEG7hzqKvM5Az6k/P/8tdMGm/2qCH/qjgCG0vjtnHrHtjdFZKhu99JqHhhWne6EsDAqtmD7tVNshwVxv9pzjzL5j3Rpxk/X5z3W1QGA== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2016 05:56:44.0778 (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: CY4PR02MB2391 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1303 Lines: 45 In macb_reset_hw, use read-modify-write to disable RX and TX. Existing settings, for ex. management port enable, are being cleared in the current implementation. Also certain reserved bits are read only. Hence it is better to use read-modify-write. Use the same method for clearing statistics as well. Signed-off-by: Harini Katakam --- v2: Make ctrl type as u32 Improve commit description --- drivers/net/ethernet/cadence/macb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 0e489bb..2ce3407 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c @@ -1744,14 +1744,18 @@ static void macb_reset_hw(struct macb *bp) { struct macb_queue *queue; unsigned int q; + u32 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