1212#include <linux/serial.h>
1313#include <linux/io.h>
1414#include <linux/serial_sci.h>
15+ #include <linux/sh_timer.h>
16+
17+ static struct sh_timer_config tmu0_platform_data = {
18+ .name = "TMU0" ,
19+ .channel_offset = 0x04 ,
20+ .timer_bit = 0 ,
21+ .clk = "module_clk" ,
22+ .clockevent_rating = 200 ,
23+ };
24+
25+ static struct resource tmu0_resources [] = {
26+ [0 ] = {
27+ .name = "TMU0" ,
28+ .start = 0xffd80008 ,
29+ .end = 0xffd80013 ,
30+ .flags = IORESOURCE_MEM ,
31+ },
32+ [1 ] = {
33+ .start = 28 ,
34+ .flags = IORESOURCE_IRQ ,
35+ },
36+ };
37+
38+ static struct platform_device tmu0_device = {
39+ .name = "sh_tmu" ,
40+ .id = 0 ,
41+ .dev = {
42+ .platform_data = & tmu0_platform_data ,
43+ },
44+ .resource = tmu0_resources ,
45+ .num_resources = ARRAY_SIZE (tmu0_resources ),
46+ };
47+
48+ static struct sh_timer_config tmu1_platform_data = {
49+ .name = "TMU1" ,
50+ .channel_offset = 0x10 ,
51+ .timer_bit = 1 ,
52+ .clk = "module_clk" ,
53+ .clocksource_rating = 200 ,
54+ };
55+
56+ static struct resource tmu1_resources [] = {
57+ [0 ] = {
58+ .name = "TMU1" ,
59+ .start = 0xffd80014 ,
60+ .end = 0xffd8001f ,
61+ .flags = IORESOURCE_MEM ,
62+ },
63+ [1 ] = {
64+ .start = 29 ,
65+ .flags = IORESOURCE_IRQ ,
66+ },
67+ };
68+
69+ static struct platform_device tmu1_device = {
70+ .name = "sh_tmu" ,
71+ .id = 1 ,
72+ .dev = {
73+ .platform_data = & tmu1_platform_data ,
74+ },
75+ .resource = tmu1_resources ,
76+ .num_resources = ARRAY_SIZE (tmu1_resources ),
77+ };
78+
79+ static struct sh_timer_config tmu2_platform_data = {
80+ .name = "TMU2" ,
81+ .channel_offset = 0x1c ,
82+ .timer_bit = 2 ,
83+ .clk = "module_clk" ,
84+ };
85+
86+ static struct resource tmu2_resources [] = {
87+ [0 ] = {
88+ .name = "TMU2" ,
89+ .start = 0xffd80020 ,
90+ .end = 0xffd8002f ,
91+ .flags = IORESOURCE_MEM ,
92+ },
93+ [1 ] = {
94+ .start = 30 ,
95+ .flags = IORESOURCE_IRQ ,
96+ },
97+ };
98+
99+ static struct platform_device tmu2_device = {
100+ .name = "sh_tmu" ,
101+ .id = 2 ,
102+ .dev = {
103+ .platform_data = & tmu2_platform_data ,
104+ },
105+ .resource = tmu2_resources ,
106+ .num_resources = ARRAY_SIZE (tmu2_resources ),
107+ };
108+
109+ static struct sh_timer_config tmu3_platform_data = {
110+ .name = "TMU3" ,
111+ .channel_offset = 0x04 ,
112+ .timer_bit = 0 ,
113+ .clk = "module_clk" ,
114+ };
115+
116+ static struct resource tmu3_resources [] = {
117+ [0 ] = {
118+ .name = "TMU3" ,
119+ .start = 0xffdc0008 ,
120+ .end = 0xffdc0013 ,
121+ .flags = IORESOURCE_MEM ,
122+ },
123+ [1 ] = {
124+ .start = 96 ,
125+ .flags = IORESOURCE_IRQ ,
126+ },
127+ };
128+
129+ static struct platform_device tmu3_device = {
130+ .name = "sh_tmu" ,
131+ .id = 3 ,
132+ .dev = {
133+ .platform_data = & tmu3_platform_data ,
134+ },
135+ .resource = tmu3_resources ,
136+ .num_resources = ARRAY_SIZE (tmu3_resources ),
137+ };
138+
139+ static struct sh_timer_config tmu4_platform_data = {
140+ .name = "TMU4" ,
141+ .channel_offset = 0x10 ,
142+ .timer_bit = 1 ,
143+ .clk = "module_clk" ,
144+ };
145+
146+ static struct resource tmu4_resources [] = {
147+ [0 ] = {
148+ .name = "TMU4" ,
149+ .start = 0xffdc0014 ,
150+ .end = 0xffdc001f ,
151+ .flags = IORESOURCE_MEM ,
152+ },
153+ [1 ] = {
154+ .start = 97 ,
155+ .flags = IORESOURCE_IRQ ,
156+ },
157+ };
158+
159+ static struct platform_device tmu4_device = {
160+ .name = "sh_tmu" ,
161+ .id = 4 ,
162+ .dev = {
163+ .platform_data = & tmu4_platform_data ,
164+ },
165+ .resource = tmu4_resources ,
166+ .num_resources = ARRAY_SIZE (tmu4_resources ),
167+ };
168+
169+ static struct sh_timer_config tmu5_platform_data = {
170+ .name = "TMU5" ,
171+ .channel_offset = 0x1c ,
172+ .timer_bit = 2 ,
173+ .clk = "module_clk" ,
174+ };
175+
176+ static struct resource tmu5_resources [] = {
177+ [0 ] = {
178+ .name = "TMU5" ,
179+ .start = 0xffdc0020 ,
180+ .end = 0xffdc002b ,
181+ .flags = IORESOURCE_MEM ,
182+ },
183+ [1 ] = {
184+ .start = 98 ,
185+ .flags = IORESOURCE_IRQ ,
186+ },
187+ };
188+
189+ static struct platform_device tmu5_device = {
190+ .name = "sh_tmu" ,
191+ .id = 5 ,
192+ .dev = {
193+ .platform_data = & tmu5_platform_data ,
194+ },
195+ .resource = tmu5_resources ,
196+ .num_resources = ARRAY_SIZE (tmu5_resources ),
197+ };
15198
16199static struct resource rtc_resources [] = {
17200 [0 ] = {
@@ -58,6 +241,12 @@ static struct platform_device sci_device = {
58241};
59242
60243static struct platform_device * sh7780_devices [] __initdata = {
244+ & tmu0_device ,
245+ & tmu1_device ,
246+ & tmu2_device ,
247+ & tmu3_device ,
248+ & tmu4_device ,
249+ & tmu5_device ,
61250 & rtc_device ,
62251 & sci_device ,
63252};
@@ -69,6 +258,21 @@ static int __init sh7780_devices_setup(void)
69258}
70259__initcall (sh7780_devices_setup );
71260
261+ static struct platform_device * sh7780_early_devices [] __initdata = {
262+ & tmu0_device ,
263+ & tmu1_device ,
264+ & tmu2_device ,
265+ & tmu3_device ,
266+ & tmu4_device ,
267+ & tmu5_device ,
268+ };
269+
270+ void __init plat_early_device_setup (void )
271+ {
272+ early_platform_add_devices (sh7780_early_devices ,
273+ ARRAY_SIZE (sh7780_early_devices ));
274+ }
275+
72276enum {
73277 UNUSED = 0 ,
74278
0 commit comments