当前位置: 首页>>代码示例>>C++>>正文


C++ parse_mtd_partitions函数代码示例

本文整理汇总了C++中parse_mtd_partitions函数的典型用法代码示例。如果您正苦于以下问题:C++ parse_mtd_partitions函数的具体用法?C++ parse_mtd_partitions怎么用?C++ parse_mtd_partitions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_mtd_partitions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: generic_onenand_probe

static int __devinit generic_onenand_probe(struct device *dev)
{
	struct onenand_info *info;
	struct platform_device *pdev = to_platform_device(dev);
	struct flash_platform_data *pdata = pdev->dev.platform_data;
	struct resource *res = pdev->resource;
	unsigned long size = res->end - res->start + 1;
	int err;

	info = kmalloc(sizeof(struct onenand_info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	memset(info, 0, sizeof(struct onenand_info));

	if (!request_mem_region(res->start, size, dev->driver->name)) {
		err = -EBUSY;
		goto out_free_info;
	}

	info->onenand.base = ioremap(res->start, size);
	if (!info->onenand.base) {
		err = -ENOMEM;
		goto out_release_mem_region;
	}

	info->onenand.mmcontrol = pdata->mmcontrol;

	info->mtd.name = pdev->dev.bus_id;
	info->mtd.priv = &info->onenand;
	info->mtd.owner = THIS_MODULE;

	if (onenand_scan(&info->mtd, 1)) {
		err = -ENXIO;
		goto out_iounmap;
	}

#ifdef CONFIG_MTD_PARTITIONS
	err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0);
	if (err > 0)
		add_mtd_partitions(&info->mtd, info->parts, err);
	else if (err < 0 && pdata->parts)
		add_mtd_partitions(&info->mtd, pdata->parts, pdata->nr_parts);
	else
#endif
		err = add_mtd_device(&info->mtd);

	dev_set_drvdata(&pdev->dev, info);

	return 0;

out_iounmap:
	iounmap(info->onenand.base);
out_release_mem_region:
	release_mem_region(res->start, size);
out_free_info:
	kfree(info);

	return err;
}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:60,代码来源:generic.c

示例2: rknand_add_partitions

static int rknand_add_partitions(struct rknand_info *nand_info)
{
#ifdef CONFIG_MTD_CMDLINE_PARTS
    int num_partitions = 0; 

	// 从命令行解析分区的信息
    num_partitions = parse_mtd_partitions(&(rknand_mtd), part_probes, &rknand_parts, 0); 
    NAND_DEBUG(NAND_DEBUG_LEVEL0,"num_partitions = %d\n",num_partitions);
    if(num_partitions > 0) { 
    	int i;
    	for (i = 0; i < num_partitions; i++) 
        {
            rknand_parts[i].offset *= 0x200;
            rknand_parts[i].size   *=0x200;
    	}
        rknand_parts[num_partitions - 1].size = rknand_mtd.size - rknand_parts[num_partitions - 1].offset;
        
		g_num_partitions = num_partitions;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
		return mtd_device_register(&rknand_mtd, rknand_parts, num_partitions);
#else
		return add_mtd_partitions(&(rknand_mtd), rknand_parts, num_partitions);
#endif
    } 
#endif 
    g_num_partitions = 0;
	return 0;
}
开发者ID:Ciastex,项目名称:kernel_rk3168_86v_yk,代码行数:28,代码来源:rknand_base_ko.c

示例3: h720x_mtd_init

/*
 * Initialize FLASH support
 */
static int __init h720x_mtd_init(void)
{

	char	*part_type = NULL;

	h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size);

	if (!h720x_map.virt) {
		printk(KERN_ERR "H720x-MTD: ioremap failed\n");
		return -EIO;
	}

	simple_map_init(&h720x_map);

	// Probe for flash bankwidth 4
	printk (KERN_INFO "H720x-MTD probing 32bit FLASH\n");
	mymtd = do_map_probe("cfi_probe", &h720x_map);
	if (!mymtd) {
		printk (KERN_INFO "H720x-MTD probing 16bit FLASH\n");
	    // Probe for bankwidth 2
	    h720x_map.bankwidth = 2;
	    mymtd = do_map_probe("cfi_probe", &h720x_map);
	}

	if (mymtd) {
		mymtd->owner = THIS_MODULE;

<<<<<<< HEAD
		nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0);
		if (nr_mtd_parts > 0)
			part_type = "command line";
=======
开发者ID:Core2idiot,项目名称:Kernel-Samsung-3.0...-,代码行数:35,代码来源:h720x-flash.c

示例4: omapflash_probe

static int __init omapflash_probe(struct platform_device *pdev)
{
	int err;
	struct omapflash_info *info;
	struct flash_platform_data *pdata = pdev->dev.platform_data;
	struct resource *res = pdev->resource;
	unsigned long size = res->end - res->start + 1;

	info = kzalloc(sizeof(struct omapflash_info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	if (!request_mem_region(res->start, size, "flash")) {
		err = -EBUSY;
		goto out_free_info;
	}

	info->map.virt		= ioremap(res->start, size);
	if (!info->map.virt) {
		err = -ENOMEM;
		goto out_release_mem_region;
	}
	info->map.name		= pdev->dev.bus_id;
	info->map.phys		= res->start;
	info->map.size		= size;
	info->map.bankwidth	= pdata->width;
	info->map.set_vpp	= omap_set_vpp;

	simple_map_init(&info->map);
	info->mtd = do_map_probe(pdata->map_name, &info->map);
	if (!info->mtd) {
		err = -EIO;
		goto out_iounmap;
	}
	info->mtd->owner = THIS_MODULE;

#ifdef CONFIG_MTD_PARTITIONS
	err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0);
	if (err > 0)
		add_mtd_partitions(info->mtd, info->parts, err);
	else if (err <= 0 && pdata->parts)
		add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts);
	else
#endif
		add_mtd_device(info->mtd);

	platform_set_drvdata(pdev, info);

	return 0;

out_iounmap:
	iounmap(info->map.virt);
out_release_mem_region:
	release_mem_region(res->start, size);
out_free_info:
	kfree(info);

	return err;
}
开发者ID:miettal,项目名称:armadillo420_standard,代码行数:59,代码来源:omap_nor.c

示例5: cs553x_init

static int __init cs553x_init(void)
{
	int err = -ENXIO;
	int i;
	uint64_t val;

#ifdef CONFIG_MTD_PARTITIONS
	int mtd_parts_nb = 0;
	struct mtd_partition *mtd_parts = NULL;
#endif

	/* If the CPU isn't a Geode GX or LX, abort */
	if (!is_geode())
		return -ENXIO;

	/* If it doesn't have the CS553[56], abort */
	rdmsrl(MSR_DIVIL_GLD_CAP, val);
	val &= ~0xFFULL;
	if (val != CAP_CS5535 && val != CAP_CS5536)
		return -ENXIO;

	/* If it doesn't have the NAND controller enabled, abort */
	rdmsrl(MSR_DIVIL_BALL_OPTS, val);
	if (val & PIN_OPT_IDE) {
		printk(KERN_INFO "CS553x NAND controller: Flash I/O not enabled in MSR_DIVIL_BALL_OPTS.\n");
		return -ENXIO;
	}

	for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
		rdmsrl(MSR_DIVIL_LBAR_FLSH0 + i, val);

		if ((val & (FLSH_LBAR_EN|FLSH_NOR_NAND)) == (FLSH_LBAR_EN|FLSH_NOR_NAND))
			err = cs553x_init_one(i, !!(val & FLSH_MEM_IO), val & 0xFFFFFFFF);
	}

	/* Register all devices together here. This means we can easily hack it to
	   do mtdconcat etc. if we want to. */
	for (i = 0; i < NR_CS553X_CONTROLLERS; i++) {
		if (cs553x_mtd[i]) {

			/* If any devices registered, return success. Else the last error. */
#ifdef CONFIG_MTD_PARTITIONS
			mtd_parts_nb = parse_mtd_partitions(cs553x_mtd[i], part_probes, &mtd_parts, 0);
			if (mtd_parts_nb > 0) {
				printk(KERN_NOTICE "Using command line partition definition\n");
				add_mtd_partitions(cs553x_mtd[i], mtd_parts, mtd_parts_nb);
			} else {
				add_mtd_device(cs553x_mtd[i]);
			}
#else
			add_mtd_device(cs553x_mtd[i]);
#endif
			err = 0;
		}
	}

	return err;
}
开发者ID:ARMP,项目名称:android_kernel_lge_x3,代码行数:58,代码来源:cs553x_nand.c

