Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp188529rdb; Tue, 5 Dec 2023 02:37:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHqXQflAod9GIrGbD4jE07jhjiSc2ZH3V6+7QE/kghK0GpqunFTHYvoLI9+lFOQrgvuptX X-Received: by 2002:a05:6358:9392:b0:16e:5deb:1df6 with SMTP id h18-20020a056358939200b0016e5deb1df6mr3435859rwb.31.1701772669190; Tue, 05 Dec 2023 02:37:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701772669; cv=none; d=google.com; s=arc-20160816; b=TmTImwO8DiUspqBWPHRUD7MuThFl7mHNEH28+8q7Ub8Pds5pzTw3ep3c4QchkycATw J6zCnt70gQrt15rrZTiWkdG+QpsGYylAzT8kI6+PYRXM0MQHQA41gzWXb+v9RH0Vy4Lc +30jHDTcg3SagFkVBg9ppQI4EsThFm9ntLdD7Bz06z/hKkNUithUH9zywJWbX3J5f2kY ERtHs+WCAfvk2N8wtuhN0fl2aMBpbrQi2WNe20Pg4qH3izBtcK7yQSx+VlnObv+0DkBf DKVMgOW44XX+Yo3wFBANsSsBa7r9f6QSCxKuvCsrDVoRk63WgzGWFrlIEwLWW44G/9Uo DNlA== 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=9/W7bRr2FIytmHTP+ve4vRfpj/k8/yIBrLP2P8LnNEk=; fh=v51bUdJj35SaMkLsH4c2WWbOUB5fQIXFjt79p2lNGyo=; b=QS0wNSRT1B2b9llhI3U4P8tebDZB7xXSGaF6FK7px8ne6a++Edo4Jmk+8wP14dviD4 ++vyRL1mGyLRZHOfNO+XNxcPc3CjntFspwsApRPMPNnBtEZlzsrYmZqcGrjwejX9igiQ TrTxwz6cHmUY1tfsLVBjzcDaz/DheNSwwo1dgrtQAVh2/bbTitr5/7u8ljaZgjjZqO69 mErPlWtLie8I/7QPGvJzPr7hpCpGbfH3f/IgSs3zpbTyRpbyAZu8ZGe6dOIvGPL7eVCz 1iIgjCcK9HLSsoSD2f37dHKjjy4lMqAoAe+DdPO3kafPdb0YRO/Yv0TbGGFBKiZbd7FI umpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Dw0oH4bt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w1-20020aa78581000000b006c0e3332534si5182391pfn.42.2023.12.05.02.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:37:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Dw0oH4bt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 6EEA9805B31D; Tue, 5 Dec 2023 02:37:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344989AbjLEKhL (ORCPT + 99 others); Tue, 5 Dec 2023 05:37:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346816AbjLEKgg (ORCPT ); Tue, 5 Dec 2023 05:36:36 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5685F1B2; Tue, 5 Dec 2023 02:36:29 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50bce78f145so6567893e87.0; Tue, 05 Dec 2023 02:36:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701772586; x=1702377386; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9/W7bRr2FIytmHTP+ve4vRfpj/k8/yIBrLP2P8LnNEk=; b=Dw0oH4btdfsgm2CLTFLfNaZBJMSA0IlZeAE75orjiHLjsQhbfuWjN0XVu82JGvRnRK RSH0fg4h8+6o+ma3QqMeB4s1RPquZKOlpfC0G+JWOQ78ONlEEfeaR1A3vseRSQjJQtPI b89nu0cECGahcK8nlC6chDiBpdFzRq084tn6GRomPWd8WWoUeVyxloAl9dMkMVlUEOqm SzzmCD6gNbrpmVotFa7g5aXwhvTlaoiQB6To7fsq+FZt7KzM9LBSCAbRFs5GQ3s9mnMj mcEC8+3iNDtJ6ow3PvR/065yzf52O8SuX93n4Kr1zEjIAGk/4XZs1aB10DGQ6OdmRCWn EyUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701772586; x=1702377386; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9/W7bRr2FIytmHTP+ve4vRfpj/k8/yIBrLP2P8LnNEk=; b=OXqNEtJqUbWwpQ55G4KDho4HR9FX57TLdqY1I71w+6RG4jo2tN5Zo/mV5wPxoiNjfw 4rGlkHUY6OS7dsW7r+PRmw7j+/kXWqKX68b1Z+/vG1YAv+sZr9nV9wKbLIzOfVULlEnp cqhjo1/H9kwkJwBe34RtDDEZ4qNUIhsBGAgv8NnHbRXpfRPh9eVG2aYStKdWBN/z/mYC 1ezj4wcd874SwBBtlBHEG+uXF1BOZpl6aqz0D2ni7+JN/kyoaB9bBJq3xp7eQYHhGffx m8LPXEIlfLkUeI+3ukiyb/WQgZy59Ge9TWZLzFkTr9BlXHLAvOaQwppn5uKbWIhy3MVP A5sg== X-Gm-Message-State: AOJu0YzN+tFdqUyg6DK3Z5Hq0xailU0IPFh3eTDM6VOHENV8cE67II4b rDN7TEAPhTLlaQA12NTGegk= X-Received: by 2002:a19:3848:0:b0:50c:4e7:87b8 with SMTP id d8-20020a193848000000b0050c04e787b8mr175943lfj.23.1701772586273; Tue, 05 Dec 2023 02:36:26 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id v8-20020ac25928000000b0050bf7a9c4adsm567335lfi.225.2023.12.05.02.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:36:25 -0800 (PST) From: Serge Semin To: Andrew Lunn , Heiner Kallweit , Russell King , Alexandre Torgue , Jose Abreu , Jose Abreu , Maxime Chevallier , Tomer Maimon , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Serge Semin , openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next 13/16] net: stmmac: intel: Register generic MDIO device Date: Tue, 5 Dec 2023 13:35:34 +0300 Message-ID: <20231205103559.9605-14-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231205103559.9605-1-fancer.lancer@gmail.com> References: <20231205103559.9605-1-fancer.lancer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 02:37:40 -0800 (PST) The DW XPCS driver has been updated to being bindable with the respective MDIO device registered during the MDIO bus probe procedure. As an example of using that feature let's convert the Intel mGBE low-level driver to registering the MDIO-device board info. Thus the registered DW XPCS device will be a subject of the fine-tunings performed during the MDIO-device probe procedures. Signed-off-by: Serge Semin --- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 60283543ffc8..7642c11abc59 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -4,6 +4,7 @@ #include #include +#include #include #include "dwmac-intel.h" #include "dwmac4.h" @@ -585,6 +586,28 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, /* Intel mgbe SGMII interface uses pcs-xcps */ if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII || plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) { + struct mdio_board_info *xpcs_info; + + xpcs_info = devm_kzalloc(&pdev->dev, + sizeof(*xpcs_info) + MII_BUS_ID_SIZE, + GFP_KERNEL); + if (!xpcs_info) { + ret = -ENOMEM; + goto err_alloc_info; + } + + xpcs_info->bus_id = (void *)xpcs_info + sizeof(*xpcs_info); + snprintf((char *)xpcs_info->bus_id, MII_BUS_ID_SIZE, + "stmmac-%x", plat->bus_id); + + snprintf(xpcs_info->modalias, MDIO_NAME_SIZE, "dwxpcs"); + + xpcs_info->mdio_addr = INTEL_MGBE_XPCS_ADDR; + + ret = mdiobus_register_board_info(xpcs_info, 1); + if (ret) + goto err_alloc_info; + plat->mdio_bus_data->has_xpcs = true; plat->mdio_bus_data->xpcs_an_inband = true; } @@ -600,7 +623,7 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, fwnode_handle_put(fixed_node); } - /* Ensure mdio bus scan skips intel serdes and pcs-xpcs */ + /* Ensure mdio bus PHY-scan skips intel serdes and pcs-xpcs */ plat->mdio_bus_data->phy_mask = 1 << INTEL_MGBE_ADHOC_ADDR; plat->mdio_bus_data->phy_mask |= 1 << INTEL_MGBE_XPCS_ADDR; @@ -618,6 +641,12 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->msi_tx_base_vec = 1; return 0; + +err_alloc_info: + clk_disable_unprepare(clk); + clk_unregister_fixed_rate(clk); + + return ret; } static int ehl_common_data(struct pci_dev *pdev, -- 2.42.1