Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp477506rdf; Tue, 21 Nov 2023 07:45:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHejaGfKN9kZssqHL68NJzfmhy85L0jmrnv7mj5sgelxOcGhgJ8+tdOJqUeNX19ix8khl6B X-Received: by 2002:a05:6a00:17a9:b0:6be:265:1bf6 with SMTP id s41-20020a056a0017a900b006be02651bf6mr10785402pfg.32.1700581542599; Tue, 21 Nov 2023 07:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700581542; cv=none; d=google.com; s=arc-20160816; b=RUSxg19wgvINhCLsKwKCVI7Q0LEPL2jcsZHsDgroyJYPMU5/TeFp6DGJTQp3OnOisp cUrV9rCDYUTLmdHEDAWARI881yaR+EulQEWjU/a79obDQGpf+emKZaRkcTco/qHidAPw Ir0RW07QscSOZ8/1cUCVY89yedxeHDDpbwReczzdAfWVf0swLOw5uT+82WuwF5MPEsXU Yc7b+nmyUI/K6XjoyVp1Vy4gG7En4VpJdte1e76j2osPOccYKdwjOG8aYbrLUXoWal0e QN533/I76+ZtXiniVfcxTB1vg5qNE3q3jIHe/+gUcB1rpN75vl7qyqggLPy4be2ww40F APOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=t92OZKOw/jrPAQGH9Id5OLcQ57oFZcBBd4j/l0YdMEI=; fh=Iz+dyluSrN8PKBtnOKXFa6VJbuEuYKxHAoQtkdUIrsg=; b=hpXh6QFU+1DOf3KeVOFFwRt46K2S/M8xQRe4t5EdAR6tyvqPZcFPG2BlgDX2vkvicx 501//IJ1VzWuQoNv20bUplejL6IP7UymnW5Teo386oBCmpzXNmOhYj7OHVj8tKY+0RDe 2T1DDs67m2Ne/3YWwj7lO4QUjhzNYF6ORedtFbCq/y23nQW+g79P2vN5Ur0rEZ6v58o5 H9TDgH2dQ+9OR/A3XHEOg3XP5SBNQdpZm4aBGKwY216nWw3KQem1oGZcviy0PznfaMwn lC2RW0KWOuUSD4sVL9u1Yhhnn9glaZ0zPvLZmYup1SBEfxQ6kawO3ARwbqHCqQHCnGFA WckQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=zQcVP1tj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cl22-20020a056a02099600b005c1ce3c9609si11567161pgb.889.2023.11.21.07.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 07:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=zQcVP1tj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 08E3A804C512; Tue, 21 Nov 2023 07:45:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234622AbjKUPpj (ORCPT + 99 others); Tue, 21 Nov 2023 10:45:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbjKUPph (ORCPT ); Tue, 21 Nov 2023 10:45:37 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C43699; Tue, 21 Nov 2023 07:45:34 -0800 (PST) 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-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=t92OZKOw/jrPAQGH9Id5OLcQ57oFZcBBd4j/l0YdMEI=; b=zQcVP1tj2x+6QgwU5DhcqEIUQY buB/Vaulv/SCpMKjnIBt8ycB21gewTRNGaJirCKmo8W5ZByxhufVBsmGFcptOxIMiosfPQc9fzMVY u/btbit81Q8tJPUj1IFDpT1pt7YvkyELqTVNGQRt0lSGBoA42juDjYsO+mx4J6ExZrevfjoZbD4Li DTooEckGVI2tSQaSJATq6Z6LXxs4ELmvwPX3id6aKyZIXTLbg/DsHp5zp1hJ5/NSP8aFvrZY/ip/X Q2y/T1+duxQsEClo+Sz/zjTseQ1sMP/RsF3P+clz05QsscjBfFhFymXfje9SaWdu4vZYZbsAScJdL 7juCgNPw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:59934) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1r5Sw6-0007Qc-0N; Tue, 21 Nov 2023 15:45:14 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1r5Sw3-0004In-UY; Tue, 21 Nov 2023 15:45:11 +0000 Date: Tue, 21 Nov 2023 15:45:11 +0000 From: "Russell King (Oracle)" To: Tomer Maimon Cc: davem@davemloft.net, edumazet@google.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, alexandre.torgue@foss.st.com, peppe.cavallaro@st.com, joabreu@synopsys.com, mcoquelin.stm32@gmail.com, avifishman70@gmail.com, tali.perry1@gmail.com, joel@jms.id.au, andrew@codeconstruct.com.au, venture@google.com, yuenn@google.com, benjaminfair@google.com, j.neuschaefer@gmx.net, openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 2/2] net: stmmac: Add NPCM support Message-ID: References: <20231121151733.2015384-1-tmaimon77@gmail.com> <20231121151733.2015384-3-tmaimon77@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231121151733.2015384-3-tmaimon77@gmail.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 07:45:41 -0800 (PST) On Tue, Nov 21, 2023 at 05:17:33PM +0200, Tomer Maimon wrote: > Add Nuvoton NPCM BMC SoCs support to STMMAC dwmac driver. > > And modify MAINTAINERS to add a new F: entry for this driver. > > Signed-off-by: Tomer Maimon A few comments on this... > +#define IND_AC_BA_REG 0x1FE > +#define SR_MII_CTRL 0x3E0000 > + > +#define PCS_SR_MII_CTRL_REG 0x0 > +#define PCS_SPEED_SELECT6 BIT(6) > +#define PCS_AN_ENABLE BIT(12) > +#define PCS_SPEED_SELECT13 BIT(13) > +#define PCS_RST BIT(15) include/uapi/linux/mii.h: #define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ #define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ #define BMCR_SPEED100 0x2000 /* Select 100Mbps */ #define BMCR_RESET 0x8000 /* Reset to default state */ Look familiar? Maybe use the standard definitions for a standardised register? > +void npcm_dwmac_pcs_init(struct npcm_dwmac *dwmac, struct device *dev, > + struct plat_stmmacenet_data *plat_dat) > +{ > + u16 val; > + > + iowrite16((u16)(SR_MII_CTRL >> 9), dwmac->reg + IND_AC_BA_REG); > + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); > + val |= PCS_RST; > + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); > + > + while (val & PCS_RST) > + val = ioread16(dwmac->reg + PCS_SR_MII_CTRL_REG); What if the PCS never clears its reset bit? Maybe use read_poll_timeout() ? > + > + val &= ~(PCS_AN_ENABLE); > + iowrite16(val, dwmac->reg + PCS_SR_MII_CTRL_REG); > +} Also, maybe it's time to require new stmmac platform support to start making use of the phylink PCS support rather than continuing to code its own? I notice, however, that you always disable inband signalling - please explain why. Also, what protocol does the PCS use when communicating with the PHY? -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!