Lines Matching refs:doc

85 #define DoC_is_MillenniumPlus(doc) ((doc)->ChipID == DOC_ChipID_DocMilPlus16 || (doc)->ChipID == DO…  argument
86 #define DoC_is_Millennium(doc) ((doc)->ChipID == DOC_ChipID_DocMil) argument
87 #define DoC_is_2000(doc) ((doc)->ChipID == DOC_ChipID_Doc2k) argument
217 static void DoC_Delay(struct doc_priv *doc, unsigned short cycles) in DoC_Delay() argument
223 if (DoC_is_Millennium(doc)) in DoC_Delay()
224 dummy = ReadDOC(doc->virtadr, NOP); in DoC_Delay()
225 else if (DoC_is_MillenniumPlus(doc)) in DoC_Delay()
226 dummy = ReadDOC(doc->virtadr, Mplus_NOP); in DoC_Delay()
228 dummy = ReadDOC(doc->virtadr, DOCStatus); in DoC_Delay()
236 static int _DoC_WaitReady(struct doc_priv *doc) in _DoC_WaitReady() argument
238 void __iomem *docptr = doc->virtadr; in _DoC_WaitReady()
244 if (DoC_is_MillenniumPlus(doc)) { in _DoC_WaitReady()
267 static inline int DoC_WaitReady(struct doc_priv *doc) in DoC_WaitReady() argument
269 void __iomem *docptr = doc->virtadr; in DoC_WaitReady()
272 if (DoC_is_MillenniumPlus(doc)) { in DoC_WaitReady()
273 DoC_Delay(doc, 4); in DoC_WaitReady()
277 ret = _DoC_WaitReady(doc); in DoC_WaitReady()
279 DoC_Delay(doc, 4); in DoC_WaitReady()
283 ret = _DoC_WaitReady(doc); in DoC_WaitReady()
284 DoC_Delay(doc, 2); in DoC_WaitReady()
294 struct doc_priv *doc = nand_get_controller_data(this); in doc2000_write_byte() local
295 void __iomem *docptr = doc->virtadr; in doc2000_write_byte()
306 struct doc_priv *doc = nand_get_controller_data(this); in doc2000_writebuf() local
307 void __iomem *docptr = doc->virtadr; in doc2000_writebuf()
322 struct doc_priv *doc = nand_get_controller_data(this); in doc2000_readbuf() local
323 void __iomem *docptr = doc->virtadr; in doc2000_readbuf()
330 if (!doc->supports_32b_reads || in doc2000_readbuf()
365 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_ident_chip() local
373 if (doc->ChipID == DOC_ChipID_Doc2k && try_dword && !nr) { in doc200x_ident_chip()
379 void __iomem *docptr = doc->virtadr; in doc200x_ident_chip()
386 doc->supports_32b_reads = true; in doc200x_ident_chip()
396 struct doc_priv *doc = nand_get_controller_data(this); in doc2000_count_chips() local
401 doc->chips_per_floor = 4; in doc2000_count_chips()
411 doc->chips_per_floor = i; in doc2000_count_chips()
417 struct doc_priv *doc = nand_get_controller_data(this); in doc2001_write_byte() local
418 void __iomem *docptr = doc->virtadr; in doc2001_write_byte()
427 struct doc_priv *doc = nand_get_controller_data(this); in doc2001_writebuf() local
428 void __iomem *docptr = doc->virtadr; in doc2001_writebuf()
439 struct doc_priv *doc = nand_get_controller_data(this); in doc2001_readbuf() local
440 void __iomem *docptr = doc->virtadr; in doc2001_readbuf()
455 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_writebuf() local
456 void __iomem *docptr = doc->virtadr; in doc2001plus_writebuf()
472 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_readbuf() local
473 void __iomem *docptr = doc->virtadr; in doc2001plus_readbuf()
503 static void doc200x_write_control(struct doc_priv *doc, u8 value) in doc200x_write_control() argument
505 WriteDOC(value, doc->virtadr, CDSNControl); in doc200x_write_control()
507 DoC_Delay(doc, 4); in doc200x_write_control()
513 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_exec_instr() local
518 doc200x_write_control(doc, CDSN_CTRL_CE | CDSN_CTRL_CLE); in doc200x_exec_instr()
523 doc200x_write_control(doc, CDSN_CTRL_CE | CDSN_CTRL_ALE); in doc200x_exec_instr()
527 if (DoC_is_2000(doc)) in doc200x_exec_instr()
535 doc200x_write_control(doc, CDSN_CTRL_CE); in doc200x_exec_instr()
536 if (DoC_is_2000(doc)) in doc200x_exec_instr()
545 doc200x_write_control(doc, CDSN_CTRL_CE); in doc200x_exec_instr()
546 if (DoC_is_2000(doc)) in doc200x_exec_instr()
555 DoC_WaitReady(doc); in doc200x_exec_instr()
567 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_exec_op() local
573 doc->curchip = op->cs % doc->chips_per_floor; in doc200x_exec_op()
574 doc->curfloor = op->cs / doc->chips_per_floor; in doc200x_exec_op()
576 WriteDOC(doc->curfloor, doc->virtadr, FloorSelect); in doc200x_exec_op()
577 WriteDOC(doc->curchip, doc->virtadr, CDSNDeviceSelect); in doc200x_exec_op()
580 doc200x_write_control(doc, CDSN_CTRL_CE); in doc200x_exec_op()
586 doc200x_write_control(doc, 0); in doc200x_exec_op()
591 static void doc2001plus_write_pipe_term(struct doc_priv *doc) in doc2001plus_write_pipe_term() argument
593 WriteDOC(0x00, doc->virtadr, Mplus_WritePipeTerm); in doc2001plus_write_pipe_term()
594 WriteDOC(0x00, doc->virtadr, Mplus_WritePipeTerm); in doc2001plus_write_pipe_term()
600 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_exec_instr() local
605 WriteDOC(instr->ctx.cmd.opcode, doc->virtadr, Mplus_FlashCmd); in doc2001plus_exec_instr()
606 doc2001plus_write_pipe_term(doc); in doc2001plus_exec_instr()
613 WriteDOC(addr, doc->virtadr, Mplus_FlashAddress); in doc2001plus_exec_instr()
615 doc2001plus_write_pipe_term(doc); in doc2001plus_exec_instr()
617 WriteDOC(0, doc->virtadr, Mplus_FlashControl); in doc2001plus_exec_instr()
627 doc2001plus_write_pipe_term(doc); in doc2001plus_exec_instr()
630 DoC_WaitReady(doc); in doc2001plus_exec_instr()
642 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_exec_op() local
648 doc->curchip = op->cs % doc->chips_per_floor; in doc2001plus_exec_op()
649 doc->curfloor = op->cs / doc->chips_per_floor; in doc2001plus_exec_op()
652 WriteDOC(DOC_FLASH_CE, doc->virtadr, Mplus_FlashSelect); in doc2001plus_exec_op()
658 WriteDOC(0, doc->virtadr, Mplus_FlashSelect); in doc2001plus_exec_op()
665 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_enable_hwecc() local
666 void __iomem *docptr = doc->virtadr; in doc200x_enable_hwecc()
683 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_enable_hwecc() local
684 void __iomem *docptr = doc->virtadr; in doc2001plus_enable_hwecc()
703 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_calculate_ecc() local
704 void __iomem *docptr = doc->virtadr; in doc200x_calculate_ecc()
709 if (DoC_is_2000(doc)) { in doc200x_calculate_ecc()
710 WriteDOC(doc->CDSNControl & ~CDSN_CTRL_FLASH_IO, docptr, CDSNControl); in doc200x_calculate_ecc()
714 WriteDOC(doc->CDSNControl, docptr, CDSNControl); in doc200x_calculate_ecc()
715 } else if (DoC_is_MillenniumPlus(doc)) { in doc200x_calculate_ecc()
726 if (DoC_is_MillenniumPlus(doc)) in doc200x_calculate_ecc()
733 if (DoC_is_MillenniumPlus(doc)) in doc200x_calculate_ecc()
763 struct doc_priv *doc = nand_get_controller_data(this); in doc200x_correct_data() local
764 void __iomem *docptr = doc->virtadr; in doc200x_correct_data()
769 if (DoC_is_2000(doc)) { in doc200x_correct_data()
773 } else if (DoC_is_MillenniumPlus(doc)) { in doc200x_correct_data()
786 if (DoC_is_MillenniumPlus(doc)) in doc200x_correct_data()
792 ret = doc_ecc_decode(doc->rs_decoder, dat, calc_ecc); in doc200x_correct_data()
797 if (DoC_is_MillenniumPlus(doc)) in doc200x_correct_data()
865 struct doc_priv *doc = nand_get_controller_data(this); in find_media_headers() local
880 if (doc->mh0_page == -1) { in find_media_headers()
881 doc->mh0_page = offs >> this->page_shift; in find_media_headers()
886 doc->mh1_page = offs >> this->page_shift; in find_media_headers()
889 if (doc->mh0_page == -1) { in find_media_headers()
895 offs = doc->mh0_page << this->page_shift; in find_media_headers()
908 struct doc_priv *doc = nand_get_controller_data(this); in nftl_partscan() local
979 offs = max(doc->mh0_page, doc->mh1_page); in nftl_partscan()
1014 struct doc_priv *doc = nand_get_controller_data(this); in inftl_partscan() local
1035 doc->mh1_page = doc->mh0_page + (4096 >> this->page_shift); in inftl_partscan()
1071 blocks = doc->chips_per_floor << (this->chip_shift - this->phys_erase_shift); in inftl_partscan()
1134 struct doc_priv *doc = nand_get_controller_data(this); in nftl_scan_bbt() local
1147 this->bbt_td->pages[0] = doc->mh0_page + 1; in nftl_scan_bbt()
1148 if (doc->mh1_page != -1) { in nftl_scan_bbt()
1153 this->bbt_md->pages[0] = doc->mh1_page + 1; in nftl_scan_bbt()
1169 struct doc_priv *doc = nand_get_controller_data(this); in inftl_scan_bbt() local
1172 if (nanddev_ntargets(&this->base) > doc->chips_per_floor) { in inftl_scan_bbt()
1177 if (DoC_is_MillenniumPlus(doc)) { in inftl_scan_bbt()
1222 struct doc_priv *doc = nand_get_controller_data(this); in doc2000_init() local
1224 doc->late_init = nftl_scan_bbt; in doc2000_init()
1226 doc->CDSNControl = CDSN_CTRL_FLASH_IO | CDSN_CTRL_ECC_IO; in doc2000_init()
1229 return (4 * doc->chips_per_floor); in doc2000_init()
1235 struct doc_priv *doc = nand_get_controller_data(this); in doc2001_init() local
1237 ReadDOC(doc->virtadr, ChipID); in doc2001_init()
1238 ReadDOC(doc->virtadr, ChipID); in doc2001_init()
1239 ReadDOC(doc->virtadr, ChipID); in doc2001_init()
1240 if (ReadDOC(doc->virtadr, ChipID) != DOC_ChipID_DocMil) { in doc2001_init()
1247 doc->late_init = inftl_scan_bbt; in doc2001_init()
1248 return (4 * doc->chips_per_floor); in doc2001_init()
1251 doc->chips_per_floor = 1; in doc2001_init()
1253 doc->late_init = nftl_scan_bbt; in doc2001_init()
1261 struct doc_priv *doc = nand_get_controller_data(this); in doc2001plus_init() local
1263 doc->late_init = inftl_scan_bbt; in doc2001plus_init()
1266 doc->chips_per_floor = 1; in doc2001plus_init()
1302 struct doc_priv *doc = NULL; in doc_probe() local
1397 for (mtd = doclist; mtd; mtd = doc->nextdoc) { in doc_probe()
1401 doc = nand_get_controller_data(nand); in doc_probe()
1407 oldval = ReadDOC(doc->virtadr, Mplus_AliasResolution); in doc_probe()
1410 oldval = ReadDOC(doc->virtadr, AliasResolution); in doc_probe()
1417 oldval = ReadDOC(doc->virtadr, Mplus_AliasResolution); in doc_probe()
1421 oldval = ReadDOC(doc->virtadr, AliasResolution); in doc_probe()
1427 doc->physadr, physadr); in doc_probe()
1451 doc = (struct doc_priv *) (nand + 1); in doc_probe()
1452 doc->rs_decoder = init_rs(10, 0x409, FCR, 1, NROOTS); in doc_probe()
1453 if (!doc->rs_decoder) { in doc_probe()
1459 nand_controller_init(&doc->base); in doc_probe()
1461 doc->base.ops = &doc2001plus_ops; in doc_probe()
1463 doc->base.ops = &doc200x_ops; in doc_probe()
1466 nand->bbt_td = (struct nand_bbt_descr *) (doc + 1); in doc_probe()
1472 nand->controller = &doc->base; in doc_probe()
1473 nand_set_controller_data(nand, doc); in doc_probe()
1478 doc->physadr = physadr; in doc_probe()
1479 doc->virtadr = virtadr; in doc_probe()
1480 doc->ChipID = ChipID; in doc_probe()
1481 doc->curfloor = -1; in doc_probe()
1482 doc->curchip = -1; in doc_probe()
1483 doc->mh0_page = -1; in doc_probe()
1484 doc->mh1_page = -1; in doc_probe()
1485 doc->nextdoc = doclist; in doc_probe()
1494 if ((ret = nand_scan(nand, numchips)) || (ret = doc->late_init(mtd))) { in doc_probe()
1511 if (doc) in doc_probe()
1512 free_rs(doc->rs_decoder); in doc_probe()
1526 struct doc_priv *doc; in release_nanddoc() local
1531 doc = nand_get_controller_data(nand); in release_nanddoc()
1533 nextmtd = doc->nextdoc; in release_nanddoc()
1537 iounmap(doc->virtadr); in release_nanddoc()
1538 release_mem_region(doc->physadr, DOC_IOREMAP_LEN); in release_nanddoc()
1539 free_rs(doc->rs_decoder); in release_nanddoc()