Lines Matching refs:oob
127 /* ----------------------- oob helpers -------------------------------------- */
148 static int sm_read_lba(struct sm_oob *oob)
157 if (!memcmp(oob, erased_pattern, SM_OOB_SIZE))
161 lba_test = *(uint16_t *)oob->lba_copy1 ^ *(uint16_t*)oob->lba_copy2;
166 lba = sm_get_lba(oob->lba_copy1);
169 lba = sm_get_lba(oob->lba_copy2);
174 static void sm_write_lba(struct sm_oob *oob, uint16_t lba)
186 oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0];
187 oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1];
217 static int sm_correct_sector(uint8_t *buffer, struct sm_oob *oob)
223 if (__nand_correct_data(buffer, ecc, oob->ecc1, SM_SMALL_PAGE,
231 if (__nand_correct_data(buffer, ecc, oob->ecc2, SM_SMALL_PAGE,
237 /* Reads a sector + oob*/
240 uint8_t *buffer, struct sm_oob *oob)
255 /* User might not need the oob, but we do for data verification */
256 if (!oob)
257 oob = &tmp_oob;
262 ops.oobbuf = (void *)oob;
279 /* Unfortunately, oob read will _always_ succeed,
290 /* Do a basic test on the oob, to guard against returned garbage */
291 if (oob->reserved != 0xFFFFFFFF && !is_power_of_2(~oob->reserved))
302 if (!sm_sector_valid(oob)) {
310 (ftl->smallpagenand && sm_correct_sector(buffer, oob))) {
323 uint8_t *buffer, struct sm_oob *oob)
344 ops.oobbuf = (void *)oob;
372 struct sm_oob oob;
376 /* Initialize the oob with requested values */
377 memset(&oob, 0xFF, SM_OOB_SIZE);
378 sm_write_lba(&oob, lba);
386 oob.data_status = 0xFF;
394 oob.data_status = 0;
399 oob.ecc1,
403 SM_SMALL_PAGE, oob.ecc2,
407 buf + boffset, &oob))
435 struct sm_oob oob;
438 memset(&oob, 0xFF, SM_OOB_SIZE);
439 oob.block_status = 0xF0;
453 sm_write_sector(ftl, zone, block, boffset, NULL, &oob);
500 struct sm_oob oob;
513 if (sm_read_sector(ftl, zone, block, boffset, NULL, &oob))
516 test_lba = sm_read_lba(&oob);
618 /* Test for proper write,erase and oob sizes */
655 struct sm_oob oob;
658 0, ftl->cis_block, ftl->cis_boffset, ftl->cis_buffer, &oob))
661 if (!sm_sector_valid(&oob) || !sm_block_valid(&oob))
675 struct sm_oob oob;
683 if (sm_read_sector(ftl, 0, block, 0, NULL, &oob))
686 if (!sm_block_valid(&oob))
699 if (sm_read_sector(ftl, 0, block, boffset, NULL, &oob))
702 if (!sm_sector_valid(&oob))
748 struct sm_oob oob;
777 /* Read the oob of first sector */
778 if (sm_read_sector(ftl, zone_num, block, 0, NULL, &oob)) {
786 if (sm_block_erased(&oob)) {
796 if (!sm_block_valid(&oob)) {
802 lba = sm_read_lba(&oob);