ptp_pch: Add missing #include <linux/slab.h>
[linux-flexiantxendom0-3.2.10.git] / drivers / ptp / ptp_pch.c
1 /*
2  * PTP 1588 clock using the EG20T PCH
3  *
4  * Copyright (C) 2010 OMICRON electronics GmbH
5  * Copyright (C) 2011-2012 LAPIS SEMICONDUCTOR Co., LTD.
6  *
7  * This code was derived from the IXP46X driver.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; version 2 of the License.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #include <linux/device.h>
24 #include <linux/err.h>
25 #include <linux/init.h>
26 #include <linux/interrupt.h>
27 #include <linux/io.h>
28 #include <linux/irq.h>
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/pci.h>
32 #include <linux/ptp_clock_kernel.h>
33 #include <linux/slab.h>
34
35 #define STATION_ADDR_LEN        20
36 #define PCI_DEVICE_ID_PCH_1588  0x8819
37 #define IO_MEM_BAR 1
38
39 #define DEFAULT_ADDEND 0xA0000000
40 #define TICKS_NS_SHIFT  5
41 #define N_EXT_TS        2
42
43 enum pch_status {
44         PCH_SUCCESS,
45         PCH_INVALIDPARAM,
46         PCH_NOTIMESTAMP,
47         PCH_INTERRUPTMODEINUSE,
48         PCH_FAILED,
49         PCH_UNSUPPORTED,
50 };
51 /**
52  * struct pch_ts_regs - IEEE 1588 registers
53  */
54 struct pch_ts_regs {
55         u32 control;
56         u32 event;
57         u32 addend;
58         u32 accum;
59         u32 test;
60         u32 ts_compare;
61         u32 rsystime_lo;
62         u32 rsystime_hi;
63         u32 systime_lo;
64         u32 systime_hi;
65         u32 trgt_lo;
66         u32 trgt_hi;
67         u32 asms_lo;
68         u32 asms_hi;
69         u32 amms_lo;
70         u32 amms_hi;
71         u32 ch_control;
72         u32 ch_event;
73         u32 tx_snap_lo;
74         u32 tx_snap_hi;
75         u32 rx_snap_lo;
76         u32 rx_snap_hi;
77         u32 src_uuid_lo;
78         u32 src_uuid_hi;
79         u32 can_status;
80         u32 can_snap_lo;
81         u32 can_snap_hi;
82         u32 ts_sel;
83         u32 ts_st[6];
84         u32 reserve1[14];
85         u32 stl_max_set_en;
86         u32 stl_max_set;
87         u32 reserve2[13];
88         u32 srst;
89 };
90
91 #define PCH_TSC_RESET           (1 << 0)
92 #define PCH_TSC_TTM_MASK        (1 << 1)
93 #define PCH_TSC_ASMS_MASK       (1 << 2)
94 #define PCH_TSC_AMMS_MASK       (1 << 3)
95 #define PCH_TSC_PPSM_MASK       (1 << 4)
96 #define PCH_TSE_TTIPEND         (1 << 1)
97 #define PCH_TSE_SNS             (1 << 2)
98 #define PCH_TSE_SNM             (1 << 3)
99 #define PCH_TSE_PPS             (1 << 4)
100 #define PCH_CC_MM               (1 << 0)
101 #define PCH_CC_TA               (1 << 1)
102
103 #define PCH_CC_MODE_SHIFT       16
104 #define PCH_CC_MODE_MASK        0x001F0000
105 #define PCH_CC_VERSION          (1 << 31)
106 #define PCH_CE_TXS              (1 << 0)
107 #define PCH_CE_RXS              (1 << 1)
108 #define PCH_CE_OVR              (1 << 0)
109 #define PCH_CE_VAL              (1 << 1)
110 #define PCH_ECS_ETH             (1 << 0)
111
112 #define PCH_ECS_CAN             (1 << 1)
113 #define PCH_STATION_BYTES       6
114
115 #define PCH_IEEE1588_ETH        (1 << 0)
116 #define PCH_IEEE1588_CAN        (1 << 1)
117 /**
118  * struct pch_dev - Driver private data
119  */
120 struct pch_dev {
121         struct pch_ts_regs *regs;
122         struct ptp_clock *ptp_clock;
123         struct ptp_clock_info caps;
124         int exts0_enabled;
125         int exts1_enabled;
126
127         u32 mem_base;
128         u32 mem_size;
129         u32 irq;
130         struct pci_dev *pdev;
131         spinlock_t register_lock;
132 };
133
134 /**
135  * struct pch_params - 1588 module parameter
136  */
137 struct pch_params {
138         u8 station[STATION_ADDR_LEN];
139 };
140
141 /* structure to hold the module parameters */
142 static struct pch_params pch_param = {
143         "00:00:00:00:00:00"
144 };
145
146 /*
147  * Register access functions
148  */
149 static inline void pch_eth_enable_set(struct pch_dev *chip)
150 {
151         u32 val;
152         /* SET the eth_enable bit */
153         val = ioread32(&chip->regs->ts_sel) | (PCH_ECS_ETH);
154         iowrite32(val, (&chip->regs->ts_sel));
155 }
156
157 static u64 pch_systime_read(struct pch_ts_regs *regs)
158 {
159         u64 ns;
160         u32 lo, hi;
161
162         lo = ioread32(&regs->systime_lo);
163         hi = ioread32(&regs->systime_hi);
164
165         ns = ((u64) hi) << 32;
166         ns |= lo;
167         ns <<= TICKS_NS_SHIFT;
168
169         return ns;
170 }
171
172 static void pch_systime_write(struct pch_ts_regs *regs, u64 ns)
173 {
174         u32 hi, lo;
175
176         ns >>= TICKS_NS_SHIFT;
177         hi = ns >> 32;
178         lo = ns & 0xffffffff;
179
180         iowrite32(lo, &regs->systime_lo);
181         iowrite32(hi, &regs->systime_hi);
182 }
183
184 static inline void pch_block_reset(struct pch_dev *chip)
185 {
186         u32 val;
187         /* Reset Hardware Assist block */
188         val = ioread32(&chip->regs->control) | PCH_TSC_RESET;
189         iowrite32(val, (&chip->regs->control));
190         val = val & ~PCH_TSC_RESET;
191         iowrite32(val, (&chip->regs->control));
192 }
193
194 u32 pch_ch_control_read(struct pci_dev *pdev)
195 {
196         struct pch_dev *chip = pci_get_drvdata(pdev);
197         u32 val;
198
199         val = ioread32(&chip->regs->ch_control);
200
201         return val;
202 }
203 EXPORT_SYMBOL(pch_ch_control_read);
204
205 void pch_ch_control_write(struct pci_dev *pdev, u32 val)
206 {
207         struct pch_dev *chip = pci_get_drvdata(pdev);
208
209         iowrite32(val, (&chip->regs->ch_control));
210 }
211 EXPORT_SYMBOL(pch_ch_control_write);
212
213 u32 pch_ch_event_read(struct pci_dev *pdev)
214 {
215         struct pch_dev *chip = pci_get_drvdata(pdev);
216         u32 val;
217
218         val = ioread32(&chip->regs->ch_event);
219
220         return val;
221 }
222 EXPORT_SYMBOL(pch_ch_event_read);
223
224 void pch_ch_event_write(struct pci_dev *pdev, u32 val)
225 {
226         struct pch_dev *chip = pci_get_drvdata(pdev);
227
228         iowrite32(val, (&chip->regs->ch_event));
229 }
230 EXPORT_SYMBOL(pch_ch_event_write);
231
232 u32 pch_src_uuid_lo_read(struct pci_dev *pdev)
233 {
234         struct pch_dev *chip = pci_get_drvdata(pdev);
235         u32 val;
236
237         val = ioread32(&chip->regs->src_uuid_lo);
238
239         return val;
240 }
241 EXPORT_SYMBOL(pch_src_uuid_lo_read);
242
243 u32 pch_src_uuid_hi_read(struct pci_dev *pdev)
244 {
245         struct pch_dev *chip = pci_get_drvdata(pdev);
246         u32 val;
247
248         val = ioread32(&chip->regs->src_uuid_hi);
249
250         return val;
251 }
252 EXPORT_SYMBOL(pch_src_uuid_hi_read);
253
254 u64 pch_rx_snap_read(struct pci_dev *pdev)
255 {
256         struct pch_dev *chip = pci_get_drvdata(pdev);
257         u64 ns;
258         u32 lo, hi;
259
260         lo = ioread32(&chip->regs->rx_snap_lo);
261         hi = ioread32(&chip->regs->rx_snap_hi);
262
263         ns = ((u64) hi) << 32;
264         ns |= lo;
265
266         return ns;
267 }
268 EXPORT_SYMBOL(pch_rx_snap_read);
269
270 u64 pch_tx_snap_read(struct pci_dev *pdev)
271 {
272         struct pch_dev *chip = pci_get_drvdata(pdev);
273         u64 ns;
274         u32 lo, hi;
275
276         lo = ioread32(&chip->regs->tx_snap_lo);
277         hi = ioread32(&chip->regs->tx_snap_hi);
278
279         ns = ((u64) hi) << 32;
280         ns |= lo;
281
282         return ns;
283 }
284 EXPORT_SYMBOL(pch_tx_snap_read);
285
286 /* This function enables all 64 bits in system time registers [high & low].
287 This is a work-around for non continuous value in the SystemTime Register*/
288 static void pch_set_system_time_count(struct pch_dev *chip)
289 {
290         iowrite32(0x01, &chip->regs->stl_max_set_en);
291         iowrite32(0xFFFFFFFF, &chip->regs->stl_max_set);
292         iowrite32(0x00, &chip->regs->stl_max_set_en);
293 }
294
295 static void pch_reset(struct pch_dev *chip)
296 {
297         /* Reset Hardware Assist */
298         pch_block_reset(chip);
299
300         /* enable all 32 bits in system time registers */
301         pch_set_system_time_count(chip);
302 }
303
304 /**
305  * pch_set_station_address() - This API sets the station address used by
306  *                                  IEEE 1588 hardware when looking at PTP
307  *                                  traffic on the  ethernet interface
308  * @addr:       dress which contain the column separated address to be used.
309  */
310 static int pch_set_station_address(u8 *addr, struct pci_dev *pdev)
311 {
312         s32 i;
313         struct pch_dev *chip = pci_get_drvdata(pdev);
314
315         /* Verify the parameter */
316         if ((chip->regs == 0) || addr == (u8 *)NULL) {
317                 dev_err(&pdev->dev,
318                         "invalid params returning PCH_INVALIDPARAM\n");
319                 return PCH_INVALIDPARAM;
320         }
321         /* For all station address bytes */
322         for (i = 0; i < PCH_STATION_BYTES; i++) {
323                 u32 val;
324                 s32 tmp;
325
326                 tmp = hex_to_bin(addr[i * 3]);
327                 if (tmp < 0) {
328                         dev_err(&pdev->dev,
329                                 "invalid params returning PCH_INVALIDPARAM\n");
330                         return PCH_INVALIDPARAM;
331                 }
332                 val = tmp * 16;
333                 tmp = hex_to_bin(addr[(i * 3) + 1]);
334                 if (tmp < 0) {
335                         dev_err(&pdev->dev,
336                                 "invalid params returning PCH_INVALIDPARAM\n");
337                         return PCH_INVALIDPARAM;
338                 }
339                 val += tmp;
340                 /* Expects ':' separated addresses */
341                 if ((i < 5) && (addr[(i * 3) + 2] != ':')) {
342                         dev_err(&pdev->dev,
343                                 "invalid params returning PCH_INVALIDPARAM\n");
344                         return PCH_INVALIDPARAM;
345                 }
346
347                 /* Ideally we should set the address only after validating
348                                                          entire string */
349                 dev_dbg(&pdev->dev, "invoking pch_station_set\n");
350                 iowrite32(val, &chip->regs->ts_st[i]);
351         }
352         return 0;
353 }
354
355 /*
356  * Interrupt service routine
357  */
358 static irqreturn_t isr(int irq, void *priv)
359 {
360         struct pch_dev *pch_dev = priv;
361         struct pch_ts_regs *regs = pch_dev->regs;
362         struct ptp_clock_event event;
363         u32 ack = 0, lo, hi, val;
364
365         val = ioread32(&regs->event);
366
367         if (val & PCH_TSE_SNS) {
368                 ack |= PCH_TSE_SNS;
369                 if (pch_dev->exts0_enabled) {
370                         hi = ioread32(&regs->asms_hi);
371                         lo = ioread32(&regs->asms_lo);
372                         event.type = PTP_CLOCK_EXTTS;
373                         event.index = 0;
374                         event.timestamp = ((u64) hi) << 32;
375                         event.timestamp |= lo;
376                         event.timestamp <<= TICKS_NS_SHIFT;
377                         ptp_clock_event(pch_dev->ptp_clock, &event);
378                 }
379         }
380
381         if (val & PCH_TSE_SNM) {
382                 ack |= PCH_TSE_SNM;
383                 if (pch_dev->exts1_enabled) {
384                         hi = ioread32(&regs->amms_hi);
385                         lo = ioread32(&regs->amms_lo);
386                         event.type = PTP_CLOCK_EXTTS;
387                         event.index = 1;
388                         event.timestamp = ((u64) hi) << 32;
389                         event.timestamp |= lo;
390                         event.timestamp <<= TICKS_NS_SHIFT;
391                         ptp_clock_event(pch_dev->ptp_clock, &event);
392                 }
393         }
394
395         if (val & PCH_TSE_TTIPEND)
396                 ack |= PCH_TSE_TTIPEND; /* this bit seems to be always set */
397
398         if (ack) {
399                 iowrite32(ack, &regs->event);
400                 return IRQ_HANDLED;
401         } else
402                 return IRQ_NONE;
403 }
404
405 /*
406  * PTP clock operations
407  */
408
409 static int ptp_pch_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
410 {
411         u64 adj;
412         u32 diff, addend;
413         int neg_adj = 0;
414         struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
415         struct pch_ts_regs *regs = pch_dev->regs;
416
417         if (ppb < 0) {
418                 neg_adj = 1;
419                 ppb = -ppb;
420         }
421         addend = DEFAULT_ADDEND;
422         adj = addend;
423         adj *= ppb;
424         diff = div_u64(adj, 1000000000ULL);
425
426         addend = neg_adj ? addend - diff : addend + diff;
427
428         iowrite32(addend, &regs->addend);
429
430         return 0;
431 }
432
433 static int ptp_pch_adjtime(struct ptp_clock_info *ptp, s64 delta)
434 {
435         s64 now;
436         unsigned long flags;
437         struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
438         struct pch_ts_regs *regs = pch_dev->regs;
439
440         spin_lock_irqsave(&pch_dev->register_lock, flags);
441         now = pch_systime_read(regs);
442         now += delta;
443         pch_systime_write(regs, now);
444         spin_unlock_irqrestore(&pch_dev->register_lock, flags);
445
446         return 0;
447 }
448
449 static int ptp_pch_gettime(struct ptp_clock_info *ptp, struct timespec *ts)
450 {
451         u64 ns;
452         u32 remainder;
453         unsigned long flags;
454         struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
455         struct pch_ts_regs *regs = pch_dev->regs;
456
457         spin_lock_irqsave(&pch_dev->register_lock, flags);
458         ns = pch_systime_read(regs);
459         spin_unlock_irqrestore(&pch_dev->register_lock, flags);
460
461         ts->tv_sec = div_u64_rem(ns, 1000000000, &remainder);
462         ts->tv_nsec = remainder;
463         return 0;
464 }
465
466 static int ptp_pch_settime(struct ptp_clock_info *ptp,
467                            const struct timespec *ts)
468 {
469         u64 ns;
470         unsigned long flags;
471         struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
472         struct pch_ts_regs *regs = pch_dev->regs;
473
474         ns = ts->tv_sec * 1000000000ULL;
475         ns += ts->tv_nsec;
476
477         spin_lock_irqsave(&pch_dev->register_lock, flags);
478         pch_systime_write(regs, ns);
479         spin_unlock_irqrestore(&pch_dev->register_lock, flags);
480
481         return 0;
482 }
483
484 static int ptp_pch_enable(struct ptp_clock_info *ptp,
485                           struct ptp_clock_request *rq, int on)
486 {
487         struct pch_dev *pch_dev = container_of(ptp, struct pch_dev, caps);
488
489         switch (rq->type) {
490         case PTP_CLK_REQ_EXTTS:
491                 switch (rq->extts.index) {
492                 case 0:
493                         pch_dev->exts0_enabled = on ? 1 : 0;
494                         break;
495                 case 1:
496                         pch_dev->exts1_enabled = on ? 1 : 0;
497                         break;
498                 default:
499                         return -EINVAL;
500                 }
501                 return 0;
502         default:
503                 break;
504         }
505
506         return -EOPNOTSUPP;
507 }
508
509 static struct ptp_clock_info ptp_pch_caps = {
510         .owner          = THIS_MODULE,
511         .name           = "PCH timer",
512         .max_adj        = 50000000,
513         .n_ext_ts       = N_EXT_TS,
514         .pps            = 0,
515         .adjfreq        = ptp_pch_adjfreq,
516         .adjtime        = ptp_pch_adjtime,
517         .gettime        = ptp_pch_gettime,
518         .settime        = ptp_pch_settime,
519         .enable         = ptp_pch_enable,
520 };
521
522
523 #ifdef CONFIG_PM
524 static s32 pch_suspend(struct pci_dev *pdev, pm_message_t state)
525 {
526         pci_disable_device(pdev);
527         pci_enable_wake(pdev, PCI_D3hot, 0);
528
529         if (pci_save_state(pdev) != 0) {
530                 dev_err(&pdev->dev, "could not save PCI config state\n");
531                 return -ENOMEM;
532         }
533         pci_set_power_state(pdev, pci_choose_state(pdev, state));
534
535         return 0;
536 }
537
538 static s32 pch_resume(struct pci_dev *pdev)
539 {
540         s32 ret;
541
542         pci_set_power_state(pdev, PCI_D0);
543         pci_restore_state(pdev);
544         ret = pci_enable_device(pdev);
545         if (ret) {
546                 dev_err(&pdev->dev, "pci_enable_device failed\n");
547                 return ret;
548         }
549         pci_enable_wake(pdev, PCI_D3hot, 0);
550         return 0;
551 }
552 #else
553 #define pch_suspend NULL
554 #define pch_resume NULL
555 #endif
556
557 static void __devexit pch_remove(struct pci_dev *pdev)
558 {
559         struct pch_dev *chip = pci_get_drvdata(pdev);
560
561         ptp_clock_unregister(chip->ptp_clock);
562         /* free the interrupt */
563         if (pdev->irq != 0)
564                 free_irq(pdev->irq, chip);
565
566         /* unmap the virtual IO memory space */
567         if (chip->regs != 0) {
568                 iounmap(chip->regs);
569                 chip->regs = 0;
570         }
571         /* release the reserved IO memory space */
572         if (chip->mem_base != 0) {
573                 release_mem_region(chip->mem_base, chip->mem_size);
574                 chip->mem_base = 0;
575         }
576         pci_disable_device(pdev);
577         kfree(chip);
578         dev_info(&pdev->dev, "complete\n");
579 }
580
581 static s32 __devinit
582 pch_probe(struct pci_dev *pdev, const struct pci_device_id *id)
583 {
584         s32 ret;
585         unsigned long flags;
586         struct pch_dev *chip;
587
588         chip = kzalloc(sizeof(struct pch_dev), GFP_KERNEL);
589         if (chip == NULL)
590                 return -ENOMEM;
591
592         /* enable the 1588 pci device */
593         ret = pci_enable_device(pdev);
594         if (ret != 0) {
595                 dev_err(&pdev->dev, "could not enable the pci device\n");
596                 goto err_pci_en;
597         }
598
599         chip->mem_base = pci_resource_start(pdev, IO_MEM_BAR);
600         if (!chip->mem_base) {
601                 dev_err(&pdev->dev, "could not locate IO memory address\n");
602                 ret = -ENODEV;
603                 goto err_pci_start;
604         }
605
606         /* retrieve the available length of the IO memory space */
607         chip->mem_size = pci_resource_len(pdev, IO_MEM_BAR);
608
609         /* allocate the memory for the device registers */
610         if (!request_mem_region(chip->mem_base, chip->mem_size, "1588_regs")) {
611                 dev_err(&pdev->dev,
612                         "could not allocate register memory space\n");
613                 ret = -EBUSY;
614                 goto err_req_mem_region;
615         }
616
617         /* get the virtual address to the 1588 registers */
618         chip->regs = ioremap(chip->mem_base, chip->mem_size);
619
620         if (!chip->regs) {
621                 dev_err(&pdev->dev, "Could not get virtual address\n");
622                 ret = -ENOMEM;
623                 goto err_ioremap;
624         }
625
626         chip->caps = ptp_pch_caps;
627         chip->ptp_clock = ptp_clock_register(&chip->caps);
628
629         if (IS_ERR(chip->ptp_clock))
630                 return PTR_ERR(chip->ptp_clock);
631
632         spin_lock_init(&chip->register_lock);
633
634         ret = request_irq(pdev->irq, &isr, IRQF_SHARED, KBUILD_MODNAME, chip);
635         if (ret != 0) {
636                 dev_err(&pdev->dev, "failed to get irq %d\n", pdev->irq);
637                 goto err_req_irq;
638         }
639
640         /* indicate success */
641         chip->irq = pdev->irq;
642         chip->pdev = pdev;
643         pci_set_drvdata(pdev, chip);
644
645         spin_lock_irqsave(&chip->register_lock, flags);
646         /* reset the ieee1588 h/w */
647         pch_reset(chip);
648
649         iowrite32(DEFAULT_ADDEND, &chip->regs->addend);
650         iowrite32(1, &chip->regs->trgt_lo);
651         iowrite32(0, &chip->regs->trgt_hi);
652         iowrite32(PCH_TSE_TTIPEND, &chip->regs->event);
653         /* Version: IEEE1588 v1 and IEEE1588-2008,  Mode: All Evwnt, Locked  */
654         iowrite32(0x80020000, &chip->regs->ch_control);
655
656         pch_eth_enable_set(chip);
657
658         if (strcmp(pch_param.station, "00:00:00:00:00:00") != 0) {
659                 if (pch_set_station_address(pch_param.station, pdev) != 0) {
660                         dev_err(&pdev->dev,
661                         "Invalid station address parameter\n"
662                         "Module loaded but station address not set correctly\n"
663                         );
664                 }
665         }
666         spin_unlock_irqrestore(&chip->register_lock, flags);
667         return 0;
668
669 err_req_irq:
670         ptp_clock_unregister(chip->ptp_clock);
671         iounmap(chip->regs);
672         chip->regs = 0;
673
674 err_ioremap:
675         release_mem_region(chip->mem_base, chip->mem_size);
676
677 err_req_mem_region:
678         chip->mem_base = 0;
679
680 err_pci_start:
681         pci_disable_device(pdev);
682
683 err_pci_en:
684         kfree(chip);
685         dev_err(&pdev->dev, "probe failed(ret=0x%x)\n", ret);
686
687         return ret;
688 }
689
690 static DEFINE_PCI_DEVICE_TABLE(pch_ieee1588_pcidev_id) = {
691         {
692           .vendor = PCI_VENDOR_ID_INTEL,
693           .device = PCI_DEVICE_ID_PCH_1588
694          },
695         {0}
696 };
697
698 static struct pci_driver pch_driver = {
699         .name = KBUILD_MODNAME,
700         .id_table = pch_ieee1588_pcidev_id,
701         .probe = pch_probe,
702         .remove = pch_remove,
703         .suspend = pch_suspend,
704         .resume = pch_resume,
705 };
706
707 static void __exit ptp_pch_exit(void)
708 {
709         pci_unregister_driver(&pch_driver);
710 }
711
712 static s32 __init ptp_pch_init(void)
713 {
714         s32 ret;
715
716         /* register the driver with the pci core */
717         ret = pci_register_driver(&pch_driver);
718
719         return ret;
720 }
721
722 module_init(ptp_pch_init);
723 module_exit(ptp_pch_exit);
724
725 module_param_string(station, pch_param.station, sizeof pch_param.station, 0444);
726 MODULE_PARM_DESC(station,
727          "IEEE 1588 station address to use - column separated hex values");
728
729 MODULE_AUTHOR("LAPIS SEMICONDUCTOR, <tshimizu818@gmail.com>");
730 MODULE_DESCRIPTION("PTP clock using the EG20T timer");
731 MODULE_LICENSE("GPL");