From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EA55ECAAD8 for ; Wed, 14 Sep 2022 09:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231643AbiINJwD (ORCPT ); Wed, 14 Sep 2022 05:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbiINJvr (ORCPT ); Wed, 14 Sep 2022 05:51:47 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF64F6525A; Wed, 14 Sep 2022 02:51:45 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 28E9pQOM076001; Wed, 14 Sep 2022 04:51:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1663149086; bh=FdVUnDFp16ezDHMqnlWq9HVXxMiIkhGZNGfWC+wvPoQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DnVITB5m+mXawnsBLRCWXotexkE41BX609dO9nVAKCDR7JBSRmddmwy55mZaRs3Ys xqZr7w3GLGZYRi+YZsUkqrsenJ4G9LfyH2jA/sfqRw7tfdNW/rdnGu8clpWyUWvPMp pcODLdIrR/W9hsQkjMBuC8iCgZyBc3uNVlV1GSTQ= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 28E9pQ9U010396 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Sep 2022 04:51:26 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Wed, 14 Sep 2022 04:51:26 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Wed, 14 Sep 2022 04:51:25 -0500 Received: from uda0492258.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 28E9osD5046564; Wed, 14 Sep 2022 04:51:21 -0500 From: Siddharth Vadapalli To: , , , , , , , , , , , CC: , , , , , Subject: [PATCH 5/8] net: ethernet: ti: am65-cpsw: Add support for fixed-link configuration Date: Wed, 14 Sep 2022 15:20:50 +0530 Message-ID: <20220914095053.189851-6-s-vadapalli@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914095053.189851-1-s-vadapalli@ti.com> References: <20220914095053.189851-1-s-vadapalli@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check for fixed-link in am65_cpsw_nuss_mac_config() using struct am65_cpsw_slave_data's phy_node property to obtain fwnode. Since am65_cpsw_nuss_mac_link_up() is not invoked in fixed-link mode, perform the relevant operations in am65_cpsw_nuss_mac_config() itself. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 72b1df12f320..1739c389af20 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1494,10 +1494,50 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in phylink_config); struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); struct am65_cpsw_common *common = port->common; + struct fwnode_handle *fwnode; + bool fixed_link = false; if (common->pdata.extra_modes & BIT(state->interface)) writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); + + /* Detecting fixed-link */ + fwnode = of_node_to_fwnode(port->slave.phy_node); + if (fwnode) + fixed_link = !!fwnode_get_named_child_node(fwnode, "fixed-link"); + + if (fixed_link) { + /* In fixed-link mode, mac_link_up is not invoked. + * Therefore, the relevant mac_link_up operations + * have to be moved to mac_config. + */ + am65_cpsw_nuss_mac_control(port, state->interface, state->speed, + state->duplex, state->pause & MLO_PAUSE_TX, + state->pause & MLO_PAUSE_RX); + + if (state->speed == SPEED_1000) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_1G; + if (state->speed == SPEED_100) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_100M; + if (state->duplex) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_FULLDUPLEX; + + if (state->interface == PHY_INTERFACE_MODE_SGMII && + (common->pdata.extra_modes & BIT(state->interface))) { + writel(mr_adv_ability, + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); + writel((AM65_CPSW_SGMII_CONTROL_MASTER_MODE | + AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE), + port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); + } + + am65_cpsw_nuss_mac_enable_link(port, state->speed, state->duplex); + } else { + if (state->interface == PHY_INTERFACE_MODE_SGMII && + (common->pdata.extra_modes & BIT(state->interface))) + writel(MAC2PHY_MR_ADV_ABILITY, + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); + } } static void am65_cpsw_nuss_mac_link_down(struct phylink_config *config, unsigned int mode, -- 2.25.1 From mboxrd@z Thu Jan 1 00:00:00 1970 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 A245DECAAD3 for ; Wed, 14 Sep 2022 10:00:19 +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=qt/Lnz5LVgVyTujgTH2Z75jQsb6Z4bLGHcdc7N51QRo=; b=Dw2uK4VogDMzcq qLyra2K+6d1Y54WMgcsDMPDNLAaTvXADPhuPCxdem2AJaIT8/G2IW7MKmkFGptLPtjXMmmrZcaVBk DJwZv43S4pM9qBd5yAzL/tRFVt2/m0AMnydGoa+lbp11TYFPOlwkaeoiK6wwN3XmLaOhOsJE+huuq H70HXsdRhNBVcg90XU12s1fjL9d52cAeaErtVj/43o8wmuvMssFsVKBirLGAPaC6HjpG8tt+ZXoNL aA9RKcyQ57tMsXWMp8KO/XPE8INAmtjYNaZmq5ZUBdQ3p5RS2X0ImN/Yh6QzPZ2kA6OOhU15MtW3u jyHhKZRofXi9f0i+4F7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYPAh-00EcOY-8X; Wed, 14 Sep 2022 09:59:07 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYP3S-00EVJs-Bh for linux-arm-kernel@lists.infradead.org; Wed, 14 Sep 2022 09:51:40 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 28E9pQOM076001; Wed, 14 Sep 2022 04:51:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1663149086; bh=FdVUnDFp16ezDHMqnlWq9HVXxMiIkhGZNGfWC+wvPoQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=DnVITB5m+mXawnsBLRCWXotexkE41BX609dO9nVAKCDR7JBSRmddmwy55mZaRs3Ys xqZr7w3GLGZYRi+YZsUkqrsenJ4G9LfyH2jA/sfqRw7tfdNW/rdnGu8clpWyUWvPMp pcODLdIrR/W9hsQkjMBuC8iCgZyBc3uNVlV1GSTQ= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 28E9pQ9U010396 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Sep 2022 04:51:26 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Wed, 14 Sep 2022 04:51:26 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Wed, 14 Sep 2022 04:51:25 -0500 Received: from uda0492258.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 28E9osD5046564; Wed, 14 Sep 2022 04:51:21 -0500 From: Siddharth Vadapalli To: , , , , , , , , , , , CC: , , , , , Subject: [PATCH 5/8] net: ethernet: ti: am65-cpsw: Add support for fixed-link configuration Date: Wed, 14 Sep 2022 15:20:50 +0530 Message-ID: <20220914095053.189851-6-s-vadapalli@ti.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220914095053.189851-1-s-vadapalli@ti.com> References: <20220914095053.189851-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220914_025138_577112_A26AF7AB X-CRM114-Status: GOOD ( 14.71 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Check for fixed-link in am65_cpsw_nuss_mac_config() using struct am65_cpsw_slave_data's phy_node property to obtain fwnode. Since am65_cpsw_nuss_mac_link_up() is not invoked in fixed-link mode, perform the relevant operations in am65_cpsw_nuss_mac_config() itself. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 72b1df12f320..1739c389af20 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1494,10 +1494,50 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in phylink_config); struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); struct am65_cpsw_common *common = port->common; + struct fwnode_handle *fwnode; + bool fixed_link = false; if (common->pdata.extra_modes & BIT(state->interface)) writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); + + /* Detecting fixed-link */ + fwnode = of_node_to_fwnode(port->slave.phy_node); + if (fwnode) + fixed_link = !!fwnode_get_named_child_node(fwnode, "fixed-link"); + + if (fixed_link) { + /* In fixed-link mode, mac_link_up is not invoked. + * Therefore, the relevant mac_link_up operations + * have to be moved to mac_config. + */ + am65_cpsw_nuss_mac_control(port, state->interface, state->speed, + state->duplex, state->pause & MLO_PAUSE_TX, + state->pause & MLO_PAUSE_RX); + + if (state->speed == SPEED_1000) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_1G; + if (state->speed == SPEED_100) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_100M; + if (state->duplex) + mr_adv_ability |= MAC2MAC_MR_ADV_ABILITY_FULLDUPLEX; + + if (state->interface == PHY_INTERFACE_MODE_SGMII && + (common->pdata.extra_modes & BIT(state->interface))) { + writel(mr_adv_ability, + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); + writel((AM65_CPSW_SGMII_CONTROL_MASTER_MODE | + AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE), + port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); + } + + am65_cpsw_nuss_mac_enable_link(port, state->speed, state->duplex); + } else { + if (state->interface == PHY_INTERFACE_MODE_SGMII && + (common->pdata.extra_modes & BIT(state->interface))) + writel(MAC2PHY_MR_ADV_ABILITY, + port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); + } } static void am65_cpsw_nuss_mac_link_down(struct phylink_config *config, unsigned int mode, -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel