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()
734 remains = ns->geom.totsz; in init_nandsim()
737 uint64_t part_sz = (uint64_t)parts[i] * ns->geom.secsz; in init_nandsim()
773 (unsigned long long)ns->geom.totsz >> 20); in init_nandsim()
774 printk("page size: %u bytes\n", ns->geom.pgsz); in init_nandsim()
775 printk("OOB area size: %u bytes\n", ns->geom.oobsz); in init_nandsim()
776 printk("sector size: %u KiB\n", ns->geom.secsz >> 10); in init_nandsim()
777 printk("pages number: %u\n", ns->geom.pgnum); in init_nandsim()
778 printk("pages per sector: %u\n", ns->geom.pgsec); in init_nandsim()
780 printk("bits in sector size: %u\n", ns->geom.secshift); in init_nandsim()
781 printk("bits in page size: %u\n", ns->geom.pgshift); in init_nandsim()
782 printk("bits in OOB size: %u\n", ffs(ns->geom.oobsz) - 1); in init_nandsim()
784 (unsigned long long)ns->geom.totszoob >> 10); in init_nandsim()
785 printk("page address bytes: %u\n", ns->geom.pgaddrbytes); in init_nandsim()
786 printk("sector address bytes: %u\n", ns->geom.secaddrbytes); in init_nandsim()
793 ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL); in init_nandsim()
796 ns->geom.pgszoob); in init_nandsim()
799 memset(ns->buf.byte, 0xFF, ns->geom.pgszoob); in init_nandsim()
832 offset = (loff_t)erase_block_no * ns->geom.secsz; in parse_badblocks()
1180 if (ns->regs.count < (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) in accept_addr_byte()
1184 ns->geom.pgaddrbytes + in accept_addr_byte()
1185 ns->geom.secaddrbytes)); in accept_addr_byte()
1518 for (i = 0; i < ns->geom.pgsec; i++) in erase_sector()
1527 for (i = 0; i < ns->geom.pgsec; i++) { in erase_sector()
1556 memset(ns->file_buf, 0xff, ns->geom.pgszoob); in prog_page()
1568 loff_t pos = (loff_t)ns->regs.row * ns->geom.pgszoob; in prog_page()
1569 tx = write_file(ns, ns->cfile, ns->file_buf, ns->geom.pgszoob, pos); in prog_page()
1570 if (tx != ns->geom.pgszoob) { in prog_page()
1599 memset(mypage->byte, 0xFF, ns->geom.pgszoob); in prog_page()
1623 if (action != ACTION_SECERASE && ns->regs.row >= ns->geom.pgnum) { in do_state_action()
1636 if (ns->regs.column >= (ns->geom.pgszoob - ns->regs.off)) { in do_state_action()
1640 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1648 else if (ns->regs.off < ns->geom.pgsz) in do_state_action()
1654 NS_UDELAY(input_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1668 if (ns->regs.row >= ns->geom.pgnum - ns->geom.pgsec in do_state_action()
1669 || (ns->regs.row & ~(ns->geom.secsz - 1))) { in do_state_action()
1675 8 * (ns->geom.pgaddrbytes - ns->geom.secaddrbytes)) | ns->regs.column; in do_state_action()
1678 erase_block_no = ns->regs.row >> (ns->geom.secshift - ns->geom.pgshift); in do_state_action()
1708 num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in do_state_action()
1725 NS_UDELAY(output_cycle * ns->geom.pgsz / 1000 / busdiv); in do_state_action()
1745 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz/2); in do_state_action()
1746 ns->regs.off = ns->geom.pgsz/2; in do_state_action()
1750 NS_DBG("do_state_action: set internal offset to %d\n", ns->geom.pgsz); in do_state_action()
1751 ns->regs.off = ns->geom.pgsz; in do_state_action()
1855 ns->regs.num = ns->geom.pgszoob - ns->regs.off - ns->regs.column; in switch_state()
1859 ns->regs.num = ns->geom.idbytes; in switch_state()
1880 ns->regs.num = ns->geom.pgaddrbytes; in switch_state()
1884 ns->regs.num = ns->geom.secaddrbytes; in switch_state()
1893 ns->regs.num = ns->geom.pgaddrbytes - ns->geom.secaddrbytes; in switch_state()
2051 ns->regs.num = ns->geom.pgaddrbytes; in ns_nand_write_byte()
2054 ns->regs.num = ns->geom.secaddrbytes; in ns_nand_write_byte()
2281 nand->geom.idbytes = 8; in ns_init_module()
2283 nand->geom.idbytes = 6; in ns_init_module()
2285 nand->geom.idbytes = 4; in ns_init_module()
2287 nand->geom.idbytes = 2; in ns_init_module()