Lines Matching defs:doc
30 #define DoC_is_2000(doc) (doc->ChipID == DOC_ChipID_Doc2k)
32 #define DoC_is_2000(doc) (0)
36 #define DoC_is_Millennium(doc) (doc->ChipID == DOC_ChipID_DocMil)
38 #define DoC_is_Millennium(doc) (0)
65 static void DoC_Delay(struct DiskOnChip *doc, unsigned short cycles)
71 if (DoC_is_Millennium(doc))
72 dummy = ReadDOC(doc->virtadr, NOP);
74 dummy = ReadDOC(doc->virtadr, DOCStatus);
80 static int _DoC_WaitReady(struct DiskOnChip *doc)
82 void __iomem *docptr = doc->virtadr;
92 DoC_Delay(doc, 2);
105 static inline int DoC_WaitReady(struct DiskOnChip *doc)
107 void __iomem *docptr = doc->virtadr;
114 DoC_Delay(doc, 4);
118 ret = _DoC_WaitReady(doc);
122 DoC_Delay(doc, 2);
131 static int DoC_Command(struct DiskOnChip *doc, unsigned char command,
134 void __iomem *docptr = doc->virtadr;
136 if (DoC_is_2000(doc))
141 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
143 if (DoC_is_Millennium(doc))
147 WriteDOC_(command, docptr, doc->ioreg);
148 if (DoC_is_Millennium(doc))
153 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
156 return DoC_WaitReady(doc);
163 static int DoC_Address(struct DiskOnChip *doc, int numbytes, unsigned long ofs,
167 void __iomem *docptr = doc->virtadr;
169 if (DoC_is_2000(doc))
175 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
190 if (DoC_is_Millennium(doc))
192 WriteDOC_(ofs & 0xff, docptr, doc->ioreg);
195 if (doc->page256) {
202 for (i = 0; i < doc->pageadrlen; i++, ofs = ofs >> 8) {
203 if (DoC_is_Millennium(doc))
205 WriteDOC_(ofs & 0xff, docptr, doc->ioreg);
209 if (DoC_is_Millennium(doc))
212 DoC_Delay(doc, 2); /* Needed for some slow flash chips. mf. */
219 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
222 return DoC_WaitReady(doc);
226 static void DoC_ReadBuf(struct DiskOnChip *doc, u_char * buf, int len)
230 void __iomem *docptr = doc->virtadr;
236 if (DoC_is_Millennium(doc)) {
249 buf[i] = ReadDOC_(docptr, doc->ioreg + (i & modulus));
251 if (DoC_is_Millennium(doc)) {
257 static void DoC_WriteBuf(struct DiskOnChip *doc, const u_char * buf, int len)
259 void __iomem *docptr = doc->virtadr;
266 WriteDOC_(buf[i], docptr, doc->ioreg + i);
268 if (DoC_is_Millennium(doc)) {
276 static inline int DoC_SelectChip(struct DiskOnChip *doc, int chip)
278 void __iomem *docptr = doc->virtadr;
283 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
287 DoC_Delay(doc, 4);
292 DoC_Delay(doc, 4); /* Software requirement 11.4.3 for Millennium */
295 return DoC_WaitReady(doc);
300 static inline int DoC_SelectFloor(struct DiskOnChip *doc, int floor)
302 void __iomem *docptr = doc->virtadr;
308 return DoC_WaitReady(doc);
313 static int DoC_IdentChip(struct DiskOnChip *doc, int floor, int chip)
319 DoC_SelectFloor(doc, floor);
320 DoC_SelectChip(doc, chip);
323 if (DoC_Command(doc, NAND_CMD_RESET, CDSN_CTRL_WP)) {
332 if (DoC_Command(doc, NAND_CMD_READID, CDSN_CTRL_WP)) {
340 DoC_Address(doc, ADDR_COLUMN, 0, CDSN_CTRL_WP, 0);
344 if (DoC_is_Millennium(doc)) {
345 DoC_Delay(doc, 2);
346 dummy = ReadDOC(doc->virtadr, ReadPipeInit);
347 mfr = ReadDOC(doc->virtadr, LastDataRead);
349 DoC_Delay(doc, 2);
350 dummy = ReadDOC(doc->virtadr, ReadPipeInit);
351 id = ReadDOC(doc->virtadr, LastDataRead);
354 dummy = ReadDOC(doc->virtadr, CDSNSlowIO);
355 DoC_Delay(doc, 2);
356 mfr = ReadDOC_(doc->virtadr, doc->ioreg);
359 dummy = ReadDOC(doc->virtadr, CDSNSlowIO);
360 DoC_Delay(doc, 2);
361 id = ReadDOC_(doc->virtadr, doc->ioreg);
372 if (doc->mfr) {
373 if (doc->mfr == mfr && doc->id == id)
393 if (!doc->mfr) {
394 doc->mfr = mfr;
395 doc->id = id;
396 doc->chipshift =
398 doc->page256 = (nand_flash_ids[i].pagesize == 256) ? 1 : 0;
399 doc->pageadrlen = doc->chipshift > 25 ? 3 : 2;
400 doc->erasesize =