From patchwork Thu Jul 19 11:51:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 10534221 X-Patchwork-Delegate: geert@linux-m68k.org 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 A4E15600D0 for ; Thu, 19 Jul 2018 11:49:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93F2828FE6 for ; Thu, 19 Jul 2018 11:49:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 881EA29131; Thu, 19 Jul 2018 11:49:13 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 6408428FFE for ; Thu, 19 Jul 2018 11:49:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730443AbeGSMb7 (ORCPT ); Thu, 19 Jul 2018 08:31:59 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42246 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbeGSMb6 (ORCPT ); Thu, 19 Jul 2018 08:31:58 -0400 Received: by mail-pg1-f193.google.com with SMTP id y4-v6so3537583pgp.9 for ; Thu, 19 Jul 2018 04:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=XfSB/sdvd+MLvTS8zZxoU4QqeChr3XazRpKVfMUpRO0=; b=Z/9tgn9iJp3Fs8eqty7wfcCh6s242uwKayieikoX0mGFkMRhf0EPqqVya0EmM2lhA+ zc9Dcu2p79HGWKcsrA7Eqh7v63JKuv74FVDFss+yyXFFTnPvDrcJlYY3vpSsvQB2+jVe Aff3F8hchdnDDGWrtyyZSCh2zY9jm29Mo7vLg60mIxUnAI0jkH7wJCZmljMWG5FkibLL XYz3w97hXuJdRJi2JAABPZqkEFbwMYBtcfoG6Tgp7pqIb6GfTjqdOaWMeGd89U1SkmKO 5BlWTzmklfeUID2WJl6r4T/N/iJrhQYYBvgXRDFBUyegdFRtkK6CfWQV3jZ3asg/1JxD THvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:date:message-id:in-reply-to :references:subject; bh=XfSB/sdvd+MLvTS8zZxoU4QqeChr3XazRpKVfMUpRO0=; b=ENzvTVk+6e5Hgm+Lzt2TIlYA+nfQnSE1w3f8ihK0qbnz9Nr2+H1kt2Tc/P/VfzFb8Z v/NLcBuFV8j+0j2CvBle/IlqQvg1aRnYkvbbgKpmpnbRlxr4VxwbydOIQ5w6rnt8wLfo W0dbKSFDOrtGsYsRzzsX8sHb0K5dZq/pxqvRvpcNzLDzRKBrXoZfFUvKpAMPjL2YHn8J e0w4c+sEDitM9L8OyOxp8GVTuZ1wTcauR1OgjhK7B5emycmFzqbnownGfj+haHwy4qNL U1tatJjq23hO64HOod45xLq1+xbUhmsmz1ysVLcPckCQeQeWuAyQdgsg0EFNYfUehhTf aypw== X-Gm-Message-State: AOUpUlEhsEo4DUXnS8oN5dKz5+yaLN/3tethwKSpH1+GDTbO1pvJwYKW zJl4l8mRWGgLBO874RpTEOJVcxET X-Google-Smtp-Source: AAOMgpft5AallsmPPFGSwAmJdPrIU5VhKAi253zC9mS9vkaaA6GkUXcx7rh11CKFPQfLfxdLywFHlw== X-Received: by 2002:a62:4a41:: with SMTP id x62-v6mr9273700pfa.45.1532000950601; Thu, 19 Jul 2018 04:49:10 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id b1-v6sm9879142pff.141.2018.07.19.04.49.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 04:49:09 -0700 (PDT) From: Magnus Damm To: linux-renesas-soc@vger.kernel.org Cc: Magnus Damm Date: Thu, 19 Jul 2018 20:51:15 +0900 Message-Id: <153200107566.13504.725250500519176904.sendpatchset@little-apple> In-Reply-To: <153200105784.13504.12882377600823578834.sendpatchset@little-apple> References: <153200105784.13504.12882377600823578834.sendpatchset@little-apple> Subject: [PATCH/RFC 02/02] ravb: Clean up duplex handling Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Magnus Damm Since only full-duplex operation is supported by the hardware, remove duplex handling code and keep the register setting of ECMR.DM fixed at 1. This updates the driver implementation to follow the data sheet text "This bit should always be set to 1." Not-Yet-Signed-off-by: Magnus Damm Reviewed-by: Sergei Shtylyov --- Written on top of renesas-drivers-2018-07-17-v4.18-rc5 drivers/net/ethernet/renesas/ravb.h | 1 - drivers/net/ethernet/renesas/ravb_main.c | 26 +------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) --- 0001/drivers/net/ethernet/renesas/ravb.h +++ work/drivers/net/ethernet/renesas/ravb.h 2018-07-19 19:43:11.830607110 +0900 @@ -1027,7 +1027,6 @@ struct ravb_private { phy_interface_t phy_interface; int msg_enable; int speed; - int duplex; int emac_irq; enum ravb_chip_id chip_id; int rx_irqs[NUM_RX_QUEUE]; --- 0003/drivers/net/ethernet/renesas/ravb_main.c +++ work/drivers/net/ethernet/renesas/ravb_main.c 2018-07-19 19:44:14.370607110 +0900 @@ -85,13 +85,6 @@ static int ravb_config(struct net_device return error; } -static void ravb_set_duplex(struct net_device *ndev) -{ - struct ravb_private *priv = netdev_priv(ndev); - - ravb_modify(ndev, ECMR, ECMR_DM, priv->duplex ? ECMR_DM : 0); -} - static void ravb_set_rate(struct net_device *ndev) { struct ravb_private *priv = netdev_priv(ndev); @@ -401,13 +394,11 @@ error: /* E-MAC init function */ static void ravb_emac_init(struct net_device *ndev) { - struct ravb_private *priv = netdev_priv(ndev); - /* Receive frame limit set register */ ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); /* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */ - ravb_write(ndev, ECMR_ZPF | (priv->duplex ? ECMR_DM : 0) | + ravb_write(ndev, ECMR_ZPF | ECMR_DM | (ndev->features & NETIF_F_RXCSUM ? ECMR_RCSC : 0) | ECMR_TE | ECMR_RE, ECMR); @@ -982,12 +973,6 @@ static void ravb_adjust_link(struct net_ bool new_state = false; if (phydev->link) { - if (phydev->duplex != priv->duplex) { - new_state = true; - priv->duplex = phydev->duplex; - ravb_set_duplex(ndev); - } - if (phydev->speed != priv->speed) { new_state = true; priv->speed = phydev->speed; @@ -1004,7 +989,6 @@ static void ravb_adjust_link(struct net_ new_state = true; priv->link = 0; priv->speed = 0; - priv->duplex = -1; if (priv->no_avb_link) ravb_rcv_snd_disable(ndev); } @@ -1029,7 +1013,6 @@ static int ravb_phy_init(struct net_devi priv->link = 0; priv->speed = 0; - priv->duplex = -1; /* Try connecting to PHY */ pn = of_parse_phandle(np, "phy-handle", 0); @@ -1131,13 +1114,6 @@ static int ravb_set_link_ksettings(struc if (error) goto error_exit; - if (cmd->base.duplex == DUPLEX_FULL) - priv->duplex = 1; - else - priv->duplex = 0; - - ravb_set_duplex(ndev); - error_exit: mdelay(1);