2012-02-02

u-boot & kernel bring up工作紀錄

一、U-Boot


u-boot主要帶起cpu, flash, ram, lan(tftp), 每個案子需求不同


1. 新增
      (1) 在include中新增
           product_info.h  => 定義用來記錄product_info的structure
   
      (2) 在include/configs中新增
            dsr250n_common.h  => 定義dsr250n的資訊, 如ram, memory等...(利用公板的版本修改)

2. lib_arm/board.c 
     (1)  include  product_info.h, 並把product_info儲存在ram中.
   
     (2) 利用eth_init() 去 init ethernet   (board\cavium\cns3000\cns3xxx_gsw.c)

3. common/main.c
     (1) 於void main_loop (void) 中增加 len = readline (CFG_PROMPT_DSR250N);
          (CFG_PROMPT_DSR250N  = "DSR-250N # ",  用於顯示u-boot console的提示文字)

4. add u-boot commands
    (1) common\cmd_nvedit.c
         include product_info.h,
       
         add :
         do_printpd,  do_getpd, do_setpd, do_savepd
   
     (2) common\cmd_misc.c
         include "../board/cavium/cns3000/cns3xxx_phy.h"
         include "../board/cavium/cns3000/cns3xxx_symbol.h"
         
          add:
         do_phyread, do_phywrite, do_phyreadbypage,
          do_phywritebypage, do_GPIOCtrl, test_wps_button_cmd,
          test_reset_button_cmd, do_testled
   
     (3) common\cmd_mem.c
          加入新的do_mem_mtest

5. board\cavium\cns3000\
     (1) vega.c
          宣告 gpioA_dir, gpioA_set, gpioA_get,
                   gpioB_dir, gpioB_set, gpioB_get
          並設定gpioA與gpioB的初始值
 
      (2) cns3xxx_switch_type.h  
            參考公板去更改define的value
   
      (3) cns3xxx_phy.h
             參考公板去更改define的value

      (4) cns3xxx_phy.c
             add bcm53128_init_internal_phy等init function,

       (5) cns3xxx_gsw.c
             avoid hw auto polling issue (hardward的bug)
            - disable hw auto polling before enable MDC/MDIO
            - this is workaround solution

6. 修改Makefile






二、Kernel


1. drivers\mtd\maps\cns3xxx-flash.c
    定義U-boot, U-boot env, kernel, Cavium env, MD的size與offset


2. drivers\gpio\cns3xxx-gpio.c
    (1) #include <mach/gpio.h>
    (2) EXPORT_SYMBOL(cns3xxx_gpio_set_value);  =>讓其他module使用  
    (3) 把kernel對gpio的改動mark掉 => 保留boot code的設定 


3. \arch\arm\configs
    增加dsr250n_defconfig與dsr150n_defconfig (參考公板)


4. mkbootpImage.sh
    makefile

5. baudrate
    rootfs/etc/inittab

6. kernel\linux-2.6.31.1\arch\arm\mach-cns3xxx\pcie.c
    pcie1 init