History

ptp_qoriq: make ptp operations global

This patch is to make functions of ptp operations global, so that ENETC PTP driver which is a PCI driver for same 1588 timer IP block could reuse them.

Yangbo Lu committed 7 years ago

Commit 73356e41 parent 1e562c82 files · +25 −11Browse files

Unified · Split

2 files
  1. drivers/ptp/ptp_qoriq.c +16 −11
  2. include/linux/fsl/ptp_qoriq.h +9 −0
drivers/ptp/ptp_qoriq.c+16−11
@@ -22,7 +22,6 @@ · 21 unmodified lines
2222
2323 #include <linux/device.h>
2424 #include <linux/hrtimer.h>
25−#include <linux/interrupt.h>
2625 #include <linux/kernel.h>
2726 #include <linux/module.h>
2827 #include <linux/of.h>
@@ -135,7 +134,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, · 106 unmodified lines
135134 * Interrupt service routine
136135 */
137136
138−static irqreturn_t isr(int irq, void *priv)
137+irqreturn_t ptp_qoriq_isr(int irq, void *priv)
139138 {
140139 struct ptp_qoriq *ptp_qoriq = priv;
141140 struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
@@ -200,12 +199,13 @@ static irqreturn_t isr(int irq, void *priv) · 58 unmodified lines
200199 } else
201200 return IRQ_NONE;
202201 }
202+EXPORT_SYMBOL_GPL(ptp_qoriq_isr);
203203
204204 /*
205205 * PTP clock operations
206206 */
207207
208−static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
208+int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
209209 {
210210 u64 adj, diff;
211211 u32 tmr_add;
@@ -233,8 +233,9 @@ static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) · 21 unmodified lines
233233
234234 return 0;
235235 }
236+EXPORT_SYMBOL_GPL(ptp_qoriq_adjfine);
236237
237−static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
238+int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
238239 {
239240 s64 now;
240241 unsigned long flags;
@@ -251,9 +252,9 @@ static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta) · 10 unmodified lines
251252
252253 return 0;
253254 }
255+EXPORT_SYMBOL_GPL(ptp_qoriq_adjtime);
254256
255−static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,
256− struct timespec64 *ts)
257+int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
257258 {
258259 u64 ns;
259260 unsigned long flags;
@@ -269,9 +270,10 @@ static int ptp_qoriq_gettime(struct ptp_clock_info *ptp, · 9 unmodified lines
269270
270271 return 0;
271272 }
273+EXPORT_SYMBOL_GPL(ptp_qoriq_gettime);
272274
273−static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
274− const struct timespec64 *ts)
275+int ptp_qoriq_settime(struct ptp_clock_info *ptp,
276+ const struct timespec64 *ts)
275277 {
276278 u64 ns;
277279 unsigned long flags;
@@ -288,9 +290,10 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp, · 10 unmodified lines
288290
289291 return 0;
290292 }
293+EXPORT_SYMBOL_GPL(ptp_qoriq_settime);
291294
292−static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
293− struct ptp_clock_request *rq, int on)
295+int ptp_qoriq_enable(struct ptp_clock_info *ptp,
296+ struct ptp_clock_request *rq, int on)
294297 {
295298 struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
296299 struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
@@ -336,6 +339,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp, · 39 unmodified lines
336339 spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
337340 return 0;
338341 }
342+EXPORT_SYMBOL_GPL(ptp_qoriq_enable);
339343
340344 static const struct ptp_clock_info ptp_qoriq_caps = {
341345 .owner = THIS_MODULE,
@@ -508,7 +512,8 @@ static int ptp_qoriq_probe(struct platform_device *dev) · 166 unmodified lines
508512 pr_err("irq not in device tree\n");
509513 goto no_node;
510514 }
511− if (request_irq(ptp_qoriq->irq, isr, IRQF_SHARED, DRIVER, ptp_qoriq)) {
515+ if (request_irq(ptp_qoriq->irq, ptp_qoriq_isr, IRQF_SHARED,
516+ DRIVER, ptp_qoriq)) {
512517 pr_err("request_irq failed\n");
513518 goto no_node;
514519 }
include/linux/fsl/ptp_qoriq.h+9−0
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #define __PTP_QORIQ_H__
88
99 #include <linux/io.h>
10+#include <linux/interrupt.h>
1011 #include <linux/ptp_clock_kernel.h>
1112
1213 /*
@@ -171,6 +172,14 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val) · 158 unmodified lines
171172 iowrite32be(val, addr);
172173 }
173174
175+irqreturn_t ptp_qoriq_isr(int irq, void *priv);
176+int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
177+int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
178+int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
179+int ptp_qoriq_settime(struct ptp_clock_info *ptp,
180+ const struct timespec64 *ts);
181+int ptp_qoriq_enable(struct ptp_clock_info *ptp,
182+ struct ptp_clock_request *rq, int on);
174183 #ifdef CONFIG_DEBUG_FS
175184 void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
176185 void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);