20 #include <linux/device.h>
27 #include <linux/kernel.h>
28 #include <linux/module.h>
33 #define DRIVER "ptp_ixp46x"
62 ns = ((
u64) hi) << 32;
101 event.timestamp = ((
u64) hi) << 32;
102 event.timestamp |=
lo;
115 event.timestamp = ((
u64) hi) << 32;
116 event.timestamp |=
lo;
151 diff = div_u64(adj, 1000000000ULL);
153 addend = neg_adj ? addend - diff : addend + diff;
169 now = ixp_systime_read(regs);
171 ixp_systime_write(regs, now);
173 spin_unlock_irqrestore(®ister_lock, flags);
188 ns = ixp_systime_read(regs);
190 spin_unlock_irqrestore(®ister_lock, flags);
192 ts->
tv_sec = div_u64_rem(ns, 1000000000, &remainder);
205 ns = ts->
tv_sec * 1000000000ULL;
210 ixp_systime_write(regs, ns);
212 spin_unlock_irqrestore(®ister_lock, flags);
223 case PTP_CLK_REQ_EXTTS:
224 switch (rq->
extts.index) {
244 .name =
"IXP46X timer",
248 .adjfreq = ptp_ixp_adjfreq,
249 .adjtime = ptp_ixp_adjtime,
250 .gettime = ptp_ixp_gettime,
251 .settime = ptp_ixp_settime,
252 .enable = ptp_ixp_enable,
257 static struct ixp_clock ixp_clock;
259 static int setup_interrupt(
int gpio)
271 pr_err(
"cannot set trigger type for irq %d\n", irq);
276 pr_err(
"request_irq failed for irq %d\n", irq);
283 static void __exit ptp_ixp_exit(
void)
291 static int __init ptp_ixp_init(
void)
299 ixp_clock.
caps = ptp_ixp_caps;