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: 54995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp392760wrn; Thu, 9 Feb 2023 07:17:01 -0800 (PST) X-Google-Smtp-Source: AK7set/Q+52ChYDECXk+0+3yGZ0WIAOOLAALCnaklMQNt0ZsgClAXHC4/+6sdUrj6wH4y0rKaS5V X-Received: by 2002:a05:6a20:8f06:b0:a3:8eb5:6869 with SMTP id b6-20020a056a208f0600b000a38eb56869mr15885386pzk.14.1675955821314; Thu, 09 Feb 2023 07:17:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955821; cv=none; d=google.com; s=arc-20160816; b=DHkk1O10RicNqiFAqXwK8/b1RXP76fNOPJ0dUrjSm//JsME7sCgs/o2CT/X3d0wwe7 rIYV/6Tv7t33CyuCtG2GWp7F+0JlPxT06tpYL1M/3gWp38sBJy9fdYXo6SQA6Oejey8E sD6n+4YNgKZZStJ+sGQED2OdKuuqnRjlQ4khW/n0GBOzR5VK0EWltVm3eUWfArD2myRW g13I9qNXdNzssEUmqSkBA8yGkq0ZGeTRWgdlDF8ir00215K8hm0qYiiUWz6/VK1aHxBe lkBcMX2kZu+7ogYRhCEDCbVohJh3bcnsqsBG6tGaCAq00F2O2ZLhrIVDMUYBfi1z3Jks SsOw== 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=mu7TroQdsoDGe1EtlIVS89GD9Tc8DkBMlQdOPg0cXvVLS81xTSl4g/B0ofLCrtCMIi j2eiL5KcdOWyOevPEMY17/9GyTgFH6w1aui9CXlsI5UHlNHM2/hA3n4Aik9GKvxcekAv b65eeA914zBNYsxDiihqGMUMyrsE0h/3Pa8wUWXHzaUGXwYjhTUTZSLK0Noe4yvolUmH MZoCU70AenHPZOnMTfwEQN1I9+y/CAxmBlOVuQ0h9zYLjKTcGW4kYyYO7PqNb7vLXzii ge9F15CPih4DhuoG5JEcoNAI76YmtGv3ZM2/v0n20WIOhgEGN7X0rT8HRUqZ5TY8eA2c EoNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mg31+fwm; 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 l192-20020a6391c9000000b004f3884d5b04si2097557pge.779.2023.02.09.07.16.48; Thu, 09 Feb 2023 07:17:01 -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=mg31+fwm; 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 S231245AbjBIPOd (ORCPT + 99 others); Thu, 9 Feb 2023 10:14:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjBIPO2 (ORCPT ); Thu, 9 Feb 2023 10:14:28 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2199F60E60; Thu, 9 Feb 2023 07:14:21 -0800 (PST) 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-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?1757367051392767147?= X-GMAIL-MSGID: =?utf-8?q?1757367051392767147?= 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 Thu Feb 9 15:16:28 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: 54996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp392955wrn; Thu, 9 Feb 2023 07:17:19 -0800 (PST) X-Google-Smtp-Source: AK7set8N1oE1iHJtgGeRtiHHAb/+L5qSeOYd24yrzHiZS45QHNl5QhZz0yZRQiK0h82DRpOCHwmT X-Received: by 2002:a17:90a:1d3:b0:22b:f622:56ae with SMTP id 19-20020a17090a01d300b0022bf62256aemr13519468pjd.23.1675955839165; Thu, 09 Feb 2023 07:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955839; cv=none; d=google.com; s=arc-20160816; b=qdpFeoqrB6hr2RJHPqdIbnVLdYM/MELhqik6z4JCFAihvvh3SDwZV083fgW3kpQXOO KvSXMiBtx9lae6+uuzpXMhz0yttbXx2TZf2WGOa2rGrGc32K7H1toUyxuj4mL5kEFtIB pml5NxlwlXEk3hGol49XYmwXZkSXh7JJjItmZPq6gEFXWwhwG5g/fMWz/jVm6PulaVq9 qPtPuCQSe7bP8ZaVLXQbgh3dUF4ttQdTxWeENiBx1+7HxvLVeQCHlYSBNiHMCSgDXrVr 9Jx+L1ekImYHyPjn9N0kOVA07vHlxayAEG4d+wR3Qai0v3UZI2fVh9EOzvgvrvYty9mP B8bg== 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=0/M2zt/YgT1gpOPr3snRzVSPDNIoI7YdPqn4xUESW0Q9mbWhUkkvtTDmdqJDudUyeY W0z9JFYIhqfSQnNOEABNh5bIvIzVOOdFV0ztkasZej7JjrDoDOm1vWeO1hoTxUCHZu6n nC17nCH32RetW1t/z03YBv1sKzRqRYxHN9+0eGw2cVR9paeoEX4SpimwTCKb0iLSi3Za vDxzneGeMLghQM/E3X50y7CSX1DA01d/IO60Kikkzfevy5srYqKut1KALrF0lXilb3k1 XlESHnlzzxxp7V3SCEJrYi92ZQJUhn5GCZdVX0wFEqSlPk3AusBTfIdW4Gk72XHHzazF tfkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=lKZ2nYUF; 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 n27-20020a63721b000000b004f1437ceb14si2085853pgc.287.2023.02.09.07.17.05; Thu, 09 Feb 2023 07:17:19 -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=lKZ2nYUF; 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 S230339AbjBIPOj (ORCPT + 99 others); Thu, 9 Feb 2023 10:14:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbjBIPOa (ORCPT ); Thu, 9 Feb 2023 10:14:30 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 444C4611CB; Thu, 9 Feb 2023 07:14:26 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 9550310000C; Thu, 9 Feb 2023 15:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955665; 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=lKZ2nYUFG+sfm0B1kVvVz/Pea80cNIURQMKuOcVwF0SMYgysSylfXLPJjtUHnpaM0dPPVI 9+ZZhA5UvEesDjwz+PeAFVo+kw286G8Kp5PetEIZsKRcM3hvfRMkZCDO2kbvs++eAiYjuq 9GcsueMKLn1HRrdi65zW1hhP/32XMml3NiRKBrTRR6GGoXUKkYoXewpRsAXYS+7tp/Jxhq EuLnrzLJ73I6A3z44mdWPW/O4/jDAbjz18PcsqpY8rWr5HF5MN5pGkzifQHJLhuD9O48Ca ysyeUUvS5kxRxblehTsIYZY4j79cjBpWddIMc1/3r9K+QHeu489Ac2PEjgxs8w== 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 2/6] net: stmmac: add support to use a generic phylink_pcs as PCS Date: Thu, 9 Feb 2023 16:16:28 +0100 Message-Id: <20230209151632.275883-3-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-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, RCVD_IN_MSPIKE_H2,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?1757367069909671634?= X-GMAIL-MSGID: =?utf-8?q?1757367069909671634?= 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 Thu Feb 9 15:16:29 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: 54999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp393861wrn; Thu, 9 Feb 2023 07:18:44 -0800 (PST) X-Google-Smtp-Source: AK7set9Y7vGRZ2qEwM0Cc7Hdrn72Mxi/RH0h6ml7vX5mMp9JCKXD/8Tx1FliOper0Cll52Ap8aBE X-Received: by 2002:a17:90b:180f:b0:22b:fe1a:1e94 with SMTP id lw15-20020a17090b180f00b0022bfe1a1e94mr13066358pjb.23.1675955924262; Thu, 09 Feb 2023 07:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955924; cv=none; d=google.com; s=arc-20160816; b=NURF9f0+R4pL4MqxKR+dYQDIWeiYDv7V6zrFEIfoJsprgD5KAd5a8ANRfbNo4MPgZN stPTEOTqfzKbtO5OwPHCRlCQYijo/EtjFqbaRJobx8IQokA04Ify4y3FCnxvoQK5nTCY 9sue9d/2+VvBwcJbkZhrBYLqGBPqQMmvadHeaF0rFqgQEi4lXoIDPod//qtENjM2fPP0 CVETZmP2EkQjfGKrYd1O86rJ2HhqTNMuTwQxUFcisNtaXTnxZwMapRVB0h3juCNdaqHE puTUeGaOQgx+Ni50l7IpnXHWzmvJZvW0NDuvjsjqayt0mSJ7SlMI6HI+yZfRavOPWDdC cEfg== 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=z1T2buUEtUaS4iwijK+9hDQD5MTQSBYcjfGbgwJHtZo=; b=jljrArc0+6mzpax3kdo1fOggPyS/gvp5034RZ8W2x5cOWOkspbEJOxGc7O4HwLeASo tgxmmyRKCqKbrs88UWUsJl9QnXMZcQd0tLNlpqBgE2nFY+5+Tn7/zTAhIi/SpZYNL1h5 1p1P5h3ve52MG8FOQdcXje9577ASYVe6rSA4pIigezzhE0EuQvcdyoKIw6c1AhCmbmMU WFhD5K6rD3LZyJnu/mdhgy9s84F9A+iH5W+j6aMLYGNmiEB3eLNiT4WLH0tgir5a5pDG IKAbXC+4s+enT6PEmAWVG7TJa3TjIHmgGcJ2+bugti+vFPtHe0nfJUCs+MaMI8fMe+zU ggig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aZ1JEgyn; 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 mu7-20020a17090b388700b002294419acc9si6499123pjb.107.2023.02.09.07.18.31; Thu, 09 Feb 2023 07:18:44 -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=aZ1JEgyn; 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 S230240AbjBIPOm (ORCPT + 99 others); Thu, 9 Feb 2023 10:14:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjBIPOf (ORCPT ); Thu, 9 Feb 2023 10:14:35 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9545260BA8; Thu, 9 Feb 2023 07:14:32 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 32FF2100006; Thu, 9 Feb 2023 15:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955671; 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=z1T2buUEtUaS4iwijK+9hDQD5MTQSBYcjfGbgwJHtZo=; b=aZ1JEgynImYFrGvJgTcRxJ6Bpcv2W4DpjJ/aY65E2KUSnT+hEERXUwbanWLyc//F82Uy8f Lvd3PSTuHd6a/6GeszmypOvPjs1XXW2b177bSOyEMYakIzCAji0ZetUwYKqk3uthc2Dti1 hUEJEpwS+0VHMYdP2+SL8H/PPPJgVfDsJ0la5nuH5abHSI20kJsITBHecKopYY5EgzLbOC QQB76kY1xL/ymHGGjYQ8N6jZPil/S4Zybi4+KtMkOE8rCJucVfnifNB6lu5MLmW2ayh2jH FChxWMw2r9KNMro2jlM3AKqtxEAgVIiAv7UChRO73BZuRgbni/uH5+nVv2AceQ== 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 3/6] net: stmmac: add support to provide pcs from platform data Date: Thu, 9 Feb 2023 16:16:29 +0100 Message-Id: <20230209151632.275883-4-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-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, RCVD_IN_MSPIKE_H2,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?1757367159236108345?= X-GMAIL-MSGID: =?utf-8?q?1757367159236108345?= Add a pcs field in platform_data to allow providing platform data. This is going 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 Thu Feb 9 15:16:30 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: 54997 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp393534wrn; Thu, 9 Feb 2023 07:18:17 -0800 (PST) X-Google-Smtp-Source: AK7set8JffRz6HVAk22+D6lisKNuwtKm5Sz9imL2UqFQ93Kk1+lJBn4j9titnslvW2EMwBTnL1z+ X-Received: by 2002:a17:902:ec89:b0:194:5c63:364c with SMTP id x9-20020a170902ec8900b001945c63364cmr12486241plg.62.1675955896859; Thu, 09 Feb 2023 07:18:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955896; cv=none; d=google.com; s=arc-20160816; b=Sgai5RYBanpYUtH+HpCytCFgBcF/G0yGjedqprtQjmM+RvdicQ8sTGFTwWX0sGkJr+ 1JAcByPs04Keqz4V+1dzZhNDlo/nrYHOCqq+uojieq7UZxhUNtc/aKn+Vjlio3qpcYwM Uz9bmFJnHWUVlwWu2CLrZTeCXhBKdkG24c26sAmiJlvR3pDn8G+8tbtm5P1p02FB/PYj fErBH2unq1fplmi19veeT9R5MCo8LcRgNimv2qGA9npuAfZdsGuMDn9B3d4TIgiUvmCz QBsZvb02y0D1SQ6XOJttN1h5xC2nH8mGAS7CI8pO/jBjPa7KUKzz0UpMeY2OsCOwLLrY zPhA== 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=X7Dq5Vuw70IMYBxuGqhVbtfZLGm2k1JDXLT0ynX7Rjw=; b=F41NKD5q7TSvtwvCgaT6tPnY6kpzNONi5nFlNEI+r11s1AOD4T61ae9ybgFddqmNhp REOf4czg+RHKiLC604068CU73gSFb47j5B58nfTjVY0VNO7GkE7r29gvKjYlHLb5EHIa bpG01I1tJ4hnx9neSEtlE+BQxTU8IkOmHUKkRBqjxqAeXCZjVrD+1HPyk1Pw0vjM2n+v MCG3U2wP6maxBpmkAepnKaoVnJMRIPWMEVq1YCNlz/j1AwjuTwZ5eb0hGppGgsdfHbsd gQBCnr8d3CtWEvYvSuYlxGosQ18z+9M1NL0tKPJBOlclDcbpCCLnz/IfBMzrsHYsUwr5 FfTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=mCCntR8c; 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 r206-20020a632bd7000000b004e30cc4a339si2278713pgr.626.2023.02.09.07.18.03; Thu, 09 Feb 2023 07:18:16 -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=mCCntR8c; 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 S229751AbjBIPPL (ORCPT + 99 others); Thu, 9 Feb 2023 10:15:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231304AbjBIPOx (ORCPT ); Thu, 9 Feb 2023 10:14:53 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80F7B63128; Thu, 9 Feb 2023 07:14:38 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7EA5B100007; Thu, 9 Feb 2023 15:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955677; 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=X7Dq5Vuw70IMYBxuGqhVbtfZLGm2k1JDXLT0ynX7Rjw=; b=mCCntR8cNEAStDQTa0eLIT/RdzS7lxYKX3xPNrHucJC5WPpQlcHGH8FA//fbglxPp9mkv1 RTz82qrL/JpN+5i5okbrVmODyAPGFNQHuMXNG3030Rmho3EIaEcvnQmvJBhGAvHBuwk3SP f+1CDiAClbKKIzClGYtcaqar5A6uYJ6WPIesIiLgBO4ghwGSzRxrM0Nweln1QijiFqLinO Kot5Z/dvJ/TPyCGpd/IuxWHXcJvnEzAUTMaue5Tdpr2mkJtN6ti6yVSeQ4e/xlARqizuY4 S78B6ek1VkELWYQmxoRkhltUEuqEIU9JMvrJH8gkgoAYczlhexT5ZfPNgPneFA== 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 4/6] dt-bindings: net: renesas,rzn1-gmac: Document RZ/N1 GMAC support Date: Thu, 9 Feb 2023 16:16:30 +0100 Message-Id: <20230209151632.275883-5-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-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?1757367130930112886?= X-GMAIL-MSGID: =?utf-8?q?1757367130930112886?= 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..029ce758a29c --- /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 + - const: renesas,rzn1-gmac + - const: 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,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>; + phy-mode = "mii"; + }; + +... From patchwork Thu Feb 9 15:16:31 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: 54998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp393720wrn; Thu, 9 Feb 2023 07:18:34 -0800 (PST) X-Google-Smtp-Source: AK7set9FLdnLs5qbnJ6hoPUy4knf7C/sYM1plCSKRgrkZKo928cXL+pMvvcZ1n1KBx9Q/XTWbPoK X-Received: by 2002:a17:90b:211:b0:232:fee6:c9ce with SMTP id fy17-20020a17090b021100b00232fee6c9cemr1115702pjb.10.1675955913724; Thu, 09 Feb 2023 07:18:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955913; cv=none; d=google.com; s=arc-20160816; b=WVHZny0Ir3fcn/URUuft+EwrQ22MatWstIz2uyTyx/ZumvqNI3dHaYG5eqcPct8Lxr yeRUgp52QD/Ijr6s0325GaMRXFlUSZNgHBmJsWTkTUG7vWgU77gmhPsdZUizfn7PbY0d UZSea0O7F0SiMykBX6Nbdy89oOL9hHSR8EvxVdp0DgYXejvXG5vdIKt+5RSnsF2zKTnK xAsEkR9dDxMXdjWY3SzlGX6y+kIcpJDgaqJgR1HcxwJdgFotF5rhKAZsyJ2cdzDJZh1w 6krBH+pH9UfU1sATp24+61UsEmJoVcd4yFH1hL5AW8T8Sjm204SIXMUyJhmQ9McYco9m nIRw== 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=VjpfhLOz9oKCMvvMGc0sfm2NiT6GrX/OPj7tcQ5MAGPXD1TUiWqvzm0dBJ2ctXmaSf +waLBoCsrCBinxJZoMAZjU+TR26zuJCUtQqRgjrZs/Hsmv7V63DBoVKLymmZC7WNgITO a4GUCTOof8EtnlCaY6LDZmp+dhIwuf9f5LNxJLu1aqCJbJ1qh3s5rJDaZd86sJnakIrJ Kf/NiExavSpX/JjAhQvFmRK7yJMD1h5vwlsdXa1WZWfvr/u6lu2kuvZwHb5FdBA8WLNY 6QXJUUqUT0QjUMx3Kyi1UEZqoANmcfsPWIPFP4rKSbIBV9dZAEN6yQih+uZs8emvfPhD h5Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TnAXLvut; 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 r11-20020a170902e3cb00b00194b7455ecasi1690008ple.415.2023.02.09.07.18.20; Thu, 09 Feb 2023 07:18:33 -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=TnAXLvut; 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 S231293AbjBIPPb (ORCPT + 99 others); Thu, 9 Feb 2023 10:15:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231354AbjBIPPH (ORCPT ); Thu, 9 Feb 2023 10:15:07 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53C3643E8; Thu, 9 Feb 2023 07:14:46 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 2E244100009; Thu, 9 Feb 2023 15:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955685; 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=TnAXLvutxsoV6SQPVLC5IpOYUVeKfybmBcXAoMhkGOpU6H6V8PNfgml/lve5R4qszfbMaO 7ZkfVOy3sU5aE/eVcpgo7GLYcdEH4kOi489P9EzR4IdOr3Lhjaa2aT3svQk25Nrz2X5oSy bffTADKtd9mJXOYB+d0qo8Vc9aTlKYnChJFdMwleyqgM45LtVmsg0v7PX/C5kYM+Vt7iQO 2Z03pqKdAytD3qBBKes1xD3W0TI8itOOGEbEiw2JhnVlHIt4KuEZSZ+uoaakXMKP4sLh9B qyBt7L3uBqwyi+TruoKNio0dVYazReU+lJD2B6KYLzQua6VTLW9fx2WN66QIXg== 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 5/6] net: stmmac: add support for RZ/N1 GMAC Date: Thu, 9 Feb 2023 16:16:31 +0100 Message-Id: <20230209151632.275883-6-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-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, RCVD_IN_MSPIKE_H2,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?1757367148021423895?= X-GMAIL-MSGID: =?utf-8?q?1757367148021423895?= 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 Thu Feb 9 15:16:32 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: 55000 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp393970wrn; Thu, 9 Feb 2023 07:18:56 -0800 (PST) X-Google-Smtp-Source: AK7set+XHGiLdUMUyt5F3AaARXtMAGJig769PXYBK0co6EiO9O0ZTdw/Gc+c8aR/3tGeE1YO4u+k X-Received: by 2002:a05:6a20:43a7:b0:b9:24d:8320 with SMTP id i39-20020a056a2043a700b000b9024d8320mr13764225pzl.26.1675955936030; Thu, 09 Feb 2023 07:18:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675955936; cv=none; d=google.com; s=arc-20160816; b=eCY6kgd8XDjeqo3dYBkaMpD6qmlIGGR6b7+lWh2fJ9U7CdN77M7WprclmM09bmWUvf BdANJPa+OsougvqjquHSswQCsR2tJ4QN9keYxuRiyVP/SNiD/eoxtZX0TPUbW0sX06gH fJqxCX3yj4GWnmp59ZMEc8YOgjF2Y6DG42F8Evf/fvKmYm2yL9Zzgd57JGeHFgwkK/BX fwCqOLtHwoRDb4X6ZMcPnLTwgLVu4xAtytRozCydRaCYUWmpw9v/cVAxxWlhIY11QXwA lwmeYVZIdvwQjhLPgidI6gUxoGNbQafEV6xxjfymfDEkeooLpaa3mvpsHuTbYEKHaR0s zKTQ== 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=qzOUvZZfHM3DvvEt4aMUhN17ayJLBpC+miLJEVG7uUgNfVJFGva8yC8BLndj6wp/c1 xT4KMYGxWhC4qAi97hZJssx2xImOz/AiEXCHAJ/3NqR0RYDlxtyxRjg5Eu1FU86mKlHP E/41AAPnIrnNyw043Fhx70rF3uT9y6IMHFDahvofQFxGi1AZ55gKJP3Go1J8GUzf2J3G 8U6bBti9tsKGge26oyH05Rh3Wk0Y5zjqD1bmKhLPwfd9Gk/dW+mTbSQXCNFN2vMvOQwa erwbetPs5HqpUc7C4xUMjWCxz25ITqjmyiF4WN7OrqNHx3wDAPzeeTcVP8qo+8FcKyXz aSGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="TX80F+//"; 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 f4-20020a655504000000b004fb31fefcccsi2335377pgr.358.2023.02.09.07.18.43; Thu, 09 Feb 2023 07:18:55 -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="TX80F+//"; 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 S231388AbjBIPPz (ORCPT + 99 others); Thu, 9 Feb 2023 10:15:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjBIPPV (ORCPT ); Thu, 9 Feb 2023 10:15:21 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20379643D1; Thu, 9 Feb 2023 07:14:51 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id AA8FF10000D; Thu, 9 Feb 2023 15:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675955690; 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=TX80F+//HsPulsgl6DqW+yS2ORLQU1YgVgOl/e3yxGJDXEtTRoslNP9e+b4yQXUAvC4aT0 xWgoT3e+fjt2RTaqpy9k9HV8pfSxinULNdxqfhainxZgqkIx5VO1d/+erfvBnNhkqowwWt AWMVLgMq2pbG+/m7HJJRoga9mYX8QbRy1ZzDLy2B35Tr7NXlVGBtL3VXxlwFwKtJ8/B85z j3IaYBpakuQjBwjTkBchTVvnCil9Hk6WdTMS/0M54DEElAOiJp3v+aT9vV1HOVkGeK4wcj uoBBXW94H3Sf8hCFlEmJVV0AmLzn4L4nxM+q+be65JwQwcztkmZAksHdBqa2mg== 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 6/6] ARM: dts: r9a06g032: describe GMAC1 Date: Thu, 9 Feb 2023 16:16:32 +0100 Message-Id: <20230209151632.275883-7-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-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?1757367171357496366?= X-GMAIL-MSGID: =?utf-8?q?1757367171357496366?= 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>;