Discussion:
[Linuxptp-devel] Question about adjust frequency
Nithin Nayak Sujir
2012-11-27 02:09:09 UTC
Permalink
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver patches that I will soon
submit upstream.

I get an error that clock is not adjustable.

./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock

I traced it to max_adj being set to 0 when we register ptp_caps in the driver.

The tg3 driver implements adjtime but not adjfreq. Is adjust frequency a mandatory requirement for
ptp4l? If so why? Why do we need both adjust time and frequency? The hardware has a 1ns granularity
counter and I don't get why this frequency tuning option is needed.

Sorry for my limited understanding. I inherited this code and don't know if something is missing.

Thanks,
Nithin.
Richard Cochran
2012-11-27 07:14:42 UTC
Permalink
Post by Nithin Nayak Sujir
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver patches that I will soon
submit upstream.
I get an error that clock is not adjustable.
./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock
I traced it to max_adj being set to 0 when we register ptp_caps in the driver.
The tg3 driver implements adjtime but not adjfreq. Is adjust frequency a mandatory requirement for
ptp4l? If so why?
You can run ptp4l without adjusting the PHC by setting "free_running 1"
in the configuration file. This is a typical use case for 802.1AS.
Post by Nithin Nayak Sujir
Why do we need both adjust time and frequency? The hardware has a 1ns granularity
counter and I don't get why this frequency tuning option is needed.
In order to synchronize the local clock to a remote master, the local
clock must run at the same frequency as the master. Otherwise, after
correcting the time offset, the slave clock's time would immediately
drift away from the master's time.

If you cannot adjustable the frequency in hardware, then you can still
employ a software method, by using a cyclecounter and a timecounter
together. There are two new drivers in net-next which work this way
and can serve as examples:

- drivers/net/ethernet/ti/cpts.c
- drivers/net/ethernet/freescale/fec_ptp.c

