From patchwork Wed Jan 3 14:28:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Romain Gantois X-Patchwork-Id: 13510133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 15D44C3DA6E for ; Wed, 3 Jan 2024 14:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ed3xt++HLw/MO931nfTo4F52XSx9LDJirjXIH/wCIps=; b=zRb5NeGxb3+/Ws JaKTP6Z4DJWTI8u6ZNoqWdEpPe8RGy6dz9RdnxQsh31I9bqRNamSqUQ8SYdlUFA7RWHYx2jF5elMf vlZpHzhbt7TJC1ZsDeLQVQ0NImHWlpWaLuBJpRuCtfm6zUiCxtloUX9JJcCM4fOAsSuOspT1vHowX 5IpVxRmpK0YxQT3g5pflAfXR4pKRUo6H61da8YBl3CDXNzHalSktFYtKBvFq6gcu4bEO2gkkvcihz 14XU4S7/o+OP8WAnHoZJvkwmQyjDBYnk4tnaaDgLJwH+cmLAXUPcGfKNvtPHx9jMqmLE/6pXywlbC zY2SiPj3vqJ5SnrrRAwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rL2EU-00B6Qe-1W; Wed, 03 Jan 2024 14:28:34 +0000 Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rL2EQ-00B6Mg-1G for linux-arm-kernel@lists.infradead.org; Wed, 03 Jan 2024 14:28:32 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 043CD6000D; Wed, 3 Jan 2024 14:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1704292109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hmed1jEpoZI+pixYHArlZGQKHPpdNarPzqdiGktR7JI=; b=NLIgcVMNlWi0/VrDdnLc+QqsaPfWKXhZvk1NqViiDyZoMs1+PEZ28REKDlv2RaCmv99Ia7 O3cKXIDjObnrrQ3k0kn9fwsvvKqeQYbdKq+GSSSPXeT6XihHjUEddonlcvdgea4nUuiYj3 FfWkiCOgoXFtcJjzjK2S9E9j3GmrLOlKufDkFOhe7QRchKn+MgCN8eO0Z8lB6sJEzSZtQ3 h4YuROcxNvOczQb+kJni36zKsewpgKSiObzwFvhwbiPjq3rGXm0z+aQI92ISmJuj5KketI D1tZS5HrIcfnYpp1E8jLoIKm6Ii3WoXpr7EpCo0gY1IqmDHEW5buHcXJxCOeYQ== From: Romain Gantois To: Alexandre Torgue , Jose Abreu , Russell King , Andrew Lunn , Jakub Kicinski , Heiner Kallweit Cc: Romain Gantois , "David S. Miller" , Eric Dumazet , Paolo Abeni , Maxime Coquelin , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Marek Vasut , Clark Wang , Miquel Raynal , Sylvain Girard , Pascal EBERHARD , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net 5/5] net: pcs: rzn1-miic: Init RX clock early if MAC requires it Date: Wed, 3 Jan 2024 15:28:25 +0100 Message-ID: <20240103142827.168321-6-romain.gantois@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240103142827.168321-1-romain.gantois@bootlin.com> References: <20240103142827.168321-1-romain.gantois@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: romain.gantois@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240103_062830_585771_D92CAD2C X-CRM114-Status: GOOD ( 12.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The GMAC1 controller in the RZN1 IP requires the RX MII clock signal to be started before it initializes its own hardware, thus before it calls phylink_start. Check the rxc_always_on pcs flag and enable the clock signal during the link validation phase. Reported-by: Clément Léger Link: https://lore.kernel.org/linux-arm-kernel/20230116103926.276869-4-clement.leger@bootlin.com/ Signed-off-by: Romain Gantois --- drivers/net/pcs/pcs-rzn1-miic.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c index 97139c07130f..bf796491b826 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -271,12 +271,20 @@ static void miic_link_up(struct phylink_pcs *pcs, unsigned int mode, static int miic_validate(struct phylink_pcs *pcs, unsigned long *supported, const struct phylink_link_state *state) { - if (phy_interface_mode_is_rgmii(state->interface) || - state->interface == PHY_INTERFACE_MODE_RMII || - state->interface == PHY_INTERFACE_MODE_MII) - return 1; + int ret = 1; - return -EINVAL; + if (!phy_interface_mode_is_rgmii(state->interface) && + state->interface != PHY_INTERFACE_MODE_RMII && + state->interface != PHY_INTERFACE_MODE_MII) + return -EINVAL; + + if (pcs->rxc_always_on) { + ret = miic_config(pcs, 0, state->interface, NULL, false); + if (ret) + pr_err("Error: Failed to init RX clock in RZN1 MIIC PCS!"); + } + + return ret; } static const struct phylink_pcs_ops miic_phylink_ops = {