This source file includes following definitions.
- n30_sdi_set_power
- n30_hwinit
- n30_map_io
- n30_init_time
- n30_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <linux/kernel.h>
15 #include <linux/types.h>
16
17 #include <linux/gpio_keys.h>
18 #include <linux/init.h>
19 #include <linux/gpio.h>
20 #include <linux/gpio/machine.h>
21 #include <linux/input.h>
22 #include <linux/interrupt.h>
23 #include <linux/platform_device.h>
24 #include <linux/serial_core.h>
25 #include <linux/serial_s3c.h>
26 #include <linux/timer.h>
27 #include <linux/io.h>
28 #include <linux/mmc/host.h>
29
30 #include <mach/hardware.h>
31 #include <asm/irq.h>
32 #include <asm/mach-types.h>
33
34 #include <mach/fb.h>
35 #include <linux/platform_data/leds-s3c24xx.h>
36 #include <mach/regs-gpio.h>
37 #include <mach/regs-lcd.h>
38 #include <mach/gpio-samsung.h>
39
40 #include <asm/mach/arch.h>
41 #include <asm/mach/irq.h>
42 #include <asm/mach/map.h>
43
44 #include <linux/platform_data/i2c-s3c2410.h>
45
46 #include <plat/cpu.h>
47 #include <plat/devs.h>
48 #include <linux/platform_data/mmc-s3cmci.h>
49 #include <linux/platform_data/usb-s3c2410_udc.h>
50 #include <plat/samsung-time.h>
51
52 #include "common.h"
53
54 static struct map_desc n30_iodesc[] __initdata = {
55
56 };
57
58 static struct s3c2410_uartcfg n30_uartcfgs[] = {
59
60 [0] = {
61 .hwport = 0,
62 .flags = 0,
63 .ucon = 0x2c5,
64 .ulcon = 0x03,
65 .ufcon = 0x51,
66 },
67
68 [1] = {
69 .hwport = 1,
70 .flags = 0,
71 .uart_flags = UPF_CONS_FLOW,
72 .ucon = 0x2c5,
73 .ulcon = 0x43,
74 .ufcon = 0x51,
75 },
76
77
78 [2] = {
79 .hwport = 2,
80 .flags = 0,
81 .ucon = 0x2c5,
82 .ulcon = 0x03,
83 .ufcon = 0x51,
84 },
85 };
86
87 static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
88 .vbus_pin = S3C2410_GPG(1),
89 .vbus_pin_inverted = 0,
90 .pullup_pin = S3C2410_GPB(3),
91 };
92
93 static struct gpio_keys_button n30_buttons[] = {
94 {
95 .gpio = S3C2410_GPF(0),
96 .code = KEY_POWER,
97 .desc = "Power",
98 .active_low = 0,
99 },
100 {
101 .gpio = S3C2410_GPG(9),
102 .code = KEY_UP,
103 .desc = "Thumbwheel Up",
104 .active_low = 0,
105 },
106 {
107 .gpio = S3C2410_GPG(8),
108 .code = KEY_DOWN,
109 .desc = "Thumbwheel Down",
110 .active_low = 0,
111 },
112 {
113 .gpio = S3C2410_GPG(7),
114 .code = KEY_ENTER,
115 .desc = "Thumbwheel Press",
116 .active_low = 0,
117 },
118 {
119 .gpio = S3C2410_GPF(7),
120 .code = KEY_HOMEPAGE,
121 .desc = "Home",
122 .active_low = 0,
123 },
124 {
125 .gpio = S3C2410_GPF(6),
126 .code = KEY_CALENDAR,
127 .desc = "Calendar",
128 .active_low = 0,
129 },
130 {
131 .gpio = S3C2410_GPF(5),
132 .code = KEY_ADDRESSBOOK,
133 .desc = "Contacts",
134 .active_low = 0,
135 },
136 {
137 .gpio = S3C2410_GPF(4),
138 .code = KEY_MAIL,
139 .desc = "Mail",
140 .active_low = 0,
141 },
142 };
143
144 static struct gpio_keys_platform_data n30_button_data = {
145 .buttons = n30_buttons,
146 .nbuttons = ARRAY_SIZE(n30_buttons),
147 };
148
149 static struct platform_device n30_button_device = {
150 .name = "gpio-keys",
151 .id = -1,
152 .dev = {
153 .platform_data = &n30_button_data,
154 }
155 };
156
157 static struct gpio_keys_button n35_buttons[] = {
158 {
159 .gpio = S3C2410_GPF(0),
160 .code = KEY_POWER,
161 .type = EV_PWR,
162 .desc = "Power",
163 .active_low = 0,
164 .wakeup = 1,
165 },
166 {
167 .gpio = S3C2410_GPG(9),
168 .code = KEY_UP,
169 .desc = "Joystick Up",
170 .active_low = 0,
171 },
172 {
173 .gpio = S3C2410_GPG(8),
174 .code = KEY_DOWN,
175 .desc = "Joystick Down",
176 .active_low = 0,
177 },
178 {
179 .gpio = S3C2410_GPG(6),
180 .code = KEY_DOWN,
181 .desc = "Joystick Left",
182 .active_low = 0,
183 },
184 {
185 .gpio = S3C2410_GPG(5),
186 .code = KEY_DOWN,
187 .desc = "Joystick Right",
188 .active_low = 0,
189 },
190 {
191 .gpio = S3C2410_GPG(7),
192 .code = KEY_ENTER,
193 .desc = "Joystick Press",
194 .active_low = 0,
195 },
196 {
197 .gpio = S3C2410_GPF(7),
198 .code = KEY_HOMEPAGE,
199 .desc = "Home",
200 .active_low = 0,
201 },
202 {
203 .gpio = S3C2410_GPF(6),
204 .code = KEY_CALENDAR,
205 .desc = "Calendar",
206 .active_low = 0,
207 },
208 {
209 .gpio = S3C2410_GPF(5),
210 .code = KEY_ADDRESSBOOK,
211 .desc = "Contacts",
212 .active_low = 0,
213 },
214 {
215 .gpio = S3C2410_GPF(4),
216 .code = KEY_MAIL,
217 .desc = "Mail",
218 .active_low = 0,
219 },
220 {
221 .gpio = S3C2410_GPF(3),
222 .code = SW_RADIO,
223 .desc = "GPS Antenna",
224 .active_low = 0,
225 },
226 {
227 .gpio = S3C2410_GPG(2),
228 .code = SW_HEADPHONE_INSERT,
229 .desc = "Headphone",
230 .active_low = 0,
231 },
232 };
233
234 static struct gpio_keys_platform_data n35_button_data = {
235 .buttons = n35_buttons,
236 .nbuttons = ARRAY_SIZE(n35_buttons),
237 };
238
239 static struct platform_device n35_button_device = {
240 .name = "gpio-keys",
241 .id = -1,
242 .num_resources = 0,
243 .dev = {
244 .platform_data = &n35_button_data,
245 }
246 };
247
248
249 static struct s3c24xx_led_platdata n30_blue_led_pdata = {
250 .name = "blue_led",
251 .gpio = S3C2410_GPG(6),
252 .def_trigger = "",
253 };
254
255
256
257 static struct s3c24xx_led_platdata n35_blue_led_pdata = {
258 .name = "blue_led",
259 .gpio = S3C2410_GPD(8),
260 .def_trigger = "",
261 };
262
263
264
265
266
267 static struct s3c24xx_led_platdata n30_warning_led_pdata = {
268 .name = "warning_led",
269 .flags = S3C24XX_LEDF_ACTLOW,
270 .gpio = S3C2410_GPD(9),
271 .def_trigger = "",
272 };
273
274 static struct s3c24xx_led_platdata n35_warning_led_pdata = {
275 .name = "warning_led",
276 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
277 .gpio = S3C2410_GPD(9),
278 .def_trigger = "",
279 };
280
281 static struct platform_device n30_blue_led = {
282 .name = "s3c24xx_led",
283 .id = 1,
284 .dev = {
285 .platform_data = &n30_blue_led_pdata,
286 },
287 };
288
289 static struct platform_device n35_blue_led = {
290 .name = "s3c24xx_led",
291 .id = 1,
292 .dev = {
293 .platform_data = &n35_blue_led_pdata,
294 },
295 };
296
297 static struct platform_device n30_warning_led = {
298 .name = "s3c24xx_led",
299 .id = 2,
300 .dev = {
301 .platform_data = &n30_warning_led_pdata,
302 },
303 };
304
305 static struct platform_device n35_warning_led = {
306 .name = "s3c24xx_led",
307 .id = 2,
308 .dev = {
309 .platform_data = &n35_warning_led_pdata,
310 },
311 };
312
313 static struct s3c2410fb_display n30_display __initdata = {
314 .type = S3C2410_LCDCON1_TFT,
315 .width = 240,
316 .height = 320,
317 .pixclock = 170000,
318
319 .xres = 240,
320 .yres = 320,
321 .bpp = 16,
322 .left_margin = 3,
323 .right_margin = 40,
324 .hsync_len = 40,
325 .upper_margin = 2,
326 .lower_margin = 3,
327 .vsync_len = 2,
328
329 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
330 };
331
332 static struct s3c2410fb_mach_info n30_fb_info __initdata = {
333 .displays = &n30_display,
334 .num_displays = 1,
335 .default_display = 0,
336 .lpcsel = 0x06,
337 };
338
339 static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
340 {
341 switch (power_mode) {
342 case MMC_POWER_ON:
343 case MMC_POWER_UP:
344 gpio_set_value(S3C2410_GPG(4), 1);
345 break;
346 case MMC_POWER_OFF:
347 default:
348 gpio_set_value(S3C2410_GPG(4), 0);
349 break;
350 }
351 }
352
353 static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
354 .ocr_avail = MMC_VDD_32_33,
355 .set_power = n30_sdi_set_power,
356 };
357
358 static struct gpiod_lookup_table n30_mci_gpio_table = {
359 .dev_id = "s3c2410-sdi",
360 .table = {
361
362 GPIO_LOOKUP("GPF", 1, "cd", GPIO_ACTIVE_LOW),
363
364 GPIO_LOOKUP("GPG", 10, "wp", GPIO_ACTIVE_LOW),
365 { },
366 },
367 };
368
369 static struct platform_device *n30_devices[] __initdata = {
370 &s3c_device_lcd,
371 &s3c_device_wdt,
372 &s3c_device_i2c0,
373 &s3c_device_iis,
374 &s3c_device_ohci,
375 &s3c_device_rtc,
376 &s3c_device_usbgadget,
377 &s3c_device_sdi,
378 &n30_button_device,
379 &n30_blue_led,
380 &n30_warning_led,
381 };
382
383 static struct platform_device *n35_devices[] __initdata = {
384 &s3c_device_lcd,
385 &s3c_device_wdt,
386 &s3c_device_i2c0,
387 &s3c_device_iis,
388 &s3c_device_rtc,
389 &s3c_device_usbgadget,
390 &s3c_device_sdi,
391 &n35_button_device,
392 &n35_blue_led,
393 &n35_warning_led,
394 };
395
396 static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
397 .flags = 0,
398 .slave_addr = 0x10,
399 .frequency = 10*1000,
400 };
401
402
403
404 static void __init n30_hwinit(void)
405 {
406
407
408
409
410
411
412
413
414 if (machine_is_n30())
415 __raw_writel(0x007fffff, S3C2410_GPACON);
416 if (machine_is_n35())
417 __raw_writel(0x007fefff, S3C2410_GPACON);
418 __raw_writel(0x00000000, S3C2410_GPADAT);
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433 __raw_writel(0x00154556, S3C2410_GPBCON);
434 __raw_writel(0x00000750, S3C2410_GPBDAT);
435 __raw_writel(0x00000073, S3C2410_GPBUP);
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452 __raw_writel(0xaaa80618, S3C2410_GPCCON);
453 __raw_writel(0x0000014c, S3C2410_GPCDAT);
454 __raw_writel(0x0000fef2, S3C2410_GPCUP);
455
456
457
458
459
460
461
462
463
464 __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
465 __raw_writel(0x00000601, S3C2410_GPDDAT);
466 __raw_writel(0x0000fbfe, S3C2410_GPDUP);
467
468
469
470
471
472
473 __raw_writel(0xa56aaaaa, S3C2410_GPECON);
474 __raw_writel(0x0000efc5, S3C2410_GPEDAT);
475 __raw_writel(0x0000f81f, S3C2410_GPEUP);
476
477
478
479
480
481
482
483
484
485
486
487
488 __raw_writel(0x0000aaaa, S3C2410_GPFCON);
489 __raw_writel(0x00000000, S3C2410_GPFDAT);
490 __raw_writel(0x000000ff, S3C2410_GPFUP);
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515 if (machine_is_n30())
516 __raw_writel(0xff0a956a, S3C2410_GPGCON);
517 if (machine_is_n35())
518 __raw_writel(0xff4aa92a, S3C2410_GPGCON);
519 __raw_writel(0x0000e800, S3C2410_GPGDAT);
520 __raw_writel(0x0000f86f, S3C2410_GPGUP);
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535 __raw_writel(0x0028aaaa, S3C2410_GPHCON);
536 __raw_writel(0x000005ef, S3C2410_GPHDAT);
537 __raw_writel(0x0000063f, S3C2410_GPHUP);
538 }
539
540 static void __init n30_map_io(void)
541 {
542 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
543 n30_hwinit();
544 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
545 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
546 }
547
548 static void __init n30_init_time(void)
549 {
550 s3c2410_init_clocks(12000000);
551 samsung_timer_init();
552 }
553
554
555
556 static void __init n30_init(void)
557 {
558 WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
559
560 s3c24xx_fb_set_platdata(&n30_fb_info);
561 s3c24xx_udc_set_platdata(&n30_udc_cfg);
562 gpiod_add_lookup_table(&n30_mci_gpio_table);
563 s3c24xx_mci_set_platdata(&n30_mci_cfg);
564 s3c_i2c0_set_platdata(&n30_i2ccfg);
565
566
567
568
569 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
570 S3C2410_MISCCR_USBSUSPND0 |
571 S3C2410_MISCCR_USBSUSPND1, 0x0);
572
573 if (machine_is_n30()) {
574
575
576 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
577 S3C2410_MISCCR_USBSUSPND0 |
578 S3C2410_MISCCR_USBSUSPND1, 0x0);
579
580 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
581 }
582
583 if (machine_is_n35()) {
584
585
586
587
588
589
590
591
592 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
593 S3C2410_MISCCR_USBSUSPND0 |
594 S3C2410_MISCCR_USBSUSPND1,
595 S3C2410_MISCCR_USBSUSPND0);
596
597 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
598 }
599 }
600
601 MACHINE_START(N30, "Acer-N30")
602
603
604
605 .atag_offset = 0x100,
606 .init_time = n30_init_time,
607 .init_machine = n30_init,
608 .init_irq = s3c2410_init_irq,
609 .map_io = n30_map_io,
610 MACHINE_END
611
612 MACHINE_START(N35, "Acer-N35")
613
614
615 .atag_offset = 0x100,
616 .init_time = n30_init_time,
617 .init_machine = n30_init,
618 .init_irq = s3c2410_init_irq,
619 .map_io = n30_map_io,
620 MACHINE_END