--- zzzz-none-000/linux-2.6.13.1/drivers/mtd/chips/gen_probe.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/drivers/mtd/chips/gen_probe.c 2007-02-20 16:39:27.000000000 +0000 @@ -13,6 +13,15 @@ #include #include +/*--- #define DEBUG_GEN_PROBE ---*/ + +#if defined(DEBUG_GEN_PROBE) +#define DBG_GEN_PROBE(...) printk(KERN_NOTICE __VA_ARGS__) +#else +#define DBG_GEN_PROBE(...) +#endif + + static struct mtd_info *check_cmd_set(struct map_info *, int); static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chip_probe *cp); @@ -24,6 +33,7 @@ struct mtd_info *mtd = NULL; struct cfi_private *cfi; + DBG_GEN_PROBE("[mtd_do_chip_probe] map %p\n", map); /* First probe the map to see if we have CFI stuff there. */ cfi = genprobe_ident_chips(map, cp); @@ -33,6 +43,7 @@ map->fldrv_priv = cfi; /* OK we liked it. Now find a driver for the command set it talks */ + DBG_GEN_PROBE("[mtd_do_chip_probe] check_cmd_set\n"); mtd = check_cmd_set(map, 1); /* First the primary cmdset */ if (!mtd) mtd = check_cmd_set(map, 0); /* Then the secondary */ @@ -60,6 +71,7 @@ memset(&cfi, 0, sizeof(cfi)); + DBG_GEN_PROBE("[genprobe_ident_chips] map name %s\n", map->name); /* Call the probetype-specific code with all permutations of interleave and device type, etc. */ if (!genprobe_new_chip(map, cp, &cfi)) { @@ -69,18 +81,27 @@ return NULL; } -#if 0 /* Let the CFI probe routine do this sanity check. The Intel and AMD - probe routines won't ever return a broken CFI structure anyway, - because they make them up themselves. - */ +#if 0 + /* Let the CFI probe routine do this sanity check. The Intel and AMD + probe routines won't ever return a broken CFI structure anyway, + because they make them up themselves. */ if (cfi.cfiq->NumEraseRegions == 0) { printk(KERN_WARNING "Number of erase regions is zero\n"); kfree(cfi.cfiq); return NULL; } #endif + DBG_GEN_PROBE("[genprobe_ident_chips] cfi.cfiq->DevSize %d\n", cfi.cfiq->DevSize); + cfi.chipshift = cfi.cfiq->DevSize; +#if CONFIG_ARCH_DAVINCI + /*--- am VideoFritz ist die höchste Adressleitung nicht angeschlossen ---*/ + if ((CONFIG_MTD_PHYSMAP_LEN == 0x01000000) && (cfi.cfiq->DevSize == 25)) + cfi.chipshift--; +#endif + + if (cfi_interleave_is_1(&cfi)) { ; } else if (cfi_interleave_is_2(&cfi)) { @@ -118,6 +139,7 @@ */ for (i = 1; i < max_chips; i++) { + DBG_GEN_PROBE("[genprobe_ident_chips] 2\n"); cp->probe_chip(map, i << cfi.chipshift, chip_map, &cfi); } @@ -138,10 +160,13 @@ memcpy(retcfi, &cfi, sizeof(cfi)); memset(&retcfi->chips[0], 0, sizeof(struct flchip) * cfi.numchips); + DBG_GEN_PROBE("[genprobe_ident_chips] 3 cfi.numchips %d max_chips %d\n", cfi.numchips, max_chips); for (i = 0, j = 0; (j < cfi.numchips) && (i < max_chips); i++) { + printk("[genprobe_ident_chips] 4 i %d j %d\n", i, j); if(test_bit(i, chip_map)) { struct flchip *pchip = &retcfi->chips[j++]; + printk("[genprobe_ident_chips] 5 i %d j %d\n", i, j); pchip->start = (i << cfi.chipshift); pchip->state = FL_READY; init_waitqueue_head(&pchip->wq); @@ -162,20 +187,25 @@ int max_chips = map_bankwidth(map); /* And minimum 1 */ int nr_chips, type; + DBG_GEN_PROBE("[genprobe_new_chip] map 0x%p map->size 0x%lx map->name %s\n", map, map->size, map->name); + DBG_GEN_PROBE("[genprobe_new_chip] min_chips %d max_chips %d\n", min_chips, max_chips); for (nr_chips = max_chips; nr_chips >= min_chips; nr_chips >>= 1) { if (!cfi_interleave_supported(nr_chips)) continue; cfi->interleave = nr_chips; + DBG_GEN_PROBE("[genprobe_new_chip] cfi->interleave %d\n", cfi->interleave); /* Minimum device size. Don't look for one 8-bit device in a 16-bit bus, etc. */ type = map_bankwidth(map) / nr_chips; + DBG_GEN_PROBE("[genprobe_new_chip] map_bankwidth %d type %d\n", map_bankwidth(map), type); for (; type <= CFI_DEVICETYPE_X32; type<<=1) { cfi->device_type = type; + DBG_GEN_PROBE("[genprobe_new_chip] call probe_chip\n"); if (cp->probe_chip(map, 0, NULL, cfi)) return 1; }