| Index: embios/trunk/target/ipodnano2g/ftl.c | 
| — | — | @@ -2253,12 +2253,12 @@ | 
| 2254 | 2254 | lcdconsole_progressbar(&progressbar, 0, ftl_nand_type->userblocks + 0x17); | 
| 2255 | 2255 | #endif | 
| 2256 | 2256 | uint32_t ppb = ftl_nand_type->pagesperblock * ftl_banks; | 
| 2257 |  | -    memset(&ftl_cxt, 0x00, 0x800);
 | 
| 2258 |  | -    memset(ftl_map, 0xff, 0x4000);
 | 
| 2259 |  | -    memset(blk_usn, 0x00, 0x8000);
 | 
| 2260 |  | -    memset(blk_type, 0x00, 0x2000);
 | 
| 2261 |  | -    memset(ftl_erasectr, 0x00, 0x4000);
 | 
| 2262 |  | -    memset(erasectr_usn, 0xff, 32);
 | 
|  | 2257 | +    memset(&ftl_cxt, 0x00, sizeof(ftl_cxt)); | 
|  | 2258 | +    memset(ftl_map, 0xff, sizeof(ftl_map)); | 
|  | 2259 | +    memset(blk_usn, 0x00, sizeof(blk_usn)); | 
|  | 2260 | +    memset(blk_type, 0x00, sizeof(blk_type)); | 
|  | 2261 | +    memset(ftl_erasectr, 0x00, sizeof(ftl_erasectr)); | 
|  | 2262 | +    memset(erasectr_usn, 0xff, sizeof(erasectr_usn)); | 
| 2263 | 2263 | user_usn = 0; | 
| 2264 | 2264 | meta_usn = 0xffffffff; | 
| 2265 | 2265 | for (i = 0; i < ftl_nand_type->userblocks + 0x17; i++) | 
| — | — | @@ -2521,44 +2521,19 @@ | 
| 2522 | 2522 | if (ftl_initialized) return 0; | 
| 2523 | 2523 | mutex_init(&ftl_mtx); | 
| 2524 | 2524 | uint32_t i; | 
| 2525 |  | -    uint32_t result = 0;
 | 
| 2526 |  | -    uint32_t foundsignature, founddevinfo, blockwiped, repaired, skip;
 | 
| 2527 | 2525 | int rc; | 
| 2528 |  | -    if ((rc = nand_device_init()) != 0) //return 1;
 | 
|  | 2526 | +    if ((rc = nand_device_init()) != 0) | 
| 2529 | 2527 | panicf(PANIC_FATAL, "FTL: Lowlevel NAND driver init failed: %d", rc); | 
| 2530 | 2528 | ftl_banks = 0; | 
| 2531 | 2529 | for (i = 0; i < 4; i++) | 
| 2532 | 2530 | if (nand_get_device_type(i) != 0) ftl_banks = i + 1; | 
| 2533 | 2531 | ftl_nand_type = nand_get_device_type(0); | 
| 2534 |  | -    foundsignature = 0;
 | 
| 2535 |  | -    blockwiped = 1;
 | 
| 2536 |  | -    for (i = 0; i < ftl_nand_type->pagesperblock; i++)
 | 
| 2537 |  | -    {
 | 
| 2538 |  | -        result = nand_read_page(0, i, ftl_buffer, NULL, 1, 1);
 | 
| 2539 |  | -        if ((result & 0x11F) == 0)
 | 
| 2540 |  | -        {
 | 
| 2541 |  | -            blockwiped = 0;
 | 
| 2542 |  | -            if (((uint32_t*)ftl_buffer)[0] != 0x41303034) continue;
 | 
| 2543 |  | -            foundsignature = 1;
 | 
| 2544 |  | -            break;
 | 
| 2545 |  | -        }
 | 
| 2546 |  | -        else if ((result & 2) != 2) blockwiped = 0;
 | 
| 2547 |  | -    }
 | 
| 2548 | 2532 |  | 
| 2549 |  | -    founddevinfo = ftl_has_devinfo();
 | 
| 2550 |  | -
 | 
| 2551 |  | -    repaired = 0;
 | 
| 2552 |  | -    skip = 0;
 | 
| 2553 |  | -    if (founddevinfo == 0)
 | 
|  | 2533 | +    if (!ftl_has_devinfo()) | 
| 2554 | 2534 | { | 
| 2555 | 2535 | DEBUGF("FTL: No DEVICEINFO found!"); | 
| 2556 | 2536 | return -1; | 
| 2557 | 2537 | } | 
| 2558 |  | -    if (foundsignature != 0 && (result & 0x11F) != 0)
 | 
| 2559 |  | -    {
 | 
| 2560 |  | -        DEBUGF("FTL: Problem with the signature!");
 | 
| 2561 |  | -        return -2;
 | 
| 2562 |  | -    }
 | 
| 2563 | 2538 | if (ftl_vfl_open() == 0) | 
| 2564 | 2539 | { | 
| 2565 | 2540 | if (ftl_open() == 0) | 
| — | — | @@ -2584,5 +2559,5 @@ | 
| 2585 | 2560 |  | 
| 2586 | 2561 | DEBUGF("FTL: Initialization failed!"); | 
| 2587 | 2562 |  | 
| 2588 |  | -    return -3;
 | 
|  | 2563 | +    return -2; | 
| 2589 | 2564 | } |