From patchwork Sat Mar 31 21:22:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10319015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9058460467 for ; Sat, 31 Mar 2018 21:22:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B20729243 for ; Sat, 31 Mar 2018 21:22:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB66292C8; Sat, 31 Mar 2018 21:22:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CC19292D2 for ; Sat, 31 Mar 2018 21:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751690AbeCaVWN (ORCPT ); Sat, 31 Mar 2018 17:22:13 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38740 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751368AbeCaVWL (ORCPT ); Sat, 31 Mar 2018 17:22:11 -0400 Received: by mail-lf0-f67.google.com with SMTP id u3-v6so16322670lff.5 for ; Sat, 31 Mar 2018 14:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UEnjQY+CF2D/zjgvDFTs4PpichjjWhMErPTlYb/twZ0=; b=WqdxhUYXtPx7oIf2yI1XzVws/1kAtgK8OnRxmrVv4edTC28vZVBxlaCYEm67DBfuFg joYi+QqktALnzA9XPCMwIbIYxU36OBYnDmCsxAYNMTzQHwL7AFnrYDhGuqC1Gj5xDxGe PcUo+EOD3athGIHJiOsZFGA3hPfo3t9dms46mmBAls3rucs3IJRsPf52PlPeS7+iwR36 OCjHBw0rgW5ZHa9HmES/t/+1iyjxazg+A/Ce+xZqP+aMZfw8iiVoF05J9bJMGEGz5CmJ UjEt0QFpOYw/jpouzcP5Q2Tuy1NuoGka313ynE4XdLhuXFZl1c+kxitvT2qgtRg8x073 3t6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=UEnjQY+CF2D/zjgvDFTs4PpichjjWhMErPTlYb/twZ0=; b=BkmTF3ibciMoLjpEKJpxpUfTc+QoCibZWwRT+ZAlkjXZo+vee/rneuGX4bM3e13s1X WvzhwMIBRgNArpeL3ViOQqdJIuo9l5m4jcheMXbTdr+vC55m1iNyHnjLXpFADhPBPSTy y6PftJU4B5YVhGoelXvlVhQPjZ+u3csVWzd6YAf/6ugjNwrxu9dDrC+X+QyhRikMxlyk EUQkzDWOaqBfpqkGC0eDwSb5ZuUKSheMYQMFShzaLOcXPZt9/Izq1Kp0jJ5WVxlEdo5A kZ5jzCq3+5UelYbSxaJ5rIibtOKMQ5rHCc9i/TSKnRCLNIoRrS9dLVhtTTuWTqs33Tjw 3qgQ== X-Gm-Message-State: ALQs6tAmuO8WRW0Jm1zocJq5lEUy9SkSXMcrbrCqecjKXkGmAv8tndC5 pGqSVwTJDlSwPBRaTru109CcF+Lv9Sw= X-Google-Smtp-Source: AIpwx4+TC/TTbkq73auIqBrgSV5RCtdewrrr8rplgEjJmSUMHOsWIM5RiWUGLtsz/bdZddHjNuv92A== X-Received: by 2002:a19:ca09:: with SMTP id a9-v6mr2446827lfg.55.1522531330231; Sat, 31 Mar 2018 14:22:10 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.87.205]) by smtp.gmail.com with ESMTPSA id d24sm1994558ljc.24.2018.03.31.14.22.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Mar 2018 14:22:09 -0700 (PDT) Subject: [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org References: <998029b4-9400-ebc3-51c1-623c3f72b6cc@cogentembedded.com> Organization: Cogent Embedded Message-ID: <233e32d1-947b-2377-3d1f-39d5d83bd3f7@cogentembedded.com> Date: Sun, 1 Apr 2018 00:22:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <998029b4-9400-ebc3-51c1-623c3f72b6cc@cogentembedded.com> Content-Language: en-MW Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit 6ded286555c2 ("sh_eth: Fix RX recovery on R-Car in case of RX ring underrun") added a check for an bad RDFAR offset in sh_eth_rx(), so that the code could work on the R-Car Ether controllers which don't have this register (and TDFAR), then the commit 3365711df02 ("sh_eth: WARN on access to a register not implemented in a particular chip") replaced offset 0 with 0xffff. Adding/checking the 'no_xdfar' bit field in the 'struct sh_eth_cpu_data' instead results in less object code... Signed-off-by: Sergei Shtylyov --- drivers/net/ethernet/renesas/sh_eth.c | 5 +++-- drivers/net/ethernet/renesas/sh_eth.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c @@ -702,6 +702,7 @@ static struct sh_eth_cpu_data rcar_gen1_ .mpr = 1, .tpauser = 1, .hw_swap = 1, + .no_xdfar = 1, }; /* R-Car Gen2 and RZ/G1 */ @@ -735,6 +736,7 @@ static struct sh_eth_cpu_data rcar_gen2_ .mpr = 1, .tpauser = 1, .hw_swap = 1, + .no_xdfar = 1, .rmiimode = 1, .magic = 1, }; @@ -1615,8 +1617,7 @@ static int sh_eth_rx(struct net_device * /* If we don't need to check status, don't. -KDU */ if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) { /* fix the values for the next receiving if RDE is set */ - if (intr_status & EESR_RDE && - mdp->reg_offset[RDFAR] != SH_ETH_OFFSET_INVALID) { + if (intr_status & EESR_RDE && !mdp->cd->no_xdfar) { u32 count = (sh_eth_read(ndev, RDFAR) - sh_eth_read(ndev, RDLAR)) >> 4; Index: net-next/drivers/net/ethernet/renesas/sh_eth.h =================================================================== --- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h +++ net-next/drivers/net/ethernet/renesas/sh_eth.h @@ -508,6 +508,7 @@ struct sh_eth_cpu_data { unsigned rpadir:1; /* E-DMAC have RPADIR */ unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */ unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */ + unsigned no_xdfar:1; /* E-DMAC DOES NOT have RDFAR/TDFAR */ unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */ unsigned hw_checksum:1; /* E-DMAC has CSMR */ unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */