1 // SPDX-License-Identifier: GPL-2.0
2 //
3 // Machine specific code for the Acer n30, Acer N35, Navman PiN 570,
4 // Yakumo AlphaX and Airis NC05 PDAs.
5 //
6 // Copyright (c) 2003-2005 Simtec Electronics
7 //	Ben Dooks <ben@simtec.co.uk>
8 //
9 // Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se>
10 //
11 // There is a wiki with more information about the n30 port at
12 // https://handhelds.org/moin/moin.cgi/AcerN30Documentation .
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 "hardware-s3c24xx.h"
31 #include <asm/irq.h>
32 #include <asm/mach-types.h>
33 
34 #include <linux/platform_data/fb-s3c2410.h>
35 #include <linux/platform_data/leds-s3c24xx.h>
36 #include "regs-gpio.h"
37 #include "gpio-samsung.h"
38 #include "gpio-cfg.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 "cpu.h"
47 #include "devs.h"
48 #include <linux/platform_data/mmc-s3cmci.h>
49 #include <linux/platform_data/usb-s3c2410_udc.h>
50 
51 #include "s3c24xx.h"
52 
53 static struct map_desc n30_iodesc[] __initdata = {
54 	/* nothing here yet */
55 };
56 
57 static struct s3c2410_uartcfg n30_uartcfgs[] = {
58 	/* Normal serial port */
59 	[0] = {
60 		.hwport	     = 0,
61 		.flags	     = 0,
62 		.ucon	     = 0x2c5,
63 		.ulcon	     = 0x03,
64 		.ufcon	     = 0x51,
65 	},
66 	/* IR port */
67 	[1] = {
68 		.hwport	     = 1,
69 		.flags	     = 0,
70 		.uart_flags  = UPF_CONS_FLOW,
71 		.ucon	     = 0x2c5,
72 		.ulcon	     = 0x43,
73 		.ufcon	     = 0x51,
74 	},
75 	/* On the N30 the bluetooth controller is connected here.
76 	 * On the N35 and variants the GPS receiver is connected here. */
77 	[2] = {
78 		.hwport	     = 2,
79 		.flags	     = 0,
80 		.ucon	     = 0x2c5,
81 		.ulcon	     = 0x03,
82 		.ufcon	     = 0x51,
83 	},
84 };
85 
86 static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = {
87 };
88 
89 static struct gpiod_lookup_table n30_udc_gpio_table = {
90 	.dev_id = "s3c2410-usbgadget",
91 	.table = {
92 		GPIO_LOOKUP("GPIOG", 1, "vbus", GPIO_ACTIVE_HIGH),
93 		GPIO_LOOKUP("GPIOB", 3, "pullup", GPIO_ACTIVE_HIGH),
94 		{ },
95 	},
96 };
97 
98 static struct gpio_keys_button n30_buttons[] = {
99 	{
100 		.gpio		= S3C2410_GPF(0),
101 		.code		= KEY_POWER,
102 		.desc		= "Power",
103 		.active_low	= 0,
104 	},
105 	{
106 		.gpio		= S3C2410_GPG(9),
107 		.code		= KEY_UP,
108 		.desc		= "Thumbwheel Up",
109 		.active_low	= 0,
110 	},
111 	{
112 		.gpio		= S3C2410_GPG(8),
113 		.code		= KEY_DOWN,
114 		.desc		= "Thumbwheel Down",
115 		.active_low	= 0,
116 	},
117 	{
118 		.gpio		= S3C2410_GPG(7),
119 		.code		= KEY_ENTER,
120 		.desc		= "Thumbwheel Press",
121 		.active_low	= 0,
122 	},
123 	{
124 		.gpio		= S3C2410_GPF(7),
125 		.code		= KEY_HOMEPAGE,
126 		.desc		= "Home",
127 		.active_low	= 0,
128 	},
129 	{
130 		.gpio		= S3C2410_GPF(6),
131 		.code		= KEY_CALENDAR,
132 		.desc		= "Calendar",
133 		.active_low	= 0,
134 	},
135 	{
136 		.gpio		= S3C2410_GPF(5),
137 		.code		= KEY_ADDRESSBOOK,
138 		.desc		= "Contacts",
139 		.active_low	= 0,
140 	},
141 	{
142 		.gpio		= S3C2410_GPF(4),
143 		.code		= KEY_MAIL,
144 		.desc		= "Mail",
145 		.active_low	= 0,
146 	},
147 };
148 
149 static struct gpio_keys_platform_data n30_button_data = {
150 	.buttons	= n30_buttons,
151 	.nbuttons	= ARRAY_SIZE(n30_buttons),
152 };
153 
154 static struct platform_device n30_button_device = {
155 	.name		= "gpio-keys",
156 	.id		= -1,
157 	.dev		= {
158 		.platform_data	= &n30_button_data,
159 	}
160 };
161 
162 static struct gpio_keys_button n35_buttons[] = {
163 	{
164 		.gpio		= S3C2410_GPF(0),
165 		.code		= KEY_POWER,
166 		.type		= EV_PWR,
167 		.desc		= "Power",
168 		.active_low	= 0,
169 		.wakeup		= 1,
170 	},
171 	{
172 		.gpio		= S3C2410_GPG(9),
173 		.code		= KEY_UP,
174 		.desc		= "Joystick Up",
175 		.active_low	= 0,
176 	},
177 	{
178 		.gpio		= S3C2410_GPG(8),
179 		.code		= KEY_DOWN,
180 		.desc		= "Joystick Down",
181 		.active_low	= 0,
182 	},
183 	{
184 		.gpio		= S3C2410_GPG(6),
185 		.code		= KEY_DOWN,
186 		.desc		= "Joystick Left",
187 		.active_low	= 0,
188 	},
189 	{
190 		.gpio		= S3C2410_GPG(5),
191 		.code		= KEY_DOWN,
192 		.desc		= "Joystick Right",
193 		.active_low	= 0,
194 	},
195 	{
196 		.gpio		= S3C2410_GPG(7),
197 		.code		= KEY_ENTER,
198 		.desc		= "Joystick Press",
199 		.active_low	= 0,
200 	},
201 	{
202 		.gpio		= S3C2410_GPF(7),
203 		.code		= KEY_HOMEPAGE,
204 		.desc		= "Home",
205 		.active_low	= 0,
206 	},
207 	{
208 		.gpio		= S3C2410_GPF(6),
209 		.code		= KEY_CALENDAR,
210 		.desc		= "Calendar",
211 		.active_low	= 0,
212 	},
213 	{
214 		.gpio		= S3C2410_GPF(5),
215 		.code		= KEY_ADDRESSBOOK,
216 		.desc		= "Contacts",
217 		.active_low	= 0,
218 	},
219 	{
220 		.gpio		= S3C2410_GPF(4),
221 		.code		= KEY_MAIL,
222 		.desc		= "Mail",
223 		.active_low	= 0,
224 	},
225 	{
226 		.gpio		= S3C2410_GPF(3),
227 		.code		= SW_RADIO,
228 		.desc		= "GPS Antenna",
229 		.active_low	= 0,
230 	},
231 	{
232 		.gpio		= S3C2410_GPG(2),
233 		.code		= SW_HEADPHONE_INSERT,
234 		.desc		= "Headphone",
235 		.active_low	= 0,
236 	},
237 };
238 
239 static struct gpio_keys_platform_data n35_button_data = {
240 	.buttons	= n35_buttons,
241 	.nbuttons	= ARRAY_SIZE(n35_buttons),
242 };
243 
244 static struct platform_device n35_button_device = {
245 	.name		= "gpio-keys",
246 	.id		= -1,
247 	.num_resources	= 0,
248 	.dev		= {
249 		.platform_data	= &n35_button_data,
250 	}
251 };
252 
253 /* This is the bluetooth LED on the device. */
254 
255 static struct gpiod_lookup_table n30_blue_led_gpio_table = {
256 	.dev_id = "s3c24xx_led.1",
257 	.table = {
258 		GPIO_LOOKUP("GPG", 6, NULL, GPIO_ACTIVE_HIGH),
259 		{ },
260 	},
261 };
262 
263 static struct s3c24xx_led_platdata n30_blue_led_pdata = {
264 	.name		= "blue_led",
265 	.def_trigger	= "",
266 };
267 
268 /* This is the blue LED on the device. Originally used to indicate GPS activity
269  * by flashing. */
270 
271 static struct gpiod_lookup_table n35_blue_led_gpio_table = {
272 	.dev_id = "s3c24xx_led.1",
273 	.table = {
274 		GPIO_LOOKUP("GPD", 8, NULL, GPIO_ACTIVE_HIGH),
275 		{ },
276 	},
277 };
278 
279 static struct s3c24xx_led_platdata n35_blue_led_pdata = {
280 	.name		= "blue_led",
281 	.def_trigger	= "",
282 };
283 
284 /* This LED is driven by the battery microcontroller, and is blinking
285  * red, blinking green or solid green when the battery is low,
286  * charging or full respectively.  By driving GPD9 low, it's possible
287  * to force the LED to blink red, so call that warning LED.  */
288 
289 static struct gpiod_lookup_table n30_warning_led_gpio_table = {
290 	.dev_id = "s3c24xx_led.2",
291 	.table = {
292 		GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW),
293 		{ },
294 	},
295 };
296 
297 static struct s3c24xx_led_platdata n30_warning_led_pdata = {
298 	.name		= "warning_led",
299 	.def_trigger	= "",
300 };
301 
302 static struct gpiod_lookup_table n35_warning_led_gpio_table = {
303 	.dev_id = "s3c24xx_led.2",
304 	.table = {
305 		GPIO_LOOKUP("GPD", 9, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
306 		{ },
307 	},
308 };
309 
310 static struct s3c24xx_led_platdata n35_warning_led_pdata = {
311 	.name		= "warning_led",
312 	.def_trigger	= "",
313 };
314 
315 static struct platform_device n30_blue_led = {
316 	.name		= "s3c24xx_led",
317 	.id		= 1,
318 	.dev		= {
319 		.platform_data	= &n30_blue_led_pdata,
320 	},
321 };
322 
323 static struct platform_device n35_blue_led = {
324 	.name		= "s3c24xx_led",
325 	.id		= 1,
326 	.dev		= {
327 		.platform_data	= &n35_blue_led_pdata,
328 	},
329 };
330 
331 static struct platform_device n30_warning_led = {
332 	.name		= "s3c24xx_led",
333 	.id		= 2,
334 	.dev		= {
335 		.platform_data	= &n30_warning_led_pdata,
336 	},
337 };
338 
339 static struct platform_device n35_warning_led = {
340 	.name		= "s3c24xx_led",
341 	.id		= 2,
342 	.dev		= {
343 		.platform_data	= &n35_warning_led_pdata,
344 	},
345 };
346 
347 static struct s3c2410fb_display n30_display __initdata = {
348 	.type		= S3C2410_LCDCON1_TFT,
349 	.width		= 240,
350 	.height		= 320,
351 	.pixclock	= 170000,
352 
353 	.xres		= 240,
354 	.yres		= 320,
355 	.bpp		= 16,
356 	.left_margin	= 3,
357 	.right_margin	= 40,
358 	.hsync_len	= 40,
359 	.upper_margin	= 2,
360 	.lower_margin	= 3,
361 	.vsync_len	= 2,
362 
363 	.lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME,
364 };
365 
366 static struct s3c2410fb_mach_info n30_fb_info __initdata = {
367 	.displays	= &n30_display,
368 	.num_displays	= 1,
369 	.default_display = 0,
370 	.lpcsel		= 0x06,
371 };
372 
n30_sdi_set_power(unsigned char power_mode,unsigned short vdd)373 static void n30_sdi_set_power(unsigned char power_mode, unsigned short vdd)
374 {
375 	s3c24xx_mci_def_set_power(power_mode, vdd);
376 
377 	switch (power_mode) {
378 	case MMC_POWER_ON:
379 	case MMC_POWER_UP:
380 		gpio_set_value(S3C2410_GPG(4), 1);
381 		break;
382 	case MMC_POWER_OFF:
383 	default:
384 		gpio_set_value(S3C2410_GPG(4), 0);
385 		break;
386 	}
387 }
388 
389 static struct s3c24xx_mci_pdata n30_mci_cfg __initdata = {
390 	.ocr_avail	= MMC_VDD_32_33,
391 	.set_power	= n30_sdi_set_power,
392 };
393 
394 static struct gpiod_lookup_table n30_mci_gpio_table = {
395 	.dev_id = "s3c2410-sdi",
396 	.table = {
397 		/* Card detect S3C2410_GPF(1) */
398 		GPIO_LOOKUP("GPIOF", 1, "cd", GPIO_ACTIVE_LOW),
399 		/* Write protect S3C2410_GPG(10) */
400 		GPIO_LOOKUP("GPIOG", 10, "wp", GPIO_ACTIVE_LOW),
401 		{ },
402 		/* bus pins */
403 		GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
404 		GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
405 		GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
406 		GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
407 		GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
408 		GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
409 	},
410 };
411 
412 static struct platform_device *n30_devices[] __initdata = {
413 	&s3c_device_lcd,
414 	&s3c_device_wdt,
415 	&s3c_device_i2c0,
416 	&s3c_device_iis,
417 	&s3c_device_ohci,
418 	&s3c_device_rtc,
419 	&s3c_device_usbgadget,
420 	&s3c_device_sdi,
421 	&n30_button_device,
422 	&n30_blue_led,
423 	&n30_warning_led,
424 };
425 
426 static struct platform_device *n35_devices[] __initdata = {
427 	&s3c_device_lcd,
428 	&s3c_device_wdt,
429 	&s3c_device_i2c0,
430 	&s3c_device_iis,
431 	&s3c_device_rtc,
432 	&s3c_device_usbgadget,
433 	&s3c_device_sdi,
434 	&n35_button_device,
435 	&n35_blue_led,
436 	&n35_warning_led,
437 };
438 
439 static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
440 	.flags		= 0,
441 	.slave_addr	= 0x10,
442 	.frequency	= 10*1000,
443 };
444 
445 /* Lots of hardcoded stuff, but it sets up the hardware in a useful
446  * state so that we can boot Linux directly from flash. */
n30_hwinit(void)447 static void __init n30_hwinit(void)
448 {
449 	/* GPA0-11 special functions -- unknown what they do
450 	 * GPA12 N30 special function -- unknown what it does
451 	 *       N35/PiN output -- unknown what it does
452 	 *
453 	 * A12 is nGCS1 on the N30 and an output on the N35/PiN.  I
454 	 * don't think it does anything useful on the N30, so I ought
455 	 * to make it an output there too since it always driven to 0
456 	 * as far as I can tell. */
457 	if (machine_is_n30())
458 		__raw_writel(0x007fffff, S3C2410_GPACON);
459 	if (machine_is_n35())
460 		__raw_writel(0x007fefff, S3C2410_GPACON);
461 	__raw_writel(0x00000000, S3C2410_GPADAT);
462 
463 	/* GPB0 TOUT0 backlight level
464 	 * GPB1 output 1=backlight on
465 	 * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled
466 	 * GPB3 output USB D+ pull up 0=disabled, 1=enabled
467 	 * GPB4 N30 output -- unknown function
468 	 *      N30/PiN GPS control 0=GPS enabled, 1=GPS disabled
469 	 * GPB5 output -- unknown function
470 	 * GPB6 input -- unknown function
471 	 * GPB7 output -- unknown function
472 	 * GPB8 output -- probably LCD driver enable
473 	 * GPB9 output -- probably LCD VSYNC driver enable
474 	 * GPB10 output -- probably LCD HSYNC driver enable
475 	 */
476 	__raw_writel(0x00154556, S3C2410_GPBCON);
477 	__raw_writel(0x00000750, S3C2410_GPBDAT);
478 	__raw_writel(0x00000073, S3C2410_GPBUP);
479 
480 	/* GPC0 input RS232 DCD/DSR/RI
481 	 * GPC1 LCD
482 	 * GPC2 output RS232 DTR?
483 	 * GPC3 input RS232 DCD/DSR/RI
484 	 * GPC4 LCD
485 	 * GPC5 output 0=NAND write enabled, 1=NAND write protect
486 	 * GPC6 input -- unknown function
487 	 * GPC7 input charger status 0=charger connected
488 	 *      this input can be triggered by power on the USB device
489 	 *      port too, but will go back to disconnected soon after.
490 	 * GPC8 N30/N35 output -- unknown function, always driven to 1
491 	 *      PiN input -- unknown function, always read as 1
492 	 *      Make it an input with a pull up for all models.
493 	 * GPC9-15 LCD
494 	 */
495 	__raw_writel(0xaaa80618, S3C2410_GPCCON);
496 	__raw_writel(0x0000014c, S3C2410_GPCDAT);
497 	__raw_writel(0x0000fef2, S3C2410_GPCUP);
498 
499 	/* GPD0 input -- unknown function
500 	 * GPD1-D7 LCD
501 	 * GPD8 N30 output -- unknown function
502 	 *      N35/PiN output 1=GPS LED on
503 	 * GPD9 output 0=power led blinks red, 1=normal power led function
504 	 * GPD10 output -- unknown function
505 	 * GPD11-15 LCD drivers
506 	 */
507 	__raw_writel(0xaa95aaa4, S3C2410_GPDCON);
508 	__raw_writel(0x00000601, S3C2410_GPDDAT);
509 	__raw_writel(0x0000fbfe, S3C2410_GPDUP);
510 
511 	/* GPE0-4 I2S audio bus
512 	 * GPE5-10 SD/MMC bus
513 	 * E11-13 outputs -- unknown function, probably power management
514 	 * E14-15 I2C bus connected to the battery controller
515 	 */
516 	__raw_writel(0xa56aaaaa, S3C2410_GPECON);
517 	__raw_writel(0x0000efc5, S3C2410_GPEDAT);
518 	__raw_writel(0x0000f81f, S3C2410_GPEUP);
519 
520 	/* GPF0  input 0=power button pressed
521 	 * GPF1  input SD/MMC switch 0=card present
522 	 * GPF2  N30 1=reset button pressed (inverted compared to the rest)
523 	 *	 N35/PiN 0=reset button pressed
524 	 * GPF3  N30/PiN input -- unknown function
525 	 *       N35 input GPS antenna position, 0=antenna closed, 1=open
526 	 * GPF4  input 0=button 4 pressed
527 	 * GPF5  input 0=button 3 pressed
528 	 * GPF6  input 0=button 2 pressed
529 	 * GPF7  input 0=button 1 pressed
530 	 */
531 	__raw_writel(0x0000aaaa, S3C2410_GPFCON);
532 	__raw_writel(0x00000000, S3C2410_GPFDAT);
533 	__raw_writel(0x000000ff, S3C2410_GPFUP);
534 
535 	/* GPG0  input RS232 DCD/DSR/RI
536 	 * GPG1  input 1=USB gadget port has power from a host
537 	 * GPG2  N30 input -- unknown function
538 	 *       N35/PiN input 0=headphones plugged in, 1=not plugged in
539 	 * GPG3  N30 output -- unknown function
540 	 *       N35/PiN input with unknown function
541 	 * GPG4  N30 output 0=MMC enabled, 1=MMC disabled
542 	 * GPG5  N30 output 0=BlueTooth chip disabled, 1=enabled
543 	 *       N35/PiN input joystick right
544 	 * GPG6  N30 output 0=blue led on, 1=off
545 	 *       N35/PiN input joystick left
546 	 * GPG7  input 0=thumbwheel pressed
547 	 * GPG8  input 0=thumbwheel down
548 	 * GPG9  input 0=thumbwheel up
549 	 * GPG10 input SD/MMC write protect switch
550 	 * GPG11 N30 input -- unknown function
551 	 *       N35 output 0=GPS antenna powered, 1=not powered
552 	 *       PiN output -- unknown function
553 	 * GPG12-15 touch screen functions
554 	 *
555 	 * The pullups differ between the models, so enable all
556 	 * pullups that are enabled on any of the models.
557 	 */
558 	if (machine_is_n30())
559 		__raw_writel(0xff0a956a, S3C2410_GPGCON);
560 	if (machine_is_n35())
561 		__raw_writel(0xff4aa92a, S3C2410_GPGCON);
562 	__raw_writel(0x0000e800, S3C2410_GPGDAT);
563 	__raw_writel(0x0000f86f, S3C2410_GPGUP);
564 
565 	/* GPH0/1/2/3 RS232 serial port
566 	 * GPH4/5 IrDA serial port
567 	 * GPH6/7  N30 BlueTooth serial port
568 	 *         N35/PiN GPS receiver
569 	 * GPH8 input -- unknown function
570 	 * GPH9 CLKOUT0 HCLK -- unknown use
571 	 * GPH10 CLKOUT1 FCLK -- unknown use
572 	 *
573 	 * The pull ups for H6/H7 are enabled on N30 but not on the
574 	 * N35/PiN.  I suppose is useful for a budget model of the N30
575 	 * with no bluetooth.  It doesn't hurt to have the pull ups
576 	 * enabled on the N35, so leave them enabled for all models.
577 	 */
578 	__raw_writel(0x0028aaaa, S3C2410_GPHCON);
579 	__raw_writel(0x000005ef, S3C2410_GPHDAT);
580 	__raw_writel(0x0000063f, S3C2410_GPHUP);
581 }
582 
n30_map_io(void)583 static void __init n30_map_io(void)
584 {
585 	s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
586 	n30_hwinit();
587 	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
588 	s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
589 }
590 
n30_init_time(void)591 static void __init n30_init_time(void)
592 {
593 	s3c2410_init_clocks(12000000);
594 	s3c24xx_timer_init();
595 }
596 
597 /* GPB3 is the line that controls the pull-up for the USB D+ line */
598 
n30_init(void)599 static void __init n30_init(void)
600 {
601 	WARN_ON(gpio_request(S3C2410_GPG(4), "mmc power"));
602 
603 	s3c24xx_fb_set_platdata(&n30_fb_info);
604 	gpiod_add_lookup_table(&n30_udc_gpio_table);
605 	s3c24xx_udc_set_platdata(&n30_udc_cfg);
606 	gpiod_add_lookup_table(&n30_mci_gpio_table);
607 	s3c24xx_mci_set_platdata(&n30_mci_cfg);
608 	s3c_i2c0_set_platdata(&n30_i2ccfg);
609 
610 	/* Turn off suspend on both USB ports, and switch the
611 	 * selectable USB port to USB device mode. */
612 
613 	s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
614 			      S3C2410_MISCCR_USBSUSPND0 |
615 			      S3C2410_MISCCR_USBSUSPND1, 0x0);
616 
617 	/* Configure the I2S pins (GPE0...GPE4) in correct mode */
618 	s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
619 			      S3C_GPIO_PULL_NONE);
620 
621 	if (machine_is_n30()) {
622 		/* Turn off suspend on both USB ports, and switch the
623 		 * selectable USB port to USB device mode. */
624 		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
625 				      S3C2410_MISCCR_USBSUSPND0 |
626 				      S3C2410_MISCCR_USBSUSPND1, 0x0);
627 
628 		/* Disable pull-up and add GPIO tables */
629 		s3c_gpio_setpull(S3C2410_GPG(6), S3C_GPIO_PULL_NONE);
630 		s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
631 		gpiod_add_lookup_table(&n30_blue_led_gpio_table);
632 		gpiod_add_lookup_table(&n30_warning_led_gpio_table);
633 
634 		platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices));
635 	}
636 
637 	if (machine_is_n35()) {
638 		/* Turn off suspend and switch the selectable USB port
639 		 * to USB device mode.  Turn on suspend for the host
640 		 * port since it is not connected on the N35.
641 		 *
642 		 * Actually, the host port is available at some pads
643 		 * on the back of the device, so it would actually be
644 		 * possible to add a USB device inside the N35 if you
645 		 * are willing to do some hardware modifications. */
646 		s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
647 				      S3C2410_MISCCR_USBSUSPND0 |
648 				      S3C2410_MISCCR_USBSUSPND1,
649 				      S3C2410_MISCCR_USBSUSPND0);
650 
651 		/* Disable pull-up and add GPIO tables */
652 		s3c_gpio_setpull(S3C2410_GPD(8), S3C_GPIO_PULL_NONE);
653 		s3c_gpio_setpull(S3C2410_GPD(9), S3C_GPIO_PULL_NONE);
654 		gpiod_add_lookup_table(&n35_blue_led_gpio_table);
655 		gpiod_add_lookup_table(&n35_warning_led_gpio_table);
656 
657 		platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices));
658 	}
659 }
660 
661 MACHINE_START(N30, "Acer-N30")
662 	/* Maintainer: Christer Weinigel <christer@weinigel.se>,
663 				Ben Dooks <ben-linux@fluff.org>
664 	*/
665 	.atag_offset	= 0x100,
666 	.nr_irqs	= NR_IRQS_S3C2410,
667 	.init_time	= n30_init_time,
668 	.init_machine	= n30_init,
669 	.init_irq	= s3c2410_init_irq,
670 	.map_io		= n30_map_io,
671 MACHINE_END
672 
673 MACHINE_START(N35, "Acer-N35")
674 	/* Maintainer: Christer Weinigel <christer@weinigel.se>
675 	*/
676 	.atag_offset	= 0x100,
677 	.nr_irqs	= NR_IRQS_S3C2410,
678 	.init_time	= n30_init_time,
679 	.init_machine	= n30_init,
680 	.init_irq	= s3c2410_init_irq,
681 	.map_io		= n30_map_io,
682 MACHINE_END
683