Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp5502623rwb; Wed, 9 Aug 2023 05:20:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHTZd34AW2iqP7hFMiJu8pDWAlTP1ZyIDGJZnGZV8JumoToDlmETLN4mjXeguqZS6Ho8Le2 X-Received: by 2002:a17:903:2341:b0:1bb:2093:efb1 with SMTP id c1-20020a170903234100b001bb2093efb1mr2710744plh.27.1691583656915; Wed, 09 Aug 2023 05:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691583656; cv=none; d=google.com; s=arc-20160816; b=a6719hrYAr87DCRklqgUminV2MdJFDcD0eAqXtpHTePpdjKpMjmNnFxI4dO1adiCZn GV0/JGjDPybbaQXIDDGDUJmbw6G/n1sC+CQU2CAwVRzzwtMc4osFeXH+O4GVhq0laj+C jwLERi3I7NM6d5Nt1d7L5xVCss5rHJt5LMfKQAC9k4VTNEoiWFN3u3dNRmCn8AN+nEwV nL++/fFDWJr7ND7GRzY0PWVNsUGb3HIMqEYepLEPw9MYoEXjrS9etq+wTNYT3fGA7s2I ftredd5cMiIEzdSvKpgoiNzD0DSLaITUBT5kvALhb23rpbbs+tQkU658pIJKyzgpnEQ6 vT+A== 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=bLi7eog4D4zCpcQySKcB5qsTvYGe8HOUojyDdT1AriI=; fh=TO4fkcEI9b5r/wMetIII7RIVPqbK0XaoWpj6Tf2aW8M=; b=snHCBjcySWrpX+MnvQs3STr6z0EdPAs5KHmUQuNiuEQVojM5WSaNb7URdhJCjbnmcH rCNtMG3Vv/8ypcC4gh1Xq02SuZM6GeIf2+uVvnAQ/mNUVEklPxlgIZF5JOIdgahU5/HI Bz3bD3PrkvR+ox5F+fjjpWmNZXlTaGjoId9BqC8G4IMOjvI1Lmn7S2fYE+kkD0TDEDMy I6Qxiw1Guso86dUpRzdtKAZ9Rm1oxzRA9+PULe6Cc0cvHQ9tFi7ntByi1Pnv2Q6e0ZTC 1sUOCGU+MMw9DUcpQW/uPKOozB1nnIc7Sro/q/4kL/DD3WroQVoYDQ69qc8STphhcpoM 6bDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=XR9A+NI5; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g13-20020a170902d1cd00b001b8bb6d9ba6si8660812plb.311.2023.08.09.05.20.41; Wed, 09 Aug 2023 05:20:56 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=XR9A+NI5; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232230AbjHILuc (ORCPT + 99 others); Wed, 9 Aug 2023 07:50:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbjHILuB (ORCPT ); Wed, 9 Aug 2023 07:50:01 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8ABE10C0; Wed, 9 Aug 2023 04:50:00 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 379BnkM5107908; Wed, 9 Aug 2023 06:49:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1691581786; bh=bLi7eog4D4zCpcQySKcB5qsTvYGe8HOUojyDdT1AriI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XR9A+NI5zlszjRHfA9emZtLZIxJjf5KDSla6prcoSXtlN5zKDiRMgenWNRQ1iu9JS fzkLlgE0U9oSTVpBtNTGHlUsR9mnqZGqQL0BZIGw7l1SHVyWaA9NuyzLxDvpXWyqpz xk4QU/gWlsJCAuDfZF8VOk+E+4zPUFq74fQZ9BJw= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 379BnkQl014225 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 9 Aug 2023 06:49:46 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 9 Aug 2023 06:49:46 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Wed, 9 Aug 2023 06:49:46 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 379BnkvB008157; Wed, 9 Aug 2023 06:49:46 -0500 Received: from localhost (uda0501179.dhcp.ti.com [172.24.227.217]) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 379BnjKf002935; Wed, 9 Aug 2023 06:49:45 -0500 From: MD Danish Anwar To: Randy Dunlap , Roger Quadros , Simon Horman , Vignesh Raghavendra , Andrew Lunn , Richard Cochran , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , MD Danish Anwar CC: , , , , , , Subject: [PATCH v3 5/5] net: ti: icssg-prueth: am65x SR2.0 add 10M full duplex support Date: Wed, 9 Aug 2023 17:19:06 +0530 Message-ID: <20230809114906.21866-6-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230809114906.21866-1-danishanwar@ti.com> References: <20230809114906.21866-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED 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 From: Grygorii Strashko For AM65x SR2.0 it's required to enable IEP1 in raw 64bit mode which is used by PRU FW to monitor the link and apply w/a for 10M link issue. Note. No public errata available yet. Without this w/a the PRU FW will stuck if link state changes under TX traffic pressure. Hence, add support for 10M full duplex for AM65x SR2.0: - add new IEP API to enable IEP, but without PTP support - add pdata quirk_10m_link_issue to enable 10M link issue w/a. Signed-off-by: Grygorii Strashko Signed-off-by: Vignesh Raghavendra Signed-off-by: MD Danish Anwar --- drivers/net/ethernet/ti/icssg/icss_iep.c | 26 +++++++++++++++++++ drivers/net/ethernet/ti/icssg/icss_iep.h | 2 ++ drivers/net/ethernet/ti/icssg/icssg_config.c | 7 +++++ drivers/net/ethernet/ti/icssg/icssg_prueth.c | 27 ++++++++++++++++++-- drivers/net/ethernet/ti/icssg/icssg_prueth.h | 2 ++ 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c index 455c803dea36..527f17430f05 100644 --- a/drivers/net/ethernet/ti/icssg/icss_iep.c +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c @@ -721,6 +721,32 @@ void icss_iep_put(struct icss_iep *iep) } EXPORT_SYMBOL_GPL(icss_iep_put); +void icss_iep_init_fw(struct icss_iep *iep) +{ + /* start IEP for FW use in raw 64bit mode, no PTP support */ + iep->clk_tick_time = iep->def_inc; + iep->cycle_time_ns = 0; + iep->ops = NULL; + iep->clockops_data = NULL; + icss_iep_set_default_inc(iep, iep->def_inc); + icss_iep_set_compensation_inc(iep, iep->def_inc); + icss_iep_set_compensation_count(iep, 0); + regmap_write(iep->map, ICSS_IEP_SYNC_PWIDTH_REG, iep->refclk_freq / 10); /* 100 ms pulse */ + regmap_write(iep->map, ICSS_IEP_SYNC0_PERIOD_REG, 0); + if (iep->plat_data->flags & ICSS_IEP_SLOW_COMPEN_REG_SUPPORT) + icss_iep_set_slow_compensation_count(iep, 0); + + icss_iep_enable(iep); + icss_iep_settime(iep, 0); +} +EXPORT_SYMBOL_GPL(icss_iep_init_fw); + +void icss_iep_exit_fw(struct icss_iep *iep) +{ + icss_iep_disable(iep); +} +EXPORT_SYMBOL_GPL(icss_iep_exit_fw); + int icss_iep_init(struct icss_iep *iep, const struct icss_iep_clockops *clkops, void *clockops_data, u32 cycle_time_ns) { diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.h b/drivers/net/ethernet/ti/icssg/icss_iep.h index 9c7f4d0a0916..803a4b714893 100644 --- a/drivers/net/ethernet/ti/icssg/icss_iep.h +++ b/drivers/net/ethernet/ti/icssg/icss_iep.h @@ -35,5 +35,7 @@ int icss_iep_exit(struct icss_iep *iep); int icss_iep_get_count_low(struct icss_iep *iep); int icss_iep_get_count_hi(struct icss_iep *iep); int icss_iep_get_ptp_clock_idx(struct icss_iep *iep); +void icss_iep_init_fw(struct icss_iep *iep); +void icss_iep_exit_fw(struct icss_iep *iep); #endif /* __NET_TI_ICSS_IEP_H */ diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.c b/drivers/net/ethernet/ti/icssg/icssg_config.c index ab648d3efe85..933b84666574 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_config.c +++ b/drivers/net/ethernet/ti/icssg/icssg_config.c @@ -210,6 +210,10 @@ void icssg_config_ipg(struct prueth_emac *emac) case SPEED_100: icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M); break; + case SPEED_10: + /* IPG for 10M is same as 100M */ + icssg_mii_update_ipg(prueth->mii_rt, slice, MII_RT_TX_IPG_100M); + break; default: /* Other links speeds not supported */ netdev_err(emac->ndev, "Unsupported link speed\n"); @@ -440,6 +444,9 @@ void icssg_config_set_speed(struct prueth_emac *emac) case SPEED_100: fw_speed = FW_LINK_SPEED_100M; break; + case SPEED_10: + fw_speed = FW_LINK_SPEED_10M; + break; default: /* Other links speeds not supported */ netdev_err(emac->ndev, "Unsupported link speed\n"); diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 8881f7df1421..b186dce80c9c 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -1149,7 +1149,6 @@ static int emac_phy_connect(struct prueth_emac *emac) /* remove unsupported modes */ phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Half_BIT); - phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_10baseT_Full_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT); phy_remove_link_mode(ndev->phydev, ETHTOOL_LINK_MODE_Pause_BIT); @@ -2090,13 +2089,29 @@ static int prueth_probe(struct platform_device *pdev) goto free_pool; } + prueth->iep1 = icss_iep_get_idx(np, 1); + if (IS_ERR(prueth->iep1)) { + ret = dev_err_probe(dev, PTR_ERR(prueth->iep1), "iep1 get failed\n"); + icss_iep_put(prueth->iep0); + prueth->iep0 = NULL; + prueth->iep1 = NULL; + goto free_pool; + } + + if (prueth->pdata.quirk_10m_link_issue) { + /* Enable IEP1 for FW in 64bit mode as W/A for 10M FD link detect issue under TX + * traffic. + */ + icss_iep_init_fw(prueth->iep1); + } + /* setup netdev interfaces */ if (eth0_node) { ret = prueth_netdev_init(prueth, eth0_node); if (ret) { dev_err_probe(dev, ret, "netdev init %s failed\n", eth0_node->name); - goto netdev_exit; + goto exit_iep; } prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; } @@ -2167,6 +2182,10 @@ static int prueth_probe(struct platform_device *pdev) prueth_netdev_exit(prueth, eth_node); } +exit_iep: + if (prueth->pdata.quirk_10m_link_issue) + icss_iep_exit_fw(prueth->iep1); + free_pool: gen_pool_free(prueth->sram_pool, (unsigned long)prueth->msmcram.va, msmc_ram_size); @@ -2212,6 +2231,10 @@ static void prueth_remove(struct platform_device *pdev) prueth_netdev_exit(prueth, eth_node); } + if (prueth->pdata.quirk_10m_link_issue) + icss_iep_exit_fw(prueth->iep1); + + icss_iep_put(prueth->iep1); icss_iep_put(prueth->iep0); gen_pool_free(prueth->sram_pool, diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.h b/drivers/net/ethernet/ti/icssg/icssg_prueth.h index a56ab4cdc83c..3fe80a8758d3 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.h +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.h @@ -208,6 +208,7 @@ struct prueth_pdata { * @icssg_hwcmdseq: seq counter or HWQ messages * @emacs_initialized: num of EMACs/ext ports that are up/running * @iep0: pointer to IEP0 device + * @iep1: pointer to IEP1 device */ struct prueth { struct device *dev; @@ -231,6 +232,7 @@ struct prueth { u8 icssg_hwcmdseq; int emacs_initialized; struct icss_iep *iep0; + struct icss_iep *iep1; }; struct emac_tx_ts_response { -- 2.34.1