]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net:phy:dp83640: Do not hardcode timestamping event edge
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Mon, 3 Feb 2014 14:36:50 +0000 (15:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Feb 2014 04:07:36 +0000 (20:07 -0800)
Currently the external timestamping code is hardcoded to use the
rising edge even though the hardware has configurable event edge
detection. This patch changes the code to use falling edge detection
if PTP_FALLING_EDGE is set in the user supplied flags.

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

index 3f882eea6e1d6e4a20b653b34c215a13b75ebef5..e347c8a218fc0f091a64e6ea48928aaa53d3e909 100644 (file)
@@ -437,7 +437,10 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp,
                if (on) {
                        gpio_num = gpio_tab[EXTTS0_GPIO + index];
                        evnt |= (gpio_num & EVNT_GPIO_MASK) << EVNT_GPIO_SHIFT;
-                       evnt |= EVNT_RISE;
+                       if (rq->extts.flags & PTP_FALLING_EDGE)
+                               evnt |= EVNT_FALL;
+                       else
+                               evnt |= EVNT_RISE;
                }
                ext_write(0, phydev, PAGE5, PTP_EVNT, evnt);
                return 0;