From patchwork Sun Jan 14 17:47:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10162707 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 4F2F460245 for ; Sun, 14 Jan 2018 17:52:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 404EC289F0 for ; Sun, 14 Jan 2018 17:52:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3564E28A6C; Sun, 14 Jan 2018 17:52:10 +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 AD41D289F0 for ; Sun, 14 Jan 2018 17:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920AbeANRwH (ORCPT ); Sun, 14 Jan 2018 12:52:07 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:46652 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751823AbeANRwE (ORCPT ); Sun, 14 Jan 2018 12:52:04 -0500 Received: by mail-lf0-f68.google.com with SMTP id a12so10828948lfe.13 for ; Sun, 14 Jan 2018 09:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=oCq493eEqIh5xRbKXckGAnMGm+F0X2Roovxz55SRoM0=; b=yUW4n3hbmyLE+LLWG27Nbnnoi7aSj18I3V4lS2uHwzE4ZPR3IadMlLNCz/KkzbNbtO t9VkiZysANRhiqqwBLmBKiaPr0qmTP/yKb5KDs6vNtJc8TdFVcgAcBFIKAvqYPYAIkaa tXWxllCgCZukfjytsgq2Wv/W1mJ3HmZRX/bgQAS9Zi5i62ok26543x3GNBskNLm3Kv7r DpkZdKfjoNd6AhheC9/xHjG/n6LxNiN+sIaHMLZnXFKD1Ife+G+5hJ71IRKGxKoHMjgW GFFIMIuXtQ40rLjds4alqkzgiAlnqBqLYehuFXXWjaz80pOydK4OSNVi3DXkKUIfDRRN IDmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=oCq493eEqIh5xRbKXckGAnMGm+F0X2Roovxz55SRoM0=; b=TrEALQUJSBLS3qfTd+bHCnNPm8ocUDeSbmUihknpaHFOBlzaTY3wLLai4gIcHRlf5L zrkoLUQFzDnMruumaQ4tSpoRT2cmb6OLhxIGh5Tabk+7XeFr14/ImGgpCfhZI1gCrqBX X8flFpVpNxfwOwY4WBw/YJzVu35rZv3xBuFOeaQy34+LgL5RT7cO+etRiTjRREwGlfwn nHjEVm3JJyx0NpEkqUvkQztryfjdx77YhJlo+WCReWWL5uKUlkioWmC+rQlkJn7rjEpC HE5VsaID3Cmsct+lE8F2ztJ9CyoEz7APubS+PibEsCf/Y2YuPnyWF5KoRaXXifGQxCQE amCw== X-Gm-Message-State: AKwxyte1Dq/kLf/AxPauns67tlJDe/pJApfZFnXXzeSm/gJq29Ph5n0w ++SkEyA7DuLi9Giv2GxQk0h+PA== X-Google-Smtp-Source: ACJfBou0tWNccbYEog1dYW4ce5lcxdVp9p4pMHa2Ted9pa8Uu38ucuETkiq0s/ga2SCbvvuIt4fJew== X-Received: by 10.46.54.12 with SMTP id d12mr13779320lja.26.1515952322955; Sun, 14 Jan 2018 09:52:02 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.87.9]) by smtp.gmail.com with ESMTPSA id h78sm319784lfb.14.2018.01.14.09.52.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Jan 2018 09:52:02 -0800 (PST) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Sun, 14 Jan 2018 20:51:59 +0300 Message-Id: <20180114175159.604307495@cogentembedded.com> User-Agent: quilt/0.64 Date: Sun, 14 Jan 2018 20:47:43 +0300 To: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: linux-sh@vger.kernel.org, Sergei Shtylyov Subject: [PATCH 1/2] sh_eth: gather all TSU init code in one place MIME-Version: 1.0 Content-Disposition: inline; filename=sh_eth-gather-all-TSU-init-code-in-one-place.patch 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 sh_eth_cpu_data::chip_reset() method always resets using ARSTR and this register is always located at the start of the TSU register region. Therefore, we can only call this method if we know TSU is there and thus simplify the probing code a bit... Signed-off-by: Sergei Shtylyov Reviewed-by: Geert Uytterhoeven --- drivers/net/ethernet/renesas/sh_eth.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 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 @@ -3222,7 +3222,6 @@ static int sh_eth_drv_probe(struct platf eth_hw_addr_random(ndev); } - /* ioremap the TSU registers */ if (mdp->cd->tsu) { struct resource *rtsu; @@ -3243,6 +3242,7 @@ static int sh_eth_drv_probe(struct platf ret = -EBUSY; goto out_release; } + /* ioremap the TSU registers */ mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start, resource_size(rtsu)); if (!mdp->tsu_addr) { @@ -3252,14 +3252,12 @@ static int sh_eth_drv_probe(struct platf } mdp->port = devno % 2; ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER; - } - /* Need to init only the first port of the two sharing a TSU */ - if (devno % 2 == 0) { - if (mdp->cd->chip_reset) - mdp->cd->chip_reset(ndev); + /* Need to init only the first port of the two sharing a TSU */ + if (devno % 2 == 0) { + if (mdp->cd->chip_reset) + mdp->cd->chip_reset(ndev); - if (mdp->cd->tsu) { /* TSU init (Init only)*/ sh_eth_tsu_init(mdp); }