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 4FDF7ECAAD8 for ; Wed, 14 Sep 2022 09:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231593AbiINJvx (ORCPT ); Wed, 14 Sep 2022 05:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbiINJvl (ORCPT ); Wed, 14 Sep 2022 05:51:41 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1591C6564B; Wed, 14 Sep 2022 02:51:38 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 28E9pLvM101296; Wed, 14 Sep 2022 04:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1663149081; bh=bxRmlv6CKHRPXNNeAzFSCgP9txXfJvzZ4l0TXlSS8Ig=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eFN5dR8821LmeB+NrlOQwkF/VFiBsJYTOjJXEeIfXoO3XTDu79GiPpWzXKd3aSXA2 L/Zy9EmCtYsTFAKQ/gtoSFkYmdXTFPj5BhPQSqNBUdg3SMScPGW1S35kXOkRkAtvBh ssBd+PrwPo6Fu1/ERlo+ieVCvLWbaJ/uX2ZS31cs= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 28E9pLmd010367 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Sep 2022 04:51:21 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) 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:20 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE101.ent.ti.com (157.170.170.31) 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:20 -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 28E9osD4046564; Wed, 14 Sep 2022 04:51:16 -0500 From: Siddharth Vadapalli To: , , , , , , , , , , , CC: , , , , , Subject: [PATCH 4/8] net: ethernet: ti: am65-cpsw: Add mac enable link function Date: Wed, 14 Sep 2022 15:20:49 +0530 Message-ID: <20220914095053.189851-5-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 Add function am65_cpsw_nuss_mac_enable_link() to invoke am65_cpsw_enable_phy(), cpsw_ale_control_set(), am65_cpsw_qos_link_up() and netif_tx_wake_all_queues() to prevent duplicate code. The above set of function calls are currently invoked by the am65_cpsw_nuss_mac_link_up() function. In a later patch in this series meant for adding fixed-link support, even the am65_cpsw_nuss_mac_config() function will invoke the same set of functions. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index c7e6ad374e1a..72b1df12f320 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1473,6 +1473,20 @@ static void am65_cpsw_nuss_mac_control(struct am65_cpsw_port *port, phy_interfac cpsw_sl_ctl_set(port->slave.mac_sl, mac_control); } +static void am65_cpsw_nuss_mac_enable_link(struct am65_cpsw_port *port, int speed, int duplex) +{ + struct am65_cpsw_common *common = port->common; + struct net_device *ndev = port->ndev; + /* enable phy */ + am65_cpsw_enable_phy(port->slave.ifphy); + + /* enable forwarding */ + cpsw_ale_control_set(common->ale, port->port_id, ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); + + am65_cpsw_qos_link_up(ndev, speed); + netif_tx_wake_all_queues(ndev); +} + static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned int mode, const struct phylink_link_state *state) { @@ -1521,19 +1535,10 @@ static void am65_cpsw_nuss_mac_link_up(struct phylink_config *config, struct phy struct am65_cpsw_slave_data *slave = container_of(config, struct am65_cpsw_slave_data, phylink_config); struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); - struct am65_cpsw_common *common = port->common; - struct net_device *ndev = port->ndev; am65_cpsw_nuss_mac_control(port, interface, speed, duplex, tx_pause, rx_pause); - /* enable phy */ - am65_cpsw_enable_phy(port->slave.ifphy); - - /* enable forwarding */ - cpsw_ale_control_set(common->ale, port->port_id, ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); - - am65_cpsw_qos_link_up(ndev, speed); - netif_tx_wake_all_queues(ndev); + am65_cpsw_nuss_mac_enable_link(port, speed, duplex); } static const struct phylink_mac_ops am65_cpsw_phylink_mac_ops = { -- 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 6F311ECAAD3 for ; Wed, 14 Sep 2022 09:58:51 +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=etl6rp6yVjolcSeJAfTPrMggDcvncYxxIs7oZ/yb7Hw=; b=NAn0DMeu1rKKHT m+zZt7dwf3HhgpTaopZmaXcgrtBOQBbmnU8/elKJ5sOWZcmhoIJnfd8JDkbY/24wLVay376dawen/ baxsRBiaVoHxujt8HjBkTDHQLtzecvQadga4eYFYFPFFAuHhOxXvxbqGHJqBsWxJN8NzwR8OvxoWz oSp6i9RJNNBSZ/UTzzD/aL0BL5lab+6zMpH/5QmQMGixrXAOBxrTZl/Vq+O6irS+FfIwRYMimVkan Y28sdSff7PYBB+TuVjk44sCPksjdVmQy+CGzQ7+2fLvWPUZunAWvyFwAwj3xe19Cmp8Og3M79kBbh vwI5sSra7D5NL3N1c7Cw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYP97-00EaUF-DG; Wed, 14 Sep 2022 09:57:31 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oYP3M-00EVFe-Ph for linux-arm-kernel@lists.infradead.org; Wed, 14 Sep 2022 09:51:34 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 28E9pLvM101296; Wed, 14 Sep 2022 04:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1663149081; bh=bxRmlv6CKHRPXNNeAzFSCgP9txXfJvzZ4l0TXlSS8Ig=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eFN5dR8821LmeB+NrlOQwkF/VFiBsJYTOjJXEeIfXoO3XTDu79GiPpWzXKd3aSXA2 L/Zy9EmCtYsTFAKQ/gtoSFkYmdXTFPj5BhPQSqNBUdg3SMScPGW1S35kXOkRkAtvBh ssBd+PrwPo6Fu1/ERlo+ieVCvLWbaJ/uX2ZS31cs= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 28E9pLmd010367 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 14 Sep 2022 04:51:21 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) 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:20 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE101.ent.ti.com (157.170.170.31) 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:20 -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 28E9osD4046564; Wed, 14 Sep 2022 04:51:16 -0500 From: Siddharth Vadapalli To: , , , , , , , , , , , CC: , , , , , Subject: [PATCH 4/8] net: ethernet: ti: am65-cpsw: Add mac enable link function Date: Wed, 14 Sep 2022 15:20:49 +0530 Message-ID: <20220914095053.189851-5-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_025132_944801_0F32AC9C X-CRM114-Status: GOOD ( 12.93 ) 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 Add function am65_cpsw_nuss_mac_enable_link() to invoke am65_cpsw_enable_phy(), cpsw_ale_control_set(), am65_cpsw_qos_link_up() and netif_tx_wake_all_queues() to prevent duplicate code. The above set of function calls are currently invoked by the am65_cpsw_nuss_mac_link_up() function. In a later patch in this series meant for adding fixed-link support, even the am65_cpsw_nuss_mac_config() function will invoke the same set of functions. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index c7e6ad374e1a..72b1df12f320 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -1473,6 +1473,20 @@ static void am65_cpsw_nuss_mac_control(struct am65_cpsw_port *port, phy_interfac cpsw_sl_ctl_set(port->slave.mac_sl, mac_control); } +static void am65_cpsw_nuss_mac_enable_link(struct am65_cpsw_port *port, int speed, int duplex) +{ + struct am65_cpsw_common *common = port->common; + struct net_device *ndev = port->ndev; + /* enable phy */ + am65_cpsw_enable_phy(port->slave.ifphy); + + /* enable forwarding */ + cpsw_ale_control_set(common->ale, port->port_id, ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); + + am65_cpsw_qos_link_up(ndev, speed); + netif_tx_wake_all_queues(ndev); +} + static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned int mode, const struct phylink_link_state *state) { @@ -1521,19 +1535,10 @@ static void am65_cpsw_nuss_mac_link_up(struct phylink_config *config, struct phy struct am65_cpsw_slave_data *slave = container_of(config, struct am65_cpsw_slave_data, phylink_config); struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); - struct am65_cpsw_common *common = port->common; - struct net_device *ndev = port->ndev; am65_cpsw_nuss_mac_control(port, interface, speed, duplex, tx_pause, rx_pause); - /* enable phy */ - am65_cpsw_enable_phy(port->slave.ifphy); - - /* enable forwarding */ - cpsw_ale_control_set(common->ale, port->port_id, ALE_PORT_STATE, ALE_PORT_STATE_FORWARD); - - am65_cpsw_qos_link_up(ndev, speed); - netif_tx_wake_all_queues(ndev); + am65_cpsw_nuss_mac_enable_link(port, speed, duplex); } static const struct phylink_mac_ops am65_cpsw_phylink_mac_ops = { -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel