Lines Matching refs:geom
190 #define NS_IS_INITIALIZED(ns) ((ns)->geom.totsz != 0)
200 (((ns)->regs.row * (ns)->geom.pgszoob) + (ns)->regs.column)
203 #define NS_RAW_OFFSET_OOB(ns) (NS_RAW_OFFSET(ns) + ns->geom.pgsz)
329 } geom; member
555 BITS_TO_LONGS(ns->geom.pgnum))); in ns_alloc_device()
561 ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in ns_alloc_device()
579 ns->pages = vmalloc(array_size(sizeof(union ns_mem), ns->geom.pgnum)); in ns_alloc_device()
584 for (i = 0; i < ns->geom.pgnum; i++) { in ns_alloc_device()
588 ns->geom.pgszoob, 0, 0, NULL); in ns_alloc_device()
618 for (i = 0; i < ns->geom.pgnum; i++) { in ns_free_device()
653 ns->geom.totsz = mtd->size; in ns_init()
654 ns->geom.pgsz = mtd->writesize; in ns_init()
655 ns->geom.oobsz = mtd->oobsize; in ns_init()
656 ns->geom.secsz = mtd->erasesize; in ns_init()
657 ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz; in ns_init()
658 ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz); in ns_init()
659 ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz; in ns_init()
660 ns->geom.secshift = ffs(ns->geom.secsz) - 1; in ns_init()
661 ns->geom.pgshift = chip->page_shift; in ns_init()
662 ns->geom.pgsec = ns->geom.secsz / ns->geom.pgsz; in ns_init()
663 ns->geom.secszoob = ns->geom.secsz + ns->geom.oobsz * ns->geom.pgsec; in ns_init()
666 if (ns->geom.pgsz == 512) { in ns_init()
670 } else if (ns->geom.pgsz == 2048) { in ns_init()
672 } else if (ns->geom.pgsz == 4096) { in ns_init()
675 NS_ERR("init_nandsim: unknown page size %u\n", ns->geom.pgsz); in ns_init()
680 if (ns->geom.totsz <= (32 << 20)) { in ns_init()
681 ns->geom.pgaddrbytes = 3; in ns_init()
682 ns->geom.secaddrbytes = 2; in ns_init()
684 ns->geom.pgaddrbytes = 4; in ns_init()
685 ns->geom.secaddrbytes = 3; in ns_init()
688 if (ns->geom.totsz <= (128 << 20)) { in ns_init()
689 ns->geom.pgaddrbytes = 4; in ns_init()
690 ns->geom.secaddrbytes = 2; in ns_init()
692 ns->geom.pgaddrbytes = 5; in ns_init()
693 ns->geom.secaddrbytes = 3; in ns_init()
702 remains = ns->geom.totsz; in ns_init()
705 uint64_t part_sz = (uint64_t)parts[i] * ns->geom.secsz; in ns_init()
743 (unsigned long long)ns->geom.totsz >> 20); in ns_init()
744 printk("page size: %u bytes\n", ns->geom.pgsz); in ns_init()
745 printk("OOB area size: %u bytes\n", ns->geom.oobsz); in ns_init()
746 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); in ns_init()
747 printk("pages number: %u\n", ns->geom.pgnum); in ns_init()
748 printk("pages per sector: %u\n", ns->geom.pgsec); in ns_init()
750 printk("bits in sector size: %u\n", ns->geom.secshift); in ns_init()
751 printk("bits in page size: %u\n", ns->geom.pgshift); in ns_init()
752 printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1); in ns_init()
754 (unsigned long long)ns->geom.totszoob >> 10); in ns_init()
755 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); in ns_init()
756 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); in ns_init()
764 ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in ns_init()
767 ns->geom.pgszoob); in ns_init()
771 memset(ns->buf.byte, 0xFF, ns->geom.pgszoob); in ns_init()
817 offset = (loff_t)erase_block_no * ns->geom.secsz; in ns_parse_badblocks()
1147 if (ns->regs.count < (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) in ns_accept_addr_byte()
1151 ns->geom.pgaddrbytes + in ns_accept_addr_byte()
1152 ns->geom.secaddrbytes)); in ns_accept_addr_byte()
1479 for (i = 0; i < ns->geom.pgsec; i++) in ns_erase_sector()
1488 for (i = 0; i < ns->geom.pgsec; i++) { in ns_erase_sector()
1517 memset(ns->file_buf, 0xff, ns->geom.pgszoob); in ns_prog_page()
1529 loff_t pos = (loff_t)ns->regs.row * ns->geom.pgszoob; in ns_prog_page()
1531 ns->geom.pgszoob, pos); in ns_prog_page()
1532 if (tx != ns->geom.pgszoob) { in ns_prog_page()
1561 memset(mypage->byte, 0xFF, ns->geom.pgszoob); in ns_prog_page()
1585 if (action != ACTION_SECERASE && ns->regs.row >= ns->geom.pgnum) { in ns_do_state_action()
1598 if (ns->regs.column >= (ns->geom.pgszoob - ns->regs.off)) { in ns_do_state_action()
1602 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in ns_do_state_action()
1610 else if (ns->regs.off < ns->geom.pgsz) in ns_do_state_action()
1616 NS_UDELAY(input_cycle * ns->geom.pgsz / 1000 / busdiv); in ns_do_state_action()
1630 if (ns->regs.row >= ns->geom.pgnum - ns->geom.pgsec in ns_do_state_action()
1631 || (ns->regs.row & ~(ns->geom.secsz - 1))) { in ns_do_state_action()
1637 8 * (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) | ns->regs.column; in ns_do_state_action()
1640 erase_block_no = ns->regs.row >> (ns->geom.secshift - ns->geom.pgshift); in ns_do_state_action()
1670 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in ns_do_state_action()
1687 NS_UDELAY(output_cycle * ns->geom.pgsz / 1000 / busdiv); in ns_do_state_action()
1707 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz/2); in ns_do_state_action()
1708 ns->regs.off = ns->geom.pgsz/2; in ns_do_state_action()
1712 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz); in ns_do_state_action()
1713 ns->regs.off = ns->geom.pgsz; in ns_do_state_action()
1821 ns->regs.num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in ns_switch_state()
1825 ns->regs.num = ns->geom.idbytes; in ns_switch_state()
1846 ns->regs.num = ns->geom.pgaddrbytes; in ns_switch_state()
1850 ns->regs.num = ns->geom.secaddrbytes; in ns_switch_state()
1859 ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes; in ns_switch_state()
2020 ns->regs.num = ns->geom.pgaddrbytes; in ns_nand_write_byte()
2023 ns->regs.num = ns->geom.secaddrbytes; in ns_nand_write_byte()
2301 ns->geom.idbytes = 8; in ns_init_module()
2303 ns->geom.idbytes = 6; in ns_init_module()
2305 ns->geom.idbytes = 4; in ns_init_module()
2307 ns->geom.idbytes = 2; in ns_init_module()