blob: b83eabdf709be3ff88d1b95abf90a3ffcff53b74 [file] [log] [blame]
Christer Weinigel95790872008-07-07 18:12:45 +01001/* Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
2 * Yakumo AlphaX and Airis NC05 PDAs.
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (c) 2003-2005 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 *
Christer Weinigel196a0472008-07-07 18:12:41 +01007 * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
9 * There is a wiki with more information about the n30 port at
10 * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
Christer Weinigel95790872008-07-07 18:12:45 +010015 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
17#include <linux/kernel.h>
18#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Christer Weinigel62065752008-07-07 18:12:43 +010020#include <linux/gpio_keys.h>
Christer Weinigel196a0472008-07-07 18:12:41 +010021#include <linux/init.h>
Ben Dooksec976d62009-05-13 22:52:24 +010022#include <linux/gpio.h>
Christer Weinigel62065752008-07-07 18:12:43 +010023#include <linux/input.h>
Christer Weinigel196a0472008-07-07 18:12:41 +010024#include <linux/interrupt.h>
25#include <linux/platform_device.h>
26#include <linux/serial_core.h>
27#include <linux/timer.h>
Russell Kingfced80c2008-09-06 12:10:45 +010028#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Russell Kinga09e64f2008-08-05 16:14:15 +010030#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070031#include <asm/irq.h>
32#include <asm/mach-types.h>
33
Russell Kinga09e64f2008-08-05 16:14:15 +010034#include <mach/fb.h>
35#include <mach/leds-gpio.h>
36#include <mach/regs-gpio.h>
37#include <mach/regs-lcd.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
Christer Weinigel196a0472008-07-07 18:12:41 +010039#include <asm/mach/arch.h>
40#include <asm/mach/irq.h>
41#include <asm/mach/map.h>
42
Ben Dooks9498cb72008-10-30 10:14:33 +000043#include <plat/iic.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010044#include <plat/regs-serial.h>
Christer Weinigel196a0472008-07-07 18:12:41 +010045
Ben Dooksd5120ae2008-10-07 23:09:51 +010046#include <plat/clock.h>
Ben Dooksa2b7ba92008-10-07 22:26:09 +010047#include <plat/cpu.h>
48#include <plat/devs.h>
49#include <plat/s3c2410.h>
Ben Dooks57bd4b92008-10-30 10:14:37 +000050#include <plat/udc.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
52static struct map_desc n30_iodesc[] __initdata = {
53 /* nothing here yet */
54};
55
56static struct s3c2410_uartcfg n30_uartcfgs[] = {
57 /* Normal serial port */
58 [0] = {
59 .hwport = 0,
60 .flags = 0,
61 .ucon = 0x2c5,
62 .ulcon = 0x03,
63 .ufcon = 0x51,
64 },
65 /* IR port */
66 [1] = {
67 .hwport = 1,
68 .flags = 0,
69 .uart_flags = UPF_CONS_FLOW,
70 .ucon = 0x2c5,
71 .ulcon = 0x43,
72 .ufcon = 0x51,
73 },
Christer Weinigel95790872008-07-07 18:12:45 +010074 /* On the N30 the bluetooth controller is connected here.
75 * On the N35 and variants the GPS receiver is connected here. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 [2] = {
77 .hwport = 2,
78 .flags = 0,
79 .ucon = 0x2c5,
80 .ulcon = 0x03,
81 .ufcon = 0x51,
82 },
83};
84
Christer Weinigeld088e5f2008-07-07 18:12:42 +010085static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd)
86{
Ben Dooksa6755782008-07-07 18:12:48 +010087 switch (cmd) {
88 case S3C2410_UDC_P_ENABLE :
Ben Dooks070276d2009-05-17 22:32:23 +010089 s3c2410_gpio_setpin(S3C2410_GPB(3), 1);
Ben Dooksa6755782008-07-07 18:12:48 +010090 break;
91 case S3C2410_UDC_P_DISABLE :
Ben Dooks070276d2009-05-17 22:32:23 +010092 s3c2410_gpio_setpin(S3C2410_GPB(3), 0);
Ben Dooksa6755782008-07-07 18:12:48 +010093 break;
94 case S3C2410_UDC_P_RESET :
95 break;
96 default:
97 break;
Christer Weinigeld088e5f2008-07-07 18:12:42 +010098 }
99}
100
101static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
102 .udc_command = n30_udc_pullup,
Ben Dooks070276d2009-05-17 22:32:23 +0100103 .vbus_pin = S3C2410_GPG(1),
Christer Weinigeld088e5f2008-07-07 18:12:42 +0100104 .vbus_pin_inverted = 0,
105};
106
Christer Weinigel62065752008-07-07 18:12:43 +0100107static struct gpio_keys_button n30_buttons[] = {
108 {
Ben Dooks070276d2009-05-17 22:32:23 +0100109 .gpio = S3C2410_GPF(0),
Christer Weinigel62065752008-07-07 18:12:43 +0100110 .code = KEY_POWER,
111 .desc = "Power",
112 .active_low = 0,
113 },
114 {
Ben Dooks070276d2009-05-17 22:32:23 +0100115 .gpio = S3C2410_GPG(9),
Christer Weinigel62065752008-07-07 18:12:43 +0100116 .code = KEY_UP,
117 .desc = "Thumbwheel Up",
118 .active_low = 0,
119 },
120 {
Ben Dooks070276d2009-05-17 22:32:23 +0100121 .gpio = S3C2410_GPG(8),
Christer Weinigel62065752008-07-07 18:12:43 +0100122 .code = KEY_DOWN,
123 .desc = "Thumbwheel Down",
124 .active_low = 0,
125 },
126 {
Ben Dooks070276d2009-05-17 22:32:23 +0100127 .gpio = S3C2410_GPG(7),
Christer Weinigel62065752008-07-07 18:12:43 +0100128 .code = KEY_ENTER,
129 .desc = "Thumbwheel Press",
130 .active_low = 0,
131 },
132 {
Ben Dooks070276d2009-05-17 22:32:23 +0100133 .gpio = S3C2410_GPF(7),
Christer Weinigel62065752008-07-07 18:12:43 +0100134 .code = KEY_HOMEPAGE,
135 .desc = "Home",
136 .active_low = 0,
137 },
138 {
Ben Dooks070276d2009-05-17 22:32:23 +0100139 .gpio = S3C2410_GPF(6),
Christer Weinigel62065752008-07-07 18:12:43 +0100140 .code = KEY_CALENDAR,
141 .desc = "Calendar",
142 .active_low = 0,
143 },
144 {
Ben Dooks070276d2009-05-17 22:32:23 +0100145 .gpio = S3C2410_GPF(5),
Christer Weinigel62065752008-07-07 18:12:43 +0100146 .code = KEY_ADDRESSBOOK,
147 .desc = "Contacts",
148 .active_low = 0,
149 },
150 {
Ben Dooks070276d2009-05-17 22:32:23 +0100151 .gpio = S3C2410_GPF(4),
Christer Weinigel62065752008-07-07 18:12:43 +0100152 .code = KEY_MAIL,
153 .desc = "Mail",
154 .active_low = 0,
155 },
156};
157
158static struct gpio_keys_platform_data n30_button_data = {
159 .buttons = n30_buttons,
160 .nbuttons = ARRAY_SIZE(n30_buttons),
161};
162
163static struct platform_device n30_button_device = {
164 .name = "gpio-keys",
165 .id = -1,
166 .dev = {
167 .platform_data = &n30_button_data,
168 }
169};
170
Christer Weinigel95790872008-07-07 18:12:45 +0100171static struct gpio_keys_button n35_buttons[] = {
172 {
Ben Dooks070276d2009-05-17 22:32:23 +0100173 .gpio = S3C2410_GPF(0),
Christer Weinigel95790872008-07-07 18:12:45 +0100174 .code = KEY_POWER,
175 .desc = "Power",
176 .active_low = 0,
177 },
178 {
Ben Dooks070276d2009-05-17 22:32:23 +0100179 .gpio = S3C2410_GPG(9),
Christer Weinigel95790872008-07-07 18:12:45 +0100180 .code = KEY_UP,
181 .desc = "Joystick Up",
182 .active_low = 0,
183 },
184 {
Ben Dooks070276d2009-05-17 22:32:23 +0100185 .gpio = S3C2410_GPG(8),
Christer Weinigel95790872008-07-07 18:12:45 +0100186 .code = KEY_DOWN,
187 .desc = "Joystick Down",
188 .active_low = 0,
189 },
190 {
Ben Dooks070276d2009-05-17 22:32:23 +0100191 .gpio = S3C2410_GPG(6),
Christer Weinigel95790872008-07-07 18:12:45 +0100192 .code = KEY_DOWN,
193 .desc = "Joystick Left",
194 .active_low = 0,
195 },
196 {
Ben Dooks070276d2009-05-17 22:32:23 +0100197 .gpio = S3C2410_GPG(5),
Christer Weinigel95790872008-07-07 18:12:45 +0100198 .code = KEY_DOWN,
199 .desc = "Joystick Right",
200 .active_low = 0,
201 },
202 {
Ben Dooks070276d2009-05-17 22:32:23 +0100203 .gpio = S3C2410_GPG(7),
Christer Weinigel95790872008-07-07 18:12:45 +0100204 .code = KEY_ENTER,
205 .desc = "Joystick Press",
206 .active_low = 0,
207 },
208 {
Ben Dooks070276d2009-05-17 22:32:23 +0100209 .gpio = S3C2410_GPF(7),
Christer Weinigel95790872008-07-07 18:12:45 +0100210 .code = KEY_HOMEPAGE,
211 .desc = "Home",
212 .active_low = 0,
213 },
214 {
Ben Dooks070276d2009-05-17 22:32:23 +0100215 .gpio = S3C2410_GPF(6),
Christer Weinigel95790872008-07-07 18:12:45 +0100216 .code = KEY_CALENDAR,
217 .desc = "Calendar",
218 .active_low = 0,
219 },
220 {
Ben Dooks070276d2009-05-17 22:32:23 +0100221 .gpio = S3C2410_GPF(5),
Christer Weinigel95790872008-07-07 18:12:45 +0100222 .code = KEY_ADDRESSBOOK,
223 .desc = "Contacts",
224 .active_low = 0,
225 },
226 {
Ben Dooks070276d2009-05-17 22:32:23 +0100227 .gpio = S3C2410_GPF(4),
Christer Weinigel95790872008-07-07 18:12:45 +0100228 .code = KEY_MAIL,
229 .desc = "Mail",
230 .active_low = 0,
231 },
232 {
Ben Dooks070276d2009-05-17 22:32:23 +0100233 .gpio = S3C2410_GPF(3),
Christer Weinigel95790872008-07-07 18:12:45 +0100234 .code = SW_RADIO,
235 .desc = "GPS Antenna",
236 .active_low = 0,
237 },
238 {
Ben Dooks070276d2009-05-17 22:32:23 +0100239 .gpio = S3C2410_GPG(2),
Christer Weinigel95790872008-07-07 18:12:45 +0100240 .code = SW_HEADPHONE_INSERT,
241 .desc = "Headphone",
242 .active_low = 0,
243 },
244};
245
246static struct gpio_keys_platform_data n35_button_data = {
247 .buttons = n35_buttons,
248 .nbuttons = ARRAY_SIZE(n35_buttons),
249};
250
251static struct platform_device n35_button_device = {
252 .name = "gpio-keys",
253 .id = -1,
254 .num_resources = 0,
255 .dev = {
256 .platform_data = &n35_button_data,
257 }
258};
259
Christer Weinigel865cc632008-07-07 18:12:44 +0100260/* This is the bluetooth LED on the device. */
261static struct s3c24xx_led_platdata n30_blue_led_pdata = {
262 .name = "blue_led",
Ben Dooks070276d2009-05-17 22:32:23 +0100263 .gpio = S3C2410_GPG(6),
Christer Weinigel865cc632008-07-07 18:12:44 +0100264 .def_trigger = "",
265};
266
Pinkava J319887e2010-05-06 15:21:16 +0200267/* This is the blue LED on the device. Originaly used to indicate GPS activity
268 * by flashing. */
269static struct s3c24xx_led_platdata n35_blue_led_pdata = {
270 .name = "blue_led",
271 .gpio = S3C2410_GPD(8),
272 .def_trigger = "",
273};
274
Christer Weinigel865cc632008-07-07 18:12:44 +0100275/* This LED is driven by the battery microcontroller, and is blinking
276 * red, blinking green or solid green when the battery is low,
277 * charging or full respectively. By driving GPD9 low, it's possible
278 * to force the LED to blink red, so call that warning LED. */
279static struct s3c24xx_led_platdata n30_warning_led_pdata = {
280 .name = "warning_led",
281 .flags = S3C24XX_LEDF_ACTLOW,
Ben Dooks070276d2009-05-17 22:32:23 +0100282 .gpio = S3C2410_GPD(9),
Christer Weinigel865cc632008-07-07 18:12:44 +0100283 .def_trigger = "",
284};
285
Pinkava J319887e2010-05-06 15:21:16 +0200286static struct s3c24xx_led_platdata n35_warning_led_pdata = {
287 .name = "warning_led",
288 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
289 .gpio = S3C2410_GPD(9),
290 .def_trigger = "",
291};
292
Christer Weinigel865cc632008-07-07 18:12:44 +0100293static struct platform_device n30_blue_led = {
294 .name = "s3c24xx_led",
295 .id = 1,
296 .dev = {
297 .platform_data = &n30_blue_led_pdata,
298 },
299};
300
Pinkava J319887e2010-05-06 15:21:16 +0200301static struct platform_device n35_blue_led = {
302 .name = "s3c24xx_led",
303 .id = 1,
304 .dev = {
305 .platform_data = &n35_blue_led_pdata,
306 },
307};
308
Christer Weinigel865cc632008-07-07 18:12:44 +0100309static struct platform_device n30_warning_led = {
310 .name = "s3c24xx_led",
311 .id = 2,
312 .dev = {
313 .platform_data = &n30_warning_led_pdata,
314 },
315};
316
Pinkava J319887e2010-05-06 15:21:16 +0200317static struct platform_device n35_warning_led = {
318 .name = "s3c24xx_led",
319 .id = 2,
320 .dev = {
321 .platform_data = &n35_warning_led_pdata,
322 },
323};
324
Christer Weinigele43f2382008-07-07 18:12:46 +0100325static struct s3c2410fb_display n30_display __initdata = {
Ben Dooksa6755782008-07-07 18:12:48 +0100326 .type = S3C2410_LCDCON1_TFT,
327 .width = 240,
328 .height = 320,
329 .pixclock = 170000,
330
331 .xres = 240,
332 .yres = 320,
333 .bpp = 16,
334 .left_margin = 3,
335 .right_margin = 40,
336 .hsync_len = 40,
337 .upper_margin = 2,
338 .lower_margin = 3,
339 .vsync_len = 2,
Christer Weinigele43f2382008-07-07 18:12:46 +0100340
341 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
342};
343
344static struct s3c2410fb_mach_info n30_fb_info __initdata = {
Ben Dooksa6755782008-07-07 18:12:48 +0100345 .displays = &n30_display,
346 .num_displays = 1,
Christer Weinigele43f2382008-07-07 18:12:46 +0100347 .default_display = 0,
Ben Dooksa6755782008-07-07 18:12:48 +0100348 .lpcsel = 0x06,
Christer Weinigele43f2382008-07-07 18:12:46 +0100349};
350
Linus Torvalds1da177e2005-04-16 15:20:36 -0700351static struct platform_device *n30_devices[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 &s3c_device_lcd,
353 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000354 &s3c_device_i2c0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355 &s3c_device_iis,
Ben Dooksb8132482009-11-23 00:13:39 +0000356 &s3c_device_ohci,
Pinkava J8ecad342010-05-06 15:20:36 +0200357 &s3c_device_rtc,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 &s3c_device_usbgadget,
Christer Weinigel62065752008-07-07 18:12:43 +0100359 &n30_button_device,
Christer Weinigel865cc632008-07-07 18:12:44 +0100360 &n30_blue_led,
361 &n30_warning_led,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700362};
363
Christer Weinigel95790872008-07-07 18:12:45 +0100364static struct platform_device *n35_devices[] __initdata = {
365 &s3c_device_lcd,
366 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000367 &s3c_device_i2c0,
Christer Weinigel95790872008-07-07 18:12:45 +0100368 &s3c_device_iis,
Pinkava J8ecad342010-05-06 15:20:36 +0200369 &s3c_device_rtc,
Christer Weinigel95790872008-07-07 18:12:45 +0100370 &s3c_device_usbgadget,
371 &n35_button_device,
Pinkava J319887e2010-05-06 15:21:16 +0200372 &n35_blue_led,
373 &n35_warning_led,
Christer Weinigel95790872008-07-07 18:12:45 +0100374};
375
Ben Dooks7bcb7ed2009-09-28 16:29:48 +0100376static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700377 .flags = 0,
378 .slave_addr = 0x10,
Daniel Silverstonec564e6a2009-03-13 13:53:46 +0000379 .frequency = 10*1000,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380};
381
Christer Weinigel9a2ddb72008-07-07 18:12:47 +0100382/* Lots of hardcoded stuff, but it sets up the hardware in a useful
383 * state so that we can boot Linux directly from flash. */
384static void __init n30_hwinit(void)
385{
386 /* GPA0-11 special functions -- unknown what they do
387 * GPA12 N30 special function -- unknown what it does
388 * N35/PiN output -- unknown what it does
389 *
390 * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
391 * don't think it does anything useful on the N30, so I ought
392 * to make it an output there too since it always driven to 0
393 * as far as I can tell. */
394 if (machine_is_n30())
395 __raw_writel(0x007fffff, S3C2410_GPACON);
396 if (machine_is_n35())
397 __raw_writel(0x007fefff, S3C2410_GPACON);
398 __raw_writel(0x00000000, S3C2410_GPADAT);
399
400 /* GPB0 TOUT0 backlight level
401 * GPB1 output 1=backlight on
402 * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
403 * GPB3 output USB D+ pull up 0=disabled, 1=enabled
404 * GPB4 N30 output -- unknown function
405 * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
406 * GPB5 output -- unknown function
407 * GPB6 input -- unknown function
408 * GPB7 output -- unknown function
409 * GPB8 output -- probably LCD driver enable
410 * GPB9 output -- probably LCD VSYNC driver enable
411 * GPB10 output -- probably LCD HSYNC driver enable
412 */
413 __raw_writel(0x00154556, S3C2410_GPBCON);
414 __raw_writel(0x00000750, S3C2410_GPBDAT);
415 __raw_writel(0x00000073, S3C2410_GPBUP);
416
417 /* GPC0 input RS232 DCD/DSR/RI
418 * GPC1 LCD
419 * GPC2 output RS232 DTR?
420 * GPC3 input RS232 DCD/DSR/RI
421 * GPC4 LCD
422 * GPC5 output 0=NAND write enabled, 1=NAND write protect
423 * GPC6 input -- unknown function
424 * GPC7 input charger status 0=charger connected
425 * this input can be triggered by power on the USB device
426 * port too, but will go back to disconnected soon after.
427 * GPC8 N30/N35 output -- unknown function, always driven to 1
428 * PiN input -- unknown function, always read as 1
429 * Make it an input with a pull up for all models.
430 * GPC9-15 LCD
431 */
432 __raw_writel(0xaaa80618, S3C2410_GPCCON);
433 __raw_writel(0x0000014c, S3C2410_GPCDAT);
434 __raw_writel(0x0000fef2, S3C2410_GPCUP);
435
436 /* GPD0 input -- unknown function
437 * GPD1-D7 LCD
438 * GPD8 N30 output -- unknown function
439 * N35/PiN output 1=GPS LED on
440 * GPD9 output 0=power led blinks red, 1=normal power led function
441 * GPD10 output -- unknown function
442 * GPD11-15 LCD drivers
443 */
444 __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
445 __raw_writel(0x00000601, S3C2410_GPDDAT);
446 __raw_writel(0x0000fbfe, S3C2410_GPDUP);
447
448 /* GPE0-4 I2S audio bus
449 * GPE5-10 SD/MMC bus
450 * E11-13 outputs -- unknown function, probably power management
451 * E14-15 I2C bus connected to the battery controller
452 */
453 __raw_writel(0xa56aaaaa, S3C2410_GPECON);
454 __raw_writel(0x0000efc5, S3C2410_GPEDAT);
455 __raw_writel(0x0000f81f, S3C2410_GPEUP);
456
457 /* GPF0 input 0=power button pressed
458 * GPF1 input SD/MMC switch 0=card present
459 * GPF2 N30 1=reset button pressed (inverted compared to the rest)
460 * N35/PiN 0=reset button pressed
461 * GPF3 N30/PiN input -- unknown function
462 * N35 input GPS antenna position, 0=antenna closed, 1=open
463 * GPF4 input 0=button 4 pressed
464 * GPF5 input 0=button 3 pressed
465 * GPF6 input 0=button 2 pressed
466 * GPF7 input 0=button 1 pressed
467 */
468 __raw_writel(0x0000aaaa, S3C2410_GPFCON);
469 __raw_writel(0x00000000, S3C2410_GPFDAT);
470 __raw_writel(0x000000ff, S3C2410_GPFUP);
471
472 /* GPG0 input RS232 DCD/DSR/RI
473 * GPG1 input 1=USB gadget port has power from a host
474 * GPG2 N30 input -- unknown function
475 * N35/PiN input 0=headphones plugged in, 1=not plugged in
476 * GPG3 N30 output -- unknown function
477 * N35/PiN input with unknown function
478 * GPG4 N30 output 0=MMC enabled, 1=MMC disabled
479 * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled
480 * N35/PiN input joystick right
481 * GPG6 N30 output 0=blue led on, 1=off
482 * N35/PiN input joystick left
483 * GPG7 input 0=thumbwheel pressed
484 * GPG8 input 0=thumbwheel down
485 * GPG9 input 0=thumbwheel up
486 * GPG10 input SD/MMC write protect switch
487 * GPG11 N30 input -- unknown function
488 * N35 output 0=GPS antenna powered, 1=not powered
489 * PiN output -- unknown function
490 * GPG12-15 touch screen functions
491 *
492 * The pullups differ between the models, so enable all
493 * pullups that are enabled on any of the models.
494 */
495 if (machine_is_n30())
496 __raw_writel(0xff0a956a, S3C2410_GPGCON);
497 if (machine_is_n35())
498 __raw_writel(0xff4aa92a, S3C2410_GPGCON);
499 __raw_writel(0x0000e800, S3C2410_GPGDAT);
500 __raw_writel(0x0000f86f, S3C2410_GPGUP);
501
502 /* GPH0/1/2/3 RS232 serial port
503 * GPH4/5 IrDA serial port
504 * GPH6/7 N30 BlueTooth serial port
505 * N35/PiN GPS receiver
506 * GPH8 input -- unknown function
507 * GPH9 CLKOUT0 HCLK -- unknown use
508 * GPH10 CLKOUT1 FCLK -- unknown use
509 *
510 * The pull ups for H6/H7 are enabled on N30 but not on the
511 * N35/PiN. I suppose is useful for a budget model of the N30
512 * with no bluetooh. It doesn't hurt to have the pull ups
513 * enabled on the N35, so leave them enabled for all models.
514 */
515 __raw_writel(0x0028aaaa, S3C2410_GPHCON);
516 __raw_writel(0x000005ef, S3C2410_GPHDAT);
517 __raw_writel(0x0000063f, S3C2410_GPHUP);
518}
519
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100520static void __init n30_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700521{
522 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
Christer Weinigel9a2ddb72008-07-07 18:12:47 +0100523 n30_hwinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 s3c24xx_init_clocks(0);
525 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526}
527
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100528static void __init n30_init_irq(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529{
530 s3c24xx_init_irq();
531}
532
Ben Dooks027da012005-09-05 20:47:53 +0100533/* GPB3 is the line that controls the pull-up for the USB D+ line */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100535static void __init n30_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536{
Christer Weinigele43f2382008-07-07 18:12:46 +0100537 s3c24xx_fb_set_platdata(&n30_fb_info);
Christer Weinigeld088e5f2008-07-07 18:12:42 +0100538 s3c24xx_udc_set_platdata(&n30_udc_cfg);
Ben Dooks7bcb7ed2009-09-28 16:29:48 +0100539 s3c_i2c0_set_platdata(&n30_i2ccfg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540
Ben Dooks027da012005-09-05 20:47:53 +0100541 /* Turn off suspend on both USB ports, and switch the
542 * selectable USB port to USB device mode. */
543
544 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
545 S3C2410_MISCCR_USBSUSPND0 |
546 S3C2410_MISCCR_USBSUSPND1, 0x0);
Ben Dooks57e51712007-04-20 11:19:16 +0100547
Christer Weinigel95790872008-07-07 18:12:45 +0100548 if (machine_is_n30()) {
549 /* Turn off suspend on both USB ports, and switch the
550 * selectable USB port to USB device mode. */
551 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
552 S3C2410_MISCCR_USBSUSPND0 |
553 S3C2410_MISCCR_USBSUSPND1, 0x0);
554
555 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
556 }
557
558 if (machine_is_n35()) {
559 /* Turn off suspend and switch the selectable USB port
560 * to USB device mode. Turn on suspend for the host
561 * port since it is not connected on the N35.
562 *
563 * Actually, the host port is available at some pads
564 * on the back of the device, so it would actually be
565 * possible to add a USB device inside the N35 if you
566 * are willing to do some hardware modifications. */
567 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
568 S3C2410_MISCCR_USBSUSPND0 |
569 S3C2410_MISCCR_USBSUSPND1,
Pinkava Jbe7c4cf2010-05-06 15:19:19 +0200570 S3C2410_MISCCR_USBSUSPND0);
Christer Weinigel95790872008-07-07 18:12:45 +0100571
572 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
573 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574}
575
576MACHINE_START(N30, "Acer-N30")
Ben Dooks027da012005-09-05 20:47:53 +0100577 /* Maintainer: Christer Weinigel <christer@weinigel.se>,
578 Ben Dooks <ben-linux@fluff.org>
579 */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100580 .phys_io = S3C2410_PA_UART,
581 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
582 .boot_params = S3C2410_SDRAM_PA + 0x100,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 .timer = &s3c24xx_timer,
584 .init_machine = n30_init,
585 .init_irq = n30_init_irq,
586 .map_io = n30_map_io,
587MACHINE_END
Christer Weinigel95790872008-07-07 18:12:45 +0100588
589MACHINE_START(N35, "Acer-N35")
590 /* Maintainer: Christer Weinigel <christer@weinigel.se>
591 */
592 .phys_io = S3C2410_PA_UART,
593 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
594 .boot_params = S3C2410_SDRAM_PA + 0x100,
595 .timer = &s3c24xx_timer,
596 .init_machine = n30_init,
597 .init_irq = n30_init_irq,
598 .map_io = n30_map_io,
599MACHINE_END