Skip to content

Commit

Permalink
net: stmmac: dwmac-imx: enable MAC propagation delay correction for i…
Browse files Browse the repository at this point in the history
….MX8MP

As the i.MX8MP supports reading MAC propagation delay and correcting the
Hardware timestamp counter for additional delays [1], enable the feature
for this SoC.

This reduces phase error of the PPS output from the PTP Hardware Clock
from approx 150ns to 100ns.

[1] i.MX8MP Reference Manual, rev.1 Section 11.7.2.5.3 "Timestamp
correction"

Signed-off-by: Johannes Zink <[email protected]>
Link: https://lore.kernel.org/r/20230719-stmmac_correct_mac_delay-v3-2-61e63427735e@pengutronix.de
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Johannes Zink authored and kuba-moo committed Aug 7, 2023
1 parent 26cfb83 commit 6cb2e61
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

struct imx_dwmac_ops {
u32 addr_width;
u32 flags;
bool mac_rgmii_txclk_auto_adj;

int (*fix_soc_reset)(void *priv, void __iomem *ioaddr);
Expand Down Expand Up @@ -311,6 +312,9 @@ static int imx_dwmac_probe(struct platform_device *pdev)
goto err_parse_dt;
}

if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;

plat_dat->host_dma_width = dwmac->ops->addr_width;
plat_dat->init = imx_dwmac_init;
plat_dat->exit = imx_dwmac_exit;
Expand Down Expand Up @@ -350,6 +354,7 @@ static struct imx_dwmac_ops imx8mp_dwmac_data = {
.addr_width = 34,
.mac_rgmii_txclk_auto_adj = false,
.set_intf_mode = imx8mp_set_intf_mode,
.flags = STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY,
};

static struct imx_dwmac_ops imx8dxl_dwmac_data = {
Expand Down

0 comments on commit 6cb2e61

Please sign in to comment.