]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
net: stmmac: Add PTP support for XGMAC2
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 8 Aug 2018 08:04:34 +0000 (09:04 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Aug 2018 18:16:28 +0000 (11:16 -0700)
XGMAC2 uses the same engine of timestamping as GMAC4. Let's use the same
callbacks.

Signed-off-by: Jose 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: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/hwif.c
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.h

index 4b4ba1c8bad5f0bf57f49acd83f71728e8235b6f..357309a6d6a52889c0f1eef9cfc042246ea42c96 100644 (file)
@@ -193,13 +193,13 @@ static const struct stmmac_hwif_entry {
                .xgmac = true,
                .min_id = DWXGMAC_CORE_2_10,
                .regs = {
-                       .ptp_off = 0,
+                       .ptp_off = PTP_XGMAC_OFFSET,
                        .mmc_off = 0,
                },
                .desc = &dwxgmac210_desc_ops,
                .dma = &dwxgmac210_dma_ops,
                .mac = &dwxgmac210_ops,
-               .hwtimestamp = NULL,
+               .hwtimestamp = &stmmac_ptp,
                .mode = NULL,
                .tc = NULL,
                .setup = dwxgmac2_setup,
index 0cb0e39a2be93f140403f081fd2077259ee15096..2293e21f789f6c5e98e542d7dd2384d0a8f7a7f2 100644 (file)
@@ -71,6 +71,9 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
        u32 sec, nsec;
        u32 quotient, reminder;
        int neg_adj = 0;
+       bool xmac;
+
+       xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac;
 
        if (delta < 0) {
                neg_adj = 1;
@@ -82,8 +85,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)
        nsec = reminder;
 
        spin_lock_irqsave(&priv->ptp_lock, flags);
-       stmmac_adjust_systime(priv, priv->ptpaddr, sec, nsec, neg_adj,
-                       priv->plat->has_gmac4);
+       stmmac_adjust_systime(priv, priv->ptpaddr, sec, nsec, neg_adj, xmac);
        spin_unlock_irqrestore(&priv->ptp_lock, flags);
 
        return 0;
index f4b31d69f60eb7291191a9ae714ef4377db508bb..ecccf895fd7e44f3f8f1cd544e861e919e9b952b 100644 (file)
@@ -21,6 +21,7 @@
 #ifndef        __STMMAC_PTP_H__
 #define        __STMMAC_PTP_H__
 
+#define PTP_XGMAC_OFFSET       0xd00
 #define        PTP_GMAC4_OFFSET        0xb00
 #define        PTP_GMAC3_X_OFFSET      0x700