Lines Matching refs:block

217  * onenand_block_address - [DEFAULT] Get block address
219 * @block: the block
220 * @return translated block address if DDP, otherwise same
224 static int onenand_block_address(struct onenand_chip *this, int block)
227 if (block & this->density_mask)
228 return ONENAND_DDP_CHIP1 | (block ^ this->density_mask);
230 return block;
236 * @block: the block
241 static int onenand_bufferram_address(struct onenand_chip *this, int block)
244 if (block & this->density_mask)
297 * flexonenand_block- For given address return block number
299 * @addr: - Address for which block number is needed
328 * flexonenand_addr - Return address of the block
330 * @block: Block number on Flex-OneNAND
332 * Return address of the block
334 static loff_t flexonenand_addr(struct onenand_chip *this, int block)
339 if (ONENAND_IS_DDP(this) && block >= this->density_mask) {
340 block -= this->density_mask;
346 ofs += (loff_t)block << (this->erase_shift - 1);
347 if (block > (boundary + 1))
348 ofs += (loff_t)(block - boundary - 1) << (this->erase_shift - 1);
352 loff_t onenand_addr(struct onenand_chip *this, int block)
355 return (loff_t)block << this->erase_shift;
356 return flexonenand_addr(this, block);
401 int value, block, page;
409 block = -1;
415 block = addr * this->density_mask;
424 block = onenand_block(this, addr);
430 block = addr * this->density_mask;
435 block = onenand_block(this, addr);
437 page = (int) (addr - onenand_addr(this, block))>>\
442 /* Make the even block number */
443 block &= ~1;
446 block++;
456 value = onenand_bufferram_address(this, block);
469 if (block != -1) {
471 value = onenand_block_address(this, block);
475 value = onenand_bufferram_address(this, block);
876 int blockpage, block, page;
878 /* Calculate the even block number */
879 block = (int) (addr >> this->erase_shift) & ~1;
882 block++;
884 blockpage = (block << 7) | page;
923 int block = onenand_block(this, addr);
924 int value = onenand_bufferram_address(this, block);
1520 /* Initial bad block case: 0x2400 or 0x0400 */
2112 * onenand_block_isbad_nolock - [GENERIC] Check if a block is marked bad
2117 * Check, if the block is bad. Either by reading the bad block table or
2143 printk(KERN_ERR "%s: Failed verify, block %d\n",
2155 * onenand_multiblock_erase - [INTERN] erase block(s) using multiblock erase
2158 * @block_size: block size
2160 * Erase one or more blocks up to 64 block at a time
2181 /* Check if we have a bad block, we do not erase bad blocks */
2183 printk(KERN_WARNING "%s: attempt to erase a bad block "
2223 "block %d\n", __func__,
2234 /* last block of 64-eb series */
2242 printk(KERN_ERR "%s: Failed erase, block %d\n",
2265 * onenand_block_by_block_erase - [INTERN] erase block(s) using regular erase
2269 * @block_size: erase block size
2271 * Erase one or more blocks one block at a time
2293 /* Check if we have a bad block, we do not erase bad blocks */
2295 printk(KERN_WARNING "%s: attempt to erase a bad block "
2308 printk(KERN_ERR "%s: Failed erase, block %d\n",
2337 * onenand_erase - [MTD Interface] erase block(s)
2364 /* Start address within region must align on block boundary.
2365 * Erase region's start offset is always block start address.
2371 /* Start address must align on block boundary */
2377 /* Length must align on block boundary */
2379 printk(KERN_ERR "%s: Length not block aligned\n", __func__);
2419 * onenand_block_isbad - [MTD Interface] Check whether the block at the given offset is bad
2423 * Check whether the block is bad
2436 * onenand_default_block_markbad - [DEFAULT] mark a block bad
2454 int block;
2456 /* Get block number */
2457 block = onenand_block(this, ofs);
2459 bbm->bbt[block >> 2] |= 0x01 << ((block & 0x03) << 1);
2463 /* FIXME : What to do when marking SLC block in partition
2471 * onenand_block_markbad - [MTD Interface] Mark the block at the given offset as bad
2475 * Mark the block as bad
2497 * onenand_do_lock_cmd - [OneNAND Interface] Lock or unlock block(s)
2508 int start, end, block, value, status;
2521 /* Set start block address */
2523 /* Set end block address */
2546 for (block = start; block < end + 1; block++) {
2547 /* Set block address */
2548 value = onenand_block_address(this, block);
2551 value = onenand_bufferram_address(this, block);
2553 /* Set start block address */
2554 this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS);
2569 printk(KERN_ERR "%s: block = %d, wp status = 0x%x\n",
2570 __func__, block, status);
2577 * onenand_lock - [MTD Interface] Lock block(s)
2595 * onenand_unlock - [MTD Interface] Unlock block(s)
2620 unsigned int value, block, status;
2624 for (block = 0; block < end; block++) {
2625 /* Set block address */
2626 value = onenand_block_address(this, block);
2629 value = onenand_bufferram_address(this, block);
2631 /* Set start block address */
2632 this->write_word(block, this->base + ONENAND_REG_START_BLOCK_ADDRESS);
2637 printk(KERN_ERR "%s: block = %d, wp status = 0x%x\n",
2638 __func__, block, status);
2659 /* Set start block address */
2680 /* Workaround for all block unlock in DDP */
2704 int value, block, page;
2709 block = (int) (addr >> this->erase_shift);
2714 block = (int) (addr >> this->erase_shift);
2718 /* Make the even block number */
2719 block &= ~1;
2722 block++;
2729 if (block != -1) {
2731 value = onenand_block_address(this, block);
2785 int block, value, status;
2804 block = (int) (to >> this->erase_shift);
2810 value = onenand_block_address(this, block);
2819 value = onenand_bufferram_address(this, block);
2898 * do_otp_read - [DEFAULT] Read OTP block area
2905 * Read OTP block area.
2935 * do_otp_write - [DEFAULT] Write OTP block area
2942 * Write OTP block area.
2979 * do_otp_lock - [DEFAULT] Lock OTP block area
2986 * Lock OTP block area.
3194 * Write lock mark on spare area in page 0 in OTP block
3219 * OTP block : 0xXXFC XX 1111 1100
3220 * 1st block : 0xXXF3 (If chip support) XX 1111 0011
3297 /* A-Die has all block unlock */
3324 printk(KERN_DEBUG "Chip support all block unlock\n");
3505 * @start: first erase block to check
3506 * @end: last erase block to check
3508 * Converting an unerased block from MLC to SLC
3510 * have changed, reads on the block give uncorrectable error.
3511 * This might lead to the block being detected as bad.
3513 * Avoid this by ensuring that the block to be converted is
3520 int block;
3532 for (block = start; block <= end; block++) {
3533 addr = flexonenand_addr(this, block);
3551 __func__, block);
3743 /* OneNAND page size & block size */
3751 /* Pages per a block are always 64 in OneNAND */
3754 * Flex-OneNAND SLC area has 64 pages per block.
3755 * Flex-OneNAND MLC area has 128 pages per block.
3778 * We emulate the 4KiB page and 256KiB erase block size
3974 /* Unlock whole block */
3978 /* Set the bad block marker position */
4004 /* Free bad block table memory, if allocated */