From patchwork Fri Apr 22 07:35:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ong Boon Leong X-Patchwork-Id: 12822986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3B3AC433EF for ; Fri, 22 Apr 2022 07:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=j9hqz1lK8kegFnkob+VyU2slWr8CuDEy3TFsRKjswhk=; b=dKi6PR0YXtiZrK 46zXKlMcTQkPaVIC9Vju9rkj9RnhCO5UnwTJ4+ZI0bwJTw1DA3sNqXiI3yxCLU0nQdNLjY6nFsU3S UCqCgEgvr2rB56k/mogdHcVIcRfY0G57CsTkbZA8tcUgnPwNk1QinLAK2R5V9oTpTMshKVpJHli4a WCWCczxqPsTrdSo/NAu0ihbqkBjjvKDO5peCOhqOGgX4Y3ZE7+Jq0w0Pe2cj+3GSFdKO7dk98OPOR VFA44LuVx0T76DEQo25fsXWnucIza4hGSP9NHufdCtOeu/byLjSkEHvp1BaypaAjdTmze3MgFZXZs HK/bdNvslmq7IiFDM4VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nho1O-00Gy6n-5s; Fri, 22 Apr 2022 07:48:07 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nhntT-00Gu5w-A6 for linux-arm-kernel@lists.infradead.org; Fri, 22 Apr 2022 07:39:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1650613195; x=1682149195; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nEPLMdPCwdmEFgscrfAJ4fkH252LE7MCcUu/Flr5Wyo=; b=SD9/S/n4R3glDD9N6qFUphzXrU0j5ncFl/olGewggySnYpMyhhRBS01u abgW132Q0giJJD53ryQn5hkMtTIJVASt7PP6SgPTLJ+/JcW/pkAcgDVDC Afbd2MDn32edBS1grrkban3gOF6H1hvjiA2PuMEeYAxAQAs6T5GsY92aF CyFxarYeByhw2lwIv4yO51fx8Liu9w+h9Rz/0bV4QbUtquRDhlXCZ+Ru1 dXlvyATiEH1ZNI0N9QYIUvv4x2B/QFG8oVJk1/g9zYhuica7zNDF7b6j+ CRcOkUykDOHG6QgSjLYffREi6/wYCIybfW62B/F/HzDdr8AdAjWIPX73B g==; X-IronPort-AV: E=McAfee;i="6400,9594,10324"; a="244534090" X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="244534090" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2022 00:39:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,281,1643702400"; d="scan'208";a="648516353" Received: from p12hl98bong5.png.intel.com ([10.158.65.178]) by FMSMGA003.fm.intel.com with ESMTP; 22 Apr 2022 00:39:39 -0700 From: Ong Boon Leong To: Alexandre Torgue , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Paolo Abeni , "David S . Miller" , Jakub Kicinski , Maxime Coquelin , Alexandre Torgue , Giuseppe Cavallaro Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ong Boon Leong Subject: [PATCH net-next 4/4] stmmac: intel: introduce platform data phyless setting for Ericsson system Date: Fri, 22 Apr 2022 15:35:05 +0800 Message-Id: <20220422073505.810084-5-boon.leong.ong@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422073505.810084-1-boon.leong.ong@intel.com> References: <20220422073505.810084-1-boon.leong.ong@intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220422_003955_506928_F9B7352B X-CRM114-Status: GOOD ( 14.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Certain platform wants specific GbE controller instance to be in PHY-less mode, i.e. to be used for 1000BASE-X connection for network switch. Tested-by: Emilio Riva Signed-off-by: Ong Boon Leong --- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 265d39acdd0..9c9577fc15d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -24,6 +24,8 @@ struct intel_priv_data { struct stmmac_pci_func_data { unsigned int func; int phy_addr; + phy_interface_t phy_interface; + unsigned int phyless; }; struct stmmac_pci_dmi_data { @@ -439,10 +441,65 @@ static void common_default_data(struct plat_stmmacenet_data *plat) plat->rx_queues_cfg[0].pkt_route = 0x0; } +static const struct stmmac_pci_func_data ericsson_phyless_func_data[] = { + { + .func = 2, + .phy_interface = PHY_INTERFACE_MODE_1000BASEX, + .phyless = true, + }, +}; + +static const struct stmmac_pci_dmi_data ericsson_phyless_dmi_data = { + .func = ericsson_phyless_func_data, + .nfuncs = ARRAY_SIZE(ericsson_phyless_func_data), +}; + +static const struct dmi_system_id intel_mgbe_pci_dmi[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Ericsson"), + DMI_MATCH(DMI_BOARD_NAME, "SMARC-SXEL"), + }, + .driver_data = (void *)&ericsson_phyless_dmi_data, + }, + {} +}; + +static bool stmmac_pci_find_phyless(struct pci_dev *pdev, + const struct dmi_system_id *dmi_list, + phy_interface_t *phy_interface, + unsigned int *phyless) +{ + const struct stmmac_pci_func_data *func_data; + const struct stmmac_pci_dmi_data *dmi_data; + const struct dmi_system_id *dmi_id; + int func = PCI_FUNC(pdev->devfn); + size_t n; + + dmi_id = dmi_first_match(dmi_list); + if (!dmi_id) + return false; + + dmi_data = dmi_id->driver_data; + func_data = dmi_data->func; + + for (n = 0; n < dmi_data->nfuncs; n++, func_data++) + if (func_data->func == func) { + *phy_interface = func_data->phy_interface; + *phyless = func_data->phyless; + return true; + } + + return false; +} + static int intel_mgbe_common_data(struct pci_dev *pdev, struct plat_stmmacenet_data *plat) { + phy_interface_t phy_interface; + unsigned int phyless; char clk_name[20]; + bool found; int ret; int i; @@ -559,6 +616,13 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, /* Use the last Rx queue */ plat->vlan_fail_q = plat->rx_queues_to_use - 1; + found = stmmac_pci_find_phyless(pdev, intel_mgbe_pci_dmi, + &phy_interface, &phyless); + if (found) { + plat->mdio_bus_data->phyless = phyless; + plat->phy_interface = phy_interface; + } + /* Intel mgbe SGMII interface uses pcs-xcps */ if (plat->phy_interface == PHY_INTERFACE_MODE_SGMII || plat->phy_interface == PHY_INTERFACE_MODE_1000BASEX) {