am335x (tq335x) Learning notes--u-boot-2014.10 transplantation

Source: Internet
Author: User

A recent transplant of the lower u-boot-2014.10 to tq335x, if transplanted based on am335x EVM, does not require much change.

Because TI's am335x EVM development uses an EEPROM to save the onboard configuration information, which distinguishes the different board models, and tq335x does not have the EEPROM, therefore, it is necessary to modify the EEPROM related parts, so that the u-boot adapt to the tq335x Development Board.

Using the source insight to see the code, it's easy to see that all the parts that get the onboard configuration are obtained by reading the EEPROM, so the preferred modification of the Read_eeprom (BOARD/TI/AM335X/BOARD.C) function is as follows:

static int Read_eeprom (struct am335x_baseboard_id *header) {#if 1 strcpy (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 */if (I2c_read (config_sys_i2c_eeprom_addr, 0, 1, (Uchar *) header, sizeof (struct am335x_baseboard_id))) {PU TS ("Could not read" 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;
} #endif return 0; }
With the above modifications, U-boot does not read the EEPROM, but instead directly assigns the header name to "tq335x", which can be used to differentiate whether the tq335x Development Board is based on this configuration.

Then you modify the Get_dpll_ddr_params (BOARD/TI/AM335X/BOARD.C) function, and the specific modifications are as follows:

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;
	else return
		&dpll_ddr;
}
Then you modify the Sdram_init (BOARD/TI/AM335X/BOARD.C) function, and the specific modifications are as follows:
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 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,
	;dd R3_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_e
	Vm_cmd_ctrl_data, &ddr3_evm_emif_reg_data, 0); else Config_ddr (266, &ioregs, &AMP;DDR2_data, &ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0); }
Then add the specific implementation of the board_is_tq335x function, refer to other similar function implementations, because our Read_eeprom only read the name, its content is "tq335x", it can be implemented as follows, in board/ti/am335x/ Board.h, add the following:
static inline int board_is_tq335x (struct am335x_baseboard_id *header)
{return
	!strncmp (Header->name, " Tq335x ", Hdr_name_len);
}
Finally, modify the Enable_board_pin_mux (BOARD/TI/AM335X/MUX.C) function, the specific changes are as follows:
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);
#else Configure_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_nand if (Profile & ~ profile_2 |
profile_3)) Configure_module_pin_mux (NAND_PIN_MUX); #endif ElsE 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);
#else Configure_module_pin_mux (MMC1_PIN_MUX);
		#endif} else {puts ("Unknown board, cannot configure Pinmux.");
	Hang (); }
}

In addition, this version of U-boot has a bug and needs to modify the Fat_register_device (fs/fat/fat.c) function:

int Fat_register_device (block_dev_desc_t *dev_desc, int part_no)
{
	disk_partition_t info;

	/* A/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_uuids
		info.uuid[0] = 0;
#endif
	} return

	Fat_set_blk_dev (Dev_desc, &info);
}
At this point, u-boot can start, but there are extra steps and log, but you can remove, modify 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, and then u-boot to boot the kernel, so you can remove the configuration item config_spl_os_boot, the specific modification 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 porting work is complete, the compilation method is as follows:

Make Arch=arm cross_compile=arm-linux-gnueabi-am335x_evm_defconfig make
arch=arm cross_compile= arm-linux-gnueabi--j8

The arm-linux-gnueabi-needs to be modified according to its own cross compilation tool chain prefix. After completing the u-boot transplant process, we'll look at how to start the kernel.


SOURCE Download Address:

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


The author of this article: Girlkoo

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

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.