From patchwork Sat Mar 24 20:08:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10306369 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 87A4960385 for ; Sat, 24 Mar 2018 20:08:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77C032926B for ; Sat, 24 Mar 2018 20:08:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C772292A4; Sat, 24 Mar 2018 20:08:49 +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=ham 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 91A302926B for ; Sat, 24 Mar 2018 20:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344AbeCXUIr (ORCPT ); Sat, 24 Mar 2018 16:08:47 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41814 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753005AbeCXUIp (ORCPT ); Sat, 24 Mar 2018 16:08:45 -0400 Received: by mail-lf0-f66.google.com with SMTP id o102-v6so22854699lfg.8 for ; Sat, 24 Mar 2018 13:08:44 -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=XPr5ozCAMNiYxTdgLuObdR9WF/TKcGaD4iGam4ICI3c=; b=gozOxCx//B5JLpYevVj/kFEyqr+dI7u/XySoPRVx/eU7v25n8vqpgEJMFk872rC+dI w5ltde7ywUYk+tJRGovZlkW1QePBndcCZi+GQmR88ZnVNXlEodeBykKbfLMZa58Drug2 mdaIQKh4otBCpoGsCVZZG5by9GLYixJmYNk1PqpOiKRZDeewc1SG+BvQBjFb0rJGulDl LawJX4L09KHBU1w0kNgfyyWJQOyfqibTtNEgFnb9Qwyoq1GZt6sP8xbTA5iZX2P5LJOG MSJOlTtAGc/7Hf8WUY/uSU8DU+/yFc+FMyalOHO/wt245aXTBf6qk4sCVDm3lr+UlV4n VbiA== 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=XPr5ozCAMNiYxTdgLuObdR9WF/TKcGaD4iGam4ICI3c=; b=qMqL8Jbb1IDaD+oPTUKQ9rN2ONcDDk2p4MIz961ejh45S+F7HLuotUR1wAnZj8JKY1 1L1JqnUKu5MLRFAlxCbp+DgzqUDT5UyhrM/58gF7ymaaxGcHS/t1Oac2SLC7VWz9+va6 wGzgwhyB0BxWIL/e60p3jrpdGCdHobvDh4ogOqcHy1GE7OlAWHcFOAuixf3+GUqnQ4kH oZblC31mLw1GP7EgM1MeCimClHUFSgP4GYCmmJ3N0VCeSJ385dV73/CH0NQ1Veclauit iYpgpleeupYt5rlroyhnKu7mWDF0q+OqxGoCMp05YdtgabKHl92oaMshsmDt+9IFS7lG qfsA== X-Gm-Message-State: AElRT7FjCDBzxkCVYv6+gRC12x8mDxrG5+AxPbonHhXNOiTBDP3ckX62 eJnYmyspYoq8c0mAsxamdZGopW1IdnQ= X-Google-Smtp-Source: AG47ELvcUL+ydLF9O2EvpQDm9gnx7eG9LahmjjGQTiVmBbUCfzCBy4zJiT7mhjjXIurecQrHHiQ5dA== X-Received: by 2002:a19:5c4b:: with SMTP id q72-v6mr24025551lfb.126.1521922123601; Sat, 24 Mar 2018 13:08:43 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.64]) by smtp.gmail.com with ESMTPSA id d8sm1547555ljg.63.2018.03.24.13.08.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Mar 2018 13:08:42 -0700 (PDT) Subject: [PATCH 2/5] sh_eth: add sh_eth_cpu_data::edtrr_trns value From: Sergei Shtylyov To: netdev@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org References: Organization: Cogent Embedded Message-ID: Date: Sat, 24 Mar 2018 23:08:42 +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: 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 sh_eth_get_edtrr_trns() returns the value to be written to EDTRR in order to start TX DMA -- this value is different between the GEther-like and the other controllers. We can replace this function (and thus get rid of the calls to sh_eth_is_{gether|rz_fast_ether}() by it) with a new field 'edtrr_trns' in the 'struct sh_eth_cpu_data'. Signed-off-by: Sergei Shtylyov --- drivers/net/ethernet/renesas/sh_eth.c | 27 +++++++++++++++------------ drivers/net/ethernet/renesas/sh_eth.h | 1 + 2 files changed, 16 insertions(+), 12 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 @@ -584,6 +584,7 @@ static struct sh_eth_cpu_data r7s72100_d .register_type = SH_ETH_REG_FAST_RZ, + .edtrr_trns = EDTRR_TRNS_GETHER, .ecsr_value = ECSR_ICD, .ecsipr_value = ECSIPR_ICDIP, .eesipr_value = EESIPR_TWB1IP | EESIPR_TWBIP | EESIPR_TC1IP | @@ -631,6 +632,7 @@ static struct sh_eth_cpu_data r8a7740_da .register_type = SH_ETH_REG_GIGABIT, + .edtrr_trns = EDTRR_TRNS_GETHER, .ecsr_value = ECSR_ICD | ECSR_MPD, .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | @@ -687,6 +689,7 @@ static struct sh_eth_cpu_data rcar_gen1_ .register_type = SH_ETH_REG_FAST_RCAR, + .edtrr_trns = EDTRR_TRNS_ETHER, .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD, .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ADEIP | EESIPR_ECIIP | @@ -716,6 +719,7 @@ static struct sh_eth_cpu_data rcar_gen2_ .register_type = SH_ETH_REG_FAST_RCAR, + .edtrr_trns = EDTRR_TRNS_ETHER, .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD, .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, @@ -765,6 +769,7 @@ static struct sh_eth_cpu_data sh7724_dat .register_type = SH_ETH_REG_FAST_SH4, + .edtrr_trns = EDTRR_TRNS_ETHER, .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD, .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ADEIP | EESIPR_ECIIP | @@ -809,6 +814,7 @@ static struct sh_eth_cpu_data sh7757_dat .register_type = SH_ETH_REG_FAST_SH4, + .edtrr_trns = EDTRR_TRNS_ETHER, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP | EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP | @@ -884,6 +890,7 @@ static struct sh_eth_cpu_data sh7757_dat .register_type = SH_ETH_REG_GIGABIT, + .edtrr_trns = EDTRR_TRNS_GETHER, .ecsr_value = ECSR_ICD | ECSR_MPD, .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | @@ -925,6 +932,7 @@ static struct sh_eth_cpu_data sh7734_dat .register_type = SH_ETH_REG_GIGABIT, + .edtrr_trns = EDTRR_TRNS_GETHER, .ecsr_value = ECSR_ICD | ECSR_MPD, .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | @@ -963,6 +971,7 @@ static struct sh_eth_cpu_data sh7763_dat .register_type = SH_ETH_REG_GIGABIT, + .edtrr_trns = EDTRR_TRNS_GETHER, .ecsr_value = ECSR_ICD | ECSR_MPD, .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | @@ -995,6 +1004,7 @@ static struct sh_eth_cpu_data sh7619_dat .register_type = SH_ETH_REG_FAST_SH3_SH2, + .edtrr_trns = EDTRR_TRNS_ETHER, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP | EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP | @@ -1015,6 +1025,7 @@ static struct sh_eth_cpu_data sh771x_dat .register_type = SH_ETH_REG_FAST_SH3_SH2, + .edtrr_trns = EDTRR_TRNS_ETHER, .eesipr_value = EESIPR_RFCOFIP | EESIPR_ECIIP | EESIPR_FTCIP | EESIPR_TDEIP | EESIPR_TFUFIP | EESIPR_FRIP | EESIPR_RDEIP | EESIPR_RFOFIP | @@ -1094,14 +1105,6 @@ static void read_mac_address(struct net_ } } -static u32 sh_eth_get_edtrr_trns(struct sh_eth_private *mdp) -{ - if (sh_eth_is_gether(mdp) || sh_eth_is_rz_fast_ether(mdp)) - return EDTRR_TRNS_GETHER; - else - return EDTRR_TRNS_ETHER; -} - struct bb_info { void (*set_gate)(void *addr); struct mdiobb_ctrl ctrl; @@ -1741,9 +1744,9 @@ static void sh_eth_error(struct net_devi sh_eth_tx_free(ndev, true); /* SH7712 BUG */ - if (edtrr ^ sh_eth_get_edtrr_trns(mdp)) { + if (edtrr ^ mdp->cd->edtrr_trns) { /* tx dma start */ - sh_eth_write(ndev, sh_eth_get_edtrr_trns(mdp), EDTRR); + sh_eth_write(ndev, mdp->cd->edtrr_trns, EDTRR); } /* wakeup */ netif_wake_queue(ndev); @@ -2502,8 +2505,8 @@ static int sh_eth_start_xmit(struct sk_b mdp->cur_tx++; - if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp))) - sh_eth_write(ndev, sh_eth_get_edtrr_trns(mdp), EDTRR); + if (!(sh_eth_read(ndev, EDTRR) & mdp->cd->edtrr_trns)) + sh_eth_write(ndev, mdp->cd->edtrr_trns, EDTRR); return NETDEV_TX_OK; } 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 @@ -479,6 +479,7 @@ struct sh_eth_cpu_data { /* mandatory initialize value */ int register_type; + u32 edtrr_trns; u32 eesipr_value; /* optional initialize value */