mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Harini Katakam <harini.katakam@amd.com>
To: <nicolas.ferre@microchip.com>, <davem@davemloft.net>,
	<richardcochran@gmail.com>, <claudiu.beznea@microchip.com>,
	<andrei.pistirica@microchip.com>, <kuba@kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<michal.simek@amd.com>, <harinikatakamlinux@gmail.com>,
	<harini.katakam@amd.com>
Subject: [PATCH net-next v3 1/3] net: macb: Update gem PTP support check
Date: Mon, 27 Mar 2023 16:36:05 +0530	[thread overview]
Message-ID: <20230327110607.21964-2-harini.katakam@amd.com> (raw)
In-Reply-To: <20230327110607.21964-1-harini.katakam@amd.com>

There are currently two checks for PTP functionality - one on GEM
capability and another on the kernel config option. Combine them
into a single function as there's no use case where gem_has_ptp is
TRUE and MACB_USE_HWSTAMP is false.

Signed-off-by: Harini Katakam <harini.katakam@amd.com>
---
v3:
New patch

 drivers/net/ethernet/cadence/macb.h      | 2 +-
 drivers/net/ethernet/cadence/macb_main.c | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index c1fc91c97cee..b6c5ecbd572c 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1363,7 +1363,7 @@ static inline bool macb_is_gem(struct macb *bp)
 
 static inline bool gem_has_ptp(struct macb *bp)
 {
-	return !!(bp->caps & MACB_CAPS_GEM_HAS_PTP);
+	return (IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && (!!(bp->caps & MACB_CAPS_GEM_HAS_PTP)));
 }
 
 /**
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index f77bd1223c8f..bcda6a08706f 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3889,7 +3889,6 @@ static void macb_configure_caps(struct macb *bp,
 		dcfg = gem_readl(bp, DCFG2);
 		if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
 			bp->caps |= MACB_CAPS_FIFO_MODE;
-#ifdef CONFIG_MACB_USE_HWSTAMP
 		if (gem_has_ptp(bp)) {
 			if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5)))
 				dev_err(&bp->pdev->dev,
@@ -3899,7 +3898,6 @@ static void macb_configure_caps(struct macb *bp,
 				bp->ptp_info = &gem_ptp_info;
 			}
 		}
-#endif
 	}
 
 	dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps);
-- 
2.17.1


  reply	other threads:[~2023-03-27 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 11:06 [PATCH net-next v3 0/3] Macb PTP minor updates Harini Katakam
2023-03-27 11:06 ` Harini Katakam [this message]
2023-03-27 17:51   ` [PATCH net-next v3 1/3] net: macb: Update gem PTP support check kernel test robot
2023-03-27 22:39   ` kernel test robot
2023-03-27 11:06 ` [PATCH net-next v3 2/3] net: macb: Enable PTP unicast Harini Katakam
2023-03-27 11:06 ` [PATCH net-next v3 3/3] net: macb: Optimize reading HW timestamp Harini Katakam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230327110607.21964-2-harini.katakam@amd.com \
    --to=harini.katakam@amd.com \
    --cc=andrei.pistirica@microchip.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=harinikatakamlinux@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@amd.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®