Exemplo n.º 1
0
static struct mtd_info *flash_probe(void)
{
	struct mtd_info *mtd_cse0;
	struct mtd_info *mtd_cse1;
	struct mtd_info *mtd_cse;

	mtd_cse0 = probe_cs(&map_cse0);
	mtd_cse1 = probe_cs(&map_cse1);

	if (!mtd_cse0 && !mtd_cse1) {
		
		return NULL;
	}

	if (mtd_cse0 && mtd_cse1) {
		struct mtd_info *mtds[] = { mtd_cse0, mtd_cse1 };

		mtd_cse = mtd_concat_create(mtds, ARRAY_SIZE(mtds),
					    "cse0+cse1");
		if (!mtd_cse) {
			printk(KERN_ERR "%s and %s: Concatenation failed!\n",
			       map_cse0.name, map_cse1.name);

			mtd_cse = mtd_cse0;
			map_destroy(mtd_cse1);
		}
	} else {
		mtd_cse = mtd_cse0? mtd_cse0 : mtd_cse1;
	}

	return mtd_cse;
}
Exemplo n.º 2
0
static struct mtd_info *flash_probe(void)
{
	struct mtd_info *mtd_cse0;
	struct mtd_info *mtd_cse1;
	struct mtd_info *mtd_total;
	struct mtd_info *mtds[2];
	int count = 0;

	if ((mtd_cse0 = probe_cs(&map_cse0)) != NULL)
		mtds[count++] = mtd_cse0;
	if ((mtd_cse1 = probe_cs(&map_cse1)) != NULL)
		mtds[count++] = mtd_cse1;

	if (!mtd_cse0 && !mtd_cse1) {
		
		return NULL;
	}

	if (count > 1) {
		mtd_total = mtd_concat_create(mtds, count, "cse0+cse1");
		if (!mtd_total) {
			printk(KERN_ERR "%s and %s: Concatenation failed!\n",
				map_cse0.name, map_cse1.name);

			mtd_total = mtd_cse0;
			map_destroy(mtd_cse1);
		}
	} else
		mtd_total = mtd_cse0 ? mtd_cse0 : mtd_cse1;

	return mtd_total;
}
Exemplo n.º 3
0
static struct mtd_info *flash_probe(void)
{
	struct mtd_info *mtd_cse0;
	struct mtd_info *mtd_cse1;
	struct mtd_info *mtd_nand = NULL;
	struct mtd_info *mtd_total;
	struct mtd_info *mtds[3];
	int count = 0;

	if ((mtd_cse0 = probe_cs(&map_cse0)) != NULL)
		mtds[count++] = mtd_cse0;
	if ((mtd_cse1 = probe_cs(&map_cse1)) != NULL)
		mtds[count++] = mtd_cse1;

#ifdef CONFIG_ETRAX_NANDFLASH
	if ((mtd_nand = crisv32_nand_flash_probe()) != NULL)
		mtds[count++] = mtd_nand;
#endif

	if (!mtd_cse0 && !mtd_cse1 && !mtd_nand) {
		/* No chip found. */
		return NULL;
	}

	if (count > 1) {
#ifdef CONFIG_MTD_CONCAT
		/* Since the concatenation layer adds a small overhead we
		 * could try to figure out if the chips in cse0 and cse1 are
		 * identical and reprobe the whole cse0+cse1 window. But since
		 * flash chips are slow, the overhead is relatively small.
		 * So we use the MTD concatenation layer instead of further
		 * complicating the probing procedure.
		 */
		mtd_total = mtd_concat_create(mtds,
		                              count,
		                              "cse0+cse1+nand");
#else
		printk(KERN_ERR "%s and %s: Cannot concatenate due to kernel "
		       "(mis)configuration!\n", map_cse0.name, map_cse1.name);
		mtd_toal = NULL;
#endif
		if (!mtd_total) {
			printk(KERN_ERR "%s and %s: Concatenation failed!\n",
			       map_cse0.name, map_cse1.name);

			/* The best we can do now is to only use what we found
			 * at cse0.
			 */
			mtd_total = mtd_cse0;
			map_destroy(mtd_cse1);
		}
	} else {
		mtd_total = mtd_cse0? mtd_cse0 : mtd_cse1 ? mtd_cse1 : mtd_nand;

	}

