From patchwork Wed Feb 8 16:41:58 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: 54494 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559541wrn; Wed, 8 Feb 2023 08:41:28 -0800 (PST) X-Google-Smtp-Source: AK7set8/1ppBCYxAzEx28If7S2pXgC6z+8i6VJUptgdngq748Sa7gSjtS+ohzxX487lS8Fevweyx X-Received: by 2002:a17:90a:4f0c:b0:230:be88:69a with SMTP id p12-20020a17090a4f0c00b00230be88069amr7069306pjh.3.1675874487815; Wed, 08 Feb 2023 08:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874487; cv=none; d=google.com; s=arc-20160816; b=aYJBfypbOuHwMRAXVfxp8/XSHajtcq6ljU/6OTB4u8lRO0S6NDeI+VhcpT4EcskyaQ dJW8kI07tuv3yvjSVFV3vTbxZ4QBRUh9Vm3Pk/jlj7HMH4YOtiUKxlPtD42oG08NZuYE 1op/5CwYicXYm0tRXodeP+9GO7EG2o/kGALbNqfqvq/7bnumnp/yy+4pYCFvA0ULA5CC J6zX5sztmnNYolbS9LsJ9PyLDtVPyjMEeVOOnaTqDTWmd3cqCCCk7S+yVt19Vig1XGqx 1WLTvvFxWLu1W6bRxPR61NpWxW1lkjCTQG6v6vd+vhCrXVUHSBQcI7c0l20erhkZBAgV MsDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1zV1VFrWVhQ6vhXF/fCLwcz9IjHBuYzryMaqXBU05Vo=; b=OR55iGtFPIOj2473uX69Y0IDdG0CoIDK9y/DVzYiLSD/nTzCcYrnCR+Yi4zvWzGvgN GtEOcCuQTjePH+sGlsu+lESs1rWqHOZh5v9/7Gm/09qulj0C4zKjaa3Use0TGf1p8/AV JdD3pnAhlpqdHkkjFfefLUEOUKoKqxNykmFuAAIL8wSmAcMvf5oMcqCv0APUPguB6MTX PryLvBsGSbe78xTQ/zzV/WUQJ2nWKR43Rom+Xa8dup489C2Z7Yewz4nk0NjbQgiqPfl2 aBQsG1Fvjm10xix3q67UiOalQIvJ2qSzBnVLsVjgOZkmP0iScGzG4zp5bxa1z6e7FG8r dzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="bsr2kT8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a17090a190d00b0022929341650si2685664pjg.15.2023.02.08.08.41.14; Wed, 08 Feb 2023 08:41:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="bsr2kT8/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231713AbjBHQkn (ORCPT + 99 others); Wed, 8 Feb 2023 11:40:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231634AbjBHQk2 (ORCPT ); Wed, 8 Feb 2023 11:40:28 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7740F4DBE8; Wed, 8 Feb 2023 08:40:22 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 36E231BF209; Wed, 8 Feb 2023 16:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874421; 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=bsr2kT8/fs5ycb41yzV5D54Na9MB0RfaRaz/6VBRiG9lnEj506WDX5EFWJbhJ9f9+cc+se 2srr6LKvbSutYzurG4hnAQYFcFmaPaHNO6rikx9pRpXY2XUWqXiMpwjs/rtViOJzTFcQT6 fSuuM3Mu67AGYUDEMsDt+vSQG9R7u27Msf4jnskpsYrVrHPWGbQJ1wv0eyK1brGcrBwxz8 GoVuevDB6Ep2WV7zfFfJvtWZ+K0ONsjugPgnC//YBHlj9EcDmvqagdg/CITSnvNfHpjgEm Ey22ZDxQPP28DIXD11BR4m4IZLtAV8WneDCssRBhlFWDLBNk5QYmoEHr7miOYg== 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 v2 1/6] net: pcs: rzn1-miic: add pcs_early_setup() function Date: Wed, 8 Feb 2023 17:41:58 +0100 Message-Id: <20230208164203.378153-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281766528504738?= X-GMAIL-MSGID: =?utf-8?q?1757281766528504738?= 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); From patchwork Wed Feb 8 16:41:59 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: 54496 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559917wrn; Wed, 8 Feb 2023 08:42:07 -0800 (PST) X-Google-Smtp-Source: AK7set8A7OHnQT8mYr6anHNcQATIv/co10DXPOTbVdfCfuhESb0SscWKNDUE3IQOFQeim/Wq9hdX X-Received: by 2002:a17:90a:f60a:b0:230:9ae4:b5e2 with SMTP id bw10-20020a17090af60a00b002309ae4b5e2mr7132528pjb.0.1675874527365; Wed, 08 Feb 2023 08:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874527; cv=none; d=google.com; s=arc-20160816; b=f/JleN0kGCNuUKyXoDYCqRTe+dTuw0W988bgK5PvgeOWtFtQ1/F50Y37+d4Gf+Is9s 08UjUqMcg/XR/m5FQ8w6QLk73MIoPmQ5hJf+i8jGQSAr0Wm/UPcjEjp/ZC4E9ba4DlhX vUPmbpzpuPAeWE+VEnNDNdqj/qcn0rlUSi5IbhIQ3FrHs5YVlJPkgjOO8ajd/sQHLsPk nIGLjTsAoUqMKG/QfJKkTvxnhiVpr55O1hoSExRzkYRIaTRwUEszql4NNwOWiqmTIDww KsGKeFFpvxjcGWzjzw7NlVCZfEcv8jxJqdGZzxQkJ+mb6MdhykkEGrm2OnSyQ39vn3t9 woKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yjugn/p6DcEUOMbEHX1a3CLJTImoHW8X+UJ8D0m1mfw=; b=jfOiHg9xSXrMx6P5Cz22w2OCl1Q04yU4U1ijMBjcQfR+gkOK4oN4Pw8O5Vs6HoN+0/ I6oIlLCXahqkOGu5a2N3H28/hC6yexl0iO6z/aOPpWDvqfWgNnc4424p9Lmo7I3FDMog d3FgW40zlht/45S1CbLfwhL7HLbEO6ylAciYMt+tEUhqwgK4Ba/+nT+e/m7YF1uQtFo4 7qsF4MUwa0vQv13NXYeOOxyZUwcJUlCyjVSmBqSw+esqC1yY3dd24eV7HEu7APMBKAn3 oJqcVOzpAdRQJieQNA9Sm8KC6dPjfn34El6iqLZG67FSMf9udDcYRdwd2mYvG+eULZMG esfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=efroKWgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a17090a2e8800b0023037066be7si2521941pjd.56.2023.02.08.08.41.55; Wed, 08 Feb 2023 08:42:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=efroKWgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbjBHQkq (ORCPT + 99 others); Wed, 8 Feb 2023 11:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231652AbjBHQke (ORCPT ); Wed, 8 Feb 2023 11:40:34 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E4AA38EAF; Wed, 8 Feb 2023 08:40:26 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 32FC71BF20E; Wed, 8 Feb 2023 16:40:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874425; 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=yjugn/p6DcEUOMbEHX1a3CLJTImoHW8X+UJ8D0m1mfw=; b=efroKWgHalzELppM3opEj7l3QcLSkRRBGsGCaspqY9ATTHmZ070Sce1o0fDTwZOg0IjH59 43J8xqFiYE6DknCU+selyB9+ZbzoHTzhCIuMKrLOWmHfQstNi/xtfjvFanWpP56roTj36J oIFJB7nvvhuTUbAflvNPdRD34qXr/y2k6XZ6Xsw0dyWIlmZvmKrz1ifkb+JU/so6jlTg/9 EM/SP6M/cJaGbD8b/jE/vAIazbzYYt06o61WE2eVOLdiKYJdyk03X8w6cNoop6mJYY4n7M gHGKDe9m8HUCZ4kMjnTq7n8oSRB0VARlvzMAOPwlULIUgEd15xrxMYzwEpGm9g== 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 v2 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS Date: Wed, 8 Feb 2023 17:41:59 +0100 Message-Id: <20230208164203.378153-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281808797513185?= X-GMAIL-MSGID: =?utf-8?q?1757281808797513185?= Currently, the PCS is set based on the presence of the xpcs field. In order to allow supporting other PCS, add a phylink_pcs pcs field to struct mac_device_info which is used in stmmac_mac_select_pcs() to select the correct PCS. Signed-off-by: Clément Léger --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +---- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index 6b5d96bced47..79fd67e8ab90 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #if IS_ENABLED(CONFIG_VLAN_8021Q) @@ -518,6 +519,7 @@ struct mac_device_info { const struct stmmac_tc_ops *tc; const struct stmmac_mmc_ops *mmc; struct dw_xpcs *xpcs; + struct phylink_pcs *phylink_pcs; struct mii_regs mii; /* MII register Addresses */ struct mac_link link; void __iomem *pcsr; /* vpointer to device CSRs */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index f44e4e4b4f16..9a8721227b17 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -937,10 +937,7 @@ static struct phylink_pcs *stmmac_mac_select_pcs(struct phylink_config *config, { struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev)); - if (!priv->hw->xpcs) - return NULL; - - return &priv->hw->xpcs->pcs; + return priv->hw->phylink_pcs; } static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 21aaa2730ac8..68deda5c5fa9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -513,6 +513,7 @@ int stmmac_xpcs_setup(struct mii_bus *bus) } priv->hw->xpcs = xpcs; + priv->hw->phylink_pcs = &xpcs->pcs; break; } From patchwork Wed Feb 8 16:42:00 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: 54495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559676wrn; Wed, 8 Feb 2023 08:41:43 -0800 (PST) X-Google-Smtp-Source: AK7set8q7/q30gB0F4OE1KNo+/tSSz6AYiQ4CmLZ2Hm8BSsQbcLTKjuHYIVzcpMAUGEPAkrAu6tL X-Received: by 2002:a17:902:d4c3:b0:196:86c2:ee89 with SMTP id o3-20020a170902d4c300b0019686c2ee89mr8317778plg.3.1675874502760; Wed, 08 Feb 2023 08:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874502; cv=none; d=google.com; s=arc-20160816; b=vV1/eB1xp50u1yJtfUc+tmePzqtHe6AqwSu6j+AtW86mI+0WXCi3PMXz/kINezoFm3 Sp/RHfmnibiutfRQ7KbpkFVhJG/1vWgu7UXKfergha3+T6yU6FT2x3b9/MRdr9HrSDgY BJRh+ZAFwviRyfaeq+ZXRWv8Cfg/soQqGjgWmogN0Q1tCXLW56VYxiTONu6ILhJg1K+g eWj4qS1CttYNOTzWwdgyXY3EN/iK/PQvmq964xBvUtdVQA5KxN632WrFH9K7SN069/gB ewbnVcok8AAbeXnYZZw7Ag7Q/FMN5B/BK4Ea1sS/GfXMzCGezWYC5GGUcnxEy4bKsdPa WRWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XCj30NsK+6xPXdqbwOoZtwRO/ZUoDqTO5hHn+iKnF+o=; b=CtjeUoTu5yUyWGwdz3NSjE6iUMaL/wULnBmA0LAkpgInI7sKM14r5AavTlFSH02Nle Mt9WCSBhtDQO/3WTaLYrgwEvKDFKIqWRBFtJGfuZaeSO1gVO5yVQgJBZ2t7QxVM/u2Zi kNTzA/ZgAAruwEE6cHnfMXeREEQdWTrENKj7Lpopu3Pe/iZPlmv79BbhyqGCj9jGg1mn 8tvt5JswHJYq4ExYj3b22h0NCNNPuyHRYeF4Yr2kxUqKIC85LrWUQw8vdM6cQaUO/BL1 9WHsucAF1a+gGPnqJtZI8nc5TZL1m5P6V2iG4BHhJR7huHPK/tiIEOgXw3XEmQoARpLc dOaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=GTQjKeKP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a170902d48500b001931fce6511si20593842plg.374.2023.02.08.08.41.30; Wed, 08 Feb 2023 08:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=GTQjKeKP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjBHQlE (ORCPT + 99 others); Wed, 8 Feb 2023 11:41:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231664AbjBHQkg (ORCPT ); Wed, 8 Feb 2023 11:40:36 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F37474DE0C; Wed, 8 Feb 2023 08:40:30 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A60E81BF211; Wed, 8 Feb 2023 16:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874429; 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=XCj30NsK+6xPXdqbwOoZtwRO/ZUoDqTO5hHn+iKnF+o=; b=GTQjKeKP6jCXB+susoQC6r7Wao2poP1/a4Ob8/035exSTjKkF1n85RREgusN779F90UUSp VAD+NeoYQcdm/pZDqopInkA0VBppi35mawnAN1AiQBezpmMkBa6qjkO+kqxXeAOhM34RLA zgx8CfO5qDXiseFzrakMKFj1fQ5hryT90ocK92GhvDoR93YZC8CfYFDasvnnHIjDB0kARr psn2hP2/+EyIeEdbUZY5jol+oDQaeVv02aZx6QxRwC1jcmL4xlKHhLHMHJ6dreVIiUJ8BO 2Rp3Q6RqOf4mEIor/Ahx883YWs1ka9LFFypyBrrtceDqIeQRCPr9ktk7Uj5tbw== 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 v2 3/6] net: stmmac: add support to provide pcs from platform data Date: Wed, 8 Feb 2023 17:42:00 +0100 Message-Id: <20230208164203.378153-4-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281782554910648?= X-GMAIL-MSGID: =?utf-8?q?1757281782554910648?= Add a pcs field in platform_data to allow providing platform data. This is gonig to be used by the renesas,rzn1-gmac compatible driver which can make use of a PCS. Signed-off-by: Clément Léger --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ include/linux/stmmac.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 9a8721227b17..8bf5f73eb4c8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7295,6 +7295,9 @@ int stmmac_dvr_probe(struct device *device, goto error_xpcs_setup; } + if (priv->plat->pcs) + priv->hw->phylink_pcs = priv->plat->pcs; + ret = stmmac_phy_setup(priv); if (ret) { netdev_err(ndev, "failed to setup phy (%d)\n", ret); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index a152678b82b7..104b3d1101c0 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -273,5 +273,6 @@ struct plat_stmmacenet_data { bool use_phy_wol; bool sph_disable; bool serdes_up_after_phy_linkup; + struct phylink_pcs *pcs; }; #endif From patchwork Wed Feb 8 16:42:01 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: 54497 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3559951wrn; Wed, 8 Feb 2023 08:42:12 -0800 (PST) X-Google-Smtp-Source: AK7set/qVH1yhKJvSgPbvQ1gGxvymlNSUkQbVEtVdCJz4YqBV7SmZe9jxwHQkSDTVF4UWVQa0BwR X-Received: by 2002:a05:6a20:a024:b0:be:f5f3:a195 with SMTP id p36-20020a056a20a02400b000bef5f3a195mr10255779pzj.3.1675874531865; Wed, 08 Feb 2023 08:42:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874531; cv=none; d=google.com; s=arc-20160816; b=EuDcJDFiNrkZ1+97cAQRXip6zrFXn2GlOEACDHMMOuPzUcmv8tvnDiqykhLItOdUWS s9GcBflkSMrcdVv6kbouv80i4Q1lIuvQUjSvRNpGRd16XChoB66O0o1XFFu7/+AuhGV+ iu7qxNXHmWIZVsmjhRdCmPEGi9uTcIdr5Gdkqy+EfTYZrtHT977DrDAbe5gXbyTi46js Mb34u6kM7OeSmYPW7yDtyVa6W3If8DkM0bdK9IVt1z4xHJv8p3dpW/WFFDNXnJtJ75il OICZoawFp+eCoINMbd69J2LcAdGeAtzZNvOnYwr4QS92v+kn/Oe/lKh5N09WD8zlDYrE rbvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CKxN1115PkUVgT67V9DJBTOcN72KLe5GaWw0cltqBAA=; b=hgGngKZLA9qvsCLHcUkTYg3FAha//fRj8eUkQug388L03gwMMtZaOnNkDDteFQ0pc3 rkIvzap33jvccVw6J4oJkSNyFecrfxo7V1hOWesuMr7eBuKSATwUqCl/HFOzlQovDNjh bGpQoFBrLJS1jFGmauTjUSr4uTJrntSnNBFsB9Hyuupfo/1U1+7BADObluaHDJXi1+AK YGaHLA3kvMwexyhiayTz1tYTcuROG58JJKc3qU5qjjzenHD4Q0N+gSyzT/8ucu2uKOOk hgVRk/Q99lknMlut8s85djuXvcT3T33FSrgcah6Rsltol5GnbW9CNVkQMbbVaTN5t61m R3rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KxrU9bOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a170902e88b00b00186ba4ba494si20130131plg.475.2023.02.08.08.41.58; Wed, 08 Feb 2023 08:42:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KxrU9bOQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231760AbjBHQlN (ORCPT + 99 others); Wed, 8 Feb 2023 11:41:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbjBHQkk (ORCPT ); Wed, 8 Feb 2023 11:40:40 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABEA4E509; Wed, 8 Feb 2023 08:40:34 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B9A171BF204; Wed, 8 Feb 2023 16:40:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874433; 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=CKxN1115PkUVgT67V9DJBTOcN72KLe5GaWw0cltqBAA=; b=KxrU9bOQAeIWYzdEKz/zSbCBf2B4HsYw4cySr7Jm7jjp4hCZox/kIrG9V6Nq4E0GTbwJFx SPXBdGbIvtGGB1oLJXq1M6LVAkj2J1J7jt6p1kSul1J2dVhBcsCYsIROYCmf/Sm+1uflK6 HFOjb0F/FdQQydqXE0jxIxNAm+SgantNmo1j0eB2wCz4q7YKUf9wrXJrirUCnOz4HW9v0x S8KvrcTDLJjF9dCUZNqrIFGsnxHEWc/KjfkZtGkxWD330qa3hNPBboGQs7F0wgABOjRYpn EvswDf6MjyqKPPuyQQtMdPkWRjDuJmYckPciShaCbqWhb4HWuGTCYfzcp4XRhA== 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 v2 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support Date: Wed, 8 Feb 2023 17:42:01 +0100 Message-Id: <20230208164203.378153-5-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281813384584255?= X-GMAIL-MSGID: =?utf-8?q?1757281813384584255?= Add "renesas,rzn1-gmac" binding documentation which is compatible with "snps,dwmac" compatible driver but uses a custom PCS to communicate with the phy. Signed-off-by: Clément Léger --- .../bindings/net/renesas,rzn1-gmac.yaml | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml diff --git a/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml new file mode 100644 index 000000000000..944fd0d97d79 --- /dev/null +++ b/Documentation/devicetree/bindings/net/renesas,rzn1-gmac.yaml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/renesas,rzn1-gmac.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas GMAC + +maintainers: + - Clément Léger + +select: + properties: + compatible: + contains: + enum: + - renesas,r9a06g032-gmac + - renesas,rzn1-gmac + required: + - compatible + +allOf: + - $ref: snps,dwmac.yaml# + +properties: + compatible: + items: + - enum: + - renesas,r9a06g032-gmac + - renesas,rzn1-gmac + - snps,dwmac + + pcs-handle: + description: + phandle pointing to a PCS sub-node compatible with + renesas,rzn1-miic.yaml# + $ref: /schemas/types.yaml#/definitions/phandle + +required: + - compatible + +unevaluatedProperties: false + +examples: + - | + #include + #include + + ethernet@44000000 { + compatible = "renesas,rzn1-gmac"; + reg = <0x44000000 0x2000>; + interrupt-parent = <&gic>; + interrupts = , + , + ; + interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; + clock-names = "stmmaceth"; + clocks = <&sysctrl R9A06G032_HCLK_GMAC0>; + snps,multicast-filter-bins = <256>; + snps,perfect-filter-entries = <128>; + tx-fifo-depth = <2048>; + rx-fifo-depth = <4096>; + pcs-handle = <&mii_conv1>; + phy-mode = "mii"; + }; + +... From patchwork Wed Feb 8 16:42:02 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: 54498 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3560003wrn; Wed, 8 Feb 2023 08:42:19 -0800 (PST) X-Google-Smtp-Source: AK7set8hICd39tLBOwwleVcU12FdunsRbAIMvg2h4DU+zmB9eIEzfuzx1CLq2+uoajedWjafjlFr X-Received: by 2002:a17:90b:3950:b0:22c:5db5:6aea with SMTP id oe16-20020a17090b395000b0022c5db56aeamr964928pjb.1.1675874538805; Wed, 08 Feb 2023 08:42:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874538; cv=none; d=google.com; s=arc-20160816; b=0WKZ67sBB/poAiCns1ruYSZNe/64iCPnFK0oSgX9hv4ZM06VfU60rXSaQtvgmN+mCg cExMKXODTk28bF+N/05FoZcweHqw0Je+FDsNcb6lzsnN6yVgC/uEH4KenYQY7KR9SgYW EHQhaoE5uNvsq4tUvvYakE0z21E/tBOT0BFVFOW5oMp6lNW+RSQddh6hjF1tjaX8sNfP 6A0khCdfUu87E9VtQoImDP4kc7mzz1PxD/CJLnub7y9XRB8v9CEBy8YgRJxnK2cYt7Mg 8RS7Ib0TYOm9JXHKpAqm67zETNVET4YGy8uJVcAtfKw3kFSTn3YDYuz6SX/3Zqno1a5c BrSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+b40twGxCdSc5QQc2SQJSyKNWqs4/oSfyFtqvqrIBhE=; b=gR4O2LJyBzP80VosHcjWIdqav9JLer66oRBiJUsyxGbF6U/y9V8bGZ1R0YelyMEu44 Vb+epTy4jwq7nL+rSnTQYi/Jzd1UjTZOOFtecBRIFvSysy/GEEBJV9OAFfCcKC6WB17S aFlBlUG6ePJP56PKI0Tv+qMW8aM7yBBD5trzHR76wly0DW3oRCtpaBFG49wnL05K1bFZ A1xiF2NAGpdoQMU/fcm4/kdNFgQXTmQ3drcAyv6qdqtx8hPv2TSUBwuUTLY8FL3U7h16 9h5rkxV/sHFJraabt5tJMZaGSdXHgR3BmQihaRoUzbPwjftnGsYyykg9F6mgpvrd+qo0 wbgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o+Jd9uzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h22-20020a17090aa89600b002298836bbecsi1440899pjq.171.2023.02.08.08.42.05; Wed, 08 Feb 2023 08:42:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=o+Jd9uzw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbjBHQl2 (ORCPT + 99 others); Wed, 8 Feb 2023 11:41:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231721AbjBHQkn (ORCPT ); Wed, 8 Feb 2023 11:40:43 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20CA24ED04; Wed, 8 Feb 2023 08:40:38 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A3EFA1BF20F; Wed, 8 Feb 2023 16:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874437; 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=+b40twGxCdSc5QQc2SQJSyKNWqs4/oSfyFtqvqrIBhE=; b=o+Jd9uzwe2WGjsk4QBqoP29okNr5Qp/syL1Zc9fPUvp82qXDxpmSPvGcPWQjPJ3jTqOL28 khktOlev1Kok1YKmTn5GBde0/XIplaoGVT8Z+zKU4sDfICTiI6haa5yH0kjoDoz0br/WEu qwS9i8n5a56uk0Gjqxy8Qk76+7KMFMaYoWsfi1XYYQPoCeH2GsSoJedE15IuIKLb1/kx+9 fu1mDahV6gDGXB14NdqBJAn1GUDq87v2v8BtPsiUNXGpFZ02GDL+BEAsMoomzsRJw89ZHu l9n7HH86/f/wPX8yzmkaMGomjc1QF/6VYknD2W1ySXqtsvcRvsBW9iGbenYxgQ== 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 v2 5/6] net: stmmac: add support for RZ/N1 GMAC Date: Wed, 8 Feb 2023 17:42:02 +0100 Message-Id: <20230208164203.378153-6-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281820249304704?= X-GMAIL-MSGID: =?utf-8?q?1757281820249304704?= Add support for Renesas RZ/N1 GMAC. This support uses a custom PCS (MIIC) which is handle by parsing the pcs-handle device tree property. Signed-off-by: Clément Léger --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 ++ drivers/net/ethernet/stmicro/stmmac/Makefile | 1 + .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c | 120 ++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig index f77511fe4e87..be5429b7e192 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -153,6 +153,17 @@ config DWMAC_ROCKCHIP This selects the Rockchip RK3288 SoC glue layer support for the stmmac device driver. +config DWMAC_RZN1 + tristate "Renesas RZ/N1 dwmac support" + default ARCH_RZN1 + depends on OF && (ARCH_RZN1 || COMPILE_TEST) + select PCS_RZN1_MIIC + help + Support for Ethernet controller on Renesas RZ/N1 SoC family. + + This selects the Renesas RZ/N1 SoC glue layer support for + the stmmac device driver. + config DWMAC_SOCFPGA tristate "SOCFPGA dwmac support" default ARCH_INTEL_SOCFPGA diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index 057e4bab5c08..53a0f74c1cb5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -22,6 +22,7 @@ obj-$(CONFIG_DWMAC_MESON) += dwmac-meson.o dwmac-meson8b.o obj-$(CONFIG_DWMAC_OXNAS) += dwmac-oxnas.o obj-$(CONFIG_DWMAC_QCOM_ETHQOS) += dwmac-qcom-ethqos.o obj-$(CONFIG_DWMAC_ROCKCHIP) += dwmac-rk.o +obj-$(CONFIG_DWMAC_RZN1) += dwmac-rzn1.o obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c new file mode 100644 index 000000000000..82118d8cb50e --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2022 Schneider-Electric + * + * Clément Léger + */ + +#include +#include +#include +#include + +#include "stmmac_platform.h" +#include "stmmac.h" + +struct rzn1_dwmac { + struct phylink_pcs *pcs; +}; + +static int rzn1_dt_parse(struct device *dev, struct rzn1_dwmac *dwmac) +{ + struct device_node *np = dev->of_node; + struct device_node *pcs_node; + struct phylink_pcs *pcs; + int ret; + + pcs_node = of_parse_phandle(np, "pcs-handle", 0); + if (!pcs_node) + return 0; + + pcs = miic_create(dev, pcs_node); + if (IS_ERR(pcs)) + return PTR_ERR(pcs); + + ret = miic_early_setup(pcs, dev); + if (ret) { + miic_destroy(pcs); + return ret; + } + + dwmac->pcs = pcs; + + return 0; +} + +static int rzn1_dwmac_probe(struct platform_device *pdev) +{ + struct plat_stmmacenet_data *plat_dat; + struct stmmac_resources stmmac_res; + struct device *dev = &pdev->dev; + struct rzn1_dwmac *dwmac; + int ret; + + ret = stmmac_get_platform_resources(pdev, &stmmac_res); + if (ret) + return ret; + + plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + if (IS_ERR(plat_dat)) + return PTR_ERR(plat_dat); + + dwmac = devm_kzalloc(dev, sizeof(*dwmac), GFP_KERNEL); + if (!dwmac) { + ret = -ENOMEM; + goto err_remove_config_dt; + } + + ret = rzn1_dt_parse(dev, dwmac); + if (ret) + goto err_remove_config_dt; + + plat_dat->bsp_priv = dwmac; + plat_dat->pcs = dwmac->pcs; + + ret = stmmac_dvr_probe(dev, plat_dat, &stmmac_res); + if (ret) + goto err_free_pcs; + + return 0; + +err_free_pcs: + if (dwmac->pcs) + miic_destroy(dwmac->pcs); + +err_remove_config_dt: + stmmac_remove_config_dt(pdev, plat_dat); + + return ret; +} + +static int rzn1_dwmac_remove(struct platform_device *pdev) +{ + struct rzn1_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); + int ret = stmmac_dvr_remove(&pdev->dev); + + if (dwmac->pcs) + miic_destroy(dwmac->pcs); + + return ret; +} + +static const struct of_device_id rzn1_dwmac_match[] = { + { .compatible = "renesas,rzn1-gmac" }, + { } +}; +MODULE_DEVICE_TABLE(of, rzn1_dwmac_match); + +static struct platform_driver rzn1_dwmac_driver = { + .probe = rzn1_dwmac_probe, + .remove = rzn1_dwmac_remove, + .driver = { + .name = "rzn1-dwmac", + .of_match_table = rzn1_dwmac_match, + }, +}; +module_platform_driver(rzn1_dwmac_driver); + +MODULE_AUTHOR("Clément Léger "); +MODULE_DESCRIPTION("Renesas RZN1 DWMAC specific glue layer"); +MODULE_LICENSE("GPL"); From patchwork Wed Feb 8 16:42:03 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: 54502 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3560903wrn; Wed, 8 Feb 2023 08:44:24 -0800 (PST) X-Google-Smtp-Source: AK7set98H2hMJYuPWZsiCPJ+FGqjDjL+gc60JR9/aJrPHHjsbwnHq9NnwxIRcZfVT7XGu+yEy1Lb X-Received: by 2002:a05:6a20:3d88:b0:c3:6ce:ac3d with SMTP id s8-20020a056a203d8800b000c306ceac3dmr4187493pzi.4.1675874664666; Wed, 08 Feb 2023 08:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675874664; cv=none; d=google.com; s=arc-20160816; b=aPw1znYCe/jcHecw7J2fujtW8aaRaXSF1XQA0k9bZqmDNPy9sfZjCjktsxhDz86ipm MRhb6HQpflxl0wK87Uv8aqwb7SSiz6ZvjqO4NanXzD1b1WcXkwRUH42bC94Fzfrvm4Nr BChG87opVkryIKTgOiep/yEOU5LBxApJ3oXzSHS6lC1cNdt3vxkBwNEfXA6+XiFujXrs /YCFUaEVe3V//CDXRP3xnSBKOK63T46i4w9tQN8CJLq5w3vwUu6R736oRNoFjBzgdLZR i+EQm3x8B6ENP2B9xtxSSeS/NAmut+hufzre0Fa33JCbiq7oeB48F8op4nB8Q/NJaUbo EJcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F2K1Mbt7RBxJUSeZsp99AVJE/j6M83BKYvRqSEdsUyg=; b=wp2bZKTxGgB17J85tvukqg6hoiW5fzPgwb0A/5f756yU+6I6Ygwodwr6GBNnchXQcO 0hkHDCEJcrYLCeB2ePbyXrt8WTw3D9pyjt51EatIm4Gd0RyOs0s7OH9qZeCpjhSqGnze SZrYJjLt0nawxHy3ovJRv2lXOvLL7JCgiH4CLBsh1k0NbTU+v83foBXqZ5L7q+L9Um3N fAcVxzQ/tv9w8jpeVa77nulO4tDXs718kodMln4U5EiI+yABhCfmmwMV/gtaIBUhTkPe 1WZ5qhSW/9f5vR8CGSBDwPzeK0rjZfneAkR4b13WGWJm7mca9Dn71SSAOnVEgv3KHGlt F74g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mdruBRmA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t18-20020a632252000000b004fb12ee7cb9si193845pgm.354.2023.02.08.08.44.11; Wed, 08 Feb 2023 08:44:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mdruBRmA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231775AbjBHQln (ORCPT + 99 others); Wed, 8 Feb 2023 11:41:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbjBHQlF (ORCPT ); Wed, 8 Feb 2023 11:41:05 -0500 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60B04E50E; Wed, 8 Feb 2023 08:40:42 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 64CE61BF215; Wed, 8 Feb 2023 16:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675874441; 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=F2K1Mbt7RBxJUSeZsp99AVJE/j6M83BKYvRqSEdsUyg=; b=mdruBRmAwMVP73GpfC+dxP/4Qe46kudrpPy1CyBLTXjn3hqNqbpJ3zsdgze0T5nx4fsY7X gCWlfUBGZcBi78ntUZo9iGqCH1OcRrT3HtjoE95vMyGsGVZtgydu/+EXa6GZmFVRS0HzeM HknySmCsTLIreg+rbiX0i0LJkLOihXwyeELHsz36+VMaZX9zQrdXzdchvDVNmXWbUVdoOM /cE1+LAF8lyWZC3ioi/CTIwWJFlDIAipwqi+w8JyVfTombVe2sXhig6BVwz0ZqZIR76v7C 3fauWb5NdrNgo2zzsjTfMcHZ9oOjbqmZJywG5pvDzNYx7f6omnarJv81oRrfyw== 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 v2 6/6] ARM: dts: r9a06g032: describe GMAC1 Date: Wed, 8 Feb 2023 17:42:03 +0100 Message-Id: <20230208164203.378153-7-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208164203.378153-1-clement.leger@bootlin.com> References: <20230208164203.378153-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757281952374870733?= X-GMAIL-MSGID: =?utf-8?q?1757281952374870733?= RZ/N1 SoC includes two MAC named GMACx that are compatible with the "snps,dwmac" driver. GMAC1 is connected directly to the MII converter port 1. Since this MII converter is represented using a PCS driver, it uses the renesas specific compatible driver which uses this PCS. Signed-off-by: Clément Léger --- arch/arm/boot/dts/r9a06g032.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi index 41e19c0986ce..ba32e4429b01 100644 --- a/arch/arm/boot/dts/r9a06g032.dtsi +++ b/arch/arm/boot/dts/r9a06g032.dtsi @@ -304,6 +304,24 @@ dma1: dma-controller@40105000 { data-width = <8>; }; + gmac1: ethernet@44000000 { + compatible = "renesas,r9a06g032-gmac", "renesas,rzn1-gmac", "snps,dwmac"; + reg = <0x44000000 0x2000>; + interrupt-parent = <&gic>; + interrupts = , + , + ; + interrupt-names = "macirq", "eth_wake_irq", "eth_lpi"; + clock-names = "stmmaceth"; + clocks = <&sysctrl R9A06G032_HCLK_GMAC0>; + snps,multicast-filter-bins = <256>; + snps,perfect-filter-entries = <128>; + tx-fifo-depth = <2048>; + rx-fifo-depth = <4096>; + pcs-handle = <&mii_conv1>; + status = "disabled"; + }; + gmac2: ethernet@44002000 { compatible = "renesas,r9a06g032-gmac", "renesas,rzn1-gmac", "snps,dwmac"; reg = <0x44002000 0x2000>;