]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* linux/arch/arm/mach-s3c2410/mach-n30.c |
2 | * | |
3 | * Copyright (c) 2003-2005 Simtec Electronics | |
4 | * Ben Dooks <ben@simtec.co.uk> | |
5 | * | |
6 | * Copyright (c) 2005 Christer Weinigel <christer@weinigel.se> | |
7 | * | |
8 | * There is a wiki with more information about the n30 port at | |
9 | * http://handhelds.org/moin/moin.cgi/AcerN30Documentation . | |
10 | * | |
11 | * This program is free software; you can redistribute it and/or modify | |
12 | * it under the terms of the GNU General Public License version 2 as | |
13 | * published by the Free Software Foundation. | |
14 | */ | |
15 | ||
16 | #include <linux/kernel.h> | |
17 | #include <linux/types.h> | |
18 | #include <linux/interrupt.h> | |
19 | #include <linux/list.h> | |
20 | #include <linux/timer.h> | |
21 | #include <linux/init.h> | |
22 | #include <linux/delay.h> | |
23 | #include <linux/device.h> | |
24 | #include <linux/kthread.h> | |
25 | ||
26 | #include <asm/mach/arch.h> | |
27 | #include <asm/mach/map.h> | |
28 | #include <asm/mach/irq.h> | |
29 | ||
30 | #include <asm/hardware.h> | |
31 | #include <asm/hardware/iomd.h> | |
32 | #include <asm/io.h> | |
33 | #include <asm/irq.h> | |
34 | #include <asm/mach-types.h> | |
35 | ||
36 | #include <asm/arch/regs-serial.h> | |
37 | #include <asm/arch/regs-gpio.h> | |
38 | #include <asm/arch/iic.h> | |
39 | ||
40 | #include <linux/serial_core.h> | |
41 | ||
42 | #include "s3c2410.h" | |
43 | #include "clock.h" | |
44 | #include "devs.h" | |
45 | #include "cpu.h" | |
46 | ||
47 | static struct map_desc n30_iodesc[] __initdata = { | |
48 | /* nothing here yet */ | |
49 | }; | |
50 | ||
51 | static struct s3c2410_uartcfg n30_uartcfgs[] = { | |
52 | /* Normal serial port */ | |
53 | [0] = { | |
54 | .hwport = 0, | |
55 | .flags = 0, | |
56 | .ucon = 0x2c5, | |
57 | .ulcon = 0x03, | |
58 | .ufcon = 0x51, | |
59 | }, | |
60 | /* IR port */ | |
61 | [1] = { | |
62 | .hwport = 1, | |
63 | .flags = 0, | |
64 | .uart_flags = UPF_CONS_FLOW, | |
65 | .ucon = 0x2c5, | |
66 | .ulcon = 0x43, | |
67 | .ufcon = 0x51, | |
68 | }, | |
69 | /* The BlueTooth controller is connected to port 2 */ | |
70 | [2] = { | |
71 | .hwport = 2, | |
72 | .flags = 0, | |
73 | .ucon = 0x2c5, | |
74 | .ulcon = 0x03, | |
75 | .ufcon = 0x51, | |
76 | }, | |
77 | }; | |
78 | ||
79 | static struct platform_device *n30_devices[] __initdata = { | |
80 | &s3c_device_usb, | |
81 | &s3c_device_lcd, | |
82 | &s3c_device_wdt, | |
83 | &s3c_device_i2c, | |
84 | &s3c_device_iis, | |
85 | &s3c_device_usbgadget, | |
86 | }; | |
87 | ||
88 | static struct s3c2410_platform_i2c n30_i2ccfg = { | |
89 | .flags = 0, | |
90 | .slave_addr = 0x10, | |
91 | .bus_freq = 10*1000, | |
92 | .max_freq = 10*1000, | |
93 | }; | |
94 | ||
95 | static struct s3c24xx_board n30_board __initdata = { | |
96 | .devices = n30_devices, | |
97 | .devices_count = ARRAY_SIZE(n30_devices) | |
98 | }; | |
99 | ||
100 | void __init n30_map_io(void) | |
101 | { | |
102 | s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); | |
103 | s3c24xx_init_clocks(0); | |
104 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); | |
105 | s3c24xx_set_board(&n30_board); | |
106 | } | |
107 | ||
108 | void __init n30_init_irq(void) | |
109 | { | |
110 | s3c24xx_init_irq(); | |
111 | } | |
112 | ||
113 | ||
114 | static int n30_usbstart_thread(void *unused) | |
115 | { | |
116 | /* Turn off suspend on both USB ports, and switch the | |
117 | * selectable USB port to USB device mode. */ | |
118 | writel(readl(S3C2410_MISCCR) & ~0x00003008, S3C2410_MISCCR); | |
119 | ||
120 | /* Turn off the D+ pull up for 3 seconds so that the USB host | |
121 | * at the other end will do a rescan of the USB bus. */ | |
122 | s3c2410_gpio_setpin(S3C2410_GPB3, 0); | |
123 | ||
124 | msleep_interruptible(3*HZ); | |
125 | ||
126 | s3c2410_gpio_setpin(S3C2410_GPB3, 1); | |
127 | ||
128 | return 0; | |
129 | } | |
130 | ||
131 | ||
132 | void __init n30_init(void) | |
133 | { | |
134 | s3c_device_i2c.dev.platform_data = &n30_i2ccfg; | |
135 | ||
136 | kthread_run(n30_usbstart_thread, NULL, "n30_usbstart"); | |
137 | } | |
138 | ||
139 | MACHINE_START(N30, "Acer-N30") | |
140 | MAINTAINER("Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org>") | |
141 | BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART) | |
142 | BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100) | |
143 | ||
144 | .timer = &s3c24xx_timer, | |
145 | .init_machine = n30_init, | |
146 | .init_irq = n30_init_irq, | |
147 | .map_io = n30_map_io, | |
148 | MACHINE_END | |
149 | ||
150 | /* | |
151 | Local variables: | |
152 | compile-command: "make ARCH=arm CROSS_COMPILE=/usr/local/arm/3.3.2/bin/arm-linux- -k -C ../../.." | |
153 | c-basic-offset: 8 | |
154 | End: | |
155 | */ |