示例6: bfin_flash_probe

static int __devinit bfin_flash_probe(struct platform_device *pdev)
{
	int ret;
	struct physmap_flash_data *pdata = pdev->dev.platform_data;
	struct resource *memory = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	struct resource *flash_ambctl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
	struct async_state *state;

	state = kzalloc(sizeof(*state), GFP_KERNEL);
	if (!state)
		return -ENOMEM;

	state->map.name       = DRIVER_NAME;
	state->map.read       = bfin_flash_read;
	state->map.copy_from  = bfin_flash_copy_from;
	state->map.write      = bfin_flash_write;
	state->map.copy_to    = bfin_flash_copy_to;
	state->map.bankwidth  = pdata->width;
	state->map.size       = resource_size(memory);
	state->map.virt       = (void __iomem *)memory->start;
	state->map.phys       = memory->start;
	state->map.map_priv_1 = (unsigned long)state;
	state->enet_flash_pin = platform_get_irq(pdev, 0);
	state->flash_ambctl0  = flash_ambctl->start;
	state->flash_ambctl1  = flash_ambctl->end;

	if (gpio_request(state->enet_flash_pin, DRIVER_NAME)) {
		pr_devinit(KERN_ERR DRIVER_NAME ": Failed to request gpio %d\n", state->enet_flash_pin);
		kfree(state);
		return -EBUSY;
	}
	gpio_direction_output(state->enet_flash_pin, 1);

	pr_devinit(KERN_NOTICE DRIVER_NAME ": probing %d-bit flash bus\n", state->map.bankwidth * 8);
	state->mtd = do_map_probe(memory->name, &state->map);
	if (!state->mtd) {
		gpio_free(state->enet_flash_pin);
		kfree(state);
		return -ENXIO;
	}

	ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0);
	if (ret > 0) {
		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n");
		mtd_device_register(state->mtd, pdata->parts, ret);
		state->parts = pdata->parts;
	} else if (pdata->nr_parts) {
		pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n");
		mtd_device_register(state->mtd, pdata->parts, pdata->nr_parts);
	} else {
		pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n");
		mtd_device_register(state->mtd, NULL, 0);
	}

	platform_set_drvdata(pdev, state);

	return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:58,代码来源:bfin-async-flash.c

