最近移植了下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)函数,具体的修改如下:

static int read_eeprom(struct am335x_baseboard_id *header)
{
#if 1strcpy(header->name, "TQ335x");
#else/* Check if baseboard eeprom is available */if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {puts("Could not probe the EEPROM; something fundamentally ""wrong on the I2C bus.\n");return -ENODEV;}/* read the eeprom using i2c */if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,sizeof(struct am335x_baseboard_id))) {puts("Could not read the EEPROM; something fundamentally"" wrong on the I2C bus.\n");return -EIO;}if (header->magic != 0xEE3355AA) {/** read the eeprom using i2c again,* but use only a 1 byte address*/if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,sizeof(struct am335x_baseboard_id))) {puts("Could not read the EEPROM; something ""fundamentally wrong on the I2C bus.\n");return -EIO;}if (header->magic != 0xEE3355AA) {printf("Incorrect magic number (0x%x) in EEPROM\n",header->magic);return -EINVAL;}}
#endifreturn 0;
}

通过上述修改,u-boot不去读取eeprom,而是直接将header的name赋值为"TQ335x",后面可以根据这一配置区分是否为TQ335x开发板。

然后是修改get_dpll_ddr_params(board/ti/am335x/board.c)函数,具体的修改内容如下:

const struct dpll_params *get_dpll_ddr_params(void)
{struct am335x_baseboard_id header;enable_i2c0_pin_mux();i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);if (read_eeprom(&header) < 0)puts("Could not get board ID.\n");if (board_is_tq335x(&header) || board_is_evm_sk(&header))return &dpll_ddr_evm_sk;else if (board_is_bone_lt(&header))return &dpll_ddr_bone_black;else if (board_is_evm_15_or_later(&header))return &dpll_ddr_evm_sk;elsereturn &dpll_ddr;
}

然后是修改sdram_init(board/ti/am335x/board.c)函数,具体的修改内容如下:

void sdram_init(void)
{__maybe_unused struct am335x_baseboard_id header;if (read_eeprom(&header) < 0)puts("Could not get board ID.\n");if (board_is_evm_sk(&header)) {/** EVM SK 1.2A and later use gpio0_7 to enable DDR3.* This is safe enough to do on older revs.*/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);else if (board_is_bone_lt(&header))config_ddr(400, &ioregs_bonelt,&ddr3_beagleblack_data,&ddr3_beagleblack_cmd_ctrl_data,&ddr3_beagleblack_emif_reg_data, 0);else if (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);elseconfig_ddr(266, &ioregs, &ddr2_data,&ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0);
}

然后添加board_is_tq335x函数的具体实现,参考其它类似函数实现即可,由于我们的read_eeprom仅读到了name,其内容是"TQ335x",故可如下实现,在board/ti/am335x/board.h中添加如下内容:

static inline int board_is_tq335x(struct am335x_baseboard_id *header)
{return !strncmp(header->name, "TQ335x", HDR_NAME_LEN);
}

最后是修改enable_board_pin_mux(board/ti/am335x/mux.c)函数,具体的修改内容如下:

