zt SM501顯卡驅動移植(http://www.sinklow.com/blog/article.asp?id=187)

來源:互聯網
上載者:User

 SM501顯卡驅動移植

http://www.sinklow.com/blog/article.asp?id=187

 

 

1. 修改fbmem.c代碼檔案
將廠商提供的voyager.c和voyager.h檔案放入linux/drivers/video目錄中
修改linux/drivers/video目錄中的fbmem.c檔案
在fb_drivers結構申明之前加入如下代碼:

  extern int voyager_init(void);

在fb_drivers結構中,添加如下代碼:

 #ifdef CONFIG_FB_VOYAGER
  /*
   * Silicon Motion, Inc. VOYAGER frame buffer device.
   */
  { "voyager", voyager_init, NULL },
 #endif

2. 修改"Makefile"和"Config.in"
修改linux/drivers/video目錄下的"Makefile"檔案,在申明驅動的地區加入如下內容:

 obj-$(CONFIG_FB_VOYAGER) += voyager.o

修改linux/drivers/video目錄下的"Config.in"檔案,加入如下內容:

   bool ' Silicon Motion, Inc. VOYAGER graphics console' CONFIG_FB_VOYAGER

3. 修改與開發板相關的核心及驅動代碼
當前開發板使用PXA255晶片,與驅動中測試的Accelent開發板晶片相同,當前開發板使用的片選訊號為CS5,SM501的SDRAM為4M。屏為12.1寸液晶,屏使用的參數為800 X 600,16BPP。

修改voyager.h:
屏的參數

#define SCREEN_X_RES  800
#define SCREEN_Y_RES  600
#define SCREEN_BPP  16
#define isACCELENT  1 /*開啟Accelent板的代碼*/
#define FB_PHYSICAL_ADDR 0x14000000 /*CS5的起始地址為SDRAM的地址*/
#define REG_PHYSICAL_ADDR 0x17E00000 /*CS5的最後2M為SM501寄存器地址*/

修改voyager.c的voyager_init函數:

u_long smem_size的值改為4M

將針對ACCELENT代碼修改為適合當前開發板,修改如下:

#if isACCELENT
 {
 MSC2 &= 0x0000ffff;
 MSC2 |= 0x92040000; // 0x92340000
 MDREFR |= 0x01010000;  // Set free running clock and SDCLK[1] to 100MHz
 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

修改arch/arm/mach-pxa/xhyper255.c,映射物理地址
在xhyper255_io_desc結構中,添加

{ 0xF0700000, 0x14000000, 0x00400000, DOMAIN_IO,0,1,0,0}, // CS5 : SM501 SDRAM
{ 0xF0C00000, 0x17E00000, 0x00200000, DOMAIN_IO,0,1,0,0}, // CS5 : SM501 REG

注:因產商驅動代碼的測試平台基於PXA255晶片,和當前開發板相似,所以相應的寄存器代碼改動較少。SM501與顯示驅動相關的寄存器主要在System Configuration和Display Controller中,具體數值參見《SM501 MMCC Databook》。

4. 配置核心參數
開啟"Character devices"中的

"Virtual Terminal"
"Support for console on virtual terminal"

開啟"Console drivers"下"Frame-buffer support"中的

"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"

註:本驅動移植基於Linux2.4.18版本的核心。
附:測試Frame Buffer的一個應用程式 FBTools

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.