示例7: dm270_init_flash

static int __init
dm270_init_flash (void)   
{
	struct mtd_partition *parts;
	int nb_parts = 0;
	int parsed_nr_parts = 0;
	const char *part_type;
 
	/*
	 * Static partition definition selection
	 */
	part_type = "static";

 	parts = dm270_partitions;
	nb_parts = ARRAY_SIZE(dm270_partitions);
	dm270_map_flash.virt = phys_to_virt(dm270_map_flash.phys);

	simple_map_init(&dm270_map_flash);
	/*
	 * Now let's probe for the actual flash.  Do it here since
	 * specific machine settings might have been set above.
	 */
	printk(KERN_NOTICE "DM270 flash: probing %d-bit flash bus\n",
		dm270_map_flash.bankwidth*8);
	dm270_flash_mtd = do_map_probe("cfi_probe", &dm270_map_flash);
	if (!dm270_flash_mtd) {
		return -ENXIO;
	}
	dm270_flash_mtd->owner = THIS_MODULE;
 
	/*
	 * Dynamic partition selection stuff (might override the static ones)
	 */
	if (dm270_partition_types[0]) {
		parsed_nr_parts = parse_mtd_partitions(dm270_flash_mtd,
				dm270_partition_types, &parsed_parts,
				CONFIG_FLASH_MEM_BASE);
	}
 	if (parsed_nr_parts > 0) {
		part_type = "dynamic";
		parts = parsed_parts;
		nb_parts = parsed_nr_parts;
	}

	if (nb_parts == 0) {
		printk(KERN_NOTICE "DM270 flash: no partition info available,"
			"registering whole flash at once\n");
		if (add_mtd_device(dm270_flash_mtd)) {
			return -ENXIO;
		}
	} else {
		printk(KERN_NOTICE "Using %s partition definition\n",
			part_type);
		return add_mtd_partitions(dm270_flash_mtd, parts, nb_parts);
	}
	return 0;
}
开发者ID:Voskrese,项目名称:mipsonqemu,代码行数:57,代码来源:dm270-flash.c

