am335x (tq335x) study notes--u-boot-2014.10 transplant

Source: Internet
Author: User

Based on this hypothesis am335x EVM migration, according to the recently transplanted u-boot-2014.10 to tq335x. Not many places need to change.

Because TI's am335x EVM developed using EEPROM to save configuration information on the ship. It uses different types of circuit boards to differentiate, and tq335x if there is no such eeprom. So. Need to change the EEPROM related parts, so that u-boot adapt to the tq335x Development Board.

Using source insight to view the code, it is very easy to find that all the parts of the onboard configuration are obtained by reading the EEPROM, so the preferred change read_eeprom (BOARD/TI/AM335X/BOARD.C) function. Detailed changes such as the following:

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 I²c bus.\n "); Return-enodev;} /* Read the EEPROM using I²c */if (i2c_read (config_sys_i2c_eeprom_addr, 0, 2, (Uchar *) header, sizeof (struct AM335X_BA seboard_id)) {puts ("Could not read the EEPROM; Something fundamentally "" wrong on the I²c bus.\n "); Return-eio;} if (header->magic! = 0XEE3355AA) {/* * * Read the EEPROM using the i²c 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 EEPR OM; Something "" fundamentally wrong on the i²c bus.\n "); Return-eio;} if (header->magic! = 0XEE3355AA) {printf ("Incorrect magic number (0x%x) in eeprom\n", header->magic); return-einval ;}} #endifreturn 0;}
With the above changes, the U-boot does not read the EEPROM, but instead directly assigns the name of the header to "tq335x", which can be followed by this configuration to differentiate whether it is a tq335x development board.

Then is the change get_dpll_ddr_params (BOARD/TI/AM335X/BOARD.C) function, the details of the changes such as the following:

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;}
Then is the change sdram_init (BOARD/TI/AM335X/BOARD.C) function, the details of the changes such as the following:
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. * Th Is are safe enough to does 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 (& 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);}
Then add a detailed implementation of the board_is_tq335x function, refer to other similar functions can be implemented, because our Read_eeprom only read the name, the content is "tq335x", it can be implemented as follows. Add for example the following in Board/ti/am335x/board.h:
static inline int board_is_tq335x (struct am335x_baseboard_id *header) {return!strncmp (header->name, "tq335x", hdr_ Name_len);}
Finally, the change Enable_board_pin_mux (board/ti/am335x/mux.c) function, the details of the changes such as the following:
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_boa Rd_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 CONFI G_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 ();}}

In addition, the u-boot of this version number has a bug. The Fat_register_device (fs/fat/fat.c) function needs to be changed:

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);}
At this point, U-boot has been able to start, but there are redundant steps and log. Just can get rid of. Change the File_fat_read_at (fs/fat/fat.c) function:

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);}
Finally, tq335x is mlo start U-boot. Then u-boot to boot the kernel. Therefore can remove the configuration item config_spl_os_boot, the detailed change file Include/configs/ti_armv7_common.h:

#if defined (config_spl_os_boot_enable) #define Config_spl_os_boot#endif

At this point, U-boot's transplant is complete, and the compiler method is as follows:

Make Arch=arm cross_compile=arm-linux-gnueabi-am335x_evm_defconfigmake arch=arm cross_compile=arm-linux-gnueabi-- J8

, arm-linux-gnueabi-needs to be modified based on its own cross-compiler toolchain prefix. After U-boot's transplant, we'll look at how to start the kernel.


Source:

u-boot-2014.10 for tq335x/tq3358 (SD card boot)


This article Girlkoo

This article link: http://blog.csdn.net/girlkoo/article/details/41183217

Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

am335x (tq335x) study notes--u-boot-2014.10 transplant

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.