Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5pv210/mach-goni.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/serial_core.h> |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 15 | #include <linux/fb.h> |
Marek Szyprowski | ba149f3 | 2010-07-14 19:39:47 +0900 | [diff] [blame^] | 16 | #include <linux/i2c.h> |
| 17 | #include <linux/i2c-gpio.h> |
| 18 | #include <linux/mfd/max8998.h> |
| 19 | #include <linux/gpio_keys.h> |
| 20 | #include <linux/input.h> |
| 21 | #include <linux/gpio.h> |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 22 | |
| 23 | #include <asm/mach/arch.h> |
| 24 | #include <asm/mach/map.h> |
| 25 | #include <asm/setup.h> |
| 26 | #include <asm/mach-types.h> |
| 27 | |
| 28 | #include <mach/map.h> |
| 29 | #include <mach/regs-clock.h> |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 30 | #include <mach/regs-fb.h> |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 31 | |
Marek Szyprowski | ba149f3 | 2010-07-14 19:39:47 +0900 | [diff] [blame^] | 32 | #include <plat/gpio-cfg.h> |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 33 | #include <plat/regs-serial.h> |
| 34 | #include <plat/s5pv210.h> |
| 35 | #include <plat/devs.h> |
| 36 | #include <plat/cpu.h> |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 37 | #include <plat/fb.h> |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 38 | |
| 39 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 40 | #define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| 41 | S3C2410_UCON_RXILEVEL | \ |
| 42 | S3C2410_UCON_TXIRQMODE | \ |
| 43 | S3C2410_UCON_RXIRQMODE | \ |
| 44 | S3C2410_UCON_RXFIFO_TOI | \ |
| 45 | S3C2443_UCON_RXERR_IRQEN) |
| 46 | |
| 47 | #define S5PV210_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 48 | |
Joonyoung Shim | bbf7b35 | 2010-06-24 19:28:55 +0900 | [diff] [blame] | 49 | #define S5PV210_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 50 | |
| 51 | static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = { |
| 52 | [0] = { |
| 53 | .hwport = 0, |
| 54 | .flags = 0, |
| 55 | .ucon = S5PV210_UCON_DEFAULT, |
| 56 | .ulcon = S5PV210_ULCON_DEFAULT, |
Joonyoung Shim | bbf7b35 | 2010-06-24 19:28:55 +0900 | [diff] [blame] | 57 | .ufcon = S5PV210_UFCON_DEFAULT | |
| 58 | S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256, |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 59 | }, |
| 60 | [1] = { |
| 61 | .hwport = 1, |
| 62 | .flags = 0, |
| 63 | .ucon = S5PV210_UCON_DEFAULT, |
| 64 | .ulcon = S5PV210_ULCON_DEFAULT, |
Joonyoung Shim | bbf7b35 | 2010-06-24 19:28:55 +0900 | [diff] [blame] | 65 | .ufcon = S5PV210_UFCON_DEFAULT | |
| 66 | S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64, |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 67 | }, |
| 68 | [2] = { |
| 69 | .hwport = 2, |
| 70 | .flags = 0, |
| 71 | .ucon = S5PV210_UCON_DEFAULT, |
| 72 | .ulcon = S5PV210_ULCON_DEFAULT, |
Joonyoung Shim | bbf7b35 | 2010-06-24 19:28:55 +0900 | [diff] [blame] | 73 | .ufcon = S5PV210_UFCON_DEFAULT | |
| 74 | S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16, |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 75 | }, |
| 76 | [3] = { |
| 77 | .hwport = 3, |
| 78 | .flags = 0, |
| 79 | .ucon = S5PV210_UCON_DEFAULT, |
| 80 | .ulcon = S5PV210_ULCON_DEFAULT, |
Joonyoung Shim | bbf7b35 | 2010-06-24 19:28:55 +0900 | [diff] [blame] | 81 | .ufcon = S5PV210_UFCON_DEFAULT | |
| 82 | S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16, |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 83 | }, |
| 84 | }; |
| 85 | |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 86 | /* Frame Buffer */ |
| 87 | static struct s3c_fb_pd_win goni_fb_win0 = { |
| 88 | .win_mode = { |
| 89 | .pixclock = 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*55), |
| 90 | .left_margin = 16, |
| 91 | .right_margin = 16, |
| 92 | .upper_margin = 3, |
| 93 | .lower_margin = 28, |
| 94 | .hsync_len = 2, |
| 95 | .vsync_len = 2, |
| 96 | .xres = 480, |
| 97 | .yres = 800, |
| 98 | .refresh = 55, |
| 99 | }, |
| 100 | .max_bpp = 32, |
| 101 | .default_bpp = 16, |
| 102 | }; |
| 103 | |
| 104 | static struct s3c_fb_platdata goni_lcd_pdata __initdata = { |
| 105 | .win[0] = &goni_fb_win0, |
| 106 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB | |
| 107 | VIDCON0_CLKSEL_LCD, |
| 108 | .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN |
| 109 | | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, |
| 110 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, |
| 111 | }; |
| 112 | |
Marek Szyprowski | ba149f3 | 2010-07-14 19:39:47 +0900 | [diff] [blame^] | 113 | /* MAX8998 regulators */ |
| 114 | #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE) |
| 115 | |
| 116 | static struct regulator_init_data goni_ldo2_data = { |
| 117 | .constraints = { |
| 118 | .name = "VALIVE_1.1V", |
| 119 | .min_uV = 1100000, |
| 120 | .max_uV = 1100000, |
| 121 | .apply_uV = 1, |
| 122 | .always_on = 1, |
| 123 | .state_mem = { |
| 124 | .enabled = 1, |
| 125 | }, |
| 126 | }, |
| 127 | }; |
| 128 | |
| 129 | static struct regulator_init_data goni_ldo3_data = { |
| 130 | .constraints = { |
| 131 | .name = "VUSB/MIPI_1.1V", |
| 132 | .min_uV = 1100000, |
| 133 | .max_uV = 1100000, |
| 134 | .apply_uV = 1, |
| 135 | .always_on = 1, |
| 136 | }, |
| 137 | }; |
| 138 | |
| 139 | static struct regulator_init_data goni_ldo4_data = { |
| 140 | .constraints = { |
| 141 | .name = "VDAC_3.3V", |
| 142 | .min_uV = 3300000, |
| 143 | .max_uV = 3300000, |
| 144 | .apply_uV = 1, |
| 145 | }, |
| 146 | }; |
| 147 | |
| 148 | static struct regulator_init_data goni_ldo5_data = { |
| 149 | .constraints = { |
| 150 | .name = "VTF_2.8V", |
| 151 | .min_uV = 2800000, |
| 152 | .max_uV = 2800000, |
| 153 | .apply_uV = 1, |
| 154 | }, |
| 155 | }; |
| 156 | |
| 157 | static struct regulator_init_data goni_ldo6_data = { |
| 158 | .constraints = { |
| 159 | .name = "VCC_3.3V", |
| 160 | .min_uV = 3300000, |
| 161 | .max_uV = 3300000, |
| 162 | .apply_uV = 1, |
| 163 | }, |
| 164 | }; |
| 165 | |
| 166 | static struct regulator_init_data goni_ldo7_data = { |
| 167 | .constraints = { |
| 168 | .name = "VLCD_1.8V", |
| 169 | .min_uV = 1800000, |
| 170 | .max_uV = 1800000, |
| 171 | .apply_uV = 1, |
| 172 | .always_on = 1, |
| 173 | }, |
| 174 | }; |
| 175 | |
| 176 | static struct regulator_init_data goni_ldo8_data = { |
| 177 | .constraints = { |
| 178 | .name = "VUSB/VADC_3.3V", |
| 179 | .min_uV = 3300000, |
| 180 | .max_uV = 3300000, |
| 181 | .apply_uV = 1, |
| 182 | .always_on = 1, |
| 183 | }, |
| 184 | }; |
| 185 | |
| 186 | static struct regulator_init_data goni_ldo9_data = { |
| 187 | .constraints = { |
| 188 | .name = "VCC/VCAM_2.8V", |
| 189 | .min_uV = 2800000, |
| 190 | .max_uV = 2800000, |
| 191 | .apply_uV = 1, |
| 192 | .always_on = 1, |
| 193 | }, |
| 194 | }; |
| 195 | |
| 196 | static struct regulator_init_data goni_ldo10_data = { |
| 197 | .constraints = { |
| 198 | .name = "VPLL_1.1V", |
| 199 | .min_uV = 1100000, |
| 200 | .max_uV = 1100000, |
| 201 | .apply_uV = 1, |
| 202 | .boot_on = 1, |
| 203 | }, |
| 204 | }; |
| 205 | |
| 206 | static struct regulator_init_data goni_ldo11_data = { |
| 207 | .constraints = { |
| 208 | .name = "CAM_IO_2.8V", |
| 209 | .min_uV = 2800000, |
| 210 | .max_uV = 2800000, |
| 211 | .apply_uV = 1, |
| 212 | .always_on = 1, |
| 213 | }, |
| 214 | }; |
| 215 | |
| 216 | static struct regulator_init_data goni_ldo12_data = { |
| 217 | .constraints = { |
| 218 | .name = "CAM_ISP_1.2V", |
| 219 | .min_uV = 1200000, |
| 220 | .max_uV = 1200000, |
| 221 | .apply_uV = 1, |
| 222 | .always_on = 1, |
| 223 | }, |
| 224 | }; |
| 225 | |
| 226 | static struct regulator_init_data goni_ldo13_data = { |
| 227 | .constraints = { |
| 228 | .name = "CAM_A_2.8V", |
| 229 | .min_uV = 2800000, |
| 230 | .max_uV = 2800000, |
| 231 | .apply_uV = 1, |
| 232 | .always_on = 1, |
| 233 | }, |
| 234 | }; |
| 235 | |
| 236 | static struct regulator_init_data goni_ldo14_data = { |
| 237 | .constraints = { |
| 238 | .name = "CAM_CIF_1.8V", |
| 239 | .min_uV = 1800000, |
| 240 | .max_uV = 1800000, |
| 241 | .apply_uV = 1, |
| 242 | .always_on = 1, |
| 243 | }, |
| 244 | }; |
| 245 | |
| 246 | static struct regulator_init_data goni_ldo15_data = { |
| 247 | .constraints = { |
| 248 | .name = "CAM_AF_3.3V", |
| 249 | .min_uV = 3300000, |
| 250 | .max_uV = 3300000, |
| 251 | .apply_uV = 1, |
| 252 | .always_on = 1, |
| 253 | }, |
| 254 | }; |
| 255 | |
| 256 | static struct regulator_init_data goni_ldo16_data = { |
| 257 | .constraints = { |
| 258 | .name = "VMIPI_1.8V", |
| 259 | .min_uV = 1800000, |
| 260 | .max_uV = 1800000, |
| 261 | .apply_uV = 1, |
| 262 | .always_on = 1, |
| 263 | }, |
| 264 | }; |
| 265 | |
| 266 | static struct regulator_init_data goni_ldo17_data = { |
| 267 | .constraints = { |
| 268 | .name = "VCC_3.0V_LCD", |
| 269 | .min_uV = 3000000, |
| 270 | .max_uV = 3000000, |
| 271 | .apply_uV = 1, |
| 272 | .always_on = 1, |
| 273 | }, |
| 274 | }; |
| 275 | |
| 276 | /* BUCK */ |
| 277 | static struct regulator_consumer_supply buck1_consumer[] = { |
| 278 | { .supply = "vddarm", }, |
| 279 | }; |
| 280 | |
| 281 | static struct regulator_consumer_supply buck2_consumer[] = { |
| 282 | { .supply = "vddint", }, |
| 283 | }; |
| 284 | |
| 285 | static struct regulator_init_data goni_buck1_data = { |
| 286 | .constraints = { |
| 287 | .name = "VARM_1.2V", |
| 288 | .min_uV = 1200000, |
| 289 | .max_uV = 1200000, |
| 290 | .apply_uV = 1, |
| 291 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 292 | REGULATOR_CHANGE_STATUS, |
| 293 | }, |
| 294 | .num_consumer_supplies = ARRAY_SIZE(buck1_consumer), |
| 295 | .consumer_supplies = buck1_consumer, |
| 296 | }; |
| 297 | |
| 298 | static struct regulator_init_data goni_buck2_data = { |
| 299 | .constraints = { |
| 300 | .name = "VINT_1.2V", |
| 301 | .min_uV = 1200000, |
| 302 | .max_uV = 1200000, |
| 303 | .apply_uV = 1, |
| 304 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
| 305 | REGULATOR_CHANGE_STATUS, |
| 306 | }, |
| 307 | .num_consumer_supplies = ARRAY_SIZE(buck2_consumer), |
| 308 | .consumer_supplies = buck2_consumer, |
| 309 | }; |
| 310 | |
| 311 | static struct regulator_init_data goni_buck3_data = { |
| 312 | .constraints = { |
| 313 | .name = "VCC_1.8V", |
| 314 | .min_uV = 1800000, |
| 315 | .max_uV = 1800000, |
| 316 | .apply_uV = 1, |
| 317 | .state_mem = { |
| 318 | .enabled = 1, |
| 319 | }, |
| 320 | }, |
| 321 | }; |
| 322 | |
| 323 | static struct regulator_init_data goni_buck4_data = { |
| 324 | .constraints = { |
| 325 | .name = "CAM_CORE_1.2V", |
| 326 | .min_uV = 1200000, |
| 327 | .max_uV = 1200000, |
| 328 | .apply_uV = 1, |
| 329 | .always_on = 1, |
| 330 | }, |
| 331 | }; |
| 332 | |
| 333 | static struct max8998_regulator_data goni_regulators[] = { |
| 334 | { MAX8998_LDO2, &goni_ldo2_data }, |
| 335 | { MAX8998_LDO3, &goni_ldo3_data }, |
| 336 | { MAX8998_LDO4, &goni_ldo4_data }, |
| 337 | { MAX8998_LDO5, &goni_ldo5_data }, |
| 338 | { MAX8998_LDO6, &goni_ldo6_data }, |
| 339 | { MAX8998_LDO7, &goni_ldo7_data }, |
| 340 | { MAX8998_LDO8, &goni_ldo8_data }, |
| 341 | { MAX8998_LDO9, &goni_ldo9_data }, |
| 342 | { MAX8998_LDO10, &goni_ldo10_data }, |
| 343 | { MAX8998_LDO11, &goni_ldo11_data }, |
| 344 | { MAX8998_LDO12, &goni_ldo12_data }, |
| 345 | { MAX8998_LDO13, &goni_ldo13_data }, |
| 346 | { MAX8998_LDO14, &goni_ldo14_data }, |
| 347 | { MAX8998_LDO15, &goni_ldo15_data }, |
| 348 | { MAX8998_LDO16, &goni_ldo16_data }, |
| 349 | { MAX8998_LDO17, &goni_ldo17_data }, |
| 350 | { MAX8998_BUCK1, &goni_buck1_data }, |
| 351 | { MAX8998_BUCK2, &goni_buck2_data }, |
| 352 | { MAX8998_BUCK3, &goni_buck3_data }, |
| 353 | { MAX8998_BUCK4, &goni_buck4_data }, |
| 354 | }; |
| 355 | |
| 356 | static struct max8998_platform_data goni_max8998_pdata = { |
| 357 | .num_regulators = ARRAY_SIZE(goni_regulators), |
| 358 | .regulators = goni_regulators, |
| 359 | }; |
| 360 | #endif |
| 361 | |
| 362 | /* GPIO I2C PMIC */ |
| 363 | #define AP_I2C_GPIO_PMIC_BUS_4 4 |
| 364 | static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = { |
| 365 | .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */ |
| 366 | .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */ |
| 367 | }; |
| 368 | |
| 369 | static struct platform_device goni_i2c_gpio_pmic = { |
| 370 | .name = "i2c-gpio", |
| 371 | .id = AP_I2C_GPIO_PMIC_BUS_4, |
| 372 | .dev = { |
| 373 | .platform_data = &goni_i2c_gpio_pmic_data, |
| 374 | }, |
| 375 | }; |
| 376 | |
| 377 | static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = { |
| 378 | #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE) |
| 379 | { |
| 380 | /* 0xCC when SRAD = 0 */ |
| 381 | I2C_BOARD_INFO("max8998", 0xCC >> 1), |
| 382 | .platform_data = &goni_max8998_pdata, |
| 383 | }, |
| 384 | #endif |
| 385 | }; |
| 386 | |
| 387 | /* PMIC Power button */ |
| 388 | static struct gpio_keys_button goni_gpio_keys_table[] = { |
| 389 | { |
| 390 | .code = KEY_POWER, |
| 391 | .gpio = S5PV210_GPH2(6), |
| 392 | .desc = "gpio-keys: KEY_POWER", |
| 393 | .type = EV_KEY, |
| 394 | .active_low = 1, |
| 395 | .wakeup = 1, |
| 396 | .debounce_interval = 1, |
| 397 | }, |
| 398 | }; |
| 399 | |
| 400 | static struct gpio_keys_platform_data goni_gpio_keys_data = { |
| 401 | .buttons = goni_gpio_keys_table, |
| 402 | .nbuttons = ARRAY_SIZE(goni_gpio_keys_table), |
| 403 | }; |
| 404 | |
| 405 | static struct platform_device goni_device_gpiokeys = { |
| 406 | .name = "gpio-keys", |
| 407 | .dev = { |
| 408 | .platform_data = &goni_gpio_keys_data, |
| 409 | }, |
| 410 | }; |
| 411 | |
| 412 | static void __init goni_pmic_init(void) |
| 413 | { |
| 414 | /* AP_PMIC_IRQ: EINT7 */ |
| 415 | s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf)); |
| 416 | s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP); |
| 417 | |
| 418 | /* nPower: EINT22 */ |
| 419 | s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf)); |
| 420 | s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP); |
| 421 | } |
| 422 | |
| 423 | |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 424 | static struct platform_device *goni_devices[] __initdata = { |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 425 | &s3c_device_fb, |
Joonyoung Shim | 4cefa36 | 2010-06-30 20:36:01 +0900 | [diff] [blame] | 426 | &s5pc110_device_onenand, |
Marek Szyprowski | ba149f3 | 2010-07-14 19:39:47 +0900 | [diff] [blame^] | 427 | &goni_i2c_gpio_pmic, |
| 428 | &goni_device_gpiokeys, |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 429 | }; |
| 430 | |
| 431 | static void __init goni_map_io(void) |
| 432 | { |
| 433 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
| 434 | s3c24xx_init_clocks(24000000); |
| 435 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); |
| 436 | } |
| 437 | |
| 438 | static void __init goni_machine_init(void) |
| 439 | { |
Marek Szyprowski | ba149f3 | 2010-07-14 19:39:47 +0900 | [diff] [blame^] | 440 | /* PMIC */ |
| 441 | goni_pmic_init(); |
| 442 | i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs, |
| 443 | ARRAY_SIZE(i2c_gpio_pmic_devs)); |
Marek Szyprowski | 3965fde | 2010-07-14 19:38:18 +0900 | [diff] [blame] | 444 | /* FB */ |
| 445 | s3c_fb_set_platdata(&goni_lcd_pdata); |
| 446 | |
Joonyoung Shim | 2e57da4 | 2010-05-19 23:15:32 +0900 | [diff] [blame] | 447 | platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices)); |
| 448 | } |
| 449 | |
| 450 | MACHINE_START(GONI, "GONI") |
| 451 | /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */ |
| 452 | .phys_io = S3C_PA_UART & 0xfff00000, |
| 453 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
| 454 | .boot_params = S5P_PA_SDRAM + 0x100, |
| 455 | .init_irq = s5pv210_init_irq, |
| 456 | .map_io = goni_map_io, |
| 457 | .init_machine = goni_machine_init, |
| 458 | .timer = &s3c24xx_timer, |
| 459 | MACHINE_END |