Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 1 | /* Machine specific code for the Acer n30, Acer N35, Navman PiN 570, |
| 2 | * Yakumo AlphaX and Airis NC05 PDAs. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (c) 2003-2005 Simtec Electronics |
| 5 | * Ben Dooks <ben@simtec.co.uk> |
| 6 | * |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 7 | * Copyright (c) 2005-2008 Christer Weinigel <christer@weinigel.se> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * |
| 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 Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 15 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
| 17 | #include <linux/kernel.h> |
| 18 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Christer Weinigel | 6206575 | 2008-07-07 18:12:43 +0100 | [diff] [blame] | 20 | #include <linux/gpio_keys.h> |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 21 | #include <linux/init.h> |
Christer Weinigel | 6206575 | 2008-07-07 18:12:43 +0100 | [diff] [blame] | 22 | #include <linux/input.h> |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/serial_core.h> |
| 26 | #include <linux/timer.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 27 | #include <linux/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 29 | #include <mach/hardware.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | #include <asm/irq.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 33 | #include <mach/fb.h> |
| 34 | #include <mach/leds-gpio.h> |
| 35 | #include <mach/regs-gpio.h> |
| 36 | #include <mach/regs-lcd.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 38 | #include <asm/mach/arch.h> |
| 39 | #include <asm/mach/irq.h> |
| 40 | #include <asm/mach/map.h> |
| 41 | |
Ben Dooks | 9498cb7 | 2008-10-30 10:14:33 +0000 | [diff] [blame] | 42 | #include <plat/iic.h> |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 43 | #include <plat/regs-serial.h> |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 44 | |
Ben Dooks | d5120ae | 2008-10-07 23:09:51 +0100 | [diff] [blame] | 45 | #include <plat/clock.h> |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 46 | #include <plat/cpu.h> |
| 47 | #include <plat/devs.h> |
| 48 | #include <plat/s3c2410.h> |
Ben Dooks | 57bd4b9 | 2008-10-30 10:14:37 +0000 | [diff] [blame] | 49 | #include <plat/udc.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
| 51 | static struct map_desc n30_iodesc[] __initdata = { |
| 52 | /* nothing here yet */ |
| 53 | }; |
| 54 | |
| 55 | static struct s3c2410_uartcfg n30_uartcfgs[] = { |
| 56 | /* Normal serial port */ |
| 57 | [0] = { |
| 58 | .hwport = 0, |
| 59 | .flags = 0, |
| 60 | .ucon = 0x2c5, |
| 61 | .ulcon = 0x03, |
| 62 | .ufcon = 0x51, |
| 63 | }, |
| 64 | /* IR port */ |
| 65 | [1] = { |
| 66 | .hwport = 1, |
| 67 | .flags = 0, |
| 68 | .uart_flags = UPF_CONS_FLOW, |
| 69 | .ucon = 0x2c5, |
| 70 | .ulcon = 0x43, |
| 71 | .ufcon = 0x51, |
| 72 | }, |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 73 | /* On the N30 the bluetooth controller is connected here. |
| 74 | * On the N35 and variants the GPS receiver is connected here. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | [2] = { |
| 76 | .hwport = 2, |
| 77 | .flags = 0, |
| 78 | .ucon = 0x2c5, |
| 79 | .ulcon = 0x03, |
| 80 | .ufcon = 0x51, |
| 81 | }, |
| 82 | }; |
| 83 | |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame] | 84 | static void n30_udc_pullup(enum s3c2410_udc_cmd_e cmd) |
| 85 | { |
Ben Dooks | a675578 | 2008-07-07 18:12:48 +0100 | [diff] [blame] | 86 | switch (cmd) { |
| 87 | case S3C2410_UDC_P_ENABLE : |
| 88 | s3c2410_gpio_setpin(S3C2410_GPB3, 1); |
| 89 | break; |
| 90 | case S3C2410_UDC_P_DISABLE : |
| 91 | s3c2410_gpio_setpin(S3C2410_GPB3, 0); |
| 92 | break; |
| 93 | case S3C2410_UDC_P_RESET : |
| 94 | break; |
| 95 | default: |
| 96 | break; |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame] | 97 | } |
| 98 | } |
| 99 | |
| 100 | static struct s3c2410_udc_mach_info n30_udc_cfg __initdata = { |
| 101 | .udc_command = n30_udc_pullup, |
| 102 | .vbus_pin = S3C2410_GPG1, |
| 103 | .vbus_pin_inverted = 0, |
| 104 | }; |
| 105 | |
Christer Weinigel | 6206575 | 2008-07-07 18:12:43 +0100 | [diff] [blame] | 106 | static struct gpio_keys_button n30_buttons[] = { |
| 107 | { |
| 108 | .gpio = S3C2410_GPF0, |
| 109 | .code = KEY_POWER, |
| 110 | .desc = "Power", |
| 111 | .active_low = 0, |
| 112 | }, |
| 113 | { |
| 114 | .gpio = S3C2410_GPG9, |
| 115 | .code = KEY_UP, |
| 116 | .desc = "Thumbwheel Up", |
| 117 | .active_low = 0, |
| 118 | }, |
| 119 | { |
| 120 | .gpio = S3C2410_GPG8, |
| 121 | .code = KEY_DOWN, |
| 122 | .desc = "Thumbwheel Down", |
| 123 | .active_low = 0, |
| 124 | }, |
| 125 | { |
| 126 | .gpio = S3C2410_GPG7, |
| 127 | .code = KEY_ENTER, |
| 128 | .desc = "Thumbwheel Press", |
| 129 | .active_low = 0, |
| 130 | }, |
| 131 | { |
| 132 | .gpio = S3C2410_GPF7, |
| 133 | .code = KEY_HOMEPAGE, |
| 134 | .desc = "Home", |
| 135 | .active_low = 0, |
| 136 | }, |
| 137 | { |
| 138 | .gpio = S3C2410_GPF6, |
| 139 | .code = KEY_CALENDAR, |
| 140 | .desc = "Calendar", |
| 141 | .active_low = 0, |
| 142 | }, |
| 143 | { |
| 144 | .gpio = S3C2410_GPF5, |
| 145 | .code = KEY_ADDRESSBOOK, |
| 146 | .desc = "Contacts", |
| 147 | .active_low = 0, |
| 148 | }, |
| 149 | { |
| 150 | .gpio = S3C2410_GPF4, |
| 151 | .code = KEY_MAIL, |
| 152 | .desc = "Mail", |
| 153 | .active_low = 0, |
| 154 | }, |
| 155 | }; |
| 156 | |
| 157 | static struct gpio_keys_platform_data n30_button_data = { |
| 158 | .buttons = n30_buttons, |
| 159 | .nbuttons = ARRAY_SIZE(n30_buttons), |
| 160 | }; |
| 161 | |
| 162 | static struct platform_device n30_button_device = { |
| 163 | .name = "gpio-keys", |
| 164 | .id = -1, |
| 165 | .dev = { |
| 166 | .platform_data = &n30_button_data, |
| 167 | } |
| 168 | }; |
| 169 | |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 170 | static struct gpio_keys_button n35_buttons[] = { |
| 171 | { |
| 172 | .gpio = S3C2410_GPF0, |
| 173 | .code = KEY_POWER, |
| 174 | .desc = "Power", |
| 175 | .active_low = 0, |
| 176 | }, |
| 177 | { |
| 178 | .gpio = S3C2410_GPG9, |
| 179 | .code = KEY_UP, |
| 180 | .desc = "Joystick Up", |
| 181 | .active_low = 0, |
| 182 | }, |
| 183 | { |
| 184 | .gpio = S3C2410_GPG8, |
| 185 | .code = KEY_DOWN, |
| 186 | .desc = "Joystick Down", |
| 187 | .active_low = 0, |
| 188 | }, |
| 189 | { |
| 190 | .gpio = S3C2410_GPG6, |
| 191 | .code = KEY_DOWN, |
| 192 | .desc = "Joystick Left", |
| 193 | .active_low = 0, |
| 194 | }, |
| 195 | { |
| 196 | .gpio = S3C2410_GPG5, |
| 197 | .code = KEY_DOWN, |
| 198 | .desc = "Joystick Right", |
| 199 | .active_low = 0, |
| 200 | }, |
| 201 | { |
| 202 | .gpio = S3C2410_GPG7, |
| 203 | .code = KEY_ENTER, |
| 204 | .desc = "Joystick Press", |
| 205 | .active_low = 0, |
| 206 | }, |
| 207 | { |
| 208 | .gpio = S3C2410_GPF7, |
| 209 | .code = KEY_HOMEPAGE, |
| 210 | .desc = "Home", |
| 211 | .active_low = 0, |
| 212 | }, |
| 213 | { |
| 214 | .gpio = S3C2410_GPF6, |
| 215 | .code = KEY_CALENDAR, |
| 216 | .desc = "Calendar", |
| 217 | .active_low = 0, |
| 218 | }, |
| 219 | { |
| 220 | .gpio = S3C2410_GPF5, |
| 221 | .code = KEY_ADDRESSBOOK, |
| 222 | .desc = "Contacts", |
| 223 | .active_low = 0, |
| 224 | }, |
| 225 | { |
| 226 | .gpio = S3C2410_GPF4, |
| 227 | .code = KEY_MAIL, |
| 228 | .desc = "Mail", |
| 229 | .active_low = 0, |
| 230 | }, |
| 231 | { |
| 232 | .gpio = S3C2410_GPF3, |
| 233 | .code = SW_RADIO, |
| 234 | .desc = "GPS Antenna", |
| 235 | .active_low = 0, |
| 236 | }, |
| 237 | { |
| 238 | .gpio = S3C2410_GPG2, |
| 239 | .code = SW_HEADPHONE_INSERT, |
| 240 | .desc = "Headphone", |
| 241 | .active_low = 0, |
| 242 | }, |
| 243 | }; |
| 244 | |
| 245 | static struct gpio_keys_platform_data n35_button_data = { |
| 246 | .buttons = n35_buttons, |
| 247 | .nbuttons = ARRAY_SIZE(n35_buttons), |
| 248 | }; |
| 249 | |
| 250 | static struct platform_device n35_button_device = { |
| 251 | .name = "gpio-keys", |
| 252 | .id = -1, |
| 253 | .num_resources = 0, |
| 254 | .dev = { |
| 255 | .platform_data = &n35_button_data, |
| 256 | } |
| 257 | }; |
| 258 | |
Christer Weinigel | 865cc63 | 2008-07-07 18:12:44 +0100 | [diff] [blame] | 259 | /* This is the bluetooth LED on the device. */ |
| 260 | static struct s3c24xx_led_platdata n30_blue_led_pdata = { |
| 261 | .name = "blue_led", |
| 262 | .gpio = S3C2410_GPG6, |
| 263 | .def_trigger = "", |
| 264 | }; |
| 265 | |
| 266 | /* This LED is driven by the battery microcontroller, and is blinking |
| 267 | * red, blinking green or solid green when the battery is low, |
| 268 | * charging or full respectively. By driving GPD9 low, it's possible |
| 269 | * to force the LED to blink red, so call that warning LED. */ |
| 270 | static struct s3c24xx_led_platdata n30_warning_led_pdata = { |
| 271 | .name = "warning_led", |
| 272 | .flags = S3C24XX_LEDF_ACTLOW, |
| 273 | .gpio = S3C2410_GPD9, |
| 274 | .def_trigger = "", |
| 275 | }; |
| 276 | |
| 277 | static struct platform_device n30_blue_led = { |
| 278 | .name = "s3c24xx_led", |
| 279 | .id = 1, |
| 280 | .dev = { |
| 281 | .platform_data = &n30_blue_led_pdata, |
| 282 | }, |
| 283 | }; |
| 284 | |
| 285 | static struct platform_device n30_warning_led = { |
| 286 | .name = "s3c24xx_led", |
| 287 | .id = 2, |
| 288 | .dev = { |
| 289 | .platform_data = &n30_warning_led_pdata, |
| 290 | }, |
| 291 | }; |
| 292 | |
Christer Weinigel | e43f238 | 2008-07-07 18:12:46 +0100 | [diff] [blame] | 293 | static struct s3c2410fb_display n30_display __initdata = { |
Ben Dooks | a675578 | 2008-07-07 18:12:48 +0100 | [diff] [blame] | 294 | .type = S3C2410_LCDCON1_TFT, |
| 295 | .width = 240, |
| 296 | .height = 320, |
| 297 | .pixclock = 170000, |
| 298 | |
| 299 | .xres = 240, |
| 300 | .yres = 320, |
| 301 | .bpp = 16, |
| 302 | .left_margin = 3, |
| 303 | .right_margin = 40, |
| 304 | .hsync_len = 40, |
| 305 | .upper_margin = 2, |
| 306 | .lower_margin = 3, |
| 307 | .vsync_len = 2, |
Christer Weinigel | e43f238 | 2008-07-07 18:12:46 +0100 | [diff] [blame] | 308 | |
| 309 | .lcdcon5 = S3C2410_LCDCON5_INVVLINE | S3C2410_LCDCON5_INVVFRAME, |
| 310 | }; |
| 311 | |
| 312 | static struct s3c2410fb_mach_info n30_fb_info __initdata = { |
Ben Dooks | a675578 | 2008-07-07 18:12:48 +0100 | [diff] [blame] | 313 | .displays = &n30_display, |
| 314 | .num_displays = 1, |
Christer Weinigel | e43f238 | 2008-07-07 18:12:46 +0100 | [diff] [blame] | 315 | .default_display = 0, |
Ben Dooks | a675578 | 2008-07-07 18:12:48 +0100 | [diff] [blame] | 316 | .lpcsel = 0x06, |
Christer Weinigel | e43f238 | 2008-07-07 18:12:46 +0100 | [diff] [blame] | 317 | }; |
| 318 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | static struct platform_device *n30_devices[] __initdata = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | &s3c_device_lcd, |
| 321 | &s3c_device_wdt, |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 322 | &s3c_device_i2c0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | &s3c_device_iis, |
Christer Weinigel | 196a047 | 2008-07-07 18:12:41 +0100 | [diff] [blame] | 324 | &s3c_device_usb, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | &s3c_device_usbgadget, |
Christer Weinigel | 6206575 | 2008-07-07 18:12:43 +0100 | [diff] [blame] | 326 | &n30_button_device, |
Christer Weinigel | 865cc63 | 2008-07-07 18:12:44 +0100 | [diff] [blame] | 327 | &n30_blue_led, |
| 328 | &n30_warning_led, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | }; |
| 330 | |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 331 | static struct platform_device *n35_devices[] __initdata = { |
| 332 | &s3c_device_lcd, |
| 333 | &s3c_device_wdt, |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 334 | &s3c_device_i2c0, |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 335 | &s3c_device_iis, |
| 336 | &s3c_device_usbgadget, |
| 337 | &n35_button_device, |
| 338 | }; |
| 339 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 340 | static struct s3c2410_platform_i2c n30_i2ccfg = { |
| 341 | .flags = 0, |
| 342 | .slave_addr = 0x10, |
| 343 | .bus_freq = 10*1000, |
| 344 | .max_freq = 10*1000, |
| 345 | }; |
| 346 | |
Christer Weinigel | 9a2ddb7 | 2008-07-07 18:12:47 +0100 | [diff] [blame] | 347 | /* Lots of hardcoded stuff, but it sets up the hardware in a useful |
| 348 | * state so that we can boot Linux directly from flash. */ |
| 349 | static void __init n30_hwinit(void) |
| 350 | { |
| 351 | /* GPA0-11 special functions -- unknown what they do |
| 352 | * GPA12 N30 special function -- unknown what it does |
| 353 | * N35/PiN output -- unknown what it does |
| 354 | * |
| 355 | * A12 is nGCS1 on the N30 and an output on the N35/PiN. I |
| 356 | * don't think it does anything useful on the N30, so I ought |
| 357 | * to make it an output there too since it always driven to 0 |
| 358 | * as far as I can tell. */ |
| 359 | if (machine_is_n30()) |
| 360 | __raw_writel(0x007fffff, S3C2410_GPACON); |
| 361 | if (machine_is_n35()) |
| 362 | __raw_writel(0x007fefff, S3C2410_GPACON); |
| 363 | __raw_writel(0x00000000, S3C2410_GPADAT); |
| 364 | |
| 365 | /* GPB0 TOUT0 backlight level |
| 366 | * GPB1 output 1=backlight on |
| 367 | * GPB2 output IrDA enable 0=transceiver enabled, 1=disabled |
| 368 | * GPB3 output USB D+ pull up 0=disabled, 1=enabled |
| 369 | * GPB4 N30 output -- unknown function |
| 370 | * N30/PiN GPS control 0=GPS enabled, 1=GPS disabled |
| 371 | * GPB5 output -- unknown function |
| 372 | * GPB6 input -- unknown function |
| 373 | * GPB7 output -- unknown function |
| 374 | * GPB8 output -- probably LCD driver enable |
| 375 | * GPB9 output -- probably LCD VSYNC driver enable |
| 376 | * GPB10 output -- probably LCD HSYNC driver enable |
| 377 | */ |
| 378 | __raw_writel(0x00154556, S3C2410_GPBCON); |
| 379 | __raw_writel(0x00000750, S3C2410_GPBDAT); |
| 380 | __raw_writel(0x00000073, S3C2410_GPBUP); |
| 381 | |
| 382 | /* GPC0 input RS232 DCD/DSR/RI |
| 383 | * GPC1 LCD |
| 384 | * GPC2 output RS232 DTR? |
| 385 | * GPC3 input RS232 DCD/DSR/RI |
| 386 | * GPC4 LCD |
| 387 | * GPC5 output 0=NAND write enabled, 1=NAND write protect |
| 388 | * GPC6 input -- unknown function |
| 389 | * GPC7 input charger status 0=charger connected |
| 390 | * this input can be triggered by power on the USB device |
| 391 | * port too, but will go back to disconnected soon after. |
| 392 | * GPC8 N30/N35 output -- unknown function, always driven to 1 |
| 393 | * PiN input -- unknown function, always read as 1 |
| 394 | * Make it an input with a pull up for all models. |
| 395 | * GPC9-15 LCD |
| 396 | */ |
| 397 | __raw_writel(0xaaa80618, S3C2410_GPCCON); |
| 398 | __raw_writel(0x0000014c, S3C2410_GPCDAT); |
| 399 | __raw_writel(0x0000fef2, S3C2410_GPCUP); |
| 400 | |
| 401 | /* GPD0 input -- unknown function |
| 402 | * GPD1-D7 LCD |
| 403 | * GPD8 N30 output -- unknown function |
| 404 | * N35/PiN output 1=GPS LED on |
| 405 | * GPD9 output 0=power led blinks red, 1=normal power led function |
| 406 | * GPD10 output -- unknown function |
| 407 | * GPD11-15 LCD drivers |
| 408 | */ |
| 409 | __raw_writel(0xaa95aaa4, S3C2410_GPDCON); |
| 410 | __raw_writel(0x00000601, S3C2410_GPDDAT); |
| 411 | __raw_writel(0x0000fbfe, S3C2410_GPDUP); |
| 412 | |
| 413 | /* GPE0-4 I2S audio bus |
| 414 | * GPE5-10 SD/MMC bus |
| 415 | * E11-13 outputs -- unknown function, probably power management |
| 416 | * E14-15 I2C bus connected to the battery controller |
| 417 | */ |
| 418 | __raw_writel(0xa56aaaaa, S3C2410_GPECON); |
| 419 | __raw_writel(0x0000efc5, S3C2410_GPEDAT); |
| 420 | __raw_writel(0x0000f81f, S3C2410_GPEUP); |
| 421 | |
| 422 | /* GPF0 input 0=power button pressed |
| 423 | * GPF1 input SD/MMC switch 0=card present |
| 424 | * GPF2 N30 1=reset button pressed (inverted compared to the rest) |
| 425 | * N35/PiN 0=reset button pressed |
| 426 | * GPF3 N30/PiN input -- unknown function |
| 427 | * N35 input GPS antenna position, 0=antenna closed, 1=open |
| 428 | * GPF4 input 0=button 4 pressed |
| 429 | * GPF5 input 0=button 3 pressed |
| 430 | * GPF6 input 0=button 2 pressed |
| 431 | * GPF7 input 0=button 1 pressed |
| 432 | */ |
| 433 | __raw_writel(0x0000aaaa, S3C2410_GPFCON); |
| 434 | __raw_writel(0x00000000, S3C2410_GPFDAT); |
| 435 | __raw_writel(0x000000ff, S3C2410_GPFUP); |
| 436 | |
| 437 | /* GPG0 input RS232 DCD/DSR/RI |
| 438 | * GPG1 input 1=USB gadget port has power from a host |
| 439 | * GPG2 N30 input -- unknown function |
| 440 | * N35/PiN input 0=headphones plugged in, 1=not plugged in |
| 441 | * GPG3 N30 output -- unknown function |
| 442 | * N35/PiN input with unknown function |
| 443 | * GPG4 N30 output 0=MMC enabled, 1=MMC disabled |
| 444 | * GPG5 N30 output 0=BlueTooth chip disabled, 1=enabled |
| 445 | * N35/PiN input joystick right |
| 446 | * GPG6 N30 output 0=blue led on, 1=off |
| 447 | * N35/PiN input joystick left |
| 448 | * GPG7 input 0=thumbwheel pressed |
| 449 | * GPG8 input 0=thumbwheel down |
| 450 | * GPG9 input 0=thumbwheel up |
| 451 | * GPG10 input SD/MMC write protect switch |
| 452 | * GPG11 N30 input -- unknown function |
| 453 | * N35 output 0=GPS antenna powered, 1=not powered |
| 454 | * PiN output -- unknown function |
| 455 | * GPG12-15 touch screen functions |
| 456 | * |
| 457 | * The pullups differ between the models, so enable all |
| 458 | * pullups that are enabled on any of the models. |
| 459 | */ |
| 460 | if (machine_is_n30()) |
| 461 | __raw_writel(0xff0a956a, S3C2410_GPGCON); |
| 462 | if (machine_is_n35()) |
| 463 | __raw_writel(0xff4aa92a, S3C2410_GPGCON); |
| 464 | __raw_writel(0x0000e800, S3C2410_GPGDAT); |
| 465 | __raw_writel(0x0000f86f, S3C2410_GPGUP); |
| 466 | |
| 467 | /* GPH0/1/2/3 RS232 serial port |
| 468 | * GPH4/5 IrDA serial port |
| 469 | * GPH6/7 N30 BlueTooth serial port |
| 470 | * N35/PiN GPS receiver |
| 471 | * GPH8 input -- unknown function |
| 472 | * GPH9 CLKOUT0 HCLK -- unknown use |
| 473 | * GPH10 CLKOUT1 FCLK -- unknown use |
| 474 | * |
| 475 | * The pull ups for H6/H7 are enabled on N30 but not on the |
| 476 | * N35/PiN. I suppose is useful for a budget model of the N30 |
| 477 | * with no bluetooh. It doesn't hurt to have the pull ups |
| 478 | * enabled on the N35, so leave them enabled for all models. |
| 479 | */ |
| 480 | __raw_writel(0x0028aaaa, S3C2410_GPHCON); |
| 481 | __raw_writel(0x000005ef, S3C2410_GPHDAT); |
| 482 | __raw_writel(0x0000063f, S3C2410_GPHUP); |
| 483 | } |
| 484 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 485 | static void __init n30_map_io(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | { |
| 487 | s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc)); |
Christer Weinigel | 9a2ddb7 | 2008-07-07 18:12:47 +0100 | [diff] [blame] | 488 | n30_hwinit(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | s3c24xx_init_clocks(0); |
| 490 | s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | } |
| 492 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 493 | static void __init n30_init_irq(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | { |
| 495 | s3c24xx_init_irq(); |
| 496 | } |
| 497 | |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 498 | /* GPB3 is the line that controls the pull-up for the USB D+ line */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 500 | static void __init n30_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | { |
Christer Weinigel | e43f238 | 2008-07-07 18:12:46 +0100 | [diff] [blame] | 502 | s3c24xx_fb_set_platdata(&n30_fb_info); |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 503 | s3c_device_i2c0.dev.platform_data = &n30_i2ccfg; |
Christer Weinigel | d088e5f | 2008-07-07 18:12:42 +0100 | [diff] [blame] | 504 | s3c24xx_udc_set_platdata(&n30_udc_cfg); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 506 | /* Turn off suspend on both USB ports, and switch the |
| 507 | * selectable USB port to USB device mode. */ |
| 508 | |
| 509 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
| 510 | S3C2410_MISCCR_USBSUSPND0 | |
| 511 | S3C2410_MISCCR_USBSUSPND1, 0x0); |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 512 | |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 513 | if (machine_is_n30()) { |
| 514 | /* Turn off suspend on both USB ports, and switch the |
| 515 | * selectable USB port to USB device mode. */ |
| 516 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
| 517 | S3C2410_MISCCR_USBSUSPND0 | |
| 518 | S3C2410_MISCCR_USBSUSPND1, 0x0); |
| 519 | |
| 520 | platform_add_devices(n30_devices, ARRAY_SIZE(n30_devices)); |
| 521 | } |
| 522 | |
| 523 | if (machine_is_n35()) { |
| 524 | /* Turn off suspend and switch the selectable USB port |
| 525 | * to USB device mode. Turn on suspend for the host |
| 526 | * port since it is not connected on the N35. |
| 527 | * |
| 528 | * Actually, the host port is available at some pads |
| 529 | * on the back of the device, so it would actually be |
| 530 | * possible to add a USB device inside the N35 if you |
| 531 | * are willing to do some hardware modifications. */ |
| 532 | s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST | |
| 533 | S3C2410_MISCCR_USBSUSPND0 | |
| 534 | S3C2410_MISCCR_USBSUSPND1, |
| 535 | S3C2410_MISCCR_USBSUSPND1); |
| 536 | |
| 537 | platform_add_devices(n35_devices, ARRAY_SIZE(n35_devices)); |
| 538 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | } |
| 540 | |
| 541 | MACHINE_START(N30, "Acer-N30") |
Ben Dooks | 027da01 | 2005-09-05 20:47:53 +0100 | [diff] [blame] | 542 | /* Maintainer: Christer Weinigel <christer@weinigel.se>, |
| 543 | Ben Dooks <ben-linux@fluff.org> |
| 544 | */ |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 545 | .phys_io = S3C2410_PA_UART, |
| 546 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
| 547 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | .timer = &s3c24xx_timer, |
| 549 | .init_machine = n30_init, |
| 550 | .init_irq = n30_init_irq, |
| 551 | .map_io = n30_map_io, |
| 552 | MACHINE_END |
Christer Weinigel | 9579087 | 2008-07-07 18:12:45 +0100 | [diff] [blame] | 553 | |
| 554 | MACHINE_START(N35, "Acer-N35") |
| 555 | /* Maintainer: Christer Weinigel <christer@weinigel.se> |
| 556 | */ |
| 557 | .phys_io = S3C2410_PA_UART, |
| 558 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
| 559 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
| 560 | .timer = &s3c24xx_timer, |
| 561 | .init_machine = n30_init, |
| 562 | .init_irq = n30_init_irq, |
| 563 | .map_io = n30_map_io, |
| 564 | MACHINE_END |