aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c64xx/mach-mini6410.c
diff options
context:
space:
mode:
authorDarius Augulis <augulis.darius@gmail.com>2010-10-19 03:06:54 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-10-20 18:42:45 -0400
commit2abca87cb691485fdff348c279e5a928e51ceb5d (patch)
tree2909a2a08d2feb77ef0ef07cf4816da0270a6137 /arch/arm/mach-s3c64xx/mach-mini6410.c
parent1c5d76ef3064b6a939146023b7e1577f528b29a6 (diff)
ARM: S3C64XX: add frame buffer support for mach-mini6410
Add support for frame buffer device for mach-mini6410. Patch also adds support for feature string parsing for mini6410. 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/mach-mini6410.c')
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c129
1 files changed, 129 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
index d079ecf23500..441b71a9b19c 100644
--- a/arch/arm/mach-s3c64xx/mach-mini6410.c
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -14,6 +14,7 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/fb.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/list.h> 20#include <linux/list.h>
@@ -28,12 +29,15 @@
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29 30
30#include <mach/map.h> 31#include <mach/map.h>
32#include <mach/regs-fb.h>
31#include <mach/regs-gpio.h> 33#include <mach/regs-gpio.h>
34#include <mach/regs-modem.h>
32#include <mach/regs-srom.h> 35#include <mach/regs-srom.h>
33#include <mach/s3c6410.h> 36#include <mach/s3c6410.h>
34 37
35#include <plat/cpu.h> 38#include <plat/cpu.h>
36#include <plat/devs.h> 39#include <plat/devs.h>
40#include <plat/fb.h>
37#include <plat/nand.h> 41#include <plat/nand.h>
38#include <plat/regs-serial.h> 42#include <plat/regs-serial.h>
39 43
@@ -141,26 +145,148 @@ static struct s3c2410_platform_nand mini6410_nand_info = {
141 .sets = mini6410_nand_sets, 145 .sets = mini6410_nand_sets,
142}; 146};
143 147
148static struct s3c_fb_pd_win mini6410_fb_win[] = {
149 {
150 .win_mode = { /* 4.3" 480x272 */
151 .left_margin = 3,
152 .right_margin = 2,
153 .upper_margin = 1,
154 .lower_margin = 1,
155 .hsync_len = 40,
156 .vsync_len = 1,
157 .xres = 480,
158 .yres = 272,
159 },
160 .max_bpp = 32,
161 .default_bpp = 16,
162 }, {
163 .win_mode = { /* 7.0" 800x480 */
164 .left_margin = 8,
165 .right_margin = 13,
166 .upper_margin = 7,
167 .lower_margin = 5,
168 .hsync_len = 3,
169 .vsync_len = 1,
170 .xres = 800,
171 .yres = 480,
172 },
173 .max_bpp = 32,
174 .default_bpp = 16,
175 },
176};
177
178static struct s3c_fb_platdata mini6410_lcd_pdata __initdata = {
179 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
180 .win[0] = &mini6410_fb_win[0],
181 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
182 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
183};
184
144static struct platform_device *mini6410_devices[] __initdata = { 185static struct platform_device *mini6410_devices[] __initdata = {
145 &mini6410_device_eth, 186 &mini6410_device_eth,
146 &s3c_device_hsmmc0, 187 &s3c_device_hsmmc0,
147 &s3c_device_hsmmc1, 188 &s3c_device_hsmmc1,
148 &s3c_device_ohci, 189 &s3c_device_ohci,
149 &s3c_device_nand, 190 &s3c_device_nand,
191 &s3c_device_fb,
150}; 192};
151 193
152static void __init mini6410_map_io(void) 194static void __init mini6410_map_io(void)
153{ 195{
196 u32 tmp;
197
154 s3c64xx_init_io(NULL, 0); 198 s3c64xx_init_io(NULL, 0);
155 s3c24xx_init_clocks(12000000); 199 s3c24xx_init_clocks(12000000);
156 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs)); 200 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
201
202 /* set the LCD type */
203 tmp = __raw_readl(S3C64XX_SPCON);
204 tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
205 tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
206 __raw_writel(tmp, S3C64XX_SPCON);
207
208 /* remove the LCD bypass */
209 tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
210 tmp &= ~MIFPCON_LCD_BYPASS;
211 __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
212}
213
214/*
215 * mini6410_features string
216 *
217 * 0-9 LCD configuration
218 *
219 */
220static char mini6410_features_str[12] __initdata = "0";
221
222static int __init mini6410_features_setup(char *str)
223{
224 if (str)
225 strlcpy(mini6410_features_str, str,
226 sizeof(mini6410_features_str));
227 return 1;
228}
229
230__setup("mini6410=", mini6410_features_setup);
231
232#define FEATURE_SCREEN (1 << 0)
233
234struct mini6410_features_t {
235 int done;
236 int lcd_index;
237};
238
239static void mini6410_parse_features(
240 struct mini6410_features_t *features,
241 const char *features_str)
242{
243 const char *fp = features_str;
244
245 features->done = 0;
246 features->lcd_index = 0;
247
248 while (*fp) {
249 char f = *fp++;
250
251 switch (f) {
252 case '0'...'9': /* tft screen */
253 if (features->done & FEATURE_SCREEN) {
254 printk(KERN_INFO "MINI6410: '%c' ignored, "
255 "screen type already set\n", f);
256 } else {
257 int li = f - '0';
258 if (li >= ARRAY_SIZE(mini6410_fb_win))
259 printk(KERN_INFO "MINI6410: '%c' out "
260 "of range LCD mode\n", f);
261 else {
262 features->lcd_index = li;
263 }
264 }
265 features->done |= FEATURE_SCREEN;
266 break;
267 }
268 }
157} 269}
158 270
159static void __init mini6410_machine_init(void) 271static void __init mini6410_machine_init(void)
160{ 272{
161 u32 cs1; 273 u32 cs1;
274 struct mini6410_features_t features = { 0 };
275
276 printk(KERN_INFO "MINI6410: Option string mini6410=%s\n",
277 mini6410_features_str);
278
279 /* Parse the feature string */
280 mini6410_parse_features(&features, mini6410_features_str);
281
282 mini6410_lcd_pdata.win[0] = &mini6410_fb_win[features.lcd_index];
283
284 printk(KERN_INFO "MINI6410: selected LCD display is %dx%d\n",
285 mini6410_lcd_pdata.win[0]->win_mode.xres,
286 mini6410_lcd_pdata.win[0]->win_mode.yres);
162 287
163 s3c_nand_set_platdata(&mini6410_nand_info); 288 s3c_nand_set_platdata(&mini6410_nand_info);
289 s3c_fb_set_platdata(&mini6410_lcd_pdata);
164 290
165 /* configure nCS1 width to 16 bits */ 291 /* configure nCS1 width to 16 bits */
166 292
@@ -182,6 +308,9 @@ static void __init mini6410_machine_init(void)
182 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | 308 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
183 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); 309 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
184 310
311 gpio_request(S3C64XX_GPF(15), "LCD power");
312 gpio_request(S3C64XX_GPE(0), "LCD power");
313
185 platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices)); 314 platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
186} 315}
187 316