Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp111389lqb; Tue, 4 Jun 2024 06:40:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWByQbTRrkPuDiQXC1UWqQEeMjrR2gLCbM1m2NY07tIoMDQqbPlXbr27Coo/HDP+3aeTAOlJ6tSAMHNgHMHgbONMosqaCilycLPm07e4Q== X-Google-Smtp-Source: AGHT+IFfzUX7XtDXGdu4u85xXddFMMlBKxOa5z8iAw5vh1JmyuQSEoHD2jgRV6wdVPTslq06iVcf X-Received: by 2002:a17:902:e751:b0:1f6:35ab:dd50 with SMTP id d9443c01a7336-1f636fd2313mr141547415ad.12.1717508409826; Tue, 04 Jun 2024 06:40:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717508409; cv=pass; d=google.com; s=arc-20160816; b=tIBHHk/2MedKMop0g04TVlaC7wbW8PgxV+HBfwLldsG7Bk23VqZAkLj+Tbi3G30lYZ qWl+/B0eejMqZHpjwA2BKb1fB/PuNE6KnW0LWHZWH68FPLUy1YER8jeJ3NZYHrhy3Aii OuipbiYURqmlo7JEpfzmtTrViU5f3+EEkw1NhhFH1mapr4awzVRlkWZSpvZrdzFQ7+y5 WJwi9pFzD6jGh8BdcX1bSihqpSZWgRFwGDL5YV//1PnQK/UavchnJM4HQToiMvy90kYH kHwNE6Bn9sT5hQCSrHJNqZwGw3vffFopnkjxCabzDuzWpJfjMq6rrN+fEVZWHtF++mxD VWeg== 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=gyr1CD+UnLkCQ5vXJuQGttb1QaQr4bwr82HurIQkO2o=; fh=WzXaSz7O0nvKAPxuEMDfPgGNT0/QiwM+PpEHWX5gjWo=; b=QYlr9meVcf6yM3DWMMxLrboUNyh4T2Y2I1E6a5TYPSLl27OMDZqTfOjj1fZM/IJg4N MU8TOLM245dWj85zLnUrw8u6fScpDpljW6Kw6+z4ksVRPVmlM5KMhoSuljZI5bGU2sAQ 0rLVGFaZvsCJyOjPq9nl2GhVsRIspd36zmy18rWnHJmN88i2vweUUpET10yOdPimpITX hZfMbrnkQEmWkRx1EEl5vDbgkyuyyHyJ3ievq03S0a2REkycJDMN5R4VCxw+KpoVDIPV oZFLNOjsUq+beozEpQ2Wj3hL+fMneI961ygTTZlfi7KnqWw0TZVjGDZbmlcEcOd3PANy Sgsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=CXcRVcpB; 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-200678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200678-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323ddad5si78176645ad.207.2024.06.04.06.40.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 06:40:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=CXcRVcpB; 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-200678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200678-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DA0D8B26192 for ; Tue, 4 Jun 2024 13:15:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3069146019; Tue, 4 Jun 2024 13:15:38 +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="CXcRVcpB" Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) (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 D40821465A3 for ; Tue, 4 Jun 2024 13:15:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.136.64.227 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717506937; cv=none; b=uf5Vu5WIg/IPxmXnRW3b6UuZnxf4OrfsyXbNsVkBP4Bpiep4f6S/9ZUKeXZvVJRiLmR6pjDpAbyt6UyidojlFkKvF1Jk3yM6fyq7WMswghuQxOQgKqyb7L7Ym38bxRuTHn1OA1cG1Iu34Ejm7JlztgkTo/ADSq0ITPDwGLqRPCg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717506937; c=relaxed/simple; bh=atMXczjLyf8GAjV1Wp38xZVTh5h1FyoEieam3CEu9ro=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=r5SpwIFu+YI8iDGEn8K+NxvfODKFZwMBjtDSnu6rz+bJgv2QsFwypI4bvCCASTlyou8ljq8+QWmkNIPzawfUDA3qdvdOarQHkOI3wXLQ+EnY89+Cx9bINS6M4wNrZn+STZZ8VOi9hKnbdQnnsuUSLjexcZvyL4IFfvyYrhNMwQ8= 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=CXcRVcpB; arc=none smtp.client-ip=185.136.64.227 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-227.siemens.flowmailer.net with ESMTPSA id 20240604131527883ca1dc26a195c71d for ; Tue, 04 Jun 2024 15:15:27 +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=gyr1CD+UnLkCQ5vXJuQGttb1QaQr4bwr82HurIQkO2o=; b=CXcRVcpB+cokNNqxkt9cPkSKynEy2WGzvg4CfRiVMmEWhmSAszaofTzAEI2CpkVvYehp2p tmA/7y5D0lpX1jHBXH0d2LCPWztf53L/MtM2g5wFHgsX2EtkK1XYK+rWsXuPJ2y4k43JuE5Y 8optpE5fsZ2dkaP1d7hTwjZB28BFA=; From: Diogo Ivo Date: Tue, 04 Jun 2024 14:15:10 +0100 Subject: [PATCH net-next v2 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: <20240604-iep-v2-1-ea8e1c0a5686@siemens.com> References: <20240604-iep-v2-0-ea8e1c0a5686@siemens.com> In-Reply-To: <20240604-iep-v2-0-ea8e1c0a5686@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 , Jacob Keller , Simon Horman 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=1717506924; l=3085; i=diogo.ivo@siemens.com; s=20240529; h=from:subject:message-id; bh=atMXczjLyf8GAjV1Wp38xZVTh5h1FyoEieam3CEu9ro=; b=MHuyIRXScvlOzyj+7BlmPGj7tdOD60gxU9q5nw8OI71GluXik7fa0TU0cTTsznh9trx3JbTIH xY7Uu4T811hAOyIA5Rp0/cobtwk1gpqurTXmkb9vZqzvfwEjd2OMuQh 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. Reviewed-by: Jacob Keller Signed-off-by: Diogo Ivo --- drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c | 51 +++++++++++++++++++++++- 1 file changed, 50 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..fa98bdb11ece 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c @@ -1011,16 +1011,44 @@ 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 +1061,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 +1121,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 +1181,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.2