加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

pxa270(Xscale核)的nandflash移植

发布时间:2020-12-15 18:12:22 所属栏目:百科 来源:网络整理
导读:一. ? ?配置内核 * MemoryTechnology Device (MTD) support? --- ????????????? *?? MTD concatenating support ????????????? -*-?? MTD partitioning support ????????????? *?? Direct char device access to MTD devices ????????????? -*-?? Common in

一. ? ?配置内核

<*> MemoryTechnology Device (MTD) support? --->

????????????? <*>?? MTD concatenating support

????????????? -*-?? MTD partitioning support

????????????? <*>?? Direct char device access to MTD devices

????????????? -*-?? Common interface to block layer for MTD'translation layers'

????????????? <*>?? Caching block device access to MTD devices

????????????? <*>?? NAND Device Support? --->

??????????????????????????? <M>?? Support for generic platform NAND driver


二.资源配置

static struct resource hepxa270_nand_flash_resource = {
	.start  = 0x02000000,.end  = 0x02000000 + (1 << MAX(HEPXA270_NAND_CLE,HEPXA270_NAND_ALE)),.flags   = IORESOURCE_MEM,};
//nandflash只作数据存储,所以只分了一个区
static struct mtd_partition hepxa270_nand_flash_partitions[] = {
	{
		.name    = "Application Data",.offset  = 0,.size    = MTDPART_SIZ_FULL
	}
};

static void hepxa270_nand_flash_cmd_ctl(struct mtd_info *mtd,int cmd,unsigned int ctrl)
{	
	struct nand_chip *this = mtd->priv;

	if (cmd == NAND_CMD_NONE)
		return;

	if (ctrl & NAND_CLE)
		writeb(cmd,this->IO_ADDR_W + (1 << HEPXA270_NAND_CLE));
	else
		writeb(cmd,this->IO_ADDR_W + (1 << HEPXA270_NAND_ALE));
}

static const char *hepxa270_nand_flash_part_probe_types[] = {"cmdlinepart",NULL};

static struct platform_nand_data hepxa270_nand_flash_platdata = {
	.chip = {
		.nr_chips          = 1,.chip_offset       = 0,.nr_partitions     = ARRAY_SIZE(hepxa270_nand_flash_partitions),.partitions        = hepxa270_nand_flash_partitions,.chip_delay        = 25,.part_probe_types  = hepxa270_nand_flash_part_probe_types,},.ctrl = {
		.cmd_ctrl          = hepxa270_nand_flash_cmd_ctl,}
};

static struct platform_device hepxa270_nand_flash_device = {
	.name              = "gen_nand",.id                = 0,.num_resources     = 1,.resource          = &hepxa270_nand_flash_resource,.dev               = {
		.platform_data = &hepxa270_nand_flash_platdata,};

三,添加平台设备

static struct platform_device *hepxa270_platform_devices[] __initdata = {
	&hepxa270_nand_flash_device,};

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读