Transplantation of the sm501 video card driver
Http://www.sinklow.com/blog/article.asp? Id = 187
1. Modify the fbmem. C code file
Put the Voyager. C and Voyager. H files provided by the vendor into the Linux/Drivers/video directory.
Modify the fbmem. c file in the Linux/Drivers/video directory
Add the following code before the fb_drivers structure declaration:
Extern int voyager_init (void );
In the fb_drivers structure, add the following code:
# Ifdef config_fb_voyager
/*
* Silicon motion, Inc. Voyager frame buffer device.
*/
{"Voyager", voyager_init, null },
# Endif
2. Modify "makefile" and "config. In"
Modify the "makefile" file in the Linux/Drivers/video directory and add the following content in the declarative driver area:
OBJ-$ (config_fb_voyager) + = Voyager. o
Modify the "config. In" file under the Linux/Drivers/video directory and add the following content:
Bool 'Silicon motion, Inc. Voyager graphics console 'config_fb_voyager
3. Modify the kernel and driver Code related to the Development Board.
The current development board uses the PXA255 chip, which is the same as the accelent development board chip tested in the driver. The chip selection signal of the current development board is cs5, And the SDRAM of sm501 is 4 m. The screen is a 12.1-inch LCD, and the parameters used for the screen are 800x600 and 16bpp.
Modify Voyager. h:
Screen Parameters
# Define screen_x_res 800
# Define screen_y_res 600
# Define screen_bpp 16
# Define isaccelent 1/* code for enabling the accelent Board */
# Define fb_physical_addr 0x14000000/* The starting address of cs5 is the address of SDRAM */
# Define reg_physical_addr 0x17e00000/* The last 2 m of cs5 is the sm501 Register address */
Modify voyager_init function of Voyager. C:
The value of u_long smem_size is changed to 4 m.
Modify the accelent code to fit the current development board as follows:
# If isaccelent
{
Msc2 & = 0x0000ffff;
Msc2 | = 0x92040000; // 0x92340000
Mdrefr | = 0x01010000; // set free running clock and sdclk [1] to 100 MHz
Lccr0 | = lccr0_dis; // bit: 10 disable LCD Controller
Gafr2_l = (gafr2_l &~ 0x30000000) | 0x20000000;
Gafr0_u = (gafr0_u &~ 0x30) | 0x10;
Gafr1_u = (gafr1_u &~ 0xf) | 0xa;
}
# Endif // isaccelent
Modify ARCH/ARM/Mach-PXA/xhyper1_c to map physical addresses.
In the xhyper255_io_desc structure, add
{0xf0700000, 0x14000000, 0x00400000, domain_io,}, // cs5: sm501 SDRAM
{0xf0c00000, 0x17e00000, 0x00200000, domain_io, 0, 0, 0}, // cs5: sm501 Reg
Note: Because the testing platform of the driver code is based on the PXA255 chip, it is similar to the current development board, so there are few changes to the corresponding register code. Sm501 registers related to the display driver are mainly in system configuration and display controller. For specific values, see sm501 mmcc Databook.
4. Configure Kernel Parameters
Open
"Virtual terminal"
"Support for console on virtual terminal"
Open
"Support for frame buffer devices (experimental )"
"Silicon motion, Inc. Voyager graphics console"
"Advanced Low level driver options"
"Monochrome support"
"2 BPP packed pixels support"
"4 BPP packed pixels support"
"8 BPP packed pixels support"
"16 BPP packed pixels support"
"24 BPP packed pixels support"
"32 BPP packed pixels support"
"Select compiled-in fonts"
"VGA 8x8 font"
Note: This driver is based on the kernel of linux2.4.18.
Appendix: An application for testing frame buffer fbtools