Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp615749imm; Fri, 21 Sep 2018 05:39:53 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbIf+qFtJ20aiucTi6SL+hmnJcYW4Bedk47gaTsNZ2GjH/FzsLZMd5okG42+6454JCTwVla X-Received: by 2002:a62:f4c:: with SMTP id x73-v6mr6771150pfi.221.1537533593584; Fri, 21 Sep 2018 05:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537533593; cv=none; d=google.com; s=arc-20160816; b=eECBnf8NIQyrMJbWbZ//49nZi3KgEBtxh+WRPzewFKVmcoXW+onCY6uQiJsPKUYb/c BAF7q7AV6giX8X0DtmQuYi6Q7soB47tndoY88H1nHMqTBeP9iDFGecFsY1mrs5p6tilt VpSR0wEn/m3ih3DF6H3iJU+GcNQG8vcLEnjnGYIs/i4baUHU1ipvVsgJIiZ/tciR/2eQ ml8+lPSXBwoAmx6vvYHRcEPFRE3uugptyrq0CcCGAxF2RdTmI9i/m8Yxv8V0jbgR1zOg 977JYW2wRxcEU1edIoY1UlWWX3gd4PAFPspolmagvlGNB0P0OHYo0HOmMCLWyd8+tidC n5CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=G5vrY0yFUGPq+5Eh3HEx78dwodFQ/j3uelLTF3RRqxA=; b=KadxbDssOEloyUVRgkVirMnFit2b6NL0X4ZaMrD5D7XLzsNYdnlaW+4k1+2H6kVPHP s9qZmymXLq27V4YZzSrRmwZxAUDhxtcbpQ1wcEgypdUF4rllNIZngJ9mmFQR7JmvR0N6 lAKGXj47VEP358dsn/vHdgOAqdmQlkegBcGipFpyC9oD5+FCCQ2PcQrAC62p/VwzI9Pv nwwutDXjtW+gCR0YDdbnryLcvEkEYn/3Kk33Rq/AvC9txBYrsxWFkEEnIKOZ4GK1F/LO 3E16rdbr6i/rVCbY17+iotcJrdWvzhXuPyCtJN5j6XDtA3awZX77SYhPGotPbMEpjQPj B2eA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7-v6si28171331pfk.146.2018.09.21.05.39.37; Fri, 21 Sep 2018 05:39:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389778AbeIUS0s (ORCPT + 99 others); Fri, 21 Sep 2018 14:26:48 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:64630 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727391AbeIUS0r (ORCPT ); Fri, 21 Sep 2018 14:26:47 -0400 X-IronPort-AV: E=Sophos;i="5.54,285,1534834800"; d="scan'208";a="20383203" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 21 Sep 2018 05:38:05 -0700 Received: from [10.159.245.112] (10.10.76.4) by chn-sv-exch02.mchp-main.com (10.10.76.38) with Microsoft SMTP Server id 14.3.352.0; Fri, 21 Sep 2018 05:38:04 -0700 Subject: Re: [PATCH] net: macb: Clean 64b dma addresses if they are not detected To: Michal Simek , "Edgar E. Iglesias" CC: , , "Edgar E. Iglesias" , "David S. Miller" , , , Joe Hershberger References: <0997a0e77b5e5c04c9a4d277d702d93a1a8a7448.1537373294.git.michal.simek@xilinx.com> <20180919180806.3tps6yukhm3ry43i@toto> <7e641346-dd4c-4e2a-637f-1b666f13485c@xilinx.com> From: Nicolas Ferre Organization: microchip Message-ID: <20eb98a9-edbd-c613-1f76-eccd7e06e052@microchip.com> Date: Fri, 21 Sep 2018 14:38:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <7e641346-dd4c-4e2a-637f-1b666f13485c@xilinx.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michal, On 20/09/2018 at 08:23, Michal Simek wrote: > On 19.9.2018 20:08, Edgar E. Iglesias wrote: >> On Wed, Sep 19, 2018 at 06:08:18PM +0200, Michal Simek wrote: >>> Clear ADDR64 dma bit in DMACFG register in case that HW_DMA_CAP_64B >>> is not detected on 64bit system. >>> The issue was observed when bootloader(u-boot) does not check macb >>> feature at DCFG6 register (DAW64_OFFSET) and enabling 64bit dma support >>> by default. Then macb driver is reading DMACFG register back and only >>> adding 64bit dma configuration but not cleaning it out. >>> >>> This is also align with other features which are also cleared if they are not >>> present. >> >> Hi Michal, >> >>> >>> Signed-off-by: Michal Simek >>> --- >>> >>> drivers/net/ethernet/cadence/macb_main.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c >>> index 16e4ef7d7185..79707dff3f13 100644 >>> --- a/drivers/net/ethernet/cadence/macb_main.c >>> +++ b/drivers/net/ethernet/cadence/macb_main.c >>> @@ -2163,6 +2163,8 @@ static void macb_configure_dma(struct macb *bp) >>> #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT >>> if (bp->hw_dma_cap & HW_DMA_CAP_64B) >>> dmacfg |= GEM_BIT(ADDR64); >>> + else >>> + dmacfg &= ~GEM_BIT(ADDR64); >>> #endif >> >> I think you might want to do this clearing outside of the #ifdef. >> If CONFIG_ARCH_DMA_ADDR_T_64BIT is not defined, we'd want to make >> sure the ADDR64 is cleared. E.g something like: >> >> dmacfg &= ~GEM_BIT(ADDR64); >> #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT >> if (bp->hw_dma_cap & HW_DMA_CAP_64B) >> dmacfg |= GEM_BIT(ADDR64); >> #endif >> >> >> Same thing for the USE_HWSTAMP/PTP flags below. > > Origin patch, which introduce this read with mask, > macfg = gem_readl(bp, DMACFG) & ~GEM_BF(RXBS, -1L); > was done in 2011 and from that time this function was extended a little > bit. I am even not quite sure if make sense to read this reg and apply > setting on the top of it. > > Nicolas: Isn't it better simply compose that reg from scratch? I have several arguments against composing this register from scratch: 1/ the reset value of this register is non-null for both of our platforms and it could be meaningful to keep some of these values. 2/ one bitfield could use different values between Zynq and AT91: RXBMS (1kB to 8kB for Zynq and 512 to 4KB for AT91), with same encoding. 3/ and well, this is the type of register with multiple bits that are marked as "reserved" and that experience tells that they might be connected to something... So, I'm all for correcting the code like what Edgar suggests. Best regards, -- Nicolas Ferre