예제 #1
0
static int __init armflash_cfi_init(void *base, u_int size)
{
	int ret;

	armflash_flash_init();
	armflash_flash_wp(1);

	/*
	 * look for CFI based flash parts fitted to this board
	 */
	armflash_map.size       = size;
	armflash_map.buswidth   = 4;
	armflash_map.virt = (unsigned long) base;

	simple_map_init(&armflash_map);

	/*
	 * The CFI layer automatically works out what size chips we have
	 * and does the necessary identification for us automatically.
	 */
	mtd = do_map_probe("cfi_probe", &armflash_map);
	if (!mtd)
		return -ENXIO;

	mtd->owner = THIS_MODULE;

	ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
	if (ret <= 0) {
		/*
		 * Use default static MTD partition definition:
		 */
		parts = integrator_partitions;
		ret = ARRAY_SIZE(integrator_partitions);
	}

	ret = add_mtd_partitions(mtd, parts, ret);
	if (ret)
		printk(KERN_ERR "mtd partition registration failed: %d\n", ret);

	/*
	 * If we got an error, free all resources.
	 */
	if (ret < 0) {
		del_mtd_partitions(mtd);
		map_destroy(mtd);
	}

	return ret;
}
예제 #2
0
static int __init armflash_cfi_init(void *base, u_int size)
{
	struct mtd_partition *parts;
	int ret;

	armflash_flash_init();
	armflash_flash_wp(1);

	/*
	 * look for CFI based flash parts fitted to this board
	 */
	armflash_map.size       = size;
	armflash_map.buswidth   = 4;
	armflash_map.map_priv_2 = (unsigned long) base;

	/*
	 * Also, the CFI layer automatically works out what size
	 * of chips we have, and does the necessary identification
	 * for us automatically.
	 */
	mtd = do_map_probe("cfi_probe", &armflash_map);
	if (!mtd)
		return -ENXIO;

	mtd->module = THIS_MODULE;

	ret = parse_afs_partitions(mtd, &parts);
	if (ret > 0) {
		ret = add_mtd_partitions(mtd, parts, ret);
		/* we don't need the partition info any longer */
		kfree(parts);
		if (ret)
			printk(KERN_ERR "mtd partition registration "
				"failed: %d\n", ret);
	}

	/*
	 * If we got an error, free all resources.
	 */
	if (ret < 0) {
		del_mtd_partitions(mtd);
		map_destroy(mtd);
	}

	return ret;
}
예제 #3
0
static int __init armflash_cfi_init(void *base, u_int size)
{
	int ret;

	armflash_flash_init();
	armflash_flash_wp(1);

	/*
	 * look for CFI based flash parts fitted to this board
	 */
	armflash_map.size       = size;
	armflash_map.bankwidth   = 4;
	armflash_map.virt = (void __iomem *) base;

	simple_map_init(&armflash_map);

	/*
	 * Also, the CFI layer automatically works out what size
	 * of chips we have, and does the necessary identification
	 * for us automatically.
	 */
	mtd = do_map_probe("cfi_probe", &armflash_map);
	if (!mtd)
		return -ENXIO;

	mtd->owner = THIS_MODULE;

	ret = parse_mtd_partitions(mtd, probes, &parts, (void *)0);
	if (ret > 0) {
		ret = add_mtd_partitions(mtd, parts, ret);
		if (ret)
			printk(KERN_ERR "mtd partition registration "
				"failed: %d\n", ret);
	}

	/*
	 * If we got an error, free all resources.
	 */
	if (ret < 0) {
		del_mtd_partitions(mtd);
		map_destroy(mtd);
	}

	return ret;
}