S5PV210(TQ210)学习笔记——Nand flash驱动编写
时间:11-28
来源:互联网
点击:
- nand_chip->hip->cmd_ctrl=s5p_md_ctrl;
- nand_chip->IO_ADDR_R=&s5p_nand_regs->nfdata;
- nand_chip->IO_ADDR_W=&s5p_nand_regs->nfdata;
- nand_chip->dev_ready=s5p_nand_ready;
- nand_chip->ecc.mode=NAND_ECC_SOFT;
- s5p_mtd_info->priv=nand_chip;
- s5p_mtd_info->owner=THIS_MODULE;
- //扫描Nandflash设备
- if(nand_scan(s5p_mtd_info,1)){
- dev_dbg(&pdev->dev,"nandscanerror");
- gotoerr_free_info;
- }
- //添加分区信息
- ret=mtd_device_parse_register(s5p_mtd_info,NULL,NULL,s5p_nand_partions,ARRAY_SIZE(s5p_nand_partions));
- if(!ret)
- return0;
- err_free_info:
- kfree(s5p_mtd_info);
- err_free_chip:
- kfree(nand_chip);
- err_clk_put:
- clk_disable(s5p_nand_clk);
- clk_put(s5p_nand_clk);
- err_iounmap:
- //if(s5p_nand_ecc==NULL)
- //iounmap(s5p_nand_ecc);
- if(s5p_nand_regs==NULL)
- iounmap(s5p_nand_regs);
- err_exit:
- returnret;
- }
- staticints5p_nand_remove(structplatform_device*pdev){
- nand_release(s5p_mtd_info);
- kfree(s5p_mtd_info);
- kfree(nand_chip);
- clk_disable(s5p_nand_clk);
- clk_put(s5p_nand_clk);
- if(s5p_nand_regs==NULL)
- iounmap(s5p_nand_regs);
- return0;
- }
- staticstructplatform_drivers5p_nand_drv={
- .driver={
- .owner=THIS_MODULE,
- .name="s5p-nand",
- },
- .probe=s5p_nand_probe,
- .remove=s5p_nand_remove,
- };
- module_platform_driver(s5p_nand_drv);
- MODULE_LICENSE("GPL");
源码都在上面,具体的原理还是参考视频或者其他资料,这里就不多说了,如果有任何问题,欢迎留言讨论。
S5PV210Nandflash驱动编 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)