blob: d63b48f8dceef2833b5b62daf502fd7ffe37e6f4 [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,
Pinkava Jaeb1b7e2010-05-06 15:21:50 +0200175 .type = EV_PWR,
Christer Weinigel95790872008-07-07 18:12:45 +0100176 .desc = "Power",
177 .active_low = 0,
Pinkava Jaeb1b7e2010-05-06 15:21:50 +0200178 .wakeup = 1,
Christer Weinigel95790872008-07-07 18:12:45 +0100179 },
180 {
Ben Dooks070276d2009-05-17 22:32:23 +0100181 .gpio = S3C2410_GPG(9),
Christer Weinigel95790872008-07-07 18:12:45 +0100182 .code = KEY_UP,
183 .desc = "Joystick Up",
184 .active_low = 0,
185 },
186 {
Ben Dooks070276d2009-05-17 22:32:23 +0100187 .gpio = S3C2410_GPG(8),
Christer Weinigel95790872008-07-07 18:12:45 +0100188 .code = KEY_DOWN,
189 .desc = "Joystick Down",
190 .active_low = 0,
191 },
192 {
Ben Dooks070276d2009-05-17 22:32:23 +0100193 .gpio = S3C2410_GPG(6),
Christer Weinigel95790872008-07-07 18:12:45 +0100194 .code = KEY_DOWN,
195 .desc = "Joystick Left",
196 .active_low = 0,
197 },
198 {
Ben Dooks070276d2009-05-17 22:32:23 +0100199 .gpio = S3C2410_GPG(5),
Christer Weinigel95790872008-07-07 18:12:45 +0100200 .code = KEY_DOWN,
201 .desc = "Joystick Right",
202 .active_low = 0,
203 },
204 {
Ben Dooks070276d2009-05-17 22:32:23 +0100205 .gpio = S3C2410_GPG(7),
Christer Weinigel95790872008-07-07 18:12:45 +0100206 .code = KEY_ENTER,
207 .desc = "Joystick Press",
208 .active_low = 0,
209 },
210 {
Ben Dooks070276d2009-05-17 22:32:23 +0100211 .gpio = S3C2410_GPF(7),
Christer Weinigel95790872008-07-07 18:12:45 +0100212 .code = KEY_HOMEPAGE,
213 .desc = "Home",
214 .active_low = 0,
215 },
216 {
Ben Dooks070276d2009-05-17 22:32:23 +0100217 .gpio = S3C2410_GPF(6),
Christer Weinigel95790872008-07-07 18:12:45 +0100218 .code = KEY_CALENDAR,
219 .desc = "Calendar",
220 .active_low = 0,
221 },
222 {
Ben Dooks070276d2009-05-17 22:32:23 +0100223 .gpio = S3C2410_GPF(5),
Christer Weinigel95790872008-07-07 18:12:45 +0100224 .code = KEY_ADDRESSBOOK,
225 .desc = "Contacts",
226 .active_low = 0,
227 },
228 {
Ben Dooks070276d2009-05-17 22:32:23 +0100229 .gpio = S3C2410_GPF(4),
Christer Weinigel95790872008-07-07 18:12:45 +0100230 .code = KEY_MAIL,
231 .desc = "Mail",
232 .active_low = 0,
233 },
234 {
Ben Dooks070276d2009-05-17 22:32:23 +0100235 .gpio = S3C2410_GPF(3),
Christer Weinigel95790872008-07-07 18:12:45 +0100236 .code = SW_RADIO,
237 .desc = "GPS Antenna",
238 .active_low = 0,
239 },
240 {
Ben Dooks070276d2009-05-17 22:32:23 +0100241 .gpio = S3C2410_GPG(2),
Christer Weinigel95790872008-07-07 18:12:45 +0100242 .code = SW_HEADPHONE_INSERT,
243 .desc = "Headphone",
244 .active_low = 0,
245 },
246};
247
248static struct gpio_keys_platform_data n35_button_data = {
249 .buttons = n35_buttons,
250 .nbuttons = ARRAY_SIZE(n35_buttons),
251};
252
253static struct platform_device n35_button_device = {
254 .name = "gpio-keys",
255 .id = -1,
256 .num_resources = 0,
257 .dev = {
258 .platform_data = &n35_button_data,
259 }
260};
261
Christer Weinigel865cc632008-07-07 18:12:44 +0100262/* This is the bluetooth LED on the device. */
263static struct s3c24xx_led_platdata n30_blue_led_pdata = {
264 .name = "blue_led",
Ben Dooks070276d2009-05-17 22:32:23 +0100265 .gpio = S3C2410_GPG(6),
Christer Weinigel865cc632008-07-07 18:12:44 +0100266 .def_trigger = "",
267};
268
Pinkava J319887e2010-05-06 15:21:16 +0200269/* This is the blue LED on the device. Originaly used to indicate GPS activity
270 * by flashing. */
271static struct s3c24xx_led_platdata n35_blue_led_pdata = {
272 .name = "blue_led",
273 .gpio = S3C2410_GPD(8),
274 .def_trigger = "",
275};
276
Christer Weinigel865cc632008-07-07 18:12:44 +0100277/* This LED is driven by the battery microcontroller, and is blinking
278 * red, blinking green or solid green when the battery is low,
279 * charging or full respectively. By driving GPD9 low, it's possible
280 * to force the LED to blink red, so call that warning LED. */
281static struct s3c24xx_led_platdata n30_warning_led_pdata = {
282 .name = "warning_led",
283 .flags = S3C24XX_LEDF_ACTLOW,
Ben Dooks070276d2009-05-17 22:32:23 +0100284 .gpio = S3C2410_GPD(9),
Christer Weinigel865cc632008-07-07 18:12:44 +0100285 .def_trigger = "",
286};
287
Pinkava J319887e2010-05-06 15:21:16 +0200288static struct s3c24xx_led_platdata n35_warning_led_pdata = {
289 .name = "warning_led",
290 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
291 .gpio = S3C2410_GPD(9),
292 .def_trigger = "",
293};
294
Christer Weinigel865cc632008-07-07 18:12:44 +0100295static struct platform_device n30_blue_led = {
296 .name = "s3c24xx_led",
297 .id = 1,
298 .dev = {
299 .platform_data = &n30_blue_led_pdata,
300 },
301};
302
Pinkava J319887e2010-05-06 15:21:16 +0200303static struct platform_device n35_blue_led = {
304 .name = "s3c24xx_led",
305 .id = 1,
306 .dev = {
307 .platform_data = &n35_blue_led_pdata,
308 },
309};
310
Christer Weinigel865cc632008-07-07 18:12:44 +0100311static struct platform_device n30_warning_led = {
312 .name = "s3c24xx_led",
313 .id = 2,
314 .dev = {
315 .platform_data = &n30_warning_led_pdata,
316 },
317};
318
Pinkava J319887e2010-05-06 15:21:16 +0200319static struct platform_device n35_warning_led = {
320 .name = "s3c24xx_led",
321 .id = 2,
322 .dev = {
323 .platform_data = &n35_warning_led_pdata,
324 },
325};
326
Christer Weinigele43f2382008-07-07 18:12:46 +0100327static struct s3c2410fb_display n30_display __initdata = {
Ben Dooksa6755782008-07-07 18:12:48 +0100328 .type = S3C2410_LCDCON1_TFT,
329 .width = 240,
330 .height = 320,
331 .pixclock = 170000,
332
333 .xres = 240,
334 .yres = 320,
335 .bpp = 16,
336 .left_margin = 3,
337 .right_margin = 40,
338 .hsync_len = 40,
339 .upper_margin = 2,
340 .lower_margin = 3,
341 .vsync_len = 2,
Christer Weinigele43f2382008-07-07 18:12:46 +0100342
343 .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
344};
345
346static struct s3c2410fb_mach_info n30_fb_info __initdata = {
Ben Dooksa6755782008-07-07 18:12:48 +0100347 .displays = &n30_display,
348 .num_displays = 1,
Christer Weinigele43f2382008-07-07 18:12:46 +0100349 .default_display = 0,
Ben Dooksa6755782008-07-07 18:12:48 +0100350 .lpcsel = 0x06,
Christer Weinigele43f2382008-07-07 18:12:46 +0100351};
352
Linus Torvalds1da177e2005-04-16 15:20:36 -0700353static struct platform_device *n30_devices[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 &s3c_device_lcd,
355 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000356 &s3c_device_i2c0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700357 &s3c_device_iis,
Ben Dooksb8132482009-11-23 00:13:39 +0000358 &s3c_device_ohci,
Pinkava J8ecad342010-05-06 15:20:36 +0200359 &s3c_device_rtc,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 &s3c_device_usbgadget,
Christer Weinigel62065752008-07-07 18:12:43 +0100361 &n30_button_device,
Christer Weinigel865cc632008-07-07 18:12:44 +0100362 &n30_blue_led,
363 &n30_warning_led,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364};
365
Christer Weinigel95790872008-07-07 18:12:45 +0100366static struct platform_device *n35_devices[] __initdata = {
367 &s3c_device_lcd,
368 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000369 &s3c_device_i2c0,
Christer Weinigel95790872008-07-07 18:12:45 +0100370 &s3c_device_iis,
Pinkava J8ecad342010-05-06 15:20:36 +0200371 &s3c_device_rtc,
Christer Weinigel95790872008-07-07 18:12:45 +0100372 &s3c_device_usbgadget,
373 &n35_button_device,
Pinkava J319887e2010-05-06 15:21:16 +0200374 &n35_blue_led,
375 &n35_warning_led,
Christer Weinigel95790872008-07-07 18:12:45 +0100376};
377
Ben Dooks7bcb7ed2009-09-28 16:29:48 +0100378static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 .flags = 0,
380 .slave_addr = 0x10,
Daniel Silverstonec564e6a2009-03-13 13:53:46 +0000381 .frequency = 10*1000,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382};
383
Christer Weinigel9a2ddb72008-07-07 18:12:47 +0100384/* Lots of hardcoded stuff, but it sets up the hardware in a useful
385 * state so that we can boot Linux directly from flash. */
386static void __init n30_hwinit(void)
387{
388 /* GPA0-11 special functions -- unknown what they do
389 * GPA12 N30 special function -- unknown what it does
390 * N35/PiN output -- unknown what it does
391 *
392 * A12 is nGCS1 on the N30 and an output on the N35/PiN. I
393 * don't think it does anything useful on the N30, so I ought
394 * to make it an output there too since it always driven to 0
395 * as far as I can tell. */
396 if (machine_is_n30())
397 __raw_writel(0x007fffff, S3C2410_GPACON);
398 if (machine_is_n35())
399 __raw_writel(0x007fefff, S3C2410_GPACON);
400 __raw_writel(0x00000000, S3C2410_GPADAT);
401
402 /* GPB0 TOUT0 backlight level
403 * GPB1 output 1=backlight on
404 * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
405 * GPB3 output USB D+ pull up 0=disabled, 1=enabled
406 * GPB4 N30 output -- unknown function
407 * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
408 * GPB5 output -- unknown function
409 * GPB6 input -- unknown function
410 * GPB7 output -- unknown function
411 * GPB8 output -- probably LCD driver enable
412 * GPB9 output -- probably LCD VSYNC driver enable
413 * GPB10 output -- probably LCD HSYNC driver enable
414 */
415 __raw_writel(0x00154556, S3C2410_GPBCON);
416 __raw_writel(0x00000750, S3C2410_GPBDAT);
417 __raw_writel(0x00000073, S3C2410_GPBUP);
418
419 /* GPC0 input RS232 DCD/DSR/RI
420 * GPC1 LCD
421 * GPC2 output RS232 DTR?
422 * GPC3 input RS232 DCD/DSR/RI
423 * GPC4 LCD
424 * GPC5 output 0=NAND write enabled, 1=NAND write protect
425 * GPC6 input -- unknown function
426 * GPC7 input charger status 0=charger connected
427 * this input can be triggered by power on the USB device
428 * port too, but will go back to disconnected soon after.
429 * GPC8 N30/N35 output -- unknown function, always driven to 1
430 * PiN input -- unknown function, always read as 1
431 * Make it an input with a pull up for all models.
432 * GPC9-15 LCD
433 */
434 __raw_writel(0xaaa80618, S3C2410_GPCCON);
435 __raw_writel(0x0000014c, S3C2410_GPCDAT);
436 __raw_writel(0x0000fef2, S3C2410_GPCUP);
437
438 /* GPD0 input -- unknown function
439 * GPD1-D7 LCD
440 * GPD8 N30 output -- unknown function
441 * N35/PiN output 1=GPS LED on
442 * GPD9 output 0=power led blinks red, 1=normal power led function
443 * GPD10 output -- unknown function
444 * GPD11-15 LCD drivers
445 */
446 __raw_writel(0xaa95aaa4, S3C2410_GPDCON);
447 __raw_writel(0x00000601, S3C2410_GPDDAT);
448 __raw_writel(0x0000fbfe, S3C2410_GPDUP);
449
450 /* GPE0-4 I2S audio bus
451 * GPE5-10 SD/MMC bus
452 * E11-13 outputs -- unknown function, probably power management
453 * E14-15 I2C bus connected to the battery controller
454 */
455 __raw_writel(0xa56aaaaa, S3C2410_GPECON);
456 __raw_writel(0x0000efc5, S3C2410_GPEDAT);
457 __raw_writel(0x0000f81f, S3C2410_GPEUP);
458
459 /* GPF0 input 0=power button pressed
460 * GPF1 input SD/MMC switch 0=card present
461 * GPF2 N30 1=reset button pressed (inverted compared to the rest)
462 * N35/PiN 0=reset button pressed
463 * GPF3 N30/PiN input -- unknown function
464 * N35 input GPS antenna position, 0=antenna closed, 1=open
465 * GPF4 input 0=button 4 pressed
466 * GPF5 input 0=button 3 pressed
467 * GPF6 input 0=button 2 pressed
468 * GPF7 input 0=button 1 pressed
469 */
470 __raw_writel(0x0000aaaa, S3C2410_GPFCON);
471 __raw_writel(0x00000000, S3C2410_GPFDAT);
472 __raw_writel(0x000000ff, S3C2410_GPFUP);
473
474 /* GPG0 input RS232 DCD/DSR/RI
475 * GPG1 input 1=USB gadget port has power from a host
476 * GPG2 N30 input -- unknown function
477 * N35/PiN input 0=headphones plugged in, 1=not plugged in
478 * GPG3 N30 output -- unknown function
479 * N35/PiN input with unknown function
480 * GPG4 N30 output 0=MMC enabled, 1=MMC disabled
481 * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled
482 * N35/PiN input joystick right
483 * GPG6 N30 output 0=blue led on, 1=off
484 * N35/PiN input joystick left
485 * GPG7 input 0=thumbwheel pressed
486 * GPG8 input 0=thumbwheel down
487 * GPG9 input 0=thumbwheel up
488 * GPG10 input SD/MMC write protect switch
489 * GPG11 N30 input -- unknown function
490 * N35 output 0=GPS antenna powered, 1=not powered
491 * PiN output -- unknown function
492 * GPG12-15 touch screen functions
493 *
494 * The pullups differ between the models, so enable all
495 * pullups that are enabled on any of the models.
496 */
497 if (machine_is_n30())
498 __raw_writel(0xff0a956a, S3C2410_GPGCON);
499 if (machine_is_n35())
500 __raw_writel(0xff4aa92a, S3C2410_GPGCON);
501 __raw_writel(0x0000e800, S3C2410_GPGDAT);
502 __raw_writel(0x0000f86f, S3C2410_GPGUP);
503
504 /* GPH0/1/2/3 RS232 serial port
505 * GPH4/5 IrDA serial port
506 * GPH6/7 N30 BlueTooth serial port
507 * N35/PiN GPS receiver
508 * GPH8 input -- unknown function
509 * GPH9 CLKOUT0 HCLK -- unknown use
510 * GPH10 CLKOUT1 FCLK -- unknown use
511 *
512 * The pull ups for H6/H7 are enabled on N30 but not on the
513 * N35/PiN. I suppose is useful for a budget model of the N30
514 * with no bluetooh. It doesn't hurt to have the pull ups
515 * enabled on the N35, so leave them enabled for all models.
516 */
517 __raw_writel(0x0028aaaa, S3C2410_GPHCON);
518 __raw_writel(0x000005ef, S3C2410_GPHDAT);
519 __raw_writel(0x0000063f, S3C2410_GPHUP);
520}
521
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100522static void __init n30_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700523{
524 s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
Christer Weinigel9a2ddb72008-07-07 18:12:47 +0100525 n30_hwinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700526 s3c24xx_init_clocks(0);
527 s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528}
529
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100530static void __init n30_init_irq(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531{
532 s3c24xx_init_irq();
533}
534
Ben Dooks027da012005-09-05 20:47:53 +0100535/* GPB3 is the line that controls the pull-up for the USB D+ line */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100537static void __init n30_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538{
Christer Weinigele43f2382008-07-07 18:12:46 +0100539 s3c24xx_fb_set_platdata(&n30_fb_info);
Christer Weinigeld088e5f2008-07-07 18:12:42 +0100540 s3c24xx_udc_set_platdata(&n30_udc_cfg);
Ben Dooks7bcb7ed2009-09-28 16:29:48 +0100541 s3c_i2c0_set_platdata(&n30_i2ccfg);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542
Ben Dooks027da012005-09-05 20:47:53 +0100543 /* Turn off suspend on both USB ports, and switch the
544 * selectable USB port to USB device mode. */
545
546 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
547 S3C2410_MISCCR_USBSUSPND0 |
548 S3C2410_MISCCR_USBSUSPND1, 0x0);
Ben Dooks57e51712007-04-20 11:19:16 +0100549
Christer Weinigel95790872008-07-07 18:12:45 +0100550 if (machine_is_n30()) {
551 /* Turn off suspend on both USB ports, and switch the
552 * selectable USB port to USB device mode. */
553 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
554 S3C2410_MISCCR_USBSUSPND0 |
555 S3C2410_MISCCR_USBSUSPND1, 0x0);
556
557 platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
558 }
559
560 if (machine_is_n35()) {
561 /* Turn off suspend and switch the selectable USB port
562 * to USB device mode. Turn on suspend for the host
563 * port since it is not connected on the N35.
564 *
565 * Actually, the host port is available at some pads
566 * on the back of the device, so it would actually be
567 * possible to add a USB device inside the N35 if you
568 * are willing to do some hardware modifications. */
569 s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
570 S3C2410_MISCCR_USBSUSPND0 |
571 S3C2410_MISCCR_USBSUSPND1,
Pinkava Jbe7c4cf2010-05-06 15:19:19 +0200572 S3C2410_MISCCR_USBSUSPND0);
Christer Weinigel95790872008-07-07 18:12:45 +0100573
574 platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
575 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576}
577
578MACHINE_START(N30, "Acer-N30")
Ben Dooks027da012005-09-05 20:47:53 +0100579 /* Maintainer: Christer Weinigel <christer@weinigel.se>,
580 Ben Dooks <ben-linux@fluff.org>
581 */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100582 .phys_io = S3C2410_PA_UART,
583 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
584 .boot_params = S3C2410_SDRAM_PA + 0x100,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700585 .timer = &s3c24xx_timer,
586 .init_machine = n30_init,
587 .init_irq = n30_init_irq,
588 .map_io = n30_map_io,
589MACHINE_END
Christer Weinigel95790872008-07-07 18:12:45 +0100590
591MACHINE_START(N35, "Acer-N35")
592 /* Maintainer: Christer Weinigel <christer@weinigel.se>
593 */
594 .phys_io = S3C2410_PA_UART,
595 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
596 .boot_params = S3C2410_SDRAM_PA + 0x100,
597 .timer = &s3c24xx_timer,
598 .init_machine = n30_init,
599 .init_irq = n30_init_irq,
600 .map_io = n30_map_io,
601MACHINE_END