Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp738119lqb; Wed, 29 May 2024 09:06:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwnmc2IQJqeBAC1YG15QHs9YC+vnakYLgT1dOzDLKNmutvUjsrJ6d3VJ37V3/eqwEHmEUNzTLie8YMNvt5YBLbQENR6uy95R3s22PGKQ== X-Google-Smtp-Source: AGHT+IGGENLnBQgipJ3b/tUKIE99IILZ/B1JjRLxpa97uIUwgvihuVAYGstnRxIHaPE0IxyrK4Jf X-Received: by 2002:a67:f60e:0:b0:48b:a830:9bb with SMTP id ada2fe7eead31-48ba8300acdmr1405044137.28.1716998818473; Wed, 29 May 2024 09:06:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716998818; cv=pass; d=google.com; s=arc-20160816; b=vR5rkk+t9Q5wV0F1s5zcOfHZsRdcCH+aOiAY0hmHqG1pNCiNsP7k1s2rcTUpwH33ja dYjvFFZJZPM+U01cIDw+t7opNBsmyq/+giiaWF7SpjrH1hXlUNsvSUmNqc6qa6cC2+1B v5s7h63PpoYT+9IJgJ/uEM9KKl4oWwcISUhEns+qA37HMdwkvhg9MepGVTCDnSpMHbIx SdUptJTBY4O6fMYvZWwcR6DYCoLkHrGae6x3yzfSbns3Oy/AzLIYpfA+diIuYBmmHpBj cci/jURzkVc8WaPapIxBblVNqCjbOOeRO4TAqscCMYk+Kw4c4oKGA1nUXERfZSlY+tEI 0LbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=t0N1v6lGOWmbUT2zPk1pBlnpA8KnITb1ou0m2UPQizo=; fh=O31swR33Q9BCrCgZsims0e0hEnEA7XKhc6flmHI4BT8=; b=ohqMRPc2kZAyLcl4B6FRuvd3ezfVPonsbBzxunVoVIsFVtLRrjvwgvXO2ISstdUlN4 pkxkblRekgTVrIWTOlwNfheL9RYAh+HNjXM6/Np9E80kiDWq2wVV2cFEVwkgfL2sqeQv uxBFXovciok3CkQTKzbx9j+KvcE38tAixJ9kV86YmAbSDaamrPgVdNbKaj7yAP1wSg79 jDAyWUdbQ5wSbPPvOWiaSdaIC3MohDSIZz3JMWMk2JlraAL+Unrl7oFI2bWV1zxI+RZx bmlF+9cNNyIFJHHjGZxNnm/nVmEn4YwAp86Fwh+lq4OUFIkMLjC3E9G1JSpTOPiE9pPP TS8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=jYAPhQ+s; arc=pass (i=1 spf=pass spfdomain=rts-flowmailer.siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-194415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48a3a2fd9dcsi2335909137.321.2024.05.29.09.06.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 09:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=jYAPhQ+s; arc=pass (i=1 spf=pass spfdomain=rts-flowmailer.siemens.com dkim=pass dkdomain=siemens.com dmarc=pass fromdomain=siemens.com); spf=pass (google.com: domain of linux-kernel+bounces-194415-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194415-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 31D031C2418A for ; Wed, 29 May 2024 16:06:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6706119069B; Wed, 29 May 2024 16:05:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=siemens.com header.i=diogo.ivo@siemens.com header.b="jYAPhQ+s" Received: from mta-64-225.siemens.flowmailer.net (mta-64-225.siemens.flowmailer.net [185.136.64.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90E591836F0 for ; Wed, 29 May 2024 16:05:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.64.225 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716998746; cv=none; b=glxK/riIrpWWq8ClyE0k5DZkQ3l3SoEYqAjIpR25WWRDYJatsKxtZuXgoEJoMAAnli10WRHerhh6IB3CdNUcKALogDthdteQcxWSc/KWnlx0y3J9TptP8OcpOPNX/HgT4LtewquZPrLaY/oBngt09e2SyJiLkl0hFM7fc9/f1C8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716998746; c=relaxed/simple; bh=3oNbe7+kl949vpSxjYDcQs/lpiG/Vv5Of/GL7kFfQV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F/3bE6z9mmuTkjA1MkSr6lF1AJP3jhWmcxAtCpvfGRQYRb82BytuwdKVcks7BX899fSFhHDZW5qGDbMiNiI18ruDRlfOBo70X8lFBijqIfQQlPcz0wyFTNvmpYnL+jXZrIYnqqDkP2Ry/nCIrq1RdKpyJrkpO7bWRRFq7HW/4fg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com; dkim=pass (1024-bit key) header.d=siemens.com header.i=diogo.ivo@siemens.com header.b=jYAPhQ+s; arc=none smtp.client-ip=185.136.64.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=siemens.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rts-flowmailer.siemens.com Received: by mta-64-225.siemens.flowmailer.net with ESMTPSA id 20240529160534e55d11188f8cb7e837 for ; Wed, 29 May 2024 18:05:35 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=diogo.ivo@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=t0N1v6lGOWmbUT2zPk1pBlnpA8KnITb1ou0m2UPQizo=; b=jYAPhQ+sPK401ZFkELi4ZYu1n6CQmj8eOgGVaGjv+JIi8P2Z3kVAr7ylkgSdejxVQ/o8Yd RyvwOg8ge+rV2/CETuM5SGkDJfhOhOJadRzU/Sq2CGDkoh87zXaN5T/2uXneCKGYebwksX/l 8qtPPfKJ0wYdUup8TPrw5NJ/Q9Nj4=; From: Diogo Ivo Date: Wed, 29 May 2024 17:05:10 +0100 Subject: [PATCH 1/3] net: ti: icssg-prueth: Enable PTP timestamping support for SR1.0 devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240529-iep-v1-1-7273c07592d3@siemens.com> References: <20240529-iep-v1-0-7273c07592d3@siemens.com> In-Reply-To: <20240529-iep-v1-0-7273c07592d3@siemens.com> To: MD Danish Anwar , Roger Quadros , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jan Kiszka Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Diogo Ivo X-Developer-Signature: v=1; a=ed25519-sha256; t=1716998732; l=3011; i=diogo.ivo@siemens.com; s=20240529; h=from:subject:message-id; bh=3oNbe7+kl949vpSxjYDcQs/lpiG/Vv5Of/GL7kFfQV4=; b=8GNTjGB2viq7HJxCXsyDfzcZ62uwz78d5Ex2SZIOKIvNum45Vl7fAHZKU017hReeDpGJV1/p7 YiKGMWTfgv6DTLFGOTd+HryoVUFc6foZcvKzicEhmWjzF1H+gIuKwF9 X-Developer-Key: i=diogo.ivo@siemens.com; a=ed25519; pk=BRGXhMh1q5KDlZ9y2B8SodFFY8FGupal+NMtJPwRpUQ= X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1320519:519-21489:flowmailer Enable PTP support for AM65x SR1.0 devices by registering with the IEP infrastructure in order to expose a PTP clock to userspace. Signed-off-by: Diogo Ivo --- drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 49 +++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c index 7b3304bbd7fc..01cad01965dc 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c @@ -1011,16 +1011,42 @@ static int prueth_probe(struct platform_device *pdev) dev_dbg(dev, "sram: pa %llx va %p size %zx\n", prueth->msmcram.pa, prueth->msmcram.va, prueth->msmcram.size); + prueth->iep0 = icss_iep_get_idx(np, 0); + if (IS_ERR(prueth->iep0)) { + ret = dev_err_probe(dev, PTR_ERR(prueth->iep0), "iep0 get failed\n"); + 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"); + goto put_iep0; + } + + ret = icss_iep_init(prueth->iep0, NULL, NULL, 0); + if (ret) { + dev_err_probe(dev, ret, "failed to init iep0\n"); + goto put_iep; + } + + ret = icss_iep_init(prueth->iep1, NULL, NULL, 0); + if (ret) { + dev_err_probe(dev, ret, "failed to init iep1\n"); + goto exit_iep0; + } + 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 free_pool; + goto exit_iep; } if (of_find_property(eth0_node, "ti,half-duplex-capable", NULL)) prueth->emac[PRUETH_MAC0]->half_duplex = 1; + + prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; } if (eth1_node) { @@ -1033,6 +1059,8 @@ static int prueth_probe(struct platform_device *pdev) if (of_find_property(eth1_node, "ti,half-duplex-capable", NULL)) prueth->emac[PRUETH_MAC1]->half_duplex = 1; + + prueth->emac[PRUETH_MAC1]->iep = prueth->iep1; } /* register the network devices */ @@ -1091,6 +1119,19 @@ static int prueth_probe(struct platform_device *pdev) prueth_netdev_exit(prueth, eth_node); } +exit_iep: + icss_iep_exit(prueth->iep1); +exit_iep0: + icss_iep_exit(prueth->iep0); + +put_iep: + icss_iep_put(prueth->iep1); + +put_iep0: + icss_iep_put(prueth->iep0); + prueth->iep0 = NULL; + prueth->iep1 = NULL; + free_pool: gen_pool_free(prueth->sram_pool, (unsigned long)prueth->msmcram.va, msmc_ram_size); @@ -1138,6 +1179,12 @@ static void prueth_remove(struct platform_device *pdev) prueth_netdev_exit(prueth, eth_node); } + icss_iep_exit(prueth->iep1); + icss_iep_exit(prueth->iep0); + + icss_iep_put(prueth->iep1); + icss_iep_put(prueth->iep0); + gen_pool_free(prueth->sram_pool, (unsigned long)prueth->msmcram.va, MSMC_RAM_SIZE_SR1); -- 2.45.1