diff options
author | Darius Augulis <augulis.darius@gmail.com> | 2010-10-19 00:52:29 -0400 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2010-10-19 00:52:29 -0400 |
commit | c115f67c03e468f18431840a97279cd3bfee8ad7 (patch) | |
tree | 1428894fa998aef1203a2d1d38c108bb443ac9ca /arch/arm/mach-s3c64xx | |
parent | cd07202cc8262e1669edff0d97715f3dd9260917 (diff) |
ARM: S3C64XX: add frame buffer support for mach-real6410
Add support for frame buffer device for mach-real6410.
Patch also adds support for feature string parsing
for real6410. The feature string is kernel command
line passed and currently lets select only LCD
configuration. At the moment there is support for
two LCD configurations - 4.3" and 7.0". Feature
parser is mach-mini2440 based.
Signed-off-by: Darius Augulis <augulis.darius@gmail.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-s3c64xx')
-rw-r--r-- | arch/arm/mach-s3c64xx/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c64xx/mach-real6410.c | 146 |
2 files changed, 143 insertions, 5 deletions
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig index 1e4d78af7d84..3bbd4184361d 100644 --- a/arch/arm/mach-s3c64xx/Kconfig +++ b/arch/arm/mach-s3c64xx/Kconfig | |||
@@ -104,6 +104,8 @@ config MACH_REAL6410 | |||
104 | select S3C_DEV_HSMMC | 104 | select S3C_DEV_HSMMC |
105 | select S3C_DEV_HSMMC1 | 105 | select S3C_DEV_HSMMC1 |
106 | select S3C64XX_SETUP_SDHCI | 106 | select S3C64XX_SETUP_SDHCI |
107 | select S3C_DEV_FB | ||
108 | select S3C64XX_SETUP_FB_24BPP | ||
107 | help | 109 | help |
108 | Machine support for the CoreWind REAL6410 | 110 | Machine support for the CoreWind REAL6410 |
109 | 111 | ||
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c index e130379ba0e8..bed75d221329 100644 --- a/arch/arm/mach-s3c64xx/mach-real6410.c +++ b/arch/arm/mach-s3c64xx/mach-real6410.c | |||
@@ -12,24 +12,35 @@ | |||
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/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <linux/serial_core.h> | ||
24 | #include <linux/types.h> | ||
25 | |||
23 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
24 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/map.h> | 28 | #include <asm/mach/map.h> |
29 | |||
26 | #include <mach/map.h> | 30 | #include <mach/map.h> |
27 | #include <mach/s3c6410.h> | 31 | #include <mach/regs-fb.h> |
32 | #include <mach/regs-gpio.h> | ||
33 | #include <mach/regs-modem.h> | ||
28 | #include <mach/regs-srom.h> | 34 | #include <mach/regs-srom.h> |
35 | #include <mach/s3c6410.h> | ||
36 | |||
29 | #include <plat/cpu.h> | 37 | #include <plat/cpu.h> |
30 | #include <plat/devs.h> | 38 | #include <plat/devs.h> |
39 | #include <plat/fb.h> | ||
31 | #include <plat/regs-serial.h> | 40 | #include <plat/regs-serial.h> |
32 | 41 | ||
42 | #include <video/platform_lcd.h> | ||
43 | |||
33 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) | 44 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) |
34 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) | 45 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) |
35 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) | 46 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) |
@@ -99,22 +110,145 @@ static struct platform_device real6410_device_eth = { | |||
99 | }, | 110 | }, |
100 | }; | 111 | }; |
101 | 112 | ||
113 | static struct s3c_fb_pd_win real6410_fb_win[] = { | ||
114 | { | ||
115 | .win_mode = { /* 4.3" 480x272 */ | ||
116 | .left_margin = 3, | ||
117 | .right_margin = 2, | ||
118 | .upper_margin = 1, | ||
119 | .lower_margin = 1, | ||
120 | .hsync_len = 40, | ||
121 | .vsync_len = 1, | ||
122 | .xres = 480, | ||
123 | .yres = 272, | ||
124 | }, | ||
125 | .max_bpp = 32, | ||
126 | .default_bpp = 16, | ||
127 | }, { | ||
128 | .win_mode = { /* 7.0" 800x480 */ | ||
129 | .left_margin = 8, | ||
130 | .right_margin = 13, | ||
131 | .upper_margin = 7, | ||
132 | .lower_margin = 5, | ||
133 | .hsync_len = 3, | ||
134 | .vsync_len = 1, | ||
135 | .xres = 800, | ||
136 | .yres = 480, | ||
137 | }, | ||
138 | .max_bpp = 32, | ||
139 | .default_bpp = 16, | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | static struct s3c_fb_platdata real6410_lcd_pdata __initdata = { | ||
144 | .setup_gpio = s3c64xx_fb_gpio_setup_24bpp, | ||
145 | .win[0] = &real6410_fb_win[0], | ||
146 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | ||
147 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | ||
148 | }; | ||
149 | |||
102 | static struct platform_device *real6410_devices[] __initdata = { | 150 | static struct platform_device *real6410_devices[] __initdata = { |
103 | &real6410_device_eth, | 151 | &real6410_device_eth, |
104 | &s3c_device_hsmmc0, | 152 | &s3c_device_hsmmc0, |
105 | &s3c_device_hsmmc1, | 153 | &s3c_device_hsmmc1, |
154 | &s3c_device_fb, | ||
106 | }; | 155 | }; |
107 | 156 | ||
108 | static void __init real6410_map_io(void) | 157 | static void __init real6410_map_io(void) |
109 | { | 158 | { |
159 | u32 tmp; | ||
160 | |||
110 | s3c64xx_init_io(NULL, 0); | 161 | s3c64xx_init_io(NULL, 0); |
111 | s3c24xx_init_clocks(12000000); | 162 | s3c24xx_init_clocks(12000000); |
112 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); | 163 | s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); |
164 | |||
165 | /* set the LCD type */ | ||
166 | tmp = __raw_readl(S3C64XX_SPCON); | ||
167 | tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK; | ||
168 | tmp |= S3C64XX_SPCON_LCD_SEL_RGB; | ||
169 | __raw_writel(tmp, S3C64XX_SPCON); | ||
170 | |||
171 | /* remove the LCD bypass */ | ||
172 | tmp = __raw_readl(S3C64XX_MODEM_MIFPCON); | ||
173 | tmp &= ~MIFPCON_LCD_BYPASS; | ||
174 | __raw_writel(tmp, S3C64XX_MODEM_MIFPCON); | ||
175 | } | ||
176 | |||
177 | /* | ||
178 | * real6410_features string | ||
179 | * | ||
180 | * 0-9 LCD configuration | ||
181 | * | ||
182 | */ | ||
183 | static char real6410_features_str[12] __initdata = "0"; | ||
184 | |||
185 | static int __init real6410_features_setup(char *str) | ||
186 | { | ||
187 | if (str) | ||
188 | strlcpy(real6410_features_str, str, | ||
189 | sizeof(real6410_features_str)); | ||
190 | return 1; | ||
191 | } | ||
192 | |||
193 | __setup("real6410=", real6410_features_setup); | ||
194 | |||
195 | #define FEATURE_SCREEN (1 << 0) | ||
196 | |||
197 | struct real6410_features_t { | ||
198 | int done; | ||
199 | int lcd_index; | ||
200 | }; | ||
201 | |||
202 | static void real6410_parse_features( | ||
203 | struct real6410_features_t *features, | ||
204 | const char *features_str) | ||
205 | { | ||
206 | const char *fp = features_str; | ||
207 | |||
208 | features->done = 0; | ||
209 | features->lcd_index = 0; | ||
210 | |||
211 | while (*fp) { | ||
212 | char f = *fp++; | ||
213 | |||
214 | switch (f) { | ||
215 | case '0'...'9': /* tft screen */ | ||
216 | if (features->done & FEATURE_SCREEN) { | ||
217 | printk(KERN_INFO "REAL6410: '%c' ignored, " | ||
218 | "screen type already set\n", f); | ||
219 | } else { | ||
220 | int li = f - '0'; | ||
221 | if (li >= ARRAY_SIZE(real6410_fb_win)) | ||
222 | printk(KERN_INFO "REAL6410: '%c' out " | ||
223 | "of range LCD mode\n", f); | ||
224 | else { | ||
225 | features->lcd_index = li; | ||
226 | } | ||
227 | } | ||
228 | features->done |= FEATURE_SCREEN; | ||
229 | break; | ||
230 | } | ||
231 | } | ||
113 | } | 232 | } |
114 | 233 | ||
115 | static void __init real6410_machine_init(void) | 234 | static void __init real6410_machine_init(void) |
116 | { | 235 | { |
117 | u32 cs1; | 236 | u32 cs1; |
237 | struct real6410_features_t features = { 0 }; | ||
238 | |||
239 | printk(KERN_INFO "REAL6410: Option string real6410=%s\n", | ||
240 | real6410_features_str); | ||
241 | |||
242 | /* Parse the feature string */ | ||
243 | real6410_parse_features(&features, real6410_features_str); | ||
244 | |||
245 | real6410_lcd_pdata.win[0] = &real6410_fb_win[features.lcd_index]; | ||
246 | |||
247 | printk(KERN_INFO "REAL6410: selected LCD display is %dx%d\n", | ||
248 | real6410_lcd_pdata.win[0]->win_mode.xres, | ||
249 | real6410_lcd_pdata.win[0]->win_mode.yres); | ||
250 | |||
251 | s3c_fb_set_platdata(&real6410_lcd_pdata); | ||
118 | 252 | ||
119 | /* configure nCS1 width to 16 bits */ | 253 | /* configure nCS1 width to 16 bits */ |
120 | 254 | ||
@@ -136,6 +270,8 @@ static void __init real6410_machine_init(void) | |||
136 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | | 270 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | |
137 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); | 271 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); |
138 | 272 | ||
273 | gpio_request(S3C64XX_GPF(15), "LCD power"); | ||
274 | |||
139 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); | 275 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); |
140 | } | 276 | } |
141 | 277 | ||