Lines Matching +full:cfi +full:- +full:flash
2 * Routines common to all CFI-type probes.
3 * (C) 2001-2003 Red Hat, Inc.
12 #include <linux/mtd/cfi.h>
19 struct cfi_private *cfi);
24 struct cfi_private *cfi; in mtd_do_chip_probe() local
26 /* First probe the map to see if we have CFI stuff there. */ in mtd_do_chip_probe()
27 cfi = genprobe_ident_chips(map, cp); in mtd_do_chip_probe()
29 if (!cfi) in mtd_do_chip_probe()
32 map->fldrv_priv = cfi; in mtd_do_chip_probe()
40 if (mtd->size > map->size) { in mtd_do_chip_probe()
42 (unsigned long)mtd->size >> 10, in mtd_do_chip_probe()
43 (unsigned long)map->size >> 10); in mtd_do_chip_probe()
44 mtd->size = map->size; in mtd_do_chip_probe()
51 kfree(cfi->cfiq); in mtd_do_chip_probe()
52 kfree(cfi); in mtd_do_chip_probe()
53 map->fldrv_priv = NULL; in mtd_do_chip_probe()
61 struct cfi_private cfi; in genprobe_ident_chips() local
67 memset(&cfi, 0, sizeof(cfi)); in genprobe_ident_chips()
69 /* Call the probetype-specific code with all permutations of in genprobe_ident_chips()
71 if (!genprobe_new_chip(map, cp, &cfi)) { in genprobe_ident_chips()
74 cp->name, map->name); in genprobe_ident_chips()
78 #if 0 /* Let the CFI probe routine do this sanity check. The Intel and AMD in genprobe_ident_chips()
79 probe routines won't ever return a broken CFI structure anyway, in genprobe_ident_chips()
82 if (cfi.cfiq->NumEraseRegions == 0) { in genprobe_ident_chips()
84 kfree(cfi.cfiq); in genprobe_ident_chips()
88 cfi.chipshift = cfi.cfiq->DevSize; in genprobe_ident_chips()
90 if (cfi_interleave_is_1(&cfi)) { in genprobe_ident_chips()
92 } else if (cfi_interleave_is_2(&cfi)) { in genprobe_ident_chips()
93 cfi.chipshift++; in genprobe_ident_chips()
94 } else if (cfi_interleave_is_4((&cfi))) { in genprobe_ident_chips()
95 cfi.chipshift += 2; in genprobe_ident_chips()
96 } else if (cfi_interleave_is_8(&cfi)) { in genprobe_ident_chips()
97 cfi.chipshift += 3; in genprobe_ident_chips()
102 cfi.numchips = 1; in genprobe_ident_chips()
108 max_chips = map->size >> cfi.chipshift; in genprobe_ident_chips()
116 kfree(cfi.cfiq); in genprobe_ident_chips()
129 cp->probe_chip(map, i << cfi.chipshift, chip_map, &cfi); in genprobe_ident_chips()
137 retcfi = kmalloc(struct_size(retcfi, chips, cfi.numchips), GFP_KERNEL); in genprobe_ident_chips()
140 kfree(cfi.cfiq); in genprobe_ident_chips()
145 memcpy(retcfi, &cfi, sizeof(cfi)); in genprobe_ident_chips()
146 memset(&retcfi->chips[0], 0, sizeof(struct flchip) * cfi.numchips); in genprobe_ident_chips()
148 for (i = 0, j = 0; (j < cfi.numchips) && (i < max_chips); i++) { in genprobe_ident_chips()
150 struct flchip *pchip = &retcfi->chips[j++]; in genprobe_ident_chips()
152 pchip->start = (i << cfi.chipshift); in genprobe_ident_chips()
153 pchip->state = FL_READY; in genprobe_ident_chips()
154 init_waitqueue_head(&pchip->wq); in genprobe_ident_chips()
155 mutex_init(&pchip->mutex); in genprobe_ident_chips()
165 struct cfi_private *cfi) in genprobe_new_chip() argument
167 int min_chips = (map_bankwidth(map)/4?:1); /* At most 4-bytes wide. */ in genprobe_new_chip()
176 cfi->interleave = nr_chips; in genprobe_new_chip()
178 /* Minimum device size. Don't look for one 8-bit device in genprobe_new_chip()
179 in a 16-bit bus, etc. */ in genprobe_new_chip()
183 cfi->device_type = type; in genprobe_new_chip()
185 if (cp->probe_chip(map, 0, NULL, cfi)) in genprobe_new_chip()
201 struct cfi_private *cfi = map->fldrv_priv; in cfi_cmdset_unknown() local
202 __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; in cfi_cmdset_unknown()
234 struct cfi_private *cfi = map->fldrv_priv; in check_cmd_set() local
235 __u16 type = primary?cfi->cfiq->P_ID:cfi->cfiq->A_ID; in check_cmd_set()
266 MODULE_DESCRIPTION("Helper routines for flash chip probe code");