From patchwork Tue Jul 11 20:35:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13309384 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 E25BCEB64DD for ; Tue, 11 Jul 2023 20:58:41 +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=JVbBDMF5iiBId5wz4f+wosjZNigTLdF1VSQ4SsrUhq8=; b=f7kTH99GK1LR54 rME2nBeDpwowJB8vs8vjA/e9+M8gclUpQJmT+9Vxr7y0xIutE/LxlZY0qtvWvZJuKuXslApxfvhVP p3cUPsNklIHMhF0nPtGfhGmEYk9vqzmm0S3pe4TuMiS22IoeDbNSzjvhjHJDoBkEjACVDAuiz2lXN xTMqBudcJ/JIGwvV5I6xNJbE6APLtAwnqXkkcmRoynazJzkeBnTudDRvyFOQpGyB0fJ44LqtrOMGw 9xPiwASnG/YnQvTYO2rqvIY1B/uHXHAB1guLYcxeBxBoGFON8ZfpyPb+VImdfoLK5BtR6H6Je2ETe n9C6SshAs3khyM+vTXKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJKR6-00Fsfm-2L; Tue, 11 Jul 2023 20:58:16 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJKR3-00Fsex-1W for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 20:58:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689109092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DGh+uAGSNBabNs8otONzVd5nXL6Ue86FrE6lpV0zFTs=; b=OArO2mzRUq2d1CFg0i4WIQ5U3YuByW8RaWLGIKFJBVbRbjNs/7AsVnActh1bcApFbZlyTf iA4+ZnOQTbaXwzgiRhoMitrukylur3olLYwrHELMy9V3DXovDKOT+DpP4hUVgLqSXrGBqS skcqBbbMcaoKNztgJtlJyucvkZdnHWc= Received: from mail-yw1-f197.google.com (mail-yw1-f197.google.com [209.85.128.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-474-fEk2t1Q5NfqhiocpKAeWkg-1; Tue, 11 Jul 2023 16:58:11 -0400 X-MC-Unique: fEk2t1Q5NfqhiocpKAeWkg-1 Received: by mail-yw1-f197.google.com with SMTP id 00721157ae682-5704970148dso62815847b3.3 for ; Tue, 11 Jul 2023 13:58:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689109091; x=1691701091; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DGh+uAGSNBabNs8otONzVd5nXL6Ue86FrE6lpV0zFTs=; b=lH/vM/DePfcZDOIG5fN2HprWJkVWxqoBNqt9jXPqdyOCLBhAjXUsM6gYjo+DvPPBMo H6FIttzM1SycjqIVu3dm/TcKexs4AzdpfQDPsWY5MWSo0OY4fgTo75ThQbAX2UBYh/W6 BmPqHrEuE9XL7PcFvUIgiiCdTXb/HWvuKzpBGQEP72bo/CmHxzQkNfLyLjTsjU8zReMi L/NyWU1Jnh/VrrFq7oKJ8kNR00Yo6fG7g6doFaz2lmLjRkvpiYQ85lA0m5U4fROV9Sq3 GsGzCOM2U3FUyt5xDznwzAYMwEkTg2MgPp76Cf10Obdb55Zt/LmxbvdELFzR1ZHXjRNs mfbw== X-Gm-Message-State: ABy/qLY2z3Jc+HNSlAleCKDQ3BnYWMR+UmnLVOrTxzRTZ44SMfbloAXs CK9hXKToHM2qN0MFaZ1kszto2T58xmSnFTrXRl5vuYy5Z3YLW8ukPMunUeSISsEJ2DClHRMe2Jt 4uke6oXRWGkFLom2dtWvmYGKsUxKr4ublFS4= X-Received: by 2002:a0d:d851:0:b0:56d:5272:d540 with SMTP id a78-20020a0dd851000000b0056d5272d540mr15383332ywe.46.1689109090880; Tue, 11 Jul 2023 13:58:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlEBKIgazDrRhr2+67U2dBV7TYIWtfQ85b0QfXe8t9Je+goLDwuNWjUTwlmm9dlLHEZL6Qvc5A== X-Received: by 2002:a0d:d851:0:b0:56d:5272:d540 with SMTP id a78-20020a0dd851000000b0056d5272d540mr15383327ywe.46.1689109090644; Tue, 11 Jul 2023 13:58:10 -0700 (PDT) Received: from halaney-x13s.attlocal.net ([2600:1700:1ff0:d0e0::22]) by smtp.gmail.com with ESMTPSA id j136-20020a81928e000000b00545a08184cesm785353ywg.94.2023.07.11.13.58.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 13:58:10 -0700 (PDT) From: Andrew Halaney To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, mcoquelin.stm32@gmail.com, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, joabreu@synopsys.com, alexandre.torgue@foss.st.com, peppe.cavallaro@st.com, bhupesh.sharma@linaro.org, vkoul@kernel.org, linux-arm-msm@vger.kernel.org, jsuraj@qti.qualcomm.com, Andrew Halaney Subject: [PATCH RFC/RFT net-next 1/3] net: stmmac: Make ptp_clk_freq_config variable type explicit Date: Tue, 11 Jul 2023 15:35:30 -0500 Message-ID: <20230711205732.364954-2-ahalaney@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711205732.364954-1-ahalaney@redhat.com> References: <20230711205732.364954-1-ahalaney@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_135813_586441_C14FFE87 X-CRM114-Status: GOOD ( 12.29 ) 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 The priv variable is _always_ of type (struct stmmac_priv *), so let's stop using (void *) since it isn't abstracting anything. Signed-off-by: Andrew Halaney Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 3 +-- include/linux/stmmac.h | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index ab9f876b6df7..718bae6872da 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -257,9 +257,8 @@ static void intel_speed_mode_2500(struct net_device *ndev, void *intel_data) /* Program PTP Clock Frequency for different variant of * Intel mGBE that has slightly different GPO mapping */ -static void intel_mgbe_ptp_clk_freq_config(void *npriv) +static void intel_mgbe_ptp_clk_freq_config(struct stmmac_priv *priv) { - struct stmmac_priv *priv = (struct stmmac_priv *)npriv; struct intel_priv_data *intel_priv; u32 gpio_value; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 06090538fe2d..c0cbcef1a2f0 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -76,6 +76,8 @@ | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \ | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256) +struct stmmac_priv; + /* Platfrom data for platform device structure's platform_data field */ struct stmmac_mdio_bus_data { @@ -245,7 +247,7 @@ struct plat_stmmacenet_data { int (*serdes_powerup)(struct net_device *ndev, void *priv); void (*serdes_powerdown)(struct net_device *ndev, void *priv); void (*speed_mode_2500)(struct net_device *ndev, void *priv); - void (*ptp_clk_freq_config)(void *priv); + void (*ptp_clk_freq_config)(struct stmmac_priv *priv); int (*init)(struct platform_device *pdev, void *priv); void (*exit)(struct platform_device *pdev, void *priv); struct mac_device_info *(*setup)(void *priv); From patchwork Tue Jul 11 20:35:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13309385 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 54349EB64DC for ; Tue, 11 Jul 2023 20:58:45 +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=hM3d5Xnivyi6Pzzt1/hu+tu+oHDAfa22/fL5KHBRzNE=; b=1mvsUH7YHrj9d9 iDW3UJGLDclRjyI3RwG19JkLWa/iqctTBy0ALIGGeg67DMqGXLSjKgUw0bmektGVBnwLZVd5KKU/5 XLQ89IC5OQIH21F0Yd4n1LqwkYgggDTBPN0iCNIH9pB3f3WtZHxzsySOaBuAJ69bqYVk1SKJVCwz1 7Xb9CzP7ULoUiVhqLDSTf1YLbOt8b0LY+bCpbaLKQxICAMK6K11l8uzeTD4zWddBqLoixk6RpdUhC fL/HR40xH796Z3P0k1kgRF/wlQfn7lKm4zjBOPZxjvJoydX8AjioUDTgJfI+ZmVzuG5MTCYWZjGNl 0hpTGHomCH6djHzzIEFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJKRB-00Fsh5-1T; Tue, 11 Jul 2023 20:58:21 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJKR8-00FsgH-2g for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 20:58:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689109098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jiBOM1KuLZEvS0bvIGnIKQCXCP0aV2NwdEa0u2AGH3g=; b=b3XV55a+W37n6PabOsBA6SysduZzT2ERFAllIXhNp7gIHXdHrzm4ArRvHW8ehC31C7zYEK 7UatMaPDseBh5JYPMxyhbYmMRBWhm2xu4dtSFBMMLKdW4g5GBtNSraVXjKFNT3hKWyRx4W HYRJX9vVjpWxoYwND9BH0qUQChWatHc= Received: from mail-yw1-f198.google.com (mail-yw1-f198.google.com [209.85.128.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-208-K6-cRKk_OTOD3w1wnWHYnQ-1; Tue, 11 Jul 2023 16:58:16 -0400 X-MC-Unique: K6-cRKk_OTOD3w1wnWHYnQ-1 Received: by mail-yw1-f198.google.com with SMTP id 00721157ae682-579dd7e77f5so69065747b3.0 for ; Tue, 11 Jul 2023 13:58:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689109095; x=1691701095; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jiBOM1KuLZEvS0bvIGnIKQCXCP0aV2NwdEa0u2AGH3g=; b=Vc+vGEzDxig6VSpmpQSUYzsC4RFUzEumVjf9AJ0vJIkstcSrqQeWnTFp7gUv/13Mlm 6itCat8wcQmil485C3+NDIlLe1SGJXFLdU99ztiFoID7EadxhiZMBgShDtXlE+barRQw w7sBKYEF+YLHJkR7rsCHSK+3tBlFfUZeiA7+ikUIf+gxohF+kw5a/gSYCh4wTq6wLBJp 8OXg6NsPXa2OP5rc0fpwmEFc/3dgRD6gau62m2zcZUA4Y47FHZYSFmf6PMn9tcklIe/f QiU0jYYOYZpfUiIiHRqYQ9sxQHp+6FfZEvnkWw7oa2O8Fc9jOoMXx3y2Qmipp0uFGfFN hNNA== X-Gm-Message-State: ABy/qLahFdHybwaIxwDd2F6jYQFXcirmVQcm4WGSovIlwMNACWFkCjjk SRTYYWsgJyghTH895MGA7lN3Gee+Exjpcn/dkxi/neDhaXrHdJ4yLDXsLZpgMl/9unx4bDElEZC LFMnEgLtpkePWVyJ28VvkFl3nyY9pwZG54dK1iU1aQ+c= X-Received: by 2002:a0d:dd0f:0:b0:55a:3ce9:dc3d with SMTP id g15-20020a0ddd0f000000b0055a3ce9dc3dmr16784172ywe.13.1689109095601; Tue, 11 Jul 2023 13:58:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMM6rSAUBx2gHMgpN1hCMMVYXQ4ts3fvOEU1AYs0oR+Y47D9PvRxELDW1bK1hOX+hNQmSRfQ== X-Received: by 2002:a0d:dd0f:0:b0:55a:3ce9:dc3d with SMTP id g15-20020a0ddd0f000000b0055a3ce9dc3dmr16784156ywe.13.1689109095299; Tue, 11 Jul 2023 13:58:15 -0700 (PDT) Received: from halaney-x13s.attlocal.net ([2600:1700:1ff0:d0e0::22]) by smtp.gmail.com with ESMTPSA id j136-20020a81928e000000b00545a08184cesm785353ywg.94.2023.07.11.13.58.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 13:58:14 -0700 (PDT) From: Andrew Halaney To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, mcoquelin.stm32@gmail.com, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, joabreu@synopsys.com, alexandre.torgue@foss.st.com, peppe.cavallaro@st.com, bhupesh.sharma@linaro.org, vkoul@kernel.org, linux-arm-msm@vger.kernel.org, jsuraj@qti.qualcomm.com, Andrew Halaney Subject: [PATCH RFC/RFT net-next 2/3] net: stmmac: dwmac-qcom-ethqos: Use max frequency for clk_ptp_ref Date: Tue, 11 Jul 2023 15:35:31 -0500 Message-ID: <20230711205732.364954-3-ahalaney@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711205732.364954-1-ahalaney@redhat.com> References: <20230711205732.364954-1-ahalaney@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_135818_940018_2AEB1175 X-CRM114-Status: GOOD ( 13.35 ) 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 Qualcomm clocks can set their frequency to a variety of levels generally. Let's use the max for clk_ptp_ref to ensure the best timestamping resolution possible. Without this, the default value of the clock is used. For sa8775p-ride this is 19.2 MHz, far less than the 230.4 MHz possible. Signed-off-by: Andrew Halaney Reviewed-by: Simon Horman --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 757504ebb676..f9e7440520fa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -694,6 +694,23 @@ static void ethqos_clks_disable(void *data) ethqos_clks_config(data, false); } +static void ethqos_ptp_clk_freq_config(struct stmmac_priv *priv) +{ + struct plat_stmmacenet_data *plat_dat = priv->plat; + int err; + + if (!plat_dat->clk_ptp_ref) + return; + + /* Max the PTP ref clock out to get the best resolution possible */ + err = clk_set_rate(plat_dat->clk_ptp_ref, ULONG_MAX); + if (err) + netdev_err(priv->dev, "Failed to max out clk_ptp_ref: %d\n", err); + plat_dat->clk_ptp_rate = clk_get_rate(plat_dat->clk_ptp_ref); + + netdev_dbg(priv->dev, "PTP rate %d\n", plat_dat->clk_ptp_rate); +} + static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -779,6 +796,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->bsp_priv = ethqos; plat_dat->fix_mac_speed = ethqos_fix_mac_speed; plat_dat->dump_debug_regs = rgmii_dump; + plat_dat->ptp_clk_freq_config = ethqos_ptp_clk_freq_config; plat_dat->has_gmac4 = 1; if (ethqos->has_emac_ge_3) plat_dat->dwmac4_addrs = &data->dwmac4_addrs; From patchwork Tue Jul 11 20:35:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Halaney X-Patchwork-Id: 13309386 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 50764C001B0 for ; Tue, 11 Jul 2023 20:58:58 +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=LfzW1C+7BTjkevO/5F2Zi073Opzs/vmnaCWPy7KFsoI=; b=x/lNsZvi+ABQxh pOv8K/OiCzxBqacrp+78gcmTq38u9AL+YlpB6TZV/jFahAhxP+ZXUrk28SeE6Lyvb3/Py1uDuYsix bniBBTBa6uQf+UEoYEqL4q64B+E68hDbyETX0vWGb+80/4NQWBRugpRLJSONiASs/8ipQ/gq2TxY5 8vtBUrpZbshnZHjRaMppLyoRB/gDNWlbv6BDrvKL5KACNm8Q+q94tugjnm7c1eSUTNgDC7T10M53t BoqgoNL7jbErBMiIUcFKipyN3ozMtj+brn36kbOigJQOsIjHwzqavKeiukPze9/djQE14q4ozhkoy 2Bd3nE0iGWQZLg6rCI+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJKRQ-00Fslj-1J; Tue, 11 Jul 2023 20:58:36 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJKRN-00FskS-1s for linux-arm-kernel@lists.infradead.org; Tue, 11 Jul 2023 20:58:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689109112; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CvuwAv+s14TExJvbO2C4lPkzFf4n3yORaiUFHM896h4=; b=BbHA4gkiSFp38W3GTh5Q6s3A/SlPSWz0A1nBZOQpymyDCFijtWTCrhHJydWyHk1xumvxIe vs49D6/jMg1P8RPsF8PPMzQHZNr/QGt2ANxXlHnBALHjDPWuif/JMSBSBlfee0ZkjBp0Uj RX5c1YaeivprvBYYGcEqA9AKa6vG4jo= Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-48-0Z2-wEVdON29wfqUmNXAqQ-1; Tue, 11 Jul 2023 16:58:31 -0400 X-MC-Unique: 0Z2-wEVdON29wfqUmNXAqQ-1 Received: by mail-oo1-f71.google.com with SMTP id 006d021491bc7-5667dddaa5cso3616670eaf.2 for ; Tue, 11 Jul 2023 13:58:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689109111; x=1691701111; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CvuwAv+s14TExJvbO2C4lPkzFf4n3yORaiUFHM896h4=; b=fHUth55Kp+4LEY00xow4FO00mjZ87XVRixniBtGwep4h+TbOEpfqbntNFp6QniOq/b VSg/6ctN4NLh7kbkDvJVDUlJClmZRelLxg4BAWuDXiUnaVCaZsA1aHBofJZwkBIuYs/n SaJO96DVtI/Y+l9e4gckR5iMpSmyjVUYfmgbJRtz4tX11mA6jDrjlVORy2E+M3HAoaGW TEa3NkMXgxrcGg7ER2SVhWePZw6wXUFI+gj17kOrq9v0aEOhm1M9fnaZxLxUN/wmg94i UYjzUw43yxUfKXgyUxsIdEyF7QVvYNWF2xjVojj9aFvc4RgPuWWTmh67ku9130bmhKCG xRRQ== X-Gm-Message-State: ABy/qLbmb7h4X3vLjLJZqEIqLSlmIejIUuNnpEi4y0zoHsE1xLxIzvmi gbNMWN900XMrKxVTtunTtmKZHWc9d33omBQwBenv4ihCC72pShR6m2g/wR9bhcOcoPLl8N1dc75 E3yRfPiYiT0r7vY5ybURf/iooK0q06t1prL8= X-Received: by 2002:a05:6358:340b:b0:134:c4dc:2c4e with SMTP id h11-20020a056358340b00b00134c4dc2c4emr5573611rwd.23.1689109110682; Tue, 11 Jul 2023 13:58:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDwoVz3zRB6ah8VU/FCjuuuOvOlH20gHcWLu5haldDqXSdHnX1ggzW6h5gC9xUcPFDK+Zpxw== X-Received: by 2002:a05:6358:340b:b0:134:c4dc:2c4e with SMTP id h11-20020a056358340b00b00134c4dc2c4emr5573607rwd.23.1689109110337; Tue, 11 Jul 2023 13:58:30 -0700 (PDT) Received: from halaney-x13s.attlocal.net ([2600:1700:1ff0:d0e0::22]) by smtp.gmail.com with ESMTPSA id j136-20020a81928e000000b00545a08184cesm785353ywg.94.2023.07.11.13.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jul 2023 13:58:30 -0700 (PDT) From: Andrew Halaney To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org, mcoquelin.stm32@gmail.com, pabeni@redhat.com, kuba@kernel.org, edumazet@google.com, davem@davemloft.net, joabreu@synopsys.com, alexandre.torgue@foss.st.com, peppe.cavallaro@st.com, bhupesh.sharma@linaro.org, vkoul@kernel.org, linux-arm-msm@vger.kernel.org, jsuraj@qti.qualcomm.com, Andrew Halaney Subject: [PATCH RFC/RFT net-next 3/3] net: stmmac: Use the max frequency possible for clk_ptp_ref Date: Tue, 11 Jul 2023 15:35:32 -0500 Message-ID: <20230711205732.364954-4-ahalaney@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711205732.364954-1-ahalaney@redhat.com> References: <20230711205732.364954-1-ahalaney@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230711_135833_691429_01FF7547 X-CRM114-Status: GOOD ( 10.12 ) 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 Using the max frequency allows for the best PTP timestamping resolution, so let's default to that. Signed-off-by: Andrew Halaney Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 231152ee5a32..c9a27a71a3f4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -602,6 +602,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) plat->clk_ptp_ref = NULL; dev_info(&pdev->dev, "PTP uses main clock\n"); } else { + /* Get the best resolution possible */ + rc = clk_set_rate(plat->clk_ptp_ref, ULONG_MAX); + if (rc) + dev_err(&pdev->dev, + "Failed to set clk_ptp_ref rate: %d\n", rc); plat->clk_ptp_rate = clk_get_rate(plat->clk_ptp_ref); dev_dbg(&pdev->dev, "PTP rate %d\n", plat->clk_ptp_rate); }