Commit adee474a authored by Harini Katakam's avatar Harini Katakam Committed by Jakub Kicinski

net: macb: Update gem PTP support check

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: default avatarHarini Katakam <harini.katakam@amd.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fb4be9a4
...@@ -1363,7 +1363,7 @@ static inline bool macb_is_gem(struct macb *bp) ...@@ -1363,7 +1363,7 @@ static inline bool macb_is_gem(struct macb *bp)
static inline bool gem_has_ptp(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);
} }
/** /**
......
...@@ -3893,17 +3893,17 @@ static void macb_configure_caps(struct macb *bp, ...@@ -3893,17 +3893,17 @@ static void macb_configure_caps(struct macb *bp,
dcfg = gem_readl(bp, DCFG2); dcfg = gem_readl(bp, DCFG2);
if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0) if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0)
bp->caps |= MACB_CAPS_FIFO_MODE; bp->caps |= MACB_CAPS_FIFO_MODE;
#ifdef CONFIG_MACB_USE_HWSTAMP
if (gem_has_ptp(bp)) { if (gem_has_ptp(bp)) {
if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5))) if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5)))
dev_err(&bp->pdev->dev, dev_err(&bp->pdev->dev,
"GEM doesn't support hardware ptp.\n"); "GEM doesn't support hardware ptp.\n");
else { else {
#ifdef CONFIG_MACB_USE_HWSTAMP
bp->hw_dma_cap |= HW_DMA_CAP_PTP; bp->hw_dma_cap |= HW_DMA_CAP_PTP;
bp->ptp_info = &gem_ptp_info; bp->ptp_info = &gem_ptp_info;
#endif
} }
} }
#endif
} }
dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps); dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment