| | 1 | /* |
| | 2 | * linux/arch/arm/mach-s3c2440/mach-glofiish.c |
| | 3 | * |
| | 4 | * S3C2440 Machine Support for the E-TEN glofiish X800/M800 |
| | 5 | * |
| | 6 | * Copyright (C) 2008 by Harald Welte <laforge@gnumonks.org> |
| | 7 | * All rights reserved. |
| | 8 | * |
| | 9 | * This program is free software; you can redistribute it and/or |
| | 10 | * modify it under the terms of the GNU General Public License as |
| | 11 | * published by the Free Software Foundation; either version 2 of |
| | 12 | * the License, or (at your option) any later version. |
| | 13 | * |
| | 14 | * This program is distributed in the hope that it will be useful, |
| | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| | 17 | * GNU General Public License for more details. |
| | 18 | * |
| | 19 | * You should have received a copy of the GNU General Public License |
| | 20 | * along with this program; if not, write to the Free Software |
| | 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| | 22 | * MA 02111-1307 USA |
| | 23 | * |
| | 24 | */ |
| | 25 | |
| | 26 | #include <linux/kernel.h> |
| | 27 | #include <linux/types.h> |
| | 28 | #include <linux/interrupt.h> |
| | 29 | #include <linux/list.h> |
| | 30 | #include <linux/delay.h> |
| | 31 | #include <linux/timer.h> |
| | 32 | #include <linux/init.h> |
| | 33 | #include <linux/i2c.h> |
| | 34 | #include <linux/workqueue.h> |
| | 35 | #include <linux/platform_device.h> |
| | 36 | #include <linux/serial_core.h> |
| | 37 | #include <linux/spi/spi.h> |
| | 38 | #include <linux/spi/spi_bitbang.h> |
| | 39 | #include <linux/mmc/host.h> |
| | 40 | |
| | 41 | #include <linux/mtd/mtd.h> |
| | 42 | #include <linux/mtd/nand.h> |
| | 43 | #include <linux/mtd/nand_ecc.h> |
| | 44 | #include <linux/mtd/partitions.h> |
| | 45 | #include <linux/mtd/physmap.h> |
| | 46 | |
| | 47 | #include <asm/mach/arch.h> |
| | 48 | #include <asm/mach/map.h> |
| | 49 | #include <asm/mach/irq.h> |
| | 50 | |
| | 51 | #include <mach/hardware.h> |
| | 52 | #include <asm/io.h> |
| | 53 | #include <asm/irq.h> |
| | 54 | #include <asm/mach-types.h> |
| | 55 | |
| | 56 | #include <mach/regs-irq.h> |
| | 57 | #include <mach/regs-gpio.h> |
| | 58 | #include <mach/regs-gpioj.h> |
| | 59 | #include <mach/leds-gpio.h> |
| | 60 | #include <mach/fb.h> |
| | 61 | #include <mach/mci.h> |
| | 62 | #include <mach/ts.h> |
| | 63 | #include <mach/spi.h> |
| | 64 | #include <mach/spi-gpio.h> |
| | 65 | |
| | 66 | #include <mach/glofiish.h> |
| | 67 | #include <mach/gta01.h> |
| | 68 | #include <mach/glofiishx500.h> |
| | 69 | |
| | 70 | #include <plat/regs-serial.h> |
| | 71 | #include <plat/regs-iic.h> |
| | 72 | #include <plat/nand.h> |
| | 73 | #include <plat/devs.h> |
| | 74 | #include <plat/cpu.h> |
| | 75 | #include <plat/pm.h> |
| | 76 | #include <plat/udc.h> |
| | 77 | #include <plat/iic.h> |
| | 78 | #include <plat/usb-control.h> |
| | 79 | #include <plat/glofiish-cpld.h> |
| | 80 | |
| | 81 | #include <linux/jbt6k74.h> |
| | 82 | |
| | 83 | #include <../drivers/input/touchscreen/ts_filter_chain.h> |
| | 84 | #ifdef CONFIG_TOUCHSCREEN_FILTER |
| | 85 | #include <../drivers/input/touchscreen/ts_filter_linear.h> |
| | 86 | #include <../drivers/input/touchscreen/ts_filter_mean.h> |
| | 87 | #include <../drivers/input/touchscreen/ts_filter_median.h> |
| | 88 | /*#include <../drivers/input/touchscreen/ts_filter_group.h>*/ |
| | 89 | #endif |
| | 90 | |
| | 91 | |
| | 92 | /* |
| | 93 | * this gets called every 1ms when we paniced. |
| | 94 | */ |
| | 95 | |
| | 96 | static long glofiishx500_panic_blink(long count) |
| | 97 | { |
| | 98 | long delay = 0; |
| | 99 | static long last_blink; |
| | 100 | // static char led; |
| | 101 | |
| | 102 | if (count - last_blink < 100) /* 200ms period, fast blink */ |
| | 103 | return 0; |
| | 104 | |
| | 105 | /* FIXME */ |
| | 106 | //#if 0 |
| | 107 | // led ^= 1; |
| | 108 | // s3c2410_gpio_cfgpin(GTA02_GPIO_AUX_LED, S3C2410_GPIO_OUTPUT); |
| | 109 | // neo1973_gpb_setpin(GTA02_GPIO_AUX_LED, led); |
| | 110 | // |
| | 111 | // last_blink = count; |
| | 112 | //#endif |
| | 113 | return delay; |
| | 114 | } |
| | 115 | |
| | 116 | //struct platform_device gta02_version_device = { |
| | 117 | // .name = "neo1973-version", |
| | 118 | // .num_resources = 0, |
| | 119 | //}; |
| | 120 | // |
| | 121 | //struct platform_device gta02_resume_reason_device = { |
| | 122 | // .name = "neo1973-resume", |
| | 123 | // .num_resources = 0, |
| | 124 | //}; |
| | 125 | // |
| | 126 | //struct platform_device gta02_memconfig_device = { |
| | 127 | // .name = "neo1973-memconfig", |
| | 128 | // .num_resources = 0, |
| | 129 | //}; |
| | 130 | |
| | 131 | static struct map_desc glofiishx500_iodesc[] __initdata = { |
| | 132 | { |
| | 133 | .virtual = 0xe0000000, |
| | 134 | .pfn = __phys_to_pfn(S3C2410_CS3+0x01000000), |
| | 135 | .length = SZ_1M, |
| | 136 | .type = MT_DEVICE |
| | 137 | }, |
| | 138 | }; |
| | 139 | |
| | 140 | #define UCON S3C2410_UCON_DEFAULT |
| | 141 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB |
| | 142 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE |
| | 143 | |
| | 144 | static struct s3c2410_uartcfg glofiishx500_uartcfgs[] = { |
| | 145 | [0] = { |
| | 146 | .hwport = 0, |
| | 147 | .flags = 0, |
| | 148 | .ucon = UCON, |
| | 149 | .ulcon = ULCON, |
| | 150 | .ufcon = UFCON, |
| | 151 | }, |
| | 152 | [1] = { |
| | 153 | .hwport = 1, |
| | 154 | .flags = 0, |
| | 155 | .ucon = UCON, |
| | 156 | .ulcon = ULCON, |
| | 157 | .ufcon = UFCON, |
| | 158 | }, |
| | 159 | [2] = { |
| | 160 | .hwport = 2, |
| | 161 | .flags = 0, |
| | 162 | .ucon = UCON, |
| | 163 | .ulcon = ULCON, |
| | 164 | .ufcon = UFCON, |
| | 165 | }, |
| | 166 | |
| | 167 | }; |
| | 168 | |
| | 169 | ///* Configuration for 480x640 toppoly TD028TTEC1. |
| | 170 | // * Do not mark this as __initdata or it will break! */ |
| | 171 | //static struct s3c2410fb_display glofiishx500_displays[] = { |
| | 172 | // { |
| | 173 | // .type = S3C2410_LCDCON1_TFT, |
| | 174 | // .width = 43, |
| | 175 | // .height = 58, |
| | 176 | // .xres = 480, |
| | 177 | // .yres = 640, |
| | 178 | // .bpp = 16, |
| | 179 | // |
| | 180 | // .pixclock = 40000, /* HCLK/4 */ |
| | 181 | // .left_margin = 2, |
| | 182 | // .right_margin = 2, |
| | 183 | // .hsync_len = 2, |
| | 184 | // .upper_margin = 2, |
| | 185 | // .lower_margin = 66, |
| | 186 | // .vsync_len = 2, |
| | 187 | // .lcdcon5 = S3C2410_LCDCON5_FRM565 | |
| | 188 | // S3C2410_LCDCON5_INVVCLK | |
| | 189 | // S3C2410_LCDCON5_INVVLINE | |
| | 190 | // S3C2410_LCDCON5_INVVFRAME | |
| | 191 | // S3C2410_LCDCON5_PWREN | |
| | 192 | // S3C2410_LCDCON5_HWSWP, |
| | 193 | // }, |
| | 194 | // { |
| | 195 | // .type = S3C2410_LCDCON1_TFT, |
| | 196 | // .width = 43, |
| | 197 | // .height = 58, |
| | 198 | // .xres = 480, |
| | 199 | // .yres = 640, |
| | 200 | // .bpp = 32, |
| | 201 | // |
| | 202 | // .pixclock = 40000, /* HCLK/4 */ |
| | 203 | // .left_margin = 104, |
| | 204 | // .right_margin = 8, |
| | 205 | // .hsync_len = 8, |
| | 206 | // .upper_margin = 2, |
| | 207 | // .lower_margin = 16, |
| | 208 | // .vsync_len = 2, |
| | 209 | // .lcdcon5 = S3C2410_LCDCON5_FRM565 | |
| | 210 | // S3C2410_LCDCON5_INVVCLK | |
| | 211 | // S3C2410_LCDCON5_INVVLINE | |
| | 212 | // S3C2410_LCDCON5_INVVFRAME | |
| | 213 | // S3C2410_LCDCON5_PWREN | |
| | 214 | // S3C2410_LCDCON5_HWSWP, |
| | 215 | // }, |
| | 216 | // { |
| | 217 | // .type = S3C2410_LCDCON1_TFT, |
| | 218 | // .width = 43, |
| | 219 | // .height = 58, |
| | 220 | // .xres = 240, |
| | 221 | // .yres = 320, |
| | 222 | // .bpp = 16, |
| | 223 | // |
| | 224 | // .pixclock = 40000, /* HCLK/4 */ |
| | 225 | // .left_margin = 104, |
| | 226 | // .right_margin = 8, |
| | 227 | // .hsync_len = 8, |
| | 228 | // .upper_margin = 2, |
| | 229 | // .lower_margin = 16, |
| | 230 | // .vsync_len = 2, |
| | 231 | // .lcdcon5 = S3C2410_LCDCON5_FRM565 | |
| | 232 | // S3C2410_LCDCON5_INVVCLK | |
| | 233 | // S3C2410_LCDCON5_INVVLINE | |
| | 234 | // S3C2410_LCDCON5_INVVFRAME | |
| | 235 | // S3C2410_LCDCON5_PWREN | |
| | 236 | // S3C2410_LCDCON5_HWSWP, |
| | 237 | // }, |
| | 238 | //}; |
| | 239 | // |
| | 240 | //static struct s3c2410fb_mach_info glofiishx500_lcd_cfg __initdata = { |
| | 241 | // .displays = glofiishx500_displays, |
| | 242 | // .num_displays = ARRAY_SIZE(glofiishx500_displays), |
| | 243 | // .default_display = 0, |
| | 244 | // |
| | 245 | // .lpcsel = ((0xCE6) & ~7) | 1<<4, |
| | 246 | //}; |
| | 247 | |
| | 248 | /** |
| | 249 | * Set lcd on or off, code from arch/arm/mach-s3c2410/mach-h1940.c |
| | 250 | **/ |
| | 251 | static struct s3c2410fb_display glofiishx500_displays[] = { |
| | 252 | { |
| | 253 | .lcdcon5= S3C2410_LCDCON5_FRM565 | \ |
| | 254 | S3C2410_LCDCON5_INVVLINE | \ |
| | 255 | S3C2410_LCDCON5_HWSWP, |
| | 256 | |
| | 257 | .type = S3C2410_LCDCON1_TFT, |
| | 258 | .width = 240, |
| | 259 | .height = 320, |
| | 260 | .pixclock = 260000, |
| | 261 | .xres = 240, |
| | 262 | .yres = 320, |
| | 263 | .bpp = 16, |
| | 264 | .left_margin = 20, |
| | 265 | .right_margin = 8, |
| | 266 | .hsync_len = 4, |
| | 267 | .upper_margin = 8, |
| | 268 | .lower_margin = 7, |
| | 269 | .vsync_len = 1, |
| | 270 | } |
| | 271 | }; |
| | 272 | |
| | 273 | static struct s3c2410fb_mach_info glofiishx500_lcd_cfg __initdata = { |
| | 274 | .displays = glofiishx500_displays, |
| | 275 | .num_displays = ARRAY_SIZE(glofiishx500_displays), |
| | 276 | .default_display = 0, |
| | 277 | |
| | 278 | .lpcsel= 0x02, |
| | 279 | .gpccon= 0xaa940659, |
| | 280 | .gpccon_mask= 0xffffffff, |
| | 281 | .gpcup= 0x0000ffff, |
| | 282 | .gpcup_mask= 0xffffffff, |
| | 283 | .gpdcon= 0xaa84aaa0, |
| | 284 | .gpdcon_mask= 0xffffffff, |
| | 285 | .gpdup= 0x0000faff, |
| | 286 | .gpdup_mask= 0xffffffff, |
| | 287 | |
| | 288 | // Magick numbers taken from rx1950 kernel patches |
| | 289 | .lpcsel = 0x02, |
| | 290 | .gpccon = 0xaa9506a9, |
| | 291 | .gpccon_mask = 0xFFC003FC, |
| | 292 | .gpcup = 0x0000ffff, |
| | 293 | .gpcup_mask = 0xffffffff, |
| | 294 | .gpdcon = 0xaa90aaa1, |
| | 295 | .gpdcon_mask = 0xffc0fff0, |
| | 296 | .gpdup = 0x0000fcfd, |
| | 297 | .gpdup_mask = 0xffffffff |
| | 298 | |
| | 299 | }; |
| | 300 | |
| | 301 | |
| | 302 | //static struct resource m800_sdio_resources[] = { |
| | 303 | // [0] = { |
| | 304 | // .flags = IORESOURCE_IRQ, |
| | 305 | // .start = IRQ_SDI, |
| | 306 | // .end = IRQ_SDI, |
| | 307 | // }, |
| | 308 | // [1] = { |
| | 309 | // .flags = IORESOURCE_MEM, |
| | 310 | // .start = S3C2410_PA_SDI, |
| | 311 | // .end = S3C2410_PA_SDI + S3C24XX_SZ_SDI - 1, |
| | 312 | // }, |
| | 313 | // [2] = { |
| | 314 | // .flags = IORESOURCE_DMA, |
| | 315 | // .start = 0, /* Channel 0 for SDI */ |
| | 316 | // .end = 0, |
| | 317 | // }, |
| | 318 | //}; |
| | 319 | |
| | 320 | static struct s3c2410_platform_i2c glofiishx500_i2c_pdata __initdata = { |
| | 321 | .flags = 0, |
| | 322 | .slave_addr = 0x48, |
| | 323 | .bus_freq = 100*1000, |
| | 324 | .max_freq = 100*1000, |
| | 325 | .sda_delay = S3C2410_IICLC_FILTER_ON, |
| | 326 | }; |
| | 327 | |
| | 328 | //static struct i2c_board_info glofiishx500_i2c_devs[] __initdata = { |
| | 329 | // { |
| | 330 | // /* CPLD */ |
| | 331 | // I2C_BOARD_INFO("gf_cpld", 0x18), |
| | 332 | // .irq = M800_IRQ_CPLD_KEY, |
| | 333 | // .flags = I2C_M_IGNORE_NAK, |
| | 334 | // }, |
| | 335 | // { |
| | 336 | // /* FM Tuner */ |
| | 337 | // I2C_BOARD_INFO("si470x-i2c", 0x10), |
| | 338 | // .irq = M800_IRQ_FMRADIO, |
| | 339 | // }, |
| | 340 | // { |
| | 341 | // /* Battery (unknown chip) */ |
| | 342 | // I2C_BOARD_INFO("gf_batt", 0x2f), |
| | 343 | // }, |
| | 344 | //#if 0 |
| | 345 | // { |
| | 346 | // /* Front camera */ |
| | 347 | // I2C_BOARD_INFO("FIXME", 0x30), |
| | 348 | // }, |
| | 349 | // { |
| | 350 | // /* Back camera */ |
| | 351 | // I2C_BOARD_INFO("FIXME", 0x3c), |
| | 352 | // }, |
| | 353 | //#endif |
| | 354 | // /* Don't put Audio Codec here, ASoC handles it */ |
| | 355 | //}; |
| | 356 | |
| | 357 | static struct s3c2410_nand_set glofiishx500_nand_sets[] = { |
| | 358 | [0] = { |
| | 359 | .name = "glofiishx500-nand", |
| | 360 | .nr_chips = 1, |
| | 361 | .flags = S3C2410_NAND_BBT, |
| | 362 | }, |
| | 363 | }; |
| | 364 | |
| | 365 | /* choose a set of timings derived from S3C@2442B MCP54 |
| | 366 | * data sheet (K5D2G13ACM-D075 MCP Memory) |
| | 367 | */ |
| | 368 | |
| | 369 | static struct s3c2410_platform_nand glofiishx500_nand_info = { |
| | 370 | .tacls = 0, |
| | 371 | .twrph0 = 25, |
| | 372 | .twrph1 = 15, |
| | 373 | .nr_sets = ARRAY_SIZE(glofiishx500_nand_sets), |
| | 374 | .sets = glofiishx500_nand_sets, |
| | 375 | .software_ecc = 1, |
| | 376 | }; |
| | 377 | |
| | 378 | static struct s3c24xx_mci_pdata glofiishx500_mmc_cfg = { |
| | 379 | .gpio_detect = GLOFIISX500_GPIO_nSD_DETECT, |
| | 380 | .set_power = NULL, |
| | 381 | .ocr_avail = MMC_VDD_32_33, |
| | 382 | }; |
| | 383 | |
| | 384 | static void glofiishx500_udc_command(enum s3c2410_udc_cmd_e cmd) |
| | 385 | { |
| | 386 | printk(KERN_DEBUG "%s(%d)\n", __func__, cmd); |
| | 387 | |
| | 388 | switch (cmd) { |
| | 389 | case S3C2410_UDC_P_ENABLE: |
| | 390 | s3c2410_gpio_setpin(GLOFIISX500_GPIO_USB_PULLUP, 1); |
| | 391 | break; |
| | 392 | case S3C2410_UDC_P_DISABLE: |
| | 393 | s3c2410_gpio_setpin(GLOFIISX500_GPIO_USB_PULLUP, 0); |
| | 394 | break; |
| | 395 | case S3C2410_UDC_P_RESET: |
| | 396 | /* FIXME! */ |
| | 397 | break; |
| | 398 | default: |
| | 399 | break; |
| | 400 | } |
| | 401 | } |
| | 402 | |
| | 403 | /* get PMU to set USB current limit accordingly */ |
| | 404 | |
| | 405 | static void glofiishx500_udc_vbus_draw(unsigned int ma) |
| | 406 | { |
| | 407 | //pcf50633_notify_usb_current_limit_change(pcf50633_global, ma); |
| | 408 | } |
| | 409 | |
| | 410 | static struct s3c2410_udc_mach_info glofiishx500_udc_cfg = { |
| | 411 | .vbus_draw = glofiishx500_udc_vbus_draw, |
| | 412 | .udc_command = glofiishx500_udc_command, |
| | 413 | |
| | 414 | }; |
| | 415 | |
| | 416 | /* touchscreen configuration */ |
| | 417 | |
| | 418 | #ifdef CONFIG_TOUCHSCREEN_FILTER |
| | 419 | |
| | 420 | //#if 0 |
| | 421 | //const static struct ts_filter_group_configuration glofiishx500_ts_group = { |
| | 422 | // .length = 12, |
| | 423 | // .close_enough = 10, |
| | 424 | // .threshold = 6, /* At least half of the points in a group. */ |
| | 425 | // .attempts = 10, |
| | 426 | //}; |
| | 427 | //#endif |
| | 428 | |
| | 429 | const static struct ts_filter_median_configuration glofiishx500_ts_median = { |
| | 430 | .extent = 20, |
| | 431 | .decimation_below = 3, |
| | 432 | .decimation_threshold = 8 * 3, |
| | 433 | .decimation_above = 4, |
| | 434 | }; |
| | 435 | |
| | 436 | const static struct ts_filter_mean_configuration glofiishx500_ts_mean = { |
| | 437 | .length = 4, |
| | 438 | }; |
| | 439 | |
| | 440 | const static struct ts_filter_linear_configuration glofiishx500_ts_linear = { |
| | 441 | .constants = {1, 0, 0, 0, 1, 0, 1}, /* Don't modify coords. */ |
| | 442 | .coord0 = 0, |
| | 443 | .coord1 = 1, |
| | 444 | }; |
| | 445 | #endif |
| | 446 | |
| | 447 | const struct ts_filter_chain_configuration glofiishx500_filter_configuration[] = |
| | 448 | { |
| | 449 | #ifdef CONFIG_TOUCHSCREEN_FILTER |
| | 450 | /* {&ts_filter_group_api, &glofiishx500_ts_group.config}, */ |
| | 451 | {&ts_filter_median_api, &glofiishx500_ts_median.config}, |
| | 452 | {&ts_filter_mean_api, &glofiishx500_ts_mean.config}, |
| | 453 | {&ts_filter_linear_api, &glofiishx500_ts_linear.config}, |
| | 454 | #endif |
| | 455 | {NULL, NULL}, |
| | 456 | }; |
| | 457 | |
| | 458 | const static struct s3c2410_ts_mach_info glofiishx500_ts_cfg = { |
| | 459 | .delay = 10000, |
| | 460 | //.presc = 0xff, /* slow as we can go */ |
| | 461 | /* next line from mach-h1940.c */ |
| | 462 | .presc = 49, |
| | 463 | //.oversampling_shift = 2, |
| | 464 | .filter_config = glofiishx500_filter_configuration, |
| | 465 | }; |
| | 466 | |
| | 467 | |
| | 468 | /* SPI: LCM control interface attached to Glamo3362 */ |
| | 469 | |
| | 470 | static void glofiishx500_jbt6k74_reset(int devidx, int level) |
| | 471 | { |
| | 472 | //glamo_lcm_reset(level); |
| | 473 | printk(KERN_DEBUG "glofiishx500_jbt6k74_reset\n"); |
| | 474 | } |
| | 475 | |
| | 476 | /* finally bring up deferred backlight resume now LCM is resumed itself */ |
| | 477 | |
| | 478 | static void glofiishx500_jbt6k74_resuming(int devidx) |
| | 479 | { |
| | 480 | //pcf50633_backlight_resume(pcf50633_global); |
| | 481 | //gta01bl_deferred_resume(); |
| | 482 | } |
| | 483 | |
| | 484 | const struct jbt6k74_platform_data jbt6k74_pdata = { |
| | 485 | .reset = glofiishx500_jbt6k74_reset, |
| | 486 | .resuming = glofiishx500_jbt6k74_resuming, |
| | 487 | }; |
| | 488 | |
| | 489 | static struct spi_board_info glofiishx500_spi_board_info[] = { |
| | 490 | { |
| | 491 | .modalias = "jbt6k74", |
| | 492 | /* platform_data */ |
| | 493 | .platform_data = &jbt6k74_pdata, |
| | 494 | /* controller_data */ |
| | 495 | /* irq */ |
| | 496 | .max_speed_hz = 10 * 1000 * 1000, |
| | 497 | .bus_num = 2, |
| | 498 | /* chip_select */ |
| | 499 | }, |
| | 500 | }; |
| | 501 | |
| | 502 | static void spi_gpio_cs(struct s3c2410_spigpio_info *spi, int csidx, int cs) |
| | 503 | { |
| | 504 | /* GPD0 is a pure guess. */ |
| | 505 | switch (cs) { |
| | 506 | case BITBANG_CS_ACTIVE: |
| | 507 | s3c2410_gpio_setpin(S3C2410_GPD0, 0); |
| | 508 | break; |
| | 509 | case BITBANG_CS_INACTIVE: |
| | 510 | s3c2410_gpio_setpin(S3C2410_GPD0, 1); |
| | 511 | break; |
| | 512 | } |
| | 513 | } |
| | 514 | |
| | 515 | static struct s3c2410_spigpio_info spi_gpio_cfg = { |
| | 516 | /* GPD8..10 is next to the LCM signals, and configured to SPI |
| | 517 | * function mode, so we guess it's them! */ |
| | 518 | .pin_clk = S3C2410_GPD10, |
| | 519 | .pin_mosi = S3C2410_GPD9, |
| | 520 | .pin_miso = S3C2410_GPD8, |
| | 521 | /* .board_size = ARRAY_SIZE(glofiish_spi_board_info), |
| | 522 | .board_info = glofiish_spi_board_info, */ |
| | 523 | .chip_select = &spi_gpio_cs, |
| | 524 | .num_chipselect = 2, /*** Should be 1 or 2 for gta01? ***/ |
| | 525 | }; |
| | 526 | |
| | 527 | static struct resource s3c_spi_lcm_resource[] = { |
| | 528 | [0] = { |
| | 529 | .start = S3C2410_GPG3, |
| | 530 | .end = S3C2410_GPG3, |
| | 531 | }, |
| | 532 | [1] = { |
| | 533 | .start = S3C2410_GPG5, |
| | 534 | .end = S3C2410_GPG5, |
| | 535 | }, |
| | 536 | [2] = { |
| | 537 | .start = S3C2410_GPG6, |
| | 538 | .end = S3C2410_GPG6, |
| | 539 | }, |
| | 540 | [3] = { |
| | 541 | .start = S3C2410_GPG7, |
| | 542 | .end = S3C2410_GPG7, |
| | 543 | }, |
| | 544 | }; |
| | 545 | |
| | 546 | struct platform_device s3c_device_spi_lcm = { |
| | 547 | .name = "spi_s3c24xx_gpio", |
| | 548 | .id = 1, |
| | 549 | .num_resources = ARRAY_SIZE(s3c_spi_lcm_resource), |
| | 550 | .resource = s3c_spi_lcm_resource, |
| | 551 | .dev = { |
| | 552 | .platform_data = &spi_gpio_cfg, |
| | 553 | }, |
| | 554 | }; |
| | 555 | |
| | 556 | //static struct gta01bl_machinfo backlight_machinfo = { |
| | 557 | // .default_intensity = 1, |
| | 558 | // .max_intensity = 1, |
| | 559 | // .limit_mask = 1, |
| | 560 | // .defer_resume_backlight = 1, |
| | 561 | //}; |
| | 562 | // |
| | 563 | //static struct resource gta01_bl_resources[] = { |
| | 564 | // [0] = { |
| | 565 | // .start = M800_GPIO_BACKLIGHT, |
| | 566 | // .end = M800_GPIO_BACKLIGHT, |
| | 567 | // }, |
| | 568 | //}; |
| | 569 | // |
| | 570 | //struct platform_device gta01_bl_dev = { |
| | 571 | // .name = "gta01-bl", |
| | 572 | // .num_resources = ARRAY_SIZE(gta01_bl_resources), |
| | 573 | // .resource = gta01_bl_resources, |
| | 574 | // .dev = { |
| | 575 | // .platform_data = &backlight_machinfo, |
| | 576 | // }, |
| | 577 | //}; |
| | 578 | |
| | 579 | |
| | 580 | //#if 0 /* currently this is not used and we use gpio spi */ |
| | 581 | //static struct glamo_spi_info glamo_spi_cfg = { |
| | 582 | // .board_size = ARRAY_SIZE(gta02_spi_board_info), |
| | 583 | // .board_info = gta02_spi_board_info, |
| | 584 | //}; |
| | 585 | //#endif /* 0 */ |
| | 586 | // |
| | 587 | ///* LED for the keyboard backlight */ |
| | 588 | //static struct s3c24xx_led_platdata m800_kbd_led_pdata = { |
| | 589 | // .name = "kbd_backlight", |
| | 590 | // .gpio = M800_GPIO_KBDLIGHT, |
| | 591 | // .def_trigger = "kbd-backlight", |
| | 592 | //}; |
| | 593 | // |
| | 594 | //static struct platform_device m800_kbd_led = { |
| | 595 | // .name = "s3c24xx_led", |
| | 596 | // .id = 0, |
| | 597 | // .dev = { |
| | 598 | // .platform_data = &m800_kbd_led_pdata, |
| | 599 | // }, |
| | 600 | //}; |
| | 601 | // |
| | 602 | ///* LED for the keyboard Fn LED */ |
| | 603 | //static struct s3c24xx_led_platdata m800_kbd_fn_led_pdata = { |
| | 604 | // .name = "kbd_fn", |
| | 605 | // .gpio = M800_GPIO_LED_KBD_Fn, |
| | 606 | // .def_trigger = "kbd-fn", |
| | 607 | //}; |
| | 608 | // |
| | 609 | //static struct platform_device m800_kbd_fn_led = { |
| | 610 | // .name = "s3c24xx_led", |
| | 611 | // .id = 1, |
| | 612 | // .dev = { |
| | 613 | // .platform_data = &m800_kbd_fn_led_pdata, |
| | 614 | // }, |
| | 615 | //}; |
| | 616 | // |
| | 617 | ///* LED for the keyboard Caps LED */ |
| | 618 | //static struct s3c24xx_led_platdata m800_kbd_caps_led_pdata = { |
| | 619 | // .name = "kbd_caps", |
| | 620 | // .gpio = M800_GPIO_LED_KBD_Caps, |
| | 621 | // .def_trigger = "kbd-caps", |
| | 622 | //}; |
| | 623 | // |
| | 624 | //static struct platform_device m800_kbd_caps_led = { |
| | 625 | // .name = "s3c24xx_led", |
| | 626 | // .id = 2, |
| | 627 | // .dev = { |
| | 628 | // .platform_data = &m800_kbd_caps_led_pdata, |
| | 629 | // }, |
| | 630 | //}; |
| | 631 | |
| | 632 | /* USB */ |
| | 633 | static struct s3c2410_hcd_info glofiishx500_usb_info = { |
| | 634 | .port[0] = { |
| | 635 | .flags = S3C_HCDFLG_USED, |
| | 636 | }, |
| | 637 | .port[1] = { |
| | 638 | .flags = 0, |
| | 639 | }, |
| | 640 | }; |
| | 641 | |
| | 642 | //static struct resource m800_button_resources[] = { |
| | 643 | // [0] = { |
| | 644 | // .start = M800_GPIO_nKEY_POWER, |
| | 645 | // .end = M800_GPIO_nKEY_POWER, |
| | 646 | // }, |
| | 647 | // [1] = { |
| | 648 | // .start = M800_GPIO_nKEY_CAMERA, |
| | 649 | // .end = M800_GPIO_nKEY_CAMERA, |
| | 650 | // }, |
| | 651 | // [2] = { |
| | 652 | // .start = M800_GPIO_nKEY_RECORD, |
| | 653 | // .end = M800_GPIO_nKEY_RECORD, |
| | 654 | // }, |
| | 655 | // [3] = { |
| | 656 | // .start = M800_GPIO_SLIDE, |
| | 657 | // .end = M800_GPIO_SLIDE, |
| | 658 | // }, |
| | 659 | // [4] = { |
| | 660 | // .start = M800_GPIO_nKEY_RESET, |
| | 661 | // .end = M800_GPIO_nKEY_RESET, |
| | 662 | // }, |
| | 663 | // [5] = { |
| | 664 | // .start = M800_GPIO_HEADJACK, |
| | 665 | // .end = M800_GPIO_HEADJACK, |
| | 666 | // }, |
| | 667 | //}; |
| | 668 | // |
| | 669 | //static struct platform_device m800_button_dev = { |
| | 670 | // .name = "m800-button", |
| | 671 | // .num_resources = ARRAY_SIZE(m800_button_resources), |
| | 672 | // .resource = m800_button_resources, |
| | 673 | //}; |
| | 674 | // |
| | 675 | //static struct platform_device m800_pm_bt_dev = { |
| | 676 | // .name = "neo1973-pm-bt", |
| | 677 | //}; |
| | 678 | // |
| | 679 | //static struct platform_device m800_pm_gps_dev = { |
| | 680 | // .name = "neo1973-pm-gps", |
| | 681 | //}; |
| | 682 | // |
| | 683 | //static struct platform_device m800_pm_fm_dev = { |
| | 684 | // .name = "glofiish-pm-fm", |
| | 685 | //}; |
| | 686 | // |
| | 687 | //static struct platform_device m800_pm_modem_dev = { |
| | 688 | // .name = "glofiish-pm-modem", |
| | 689 | //}; |
| | 690 | // |
| | 691 | //static struct resource m800_modem_resources[] = { |
| | 692 | // [0] = { |
| | 693 | // .flags = IORESOURCE_IRQ, |
| | 694 | // .start = M800_IRQ_GSM, |
| | 695 | // .end = M800_IRQ_GSM, |
| | 696 | // }, |
| | 697 | // [1] = { |
| | 698 | // .flags = IORESOURCE_IRQ, |
| | 699 | // .start = IRQ_SPI1, |
| | 700 | // .end = IRQ_SPI1, |
| | 701 | // }, |
| | 702 | // [2] = { |
| | 703 | // .flags = IORESOURCE_MEM, |
| | 704 | // .start = S3C2410_PA_SPI + 0x20, |
| | 705 | // .end = S3C2410_PA_SPI + 0x34, |
| | 706 | // }, |
| | 707 | //}; |
| | 708 | // |
| | 709 | //static struct platform_device m800_modem_dev = { |
| | 710 | // .name = "gfish-modem", |
| | 711 | // .num_resources = ARRAY_SIZE(m800_modem_resources), |
| | 712 | // .resource = m800_modem_resources, |
| | 713 | //}; |
| | 714 | // |
| | 715 | //static const struct gf_cpld_led_cfg m800_led_cfg[] = { |
| | 716 | // { |
| | 717 | // .reg_offset = 0x10, |
| | 718 | // .bit_offset = 0, |
| | 719 | // .name = "glofiish:red:right", |
| | 720 | // }, { |
| | 721 | // .reg_offset = 0x10, |
| | 722 | // .bit_offset = 1, |
| | 723 | // .name = "glofiish:green:right", |
| | 724 | // }, { |
| | 725 | // .reg_offset = 0x10, |
| | 726 | // .bit_offset = 2, |
| | 727 | // .name = "glofiish:blue:left", |
| | 728 | // }, { |
| | 729 | // .reg_offset = 0x10, |
| | 730 | // .bit_offset = 3, |
| | 731 | // .name = "glofiish:orange:left", |
| | 732 | // }, { |
| | 733 | // .reg_offset = 0x14, |
| | 734 | // .bit_offset = 0, |
| | 735 | // .name = "glofiish:white:left", |
| | 736 | // }, { |
| | 737 | // .reg_offset = 0x14, |
| | 738 | // .bit_offset = 2, |
| | 739 | // .name = "glofiish::vibrator", |
| | 740 | // }, { |
| | 741 | // .reg_offset = 0x16, |
| | 742 | // .bit_offset = 2, |
| | 743 | // .name = "glofiish:white:light", |
| | 744 | // }, { |
| | 745 | // .reg_offset = 0x16, |
| | 746 | // .bit_offset = 3, |
| | 747 | // .name = "glofiish:white:flash", |
| | 748 | // }, |
| | 749 | //}; |
| | 750 | // |
| | 751 | //static struct gf_cpld_pdata m800_cpld_pdata = { |
| | 752 | // .led_num = ARRAY_SIZE(m800_led_cfg), |
| | 753 | // .led_cfgs = m800_led_cfg, |
| | 754 | //}; |
| | 755 | // |
| | 756 | //static struct resource m800_cpld_resources[] = { |
| | 757 | // [0] = { |
| | 758 | // .start = S3C2410_CS1, |
| | 759 | // .end = S3C2410_CS1 + 0x1000000 - 1, |
| | 760 | // .flags = IORESOURCE_MEM, |
| | 761 | // }, |
| | 762 | // [1] = { |
| | 763 | // .start = M800_IRQ_CPLD_KEY, |
| | 764 | // .end = M800_IRQ_CPLD_KEY, |
| | 765 | // .flags = IORESOURCE_IRQ, |
| | 766 | // }, |
| | 767 | // [2] = { |
| | 768 | // .start = M800_GPIO_KBD_SCAN_EN, |
| | 769 | // .end = M800_GPIO_KBD_SCAN_EN, |
| | 770 | // .name = "kbd_scan_en", |
| | 771 | // }, |
| | 772 | //}; |
| | 773 | // |
| | 774 | //static struct platform_device m800_cpld_dev = { |
| | 775 | // .name = "gfish-cpld", |
| | 776 | // .num_resources = ARRAY_SIZE(m800_cpld_resources), |
| | 777 | // .resource = m800_cpld_resources, |
| | 778 | // .dev = { |
| | 779 | // .platform_data = &m800_cpld_pdata, |
| | 780 | // }, |
| | 781 | //}; |
| | 782 | |
| | 783 | static void __init glofiishx500_map_io(void) |
| | 784 | { |
| | 785 | s3c24xx_init_io(glofiishx500_iodesc, ARRAY_SIZE(glofiishx500_iodesc)); |
| | 786 | s3c24xx_init_clocks(16934400); |
| | 787 | s3c24xx_init_uarts(glofiishx500_uartcfgs, ARRAY_SIZE(glofiishx500_uartcfgs)); |
| | 788 | } |
| | 789 | |
| | 790 | /* |
| | 791 | * hardware_ecc=1|0 |
| | 792 | */ |
| | 793 | static char hardware_ecc_str[4] __initdata = ""; |
| | 794 | |
| | 795 | static int __init hardware_ecc_setup(char *str) |
| | 796 | { |
| | 797 | if (str) |
| | 798 | strlcpy(hardware_ecc_str, str, sizeof(hardware_ecc_str)); |
| | 799 | return 1; |
| | 800 | } |
| | 801 | |
| | 802 | static struct platform_device *glofiishx500_devices[] __initdata = { |
| | 803 | &s3c_device_usb, |
| | 804 | &s3c_device_lcd, |
| | 805 | &s3c_device_wdt, |
| | 806 | &s3c_device_i2c0, |
| | 807 | &s3c_device_iis, |
| | 808 | &s3c_device_sdi, |
| | 809 | &s3c_device_usbgadget, |
| | 810 | // &s3c_device_nand, |
| | 811 | &s3c_device_ts, |
| | 812 | // &m800_kbd_led, |
| | 813 | // &m800_kbd_fn_led, |
| | 814 | // &m800_kbd_caps_led, |
| | 815 | }; |
| | 816 | |
| | 817 | __setup("hardware_ecc=", hardware_ecc_setup); |
| | 818 | |
| | 819 | static void __init glofiishx500_machine_init(void) |
| | 820 | { |
| | 821 | //int rc; |
| | 822 | |
| | 823 | /* set the panic callback to make AUX blink fast */ |
| | 824 | panic_blink = glofiishx500_panic_blink; |
| | 825 | |
| | 826 | /* do not force soft ecc if we are asked to use hardware_ecc */ |
| | 827 | if (hardware_ecc_str[0] == '1') |
| | 828 | glofiishx500_nand_info.software_ecc = 0; |
| | 829 | |
| | 830 | s3c_device_usb.dev.platform_data = &glofiishx500_usb_info; |
| | 831 | s3c_device_nand.dev.platform_data = &glofiishx500_nand_info; |
| | 832 | s3c_device_sdi.dev.platform_data = &glofiishx500_mmc_cfg; |
| | 833 | |
| | 834 | s3c24xx_fb_set_platdata(&glofiishx500_lcd_cfg); |
| | 835 | s3c24xx_udc_set_platdata(&glofiishx500_udc_cfg); |
| | 836 | set_s3c2410ts_info(&glofiishx500_ts_cfg); |
| | 837 | |
| | 838 | /* |
| | 839 | platform_device_register(>a01_bl_dev); |
| | 840 | platform_device_register(&m800_pm_bt_dev); |
| | 841 | platform_device_register(&m800_pm_gps_dev); |
| | 842 | platform_device_register(&m800_pm_fm_dev); |
| | 843 | platform_device_register(&m800_pm_modem_dev); |
| | 844 | platform_device_register(&m800_modem_dev); |
| | 845 | platform_device_register(&m800_cpld_dev); |
| | 846 | platform_device_register(&m800_button_dev); |
| | 847 | */ |
| | 848 | platform_device_register(&s3c_device_spi_lcm); |
| | 849 | |
| | 850 | s3c_i2c0_set_platdata(&glofiishx500_i2c_pdata); |
| | 851 | //i2c_register_board_info(0, glofiishx500_i2c_devs, |
| | 852 | // ARRAY_SIZE(glofiishx500_i2c_devs)); |
| | 853 | spi_register_board_info(glofiishx500_spi_board_info, |
| | 854 | ARRAY_SIZE(glofiishx500_spi_board_info)); |
| | 855 | |
| | 856 | platform_add_devices(glofiishx500_devices, ARRAY_SIZE(glofiishx500_devices)); |
| | 857 | |
| | 858 | s3c_pm_init(); |
| | 859 | |
| | 860 | printk(KERN_INFO "Glofiish X500 machine initialized\n"); |
| | 861 | } |
| | 862 | |
| | 863 | MACHINE_START(X500, "Glofiish X500") |
| | 864 | .phys_io = S3C2410_PA_UART, |
| | 865 | .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, |
| | 866 | .boot_params = S3C2410_SDRAM_PA + 0x100, |
| | 867 | .map_io = glofiishx500_map_io, |
| | 868 | .init_irq = s3c24xx_init_irq, |
| | 869 | .init_machine = glofiishx500_machine_init, |
| | 870 | .timer = &s3c24xx_timer, |
| | 871 | MACHINE_END |