示例8: init_soleng_maps

static int __init init_soleng_maps(void)
{
	int nr_parts = 0;

	/* First probe at offset 0 */
	soleng_flash_map.phys = 0;
	soleng_flash_map.virt = (void __iomem *)P2SEGADDR(0);
	soleng_eprom_map.phys = 0x01000000;
	soleng_eprom_map.virt = (void __iomem *)P1SEGADDR(0x01000000);
	simple_map_init(&soleng_eprom_map);
	simple_map_init(&soleng_flash_map);

	printk(KERN_NOTICE "Probing for flash chips at 0x00000000:\n");
	flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
	if (!flash_mtd) {
		/* Not there. Try swapping */
		printk(KERN_NOTICE "Probing for flash chips at 0x01000000:\n");
		soleng_flash_map.phys = 0x01000000;
		soleng_flash_map.virt = P2SEGADDR(0x01000000);
		soleng_eprom_map.phys = 0;
		soleng_eprom_map.virt = P1SEGADDR(0);
		flash_mtd = do_map_probe("cfi_probe", &soleng_flash_map);
		if (!flash_mtd) {
			/* Eep. */
			printk(KERN_NOTICE "Flash chips not detected at either possible location.\n");
			return -ENXIO;
		}
	}
	printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
	       soleng_flash_map.phys & 0x1fffffff,
	       soleng_eprom_map.phys & 0x1fffffff);
	flash_mtd->owner = THIS_MODULE;

	eprom_mtd = do_map_probe("map_rom", &soleng_eprom_map);
	if (eprom_mtd) {
		eprom_mtd->owner = THIS_MODULE;
		add_mtd_device(eprom_mtd);
	}

	nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0);

#ifdef CONFIG_MTD_SUPERH_RESERVE
	if (nr_parts <= 0) {
		printk(KERN_NOTICE "Using configured partition at 0x%08x.\n",
		       CONFIG_MTD_SUPERH_RESERVE);
		parsed_parts = superh_se_partitions;
		nr_parts = sizeof(superh_se_partitions)/sizeof(*parsed_parts);
	}
#endif /* CONFIG_MTD_SUPERH_RESERVE */

	if (nr_parts > 0)
		add_mtd_partitions(flash_mtd, parsed_parts, nr_parts);
	else
		add_mtd_device(flash_mtd);

	return 0;
}
开发者ID:mahyarmd,项目名称:unifi-gpl,代码行数:57,代码来源:solutionengine.c

示例9: generic_onenand_probe

static int __devinit generic_onenand_probe(struct platform_device *pdev)
{
	struct onenand_info *info;
	struct onenand_platform_data *pdata = pdev->dev.platform_data;
	struct resource *res = pdev->resource;
	unsigned long size = resource_size(res);
	int err;

	info = kzalloc(sizeof(struct onenand_info), GFP_KERNEL);
	if (!info)
		return -ENOMEM;

	if (!request_mem_region(res->start, size, dev_name(&pdev->dev))) {
		err = -EBUSY;
		goto out_free_info;
	}

	info->onenand.base = ioremap(res->start, size);
	if (!info->onenand.base) {
		err = -ENOMEM;
		goto out_release_mem_region;
	}

	info->onenand.mmcontrol = pdata ? pdata->mmcontrol : 0;
	info->onenand.irq = platform_get_irq(pdev, 0);

	info->mtd.name = dev_name(&pdev->dev);
	info->mtd.priv = &info->onenand;
	info->mtd.owner = THIS_MODULE;

	if (onenand_scan(&info->mtd, 1)) {
		err = -ENXIO;
		goto out_iounmap;
	}

	err = parse_mtd_partitions(&info->mtd, part_probes, &info->parts, 0);
	if (err > 0)
		mtd_device_register(&info->mtd, info->parts, err);
	else if (err <= 0 && pdata && pdata->parts)
		mtd_device_register(&info->mtd, pdata->parts, pdata->nr_parts);
	else
		err = mtd_device_register(&info->mtd, NULL, 0);

	platform_set_drvdata(pdev, info);

	return 0;

out_iounmap:
	iounmap(info->onenand.base);
out_release_mem_region:
	release_mem_region(res->start, size);
out_free_info:
	kfree(info);

	return err;
}
开发者ID:119-org,项目名称:hi3518-osdrv,代码行数:56,代码来源:generic.c

