Revision e96efcfc hw/pflash_cfi02.c
b/hw/pflash_cfi02.c | ||
---|---|---|
91 | 91 |
uint32_t ret; |
92 | 92 |
uint8_t *p; |
93 | 93 |
|
94 |
DPRINTF("%s: offset %08x\n", __func__, offset);
|
|
94 |
DPRINTF("%s: offset " TARGET_FMT_lx "\n", __func__, offset);
|
|
95 | 95 |
ret = -1; |
96 | 96 |
offset -= pfl->base; |
97 | 97 |
boff = offset & 0xFF; |
... | ... | |
161 | 161 |
default: |
162 | 162 |
goto flash_read; |
163 | 163 |
} |
164 |
DPRINTF("%s: ID %d %x\n", __func__, boff, ret);
|
|
164 |
DPRINTF("%s: ID " TARGET_FMT_ld " %x\n", __func__, boff, ret);
|
|
165 | 165 |
break; |
166 | 166 |
case 0xA0: |
167 | 167 |
case 0x10: |
... | ... | |
214 | 214 |
offset -= pfl->base; |
215 | 215 |
|
216 | 216 |
cmd = value; |
217 |
DPRINTF("%s: offset %08x %08x %d\n", __func__, offset, value, width); |
|
217 |
DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__, |
|
218 |
offset, value, width); |
|
218 | 219 |
if (pfl->cmd != 0xA0 && cmd == 0xF0) { |
219 | 220 |
DPRINTF("%s: flash reset asked (%02x %02x)\n", |
220 | 221 |
__func__, pfl->cmd, cmd); |
... | ... | |
239 | 240 |
return; |
240 | 241 |
} |
241 | 242 |
if (boff != 0x555 || cmd != 0xAA) { |
242 |
DPRINTF("%s: unlock0 failed %04x %02x %04x\n",
|
|
243 |
DPRINTF("%s: unlock0 failed " TARGET_FMT_lx " %02x %04x\n",
|
|
243 | 244 |
__func__, boff, cmd, 0x555); |
244 | 245 |
goto reset_flash; |
245 | 246 |
} |
... | ... | |
249 | 250 |
/* We started an unlock sequence */ |
250 | 251 |
check_unlock1: |
251 | 252 |
if (boff != 0x2AA || cmd != 0x55) { |
252 |
DPRINTF("%s: unlock1 failed %04x %02x\n", __func__, boff, cmd); |
|
253 |
DPRINTF("%s: unlock1 failed " TARGET_FMT_lx " %02x\n", __func__, |
|
254 |
boff, cmd); |
|
253 | 255 |
goto reset_flash; |
254 | 256 |
} |
255 | 257 |
DPRINTF("%s: unlock sequence done\n", __func__); |
... | ... | |
257 | 259 |
case 2: |
258 | 260 |
/* We finished an unlock sequence */ |
259 | 261 |
if (!pfl->bypass && boff != 0x555) { |
260 |
DPRINTF("%s: command failed %04x %02x\n", __func__, boff, cmd); |
|
262 |
DPRINTF("%s: command failed " TARGET_FMT_lx " %02x\n", __func__, |
|
263 |
boff, cmd); |
|
261 | 264 |
goto reset_flash; |
262 | 265 |
} |
263 | 266 |
switch (cmd) { |
... | ... | |
281 | 284 |
/* We need another unlock sequence */ |
282 | 285 |
goto check_unlock0; |
283 | 286 |
case 0xA0: |
284 |
DPRINTF("%s: write data offset %08x %08x %d\n",
|
|
287 |
DPRINTF("%s: write data offset " TARGET_FMT_lx " %08x %d\n",
|
|
285 | 288 |
__func__, offset, value, width); |
286 | 289 |
p = pfl->storage; |
287 | 290 |
switch (width) { |
... | ... | |
352 | 355 |
switch (cmd) { |
353 | 356 |
case 0x10: |
354 | 357 |
if (boff != 0x555) { |
355 |
DPRINTF("%s: chip erase: invalid address %04x\n",
|
|
358 |
DPRINTF("%s: chip erase: invalid address " TARGET_FMT_lx "\n",
|
|
356 | 359 |
__func__, offset); |
357 | 360 |
goto reset_flash; |
358 | 361 |
} |
... | ... | |
369 | 372 |
/* Sector erase */ |
370 | 373 |
p = pfl->storage; |
371 | 374 |
offset &= ~(pfl->sector_len - 1); |
372 |
DPRINTF("%s: start sector erase at %08x\n", __func__, offset); |
|
375 |
DPRINTF("%s: start sector erase at " TARGET_FMT_lx "\n", __func__, |
|
376 |
offset); |
|
373 | 377 |
memset(p + offset, 0xFF, pfl->sector_len); |
374 | 378 |
pflash_update(pfl, offset, pfl->sector_len); |
375 | 379 |
pfl->status = 0x00; |
Also available in: Unified diff