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)
345 } geom; member
591 ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) * in alloc_device()
598 ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in alloc_device()
608 ns->pages = vmalloc(ns->geom.pgnum * sizeof(union ns_mem)); in alloc_device()
613 for (i = 0; i < ns->geom.pgnum; i++) { in alloc_device()
617 ns->geom.pgszoob, 0, 0, NULL); in alloc_device()
647 for (i = 0; i < ns->geom.pgnum; i++) { in free_device()
685 ns->geom.totsz = mtd->size; in init_nandsim()
686 ns->geom.pgsz = mtd->writesize; in init_nandsim()
687 ns->geom.oobsz = mtd->oobsize; in init_nandsim()
688 ns->geom.secsz = mtd->erasesize; in init_nandsim()
689 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; in init_nandsim()
690 ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz); in init_nandsim()
691 ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; in init_nandsim()
692 ns->geom.secshift = ffs(ns->geom.secsz) - 1; in init_nandsim()
693 ns->geom.pgshift = chip->page_shift; in init_nandsim()
694 ns->geom.pgsec = ns->geom.secsz / ns->geom.pgsz; in init_nandsim()
695 ns->geom.secszoob = ns->geom.secsz + ns->geom.oobsz * ns->geom.pgsec; in init_nandsim()
698 if (ns->geom.pgsz == 512) { in init_nandsim()
702 } else if (ns->geom.pgsz == 2048) { in init_nandsim()
704 } else if (ns->geom.pgsz == 4096) { in init_nandsim()
707 NS_ERR("init_nandsim: unknown page size %u\n", ns->geom.pgsz); in init_nandsim()
712 if (ns->geom.totsz <= (32 << 20)) { in init_nandsim()
713 ns->geom.pgaddrbytes = 3; in init_nandsim()
714 ns->geom.secaddrbytes = 2; in init_nandsim()
716 ns->geom.pgaddrbytes = 4; in init_nandsim()
717 ns->geom.secaddrbytes = 3; in init_nandsim()
720 if (ns->geom.totsz <= (128 << 20)) { in init_nandsim()
721 ns->geom.pgaddrbytes = 4; in init_nandsim()
722 ns->geom.secaddrbytes = 2; in init_nandsim()
724 ns->geom.pgaddrbytes = 5; in init_nandsim()
725 ns->geom.secaddrbytes = 3; in init_nandsim()
735 remains = ns->geom.totsz; in init_nandsim()
738 uint64_t part_sz = (uint64_t)parts[i] * ns->geom.secsz; in init_nandsim()
768 (unsigned long long)ns->geom.totsz >> 20); in init_nandsim()
769 printk("page size: %u bytes\n", ns->geom.pgsz); in init_nandsim()
770 printk("OOB area size: %u bytes\n", ns->geom.oobsz); in init_nandsim()
771 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); in init_nandsim()
772 printk("pages number: %u\n", ns->geom.pgnum); in init_nandsim()
773 printk("pages per sector: %u\n", ns->geom.pgsec); in init_nandsim()
775 printk("bits in sector size: %u\n", ns->geom.secshift); in init_nandsim()
776 printk("bits in page size: %u\n", ns->geom.pgshift); in init_nandsim()
777 printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1); in init_nandsim()
779 (unsigned long long)ns->geom.totszoob >> 10); in init_nandsim()
780 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); in init_nandsim()
781 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); in init_nandsim()
788 ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in init_nandsim()
791 ns->geom.pgszoob); in init_nandsim()
795 memset(ns->buf.byte, 0xFF, ns->geom.pgszoob); in init_nandsim()
833 offset = (loff_t)erase_block_no * ns->geom.secsz; in parse_badblocks()
1181 if (ns->regs.count < (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) in accept_addr_byte()
1185 ns->geom.pgaddrbytes + in accept_addr_byte()
1186 ns->geom.secaddrbytes)); in accept_addr_byte()
1519 for (i = 0; i < ns->geom.pgsec; i++) in erase_sector()
1528 for (i = 0; i < ns->geom.pgsec; i++) { in erase_sector()
1557 memset(ns->file_buf, 0xff, ns->geom.pgszoob); in prog_page()
1569 loff_t pos = (loff_t)ns->regs.row * ns->geom.pgszoob; in prog_page()
1570 tx = write_file(ns, ns->cfile, ns->file_buf, ns->geom.pgszoob, pos); in prog_page()
1571 if (tx != ns->geom.pgszoob) { in prog_page()
1600 memset(mypage->byte, 0xFF, ns->geom.pgszoob); in prog_page()
1624 if (action != ACTION_SECERASE && ns->regs.row >= ns->geom.pgnum) { in do_state_action()
1637 if (ns->regs.column >= (ns->geom.pgszoob - ns->regs.off)) { in do_state_action()
1641 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1649 else if (ns->regs.off < ns->geom.pgsz) in do_state_action()
1655 NS_UDELAY(input_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1669 if (ns->regs.row >= ns->geom.pgnum - ns->geom.pgsec in do_state_action()
1670 || (ns->regs.row & ~(ns->geom.secsz - 1))) { in do_state_action()
1676 8 * (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) | ns->regs.column; in do_state_action()
1679 erase_block_no = ns->regs.row >> (ns->geom.secshift - ns->geom.pgshift); in do_state_action()
1709 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1726 NS_UDELAY(output_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1746 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz/2); in do_state_action()
1747 ns->regs.off = ns->geom.pgsz/2; in do_state_action()
1751 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz); in do_state_action()
1752 ns->regs.off = ns->geom.pgsz; in do_state_action()
1856 ns->regs.num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in switch_state()
1860 ns->regs.num = ns->geom.idbytes; in switch_state()
1881 ns->regs.num = ns->geom.pgaddrbytes; in switch_state()
1885 ns->regs.num = ns->geom.secaddrbytes; in switch_state()
1894 ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes; in switch_state()
2052 ns->regs.num = ns->geom.pgaddrbytes; in ns_nand_write_byte()
2055 ns->regs.num = ns->geom.secaddrbytes; in ns_nand_write_byte()
2282 nand->geom.idbytes = 8; in ns_init_module()
2284 nand->geom.idbytes = 6; in ns_init_module()
2286 nand->geom.idbytes = 4; in ns_init_module()
2288 nand->geom.idbytes = 2; in ns_init_module()