From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2D70C3A5A1 for ; Thu, 22 Aug 2019 14:28:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7703121726 for ; Thu, 22 Aug 2019 14:28:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IVOIdgkv"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="rCPArFXY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7703121726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VKM2pXq50bxXcYiGamF2O2qi8rJNlwhrxzYYpY0Lryw=; b=IVOIdgkv508LgA MzMXMq+EO4TkoQ1yJA2/lCdC9tn6Om7Uk8AKDkQVBTycTo/TyBX6eVCwEziThjTlBtjqVEKe1nnY3 AiE643qH1xYbLOGdj1olIXWt42aWxtTGn/bxBun0iCu1eVaBTRXZ8cAVkQ99Tc/7/xWzfP5clBm+b FFVpcYg4Ns4BF6vAyEY+wCjdbbI9sAuntlPg1BTZWp49EKUcrqWfeUYpM9JILzje3Eni/U+yYZHsf UHoFYcZ3OmoxdI8L0s2vqVK+8vOa7klwHJhT1X1wM87yDskT5KwZTEsH2AG2jvSCAQ1srjvZHfUHb S3bzaezQVLijxLbBQgTA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i0o4T-0005bn-I1; Thu, 22 Aug 2019 14:28:13 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i0o4P-0005a7-CK; Thu, 22 Aug 2019 14:28:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fg0ublZzgw0A5Szj0n+RkN+2zqyaQU5CTNzjkTpcOJ8=; b=rCPArFXYhmfM98sv0h9BelJSm tbLpRAGrRGuQ3+j/EAJjtdH6ZkCsUUaoDtmTMMxj6z5sF9GJkzLhO2vNR06oxoTYCmTOzM73rRrfr axkoasy9w9Yot1Q5SnpyRIdAyUDkhwOzUJ9xUFvEAEZR2U3clyZB6xvJFg9iL53Ms8AGzesHd0GLw kbYuB6Kff4HYqNQni9GCj/Wkr+JELdcecTABRBjmfS+P8tw8aZgxh6M2Rp+OdDzfvhhJTYhicfeVE owyJGvIEzxW0IXGZmfjzojfLYd/fpHEC6q36/hgE0wG78WGF7yYfn/BqeI5t1nEEWRvCHlpW/+Y9N 7JzH9RBNw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:59702) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1i0o43-00078p-7T; Thu, 22 Aug 2019 15:27:47 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1i0o3w-0007kt-33; Thu, 22 Aug 2019 15:27:40 +0100 Date: Thu, 22 Aug 2019 15:27:40 +0100 From: Russell King - ARM Linux admin To: =?iso-8859-1?Q?Ren=E9?= van Dorst Subject: Re: [PATCH net-next v2 1/3] net: ethernet: mediatek: Add basic PHYLINK support Message-ID: <20190822142739.GS13294@shell.armlinux.org.uk> References: <20190821144336.9259-1-opensource@vdorst.com> <20190821144336.9259-2-opensource@vdorst.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190821144336.9259-2-opensource@vdorst.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190822_072809_575787_F38958C1 X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nelson Chang , Frank Wunderlich , netdev@vger.kernel.org, Sean Wang , linux-mips@vger.kernel.org, linux-mediatek@lists.infradead.org, John Crispin , Matthias Brugger , Stefan Roese , "David S . Miller" , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 21, 2019 at 04:43:34PM +0200, Ren=E9 van Dorst wrote: > +static void mtk_mac_link_down(struct phylink_config *config, unsigned in= t mode, > + phy_interface_t interface) > +{ > + struct mtk_mac *mac =3D container_of(config, struct mtk_mac, > + phylink_config); > = > - return 0; > + mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id)); > } You set the MAC_MCR_FORCE_MODE bit here... > +static void mtk_mac_link_up(struct phylink_config *config, unsigned int = mode, > + phy_interface_t interface, > + struct phy_device *phy) > { > + struct mtk_mac *mac =3D container_of(config, struct mtk_mac, > + phylink_config); > + u32 mcr =3D mtk_r32(mac->hw, MTK_MAC_MCR(mac->id)); > = > + mcr |=3D MAC_MCR_TX_EN | MAC_MCR_RX_EN; > + mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); > +} Looking at this, a link_down() followed by a link_up() would result in this register containing MAC_MCR_FORCE_MODE | MAC_MCR_TX_EN | MAC_MCR_RX_EN ? Is that actually correct? (MAC_MCR_FORCE_LINK isn't set, so it looks to me like it still forces the link down.) Note that link up/down forcing should not be done for in-band AN. > +static void mtk_validate(struct phylink_config *config, > + unsigned long *supported, > + struct phylink_link_state *state) > +{ > + struct mtk_mac *mac =3D container_of(config, struct mtk_mac, > + phylink_config); > + __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) =3D { 0, }; > = > + if (state->interface !=3D PHY_INTERFACE_MODE_NA && > + state->interface !=3D PHY_INTERFACE_MODE_MII && > + state->interface !=3D PHY_INTERFACE_MODE_GMII && > + !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_RGMII) && > + phy_interface_mode_is_rgmii(state->interface)) && > + !(MTK_HAS_CAPS(mac->hw->soc->caps, MTK_TRGMII) && > + !mac->id && state->interface =3D=3D PHY_INTERFACE_MODE_TRGMII)) { > + linkmode_zero(supported); > + return; > } > = > + phylink_set_port_modes(mask); > + phylink_set(mask, Autoneg); > = > + if (state->interface =3D=3D PHY_INTERFACE_MODE_TRGMII) { > + phylink_set(mask, 1000baseT_Full); > + } else { > + phylink_set(mask, 10baseT_Half); > + phylink_set(mask, 10baseT_Full); > + phylink_set(mask, 100baseT_Half); > + phylink_set(mask, 100baseT_Full); > + > + if (state->interface !=3D PHY_INTERFACE_MODE_MII) { > + phylink_set(mask, 1000baseT_Half); > + phylink_set(mask, 1000baseT_Full); > + phylink_set(mask, 1000baseX_Full); > + } > + } > = > + phylink_set(mask, Pause); > + phylink_set(mask, Asym_Pause); > = > + linkmode_and(supported, supported, mask); > + linkmode_and(state->advertising, state->advertising, mask); > } This looks fine. Thanks. -- = RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps = up According to speedtest.net: 11.9Mbps down 500kbps up _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel