From patchwork Thu Feb 9 15:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 13134722 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 65D00C636D6 for ; Thu, 9 Feb 2023 15:15:35 +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=nZUOfw1YBLU4A+Epvj4tuTwUNA3lQC4/LkeKakWBHQY=; b=QI+1u/HmwTCmql eEN0S4b0JHHBGHQvGTDqN5S/r2OMEcvs1MCEdxuyQKqovLEUgzKXhArSmjRVva/bRXVJ3WYlEsbSQ UWHV1agbPr9vdx8jxOmnAebhtI2q2TyhyxJ9mP3rn006JyypIwiOzFJRQGekXdDypwIgEGeD2wKfX ZDxEAqvN1ci9ET7a54uX7p0D5zcrok2tvudtFJvdy9WQYb9aFP8MABNtItRsT9768CcpN20SqSJ85 FdafmimSpzLEy7S0cpHaKc9Fb1EN737cLI/V9qALyKDXfz93am4oBWMC2X8LmXO28Weem+ZGO2ytq QKJO/QN3YstV/kUgEm8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ8d7-0028Hc-L1; Thu, 09 Feb 2023 15:14:33 +0000 Received: from relay11.mail.gandi.net ([2001:4b98:dc4:8::231]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pQ8cv-0028DT-PT for linux-arm-kernel@lists.infradead.org; Thu, 09 Feb 2023 15:14:23 +0000 Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id C3FEA10000E; Thu, 9 Feb 2023 15:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955660; 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=1zV1VFrWVhQ6vhXF/fCLwcz9IjHBuYzryMaqXBU05Vo=; b=mg31+fwmnqE8u7cGEi/QGe/SMl4+BaYKkpQi1C+HTGPppCfF+Fha0WJeq4chwPPf2489cK 2zMxvzC6h+MfgiCzZEBddNfqlAo0C5/EcRXdb+fqm89SdLoxwZ0gFn1jHBP4/B5jBsApVK DokxQO5wmtMmkBJJ30Z4uZUnRmZmIP3opk9DRGl10MawKt37a4xL7RBgOqjOJPAqCoKChQ 1W2UE3sxFea/w39bZ5kTSPnoHicRv+Gei5bvsQKM+0pHu7d8EO2pcyPOUGTnd6WJNgTsrG msyjEBkI3aUeXQ9Z4S82IPRPmXfJgYlXJZbRVuKucSIFlptwK2SvpsWEJbuA1g== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Sergey Shtylyov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Geert Uytterhoeven , Magnus Damm , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Russell King , Wong Vee Khee , =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Kurt Kanzenbach , Revanth Kumar Uppala , Tan Tee Min Cc: Thomas Petazzoni , Herve Codina , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Mohammad Athari Bin Ismail , Jon Hunter , netdev@vger.kernel.org, linux-renesas-soc@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: [PATCH net-next v3 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function Date: Thu, 9 Feb 2023 16:16:27 +0100 Message-Id: <20230209151632.275883-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230209151632.275883-1-clement.leger@bootlin.com> References: <20230209151632.275883-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230209_071422_169122_7BA2742B X-CRM114-Status: GOOD ( 12.75 ) 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 When using this PCS with the stmmac IP, if the pcs is not configured and enabled before setting up stmmac hardware, driver setup will fail due to the lack of input RGMII RX clock. Add pcs_early_setup() function which allows to configure the MIIC converter based on the "phy-mode" that is described in the device-tree. Signed-off-by: Clément Léger --- drivers/net/pcs/pcs-rzn1-miic.c | 12 ++++++++++++ include/linux/pcs-rzn1-miic.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c index c1424119e821..e2eaf789c4d2 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -288,6 +288,18 @@ static const struct phylink_pcs_ops miic_phylink_ops = { .pcs_link_up = miic_link_up, }; +int miic_early_setup(struct phylink_pcs *pcs, struct device *dev) +{ + int interface; + + interface = device_get_phy_mode(dev); + if (interface < 0) + return interface; + + return miic_config(pcs, 0, interface, NULL, false); +} +EXPORT_SYMBOL(miic_early_setup); + struct phylink_pcs *miic_create(struct device *dev, struct device_node *np) { struct platform_device *pdev; diff --git a/include/linux/pcs-rzn1-miic.h b/include/linux/pcs-rzn1-miic.h index 56d12b21365d..84d7130b4b78 100644 --- a/include/linux/pcs-rzn1-miic.h +++ b/include/linux/pcs-rzn1-miic.h @@ -9,8 +9,11 @@ #define __LINUX_PCS_MIIC_H struct phylink; +struct phylink_pcs; struct device_node; +int miic_early_setup(struct phylink_pcs *pcs, struct device *dev); + struct phylink_pcs *miic_create(struct device *dev, struct device_node *np); void miic_destroy(struct phylink_pcs *pcs);