示例10: mtdsf_init_device

int mtdsf_init_device(struct mtd_info *mtd, unsigned long size, char *name)
{
	int nr_parts, cut_parts = 0;
	char *part_type = NULL;

	mtd->name = name;
	mtd->type = MTD_NORFLASH;
	mtd->flags = MTD_CAP_NORFLASH;
	mtd->size = size;
	mtd->erasesize = MTDSF_ERASE_SIZE;
	mtd->owner = THIS_MODULE;
	mtd->erase = sf_erase;
	mtd->read = sf_read;
	mtd->write = sf_write;
	mtd->writesize = 1;


	boot_partitions[5].offset = size - boot_partitions[5].size;
	boot_partitions[4].offset = boot_partitions[5].offset - boot_partitions[4].size;
	boot_partitions[3].offset = boot_partitions[4].offset - boot_partitions[3].size;
	boot_partitions[2].offset = boot_partitions[3].offset - boot_partitions[2].size;
	if (boot_partitions[2].offset > 0x00280000) {
		boot_partitions[1].offset = boot_partitions[2].offset - boot_partitions[1].size;
		if (boot_partitions[1].offset > 0)
			boot_partitions[0].size = boot_partitions[1].offset;
		else {
			shift_partition_content(1);
			cut_parts = 1;
		}
	} else if (boot_partitions[2].offset > 0) {
		boot_partitions[1].size = boot_partitions[2].offset;
		boot_partitions[1].offset = 0;
		shift_partition_content(1);
		cut_parts = 1;
	} else {
		shift_partition_content(2);
		cut_parts = 2;
	}
	

	nr_parts = parse_mtd_partitions(mtd, part_probes, &parts, 0);
	if (nr_parts > 0) {
		part_type = "command line";
		cut_parts = 0;
	}
	if (nr_parts <= 0) {
		parts = boot_partitions;
		nr_parts = NUM_SF_PARTITIONS;
		part_type = "builtin";
	}
	printk(KERN_INFO "SF Using %s partition table count=%d\n", part_type, nr_parts - cut_parts);
	mtd_device_register(mtd, parts, nr_parts - cut_parts);
	//add_mtd_partitions(mtd, boot_partitions, ARRAY_SIZE(boot_partitions));

	return 0;
}
开发者ID:josh64x2,项目名称:apc-rock,代码行数:56,代码来源:wmt_sf.c

示例11: vr_nor_init_partitions

static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p)
{
	struct mtd_partition *parts;
	static const char *part_probes[] = { "cmdlinepart", NULL };

	/* register the flash bank */
	/* partition the flash bank */
	p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0);
	return mtd_device_register(p->info, parts, p->nr_parts);
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:10,代码来源:intel_vr_nor.c

示例12: init_s3c2410nor

int __init init_s3c2410nor(void)
{
  static const char *rom_probe_types[] = PROBETYPES;
  const char **type;
  const char *part_type = 0;

  printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n", WINDOW_SIZE, WINDOW_ADDR);
  s3c2410nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);//物理->虚拟地址

  if (!s3c2410nor_map.virt)
  {
    printk(MSG_PREFIX "failed to ioremap\n");
    return  - EIO;
  }

  simple_map_init(&s3c2410nor_map);

  mymtd = 0;
  type = rom_probe_types;
  for (; !mymtd &&  *type; type++)
  {
    mymtd = do_map_probe(*type, &s3c2410nor_map);//探测NOR FLASH
  }
  if (mymtd)
  {
    mymtd->owner = THIS_MODULE;

    #ifdef CONFIG_MTD_PARTITIONS
      mtd_parts_nb = parse_mtd_partitions(mymtd, NULL, &mtd_parts, MTDID);//探测分区信息
      if (mtd_parts_nb > 0)
        part_type = "detected";

      if (mtd_parts_nb == 0) //未探测到,使用数组定义的分区信息
      {
        mtd_parts = static_partitions;
        mtd_parts_nb = ARRAY_SIZE(static_partitions);
        part_type = "static";
      }
    #endif
    add_mtd_device(mymtd);
    if (mtd_parts_nb == 0)
      printk(KERN_NOTICE MSG_PREFIX "no partition info available\n");
    else
    {
      printk(KERN_NOTICE MSG_PREFIX "using %s partition definition\n",
        part_type);
      add_mtd_partitions(mymtd, mtd_parts, mtd_parts_nb);//添加分区信息
    }
    return 0;
  }

  iounmap((void*)s3c2410nor_map.virt);
  return  - ENXIO;
}
开发者ID:chenzhongtao,项目名称:source,代码行数:54,代码来源:s3c2410nor.c

