G'day John,

On 23/05/2017 22:28, John Lemonovich wrote:
> Hi Phil,
> 
> What kernel version are you running to successfully use HPS EMAC with HW
> timestamping?  Instead of trying to backport the ptp changes (your commit
> from Dec 2015) to the stmmac driver, I compiled and tried to run kernel
> v4.5 which already has those changes (among others).  But now I'm back to
> getting the clock jumped forward or running faster than expected messages,
> and the master offset just increases indefinitely.

I don't have a system here at the moment running it. But it was work with a 
variant of 4.7.

> 
> I had changed these 2 lines of my altera-generated  DTS  per
> recommendation from another user who was using 4.1.22-altera-ltsi:
> 
> clocks = <&l4_mp_clk &arria10_hps_0_eosc1>;
> clock-names = "stmmaceth", "clk_ptp_ref"

I'm not familiar with the Arria and thee a couple of difference to the C-V.
But a quick look at the handbook for the arria 10 shows the emac_ptp_clk
is an output of one of the pll's.

so arria10_hps_0_eosc1 doesn't sound quite right.
There looks to be a few registers to config this clock output so it could be 
okay, but maybe not.

This is different to the c-v which could only had the osc1_clk option.


> 
> I added both the latter parameters from above.  I was surprised to see the
> driver chosen upon boot was as follows (previously with
> 4.1.22-altera-ltsi):
> driver -> ../../../../bus/platform/drivers/socfpga-dwmac
> of_node -> ../../../../firmware/devicetree/base/sopc@0/ethernet@0xff800000
> 
> 
> So then I just get:
> 
> ptp4l[776.919]: clockcheck: clock jumped forward or running faster than
> expected!
> ptp4l[776.958]: master offset      -2640 s0 freq   +7080 path delay
> -1160
> ptp4l[776.958]: port 1: SLAVE to UNCALIBRATED on SYNCHRONIZATION_FAULT
> ptp4l[777.919]: clockcheck: clock jumped forward or running faster than
> expected!
> ptp4l[777.958]: master offset     -12520 s0 freq   +7080 path delay
> 5040
> ptp4l[778.919]: clockcheck: clock jumped forward or running faster than
> expected!
> ptp4l[778.958]: master offset     -22400 s0 freq   +7080 path delay
> 11240
> ptp4l[779.919]: clockcheck: clock jumped forward or running faster than
> expected!
> ptp4l[779.958]: master offset     -26000 s0 freq   +7080 path delay
> 11240
> ptp4l[780.919]: clockcheck: clock jumped forward or running faster than
> expected!
> ptp4l[780.958]: master offset     -29180 s0 freq   +7080 path delay
> 10580
> ptp4l[781.919]: clockcheck: clock jumped forward or running faster than
> expected!
> 

The following snippet was helpful for me.
Got reject for mainline.
Make sure the increment and addend register are getting set correctly.
goes in stmmac_main search for stmmac_init_fs

static int stmmac_sysfs_ptp_read(struct seq_file *seq, void *v)
{
        struct net_device *dev = seq->private;
        struct stmmac_priv *priv = netdev_priv(dev);

        if (!(priv->dma_cap.time_stamp || priv->adv_ts)) {
                seq_printf(seq, "PTP HW features not supported\n");
                return 0;
        }

        seq_printf(seq, "==============================\n");
        seq_printf(seq, "\tPTP Status\n");
        seq_printf(seq, "==============================\n");

        #define DUMP_REG(x) seq_printf(seq, "%-20s       %04x  %08x\n", #x, x, 
readl(priv->ptpaddr + x));
        DUMP_REG(GMAC_INT_STATUS);
        DUMP_REG(GMAC_INT_MASK);

        DUMP_REG(PTP_TCR);
        DUMP_REG(PTP_SSIR);
        DUMP_REG(PTP_STSR);
        DUMP_REG(PTP_STNSR);
        DUMP_REG(PTP_STSUR);
        DUMP_REG(PTP_STNSUR);
        DUMP_REG(PTP_TAR);
        DUMP_REG(PTP_TTSR);
        DUMP_REG(PTP_TTNSR);
        DUMP_REG(PTP_STHWSR);
        DUMP_REG(PTP_TSR);
        DUMP_REG(PTP_PPSCTLR);
        DUMP_REG(PTP_AUXTSTNSR);
        DUMP_REG(PTP_AUXTSTSR);
        DUMP_REG(PTP_PPS0INTRR);
        DUMP_REG(PTP_PPS0WDTHR);

        return 0;
}

static int stmmac_sysfs_ptp_open(struct inode *inode, struct file *file)
{
        return single_open(file, stmmac_sysfs_ptp_read, inode->i_private);
}

static const struct file_operations stmmac_ptp_fops = {
        .owner = THIS_MODULE,
        .open = stmmac_sysfs_ptp_open,
        .read = seq_read,
        .llseek = seq_lseek,
        .release = single_release,
};

static int stmmac_init_fs(struct net_device *dev)
{
        struct stmmac_priv *priv = netdev_priv(dev);

<snip....>

        /* Entry to report the PTP status */
        priv->dbgfs_ptp = debugfs_create_file("ptp", S_IRUGO,
                                            priv->dbgfs_dir,
                                            dev, &stmmac_ptp_fops);

        if (!priv->dbgfs_ptp || IS_ERR(priv->dbgfs_ptp)) {
                pr_info("ERROR creating stmmac PTP debugfs file\n");
                debugfs_remove_recursive(priv->dbgfs_dir);

                return -ENOMEM;
        }

        return 0;
}



-- 
Regards
Phil Reid

ElectroMagnetic Imaging Technology Pty Ltd
Development of Geophysical Instrumentation & Software
www.electromag.com.au

3 The Avenue, Midland WA 6056, AUSTRALIA
Ph: +61 8 9250 8100
Fax: +61 8 9250 7100
Email: pr...@electromag.com.au

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-users mailing list
Linuxptp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-users

Reply via email to