xref: /OK3568_Linux_fs/kernel/Documentation/fb/ep93xx-fb.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun================================
2*4882a593SmuzhiyunDriver for EP93xx LCD controller
3*4882a593Smuzhiyun================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe EP93xx LCD controller can drive both standard desktop monitors and
6*4882a593Smuzhiyunembedded LCD displays. If you have a standard desktop monitor then you
7*4882a593Smuzhiyuncan use the standard Linux video mode database. In your board file::
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun	static struct ep93xxfb_mach_info some_board_fb_info = {
10*4882a593Smuzhiyun		.num_modes	= EP93XXFB_USE_MODEDB,
11*4882a593Smuzhiyun		.bpp		= 16,
12*4882a593Smuzhiyun	};
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunIf you have an embedded LCD display then you need to define a video
15*4882a593Smuzhiyunmode for it as follows::
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun	static struct fb_videomode some_board_video_modes[] = {
18*4882a593Smuzhiyun		{
19*4882a593Smuzhiyun			.name		= "some_lcd_name",
20*4882a593Smuzhiyun			/* Pixel clock, porches, etc */
21*4882a593Smuzhiyun		},
22*4882a593Smuzhiyun	};
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunNote that the pixel clock value is in pico-seconds. You can use the
25*4882a593SmuzhiyunKHZ2PICOS macro to convert the pixel clock value. Most other values
26*4882a593Smuzhiyunare in pixel clocks. See Documentation/fb/framebuffer.rst for further
27*4882a593Smuzhiyundetails.
28*4882a593Smuzhiyun
29*4882a593SmuzhiyunThe ep93xxfb_mach_info structure for your board should look like the
30*4882a593Smuzhiyunfollowing::
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun	static struct ep93xxfb_mach_info some_board_fb_info = {
33*4882a593Smuzhiyun		.num_modes	= ARRAY_SIZE(some_board_video_modes),
34*4882a593Smuzhiyun		.modes		= some_board_video_modes,
35*4882a593Smuzhiyun		.default_mode	= &some_board_video_modes[0],
36*4882a593Smuzhiyun		.bpp		= 16,
37*4882a593Smuzhiyun	};
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunThe framebuffer device can be registered by adding the following to
40*4882a593Smuzhiyunyour board initialisation function::
41*4882a593Smuzhiyun
42*4882a593Smuzhiyun	ep93xx_register_fb(&some_board_fb_info);
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun=====================
45*4882a593SmuzhiyunVideo Attribute Flags
46*4882a593Smuzhiyun=====================
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunThe ep93xxfb_mach_info structure has a flags field which can be used
49*4882a593Smuzhiyunto configure the controller. The video attributes flags are fully
50*4882a593Smuzhiyundocumented in section 7 of the EP93xx users' guide. The following
51*4882a593Smuzhiyunflags are available:
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun=============================== ==========================================
54*4882a593SmuzhiyunEP93XXFB_PCLK_FALLING		Clock data on the falling edge of the
55*4882a593Smuzhiyun				pixel clock. The default is to clock
56*4882a593Smuzhiyun				data on the rising edge.
57*4882a593Smuzhiyun
58*4882a593SmuzhiyunEP93XXFB_SYNC_BLANK_HIGH	Blank signal is active high. By
59*4882a593Smuzhiyun				default the blank signal is active low.
60*4882a593Smuzhiyun
61*4882a593SmuzhiyunEP93XXFB_SYNC_HORIZ_HIGH	Horizontal sync is active high. By
62*4882a593Smuzhiyun				default the horizontal sync is active low.
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunEP93XXFB_SYNC_VERT_HIGH		Vertical sync is active high. By
65*4882a593Smuzhiyun				default the vertical sync is active high.
66*4882a593Smuzhiyun=============================== ==========================================
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunThe physical address of the framebuffer can be controlled using the
69*4882a593Smuzhiyunfollowing flags:
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun=============================== ======================================
72*4882a593SmuzhiyunEP93XXFB_USE_SDCSN0		Use SDCSn[0] for the framebuffer. This
73*4882a593Smuzhiyun				is the default setting.
74*4882a593Smuzhiyun
75*4882a593SmuzhiyunEP93XXFB_USE_SDCSN1		Use SDCSn[1] for the framebuffer.
76*4882a593Smuzhiyun
77*4882a593SmuzhiyunEP93XXFB_USE_SDCSN2		Use SDCSn[2] for the framebuffer.
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunEP93XXFB_USE_SDCSN3		Use SDCSn[3] for the framebuffer.
80*4882a593Smuzhiyun=============================== ======================================
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun==================
83*4882a593SmuzhiyunPlatform callbacks
84*4882a593Smuzhiyun==================
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunThe EP93xx framebuffer driver supports three optional platform
87*4882a593Smuzhiyuncallbacks: setup, teardown and blank. The setup and teardown functions
88*4882a593Smuzhiyunare called when the framebuffer driver is installed and removed
89*4882a593Smuzhiyunrespectively. The blank function is called whenever the display is
90*4882a593Smuzhiyunblanked or unblanked.
91*4882a593Smuzhiyun
92*4882a593SmuzhiyunThe setup and teardown devices pass the platform_device structure as
93*4882a593Smuzhiyunan argument. The fb_info and ep93xxfb_mach_info structures can be
94*4882a593Smuzhiyunobtained as follows::
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun	static int some_board_fb_setup(struct platform_device *pdev)
97*4882a593Smuzhiyun	{
98*4882a593Smuzhiyun		struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data;
99*4882a593Smuzhiyun		struct fb_info *fb_info = platform_get_drvdata(pdev);
100*4882a593Smuzhiyun
101*4882a593Smuzhiyun		/* Board specific framebuffer setup */
102*4882a593Smuzhiyun	}
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun======================
105*4882a593SmuzhiyunSetting the video mode
106*4882a593Smuzhiyun======================
107*4882a593Smuzhiyun
108*4882a593SmuzhiyunThe video mode is set using the following syntax::
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun	video=XRESxYRES[-BPP][@REFRESH]
111*4882a593Smuzhiyun
112*4882a593SmuzhiyunIf the EP93xx video driver is built-in then the video mode is set on
113*4882a593Smuzhiyunthe Linux kernel command line, for example::
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun	video=ep93xx-fb:800x600-16@60
116*4882a593Smuzhiyun
117*4882a593SmuzhiyunIf the EP93xx video driver is built as a module then the video mode is
118*4882a593Smuzhiyunset when the module is installed::
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun	modprobe ep93xx-fb video=320x240
121*4882a593Smuzhiyun
122*4882a593Smuzhiyun==============
123*4882a593SmuzhiyunScreenpage bug
124*4882a593Smuzhiyun==============
125*4882a593Smuzhiyun
126*4882a593SmuzhiyunAt least on the EP9315 there is a silicon bug which causes bit 27 of
127*4882a593Smuzhiyunthe VIDSCRNPAGE (framebuffer physical offset) to be tied low. There is
128*4882a593Smuzhiyunan unofficial errata for this bug at::
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun	https://marc.info/?l=linux-arm-kernel&m=110061245502000&w=2
131*4882a593Smuzhiyun
132*4882a593SmuzhiyunBy default the EP93xx framebuffer driver checks if the allocated physical
133*4882a593Smuzhiyunaddress has bit 27 set. If it does, then the memory is freed and an
134*4882a593Smuzhiyunerror is returned. The check can be disabled by adding the following
135*4882a593Smuzhiyunoption when loading the driver::
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun      ep93xx-fb.check_screenpage_bug=0
138*4882a593Smuzhiyun
139*4882a593SmuzhiyunIn some cases it may be possible to reconfigure your SDRAM layout to
140*4882a593Smuzhiyunavoid this bug. See section 13 of the EP93xx users' guide for details.
141