diff options
author | Andrew Lunn <andrew@lunn.ch> | 2018-07-18 23:38:22 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-19 01:05:38 +0300 |
commit | dfa543481034ef57cba55585e35eead113f50030 (patch) | |
tree | 893dd93f99cb34724d58ffe96f29ed7bce78ac2a /drivers/net/dsa/mv88e6xxx/ptp.c | |
parent | a469a61231e5f67de4289f2a7889f0665528b13b (diff) | |
download | linux-dfa543481034ef57cba55585e35eead113f50030.tar.xz |
net: dsa: mv88e6xxx: Add mv88e6165 PTP support
The mv88e6165 family has its global clock in the PTP global
registers. It does not support any form of PTP events. Add a function
to read the clock, fill in an ops structure, and register it with the
two members of the family.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/ptp.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/ptp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c index aaa8f1b3dc08..485f5676fefb 100644 --- a/drivers/net/dsa/mv88e6xxx/ptp.c +++ b/drivers/net/dsa/mv88e6xxx/ptp.c @@ -79,6 +79,20 @@ static u64 mv88e6352_ptp_clock_read(const struct cyclecounter *cc) return ((u32)phc_time[1] << 16) | phc_time[0]; } +static u64 mv88e6165_ptp_clock_read(const struct cyclecounter *cc) +{ + struct mv88e6xxx_chip *chip = cc_to_chip(cc); + u16 phc_time[2]; + int err; + + err = mv88e6xxx_tai_read(chip, MV88E6XXX_PTP_GC_TIME_LO, phc_time, + ARRAY_SIZE(phc_time)); + if (err) + return 0; + else + return ((u32)phc_time[1] << 16) | phc_time[0]; +} + /* mv88e6352_config_eventcap - configure TAI event capture * @event: PTP_CLOCK_PPS (internal) or PTP_CLOCK_EXTTS (external) * @rising: zero for falling-edge trigger, else rising-edge trigger @@ -307,6 +321,10 @@ const struct mv88e6xxx_ptp_ops mv88e6352_ptp_ops = { .n_ext_ts = 1, }; +const struct mv88e6xxx_ptp_ops mv88e6165_ptp_ops = { + .clock_read = mv88e6165_ptp_clock_read, +}; + static u64 mv88e6xxx_ptp_clock_read(const struct cyclecounter *cc) { struct mv88e6xxx_chip *chip = cc_to_chip(cc); |