From: Stefan Sørensen <hidden> Date: 2014-06-25 12:37:39
This patch series increases the number of periodic output pins supported
on the dp83640 to 7, and allows for reprogramming the calibration pin.
Stefan Sørensen (3):
ptp: Allow reassigning calibration pin function
dp83640: Program pulsewidth2 values of perout triggers 0 and 1
dp83640: Increase supported perout pins to 7
drivers/net/phy/dp83640.c | 28 ++++++++++++++++++----------
drivers/ptp/ptp_chardev.c | 9 ++-------
2 files changed, 20 insertions(+), 17 deletions(-)
--
1.9.3
From: Stefan Sørensen <hidden> Date: 2014-06-25 12:37:40
The ptp pin function programming does not allow calibration pin to change
function. This is problematic on hardware that uses the default calibration
pin for other purposes.
Removing this limitation does not impact calibration if userspace does not
reprogram the calibration pin.
Signed-off-by: Stefan Sørensen <redacted>
---
drivers/net/phy/dp83640.c | 6 +++++-
drivers/ptp/ptp_chardev.c | 9 ++-------
2 files changed, 7 insertions(+), 8 deletions(-)
@@ -86,17 +86,12 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin,return-EINVAL;break;casePTP_PF_PHYSYNC:-pr_err("sorry, cannot reassign the calibration pin\n");-return-EINVAL;+if(chan!=0)+return-EINVAL;default:return-EINVAL;}-if(pin2->func==PTP_PF_PHYSYNC){-pr_err("sorry, cannot reprogram the calibration pin\n");-return-EINVAL;-}-if(info->verify(info,pin,func,chan)){pr_err("driver cannot use function %u on pin %u\n",func,chan);return-EOPNOTSUPP;
From: Stefan Sørensen <hidden> Date: 2014-06-25 12:37:42
Periodic output triggers 0 and 1 of the dp83640 has a programmable
duty-cycle which is controlled by the Pulsewidth2 field of the trigger
data register. This field is not documented in the datasheet, but it
is described in the "PHYTER Software Development Guide" section
3.1.4.1. Failing to set the field can result in unstable/no trigger
output.
Add programming of the Pulsewidth2 field, setting it to the same value
as the Pulsewidth field for a 50% duty cycle.
Signed-off-by: Stefan Sørensen <redacted>
---
drivers/net/phy/dp83640.c | 5 +++++
1 file changed, 5 insertions(+)
From: Stefan Sørensen <hidden> Date: 2014-06-25 12:37:43
This patch increases the number of supported periodic output pins from
1 to 7. The last pin is reserved for sync.
Signed-off-by: Stefan Sørensen <redacted>
---
drivers/net/phy/dp83640.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
From: Sergei Shtylyov <hidden> Date: 2014-06-25 17:50:47
Hello.
On 06/25/2014 04:37 PM, Stefan Sørensen wrote:
Periodic output triggers 0 and 1 of the dp83640 has a programmable
duty-cycle which is controlled by the Pulsewidth2 field of the trigger
data register. This field is not documented in the datasheet, but it
is described in the "PHYTER Software Development Guide" section
3.1.4.1. Failing to set the field can result in unstable/no trigger
output.
Add programming of the Pulsewidth2 field, setting it to the same value
as the Pulsewidth field for a 50% duty cycle.
From: Richard Cochran <richardcochran@gmail.com> Date: 2014-06-26 05:21:56
On Wed, Jun 25, 2014 at 02:37:29PM +0200, Stefan Sørensen wrote:
The ptp pin function programming does not allow calibration pin to change
function. This is problematic on hardware that uses the default calibration
pin for other purposes.
Removing this limitation does not impact calibration if userspace does not
reprogram the calibration pin.
Reassigning the calibration function never makes sense, because it is
only used in the driver probe method.
Clobbering the calibration pin with another function only makes sense
if the hardware design has exactly one PHY.
Can you please add a check in the dp83640 verify method to enforce
these two constraints?
Thanks,
Richard
From: Christian Riesch <hidden> Date: 2014-06-26 06:14:59
Hi Richard,
On Thu, Jun 26, 2014 at 7:21 AM, Richard Cochran
[off-list ref] wrote:
On Wed, Jun 25, 2014 at 02:37:29PM +0200, Stefan Sørensen wrote:
quoted
The ptp pin function programming does not allow calibration pin to change
function. This is problematic on hardware that uses the default calibration
pin for other purposes.
Removing this limitation does not impact calibration if userspace does not
reprogram the calibration pin.
Reassigning the calibration function never makes sense, because it is
only used in the driver probe method.
Yes, indeed, but isn't that a bug? I think the calibration should be
done again whenever the clock is loaded with a new value, i.e. in
ptp_dp83640_settime. See section 3.1 in [1]: "All subsequent settings
should use a step
adjustment or temporary rate adjustment, which should occur at each
PHY without introducing any error." This means, whenever we do
something else (directly write to the clock register), we must
recalibrate.
Clobbering the calibration pin with another function only makes sense
if the hardware design has exactly one PHY.
Or if the hardware has two PHYs that are not used at the same time. I
have a board that has two DP83640 on the same MII bus, one is used for
optical Ethernet, one for copper. Only one of the PHYs is powered up
at a time, the other one is in power down and MII isolate mode. In
such a case the calibration pin could be used for something else.
Christian
From: Christian Riesch <hidden> Date: 2014-06-26 06:16:14
On Thu, Jun 26, 2014 at 8:14 AM, Christian Riesch
[off-list ref] wrote:
Yes, indeed, but isn't that a bug? I think the calibration should be
done again whenever the clock is loaded with a new value, i.e. in
ptp_dp83640_settime. See section 3.1 in [1]: "All subsequent settings
should use a step
adjustment or temporary rate adjustment, which should occur at each
PHY without introducing any error." This means, whenever we do
something else (directly write to the clock register), we must
recalibrate.
From: Richard Cochran <richardcochran@gmail.com> Date: 2014-06-26 14:57:33
On Thu, Jun 26, 2014 at 08:14:58AM +0200, Christian Riesch wrote:
On Thu, Jun 26, 2014 at 7:21 AM, Richard Cochran [off-list ref] wrote:
quoted
Reassigning the calibration function never makes sense, because it is
only used in the driver probe method.
Yes, indeed, but isn't that a bug? I think the calibration should be
done again whenever the clock is loaded with a new value, i.e. in
ptp_dp83640_settime. See section 3.1 in [1]: "All subsequent settings
should use a step
adjustment or temporary rate adjustment, which should occur at each
PHY without introducing any error." This means, whenever we do
something else (directly write to the clock register), we must
recalibrate.
When we write the time, we use the broadcast address, and so the PHYs
receive the data at exactly the same time on the MDIO bus. But maybe
they would still need a new, fine calibration. Can you test this?
(I don't have a board with two phys.)
Thanks,
Richard