最近移植了下u-boot-2014.10到TQ335x,假如依据am335x evm进行移植,需求修正的当地并不多。
因为TI的am335x evm开发运用了一个eeprom保存了板载装备信息,用来区别不同板子的类型的,而TQ335x没有这个eeprom,因而,需求修正eeprom相关的部分,使u-boot习惯TQ335x开发板。
运用source insight检查代码,很简单发现,一切获取板载装备的部分都是经过读取eeprom取得的,因而,首选修正read_eeprom(board/ti/am335x/board.c)函数,详细的修正如下:
- staticintread_eeprom(structam335x_baseboard_id*header)
- {
- #if1
- strcpy(header->name,”TQ335x”);
- #else
- /*Checkifbaseboardeepromisavailable*/
- if(i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)){
- puts(“CouldnotprobetheEEPROM;somethingfundamentally”
- “wrongontheI2Cbus.”);
- return-ENODEV;
- }
- /*readtheeepromusingi2c*/
- if(i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR,0,2,(uchar*)header,
- sizeof(structam335x_baseboard_id))){
- puts(“CouldnotreadtheEEPROM;somethingfundamentally”
- “wrongontheI2Cbus.”);
- return-EIO;
- }
- if(header->magic!=0xEE3355AA){
- /*
- *readtheeepromusingi2cagain,
- *butuseonlya1byteaddress
- */
- if(i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR,0,1,(uchar*)header,
- sizeof(structam335x_baseboard_id))){
- puts(“CouldnotreadtheEEPROM;something”
- “fundamentallywrongontheI2Cbus.”);
- return-EIO;
- }
- if(header->magic!=0xEE3355AA){
- printf(“Incorrectmagicnumber(0x%x)inEEPROM”,
- header->magic);
- return-EINVAL;
- }
- }
- #endif
- return0;
- }
经过上述修正,u-boot不去读取eeprom,而是直接将header的name赋值为”TQ335x”,后边能够依据这一装备区别是否为TQ335x开发板。
然后是修正get_dpll_ddr_params(board/ti/am335x/board.c)函数,详细的修正内容如下:
- conststructdpll_params*get_dpll_ddr_params(void)
- {
- structam335x_baseboard_idheader;
- enable_i2c0_pin_mux();
- i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED,CONFIG_SYS_OMAP24_I2C_SLAVE);
- if(read_eeprom(&header)<0)
- puts(“CouldnotgetboardID.”);
- if(board_is_tq335x(&header)||board_is_evm_sk(&header))
- return&dpll_ddr_evm_sk;
- elseif(board_is_bone_lt(&header))
- return&dpll_ddr_bone_black;
- elseif(board_is_evm_15_or_later(&header))
- return&dpll_ddr_evm_sk;
- else
- return&dpll_ddr;
- }
然后是修正sdram_init(board/ti/am335x/board.c)函数,详细的修正内容如下:
- voidsdram_init(void)
- {
- __maybe_unusedstructam335x_baseboard_idheader;
- if(read_eeprom(&header)<0)
- puts(“CouldnotgetboardID.”);
- if(board_is_evm_sk(&header)){
- /*
- *EVMSK1.2Aandlaterusegpio0_7toenableDDR3.
- *Thisissafeenoughtodoonolderrevs.
- */
- gpio_request(GPIO_DDR_VTT_EN,”ddr_vtt_en”);
- gpio_direction_output(GPIO_DDR_VTT_EN,1);
- }
- if(board_is_evm_sk(&header)||board_is_tq335x(&header))
- config_ddr(303,&ioregs_evmsk,&ddr3_data,
- &ddr3_cmd_ctrl_data,&ddr3_emif_reg_data,0);
- elseif(board_is_bone_lt(&header))
- config_ddr(400,&ioregs_bonelt,
- &ddr3_beagleblack_data,
- &ddr3_beagleblack_cmd_ctrl_data,
- &ddr3_beagleblack_emif_reg_data,0);
- elseif(board_is_evm_15_or_later(&header))
- config_ddr(303,&ioregs_evm15,&ddr3_evm_data,
- &ddr3_evm_cmd_ctrl_data,&ddr3_evm_emif_reg_data,0);
- else
- config_ddr(266,&ioregs,&ddr2_data,
- &ddr2_cmd_ctrl_data,&ddr2_emif_reg_data,0);
- }
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qianrushi/yingjian/256209.html