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