Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932396AbcK1JcB (ORCPT ); Mon, 28 Nov 2016 04:32:01 -0500 Received: from eusmtp01.atmel.com ([212.144.249.242]:49142 "EHLO eusmtp01.atmel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932223AbcK1Jbv (ORCPT ); Mon, 28 Nov 2016 04:31:51 -0500 Subject: Re: [PATCH] net: macb: Write only necessary bits in NCR in macb reset To: Harini Katakam , , References: <1480325029-39224-1-git-send-email-harinik@xilinx.com> CC: , , , From: Nicolas Ferre Organization: atmel Message-ID: Date: Mon, 28 Nov 2016 10:31:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1480325029-39224-1-git-send-email-harinik@xilinx.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.145.133.18] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1489 Lines: 48 Le 28/11/2016 ? 10:23, Harini Katakam a ?crit : > In macb_reset_hw, use read-modify-write to disable RX and TX. > This way exiting settings and reserved bits wont be disturbed. Yes, indeed... but I would have liked a line about how you discovered it was an issue for you ; what did it break, etc... > 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; I would have preferred a different line with u32 type. > /* 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); > -- Nicolas Ferre