AM335x(TQ335x)学习笔记——u-boot-2014.10移植
时间:11-28
来源:互联网
点击:
最近移植了下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;
- }
然后是修改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;
- }
- 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);
- }
- staticinlineintboard_is_tq335x(structam335x_baseboard_id*header)
- {
- return!strncmp(header->name,"TQ335x",HDR_NAME_LEN);
- }
- voidenable_board_pin_mux(structam335x_baseboard_id*header)
- {
- /*Doboard-specificmuxes.*/
- if(board_is_bone(header)||board_is_tq335x(header)){
- /*Beaglebonepinmux*/
- configure_module_pin_mux(i2c1_pin_mux);
- configure_module_pin_mux(mii1_pin_mux);
- configure_module_pin_mux(mmc0_pin_mux);
- #ifdefined(CONFIG_NAND)
- configure_module_pin_mux(nand_pin_mux);
- #elifdefined(CONFIG_NOR)
- configure_module_pin_mux(bone_norcape_pin_mux);
- #else
- configu
AM335xTQ335xu-boo 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)