概述
1. TI AM335x 内核源码分析
1.1 Board-am335xevm.c
Board-am335xevm.c(./arch/arm/mach-omap2)中开始执行入口:
MACHINE_START(AM335XEVM,"am335xevm")
/* Maintainer: Texas Instruments */
.atag_offset = 0x100,
.map_io =am335x_evm_map_io,
.init_early = am33xx_init_early,
.init_irq = ti81xx_init_irq,
.handle_irq = omap3_intc_handle_irq,
.timer =&omap3_am33xx_timer,
.init_machine = am335x_evm_init,
MACHINE_END
MACHINE_START(AM335XIAEVM,"am335xiaevm")
/* Maintainer: Texas Instruments */
.atag_offset = 0x100,
.map_io =am335x_evm_map_io,
.init_irq = ti81xx_init_irq,
.init_early = am33xx_init_early,
.timer =&omap3_am33xx_timer,
.init_machine = am335x_evm_init,
MACHINE_END
1.2 am335x_evm_init
static void__init am335x_evm_init(void)
{
am33xx_cpuidle_init();
am33xx_mux_init(board_mux);
omap_serial_init();
am335x_evm_i2c_init();
//daughter_brd_detected = false;
am335x_evm_setup(NULL,NULL); //Tbao--------
omap_sdrc_init(NULL, NULL);
usb_musb_init(&musb_board_data);
omap_board_config = am335x_evm_config;
omap_board_config_size =ARRAY_SIZE(am335x_evm_config);
//setup_general_purpose_evm();
/* Create an alias for icss clock */
if (clk_add_alias("pruss",NULL, "pruss_uart_gclk", NULL))
pr_warn("failed tocreate an alias: icss_uart_gclk --> prussn");
/* Create an alias for gfx/sgx clock */
if (clk_add_alias("sgx_ck",NULL, "gfx_fclk", NULL))
pr_warn("failed tocreate an alias: gfx_fclk --> sgx_ckn");
}
1.3 am335x_evm_setup
static voidam335x_evm_setup(struct memory_accessor *mem_acc, void *context)
{
setup_general_purpose_evm();
return;
#if 0
/* 1st get the MAC address from EEPROM*/
ret = mem_acc->read(mem_acc, (char*)&am335x_mac_addr,
EEPROM_MAC_ADDRESS_OFFSET,sizeof(am335x_mac_addr));
if (ret != sizeof(am335x_mac_addr)) {
pr_warning("AM335X: EVMConfig read fail: %dn", ret);
return;
}
#endif
/* Fillup global mac id */
//am33xx_cpsw_macidfillup(&am335x_mac_addr[0][0],
// &am335x_mac_addr[1][0]);
#if 0
/* get board specific data */
ret = mem_acc->read(mem_acc, (char*)&config, 0, sizeof(config));
if (ret != sizeof(config)) {
pr_err("AM335X EVMconfig read fail, read %d bytesn", ret);
pr_err("This likelymeans that there either is no/or a failed EEPROMn");
goto out;
}
if (config.header !=AM335X_EEPROM_HEADER) {
pr_err("AM335X: wrongheader 0x%x, expected 0x%xn",
config.header,AM335X_EEPROM_HEADER);
goto out;
}
if (strncmp("A335",config.name, 4)) {
pr_err("Board%sndoesn't look like an AM335x boardn",
config.name);
goto out;
}
snprintf(tmp, sizeof(config.name) + 1,"%s", config.name);
pr_info("Board name: %sn",tmp);
snprintf(tmp, sizeof(config.version) +1, "%s", config.version);
pr_info("Board version:%sn", tmp);
if (!strncmp("A335BONE",config.name, 8)) {
daughter_brd_detected =false;
if(!strncmp("00A1",config.version, 4) ||
!strncmp("00A2", config.version,4))
setup_beaglebone_old();
else
setup_beaglebone();
} else if (!strncmp("A335BNLT",config.name, 8)) {
setup_beagleboneblack();
} else if(!strncmp("A335X_SK", config.name, 8)) {
daughter_brd_detected =false;
#endif
//setup_starterkit();
#if 0
} else {
/* only 6 characters ofoptions string used for now */
snprintf(tmp, 7,"%s", config.opt);
pr_info("SKU:%sn", tmp);
if(!strncmp("SKU#01", config.opt, 6))
setup_general_purpose_evm();
else if(!strncmp("SKU#02", config.opt, 6))
setup_ind_auto_motor_ctrl_evm();
else
goto out;
}
am335x_opp_update();
/*
* For now, Beaglebone Black uses PG 2.0 thatare speed binned and operate
* up to 1GHz. So re-enable Turbo and Nitromodes,
*/
if (!strncmp("A335BNLT",config.name, 8)) {
struct device *mpu_dev;
mpu_dev = omap_device_get_by_hwmod_name("mpu");
opp_enable(mpu_dev,
AM33XX_ES2_0_OPPTURBO_FREQ);
opp_enable(mpu_dev,
AM33XX_ES2_0_OPPNITRO_FREQ);
}
#endif
1.4 setup_general_purpose_evm
static voidsetup_general_purpose_evm(void)
{
u32prof_sel = am335x_get_profile_selection();
u32boardid = GEN_PURP_EVM;
if(!strncmp("1.5A", config.version, 4))
boardid= GEN_PURP_DDR3_EVM;
pr_info("Theboard is general purpose EVM %sin profile %dn",
((boardid== GEN_PURP_DDR3_EVM) ? "with DDR3 " : ""),
prof_sel);
_configure_device(boardid,invt_evm_dev_cfg, -1); //*****Tbao*****
am33xx_cpsw_init(AM33XX_CPSW_MODE_RMII,NULL, NULL);
/*Atheros Tx Clk delay Phy fixup */
phy_register_fixup_for_uid(AM335X_EVM_PHY_ID,AM335X_EVM_PHY_MASK,
beaglebone_phy_fixup);
}
_configure_device初始化:结构体很重要,初始化就是初始化这些函数指针结构体
static struct evm_dev_cfginvt_evm_dev_cfg[] = {
{enable_ecap0, DEV_ON_BASEBOARD, PROFILE_NONE},
{lcdc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{mfd_tscadc_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{rmii1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{rmii2_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{usb1_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{evm_nand_init,DEV_ON_BASEBOARD,PROFILE_NONE},
{mmc0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
{spi0_init, DEV_ON_BASEBOARD, PROFILE_NONE},
//{uart1_init, DEV_ON_DGHTR_BRD, PROFILE_NONE},
//{switch1_init, DEV_ON_DGHTR_BRD, PROFILE_NONE},
//{poweroff_init, DEV_ON_DGHTR_BRD, PROFILE_NONE},
{NULL,0,0},
};
1.5 _configure_device
static void _configure_device(intevm_id, struct evm_dev_cfg *dev_cfg,
intprofile)
{
inti;
am335x_evm_set_id(evm_id);
if(profile == PROFILE_NONE) {
for(i = 0; dev_cfg->device_init != NULL; dev_cfg++) {
if(dev_cfg->device_on == DEV_ON_BASEBOARD)
dev_cfg->device_init(evm_id,profile);
elseif (daughter_brd_detected == true)
dev_cfg->device_init(evm_id,profile);
}
}else {
for(i = 0; dev_cfg->device_init != NULL; dev_cfg++) {
if(dev_cfg->profile & profile) {
if(dev_cfg->device_on == DEV_ON_BASEBOARD)
dev_cfg->device_init(evm_id,profile);
elseif (daughter_brd_detected == true)
dev_cfg->device_init(evm_id,profile);
}
}
}
}
1.6nand_base.c (drivers/mtd/nand)
在nand_base.c(drivers/mtd/nand) 中nand_scan_tail函数中加红色部分,加载文件系统:
/* Allow subpagewrites up to ecc.steps. Not possible for MLC flash */
if (!(chip->options &NAND_NO_SUBPAGE_WRITE) &&
!(chip->cellinfo & NAND_CI_CELLTYPE_MSK)) {
switch (chip->ecc.steps) {
case 2:
mtd->subpage_sft= 1;
break;
case 4:
case 8:
case 16:
mtd->subpage_sft= 2;
break;
}
mtd->subpage_sft= 0; //Tbao****************
}
chip->subpagesize =mtd->writesize >> mtd->subpage_sft;
最后
以上就是坚定黑裤为你收集整理的a335x换linux内核,linux 内核代码分析1 TI am335x的全部内容,希望文章能够帮你解决a335x换linux内核,linux 内核代码分析1 TI am335x所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复