dp83640: Verify calibration pin assignment
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Fri, 27 Jun 2014 10:05:31 +0000 (12:05 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Jul 2014 01:52:53 +0000 (18:52 -0700)
This constraints the pin assignment to not allow the calibration function to
be reassigned and only allow reassigning the calibratin pin if only one phy is
connected.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/dp83640.c

index eabecff9b740ac30797f02d35c98b7588133d55e..ab4811242458e7462bb6a6450912ae9d5b478970 100644 (file)
@@ -510,6 +510,16 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
 static int ptp_dp83640_verify(struct ptp_clock_info *ptp, unsigned int pin,
                              enum ptp_pin_function func, unsigned int chan)
 {
+       struct dp83640_clock *clock =
+               container_of(ptp, struct dp83640_clock, caps);
+
+       if (clock->caps.pin_config[pin].func == PTP_PF_PHYSYNC &&
+           !list_empty(&clock->phylist))
+               return 1;
+
+       if (func == PTP_PF_PHYSYNC)
+               return 1;
+
        return 0;
 }