Lines Matching refs:geom
203 #define NS_IS_INITIALIZED(ns) ((ns)->geom.totsz != 0)
213 (((ns)->regs.row * (ns)->geom.pgszoob) + (ns)->regs.column)
216 #define NS_RAW_OFFSET_OOB(ns) (NS_RAW_OFFSET(ns) + ns->geom.pgsz)
340 } geom; member
570 BITS_TO_LONGS(ns->geom.pgnum))); in alloc_device()
576 ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in alloc_device()
586 ns->pages = vmalloc(array_size(sizeof(union ns_mem), ns->geom.pgnum)); in alloc_device()
591 for (i = 0; i < ns->geom.pgnum; i++) { in alloc_device()
595 ns->geom.pgszoob, 0, 0, NULL); in alloc_device()
625 for (i = 0; i < ns->geom.pgnum; i++) { in free_device()
663 ns->geom.totsz = mtd->size; in init_nandsim()
664 ns->geom.pgsz = mtd->writesize; in init_nandsim()
665 ns->geom.oobsz = mtd->oobsize; in init_nandsim()
666 ns->geom.secsz = mtd->erasesize; in init_nandsim()
667 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; in init_nandsim()
668 ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz); in init_nandsim()
669 ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; in init_nandsim()
670 ns->geom.secshift = ffs(ns->geom.secsz) - 1; in init_nandsim()
671 ns->geom.pgshift = chip->page_shift; in init_nandsim()
672 ns->geom.pgsec = ns->geom.secsz / ns->geom.pgsz; in init_nandsim()
673 ns->geom.secszoob = ns->geom.secsz + ns->geom.oobsz * ns->geom.pgsec; in init_nandsim()
676 if (ns->geom.pgsz == 512) { in init_nandsim()
680 } else if (ns->geom.pgsz == 2048) { in init_nandsim()
682 } else if (ns->geom.pgsz == 4096) { in init_nandsim()
685 NS_ERR("init_nandsim: unknown page size %u\n", ns->geom.pgsz); in init_nandsim()
690 if (ns->geom.totsz <= (32 << 20)) { in init_nandsim()
691 ns->geom.pgaddrbytes = 3; in init_nandsim()
692 ns->geom.secaddrbytes = 2; in init_nandsim()
694 ns->geom.pgaddrbytes = 4; in init_nandsim()
695 ns->geom.secaddrbytes = 3; in init_nandsim()
698 if (ns->geom.totsz <= (128 << 20)) { in init_nandsim()
699 ns->geom.pgaddrbytes = 4; in init_nandsim()
700 ns->geom.secaddrbytes = 2; in init_nandsim()
702 ns->geom.pgaddrbytes = 5; in init_nandsim()
703 ns->geom.secaddrbytes = 3; in init_nandsim()
712 remains = ns->geom.totsz; in init_nandsim()
715 uint64_t part_sz = (uint64_t)parts[i] * ns->geom.secsz; in init_nandsim()
751 (unsigned long long)ns->geom.totsz >> 20); in init_nandsim()
752 printk("page size: %u bytes\n", ns->geom.pgsz); in init_nandsim()
753 printk("OOB area size: %u bytes\n", ns->geom.oobsz); in init_nandsim()
754 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); in init_nandsim()
755 printk("pages number: %u\n", ns->geom.pgnum); in init_nandsim()
756 printk("pages per sector: %u\n", ns->geom.pgsec); in init_nandsim()
758 printk("bits in sector size: %u\n", ns->geom.secshift); in init_nandsim()
759 printk("bits in page size: %u\n", ns->geom.pgshift); in init_nandsim()
760 printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1); in init_nandsim()
762 (unsigned long long)ns->geom.totszoob >> 10); in init_nandsim()
763 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); in init_nandsim()
764 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); in init_nandsim()
771 ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in init_nandsim()
774 ns->geom.pgszoob); in init_nandsim()
777 memset(ns->buf.byte, 0xFF, ns->geom.pgszoob); in init_nandsim()
810 offset = (loff_t)erase_block_no * ns->geom.secsz; in parse_badblocks()
1158 if (ns->regs.count < (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) in accept_addr_byte()
1162 ns->geom.pgaddrbytes + in accept_addr_byte()
1163 ns->geom.secaddrbytes)); in accept_addr_byte()
1484 for (i = 0; i < ns->geom.pgsec; i++) in erase_sector()
1493 for (i = 0; i < ns->geom.pgsec; i++) { in erase_sector()
1522 memset(ns->file_buf, 0xff, ns->geom.pgszoob); in prog_page()
1534 loff_t pos = (loff_t)ns->regs.row * ns->geom.pgszoob; in prog_page()
1535 tx = write_file(ns, ns->cfile, ns->file_buf, ns->geom.pgszoob, pos); in prog_page()
1536 if (tx != ns->geom.pgszoob) { in prog_page()
1565 memset(mypage->byte, 0xFF, ns->geom.pgszoob); in prog_page()
1589 if (action != ACTION_SECERASE && ns->regs.row >= ns->geom.pgnum) { in do_state_action()
1602 if (ns->regs.column >= (ns->geom.pgszoob - ns->regs.off)) { in do_state_action()
1606 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1614 else if (ns->regs.off < ns->geom.pgsz) in do_state_action()
1620 NS_UDELAY(input_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1634 if (ns->regs.row >= ns->geom.pgnum - ns->geom.pgsec in do_state_action()
1635 || (ns->regs.row & ~(ns->geom.secsz - 1))) { in do_state_action()
1641 8 * (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) | ns->regs.column; in do_state_action()
1644 erase_block_no = ns->regs.row >> (ns->geom.secshift - ns->geom.pgshift); in do_state_action()
1674 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1691 NS_UDELAY(output_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1711 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz/2); in do_state_action()
1712 ns->regs.off = ns->geom.pgsz/2; in do_state_action()
1716 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz); in do_state_action()
1717 ns->regs.off = ns->geom.pgsz; in do_state_action()
1821 ns->regs.num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in switch_state()
1825 ns->regs.num = ns->geom.idbytes; in switch_state()
1846 ns->regs.num = ns->geom.pgaddrbytes; in switch_state()
1850 ns->regs.num = ns->geom.secaddrbytes; in switch_state()
1859 ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes; in switch_state()
2019 ns->regs.num = ns->geom.pgaddrbytes; in ns_nand_write_byte()
2022 ns->regs.num = ns->geom.secaddrbytes; in ns_nand_write_byte()
2294 nand->geom.idbytes = 8; in ns_init_module()
2296 nand->geom.idbytes = 6; in ns_init_module()
2298 nand->geom.idbytes = 4; in ns_init_module()
2300 nand->geom.idbytes = 2; in ns_init_module()