嵌入式Linux开发环境的搭建之:U-Boot移植

时间:2013-09-13来源:网络

(7)加入NandFlash的初始化函数(board/fs2410/fs2410.c)。

#if(CONFIG_COMMANDSCFG_CMD_NAND)

typedefenum

{

NFCE_LOW,

NFCE_HIGH

}NFCE_STATE;

staticinlinevoidNF_Conf(u16conf)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

nand->NFCONF=conf;

}

staticinlinevoidNF_Cmd(u8cmd)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

nand->NFCMD=cmd;

}

staticinlinevoidNF_CmdW(u8cmd)

{

NF_Cmd(cmd);

udelay(1);

}

staticinlinevoidNF_Addr(u8addr)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

nand->NFADDR=addr;

}

staticinlinevoidNF_SetCE(NFCE_STATEs)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

switch(s)

{

caseNFCE_LOW:

nand->NFCONF=~(111);

break;

caseNFCE_HIGH:

nand->NFCONF|=(111);

break;

}

}

staticinlinevoidNF_WaitRB(void)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

while(!(nand->NFSTAT(10)));

}

staticinlinevoidNF_Write(u8data)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

nand->NFDATA=data;

}

staticinlineu8NF_Read(void)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

return(nand->NFDATA);

}

staticinlinevoidNF_Init_ECC(void)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

nand->NFCONF|=(112);

}

staticinlineu32NF_Read_ECC(void)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

return(nand->NFECC);

}

#endif

/*

*NANDflashinitialization.

*/

#if(CONFIG_COMMANDSCFG_CMD_NAND)

externulongnand_probe(ulongphysadr);

staticinlinevoidNF_Reset(void)

{

inti;

NF_SetCE(NFCE_LOW);

NF_Cmd(0xFF);/*resetcommand*/

for(i=0;i10;i++);/*tWB=100ns.*/

NF_WaitRB();/*wait200~500us;*/

NF_SetCE(NFCE_HIGH);

}

staticinlinevoidNF_Init(void)

{

#defineTACLS0

#defineTWRPH04

#defineTWRPH12

NF_Conf((115)|(014)|(013)|(112)

|(111)|(TACLS8)|(TWRPH04)|(TWRPH10));

/*1111,1xxx,rxxx,rxxx*/

/*En512B4stepECCRnFCE=HtACLStWRPH0tWRPH1*/

NF_Reset();

}

voidnand_init(void)

{

S3C2410_NAND*constnand=S3C2410_GetBase_NAND();

NF_Init();

#ifdefDEBUG

printf(NANDflashprobingat0x%.8lXn,(ulong)nand);

#endif

printf(%4luMBn,nand_probe((ulong)nand)>>20);

}

#endif

(8)修改GPIO配置(board/fs2410/fs2410.c)。

/*setuptheI/Oports*/

gpio->GPACON=0x007FFFFF;

gpio->GPBCON=0x002AAAAA;

gpio->GPBUP=0x000002BF;

gpio->GPCCON=0xAAAAAAAA;

gpio->GPCUP=0x0000FFFF;

gpio->GPDCON=0xAAAAAAAA;

gpio->GPDUP=0x0000FFFF;

gpio->GPECON=0xAAAAAAAA;

gpio->GPEUP=0x000037F7;

gpio->GPFCON=0x00000000;

gpio->GPFUP=0x00000000;

gpio->GPGCON=0xFFEAFF5A;

gpio->GPGUP=0x0000F0DC;

gpio->GPHCON=0x0018AAAA;

gpio->GPHDAT=0x000001FF;

gpio->GPHUP=0x00000656

1 2 3 4 5

关键词: 嵌入式Linux U-Boot移植 Bootloader

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关文章

查看电脑版