	return mtd_total;
}
Exemplo n.º 4
0
/* 
 * Probe each chip select individually for flash chips. If there are chips on
 * both cse0 and cse1, the mtd_info structs will be concatenated to one struct
 * so that MTD partitions can cross chip boundries.
 *
 * The only known restriction to how you can mount your chips is that each
 * chip select must hold similar flash chips. But you need external hardware
 * to do that anyway and you can put totally different chips on cse0 and cse1
 * so it isn't really much of a restriction.
 */
static struct mtd_info *flash_probe(void)
{
	struct mtd_info *mtd_cse0;
	struct mtd_info *mtd_cse1;
	struct mtd_info *mtd_cse;

	mtd_cse0 = probe_cs(&map_cse0);
	mtd_cse1 = probe_cs(&map_cse1);

	if (!mtd_cse0 && !mtd_cse1) {
		/* No chip found. */
		return NULL;
	}

	if (mtd_cse0 && mtd_cse1) {
#ifdef CONFIG_MTD_CONCAT
		struct mtd_info *mtds[] = { mtd_cse0, mtd_cse1 };
		
		/* Since the concatenation layer adds a small overhead we
		 * could try to figure out if the chips in cse0 and cse1 are
		 * identical and reprobe the whole cse0+cse1 window. But since
		 * flash chips are slow, the overhead is relatively small.
		 * So we use the MTD concatenation layer instead of further
		 * complicating the probing procedure.
		 */
		mtd_cse = mtd_concat_create(mtds,
					    sizeof(mtds) / sizeof(mtds[0]),
					    "cse0+cse1");
#else
		printk(KERN_ERR "%s and %s: Cannot concatenate due to kernel "
		       "(mis)configuration!\n", map_cse0.name, map_cse1.name);
		mtd_cse = NULL;
#endif
		if (!mtd_cse) {
			printk(KERN_ERR "%s and %s: Concatenation failed!\n",
			       map_cse0.name, map_cse1.name);

			/* The best we can do now is to only use what we found
			 * at cse0.
			 */ 
			mtd_cse = mtd_cse0;
			map_destroy(mtd_cse1);
		}
	} else {
		mtd_cse = mtd_cse0? mtd_cse0 : mtd_cse1;
	}

	return mtd_cse;
}
static struct mtd_info *flash_probe(void)
{
	struct mtd_info *mtd_cse0;
	struct mtd_info *mtd_cse1;
	struct mtd_info *mtd_total;
	struct mtd_info *mtds[2];
	int count = 0;

	if ((mtd_cse0 = probe_cs(&map_cse0)) != NULL)
		mtds[count++] = mtd_cse0;
	if ((mtd_cse1 = probe_cs(&map_cse1)) != NULL)
		mtds[count++] = mtd_cse1;

	if (!mtd_cse0 && !mtd_cse1) {
		/* No chip found. */
		return NULL;
	}

	if (count > 1) {
		/* Since the concatenation layer adds a small overhead we
		 * could try to figure out if the chips in cse0 and cse1 are
		 * identical and reprobe the whole cse0+cse1 window. But since
		 * flash chips are slow, the overhead is relatively small.
		 * So we use the MTD concatenation layer instead of further
		 * complicating the probing procedure.
		 */
		mtd_total = mtd_concat_create(mtds, count, "cse0+cse1");
		if (!mtd_total) {
			printk(KERN_ERR "%s and %s: Concatenation failed!\n",
				map_cse0.name, map_cse1.name);

			/* The best we can do now is to only use what we found
			 * at cse0. */
			mtd_total = mtd_cse0;
			map_destroy(mtd_cse1);
		}
	} else
		mtd_total = mtd_cse0 ? mtd_cse0 : mtd_cse1;

	return mtd_total;
}