diff options
-rw-r--r-- | arch/arm/configs/nuc950_defconfig | 53 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/cpu.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/dev.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/fb.h | 83 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/include/mach/regs-ldm.h | 253 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/mach-nuc950evb.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-w90x900/nuc950.c | 4 | ||||
-rw-r--r-- | drivers/video/Kconfig | 21 | ||||
-rw-r--r-- | drivers/video/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/nuc900fb.c | 779 | ||||
-rw-r--r-- | drivers/video/nuc900fb.h | 55 |
11 files changed, 1338 insertions, 1 deletions
diff --git a/arch/arm/configs/nuc950_defconfig b/arch/arm/configs/nuc950_defconfig index 97300ec478dd..51cc2a260cbb 100644 --- a/arch/arm/configs/nuc950_defconfig +++ b/arch/arm/configs/nuc950_defconfig | |||
@@ -590,8 +590,40 @@ CONFIG_SSB_POSSIBLE=y | |||
590 | # | 590 | # |
591 | # CONFIG_VGASTATE is not set | 591 | # CONFIG_VGASTATE is not set |
592 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set | 592 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set |
593 | # CONFIG_FB is not set | ||
594 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | 593 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set |
594 | CONFIG_FB=y | ||
595 | # CONFIG_FIRMWARE_EDID is not set | ||
596 | # CONFIG_FB_DDC is not set | ||
597 | # CONFIG_FB_BOOT_VESA_SUPPORT is not set | ||
598 | CONFIG_FB_CFB_FILLRECT=y | ||
599 | CONFIG_FB_CFB_COPYAREA=y | ||
600 | CONFIG_FB_CFB_IMAGEBLIT=y | ||
601 | # CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set | ||
602 | # CONFIG_FB_SYS_FILLRECT is not set | ||
603 | # CONFIG_FB_SYS_COPYAREA is not set | ||
604 | # CONFIG_FB_SYS_IMAGEBLIT is not set | ||
605 | # CONFIG_FB_FOREIGN_ENDIAN is not set | ||
606 | # CONFIG_FB_SYS_FOPS is not set | ||
607 | # CONFIG_FB_SVGALIB is not set | ||
608 | # CONFIG_FB_MACMODES is not set | ||
609 | # CONFIG_FB_BACKLIGHT is not set | ||
610 | # CONFIG_FB_MODE_HELPERS is not set | ||
611 | # CONFIG_FB_TILEBLITTING is not set | ||
612 | |||
613 | # | ||
614 | # Frame buffer hardware drivers | ||
615 | # | ||
616 | # CONFIG_FB_S1D13XXX is not set | ||
617 | CONFIG_FB_NUC900=y | ||
618 | CONFIG_GPM1040A0_320X240=y | ||
619 | CONFIG_FB_NUC900_DEBUG=y | ||
620 | # CONFIG_FB_VIRTUAL is not set | ||
621 | # CONFIG_FB_METRONOME is not set | ||
622 | # CONFIG_FB_MB862XX is not set | ||
623 | # CONFIG_FB_BROADSHEET is not set | ||
624 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set | ||
625 | |||
626 | |||
595 | 627 | ||
596 | # | 628 | # |
597 | # Display device support | 629 | # Display device support |
@@ -603,6 +635,25 @@ CONFIG_SSB_POSSIBLE=y | |||
603 | # | 635 | # |
604 | # CONFIG_VGA_CONSOLE is not set | 636 | # CONFIG_VGA_CONSOLE is not set |
605 | CONFIG_DUMMY_CONSOLE=y | 637 | CONFIG_DUMMY_CONSOLE=y |
638 | CONFIG_FRAMEBUFFER_CONSOLE=y | ||
639 | CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y | ||
640 | # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set | ||
641 | CONFIG_FONTS=y | ||
642 | # CONFIG_FONT_8x8 is not set | ||
643 | CONFIG_FONT_8x16=y | ||
644 | # CONFIG_FONT_6x11 is not set | ||
645 | # CONFIG_FONT_7x14 is not set | ||
646 | # CONFIG_FONT_PEARL_8x8 is not set | ||
647 | # CONFIG_FONT_ACORN_8x8 is not set | ||
648 | # CONFIG_FONT_MINI_4x6 is not set | ||
649 | # CONFIG_FONT_SUN8x16 is not set | ||
650 | # CONFIG_FONT_SUN12x22 is not set | ||
651 | # CONFIG_FONT_10x18 is not set | ||
652 | CONFIG_LOGO=y | ||
653 | # CONFIG_LOGO_LINUX_MONO is not set | ||
654 | # CONFIG_LOGO_LINUX_VGA16 is not set | ||
655 | CONFIG_LOGO_LINUX_CLUT224=y | ||
656 | |||
606 | # CONFIG_SOUND is not set | 657 | # CONFIG_SOUND is not set |
607 | # CONFIG_HID_SUPPORT is not set | 658 | # CONFIG_HID_SUPPORT is not set |
608 | CONFIG_USB_SUPPORT=y | 659 | CONFIG_USB_SUPPORT=y |
diff --git a/arch/arm/mach-w90x900/cpu.h b/arch/arm/mach-w90x900/cpu.h index 4d58ba164e25..f8730b60bd76 100644 --- a/arch/arm/mach-w90x900/cpu.h +++ b/arch/arm/mach-w90x900/cpu.h | |||
@@ -57,3 +57,4 @@ extern struct platform_device nuc900_device_fmi; | |||
57 | extern struct platform_device nuc900_device_kpi; | 57 | extern struct platform_device nuc900_device_kpi; |
58 | extern struct platform_device nuc900_device_rtc; | 58 | extern struct platform_device nuc900_device_rtc; |
59 | extern struct platform_device nuc900_device_ts; | 59 | extern struct platform_device nuc900_device_ts; |
60 | extern struct platform_device nuc900_device_lcd; | ||
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c index ec711f4b4019..48876122df91 100644 --- a/arch/arm/mach-w90x900/dev.c +++ b/arch/arm/mach-w90x900/dev.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <mach/regs-serial.h> | 34 | #include <mach/regs-serial.h> |
35 | #include <mach/nuc900_spi.h> | 35 | #include <mach/nuc900_spi.h> |
36 | #include <mach/map.h> | 36 | #include <mach/map.h> |
37 | #include <mach/fb.h> | ||
37 | 38 | ||
38 | #include "cpu.h" | 39 | #include "cpu.h" |
39 | 40 | ||
@@ -380,6 +381,47 @@ struct platform_device nuc900_device_kpi = { | |||
380 | .resource = nuc900_kpi_resource, | 381 | .resource = nuc900_kpi_resource, |
381 | }; | 382 | }; |
382 | 383 | ||
384 | #ifdef CONFIG_FB_NUC900 | ||
385 | |||
386 | static struct resource nuc900_lcd_resource[] = { | ||
387 | [0] = { | ||
388 | .start = W90X900_PA_LCD, | ||
389 | .end = W90X900_PA_LCD + W90X900_SZ_LCD - 1, | ||
390 | .flags = IORESOURCE_MEM, | ||
391 | }, | ||
392 | [1] = { | ||
393 | .start = IRQ_LCD, | ||
394 | .end = IRQ_LCD, | ||
395 | .flags = IORESOURCE_IRQ, | ||
396 | } | ||
397 | }; | ||
398 | |||
399 | static u64 nuc900_device_lcd_dmamask = -1; | ||
400 | struct platform_device nuc900_device_lcd = { | ||
401 | .name = "nuc900-lcd", | ||
402 | .id = -1, | ||
403 | .num_resources = ARRAY_SIZE(nuc900_lcd_resource), | ||
404 | .resource = nuc900_lcd_resource, | ||
405 | .dev = { | ||
406 | .dma_mask = &nuc900_device_lcd_dmamask, | ||
407 | .coherent_dma_mask = -1, | ||
408 | } | ||
409 | }; | ||
410 | |||
411 | void nuc900_fb_set_platdata(struct nuc900fb_mach_info *pd) | ||
412 | { | ||
413 | struct nuc900fb_mach_info *npd; | ||
414 | |||
415 | npd = kmalloc(sizeof(*npd), GFP_KERNEL); | ||
416 | if (npd) { | ||
417 | memcpy(npd, pd, sizeof(*npd)); | ||
418 | nuc900_device_lcd.dev.platform_data = npd; | ||
419 | } else { | ||
420 | printk(KERN_ERR "no memory for LCD platform data\n"); | ||
421 | } | ||
422 | } | ||
423 | #endif | ||
424 | |||
383 | /*Here should be your evb resourse,such as LCD*/ | 425 | /*Here should be your evb resourse,such as LCD*/ |
384 | 426 | ||
385 | static struct platform_device *nuc900_public_dev[] __initdata = { | 427 | static struct platform_device *nuc900_public_dev[] __initdata = { |
diff --git a/arch/arm/mach-w90x900/include/mach/fb.h b/arch/arm/mach-w90x900/include/mach/fb.h new file mode 100644 index 000000000000..cec5ece765ed --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/fb.h | |||
@@ -0,0 +1,83 @@ | |||
1 | /* linux/include/asm/arch-nuc900/fb.h | ||
2 | * | ||
3 | * Copyright (c) 2008 Nuvoton technology corporation | ||
4 | * All rights reserved. | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * Changelog: | ||
12 | * | ||
13 | * 2008/08/26 vincen.zswan modify this file for LCD. | ||
14 | */ | ||
15 | |||
16 | #ifndef __ASM_ARM_FB_H | ||
17 | #define __ASM_ARM_FB_H | ||
18 | |||
19 | |||
20 | |||
21 | /* LCD Controller Hardware Desc */ | ||
22 | struct nuc900fb_hw { | ||
23 | unsigned int lcd_dccs; | ||
24 | unsigned int lcd_device_ctrl; | ||
25 | unsigned int lcd_mpulcd_cmd; | ||
26 | unsigned int lcd_int_cs; | ||
27 | unsigned int lcd_crtc_size; | ||
28 | unsigned int lcd_crtc_dend; | ||
29 | unsigned int lcd_crtc_hr; | ||
30 | unsigned int lcd_crtc_hsync; | ||
31 | unsigned int lcd_crtc_vr; | ||
32 | unsigned int lcd_va_baddr0; | ||
33 | unsigned int lcd_va_baddr1; | ||
34 | unsigned int lcd_va_fbctrl; | ||
35 | unsigned int lcd_va_scale; | ||
36 | unsigned int lcd_va_test; | ||
37 | unsigned int lcd_va_win; | ||
38 | unsigned int lcd_va_stuff; | ||
39 | }; | ||
40 | |||
41 | /* LCD Display Description */ | ||
42 | struct nuc900fb_display { | ||
43 | /* LCD Image type */ | ||
44 | unsigned type; | ||
45 | |||
46 | /* LCD Screen Size */ | ||
47 | unsigned short width; | ||
48 | unsigned short height; | ||
49 | |||
50 | /* LCD Screen Info */ | ||
51 | unsigned short xres; | ||
52 | unsigned short yres; | ||
53 | unsigned short bpp; | ||
54 | |||
55 | unsigned long pixclock; | ||
56 | unsigned short left_margin; | ||
57 | unsigned short right_margin; | ||
58 | unsigned short hsync_len; | ||
59 | unsigned short upper_margin; | ||
60 | unsigned short lower_margin; | ||
61 | unsigned short vsync_len; | ||
62 | |||
63 | /* hardware special register value */ | ||
64 | unsigned int dccs; | ||
65 | unsigned int devctl; | ||
66 | unsigned int fbctrl; | ||
67 | unsigned int scale; | ||
68 | }; | ||
69 | |||
70 | struct nuc900fb_mach_info { | ||
71 | struct nuc900fb_display *displays; | ||
72 | unsigned num_displays; | ||
73 | unsigned default_display; | ||
74 | /* GPIO Setting Info */ | ||
75 | unsigned gpio_dir; | ||
76 | unsigned gpio_dir_mask; | ||
77 | unsigned gpio_data; | ||
78 | unsigned gpio_data_mask; | ||
79 | }; | ||
80 | |||
81 | extern void __init nuc900_fb_set_platdata(struct nuc900fb_mach_info *); | ||
82 | |||
83 | #endif /* __ASM_ARM_FB_H */ | ||
diff --git a/arch/arm/mach-w90x900/include/mach/regs-ldm.h b/arch/arm/mach-w90x900/include/mach/regs-ldm.h new file mode 100644 index 000000000000..e9d480a5b232 --- /dev/null +++ b/arch/arm/mach-w90x900/include/mach/regs-ldm.h | |||
@@ -0,0 +1,253 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-w90x900/include/mach/regs-serial.h | ||
3 | * | ||
4 | * Copyright (c) 2009 Nuvoton technology corporation | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | * | ||
12 | * Description: | ||
13 | * Nuvoton Display, LCM Register list | ||
14 | * Author: Wang Qiang (rurality.linux@gmail.com) 2009/12/11 | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | |||
19 | #ifndef __ASM_ARM_W90X900_REGS_LDM_H | ||
20 | #define __ASM_ARM_W90X900_REGS_LDM_H | ||
21 | |||
22 | #include <mach/map.h> | ||
23 | |||
24 | /* Display Controller Control/Status Register */ | ||
25 | #define REG_LCM_DCCS (0x00) | ||
26 | |||
27 | #define LCM_DCCS_ENG_RST (1 << 0) | ||
28 | #define LCM_DCCS_VA_EN (1 << 1) | ||
29 | #define LCM_DCCS_OSD_EN (1 << 2) | ||
30 | #define LCM_DCCS_DISP_OUT_EN (1 << 3) | ||
31 | #define LCM_DCCS_DISP_INT_EN (1 << 4) | ||
32 | #define LCM_DCCS_CMD_ON (1 << 5) | ||
33 | #define LCM_DCCS_FIELD_INTR (1 << 6) | ||
34 | #define LCM_DCCS_SINGLE (1 << 7) | ||
35 | |||
36 | enum LCM_DCCS_VA_SRC { | ||
37 | LCM_DCCS_VA_SRC_YUV422 = (0 << 8), | ||
38 | LCM_DCCS_VA_SRC_YCBCR422 = (1 << 8), | ||
39 | LCM_DCCS_VA_SRC_RGB888 = (2 << 8), | ||
40 | LCM_DCCS_VA_SRC_RGB666 = (3 << 8), | ||
41 | LCM_DCCS_VA_SRC_RGB565 = (4 << 8), | ||
42 | LCM_DCCS_VA_SRC_RGB444LOW = (5 << 8), | ||
43 | LCM_DCCS_VA_SRC_RGB444HIGH = (7 << 8) | ||
44 | }; | ||
45 | |||
46 | |||
47 | /* Display Device Control Register */ | ||
48 | #define REG_LCM_DEV_CTRL (0x04) | ||
49 | |||
50 | enum LCM_DEV_CTRL_SWAP_YCbCr { | ||
51 | LCM_DEV_CTRL_SWAP_UYVY = (0 << 1), | ||
52 | LCM_DEV_CTRL_SWAP_YUYV = (1 << 1), | ||
53 | LCM_DEV_CTRL_SWAP_VYUY = (2 << 1), | ||
54 | LCM_DEV_CTRL_SWAP_YVYU = (3 << 1) | ||
55 | }; | ||
56 | |||
57 | enum LCM_DEV_CTRL_RGB_SHIFT { | ||
58 | LCM_DEV_CTRL_RGB_SHIFT_NOT = (0 << 3), | ||
59 | LCM_DEV_CTRL_RGB_SHIFT_ONECYCLE = (1 << 3), | ||
60 | LCM_DEV_CTRL_RGB_SHIFT_TWOCYCLE = (2 << 3), | ||
61 | LCM_DEV_CTRL_RGB_SHIFT_NOT_DEF = (3 << 3) | ||
62 | }; | ||
63 | |||
64 | enum LCM_DEV_CTRL_DEVICE { | ||
65 | LCM_DEV_CTRL_DEVICE_YUV422 = (0 << 5), | ||
66 | LCM_DEV_CTRL_DEVICE_YUV444 = (1 << 5), | ||
67 | LCM_DEV_CTRL_DEVICE_UNIPAC = (4 << 5), | ||
68 | LCM_DEV_CTRL_DEVICE_SEIKO_EPSON = (5 << 5), | ||
69 | LCM_DEV_CTRL_DEVICE_HIGH_COLOR = (6 << 5), | ||
70 | LCM_DEV_CTRL_DEVICE_MPU = (7 << 5) | ||
71 | }; | ||
72 | |||
73 | #define LCM_DEV_CTRL_LCD_DDA (8) | ||
74 | #define LCM_DEV_CTRL_YUV2CCIR (16) | ||
75 | |||
76 | enum LCM_DEV_CTRL_LCD_SEL { | ||
77 | LCM_DEV_CTRL_LCD_SEL_RGB_GBR = (0 << 17), | ||
78 | LCM_DEV_CTRL_LCD_SEL_BGR_RBG = (1 << 17), | ||
79 | LCM_DEV_CTRL_LCD_SEL_GBR_RGB = (2 << 17), | ||
80 | LCM_DEV_CTRL_LCD_SEL_RBG_BGR = (3 << 17) | ||
81 | }; | ||
82 | |||
83 | enum LCM_DEV_CTRL_FAL_D { | ||
84 | LCM_DEV_CTRL_FAL_D_FALLING = (0 << 19), | ||
85 | LCM_DEV_CTRL_FAL_D_RISING = (1 << 19), | ||
86 | }; | ||
87 | |||
88 | enum LCM_DEV_CTRL_H_POL { | ||
89 | LCM_DEV_CTRL_H_POL_LOW = (0 << 20), | ||
90 | LCM_DEV_CTRL_H_POL_HIGH = (1 << 20), | ||
91 | }; | ||
92 | |||
93 | enum LCM_DEV_CTRL_V_POL { | ||
94 | LCM_DEV_CTRL_V_POL_LOW = (0 << 21), | ||
95 | LCM_DEV_CTRL_V_POL_HIGH = (1 << 21), | ||
96 | }; | ||
97 | |||
98 | enum LCM_DEV_CTRL_VR_LACE { | ||
99 | LCM_DEV_CTRL_VR_LACE_NINTERLACE = (0 << 22), | ||
100 | LCM_DEV_CTRL_VR_LACE_INTERLACE = (1 << 22), | ||
101 | }; | ||
102 | |||
103 | enum LCM_DEV_CTRL_LACE { | ||
104 | LCM_DEV_CTRL_LACE_NINTERLACE = (0 << 23), | ||
105 | LCM_DEV_CTRL_LACE_INTERLACE = (1 << 23), | ||
106 | }; | ||
107 | |||
108 | enum LCM_DEV_CTRL_RGB_SCALE { | ||
109 | LCM_DEV_CTRL_RGB_SCALE_4096 = (0 << 24), | ||
110 | LCM_DEV_CTRL_RGB_SCALE_65536 = (1 << 24), | ||
111 | LCM_DEV_CTRL_RGB_SCALE_262144 = (2 << 24), | ||
112 | LCM_DEV_CTRL_RGB_SCALE_16777216 = (3 << 24), | ||
113 | }; | ||
114 | |||
115 | enum LCM_DEV_CTRL_DBWORD { | ||
116 | LCM_DEV_CTRL_DBWORD_HALFWORD = (0 << 26), | ||
117 | LCM_DEV_CTRL_DBWORD_FULLWORD = (1 << 26), | ||
118 | }; | ||
119 | |||
120 | enum LCM_DEV_CTRL_MPU68 { | ||
121 | LCM_DEV_CTRL_MPU68_80_SERIES = (0 << 27), | ||
122 | LCM_DEV_CTRL_MPU68_68_SERIES = (1 << 27), | ||
123 | }; | ||
124 | |||
125 | enum LCM_DEV_CTRL_DE_POL { | ||
126 | LCM_DEV_CTRL_DE_POL_HIGH = (0 << 28), | ||
127 | LCM_DEV_CTRL_DE_POL_LOW = (1 << 28), | ||
128 | }; | ||
129 | |||
130 | #define LCM_DEV_CTRL_CMD16 (29) | ||
131 | #define LCM_DEV_CTRL_CM16t18 (30) | ||
132 | #define LCM_DEV_CTRL_CMD_LOW (31) | ||
133 | |||
134 | /* MPU-Interface LCD Write Command */ | ||
135 | #define REG_LCM_MPU_CMD (0x08) | ||
136 | |||
137 | /* Interrupt Control/Status Register */ | ||
138 | #define REG_LCM_INT_CS (0x0c) | ||
139 | #define LCM_INT_CS_DISP_F_EN (1 << 0) | ||
140 | #define LCM_INT_CS_UNDERRUN_EN (1 << 1) | ||
141 | #define LCM_INT_CS_BUS_ERROR_INT (1 << 28) | ||
142 | #define LCM_INT_CS_UNDERRUN_INT (1 << 29) | ||
143 | #define LCM_INT_CS_DISP_F_STATUS (1 << 30) | ||
144 | #define LCM_INT_CS_DISP_F_INT (1 << 31) | ||
145 | |||
146 | /* CRTC Display Size Control Register */ | ||
147 | #define REG_LCM_CRTC_SIZE (0x10) | ||
148 | #define LCM_CRTC_SIZE_VTTVAL(x) ((x) << 16) | ||
149 | #define LCM_CRTC_SIZE_HTTVAL(x) ((x) << 0) | ||
150 | |||
151 | /* CRTC Display Enable End */ | ||
152 | #define REG_LCM_CRTC_DEND (0x14) | ||
153 | #define LCM_CRTC_DEND_VDENDVAL(x) ((x) << 16) | ||
154 | #define LCM_CRTC_DEND_HDENDVAL(x) ((x) << 0) | ||
155 | |||
156 | /* CRTC Internal Horizontal Retrace Control Register */ | ||
157 | #define REG_LCM_CRTC_HR (0x18) | ||
158 | #define LCM_CRTC_HR_EVAL(x) ((x) << 16) | ||
159 | #define LCM_CRTC_HR_SVAL(x) ((x) << 0) | ||
160 | |||
161 | /* CRTC Horizontal Sync Control Register */ | ||
162 | #define REG_LCM_CRTC_HSYNC (0x1C) | ||
163 | #define LCM_CRTC_HSYNC_SHIFTVAL(x) ((x) << 30) | ||
164 | #define LCM_CRTC_HSYNC_EVAL(x) ((x) << 16) | ||
165 | #define LCM_CRTC_HSYNC_SVAL(x) ((x) << 0) | ||
166 | |||
167 | /* CRTC Internal Vertical Retrace Control Register */ | ||
168 | #define REG_LCM_CRTC_VR (0x20) | ||
169 | #define LCM_CRTC_VR_EVAL(x) ((x) << 16) | ||
170 | #define LCM_CRTC_VR_SVAL(x) ((x) << 0) | ||
171 | |||
172 | /* Video Stream Frame Buffer-0 Starting Address */ | ||
173 | #define REG_LCM_VA_BADDR0 (0x24) | ||
174 | |||
175 | /* Video Stream Frame Buffer-1 Starting Address */ | ||
176 | #define REG_LCM_VA_BADDR1 (0x28) | ||
177 | |||
178 | /* Video Stream Frame Buffer Control Register */ | ||
179 | #define REG_LCM_VA_FBCTRL (0x2C) | ||
180 | #define LCM_VA_FBCTRL_IO_REGION_HALF (1 << 28) | ||
181 | #define LCM_VA_FBCTRL_FIELD_DUAL (1 << 29) | ||
182 | #define LCM_VA_FBCTRL_START_BUF (1 << 30) | ||
183 | #define LCM_VA_FBCTRL_DB_EN (1 << 31) | ||
184 | |||
185 | /* Video Stream Scaling Control Register */ | ||
186 | #define REG_LCM_VA_SCALE (0x30) | ||
187 | #define LCM_VA_SCALE_XCOPY_INTERPOLATION (0 << 15) | ||
188 | #define LCM_VA_SCALE_XCOPY_DUPLICATION (1 << 15) | ||
189 | |||
190 | /* Image Stream Active Window Coordinates */ | ||
191 | #define REG_LCM_VA_WIN (0x38) | ||
192 | |||
193 | /* Image Stream Stuff Pixel */ | ||
194 | #define REG_LCM_VA_STUFF (0x3C) | ||
195 | |||
196 | /* OSD Window Starting Coordinates */ | ||
197 | #define REG_LCM_OSD_WINS (0x40) | ||
198 | |||
199 | /* OSD Window Ending Coordinates */ | ||
200 | #define REG_LCM_OSD_WINE (0x44) | ||
201 | |||
202 | /* OSD Stream Frame Buffer Starting Address */ | ||
203 | #define REG_LCM_OSD_BADDR (0x48) | ||
204 | |||
205 | /* OSD Stream Frame Buffer Control Register */ | ||
206 | #define REG_LCM_OSD_FBCTRL (0x4c) | ||
207 | |||
208 | /* OSD Overlay Control Register */ | ||
209 | #define REG_LCM_OSD_OVERLAY (0x50) | ||
210 | |||
211 | /* OSD Overlay Color-Key Pattern Register */ | ||
212 | #define REG_LCM_OSD_CKEY (0x54) | ||
213 | |||
214 | /* OSD Overlay Color-Key Mask Register */ | ||
215 | #define REG_LCM_OSD_CMASK (0x58) | ||
216 | |||
217 | /* OSD Window Skip1 Register */ | ||
218 | #define REG_LCM_OSD_SKIP1 (0x5C) | ||
219 | |||
220 | /* OSD Window Skip2 Register */ | ||
221 | #define REG_LCM_OSD_SKIP2 (0x60) | ||
222 | |||
223 | /* OSD horizontal up scaling control register */ | ||
224 | #define REG_LCM_OSD_SCALE (0x64) | ||
225 | |||
226 | /* MPU Vsync control register */ | ||
227 | #define REG_LCM_MPU_VSYNC (0x68) | ||
228 | |||
229 | /* Hardware cursor control Register */ | ||
230 | #define REG_LCM_HC_CTRL (0x6C) | ||
231 | |||
232 | /* Hardware cursot tip point potison on va picture */ | ||
233 | #define REG_LCM_HC_POS (0x70) | ||
234 | |||
235 | /* Hardware Cursor Window Buffer Control Register */ | ||
236 | #define REG_LCM_HC_WBCTRL (0x74) | ||
237 | |||
238 | /* Hardware cursor memory base address register */ | ||
239 | #define REG_LCM_HC_BADDR (0x78) | ||
240 | |||
241 | /* Hardware cursor color ram register mapped to bpp = 0 */ | ||
242 | #define REG_LCM_HC_COLOR0 (0x7C) | ||
243 | |||
244 | /* Hardware cursor color ram register mapped to bpp = 1 */ | ||
245 | #define REG_LCM_HC_COLOR1 (0x80) | ||
246 | |||
247 | /* Hardware cursor color ram register mapped to bpp = 2 */ | ||
248 | #define REG_LCM_HC_COLOR2 (0x84) | ||
249 | |||
250 | /* Hardware cursor color ram register mapped to bpp = 3 */ | ||
251 | #define REG_LCM_HC_COLOR3 (0x88) | ||
252 | |||
253 | #endif /* __ASM_ARM_W90X900_REGS_LDM_H */ | ||
diff --git a/arch/arm/mach-w90x900/mach-nuc950evb.c b/arch/arm/mach-w90x900/mach-nuc950evb.c index cef903bcccd1..b3edc3cccf52 100644 --- a/arch/arm/mach-w90x900/mach-nuc950evb.c +++ b/arch/arm/mach-w90x900/mach-nuc950evb.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU General Public License as | 11 | * modify it under the terms of the GNU General Public License as |
12 | * published by the Free Software Foundation;version 2 of the License. | 12 | * published by the Free Software Foundation;version 2 of the License. |
13 | * history: | ||
14 | * Wang Qiang (rurality.linux@gmail.com) add LCD support | ||
13 | * | 15 | * |
14 | */ | 16 | */ |
15 | 17 | ||
@@ -18,9 +20,51 @@ | |||
18 | #include <asm/mach/map.h> | 20 | #include <asm/mach/map.h> |
19 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
20 | #include <mach/map.h> | 22 | #include <mach/map.h> |
23 | #include <mach/regs-ldm.h> | ||
24 | #include <mach/fb.h> | ||
21 | 25 | ||
22 | #include "nuc950.h" | 26 | #include "nuc950.h" |
23 | 27 | ||
28 | #ifdef CONFIG_FB_NUC900 | ||
29 | /* LCD Controller */ | ||
30 | static struct nuc900fb_display __initdata nuc950_lcd_info[] = { | ||
31 | /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */ | ||
32 | [0] = { | ||
33 | .type = LCM_DCCS_VA_SRC_RGB565, | ||
34 | .width = 320, | ||
35 | .height = 240, | ||
36 | .xres = 320, | ||
37 | .yres = 240, | ||
38 | .bpp = 16, | ||
39 | .pixclock = 200000, | ||
40 | .left_margin = 34, | ||
41 | .right_margin = 54, | ||
42 | .hsync_len = 10, | ||
43 | .upper_margin = 18, | ||
44 | .lower_margin = 4, | ||
45 | .vsync_len = 1, | ||
46 | .dccs = 0x8e00041a, | ||
47 | .devctl = 0x060800c0, | ||
48 | .fbctrl = 0x00a000a0, | ||
49 | .scale = 0x04000400, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct nuc900fb_mach_info nuc950_fb_info __initdata = { | ||
54 | #if defined(CONFIG_GPM1040A0_320X240) | ||
55 | .displays = &nuc950_lcd_info[0], | ||
56 | #else | ||
57 | .displays = nuc950_lcd_info, | ||
58 | #endif | ||
59 | .num_displays = ARRAY_SIZE(nuc950_lcd_info), | ||
60 | .default_display = 0, | ||
61 | .gpio_dir = 0x00000004, | ||
62 | .gpio_dir_mask = 0xFFFFFFFD, | ||
63 | .gpio_data = 0x00000004, | ||
64 | .gpio_data_mask = 0xFFFFFFFD, | ||
65 | }; | ||
66 | #endif | ||
67 | |||
24 | static void __init nuc950evb_map_io(void) | 68 | static void __init nuc950evb_map_io(void) |
25 | { | 69 | { |
26 | nuc950_map_io(); | 70 | nuc950_map_io(); |
@@ -30,6 +74,9 @@ static void __init nuc950evb_map_io(void) | |||
30 | static void __init nuc950evb_init(void) | 74 | static void __init nuc950evb_init(void) |
31 | { | 75 | { |
32 | nuc950_board_init(); | 76 | nuc950_board_init(); |
77 | #ifdef CONFIG_FB_NUC900 | ||
78 | nuc900_fb_set_platdata(&nuc950_fb_info); | ||
79 | #endif | ||
33 | } | 80 | } |
34 | 81 | ||
35 | MACHINE_START(W90P950EVB, "W90P950EVB") | 82 | MACHINE_START(W90P950EVB, "W90P950EVB") |
diff --git a/arch/arm/mach-w90x900/nuc950.c b/arch/arm/mach-w90x900/nuc950.c index 149508116d18..4d1f1ab044c4 100644 --- a/arch/arm/mach-w90x900/nuc950.c +++ b/arch/arm/mach-w90x900/nuc950.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <asm/mach/map.h> | 19 | #include <asm/mach/map.h> |
20 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
21 | |||
21 | #include "cpu.h" | 22 | #include "cpu.h" |
22 | 23 | ||
23 | /* define specific CPU platform device */ | 24 | /* define specific CPU platform device */ |
@@ -25,6 +26,9 @@ | |||
25 | static struct platform_device *nuc950_dev[] __initdata = { | 26 | static struct platform_device *nuc950_dev[] __initdata = { |
26 | &nuc900_device_kpi, | 27 | &nuc900_device_kpi, |
27 | &nuc900_device_fmi, | 28 | &nuc900_device_fmi, |
29 | #ifdef CONFIG_FB_NUC900 | ||
30 | &nuc900_device_lcd, | ||
31 | #endif | ||
28 | }; | 32 | }; |
29 | 33 | ||
30 | /* define specific CPU platform io map */ | 34 | /* define specific CPU platform io map */ |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7fe18390c587..3e5b4490c011 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -1944,6 +1944,27 @@ config FB_S3C2410_DEBUG | |||
1944 | Turn on debugging messages. Note that you can set/unset at run time | 1944 | Turn on debugging messages. Note that you can set/unset at run time |
1945 | through sysfs | 1945 | through sysfs |
1946 | 1946 | ||
1947 | config FB_NUC900 | ||
1948 | bool "NUC900 LCD framebuffer support" | ||
1949 | depends on FB && ARCH_W90X900 | ||
1950 | select FB_CFB_FILLRECT | ||
1951 | select FB_CFB_COPYAREA | ||
1952 | select FB_CFB_IMAGEBLIT | ||
1953 | ---help--- | ||
1954 | Frame buffer driver for the built-in LCD controller in the Nuvoton | ||
1955 | NUC900 processor | ||
1956 | |||
1957 | config GPM1040A0_320X240 | ||
1958 | bool "Giantplus Technology GPM1040A0 320x240 Color TFT LCD" | ||
1959 | depends on FB_NUC900 | ||
1960 | |||
1961 | config FB_NUC900_DEBUG | ||
1962 | bool "NUC900 lcd debug messages" | ||
1963 | depends on FB_NUC900 | ||
1964 | help | ||
1965 | Turn on debugging messages. Note that you can set/unset at run time | ||
1966 | through sysfs | ||
1967 | |||
1947 | config FB_SM501 | 1968 | config FB_SM501 |
1948 | tristate "Silicon Motion SM501 framebuffer support" | 1969 | tristate "Silicon Motion SM501 framebuffer support" |
1949 | depends on FB && MFD_SM501 | 1970 | depends on FB && MFD_SM501 |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 4ecb30c4f3f2..a42ad55e3a15 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -129,6 +129,7 @@ obj-$(CONFIG_XEN_FBDEV_FRONTEND) += xen-fbfront.o | |||
129 | obj-$(CONFIG_FB_CARMINE) += carminefb.o | 129 | obj-$(CONFIG_FB_CARMINE) += carminefb.o |
130 | obj-$(CONFIG_FB_MB862XX) += mb862xx/ | 130 | obj-$(CONFIG_FB_MB862XX) += mb862xx/ |
131 | obj-$(CONFIG_FB_MSM) += msm/ | 131 | obj-$(CONFIG_FB_MSM) += msm/ |
132 | obj-$(CONFIG_FB_NUC900) += nuc900fb.o | ||
132 | 133 | ||
133 | # Platform or fallback drivers go here | 134 | # Platform or fallback drivers go here |
134 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | 135 | obj-$(CONFIG_FB_UVESA) += uvesafb.o |
diff --git a/drivers/video/nuc900fb.c b/drivers/video/nuc900fb.c new file mode 100644 index 000000000000..6bf0d460a738 --- /dev/null +++ b/drivers/video/nuc900fb.c | |||
@@ -0,0 +1,779 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (c) 2009 Nuvoton technology corporation | ||
4 | * All rights reserved. | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * Description: | ||
12 | * Nuvoton LCD Controller Driver | ||
13 | * Author: | ||
14 | * Wang Qiang (rurality.linux@gmail.com) 2009/12/11 | ||
15 | */ | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/errno.h> | ||
19 | #include <linux/string.h> | ||
20 | #include <linux/mm.h> | ||
21 | #include <linux/tty.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <linux/delay.h> | ||
24 | #include <linux/fb.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/workqueue.h> | ||
29 | #include <linux/wait.h> | ||
30 | #include <linux/platform_device.h> | ||
31 | #include <linux/clk.h> | ||
32 | #include <linux/cpufreq.h> | ||
33 | #include <linux/io.h> | ||
34 | #include <linux/pm.h> | ||
35 | #include <linux/device.h> | ||
36 | |||
37 | #include <mach/map.h> | ||
38 | #include <mach/regs-clock.h> | ||
39 | #include <mach/regs-ldm.h> | ||
40 | #include <mach/fb.h> | ||
41 | #include <mach/clkdev.h> | ||
42 | |||
43 | #include "nuc900fb.h" | ||
44 | |||
45 | |||
46 | /* | ||
47 | * Initialize the nuc900 video (dual) buffer address | ||
48 | */ | ||
49 | static void nuc900fb_set_lcdaddr(struct fb_info *info) | ||
50 | { | ||
51 | struct nuc900fb_info *fbi = info->par; | ||
52 | void __iomem *regs = fbi->io; | ||
53 | unsigned long vbaddr1, vbaddr2; | ||
54 | |||
55 | vbaddr1 = info->fix.smem_start; | ||
56 | vbaddr2 = info->fix.smem_start; | ||
57 | vbaddr2 += info->fix.line_length * info->var.yres; | ||
58 | |||
59 | /* set frambuffer start phy addr*/ | ||
60 | writel(vbaddr1, regs + REG_LCM_VA_BADDR0); | ||
61 | writel(vbaddr2, regs + REG_LCM_VA_BADDR1); | ||
62 | |||
63 | writel(fbi->regs.lcd_va_fbctrl, regs + REG_LCM_VA_FBCTRL); | ||
64 | writel(fbi->regs.lcd_va_scale, regs + REG_LCM_VA_SCALE); | ||
65 | } | ||
66 | |||
67 | /* | ||
68 | * calculate divider for lcd div | ||
69 | */ | ||
70 | static unsigned int nuc900fb_calc_pixclk(struct nuc900fb_info *fbi, | ||
71 | unsigned long pixclk) | ||
72 | { | ||
73 | unsigned long clk = fbi->clk_rate; | ||
74 | unsigned long long div; | ||
75 | |||
76 | /* pixclk is in picseconds. our clock is in Hz*/ | ||
77 | /* div = (clk * pixclk)/10^12 */ | ||
78 | div = (unsigned long long)clk * pixclk; | ||
79 | div >>= 12; | ||
80 | do_div(div, 625 * 625UL * 625); | ||
81 | |||
82 | dev_dbg(fbi->dev, "pixclk %ld, divisor is %lld\n", pixclk, div); | ||
83 | |||
84 | return div; | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * Check the video params of 'var'. | ||
89 | */ | ||
90 | static int nuc900fb_check_var(struct fb_var_screeninfo *var, | ||
91 | struct fb_info *info) | ||
92 | { | ||
93 | struct nuc900fb_info *fbi = info->par; | ||
94 | struct nuc900fb_mach_info *mach_info = fbi->dev->platform_data; | ||
95 | struct nuc900fb_display *display = NULL; | ||
96 | struct nuc900fb_display *default_display = mach_info->displays + | ||
97 | mach_info->default_display; | ||
98 | int i; | ||
99 | |||
100 | dev_dbg(fbi->dev, "check_var(var=%p, info=%p)\n", var, info); | ||
101 | |||
102 | /* validate x/y resolution */ | ||
103 | /* choose default mode if possible */ | ||
104 | if (var->xres == default_display->xres && | ||
105 | var->yres == default_display->yres && | ||
106 | var->bits_per_pixel == default_display->bpp) | ||
107 | display = default_display; | ||
108 | else | ||
109 | for (i = 0; i < mach_info->num_displays; i++) | ||
110 | if (var->xres == mach_info->displays[i].xres && | ||
111 | var->yres == mach_info->displays[i].yres && | ||
112 | var->bits_per_pixel == mach_info->displays[i].bpp) { | ||
113 | display = mach_info->displays + i; | ||
114 | break; | ||
115 | } | ||
116 | |||
117 | if (display == NULL) { | ||
118 | printk(KERN_ERR "wrong resolution or depth %dx%d at %d bit per pixel\n", | ||
119 | var->xres, var->yres, var->bits_per_pixel); | ||
120 | return -EINVAL; | ||
121 | } | ||
122 | |||
123 | /* it should be the same size as the display */ | ||
124 | var->xres_virtual = display->xres; | ||
125 | var->yres_virtual = display->yres; | ||
126 | var->height = display->height; | ||
127 | var->width = display->width; | ||
128 | |||
129 | /* copy lcd settings */ | ||
130 | var->pixclock = display->pixclock; | ||
131 | var->left_margin = display->left_margin; | ||
132 | var->right_margin = display->right_margin; | ||
133 | var->upper_margin = display->upper_margin; | ||
134 | var->lower_margin = display->lower_margin; | ||
135 | var->vsync_len = display->vsync_len; | ||
136 | var->hsync_len = display->hsync_len; | ||
137 | |||
138 | var->transp.offset = 0; | ||
139 | var->transp.length = 0; | ||
140 | |||
141 | fbi->regs.lcd_dccs = display->dccs; | ||
142 | fbi->regs.lcd_device_ctrl = display->devctl; | ||
143 | fbi->regs.lcd_va_fbctrl = display->fbctrl; | ||
144 | fbi->regs.lcd_va_scale = display->scale; | ||
145 | |||
146 | /* set R/G/B possions */ | ||
147 | switch (var->bits_per_pixel) { | ||
148 | case 1: | ||
149 | case 2: | ||
150 | case 4: | ||
151 | case 8: | ||
152 | default: | ||
153 | var->red.offset = 0; | ||
154 | var->red.length = var->bits_per_pixel; | ||
155 | var->green = var->red; | ||
156 | var->blue = var->red; | ||
157 | break; | ||
158 | case 12: | ||
159 | var->red.length = 4; | ||
160 | var->green.length = 4; | ||
161 | var->blue.length = 4; | ||
162 | var->red.offset = 8; | ||
163 | var->green.offset = 4; | ||
164 | var->blue.offset = 0; | ||
165 | break; | ||
166 | case 16: | ||
167 | var->red.length = 5; | ||
168 | var->green.length = 6; | ||
169 | var->blue.length = 5; | ||
170 | var->red.offset = 11; | ||
171 | var->green.offset = 5; | ||
172 | var->blue.offset = 0; | ||
173 | break; | ||
174 | case 18: | ||
175 | var->red.length = 6; | ||
176 | var->green.length = 6; | ||
177 | var->blue.length = 6; | ||
178 | var->red.offset = 12; | ||
179 | var->green.offset = 6; | ||
180 | var->blue.offset = 0; | ||
181 | break; | ||
182 | case 32: | ||
183 | var->red.length = 8; | ||
184 | var->green.length = 8; | ||
185 | var->blue.length = 8; | ||
186 | var->red.offset = 16; | ||
187 | var->green.offset = 8; | ||
188 | var->blue.offset = 0; | ||
189 | break; | ||
190 | } | ||
191 | |||
192 | return 0; | ||
193 | } | ||
194 | |||
195 | /* | ||
196 | * Calculate lcd register values from var setting & save into hw | ||
197 | */ | ||
198 | static void nuc900fb_calculate_lcd_regs(const struct fb_info *info, | ||
199 | struct nuc900fb_hw *regs) | ||
200 | { | ||
201 | const struct fb_var_screeninfo *var = &info->var; | ||
202 | int vtt = var->height + var->upper_margin + var->lower_margin; | ||
203 | int htt = var->width + var->left_margin + var->right_margin; | ||
204 | int hsync = var->width + var->right_margin; | ||
205 | int vsync = var->height + var->lower_margin; | ||
206 | |||
207 | regs->lcd_crtc_size = LCM_CRTC_SIZE_VTTVAL(vtt) | | ||
208 | LCM_CRTC_SIZE_HTTVAL(htt); | ||
209 | regs->lcd_crtc_dend = LCM_CRTC_DEND_VDENDVAL(var->height) | | ||
210 | LCM_CRTC_DEND_HDENDVAL(var->width); | ||
211 | regs->lcd_crtc_hr = LCM_CRTC_HR_EVAL(var->width + 5) | | ||
212 | LCM_CRTC_HR_SVAL(var->width + 1); | ||
213 | regs->lcd_crtc_hsync = LCM_CRTC_HSYNC_EVAL(hsync + var->hsync_len) | | ||
214 | LCM_CRTC_HSYNC_SVAL(hsync); | ||
215 | regs->lcd_crtc_vr = LCM_CRTC_VR_EVAL(vsync + var->vsync_len) | | ||
216 | LCM_CRTC_VR_SVAL(vsync); | ||
217 | |||
218 | } | ||
219 | |||
220 | /* | ||
221 | * Activate (set) the controller from the given framebuffer | ||
222 | * information | ||
223 | */ | ||
224 | static void nuc900fb_activate_var(struct fb_info *info) | ||
225 | { | ||
226 | struct nuc900fb_info *fbi = info->par; | ||
227 | void __iomem *regs = fbi->io; | ||
228 | struct fb_var_screeninfo *var = &info->var; | ||
229 | int clkdiv; | ||
230 | |||
231 | clkdiv = nuc900fb_calc_pixclk(fbi, var->pixclock) - 1; | ||
232 | if (clkdiv < 0) | ||
233 | clkdiv = 0; | ||
234 | |||
235 | nuc900fb_calculate_lcd_regs(info, &fbi->regs); | ||
236 | |||
237 | /* set the new lcd registers*/ | ||
238 | |||
239 | dev_dbg(fbi->dev, "new lcd register set:\n"); | ||
240 | dev_dbg(fbi->dev, "dccs = 0x%08x\n", fbi->regs.lcd_dccs); | ||
241 | dev_dbg(fbi->dev, "dev_ctl = 0x%08x\n", fbi->regs.lcd_device_ctrl); | ||
242 | dev_dbg(fbi->dev, "crtc_size = 0x%08x\n", fbi->regs.lcd_crtc_size); | ||
243 | dev_dbg(fbi->dev, "crtc_dend = 0x%08x\n", fbi->regs.lcd_crtc_dend); | ||
244 | dev_dbg(fbi->dev, "crtc_hr = 0x%08x\n", fbi->regs.lcd_crtc_hr); | ||
245 | dev_dbg(fbi->dev, "crtc_hsync = 0x%08x\n", fbi->regs.lcd_crtc_hsync); | ||
246 | dev_dbg(fbi->dev, "crtc_vr = 0x%08x\n", fbi->regs.lcd_crtc_vr); | ||
247 | |||
248 | writel(fbi->regs.lcd_device_ctrl, regs + REG_LCM_DEV_CTRL); | ||
249 | writel(fbi->regs.lcd_crtc_size, regs + REG_LCM_CRTC_SIZE); | ||
250 | writel(fbi->regs.lcd_crtc_dend, regs + REG_LCM_CRTC_DEND); | ||
251 | writel(fbi->regs.lcd_crtc_hr, regs + REG_LCM_CRTC_HR); | ||
252 | writel(fbi->regs.lcd_crtc_hsync, regs + REG_LCM_CRTC_HSYNC); | ||
253 | writel(fbi->regs.lcd_crtc_vr, regs + REG_LCM_CRTC_VR); | ||
254 | |||
255 | /* set lcd address pointers */ | ||
256 | nuc900fb_set_lcdaddr(info); | ||
257 | |||
258 | writel(fbi->regs.lcd_dccs, regs + REG_LCM_DCCS); | ||
259 | } | ||
260 | |||
261 | /* | ||
262 | * Alters the hardware state. | ||
263 | * | ||
264 | */ | ||
265 | static int nuc900fb_set_par(struct fb_info *info) | ||
266 | { | ||
267 | struct fb_var_screeninfo *var = &info->var; | ||
268 | |||
269 | switch (var->bits_per_pixel) { | ||
270 | case 32: | ||
271 | case 24: | ||
272 | case 18: | ||
273 | case 16: | ||
274 | case 12: | ||
275 | info->fix.visual = FB_VISUAL_TRUECOLOR; | ||
276 | break; | ||
277 | case 1: | ||
278 | info->fix.visual = FB_VISUAL_MONO01; | ||
279 | break; | ||
280 | default: | ||
281 | info->fix.visual = FB_VISUAL_PSEUDOCOLOR; | ||
282 | break; | ||
283 | } | ||
284 | |||
285 | info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8; | ||
286 | |||
287 | /* activate this new configuration */ | ||
288 | nuc900fb_activate_var(info); | ||
289 | return 0; | ||
290 | } | ||
291 | |||
292 | static inline unsigned int chan_to_field(unsigned int chan, | ||
293 | struct fb_bitfield *bf) | ||
294 | { | ||
295 | chan &= 0xffff; | ||
296 | chan >>= 16 - bf->length; | ||
297 | return chan << bf->offset; | ||
298 | } | ||
299 | |||
300 | static int nuc900fb_setcolreg(unsigned regno, | ||
301 | unsigned red, unsigned green, unsigned blue, | ||
302 | unsigned transp, struct fb_info *info) | ||
303 | { | ||
304 | unsigned int val; | ||
305 | |||
306 | switch (info->fix.visual) { | ||
307 | case FB_VISUAL_TRUECOLOR: | ||
308 | /* true-colour, use pseuo-palette */ | ||
309 | if (regno < 16) { | ||
310 | u32 *pal = info->pseudo_palette; | ||
311 | |||
312 | val = chan_to_field(red, &info->var.red); | ||
313 | val |= chan_to_field(green, &info->var.green); | ||
314 | val |= chan_to_field(blue, &info->var.blue); | ||
315 | pal[regno] = val; | ||
316 | } | ||
317 | break; | ||
318 | |||
319 | default: | ||
320 | return 1; /* unknown type */ | ||
321 | } | ||
322 | return 0; | ||
323 | } | ||
324 | |||
325 | /** | ||
326 | * nuc900fb_blank | ||
327 | * | ||
328 | */ | ||
329 | static int nuc900fb_blank(int blank_mode, struct fb_info *info) | ||
330 | { | ||
331 | |||
332 | return 0; | ||
333 | } | ||
334 | |||
335 | static struct fb_ops nuc900fb_ops = { | ||
336 | .owner = THIS_MODULE, | ||
337 | .fb_check_var = nuc900fb_check_var, | ||
338 | .fb_set_par = nuc900fb_set_par, | ||
339 | .fb_blank = nuc900fb_blank, | ||
340 | .fb_setcolreg = nuc900fb_setcolreg, | ||
341 | .fb_fillrect = cfb_fillrect, | ||
342 | .fb_copyarea = cfb_copyarea, | ||
343 | .fb_imageblit = cfb_imageblit, | ||
344 | }; | ||
345 | |||
346 | |||
347 | static inline void modify_gpio(void __iomem *reg, | ||
348 | unsigned long set, unsigned long mask) | ||
349 | { | ||
350 | unsigned long tmp; | ||
351 | tmp = readl(reg) & ~mask; | ||
352 | writel(tmp | set, reg); | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | * Initialise LCD-related registers | ||
357 | */ | ||
358 | static int nuc900fb_init_registers(struct fb_info *info) | ||
359 | { | ||
360 | struct nuc900fb_info *fbi = info->par; | ||
361 | struct nuc900fb_mach_info *mach_info = fbi->dev->platform_data; | ||
362 | void __iomem *regs = fbi->io; | ||
363 | |||
364 | /*reset the display engine*/ | ||
365 | writel(0, regs + REG_LCM_DCCS); | ||
366 | writel(readl(regs + REG_LCM_DCCS) | LCM_DCCS_ENG_RST, | ||
367 | regs + REG_LCM_DCCS); | ||
368 | ndelay(100); | ||
369 | writel(readl(regs + REG_LCM_DCCS) & (~LCM_DCCS_ENG_RST), | ||
370 | regs + REG_LCM_DCCS); | ||
371 | ndelay(100); | ||
372 | |||
373 | writel(0, regs + REG_LCM_DEV_CTRL); | ||
374 | |||
375 | /* config gpio output */ | ||
376 | modify_gpio(W90X900_VA_GPIO + 0x54, mach_info->gpio_dir, | ||
377 | mach_info->gpio_dir_mask); | ||
378 | modify_gpio(W90X900_VA_GPIO + 0x58, mach_info->gpio_data, | ||
379 | mach_info->gpio_data_mask); | ||
380 | |||
381 | return 0; | ||
382 | } | ||
383 | |||
384 | |||
385 | /* | ||
386 | * Alloc the SDRAM region of NUC900 for the frame buffer. | ||
387 | * The buffer should be a non-cached, non-buffered, memory region | ||
388 | * to allow palette and pixel writes without flushing the cache. | ||
389 | */ | ||
390 | static int __init nuc900fb_map_video_memory(struct fb_info *info) | ||
391 | { | ||
392 | struct nuc900fb_info *fbi = info->par; | ||
393 | dma_addr_t map_dma; | ||
394 | unsigned long map_size = PAGE_ALIGN(info->fix.smem_len); | ||
395 | |||
396 | dev_dbg(fbi->dev, "nuc900fb_map_video_memory(fbi=%p) map_size %lu\n", | ||
397 | fbi, map_size); | ||
398 | |||
399 | info->screen_base = dma_alloc_writecombine(fbi->dev, map_size, | ||
400 | &map_dma, GFP_KERNEL); | ||
401 | |||
402 | if (!info->screen_base) | ||
403 | return -ENOMEM; | ||
404 | |||
405 | memset(info->screen_base, 0x00, map_size); | ||
406 | info->fix.smem_start = map_dma; | ||
407 | |||
408 | return 0; | ||
409 | } | ||
410 | |||
411 | static inline void nuc900fb_unmap_video_memory(struct fb_info *info) | ||
412 | { | ||
413 | struct nuc900fb_info *fbi = info->par; | ||
414 | dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len), | ||
415 | info->screen_base, info->fix.smem_start); | ||
416 | } | ||
417 | |||
418 | static irqreturn_t nuc900fb_irqhandler(int irq, void *dev_id) | ||
419 | { | ||
420 | struct nuc900fb_info *fbi = dev_id; | ||
421 | void __iomem *regs = fbi->io; | ||
422 | void __iomem *irq_base = fbi->irq_base; | ||
423 | unsigned long lcdirq = readl(regs + REG_LCM_INT_CS); | ||
424 | |||
425 | if (lcdirq & LCM_INT_CS_DISP_F_STATUS) { | ||
426 | writel(readl(irq_base) | 1<<30, irq_base); | ||
427 | |||
428 | /* wait VA_EN low */ | ||
429 | if ((readl(regs + REG_LCM_DCCS) & | ||
430 | LCM_DCCS_SINGLE) == LCM_DCCS_SINGLE) | ||
431 | while ((readl(regs + REG_LCM_DCCS) & | ||
432 | LCM_DCCS_VA_EN) == LCM_DCCS_VA_EN) | ||
433 | ; | ||
434 | /* display_out-enable */ | ||
435 | writel(readl(regs + REG_LCM_DCCS) | LCM_DCCS_DISP_OUT_EN, | ||
436 | regs + REG_LCM_DCCS); | ||
437 | /* va-enable*/ | ||
438 | writel(readl(regs + REG_LCM_DCCS) | LCM_DCCS_VA_EN, | ||
439 | regs + REG_LCM_DCCS); | ||
440 | } else if (lcdirq & LCM_INT_CS_UNDERRUN_INT) { | ||
441 | writel(readl(irq_base) | LCM_INT_CS_UNDERRUN_INT, irq_base); | ||
442 | } else if (lcdirq & LCM_INT_CS_BUS_ERROR_INT) { | ||
443 | writel(readl(irq_base) | LCM_INT_CS_BUS_ERROR_INT, irq_base); | ||
444 | } | ||
445 | |||
446 | return IRQ_HANDLED; | ||
447 | } | ||
448 | |||
449 | #ifdef CONFIG_CPU_FREQ | ||
450 | |||
451 | static int nuc900fb_cpufreq_transition(struct notifier_block *nb, | ||
452 | unsigned long val, void *data) | ||
453 | { | ||
454 | struct nuc900fb_info *info; | ||
455 | struct fb_info *fbinfo; | ||
456 | long delta_f; | ||
457 | info = container_of(nb, struct nuc900fb_info, freq_transition); | ||
458 | fbinfo = platform_get_drvdata(to_platform_device(info->dev)); | ||
459 | |||
460 | delta_f = info->clk_rate - clk_get_rate(info->clk); | ||
461 | |||
462 | if ((val == CPUFREQ_POSTCHANGE && delta_f > 0) || | ||
463 | (val == CPUFREQ_PRECHANGE && delta_f < 0)) { | ||
464 | info->clk_rate = clk_get_rate(info->clk); | ||
465 | nuc900fb_activate_var(fbinfo); | ||
466 | } | ||
467 | |||
468 | return 0; | ||
469 | } | ||
470 | |||
471 | static inline int nuc900fb_cpufreq_register(struct nuc900fb_info *fbi) | ||
472 | { | ||
473 | fbi->freq_transition.notifier_call = nuc900fb_cpufreq_transition; | ||
474 | return cpufreq_register_notifier(&fbi->freq_transition, | ||
475 | CPUFREQ_TRANSITION_NOTIFIER); | ||
476 | } | ||
477 | |||
478 | static inline void nuc900fb_cpufreq_deregister(struct nuc900fb_info *fbi) | ||
479 | { | ||
480 | cpufreq_unregister_notifier(&fbi->freq_transition, | ||
481 | CPUFREQ_TRANSITION_NOTIFIER); | ||
482 | } | ||
483 | #else | ||
484 | static inline int nuc900fb_cpufreq_transition(struct notifier_block *nb, | ||
485 | unsigned long val, void *data) | ||
486 | { | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static inline int nuc900fb_cpufreq_register(struct nuc900fb_info *fbi) | ||
491 | { | ||
492 | return 0; | ||
493 | } | ||
494 | |||
495 | static inline void nuc900fb_cpufreq_deregister(struct nuc900fb_info *info) | ||
496 | { | ||
497 | } | ||
498 | #endif | ||
499 | |||
500 | static char driver_name[] = "nuc900fb"; | ||
501 | |||
502 | static int __devinit nuc900fb_probe(struct platform_device *pdev) | ||
503 | { | ||
504 | struct nuc900fb_info *fbi; | ||
505 | struct nuc900fb_display *display; | ||
506 | struct fb_info *fbinfo; | ||
507 | struct nuc900fb_mach_info *mach_info; | ||
508 | struct resource *res; | ||
509 | int ret; | ||
510 | int irq; | ||
511 | int i; | ||
512 | int size; | ||
513 | |||
514 | dev_dbg(&pdev->dev, "devinit\n"); | ||
515 | mach_info = pdev->dev.platform_data; | ||
516 | if (mach_info == NULL) { | ||
517 | dev_err(&pdev->dev, | ||
518 | "no platform data for lcd, cannot attach\n"); | ||
519 | return -EINVAL; | ||
520 | } | ||
521 | |||
522 | if (mach_info->default_display > mach_info->num_displays) { | ||
523 | dev_err(&pdev->dev, | ||
524 | "default display No. is %d but only %d displays \n", | ||
525 | mach_info->default_display, mach_info->num_displays); | ||
526 | return -EINVAL; | ||
527 | } | ||
528 | |||
529 | |||
530 | display = mach_info->displays + mach_info->default_display; | ||
531 | |||
532 | irq = platform_get_irq(pdev, 0); | ||
533 | if (irq < 0) { | ||
534 | dev_err(&pdev->dev, "no irq for device\n"); | ||
535 | return -ENOENT; | ||
536 | } | ||
537 | |||
538 | fbinfo = framebuffer_alloc(sizeof(struct nuc900fb_info), &pdev->dev); | ||
539 | if (!fbinfo) | ||
540 | return -ENOMEM; | ||
541 | |||
542 | platform_set_drvdata(pdev, fbinfo); | ||
543 | |||
544 | fbi = fbinfo->par; | ||
545 | fbi->dev = &pdev->dev; | ||
546 | |||
547 | #ifdef CONFIG_CPU_NUC950 | ||
548 | fbi->drv_type = LCDDRV_NUC950; | ||
549 | #endif | ||
550 | |||
551 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
552 | |||
553 | size = (res->end - res->start) + 1; | ||
554 | fbi->mem = request_mem_region(res->start, size, pdev->name); | ||
555 | if (fbi->mem == NULL) { | ||
556 | dev_err(&pdev->dev, "failed to alloc memory region\n"); | ||
557 | ret = -ENOENT; | ||
558 | goto free_fb; | ||
559 | } | ||
560 | |||
561 | fbi->io = ioremap(res->start, size); | ||
562 | if (fbi->io == NULL) { | ||
563 | dev_err(&pdev->dev, "ioremap() of lcd registers failed\n"); | ||
564 | ret = -ENXIO; | ||
565 | goto release_mem_region; | ||
566 | } | ||
567 | |||
568 | fbi->irq_base = fbi->io + REG_LCM_INT_CS; | ||
569 | |||
570 | |||
571 | /* Stop the LCD */ | ||
572 | writel(0, fbi->io + REG_LCM_DCCS); | ||
573 | |||
574 | /* fill the fbinfo*/ | ||
575 | strcpy(fbinfo->fix.id, driver_name); | ||
576 | fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; | ||
577 | fbinfo->fix.type_aux = 0; | ||
578 | fbinfo->fix.xpanstep = 0; | ||
579 | fbinfo->fix.ypanstep = 0; | ||
580 | fbinfo->fix.ywrapstep = 0; | ||
581 | fbinfo->fix.accel = FB_ACCEL_NONE; | ||
582 | fbinfo->var.nonstd = 0; | ||
583 | fbinfo->var.activate = FB_ACTIVATE_NOW; | ||
584 | fbinfo->var.accel_flags = 0; | ||
585 | fbinfo->var.vmode = FB_VMODE_NONINTERLACED; | ||
586 | fbinfo->fbops = &nuc900fb_ops; | ||
587 | fbinfo->flags = FBINFO_FLAG_DEFAULT; | ||
588 | fbinfo->pseudo_palette = &fbi->pseudo_pal; | ||
589 | |||
590 | ret = request_irq(irq, nuc900fb_irqhandler, IRQF_DISABLED, | ||
591 | pdev->name, fbinfo); | ||
592 | if (ret) { | ||
593 | dev_err(&pdev->dev, "cannot register irq handler %d -err %d\n", | ||
594 | irq, ret); | ||
595 | ret = -EBUSY; | ||
596 | goto release_regs; | ||
597 | } | ||
598 | |||
599 | nuc900_driver_clksrc_div(&pdev->dev, "ext", 0x2); | ||
600 | |||
601 | fbi->clk = clk_get(&pdev->dev, NULL); | ||
602 | if (!fbi->clk || IS_ERR(fbi->clk)) { | ||
603 | printk(KERN_ERR "nuc900-lcd:failed to get lcd clock source\n"); | ||
604 | ret = -ENOENT; | ||
605 | goto release_irq; | ||
606 | } | ||
607 | |||
608 | clk_enable(fbi->clk); | ||
609 | dev_dbg(&pdev->dev, "got and enabled clock\n"); | ||
610 | |||
611 | fbi->clk_rate = clk_get_rate(fbi->clk); | ||
612 | |||
613 | /* calutate the video buffer size */ | ||
614 | for (i = 0; i < mach_info->num_displays; i++) { | ||
615 | unsigned long smem_len = mach_info->displays[i].xres; | ||
616 | smem_len *= mach_info->displays[i].yres; | ||
617 | smem_len *= mach_info->displays[i].bpp; | ||
618 | smem_len >>= 3; | ||
619 | if (fbinfo->fix.smem_len < smem_len) | ||
620 | fbinfo->fix.smem_len = smem_len; | ||
621 | } | ||
622 | |||
623 | /* Initialize Video Memory */ | ||
624 | ret = nuc900fb_map_video_memory(fbinfo); | ||
625 | if (ret) { | ||
626 | printk(KERN_ERR "Failed to allocate video RAM: %x\n", ret); | ||
627 | goto release_clock; | ||
628 | } | ||
629 | |||
630 | dev_dbg(&pdev->dev, "got video memory\n"); | ||
631 | |||
632 | fbinfo->var.xres = display->xres; | ||
633 | fbinfo->var.yres = display->yres; | ||
634 | fbinfo->var.bits_per_pixel = display->bpp; | ||
635 | |||
636 | nuc900fb_init_registers(fbinfo); | ||
637 | |||
638 | nuc900fb_check_var(&fbinfo->var, fbinfo); | ||
639 | |||
640 | ret = nuc900fb_cpufreq_register(fbi); | ||
641 | if (ret < 0) { | ||
642 | dev_err(&pdev->dev, "Failed to register cpufreq\n"); | ||
643 | goto free_video_memory; | ||
644 | } | ||
645 | |||
646 | ret = register_framebuffer(fbinfo); | ||
647 | if (ret) { | ||
648 | printk(KERN_ERR "failed to register framebuffer device: %d\n", | ||
649 | ret); | ||
650 | goto free_cpufreq; | ||
651 | } | ||
652 | |||
653 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | ||
654 | fbinfo->node, fbinfo->fix.id); | ||
655 | |||
656 | return 0; | ||
657 | |||
658 | free_cpufreq: | ||
659 | nuc900fb_cpufreq_deregister(fbi); | ||
660 | free_video_memory: | ||
661 | nuc900fb_unmap_video_memory(fbinfo); | ||
662 | release_clock: | ||
663 | clk_disable(fbi->clk); | ||
664 | clk_put(fbi->clk); | ||
665 | release_irq: | ||
666 | free_irq(irq, fbi); | ||
667 | release_regs: | ||
668 | iounmap(fbi->io); | ||
669 | release_mem_region: | ||
670 | release_mem_region((unsigned long)fbi->mem, size); | ||
671 | free_fb: | ||
672 | framebuffer_release(fbinfo); | ||
673 | return ret; | ||
674 | } | ||
675 | |||
676 | /* | ||
677 | * shutdown the lcd controller | ||
678 | */ | ||
679 | static void nuc900fb_stop_lcd(struct fb_info *info) | ||
680 | { | ||
681 | struct nuc900fb_info *fbi = info->par; | ||
682 | void __iomem *regs = fbi->io; | ||
683 | |||
684 | writel((~LCM_DCCS_DISP_INT_EN) | (~LCM_DCCS_VA_EN) | (~LCM_DCCS_OSD_EN), | ||
685 | regs + REG_LCM_DCCS); | ||
686 | } | ||
687 | |||
688 | /* | ||
689 | * Cleanup | ||
690 | */ | ||
691 | static int nuc900fb_remove(struct platform_device *pdev) | ||
692 | { | ||
693 | struct fb_info *fbinfo = platform_get_drvdata(pdev); | ||
694 | struct nuc900fb_info *fbi = fbinfo->par; | ||
695 | int irq; | ||
696 | |||
697 | nuc900fb_stop_lcd(fbinfo); | ||
698 | msleep(1); | ||
699 | |||
700 | nuc900fb_unmap_video_memory(fbinfo); | ||
701 | |||
702 | iounmap(fbi->io); | ||
703 | |||
704 | irq = platform_get_irq(pdev, 0); | ||
705 | free_irq(irq, fbi); | ||
706 | |||
707 | release_resource(fbi->mem); | ||
708 | kfree(fbi->mem); | ||
709 | |||
710 | platform_set_drvdata(pdev, NULL); | ||
711 | framebuffer_release(fbinfo); | ||
712 | |||
713 | return 0; | ||
714 | } | ||
715 | |||
716 | #ifdef CONFIG_PM | ||
717 | |||
718 | /* | ||
719 | * suspend and resume support for the lcd controller | ||
720 | */ | ||
721 | |||
722 | static int nuc900fb_suspend(struct platform_device *dev, pm_message_t state) | ||
723 | { | ||
724 | struct fb_info *fbinfo = platform_get_drvdata(dev); | ||
725 | struct nuc900fb_info *info = fbinfo->par; | ||
726 | |||
727 | nuc900fb_stop_lcd(); | ||
728 | msleep(1); | ||
729 | clk_disable(info->clk); | ||
730 | return 0; | ||
731 | } | ||
732 | |||
733 | static int nuc900fb_resume(struct platform_device *dev) | ||
734 | { | ||
735 | struct fb_info *fbinfo = platform_get_drvdata(dev); | ||
736 | struct nuc900fb_info *fbi = fbinfo->par; | ||
737 | |||
738 | printk(KERN_INFO "nuc900fb resume\n"); | ||
739 | |||
740 | clk_enable(fbi->clk); | ||
741 | msleep(1); | ||
742 | |||
743 | nuc900fb_init_registers(fbinfo); | ||
744 | nuc900fb_activate_var(bfinfo); | ||
745 | |||
746 | return 0; | ||
747 | } | ||
748 | |||
749 | #else | ||
750 | #define nuc900fb_suspend NULL | ||
751 | #define nuc900fb_resume NULL | ||
752 | #endif | ||
753 | |||
754 | static struct platform_driver nuc900fb_driver = { | ||
755 | .probe = nuc900fb_probe, | ||
756 | .remove = nuc900fb_remove, | ||
757 | .suspend = nuc900fb_suspend, | ||
758 | .resume = nuc900fb_resume, | ||
759 | .driver = { | ||
760 | .name = "nuc900-lcd", | ||
761 | .owner = THIS_MODULE, | ||
762 | }, | ||
763 | }; | ||
764 | |||
765 | int __devinit nuc900fb_init(void) | ||
766 | { | ||
767 | return platform_driver_register(&nuc900fb_driver); | ||
768 | } | ||
769 | |||
770 | static void __exit nuc900fb_cleanup(void) | ||
771 | { | ||
772 | platform_driver_unregister(&nuc900fb_driver); | ||
773 | } | ||
774 | |||
775 | module_init(nuc900fb_init); | ||
776 | module_exit(nuc900fb_cleanup); | ||
777 | |||
778 | MODULE_DESCRIPTION("Framebuffer driver for the NUC900"); | ||
779 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/nuc900fb.h b/drivers/video/nuc900fb.h new file mode 100644 index 000000000000..6c23aa3d3b89 --- /dev/null +++ b/drivers/video/nuc900fb.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (c) 2009 Nuvoton technology corporation | ||
4 | * All rights reserved. | ||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * Auther: | ||
12 | * Wang Qiang(rurality.linux@gmail.com) 2009/12/16 | ||
13 | */ | ||
14 | |||
15 | #ifndef __NUC900FB_H | ||
16 | #define __NUC900FB_H | ||
17 | |||
18 | #include <mach/map.h> | ||
19 | #include <mach/fb.h> | ||
20 | |||
21 | enum nuc900_lcddrv_type { | ||
22 | LCDDRV_NUC910, | ||
23 | LCDDRV_NUC930, | ||
24 | LCDDRV_NUC932, | ||
25 | LCDDRV_NUC950, | ||
26 | LCDDRV_NUC960, | ||
27 | }; | ||
28 | |||
29 | |||
30 | #define PALETTE_BUFFER_SIZE 256 | ||
31 | #define PALETTE_BUFF_CLEAR (0x80000000) /* entry is clear/invalid */ | ||
32 | |||
33 | struct nuc900fb_info { | ||
34 | struct device *dev; | ||
35 | struct clk *clk; | ||
36 | |||
37 | struct resource *mem; | ||
38 | void __iomem *io; | ||
39 | void __iomem *irq_base; | ||
40 | int drv_type; | ||
41 | struct nuc900fb_hw regs; | ||
42 | unsigned long clk_rate; | ||
43 | |||
44 | #ifdef CONFIG_CPU_FREQ | ||
45 | struct notifier_block freq_transition; | ||
46 | #endif | ||
47 | |||
48 | /* keep these registers in case we need to re-write palette */ | ||
49 | u32 palette_buffer[PALETTE_BUFFER_SIZE]; | ||
50 | u32 pseudo_pal[16]; | ||
51 | }; | ||
52 | |||
53 | int nuc900fb_init(void); | ||
54 | |||
55 | #endif /* __NUC900FB_H */ | ||