void enable_board_pin_mux(struct am335x_baseboard_id *header)
{/* Do board-specific muxes. */if (board_is_bone(header) || board_is_tq335x(header)) {/* Beaglebone pinmux */configure_module_pin_mux(i2c1_pin_mux);configure_module_pin_mux(mii1_pin_mux);configure_module_pin_mux(mmc0_pin_mux);
#if defined(CONFIG_NAND)configure_module_pin_mux(nand_pin_mux);
#elif defined(CONFIG_NOR)configure_module_pin_mux(bone_norcape_pin_mux);
#elseconfigure_module_pin_mux(mmc1_pin_mux);
#endif} else if (board_is_gp_evm(header)) {/* General Purpose EVM */unsigned short profile = detect_daughter_board_profile();configure_module_pin_mux(rgmii1_pin_mux);configure_module_pin_mux(mmc0_pin_mux);/* In profile #2 i2c1 and spi0 conflict. */if (profile & ~PROFILE_2)configure_module_pin_mux(i2c1_pin_mux);/* Profiles 2 & 3 don't have NAND */
#ifdef CONFIG_NANDif (profile & ~(PROFILE_2 | PROFILE_3))configure_module_pin_mux(nand_pin_mux);
#endifelse if (profile == PROFILE_2) {configure_module_pin_mux(mmc1_pin_mux);configure_module_pin_mux(spi0_pin_mux);}} else if (board_is_idk(header)) {/* Industrial Motor Control (IDK) */configure_module_pin_mux(mii1_pin_mux);configure_module_pin_mux(mmc0_no_cd_pin_mux);} else if (board_is_evm_sk(header)) {/* Starter Kit EVM */configure_module_pin_mux(i2c1_pin_mux);configure_module_pin_mux(gpio0_7_pin_mux);configure_module_pin_mux(rgmii1_pin_mux);configure_module_pin_mux(mmc0_pin_mux_sk_evm);} else if (board_is_bone_lt(header)) {/* Beaglebone LT pinmux */configure_module_pin_mux(i2c1_pin_mux);configure_module_pin_mux(mii1_pin_mux);configure_module_pin_mux(mmc0_pin_mux);
#if defined(CONFIG_NAND)configure_module_pin_mux(nand_pin_mux);
#elif defined(CONFIG_NOR)configure_module_pin_mux(bone_norcape_pin_mux);
#elseconfigure_module_pin_mux(mmc1_pin_mux);
#endif} else {puts("Unknown board, cannot configure pinmux.");hang();}
}

另外,这个版本的u-boot有个bug,需要修改fat_register_device(fs/fat/fat.c)函数:

int fat_register_device(block_dev_desc_t *dev_desc, int part_no)
{disk_partition_t info;/* First close any currently found FAT filesystem */cur_dev = NULL;/* Read the partition table, if present */if (get_partition_info(dev_desc, part_no, &info)) {/*if (part_no != 0) {printf("** Partition %d not valid on device %d **\n",part_no, dev_desc->dev);return -1;}*/info.start = 0;info.size = dev_desc->lba;info.blksz = dev_desc->blksz;info.name[0] = 0;info.type[0] = 0;info.bootable = 0;
#ifdef CONFIG_PARTITION_UUIDSinfo.uuid[0] = 0;
#endif}return fat_set_blk_dev(dev_desc, &info);
}

至此,u-boot就已经可以启动了,但是有多余的步骤和log,不过可以去掉,修改file_fat_read_at(fs/fat/fat.c)函数:

long file_fat_read_at(const char *filename, unsigned long pos, void *buffer,unsigned long maxsize)
{debug("reading %s\n", filename);return do_fat_read_at(filename, pos, buffer, maxsize, LS_NO, 0);
}

最后,TQ335x是MLO启动u-boot,然后u-boot去启动内核,故可以去掉配置项CONFIG_SPL_OS_BOOT,具体的修改文件include/configs/ti_armv7_common.h:

#if defined(CONFIG_SPL_OS_BOOT_ENABLE)
#define CONFIG_SPL_OS_BOOT
#endif

至此,u-boot的移植工作就完成了,编译方法如下:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x_evm_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j8

其中,arm-linux-gnueabi-需要根据自己的交叉编译工具链前缀进行修改。完成u-boot的移植工作后我们来研究如何启动内核。

源码下载地址:

u-boot-2014.10 for TQ335x/TQ3358(SD卡启动)

本文作者:girlkoo

本文链接:http://blog.csdn.net/girlkoo/article/details/41183217

AM335x(TQ335x)学习笔记——u-boot-2014.10移植相关推荐

  1. AM335x(TQ335x)学习笔记——Nandamp;amp;网卡驱动移植

    移植完成声卡驱动之后本想再接再励,移植网卡驱动,但没想到的是TI维护的内核太健壮,移植网卡驱动跟之前移植按键驱动一样简单,Nand驱动也是如此,于是,本人将Nand和网卡放在同一篇文章中介绍.介绍之前 ...

  2. AM335x(TQ335x)学习笔记——使用dtb方式启动内核

    老式的u-boot使用ATAGS的方式启动linux内核,本文使用新式的dtb方式启动内核. 我使用的内核是linux-3.17.2版本,下面开始编译内核. (1) 解压内核 [php] view p ...

  3. AM335x(TQ335x)学习笔记——GPIO关键驱动移植

    或按照S5PV210学习秩序.我们首先解决的关键问题.TQ335x有六个用户按钮,每个上.下.剩下.对.Enter和ESC. 我想开始学习S5PV210当同一,写输入子系统驱动器的关键问题要解决,但浏 ...

  4. linux声卡驱动arm,AM335x(TQ335x)学习笔记——WM8960声卡驱动移植

    Step3. 调整WM8960驱动结构 内核中自带的WM8960驱动结构很旧,编写Machine是需要过多的了解Codec芯片内部细节,本文对WM8960的驱动结构进行了调整,可以使Machine忽略 ...

  5. AM335x(TQ335x)学习笔记——Nand网卡驱动移植

    移植完成声卡驱动之后本想再接再励,移植网卡驱动,但没想到的是TI维护的内核太健壮,移植网卡驱动跟之前移植按键驱动一样简单,Nand驱动也是如此,于是,本人将Nand和网卡放在同一篇文章中介绍.介绍之前 ...

  6. 【全栈之巅】Node.js + Vue.js 全栈开发王者荣耀手机端官网和管理后台学习笔记(4.1-4.10)

    [全栈之巅]Node.js + Vue.js 全栈开发王者荣耀手机端官网和管理后台学习笔记(4.1-4.10) 本项目是 学习Bilibili 全栈之巅 视频教程相关源码和体会 https://git ...

  7. 【全栈之巅】Node.js + Vue.js 全栈开发王者荣耀手机端官网和管理后台学习笔记(3.6-3.10)

    [全栈之巅]Node.js + Vue.js 全栈开发王者荣耀手机端官网和管理后台学习笔记(3.6-3.10) 本项目是 学习Bilibili 全栈之巅 视频教程相关源码和体会 https://git ...

  8. CV学习笔记 | CV综述 [2020.10.01]

    文章目录 0. 概述(整理完后随时修改) 1. 人工神经网络 1.1. 人工神经网络发展历程 1.2. 一些神经元节点的工作原理 1.2.1. 基本神经元 1.2.2. 卷积神经元(Convoluti ...

  9. 最热网友收藏:写得蛮好的linux学习笔记(2007年第10周)

    2007年第10周最热网友收藏 上班人员必读:"五险一金"详解!(130),共376人收藏,liukang520236首先收藏 写得蛮好的linux学习笔记-(96),共159人收 ...

最新文章

  1. python与vb可以互换吗_vb能配合python写程序么?
  2. Linux下通过进程名查询占用的端口
  3. 数据挖掘 —— 模型评估
  4. cisco 2960 VLAN MAC_华为网络初级工程师快速掌握基于MAC地址的VLAN划分实用收藏
  5. 【Git学习笔记6】把当前工作现场“储藏”起来:stash操作
  6. 02 李俊杰 20160221-S1笔试
  7. 结构体:struct关键字
  8. Filter过滤器拦截方式
  9. java list填入table_JavaFX从ObservableList填充TableView
  10. 金针工具箱5.0安装版(多功能软件快捷工具)hh852作品
  11. 执行安装操作的时候,出现丢失MSVCR120.dll的解决方法
  12. h5 - mui 使用技巧
  13. 蓝牙定位网关-蓝牙网关通过三角定位获取蓝牙设备的位置
  14. 运营商大数据靶向短信,指定区域,定位发送,100%精准触达
  15. DNSPod十问侯家文:如何为中小企业的网络安全保驾护航?
  16. linux运行vb程序,Linux可执行文件ELF结构及程序加载运行
  17. MOB短信验证码开发
  18. Redis:redis通用命令;redis常见数据结构;redis客户端;redis的序列化
  19. 【MFC学习笔记】常见问题解答
  20. codewars(二)

热门文章

  1. Linux epoll 实现原理
  2. 世界各国犯罪率统计系列:各国暴力犯罪性犯罪(2003-2021)
  3. Windows平台部署巡风扫描引擎的注意事项
  4. 利用Matlab读取Excel数据并进行拟合
  5. A brief introduction to MIMO
  6. 言而有信 | 149美元的IntelliJ IDEA正版订阅抽一个
  7. 3.访问数据库的步骤:访问数据库的步骤有哪些???
  8. python十年高考录取率表_历年高考录取比例,看看你当年的是多少?
  9. cookie注入 base64注入 原理详解
  10. 好文转载 【ChatGPT】ChatGPT+MindShow三分钟生成PPT