HTH,
Richard
Nithin Sujir
2012-11-27 19:05:54 UTC
Permalink
-----Original Message-----
Sent: Monday, November 26, 2012 11:15 PM
To: Nithin Sujir
Subject: Re: [Linuxptp-devel] Question about adjust frequency
Post by Nithin Nayak Sujir
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver
patches that I will soon
Post by Nithin Nayak Sujir
submit upstream.
I get an error that clock is not adjustable.
./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock
I traced it to max_adj being set to 0 when we register ptp_caps in the
driver.
Post by Nithin Nayak Sujir
The tg3 driver implements adjtime but not adjfreq. Is adjust frequency a
mandatory requirement for
Post by Nithin Nayak Sujir
ptp4l? If so why?
You can run ptp4l without adjusting the PHC by setting "free_running 1"
in the configuration file. This is a typical use case for 802.1AS.
Post by Nithin Nayak Sujir
Why do we need both adjust time and frequency? The hardware has a 1ns
granularity
Post by Nithin Nayak Sujir
counter and I don't get why this frequency tuning option is needed.
In order to synchronize the local clock to a remote master, the local
clock must run at the same frequency as the master. Otherwise, after
correcting the time offset, the slave clock's time would immediately
drift away from the master's time.
If you cannot adjustable the frequency in hardware, then you can still
employ a software method, by using a cyclecounter and a timecounter
together. There are two new drivers in net-next which work this way
- drivers/net/ethernet/ti/cpts.c
- drivers/net/ethernet/freescale/fec_ptp.c
[Nithin Sujir]
I see. Thanks for the information. I will take a look at these drivers.
HTH,
Richard
Nithin Nayak Sujir
2012-11-28 00:12:39 UTC
Permalink
Post by Richard Cochran
Post by Nithin Nayak Sujir
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver patches that I will soon
submit upstream.
I get an error that clock is not adjustable.
./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock
I traced it to max_adj being set to 0 when we register ptp_caps in the driver.
The tg3 driver implements adjtime but not adjfreq. Is adjust frequency a mandatory requirement for
ptp4l? If so why?
You can run ptp4l without adjusting the PHC by setting "free_running 1"
in the configuration file. This is a typical use case for 802.1AS.
Post by Nithin Nayak Sujir
Why do we need both adjust time and frequency? The hardware has a 1ns granularity
counter and I don't get why this frequency tuning option is needed.
In order to synchronize the local clock to a remote master, the local
clock must run at the same frequency as the master. Otherwise, after
correcting the time offset, the slave clock's time would immediately
drift away from the master's time.
If you cannot adjustable the frequency in hardware, then you can still
employ a software method, by using a cyclecounter and a timecounter
together. There are two new drivers in net-next which work this way
- drivers/net/ethernet/ti/cpts.c
- drivers/net/ethernet/freescale/fec_ptp.c
Sorry if this is partially off topic since it talks about the driver code. It is relevant to my
original question about ptp4l so hope it's ok.
Keller, Jacob E
2012-11-28 00:24:54 UTC
Permalink
-----Original Message-----
Sent: Tuesday, November 27, 2012 4:13 PM
To: Richard Cochran
Subject: Re: [Linuxptp-devel] Question about adjust frequency
Post by Richard Cochran
Post by Nithin Nayak Sujir
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver
patches that I will soon
Post by Richard Cochran
Post by Nithin Nayak Sujir
submit upstream.
I get an error that clock is not adjustable.
./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock
I traced it to max_adj being set to 0 when we register ptp_caps in the
driver.
Post by Richard Cochran
Post by Nithin Nayak Sujir
The tg3 driver implements adjtime but not adjfreq. Is adjust frequency
a mandatory requirement for
Post by Richard Cochran
Post by Nithin Nayak Sujir
ptp4l? If so why?
You can run ptp4l without adjusting the PHC by setting "free_running 1"
in the configuration file. This is a typical use case for 802.1AS.
Post by Nithin Nayak Sujir
Why do we need both adjust time and frequency? The hardware has a 1ns
granularity
Post by Richard Cochran
Post by Nithin Nayak Sujir
counter and I don't get why this frequency tuning option is needed.
In order to synchronize the local clock to a remote master, the local
clock must run at the same frequency as the master. Otherwise, after
correcting the time offset, the slave clock's time would immediately
drift away from the master's time.
If you cannot adjustable the frequency in hardware, then you can still
employ a software method, by using a cyclecounter and a timecounter
together. There are two new drivers in net-next which work this way
- drivers/net/ethernet/ti/cpts.c
- drivers/net/ethernet/freescale/fec_ptp.c
Sorry if this is partially off topic since it talks about the driver code.
It is relevant to my
original question about ptp4l so hope it's ok.
Nithin Nayak Sujir
2012-11-28 01:09:08 UTC
Permalink
-----Original Message-----
Sent: Tuesday, November 27, 2012 4:13 PM
To: Richard Cochran
Subject: Re: [Linuxptp-devel] Question about adjust frequency
Post by Richard Cochran
Post by Nithin Nayak Sujir
Hi Richard,
I am trying to test the tg3 hardware ptp feature using ptp4l for driver
patches that I will soon
Post by Richard Cochran
Post by Nithin Nayak Sujir
submit upstream.
I get an error that clock is not adjustable.
./ptp4l -i p6p4 -A -s -v
ptp4l[862288.218]: selected /dev/ptp5 as PTP clock
ptp4l[862288.218]: clock is not adjustable
failed to create a clock
I traced it to max_adj being set to 0 when we register ptp_caps in the
driver.
Post by Richard Cochran
Post by Nithin Nayak Sujir
The tg3 driver implements adjtime but not adjfreq. Is adjust frequency
a mandatory requirement for
Post by Richard Cochran
Post by Nithin Nayak Sujir
ptp4l? If so why?
You can run ptp4l without adjusting the PHC by setting "free_running 1"
in the configuration file. This is a typical use case for 802.1AS.
Post by Nithin Nayak Sujir
Why do we need both adjust time and frequency? The hardware has a 1ns
granularity
Post by Richard Cochran
Post by Nithin Nayak Sujir
counter and I don't get why this frequency tuning option is needed.
In order to synchronize the local clock to a remote master, the local
clock must run at the same frequency as the master. Otherwise, after
correcting the time offset, the slave clock's time would immediately
drift away from the master's time.
If you cannot adjustable the frequency in hardware, then you can still
employ a software method, by using a cyclecounter and a timecounter
together. There are two new drivers in net-next which work this way
- drivers/net/ethernet/ti/cpts.c
- drivers/net/ethernet/freescale/fec_ptp.c
Sorry if this is partially off topic since it talks about the driver code.
It is relevant to my
original question about ptp4l so hope it's ok.
Loading...