提交 4bb7aff9 编写于 作者: J Jose Abreu 提交者: David S. Miller

net: stmmac: Add PTP support for XGMAC2

XGMAC2 uses the same engine of timestamping as GMAC4. Let's use the same
callbacks.
Signed-off-by: NJose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 6fc21117
...@@ -193,13 +193,13 @@ static const struct stmmac_hwif_entry { ...@@ -193,13 +193,13 @@ static const struct stmmac_hwif_entry {
.xgmac = true, .xgmac = true,
.min_id = DWXGMAC_CORE_2_10, .min_id = DWXGMAC_CORE_2_10,
.regs = { .regs = {
.ptp_off = 0, .ptp_off = PTP_XGMAC_OFFSET,
.mmc_off = 0, .mmc_off = 0,
}, },
.desc = &dwxgmac210_desc_ops, .desc = &dwxgmac210_desc_ops,
.dma = &dwxgmac210_dma_ops, .dma = &dwxgmac210_dma_ops,
.mac = &dwxgmac210_ops, .mac = &dwxgmac210_ops,
.hwtimestamp = NULL, .hwtimestamp = &stmmac_ptp,
.mode = NULL, .mode = NULL,
.tc = NULL, .tc = NULL,
.setup = dwxgmac2_setup, .setup = dwxgmac2_setup,
......
...@@ -71,6 +71,9 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) ...@@ -71,6 +71,9 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
u32 sec, nsec; u32 sec, nsec;
u32 quotient, reminder; u32 quotient, reminder;
int neg_adj = 0; int neg_adj = 0;
bool xmac;
xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac;
if (delta < 0) { if (delta < 0) {
neg_adj = 1; neg_adj = 1;
...@@ -82,8 +85,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) ...@@ -82,8 +85,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
nsec = reminder; nsec = reminder;
spin_lock_irqsave(&priv->ptp_lock, flags); spin_lock_irqsave(&priv->ptp_lock, flags);
stmmac_adjust_systime(priv, priv->ptpaddr, sec, nsec, neg_adj, stmmac_adjust_systime(priv, priv->ptpaddr, sec, nsec, neg_adj, xmac);
priv->plat->has_gmac4);
spin_unlock_irqrestore(&priv->ptp_lock, flags); spin_unlock_irqrestore(&priv->ptp_lock, flags);
return 0; return 0;
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#ifndef __STMMAC_PTP_H__ #ifndef __STMMAC_PTP_H__
#define __STMMAC_PTP_H__ #define __STMMAC_PTP_H__
#define PTP_XGMAC_OFFSET 0xd00
#define PTP_GMAC4_OFFSET 0xb00 #define PTP_GMAC4_OFFSET 0xb00
#define PTP_GMAC3_X_OFFSET 0x700 #define PTP_GMAC3_X_OFFSET 0x700
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册