Commit 10bc877c authored by Yangbo Lu's avatar Yangbo Lu Committed by David S. Miller

ptp_qoriq: check valid status before reading extts fifo

For PTP timer supporting external trigger timestamp FIFO,
there is a valid bit in TMR_STAT register indicating the
timestamp is available. For PTP timer without FIFO, there
is not TMR_STAT register.
This patch is to check the valid bit for the FIFO before
reading timestamp, and to avoid operating TMR_STAT register
for PTP timer without the FIFO.
Signed-off-by: default avatarYangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0e627190
...@@ -81,7 +81,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, ...@@ -81,7 +81,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
struct ptp_clock_event event; struct ptp_clock_event event;
void __iomem *reg_etts_l; void __iomem *reg_etts_l;
void __iomem *reg_etts_h; void __iomem *reg_etts_h;
u32 valid, stat, lo, hi; u32 valid, lo, hi;
switch (index) { switch (index) {
case 0: case 0:
...@@ -101,6 +101,10 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, ...@@ -101,6 +101,10 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
event.type = PTP_CLOCK_EXTTS; event.type = PTP_CLOCK_EXTTS;
event.index = index; event.index = index;
if (ptp_qoriq->extts_fifo_support)
if (!(ptp_qoriq->read(&regs->ctrl_regs->tmr_stat) & valid))
return 0;
do { do {
lo = ptp_qoriq->read(reg_etts_l); lo = ptp_qoriq->read(reg_etts_l);
hi = ptp_qoriq->read(reg_etts_h); hi = ptp_qoriq->read(reg_etts_h);
...@@ -111,8 +115,9 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, ...@@ -111,8 +115,9 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
ptp_clock_event(ptp_qoriq->clock, &event); ptp_clock_event(ptp_qoriq->clock, &event);
} }
stat = ptp_qoriq->read(&regs->ctrl_regs->tmr_stat); if (!ptp_qoriq->extts_fifo_support)
} while (ptp_qoriq->extts_fifo_support && (stat & valid)); break;
} while (ptp_qoriq->read(&regs->ctrl_regs->tmr_stat) & valid);
return 0; return 0;
} }
......
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