Skip to content

Commit

Permalink
ptp_qoriq: make ptp operations global
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yangbo Lu authored and David S. Miller committed Feb 12, 2019
1 parent 1e562c8 commit 73356e4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
27 changes: 16 additions & 11 deletions drivers/ptp/ptp_qoriq.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

#include <linux/device.h>
#include <linux/hrtimer.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
Expand Down Expand Up @@ -135,7 +134,7 @@ static int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index,
* Interrupt service routine
*/

static irqreturn_t isr(int irq, void *priv)
irqreturn_t ptp_qoriq_isr(int irq, void *priv)
{
struct ptp_qoriq *ptp_qoriq = priv;
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
Expand Down Expand Up @@ -200,12 +199,13 @@ static irqreturn_t isr(int irq, void *priv)
} else
return IRQ_NONE;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_isr);

/*
* PTP clock operations
*/

static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
{
u64 adj, diff;
u32 tmr_add;
Expand Down Expand Up @@ -233,8 +233,9 @@ static int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)

return 0;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_adjfine);

static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)
{
s64 now;
unsigned long flags;
Expand All @@ -251,9 +252,9 @@ static int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta)

return 0;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_adjtime);

static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,
struct timespec64 *ts)
int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
u64 ns;
unsigned long flags;
Expand All @@ -269,9 +270,10 @@ static int ptp_qoriq_gettime(struct ptp_clock_info *ptp,

return 0;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_gettime);

static int ptp_qoriq_settime(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
int ptp_qoriq_settime(struct ptp_clock_info *ptp,
const struct timespec64 *ts)
{
u64 ns;
unsigned long flags;
Expand All @@ -288,9 +290,10 @@ static int ptp_qoriq_settime(struct ptp_clock_info *ptp,

return 0;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_settime);

static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
int ptp_qoriq_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{
struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
Expand Down Expand Up @@ -336,6 +339,7 @@ static int ptp_qoriq_enable(struct ptp_clock_info *ptp,
spin_unlock_irqrestore(&ptp_qoriq->lock, flags);
return 0;
}
EXPORT_SYMBOL_GPL(ptp_qoriq_enable);

static const struct ptp_clock_info ptp_qoriq_caps = {
.owner = THIS_MODULE,
Expand Down Expand Up @@ -508,7 +512,8 @@ static int ptp_qoriq_probe(struct platform_device *dev)
pr_err("irq not in device tree\n");
goto no_node;
}
if (request_irq(ptp_qoriq->irq, isr, IRQF_SHARED, DRIVER, ptp_qoriq)) {
if (request_irq(ptp_qoriq->irq, ptp_qoriq_isr, IRQF_SHARED,
DRIVER, ptp_qoriq)) {
pr_err("request_irq failed\n");
goto no_node;
}
Expand Down
9 changes: 9 additions & 0 deletions include/linux/fsl/ptp_qoriq.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#define __PTP_QORIQ_H__

#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/ptp_clock_kernel.h>

/*
Expand Down Expand Up @@ -171,6 +172,14 @@ static inline void qoriq_write(unsigned __iomem *addr, u32 val)
iowrite32be(val, addr);
}

irqreturn_t ptp_qoriq_isr(int irq, void *priv);
int ptp_qoriq_adjfine(struct ptp_clock_info *ptp, long scaled_ppm);
int ptp_qoriq_adjtime(struct ptp_clock_info *ptp, s64 delta);
int ptp_qoriq_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts);
int ptp_qoriq_settime(struct ptp_clock_info *ptp,
const struct timespec64 *ts);
int ptp_qoriq_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on);
#ifdef CONFIG_DEBUG_FS
void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);
Expand Down

0 comments on commit 73356e4

Please sign in to comment.