Commit ad3cc776 authored by Min Li's avatar Min Li Committed by David S. Miller

ptp: idt82p33: Add PTP_CLK_REQ_EXTTS support

82P33 family of chips can trigger TOD read/write by external
signal from one of the IN12/13/14 pins, which are set user
space programs by calling PTP_PIN_SETFUNC through ptp_ioctl
Signed-off-by: default avatarMin Li <min.li.xe@renesas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eea7b313
This diff is collapsed.
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#define FW_FILENAME "idt82p33xxx.bin" #define FW_FILENAME "idt82p33xxx.bin"
#define MAX_PHC_PLL (2) #define MAX_PHC_PLL (2)
#define MAX_TRIG_CLK (3)
#define MAX_PER_OUT (11)
#define TOD_BYTE_COUNT (10) #define TOD_BYTE_COUNT (10)
#define DCO_MAX_PPB (92000) #define DCO_MAX_PPB (92000)
#define MAX_MEASURMENT_COUNT (5) #define MAX_MEASURMENT_COUNT (5)
...@@ -60,8 +62,18 @@ struct idt82p33_channel { ...@@ -60,8 +62,18 @@ struct idt82p33_channel {
struct ptp_clock *ptp_clock; struct ptp_clock *ptp_clock;
struct idt82p33 *idt82p33; struct idt82p33 *idt82p33;
enum pll_mode pll_mode; enum pll_mode pll_mode;
s32 current_freq_ppb; /* Workaround for TOD-to-output alignment issue */
struct delayed_work adjtime_work;
s32 current_freq;
/* double dco mode */
bool ddco;
u8 output_mask; u8 output_mask;
/* last input trigger for extts */
u8 tod_trigger;
bool discard_next_extts;
u8 plln;
/* remember last tod_sts for extts */
u8 extts_tod_sts[TOD_BYTE_COUNT];
u16 dpll_tod_cnfg; u16 dpll_tod_cnfg;
u16 dpll_tod_trigger; u16 dpll_tod_trigger;
u16 dpll_tod_sts; u16 dpll_tod_sts;
...@@ -76,6 +88,12 @@ struct idt82p33 { ...@@ -76,6 +88,12 @@ struct idt82p33 {
struct idt82p33_channel channel[MAX_PHC_PLL]; struct idt82p33_channel channel[MAX_PHC_PLL];
struct device *dev; struct device *dev;
u8 pll_mask; u8 pll_mask;
/* Polls for external time stamps */
u8 extts_mask;
bool extts_single_shot;
struct delayed_work extts_work;
/* Remember the ptp channel to report extts */
struct idt82p33_channel *event_channel[MAX_PHC_PLL];
/* Mutex to protect operations from being interrupted */ /* Mutex to protect operations from being interrupted */
struct mutex *lock; struct mutex *lock;
struct regmap *regmap; struct regmap *regmap;
......
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