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