示例13: init_physmap

int __init init_physmap(void)
{
	static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 };
	const char **type;

       	printk(KERN_NOTICE "physmap flash device: %lx at %lx\n", physmap_map.size, physmap_map.phys);
	physmap_map.virt = (unsigned long)ioremap(physmap_map.phys, physmap_map.size);

	if (!physmap_map.virt) {
		printk("Failed to ioremap\n");
		return -EIO;
	}

	simple_map_init(&physmap_map);

	mymtd = 0;
	type = rom_probe_types;
	for(; !mymtd && *type; type++) {
		mymtd = do_map_probe(*type, &physmap_map);
	}
	if (mymtd) {
		mymtd->owner = THIS_MODULE;

#ifdef CONFIG_MTD_PARTITIONS
		mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes, 
						    &mtd_parts, 0);

		if (mtd_parts_nb > 0)
		{
			add_mtd_partitions (mymtd, mtd_parts, mtd_parts_nb);
			return 0;
		}

		if (num_physmap_partitions != 0) 
		{
			printk(KERN_NOTICE 
			       "Using physmap partition definition\n");
			add_mtd_partitions (mymtd, physmap_partitions, num_physmap_partitions);
			return 0;
		}

#endif
		add_mtd_device(mymtd);

		return 0;
	}

	iounmap((void *)physmap_map.virt);
	return -ENXIO;
}
开发者ID:BackupTheBerlios,项目名称:wl530g-svn,代码行数:50,代码来源:physmap.c

示例14: set_mtd_partitions

static void __init set_mtd_partitions(void)
{
	int nr_parts = 0;

	simple_map_init(&rsk_flash_map);
	flash_mtd = do_map_probe("cfi_probe", &rsk_flash_map);
	nr_parts = parse_mtd_partitions(flash_mtd, probes,
					&parsed_partitions, 0);
	/* If there is no partition table, used the hard coded table */
	if (nr_parts <= 0) {
		flash_data.parts = rsk_partitions;
		flash_data.nr_parts = ARRAY_SIZE(rsk_partitions);
	} else {
		flash_data.nr_parts = nr_parts;
		flash_data.parts = parsed_partitions;
	}
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:17,代码来源:setup.c

示例15: init_alteramap

int __init init_alteramap(void)
{
	static const char *rom_probe_types[] = {"cfi_probe", "jedec_probe", 0 };
	const char **type;

 	ndk_amd_map.virt = (unsigned long *)ioremap_nocache(WINDOW_ADDR, WINDOW_SIZE);
/*
	if (!ndk_amd_map.virt) {
		printk("Failed to ioremap\n");
		return -EIO;
	}
*/
	simple_map_init(&ndk_amd_map);

	mymtd = 0;
	type = rom_probe_types;
	for(; !mymtd && *type; type++) {
		mymtd = do_map_probe(*type, &ndk_amd_map);
	}
	if (mymtd) {
		mymtd->owner = THIS_MODULE;

		mtd_parts_nb = parse_mtd_partitions(mymtd, part_probes, 
						    &mtd_parts, 0);

		if (mtd_parts_nb > 0)
		{
			mtd_device_register(mymtd, mtd_parts, mtd_parts_nb);
			return 0;
		}

		if (NUM_PARTITIONS != 0) 
		{
			printk(KERN_NOTICE 
			       "Using Altera NDK partition definition\n");
			mtd_device_register(mymtd, alteramap_partitions, NUM_PARTITIONS);
			return 0;
		}

		return 0;
	}

	iounmap((void *)ndk_amd_map.virt);
	return -ENXIO;
}
开发者ID:robacklin,项目名称:uclinux-linux,代码行数:45,代码来源:altera.c


注:本文中的parse_mtd_partitions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。