1 /***************************************************************************
2 * Copyright (C) 2007 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
32 /* non-CFI compatible flashes */
33 non_cfi_t non_cfi_flashes[] = {
38 .dev_size = 0x10, /* 2^16 = 64KB */
39 .interface_desc = 0x0, /* x8 only device */
40 .max_buf_write_size = 0x0,
41 .num_erase_regions = 1,
44 0x0010000f, /* 16x 4KB */
52 .dev_size = 0x11, /* 2^17 = 128KB */
53 .interface_desc = 0x0, /* x8 only device */
54 .max_buf_write_size = 0x0,
55 .num_erase_regions = 1,
66 .dev_size = 0x12, /* 2^18 = 256KB */
67 .interface_desc = 0x0, /* x8 only device */
68 .max_buf_write_size = 0x0,
69 .num_erase_regions = 1,
80 .dev_size = 0x13, /* 2^19 = 512KB */
81 .interface_desc = 0x0, /* x8 only device */
82 .max_buf_write_size = 0x0,
83 .num_erase_regions = 1,
92 .id = 0xd6, /* ST29F400BB */
94 .dev_size = 0x13, /* 2^19 = 512KB */
95 .interface_desc = 0x2, /* x8 or x16 device with nBYTE */
96 .max_buf_write_size = 0x0,
97 .num_erase_regions = 4,
100 0x00400000, /* 1x 16KB */
101 0x00200001, /* 2x 8KB */
102 0x00800000, /* 1x 32KB */
103 0x01000006, /* 7x 64KB */
109 .id = 0xd5, /* ST29F400BT */
111 .dev_size = 0x13, /* 2^19 = 512KB */
112 .interface_desc = 0x2, /* x8 or x16 device with nBYTE */
113 .max_buf_write_size = 0x0,
114 .num_erase_regions = 4,
117 0x01000006, /* 7x 64KB */
118 0x00800000, /* 1x 32KB */
119 0x00200001, /* 2x 8KB */
120 0x00400000, /* 1x 16KB */
126 .id = 0x22ab, /* AM29F400BB */
128 .dev_size = 0x13, /* 2^19 = 512KB */
129 .interface_desc = 0x2, /* x8 or x16 device with nBYTE */
130 .max_buf_write_size = 0x0,
131 .num_erase_regions = 4,
134 0x00400000, /* 1x 16KB */
135 0x00200001, /* 2x 8KB */
136 0x00800000, /* 1x 32KB */
137 0x01000006, /* 7x 64KB */
143 .id = 0x2223, /* AM29F400BT */
145 .dev_size = 0x13, /* 2^19 = 512KB */
146 .interface_desc = 0x2, /* x8 or x16 device with nBYTE */
147 .max_buf_write_size = 0x0,
148 .num_erase_regions = 4,
151 0x01000006, /* 7x 64KB */
152 0x00800000, /* 1x 32KB */
153 0x00200001, /* 2x 8KB */
154 0x00400000, /* 1x 16KB */
164 void cfi_fixup_non_cfi(flash_bank_t *bank, void *param)
166 cfi_flash_bank_t *cfi_info = bank->driver_priv;
167 non_cfi_t *non_cfi = non_cfi_flashes;
171 if ((cfi_info->manufacturer == non_cfi->mfr)
172 && (cfi_info->device_id == non_cfi->id))
179 cfi_info->not_cfi = 1;
181 /* fill in defaults for non-critical data */
182 cfi_info->vcc_min = 0x0;
183 cfi_info->vcc_max = 0x0;
184 cfi_info->vpp_min = 0x0;
185 cfi_info->vpp_max = 0x0;
186 cfi_info->word_write_timeout_typ = 0x0;
187 cfi_info->buf_write_timeout_typ = 0x0;
188 cfi_info->block_erase_timeout_typ = 0x0;
189 cfi_info->chip_erase_timeout_typ = 0x0;
190 cfi_info->word_write_timeout_max = 0x0;
191 cfi_info->buf_write_timeout_max = 0x0;
192 cfi_info->block_erase_timeout_max = 0x0;
193 cfi_info->chip_erase_timeout_max = 0x0;
195 cfi_info->qry[0] = 'Q';
196 cfi_info->qry[1] = 'R';
197 cfi_info->qry[2] = 'Y';
199 cfi_info->pri_id = non_cfi->pri_id;
200 cfi_info->pri_addr = 0x0;
201 cfi_info->alt_id = 0x0;
202 cfi_info->alt_addr = 0x0;
203 cfi_info->alt_ext = NULL;
205 cfi_info->interface_desc = non_cfi->interface_desc;
206 cfi_info->max_buf_write_size = non_cfi->max_buf_write_size;
207 cfi_info->num_erase_regions = non_cfi->num_erase_regions;
208 cfi_info->erase_region_info = non_cfi->erase_region_info;
210 if (cfi_info->pri_id == 0x2)
212 cfi_spansion_pri_ext_t *pri_ext = malloc(sizeof(cfi_spansion_pri_ext_t));
214 pri_ext->pri[0] = 'P';
215 pri_ext->pri[1] = 'R';
216 pri_ext->pri[2] = 'I';
218 pri_ext->major_version = '1';
219 pri_ext->minor_version = '0';
221 pri_ext->SiliconRevision = 0x0;
222 pri_ext->EraseSuspend = 0x0;
223 pri_ext->EraseSuspend = 0x0;
224 pri_ext->BlkProt = 0x0;
225 pri_ext->TmpBlkUnprotect = 0x0;
226 pri_ext->BlkProtUnprot = 0x0;
227 pri_ext->SimultaneousOps = 0x0;
228 pri_ext->BurstMode = 0x0;
229 pri_ext->PageMode = 0x0;
230 pri_ext->VppMin = 0x0;
231 pri_ext->VppMax = 0x0;
232 pri_ext->TopBottom = 0x0;
234 pri_ext->_reversed_geometry = 0;
236 cfi_info->pri_ext = pri_ext;
237 } else if ((cfi_info->pri_id == 0x1) || (cfi_info->pri_id == 0x3))
239 ERROR("BUG: non-CFI flashes using the Intel commandset are not yet supported");