summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/mv88e6xxx/ptp.c
diff options
context:
space:
mode:
authorAndrew Lunn2018-07-18 22:38:22 +0200
committerDavid S. Miller2018-07-19 00:05:38 +0200
commitdfa543481034ef57cba55585e35eead113f50030 (patch)
tree893dd93f99cb34724d58ffe96f29ed7bce78ac2a /drivers/net/dsa/mv88e6xxx/ptp.c
parentnet: dsa: mv88e6xxx: Add MV88E6165 AVB register access (diff)
downloadkernel-qcow2-linux-dfa543481034ef57cba55585e35eead113f50030.tar.gz
kernel-qcow2-linux-dfa543481034ef57cba55585e35eead113f50030.tar.xz
kernel-qcow2-linux-dfa543481034ef57cba55585e35eead113f50030.zip
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.c18
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);