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.
Unified · Split
| @@ -22,7 +22,6 @@ · 21 unmodified lines | |||
| 22 | 22 | ||
| 23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
| 24 | #include <linux/hrtimer.h> | 24 | #include <linux/hrtimer.h> |
| 25 | #include <linux/interrupt.h> | ||
| 26 | #include <linux/kernel.h> | 25 | #include <linux/kernel.h> |
| 27 | #include <linux/module.h> | 26 | #include <linux/module.h> |
| 28 | #include <linux/of.h> | 27 | #include <linux/of.h> |
| @@ -135,7 +134,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, · 106 unmodified lines | |||
| 135 | * Interrupt service routine | 134 | * Interrupt service routine |
| 136 | */ | 135 | */ |
| 137 | 136 | ||
| 138 | static irqreturn_t isr(int irq, void *priv) | 137 | irqreturn_t ptp_qoriq_isr(int irq, void *priv) |
| 139 | { | 138 | { |
| 140 | struct ptp_qoriq *ptp_qoriq = priv; | 139 | struct ptp_qoriq *ptp_qoriq = priv; |
| 141 | struct ptp_qoriq_registers *regs = &ptp_qoriq->regs; | 140 | struct ptp_qoriq_registers *regs = &ptp_qoriq->regs; |
| @@ -200,12 +199,13 @@ static irqreturn_t isr(int irq, void *priv) · 58 unmodified lines | |||
| 200 | } else | 199 | } else |
| 201 | return IRQ_NONE; | 200 | return IRQ_NONE; |
| 202 | } | 201 | } |
| 202 | EXPORT_SYMBOL_GPL(ptp_qoriq_isr); | ||
| 203 | 203 | ||
| 204 | /* | 204 | /* |
| 205 | * PTP clock operations | 205 | * PTP clock operations |
| 206 | */ | 206 | */ |
| 207 | 207 | ||
| 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) |
| 209 | { | 209 | { |
| 210 | u64 adj, diff; | 210 | u64 adj, diff; |
| 211 | u32 tmr_add; | 211 | u32 tmr_add; |
| @@ -233,8 +233,9 @@ static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm) · 21 unmodified lines | |||
| 233 | 233 | ||
| 234 | return 0; | 234 | return 0; |
| 235 | } | 235 | } |
| 236 | EXPORT_SYMBOL_GPL(ptp_qoriq_adjfine); | ||
| 236 | 237 | ||
| 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) |
| 238 | { | 239 | { |
| 239 | s64 now; | 240 | s64 now; |
| 240 | unsigned long flags; | 241 | unsigned long flags; |
| @@ -251,9 +252,9 @@ static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta) · 10 unmodified lines | |||
| 251 | 252 | ||
| 252 | return 0; | 253 | return 0; |
| 253 | } | 254 | } |
| 255 | EXPORT_SYMBOL_GPL(ptp_qoriq_adjtime); | ||
| 254 | 256 | ||
| 255 | static int ptp_qoriq_gettime(struct ptp_clock_info *ptp, | 257 | int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
| 256 | struct timespec64 *ts) | ||
| 257 | { | 258 | { |
| 258 | u64 ns; | 259 | u64 ns; |
| 259 | unsigned long flags; | 260 | unsigned long flags; |
| @@ -269,9 +270,10 @@ static int ptp_qoriq_gettime(struct ptp_clock_info *ptp, · 9 unmodified lines | |||
| 269 | 270 | ||
| 270 | return 0; | 271 | return 0; |
| 271 | } | 272 | } |
| 273 | EXPORT_SYMBOL_GPL(ptp_qoriq_gettime); | ||
| 272 | 274 | ||
| 273 | static int ptp_qoriq_settime(struct ptp_clock_info *ptp, | 275 | int ptp_qoriq_settime(struct ptp_clock_info *ptp, |
| 274 | const struct timespec64 *ts) | 276 | const struct timespec64 *ts) |
| 275 | { | 277 | { |
| 276 | u64 ns; | 278 | u64 ns; |
| 277 | unsigned long flags; | 279 | unsigned long flags; |
| @@ -288,9 +290,10 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp, · 10 unmodified lines | |||
| 288 | 290 | ||
| 289 | return 0; | 291 | return 0; |
| 290 | } | 292 | } |
| 293 | EXPORT_SYMBOL_GPL(ptp_qoriq_settime); | ||
| 291 | 294 | ||
| 292 | static int ptp_qoriq_enable(struct ptp_clock_info *ptp, | 295 | int ptp_qoriq_enable(struct ptp_clock_info *ptp, |
| 293 | struct ptp_clock_request *rq, int on) | 296 | struct ptp_clock_request *rq, int on) |
| 294 | { | 297 | { |
| 295 | struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps); | 298 | struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps); |
| 296 | struct ptp_qoriq_registers *regs = &ptp_qoriq->regs; | 299 | 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 | |||
| 336 | spin_unlock_irqrestore(&ptp_qoriq->lock, flags); | 339 | spin_unlock_irqrestore(&ptp_qoriq->lock, flags); |
| 337 | return 0; | 340 | return 0; |
| 338 | } | 341 | } |
| 342 | EXPORT_SYMBOL_GPL(ptp_qoriq_enable); | ||
| 339 | 343 | ||
| 340 | static const struct ptp_clock_info ptp_qoriq_caps = { | 344 | static const struct ptp_clock_info ptp_qoriq_caps = { |
| 341 | .owner = THIS_MODULE, | 345 | .owner = THIS_MODULE, |
| @@ -508,7 +512,8 @@ static int ptp_qoriq_probe(struct platform_device *dev) · 166 unmodified lines | |||
| 508 | pr_err("irq not in device tree\n"); | 512 | pr_err("irq not in device tree\n"); |
| 509 | goto no_node; | 513 | goto no_node; |
| 510 | } | 514 | } |
| 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)) { | ||
| 512 | pr_err("request_irq failed\n"); | 517 | pr_err("request_irq failed\n"); |
| 513 | goto no_node; | 518 | goto no_node; |
| 514 | } | 519 | } |
| @@ -7,6 +7,7 @@ · 6 unmodified lines | |||
| 7 | #define __PTP_QORIQ_H__ | 7 | #define __PTP_QORIQ_H__ |
| 8 | 8 | ||
| 9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
| 10 | #include <linux/interrupt.h> | ||
| 10 | #include <linux/ptp_clock_kernel.h> | 11 | #include <linux/ptp_clock_kernel.h> |
| 11 | 12 | ||
| 12 | /* | 13 | /* |
| @@ -171,6 +172,14 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val) · 158 unmodified lines | |||
| 171 | iowrite32be(val, addr); | 172 | iowrite32be(val, addr); |
| 172 | } | 173 | } |
| 173 | 174 | ||
| 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); | ||
| 174 | #ifdef CONFIG_DEBUG_FS | 183 | #ifdef CONFIG_DEBUG_FS |
| 175 | void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq); | 184 | void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq); |
| 176 | void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq); | 185 | void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq); |