Commit bec67592 authored by Min Li's avatar Min Li Committed by Jakub Kicinski

ptp: ptp_clockmatrix: Add PTP_CLK_REQ_EXTTS support

Use TOD_READ_SECONDARY for extts to keep TOD_READ_PRIMARY
for gettime and settime exclusively. Before this change,
TOD_READ_PRIMARY was used for both extts and gettime/settime,
which would result in changing TOD read/write triggers between
operations. Using TOD_READ_SECONDARY would make extts
independent of gettime/settime operation
Signed-off-by: default avatarMin Li <min.li.xe@renesas.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/1652712427-14703-1-git-send-email-min.li.xe@renesas.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5ff0348b
This diff is collapsed.
...@@ -10,11 +10,13 @@ ...@@ -10,11 +10,13 @@
#include <linux/ktime.h> #include <linux/ktime.h>
#include <linux/mfd/idt8a340_reg.h> #include <linux/mfd/idt8a340_reg.h>
#include <linux/ptp_clock.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#define FW_FILENAME "idtcm.bin" #define FW_FILENAME "idtcm.bin"
#define MAX_TOD (4) #define MAX_TOD (4)
#define MAX_PLL (8) #define MAX_PLL (8)
#define MAX_REF_CLK (16)
#define MAX_ABS_WRITE_PHASE_PICOSECONDS (107374182350LL) #define MAX_ABS_WRITE_PHASE_PICOSECONDS (107374182350LL)
...@@ -90,6 +92,7 @@ struct idtcm_channel { ...@@ -90,6 +92,7 @@ struct idtcm_channel {
u16 dpll_ctrl_n; u16 dpll_ctrl_n;
u16 dpll_phase_pull_in; u16 dpll_phase_pull_in;
u16 tod_read_primary; u16 tod_read_primary;
u16 tod_read_secondary;
u16 tod_write; u16 tod_write;
u16 tod_n; u16 tod_n;
u16 hw_dpll_n; u16 hw_dpll_n;
...@@ -105,6 +108,7 @@ struct idtcm_channel { ...@@ -105,6 +108,7 @@ struct idtcm_channel {
/* last input trigger for extts */ /* last input trigger for extts */
u8 refn; u8 refn;
u8 pll; u8 pll;
u8 tod;
u16 output_mask; u16 output_mask;
}; };
...@@ -116,6 +120,7 @@ struct idtcm { ...@@ -116,6 +120,7 @@ struct idtcm {
enum fw_version fw_ver; enum fw_version fw_ver;
/* Polls for external time stamps */ /* Polls for external time stamps */
u8 extts_mask; u8 extts_mask;
bool extts_single_shot;
struct delayed_work extts_work; struct delayed_work extts_work;
/* Remember the ptp channel to report extts */ /* Remember the ptp channel to report extts */
struct idtcm_channel *event_channel[MAX_TOD]; struct idtcm_channel *event_channel[MAX_TOD];
......
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
#define TOD_READ_PRIMARY_0 0xcc40 #define TOD_READ_PRIMARY_0 0xcc40
#define TOD_READ_PRIMARY_0_V520 0xcc50 #define TOD_READ_PRIMARY_0_V520 0xcc50
/* 8-bit subns, 32-bit ns, 48-bit seconds */ /* 8-bit subns, 32-bit ns, 48-bit seconds */
#define TOD_READ_PRIMARY 0x0000 #define TOD_READ_PRIMARY_BASE 0x0000
/* Counter increments after TOD write is completed */ /* Counter increments after TOD write is completed */
#define TOD_READ_PRIMARY_COUNTER 0x000b #define TOD_READ_PRIMARY_COUNTER 0x000b
/* Read trigger configuration */ /* Read trigger configuration */
...@@ -424,6 +424,16 @@ ...@@ -424,6 +424,16 @@
#define TOD_READ_SECONDARY_0 0xcc90 #define TOD_READ_SECONDARY_0 0xcc90
#define TOD_READ_SECONDARY_0_V520 0xcca0 #define TOD_READ_SECONDARY_0_V520 0xcca0
/* 8-bit subns, 32-bit ns, 48-bit seconds */
#define TOD_READ_SECONDARY_BASE 0x0000
/* Counter increments after TOD write is completed */
#define TOD_READ_SECONDARY_COUNTER 0x000b
/* Read trigger configuration */
#define TOD_READ_SECONDARY_SEL_CFG_0 0x000c
/* Read trigger selection */
#define TOD_READ_SECONDARY_CMD 0x000e
#define TOD_READ_SECONDARY_CMD_V520 0x000f
#define TOD_READ_SECONDARY_1 0xcca0 #define TOD_READ_SECONDARY_1 0xcca0
#define TOD_READ_SECONDARY_1_V520 0xccb0 #define TOD_READ_SECONDARY_1_V520 0xccb0
#define TOD_READ_SECONDARY_2 0xccb0 #define TOD_READ_SECONDARY_2 0xccb0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment