Lines Matching refs:nandcore
78 static hndnand_t nandcore;
543 if (!firsttime && nandcore.size)
544 return &nandcore;
547 bzero(&nandcore, sizeof(nandcore));
549 nandcore.sih = sih;
550 nandcore.core = (void *)nc;
551 nandcore.wrap = si_wrapperregs(sih);
552 nandcore.read = nandcore_read;
553 nandcore.write = nandcore_write;
554 nandcore.erase = nandcore_erase;
555 nandcore.checkbadb = nandcore_checkbadb;
556 nandcore.markbadb = nandcore_mark_badb;
559 nandcore.dev_ready = nandcore_dev_ready;
560 nandcore.select_chip = nandcore_select_chip;
561 nandcore.cmdfunc = nandcore_cmdfunc;
562 nandcore.waitfunc = nandcore_waitfunc;
563 nandcore.read_oob = nandcore_read_oob;
564 nandcore.write_oob = nandcore_write_oob;
565 nandcore.read_page = nandcore_read_page;
566 nandcore.write_page = nandcore_write_page;
567 nandcore.cmd_read_byte = nandcore_cmd_read_byte;
581 ai = (aidmp_t *)nandcore.wrap;
593 nandcore.id[i] = (id >> (8*i)) & 0xff;
594 nandcore.id[i + 4] = (id2 >> (8*i)) & 0xff;
597 name = nandcore_check_id(nandcore.id);
600 nandcore.type = nandcore.id[0];
603 nandcore_override_config(&nandcore);
610 nandcore.pagesize = 512;
613 nandcore.pagesize = (1 << 10) * 2;
616 nandcore.pagesize = (1 << 10) * 4;
619 nandcore.pagesize = (1 << 10) * 8;
626 nandcore.blocksize = (1 << 10) * 8;
629 nandcore.blocksize = (1 << 10) * 16;
632 nandcore.blocksize = (1 << 10) * 128;
635 nandcore.blocksize = (1 << 10) * 256;
638 nandcore.blocksize = (1 << 10) * 512;
641 nandcore.blocksize = (1 << 10) * 1024;
644 nandcore.blocksize = (1 << 10) * 2048;
652 nandcore.size = (1 << val) * 4;
656 nandcore.width = 1;
663 nandcore.sectorsize = 1024;
666 nandcore.sectorsize = 512;
668 if (nandcore.sectorsize == 1024 && nandcore.pagesize == 512) {
674 nandcore.sparesize = acc_control & NANDAC_CS0_SPARE_AREA_SIZE;
677 nandcore.oobsize = nandcore.sparesize * (nandcore.pagesize / NANDCACHE_SIZE);
680 nandcore.ecclevel = (acc_control & NANDAC_CS0_ECC_LEVEL_MASK) >> NANDAC_CS0_ECC_LEVEL_SHIFT;
683 if (nandcore.sectorsize == 1024) {
684 nandcore.sparesize *= 2;
685 nandcore.eccbytes = ((nandcore.ecclevel * 14 + 3) >> 2);
688 nandcore.eccbytes = ((nandcore.ecclevel * 14 + 7) >> 3);
690 nandcore.numblocks = (nandcore.size * (1 << 10)) / (nandcore.blocksize >> 10);
693 num_cache_per_page = nandcore.pagesize / NANDCACHE_SIZE;
696 spare_per_cache = nandcore.oobsize / num_cache_per_page;
700 printf("Total size: %uMB\n", nandcore.size);
701 printf("Block size: %uKB\n", (nandcore.blocksize >> 10));
702 printf("Page Size: %uB\n", nandcore.pagesize);
703 printf("OOB Size: %uB\n", nandcore.oobsize);
704 printf("Sector size: %uB\n", nandcore.sectorsize);
705 printf("Spare size: %uB\n", nandcore.sparesize);
706 printf("ECC level: %u (%u-bit)\n", nandcore.ecclevel,
707 (nandcore.sectorsize == 1024)? nandcore.ecclevel*2 : nandcore.ecclevel);
709 nandcore.id[0], nandcore.id[1], nandcore.id[2],
710 nandcore.id[3], nandcore.id[4], nandcore.id[5]);
715 nandcore.phybase = SI_NS_NANDFLASH;
716 nandcore.base = (uint32)REG_MAP(SI_NS_NANDFLASH, SI_FLASH_WINDOW);
733 nandcore_optimize_timing(&nandcore);
735 return nandcore.size ? &nandcore : NULL;