TQ335x开发板U-boot2015.07移植

原创 2016年05月31日 20:42:49

硬件平台:TQ335X_BOARD_V2.1

软件环境:VMWARE10+UBUNTU14.04


打开board\ti\am335x\board.c文件

修改如下:

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 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;
		}
	}
#endif

	return 0;
}


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_evm_sk(&header))
		return &dpll_ddr_evm_sk;
	else if (board_is_bone_lt(&header) ||board_is_tq335x(&header))
		return &dpll_ddr_bone_black;
	else if (board_is_evm_15_or_later(&header))
		return &dpll_ddr_evm_sk;
	else
		return &dpll_ddr;
}


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))
		config_ddr(303, &ioregs_evmsk, &ddr3_data,
			   &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);
	else if (board_is_bone_lt(&header) || board_is_tq335x(&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);
	else
		config_ddr(266, &ioregs, &ddr2_data,
			   &ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0);
}


打开board\ti\am335x\board.h文件

修改如下:

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


打开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);
#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) && defined(CONFIG_EMMC_BOOT)
		configure_module_pin_mux(nand_pin_mux);
#elif defined(CONFIG_NOR) && defined(CONFIG_EMMC_BOOT)
		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();
	}
}

打开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 0
		if (part_no != 0) {
			printf("** Partition %d not valid on device %d **\n",
					part_no, dev_desc->dev);
			return -1;
		}
#endif
		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);
}


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


打开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-gnueabihf-是我使用的编译器。
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

AM335x uboot 移植

AM335x uboot 移植   2013-06-11 22:36:39|  分类: am335x-艾默生 |  标签:uboot  am335x  移植   |举报 ...

AM335x(TQ335x)学习笔记——u-boot-2014.10移植

最近移植了下u-boot-2014.10到TQ335x,如果基于am335x evm进行移植,需要修改的地方并不多。 由于TI的am335x evm开发使用了一个eeprom保存了板载配置信息,用来区...

AM335x uboot 移植

uBOOT的编译命令 直接一次性编译 make O=am335x CROSS_COMPILE=arm-arago-linux-gnueabi ARCH=arm  am335x_evm 配置 ...

AM335x uboot 移植

uBOOT的编译命令 直接一次性编译 make O=am335x CROSS_COMPILE=arm-arago-linux-gnueabi ARCH=arm  am335x_evm 配置 ...

让uboot按下指定键停止autoboot

默认uboot是按下任意键停止autoboot,有人觉得不爽,害怕终端操作用户误操作,要指定特殊按键 这个功能很简单,例如要按下ESC键,停止自动boot 只需要添加 #define C...

ti-sdk-evm-am335x-05.07 uboot分析(MLO跳转到u-boot之前)

本文主要通过阅读源码及调试揭示了AM335X中u-boot的MLO阶段实现机理。

OK335XD uboot移植(一)

先说说基本情况; 板子使用的是飞凌的OK335XD,芯片是TI公司的AM335X;(飞凌只提供kernel的代码,没提供Uboot源码) Nandflash为K9F2G08UOC(飞凌原理图给的是MT...

AM335x(TQ335x)学习笔记——u-boot-2014.10移植

最近移植了下u-boot-2014.10到TQ335x,如果基于am335x evm进行移植,需要修改的地方并不多。由于TI的am335x evm开发使用了一个eeprom保存了板载配置信息,用来区分...

为AM335x移植Linux内核主线代码了解dts

出处:http://bbs.ednchina.com/BLOG_ARTICLE_3024972.HTM http://events.linuxfoundation.org/sites/events/...

为AM335x移植Linux内核主线代码(1)了解dtb

http://www.eefocus.com/marianna/blog/cate_18142_0.html?p=5 这个链接里有关于AM335x内核移植的很多文章,为以后的TQ335X平台...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)