Skip to content

Commit f316484

Browse files
Wei Fangkuba-moo
authored andcommitted
ptp: qoriq: convert to use generic interfaces to set loopback mode
Since the generic debugfs interfaces for setting the periodic pulse signal loopback have been added to the ptp_clock driver, so convert the vendor-defined debugfs interfaces to the generic interfaces. Signed-off-by: Wei Fang <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Tested-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 67ac836 commit f316484

File tree

6 files changed

+24
-118
lines changed

6 files changed

+24
-118
lines changed

MAINTAINERS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9817,7 +9817,6 @@ F: drivers/net/ethernet/freescale/dpaa2/dpaa2-ptp*
98179817
F: drivers/net/ethernet/freescale/dpaa2/dprtc*
98189818
F: drivers/net/ethernet/freescale/enetc/enetc_ptp.c
98199819
F: drivers/ptp/ptp_qoriq.c
9820-
F: drivers/ptp/ptp_qoriq_debugfs.c
98219820
F: include/linux/fsl/ptp_qoriq.h
98229821

98239822
FREESCALE QUAD SPI DRIVER

drivers/ptp/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ config PTP_1588_CLOCK_QORIQ
6767
packets using the SO_TIMESTAMPING API.
6868

6969
To compile this driver as a module, choose M here: the module
70-
will be called ptp-qoriq.
70+
will be called ptp_qoriq.
7171

7272
comment "Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks."
7373
depends on PHYLIB=n || NETWORK_PHY_TIMESTAMPING=n

drivers/ptp/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ obj-$(CONFIG_PTP_1588_CLOCK_INES) += ptp_ines.o
1212
obj-$(CONFIG_PTP_1588_CLOCK_PCH) += ptp_pch.o
1313
obj-$(CONFIG_PTP_1588_CLOCK_KVM) += ptp_kvm.o
1414
obj-$(CONFIG_PTP_1588_CLOCK_VMCLOCK) += ptp_vmclock.o
15-
obj-$(CONFIG_PTP_1588_CLOCK_QORIQ) += ptp-qoriq.o
16-
ptp-qoriq-y += ptp_qoriq.o
17-
ptp-qoriq-$(CONFIG_DEBUG_FS) += ptp_qoriq_debugfs.o
15+
obj-$(CONFIG_PTP_1588_CLOCK_QORIQ) += ptp_qoriq.o
1816
obj-$(CONFIG_PTP_1588_CLOCK_IDTCM) += ptp_clockmatrix.o
1917
obj-$(CONFIG_PTP_1588_CLOCK_FC3W) += ptp_fc3.o
2018
obj-$(CONFIG_PTP_1588_CLOCK_IDT82P33) += ptp_idt82p33.o

drivers/ptp/ptp_qoriq.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,25 @@ static int ptp_qoriq_auto_config(struct ptp_qoriq *ptp_qoriq,
465465
return 0;
466466
}
467467

468+
static int ptp_qoriq_perout_loopback(struct ptp_clock_info *ptp,
469+
unsigned int index, int on)
470+
{
471+
struct ptp_qoriq *ptp_qoriq = container_of(ptp, struct ptp_qoriq, caps);
472+
struct ptp_qoriq_registers *regs = &ptp_qoriq->regs;
473+
u32 loopback_bit = index ? PP2L : PP1L;
474+
u32 tmr_ctrl;
475+
476+
tmr_ctrl = ptp_qoriq->read(&regs->ctrl_regs->tmr_ctrl);
477+
if (on)
478+
tmr_ctrl |= loopback_bit;
479+
else
480+
tmr_ctrl &= ~loopback_bit;
481+
482+
ptp_qoriq->write(&regs->ctrl_regs->tmr_ctrl, tmr_ctrl);
483+
484+
return 0;
485+
}
486+
468487
int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
469488
const struct ptp_clock_info *caps)
470489
{
@@ -479,6 +498,8 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
479498

480499
ptp_qoriq->base = base;
481500
ptp_qoriq->caps = *caps;
501+
ptp_qoriq->caps.n_per_lp = 2;
502+
ptp_qoriq->caps.perout_loopback = ptp_qoriq_perout_loopback;
482503

483504
if (of_property_read_u32(node, "fsl,cksel", &ptp_qoriq->cksel))
484505
ptp_qoriq->cksel = DEFAULT_CKSEL;
@@ -568,7 +589,7 @@ int ptp_qoriq_init(struct ptp_qoriq *ptp_qoriq, void __iomem *base,
568589
return PTR_ERR(ptp_qoriq->clock);
569590

570591
ptp_qoriq->phc_index = ptp_clock_index(ptp_qoriq->clock);
571-
ptp_qoriq_create_debugfs(ptp_qoriq);
592+
572593
return 0;
573594
}
574595
EXPORT_SYMBOL_GPL(ptp_qoriq_init);
@@ -580,7 +601,6 @@ void ptp_qoriq_free(struct ptp_qoriq *ptp_qoriq)
580601
ptp_qoriq->write(&regs->ctrl_regs->tmr_temask, 0);
581602
ptp_qoriq->write(&regs->ctrl_regs->tmr_ctrl, 0);
582603

583-
ptp_qoriq_remove_debugfs(ptp_qoriq);
584604
ptp_clock_unregister(ptp_qoriq->clock);
585605
iounmap(ptp_qoriq->base);
586606
free_irq(ptp_qoriq->irq, ptp_qoriq);

drivers/ptp/ptp_qoriq_debugfs.c

Lines changed: 0 additions & 101 deletions
This file was deleted.

include/linux/fsl/ptp_qoriq.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ struct ptp_qoriq {
145145
struct ptp_clock *clock;
146146
struct ptp_clock_info caps;
147147
struct resource *rsrc;
148-
struct dentry *debugfs_root;
149148
struct device *dev;
150149
bool extts_fifo_support;
151150
bool fiper3_support;
@@ -195,14 +194,5 @@ int ptp_qoriq_settime(struct ptp_clock_info *ptp,
195194
int ptp_qoriq_enable(struct ptp_clock_info *ptp,
196195
struct ptp_clock_request *rq, int on);
197196
int extts_clean_up(struct ptp_qoriq *ptp_qoriq, int index, bool update_event);
198-
#ifdef CONFIG_DEBUG_FS
199-
void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq);
200-
void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq);
201-
#else
202-
static inline void ptp_qoriq_create_debugfs(struct ptp_qoriq *ptp_qoriq)
203-
{ }
204-
static inline void ptp_qoriq_remove_debugfs(struct ptp_qoriq *ptp_qoriq)
205-
{ }
206-
#endif
207197

208198
#endif

0 commit comments

Comments
 (0)