Skip to content

Commit 17568c6

Browse files
yangbolu1991davem330
authored andcommitted
dpaa2-ptp: add external trigger event support
This patch is to add external trigger event support for dpaa2-ptp driver with v2 dprtc_set_irq_mask() API. Signed-off-by: Yangbo Lu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9429439 commit 17568c6

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ static int dpaa2_ptp_enable(struct ptp_clock_info *ptp,
2727
mc_dev = to_fsl_mc_device(dev);
2828

2929
switch (rq->type) {
30+
case PTP_CLK_REQ_EXTTS:
31+
switch (rq->extts.index) {
32+
case 0:
33+
bit = DPRTC_EVENT_ETS1;
34+
break;
35+
case 1:
36+
bit = DPRTC_EVENT_ETS2;
37+
break;
38+
default:
39+
return -EINVAL;
40+
}
41+
if (on)
42+
extts_clean_up(ptp_qoriq, rq->extts.index, false);
43+
break;
3044
case PTP_CLK_REQ_PPS:
3145
bit = DPRTC_EVENT_PPS;
3246
break;
@@ -96,6 +110,12 @@ static irqreturn_t dpaa2_ptp_irq_handler_thread(int irq, void *priv)
96110
ptp_clock_event(ptp_qoriq->clock, &event);
97111
}
98112

113+
if (status & DPRTC_EVENT_ETS1)
114+
extts_clean_up(ptp_qoriq, 0, true);
115+
116+
if (status & DPRTC_EVENT_ETS2)
117+
extts_clean_up(ptp_qoriq, 1, true);
118+
99119
err = dprtc_clear_irq_status(mc_dev->mc_io, 0, mc_dev->mc_handle,
100120
DPRTC_IRQ_INDEX, status);
101121
if (unlikely(err)) {

drivers/net/ethernet/freescale/dpaa2/dprtc-cmd.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,19 @@
99

1010
/* Command versioning */
1111
#define DPRTC_CMD_BASE_VERSION 1
12+
#define DPRTC_CMD_VERSION_2 2
1213
#define DPRTC_CMD_ID_OFFSET 4
1314

1415
#define DPRTC_CMD(id) (((id) << DPRTC_CMD_ID_OFFSET) | DPRTC_CMD_BASE_VERSION)
16+
#define DPRTC_CMD_V2(id) (((id) << DPRTC_CMD_ID_OFFSET) | DPRTC_CMD_VERSION_2)
1517

1618
/* Command IDs */
1719
#define DPRTC_CMDID_CLOSE DPRTC_CMD(0x800)
1820
#define DPRTC_CMDID_OPEN DPRTC_CMD(0x810)
1921

2022
#define DPRTC_CMDID_SET_IRQ_ENABLE DPRTC_CMD(0x012)
2123
#define DPRTC_CMDID_GET_IRQ_ENABLE DPRTC_CMD(0x013)
22-
#define DPRTC_CMDID_SET_IRQ_MASK DPRTC_CMD(0x014)
24+
#define DPRTC_CMDID_SET_IRQ_MASK DPRTC_CMD_V2(0x014)
2325
#define DPRTC_CMDID_GET_IRQ_MASK DPRTC_CMD(0x015)
2426
#define DPRTC_CMDID_GET_IRQ_STATUS DPRTC_CMD(0x016)
2527
#define DPRTC_CMDID_CLEAR_IRQ_STATUS DPRTC_CMD(0x017)

drivers/net/ethernet/freescale/dpaa2/dprtc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ struct fsl_mc_io;
2020
#define DPRTC_IRQ_INDEX 0
2121

2222
#define DPRTC_EVENT_PPS 0x08000000
23+
#define DPRTC_EVENT_ETS1 0x00800000
24+
#define DPRTC_EVENT_ETS2 0x00400000
2325

2426
int dprtc_open(struct fsl_mc_io *mc_io,
2527
u32 cmd_flags,

0 commit comments

Comments
 (0)