Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5c79c26 authored by Richard Cochran's avatar Richard Cochran Committed by David S. Miller
Browse files

ptp: cpts: convert to the 64 bit get/set time methods.



This driver's clock is implemented using a timecounter, and so with
this patch the driver is ready for the year 2038.

Compile tested only.

Signed-off-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3f6c4654
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -167,7 +167,7 @@ static int cpts_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
	return 0;
	return 0;
}
}


static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
{
{
	u64 ns;
	u64 ns;
	u32 remainder;
	u32 remainder;
@@ -185,7 +185,7 @@ static int cpts_ptp_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
}
}


static int cpts_ptp_settime(struct ptp_clock_info *ptp,
static int cpts_ptp_settime(struct ptp_clock_info *ptp,
			    const struct timespec *ts)
			    const struct timespec64 *ts)
{
{
	u64 ns;
	u64 ns;
	unsigned long flags;
	unsigned long flags;
@@ -216,20 +216,20 @@ static struct ptp_clock_info cpts_info = {
	.pps		= 0,
	.pps		= 0,
	.adjfreq	= cpts_ptp_adjfreq,
	.adjfreq	= cpts_ptp_adjfreq,
	.adjtime	= cpts_ptp_adjtime,
	.adjtime	= cpts_ptp_adjtime,
	.gettime	= cpts_ptp_gettime,
	.gettime64	= cpts_ptp_gettime,
	.settime	= cpts_ptp_settime,
	.settime64	= cpts_ptp_settime,
	.enable		= cpts_ptp_enable,
	.enable		= cpts_ptp_enable,
};
};


static void cpts_overflow_check(struct work_struct *work)
static void cpts_overflow_check(struct work_struct *work)
{
{
	struct timespec ts;
	struct timespec64 ts;
	struct cpts *cpts = container_of(work, struct cpts, overflow_work.work);
	struct cpts *cpts = container_of(work, struct cpts, overflow_work.work);


	cpts_write32(cpts, CPTS_EN, control);
	cpts_write32(cpts, CPTS_EN, control);
	cpts_write32(cpts, TS_PEND_EN, int_enable);
	cpts_write32(cpts, TS_PEND_EN, int_enable);
	cpts_ptp_gettime(&cpts->info, &ts);
	cpts_ptp_gettime(&cpts->info, &ts);
	pr_debug("cpts overflow check at %ld.%09lu\n", ts.tv_sec, ts.tv_nsec);
	pr_debug("cpts overflow check at %lld.%09lu\n", ts.tv_sec, ts.tv_nsec);
	schedule_delayed_work(&cpts->overflow_work, CPTS_OVERFLOW_PERIOD);
	schedule_delayed_work(&cpts->overflow_work, CPTS_OVERFLOW_PERIOD);
}
}