diff options
Diffstat (limited to 'arch/arm/mach-s3c64xx/mach-real6410.c')
| -rw-r--r-- | arch/arm/mach-s3c64xx/mach-real6410.c | 198 |
1 files changed, 193 insertions, 5 deletions
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c index 4b4475da8ec6..f9ef9b5c5f5a 100644 --- a/arch/arm/mach-s3c64xx/mach-real6410.c +++ b/arch/arm/mach-s3c64xx/mach-real6410.c | |||
| @@ -12,23 +12,39 @@ | |||
| 12 | * | 12 | * |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <linux/kernel.h> | 15 | #include <linux/init.h> |
| 16 | #include <linux/types.h> | ||
| 17 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/fb.h> | ||
| 18 | #include <linux/gpio.h> | ||
| 19 | #include <linux/kernel.h> | ||
| 18 | #include <linux/list.h> | 20 | #include <linux/list.h> |
| 19 | #include <linux/init.h> | ||
| 20 | #include <linux/dm9000.h> | 21 | #include <linux/dm9000.h> |
| 21 | #include <linux/serial_core.h> | 22 | #include <linux/mtd/mtd.h> |
| 23 | #include <linux/mtd/partitions.h> | ||
| 22 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/serial_core.h> | ||
| 26 | #include <linux/types.h> | ||
| 27 | |||
| 23 | #include <asm/mach-types.h> | 28 | #include <asm/mach-types.h> |
| 24 | #include <asm/mach/arch.h> | 29 | #include <asm/mach/arch.h> |
| 25 | #include <asm/mach/map.h> | 30 | #include <asm/mach/map.h> |
| 31 | |||
| 26 | #include <mach/map.h> | 32 | #include <mach/map.h> |
| 27 | #include <mach/s3c6410.h> | 33 | #include <mach/regs-fb.h> |
| 34 | #include <mach/regs-gpio.h> | ||
| 35 | #include <mach/regs-modem.h> | ||
| 28 | #include <mach/regs-srom.h> | 36 | #include <mach/regs-srom.h> |
| 37 | #include <mach/s3c6410.h> | ||
| 38 | |||
| 39 | #include <plat/adc.h> | ||
| 29 | #include <plat/cpu.h> | 40 | #include <plat/cpu.h> |
| 30 | #include <plat/devs.h> | 41 | #include <plat/devs.h> |
| 42 | #include <plat/fb.h> | ||
| 43 | #include <plat/nand.h> | ||
| 31 | #include <plat/regs-serial.h> | 44 | #include <plat/regs-serial.h> |
| 45 | #include <plat/ts.h> | ||
| 46 | |||
| 47 | #include <video/platform_lcd.h> | ||
| 32 | 48 | ||
| 33 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) | 49 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) |
| 34 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) | 50 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) |
| @@ -99,22 +115,192 @@ static struct platform_device real6410_device_eth = { | |||
| 99 | }, | 115 | }, |
| 100 | }; | 116 | }; |
| 101 | 117 | ||
| 118 | static struct s3c_fb_pd_win real6410_fb_win[] = { | ||
| 119 | { | ||
| 120 | .win_mode = { /* 4.3" 480x272 */ | ||
| 121 | .left_margin = 3, | ||
| 122 | .right_margin = 2, | ||
| 123 | .upper_margin = 1, | ||
| 124 | .lower_margin = 1, | ||
| 125 | .hsync_len = 40, | ||
| 126 | .vsync_len = 1, | ||
| 127 | .xres = 480, | ||
| 128 | .yres = 272, | ||
| 129 | }, | ||
| 130 | .max_bpp = 32, | ||
| 131 | .default_bpp = 16, | ||
| 132 | }, { | ||
| 133 | .win_mode = { /* 7.0" 800x480 */ | ||
| 134 | .left_margin = 8, | ||
| 135 | .right_margin = 13, | ||
| 136 | .upper_margin = 7, | ||
| 137 | .lower_margin = 5, | ||
| 138 | .hsync_len = 3, | ||
| 139 | .vsync_len = 1, | ||
| 140 | .xres = 800, | ||
| 141 | .yres = 480, | ||
| 142 | }, | ||
| 143 | .max_bpp = 32, | ||
| 144 | .default_bpp = 16, | ||
| 145 | }, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static struct s3c_fb_platdata real6410_lcd_pdata __initdata = { | ||
| 149 | .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, | ||
| 150 | .win[0] = &real6410_fb_win[0], | ||
| 151 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | ||
| 152 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
| 153 | }; | ||
| 154 | |||
| 155 | static struct mtd_partition real6410_nand_part[] = { | ||
| 156 | [0] = { | ||
| 157 | .name = "uboot", | ||
| 158 | .size = SZ_1M, | ||
| 159 | .offset = 0, | ||
| 160 | }, | ||
| 161 | [1] = { | ||
| 162 | .name = "kernel", | ||
| 163 | .size = SZ_2M, | ||
| 164 | .offset = SZ_1M, | ||
| 165 | }, | ||
| 166 | [2] = { | ||
| 167 | .name = "rootfs", | ||
| 168 | .size = MTDPART_SIZ_FULL, | ||
| 169 | .offset = SZ_1M + SZ_2M, | ||
| 170 | }, | ||
| 171 | }; | ||
| 172 | |||
| 173 | static struct s3c2410_nand_set real6410_nand_sets[] = { | ||
| 174 | [0] = { | ||
| 175 | .name = "nand", | ||
| 176 | .nr_chips = 1, | ||
| 177 | .nr_partitions = ARRAY_SIZE(real6410_nand_part), | ||
| 178 | .partitions = real6410_nand_part, | ||
| 179 | }, | ||
| 180 | }; | ||
| 181 | |||
| 182 | static struct s3c2410_platform_nand real6410_nand_info = { | ||
| 183 | .tacls = 25, | ||
| 184 | .twrph0 = 55, | ||
| 185 | .twrph1 = 40, | ||
| 186 | .nr_sets = ARRAY_SIZE(real6410_nand_sets), | ||
| 187 | .sets = real6410_nand_sets, | ||
| 188 | }; | ||
| 189 | |||
| 102 | static struct platform_device *real6410_devices[] __initdata = { | 190 | static struct platform_device *real6410_devices[] __initdata = { |
| 103 | &real6410_device_eth, | 191 | &real6410_device_eth, |
| 104 | &s3c_device_hsmmc0, | 192 | &s3c_device_hsmmc0, |
| 105 | &s3c_device_hsmmc1, | 193 | &s3c_device_hsmmc1, |
| 194 | &s3c_device_fb, | ||
| 195 | &s3c_device_nand, | ||
| 196 | &s3c_device_adc, | ||
| 197 | &s3c_device_ts, | ||
| 198 | &s3c_device_ohci, | ||
| 199 | }; | ||
| 200 | |||
| 201 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { | ||
| 202 | .delay = 10000, | ||
| 203 | .presc = 49, | ||
| 204 | .oversampling_shift = 2, | ||
| 106 | }; | 205 | }; |
| 107 | 206 | ||
| 108 | static void __init real6410_map_io(void) | 207 | static void __init real6410_map_io(void) |
| 109 | { | 208 | { |
| 209 | u32 tmp; | ||
| 210 | |||
| 110 | s3c64xx_init_io(NULL, 0); | 211 | s3c64xx_init_io(NULL, 0); |
| 111 | s3c24xx_init_clocks(12000000); | 212 | s3c24xx_init_clocks(12000000); |
| 112 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); | 213 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); |
| 214 | |||
| 215 | /* set the LCD type */ | ||
| 216 | tmp = __raw_readl(S3C64XX_SPCON); | ||
| 217 | tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK; | ||
| 218 | tmp |= S3C64XX_SPCON_LCD_SEL_RGB; | ||
| 219 | __raw_writel(tmp, S3C64XX_SPCON); | ||
| 220 | |||
| 221 | /* remove the LCD bypass */ | ||
| 222 | tmp = __raw_readl(S3C64XX_MODEM_MIFPCON); | ||
| 223 | tmp &= ~MIFPCON_LCD_BYPASS; | ||
| 224 | __raw_writel(tmp, S3C64XX_MODEM_MIFPCON); | ||
| 225 | } | ||
| 226 | |||
| 227 | /* | ||
| 228 | * real6410_features string | ||
| 229 | * | ||
| 230 | * 0-9 LCD configuration | ||
| 231 | * | ||
| 232 | */ | ||
| 233 | static char real6410_features_str[12] __initdata = "0"; | ||
| 234 | |||
| 235 | static int __init real6410_features_setup(char *str) | ||
| 236 | { | ||
| 237 | if (str) | ||
| 238 | strlcpy(real6410_features_str, str, | ||
| 239 | sizeof(real6410_features_str)); | ||
| 240 | return 1; | ||
| 241 | } | ||
| 242 | |||
| 243 | __setup("real6410=", real6410_features_setup); | ||
| 244 | |||
| 245 | #define FEATURE_SCREEN (1 << 0) | ||
| 246 | |||
| 247 | struct real6410_features_t { | ||
| 248 | int done; | ||
| 249 | int lcd_index; | ||
| 250 | }; | ||
| 251 | |||
| 252 | static void real6410_parse_features( | ||
| 253 | struct real6410_features_t *features, | ||
| 254 | const char *features_str) | ||
| 255 | { | ||
| 256 | const char *fp = features_str; | ||
| 257 | |||
| 258 | features->done = 0; | ||
| 259 | features->lcd_index = 0; | ||
| 260 | |||
| 261 | while (*fp) { | ||
| 262 | char f = *fp++; | ||
| 263 | |||
| 264 | switch (f) { | ||
| 265 | case '0'...'9': /* tft screen */ | ||
| 266 | if (features->done & FEATURE_SCREEN) { | ||
| 267 | printk(KERN_INFO "REAL6410: '%c' ignored, " | ||
| 268 | "screen type already set\n", f); | ||
| 269 | } else { | ||
| 270 | int li = f - '0'; | ||
| 271 | if (li >= ARRAY_SIZE(real6410_fb_win)) | ||
| 272 | printk(KERN_INFO "REAL6410: '%c' out " | ||
| 273 | "of range LCD mode\n", f); | ||
| 274 | else { | ||
| 275 | features->lcd_index = li; | ||
| 276 | } | ||
| 277 | } | ||
| 278 | features->done |= FEATURE_SCREEN; | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | } | ||
| 113 | } | 282 | } |
| 114 | 283 | ||
| 115 | static void __init real6410_machine_init(void) | 284 | static void __init real6410_machine_init(void) |
| 116 | { | 285 | { |
| 117 | u32 cs1; | 286 | u32 cs1; |
| 287 | struct real6410_features_t features = { 0 }; | ||
| 288 | |||
| 289 | printk(KERN_INFO "REAL6410: Option string real6410=%s\n", | ||
| 290 | real6410_features_str); | ||
| 291 | |||
| 292 | /* Parse the feature string */ | ||
| 293 | real6410_parse_features(&features, real6410_features_str); | ||
| 294 | |||
| 295 | real6410_lcd_pdata.win[0] = &real6410_fb_win[features.lcd_index]; | ||
| 296 | |||
| 297 | printk(KERN_INFO "REAL6410: selected LCD display is %dx%d\n", | ||
| 298 | real6410_lcd_pdata.win[0]->win_mode.xres, | ||
| 299 | real6410_lcd_pdata.win[0]->win_mode.yres); | ||
| 300 | |||
| 301 | s3c_fb_set_platdata(&real6410_lcd_pdata); | ||
| 302 | s3c_nand_set_platdata(&real6410_nand_info); | ||
| 303 | s3c24xx_ts_set_platdata(&s3c_ts_platform); | ||
| 118 | 304 | ||
| 119 | /* configure nCS1 width to 16 bits */ | 305 | /* configure nCS1 width to 16 bits */ |
| 120 | 306 | ||
| @@ -136,6 +322,8 @@ static void __init real6410_machine_init(void) | |||
| 136 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | | 322 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | |
| 137 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); | 323 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); |
| 138 | 324 | ||
| 325 | gpio_request(S3C64XX_GPF(15), "LCD power"); | ||
| 326 | |||
| 139 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); | 327 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); |
| 140 | } | 328 | } |
| 141 | 329 | ||
