From patchwork Fri Oct 4 15:24:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 13822576 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 EEE79CF8849 for ; Fri, 4 Oct 2024 15:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KptdMQH+uxSKHP9pjmqfYtljNFGdshmXN06eLUlgi/0=; b=mtsQzYb63WjHYEXzi6TvsiOsyG M2cF2ML6UozrsO0TaaeyKcFcmBLtdHopvvwnSRB8R44v+MRX6gAqqgM8+nWevdU3D8BLX7Zdtku1t bqc88GHi8iph5Lac6T68o1I4i0bCqazHxw6tuQ6W2bQA2gxFBOG+fsEq/IDNfgjiilXjAlZXJGO0Y 3mxfR1WpKEf8ydvc1ch64BvyIiuOZjdu4bvByx5CdkHOV5sAan506XZXo6vAFJ320gAU4SrvJx9/7 oTI3ivpdict3I74G8u8nnVeR6g3aTrFaQMxgaJraScxP7hutFaf50oYnzjdvqYilCgcwa0v0/nIzw Xm3BgzUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swkBp-0000000Cz9f-3TcG; Fri, 04 Oct 2024 15:25:57 +0000 Received: from mail11.truemail.it ([2001:4b7e:0:8::81]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swkAX-0000000Cyjm-3doe for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 15:24:39 +0000 Received: from francesco-nb.pivistrello.it (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 7E66320E6A; Fri, 4 Oct 2024 17:24:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1728055472; bh=KptdMQH+uxSKHP9pjmqfYtljNFGdshmXN06eLUlgi/0=; h=From:To:Subject; b=YGKx+jKeyGwPTK6aIWenY7KyUgJC/HHQa++ChR1Or7cZQhgrC8EKpXUzOQDC4HWZz ES2ETkNGTfLHiLANHkUnT43CETfYs0cab1VDsX4ncnR9XdM1DwIuUD3MCcMNyCV2mw xYme84OqXN9W6XdQZmzVEbMsi+2a8Z7AzObRU1vcNZgrii+eL1idZnuqyKe5xNBMmT SdeCfO7U0ikw0LEaNAhNDfBxzhjr8wi2+5OM7c/WAXfFJIG6uy3u8hhaeyAgXtKdF7 yMrihUVHdWbaWh18/u+pXYzXzqQj0Xpglyv+gB1OirYG4LI4SCkiu3lQKfcAv/5NR3 rs7g2XPDZA0qA== From: Francesco Dolcini To: Wei Fang , Shenwei Wang , Clark Wang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Richard Cochran , Linux Team Cc: Francesco Dolcini , imx@lists.linux.dev, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Frank Li , Rafael Beims Subject: [PATCH net-next v4 3/3] net: fec: make PPS channel configurable Date: Fri, 4 Oct 2024 17:24:19 +0200 Message-Id: <20241004152419.79465-4-francesco@dolcini.it> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241004152419.79465-1-francesco@dolcini.it> References: <20241004152419.79465-1-francesco@dolcini.it> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_082438_097983_8A1D6AF9 X-CRM114-Status: GOOD ( 12.19 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Francesco Dolcini Depending on the SoC where the FEC is integrated into the PPS channel might be routed to different timer instances. Make this configurable from the devicetree. When the related DT property is not present fallback to the previous default and use channel 0. Reviewed-by: Frank Li Tested-by: Rafael Beims Signed-off-by: Francesco Dolcini Reviewed-by: Csókás, Bence --- v4: no changes v3: no changes v2: add Reviewed|Tested-by --- drivers/net/ethernet/freescale/fec_ptp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index ce7aa2c38c7f..aea24575e840 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -523,8 +523,6 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp, unsigned long flags; int ret = 0; - fep->pps_channel = DEFAULT_PPS_CHANNEL; - if (rq->type == PTP_CLK_REQ_PPS) { fep->reload_period = PPS_OUPUT_RELOAD_PERIOD; @@ -706,12 +704,16 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) { struct net_device *ndev = platform_get_drvdata(pdev); struct fec_enet_private *fep = netdev_priv(ndev); + struct device_node *np = fep->pdev->dev.of_node; int irq; int ret; fep->ptp_caps.owner = THIS_MODULE; strscpy(fep->ptp_caps.name, "fec ptp", sizeof(fep->ptp_caps.name)); + fep->pps_channel = DEFAULT_PPS_CHANNEL; + of_property_read_u32(np, "fsl,pps-channel", &fep->pps_channel); + fep->ptp_caps.max_adj = 250000000; fep->ptp_caps.n_alarm = 0; fep->ptp_caps.n_ext_ts = 0;