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