1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
| -
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
!
-
|
!
-
-
|
|
|
!
-
|
|
|
!
!
-
|
!
-
|
|
!
-
|
|
!
-
|
|
|
|
|
-
|
!
!
-
|
!
-
|
|
|
-
|
|
|
|
!
|
!
|
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <asm/hpet.h>
#include <linux/i8253.h>
#include <linux/i8253_ref.h>
#if (!defined(PIT_CH1))
#define PIT_CH1 (PIT_CH0 + 1)
#endif
static struct resource i8253_ref_ports[] = {
{ .name = I8253_REF_RESOURCE_REFRESH_COUNTER,
.start = PIT_CH1,
.end = PIT_CH1,
.flags = IORESOURCE_IO,
},
{ .name = I8253_REF_RESOURCE_CONTROL_WORD,
.start = PIT_MODE,
.end = PIT_MODE,
.flags = IORESOURCE_IO,
},
};
static struct i8253_ref_platfrom_data i8253_ref_ch1 = {
.channel = 1,
.rate_default = I8253_REF_RATE_DEFAULT_KEEP,
};
static struct platform_device i8253_ref_platform_device = {
.name = I8253_REF_DEVICE_NAME,
.id = PLATFORM_DEVID_AUTO,
.id_auto = true,
.num_resources = ARRAY_SIZE(i8253_ref_ports),
.resource = i8253_ref_ports,
.dev = {
.platform_data = &i8253_ref_ch1,
},
};
static int __init i8253_ref_device_initcall(void)
{ int ret;
ret = platform_device_register(&i8253_ref_platform_device);
if (ret != 0) {
pr_err("%s: Can not register platform %s device. "
"ret=%d\n",
__func__, I8253_REF_DEVICE_NAME, ret
);
}
return ret;
}
arch_initcall(i8253_ref_device_initcall);
|