diff options
author | David Woodhouse <dwmw2@infradead.org> | 2006-10-30 23:30:11 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-10-30 23:30:11 -0500 |
commit | 195a253b6632e2b7e6319f2f67120e708646554e (patch) | |
tree | 7bcf7803723f5aa4dfe720d60b0784ae8086a606 /drivers/mtd/nand | |
parent | a020727b1628cb4d7b70733222253c7fa3ec6113 (diff) |
[MTD] NAND: Use register #defines throughout CAFÉ driver, not numbers
Also use cafe_readl() and cafe_writel() abstraction to make code
slightly cleaner -- especially if we want to use it in PIO mode.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/cafe.c | 118 |
1 files changed, 63 insertions, 55 deletions
diff --git a/drivers/mtd/nand/cafe.c b/drivers/mtd/nand/cafe.c index 35a868708e03..175cf82393ef 100644 --- a/drivers/mtd/nand/cafe.c +++ b/drivers/mtd/nand/cafe.c | |||
@@ -40,6 +40,11 @@ | |||
40 | #define CAFE_NAND_READ_DATA 0x1000 | 40 | #define CAFE_NAND_READ_DATA 0x1000 |
41 | #define CAFE_NAND_WRITE_DATA 0x2000 | 41 | #define CAFE_NAND_WRITE_DATA 0x2000 |
42 | 42 | ||
43 | #define CAFE_GLOBAL_CTRL 0x3004 | ||
44 | #define CAFE_GLOBAL_IRQ 0x3008 | ||
45 | #define CAFE_GLOBAL_IRQ_MASK 0x300c | ||
46 | #define CAFE_NAND_RESET 0x3034 | ||
47 | |||
43 | int cafe_correct_ecc(unsigned char *buf, | 48 | int cafe_correct_ecc(unsigned char *buf, |
44 | unsigned short *chk_syndrome_list); | 49 | unsigned short *chk_syndrome_list); |
45 | 50 | ||
@@ -76,18 +81,21 @@ module_param(slowtiming, int, 0644); | |||
76 | /* Hrm. Why isn't this already conditional on something in the struct device? */ | 81 | /* Hrm. Why isn't this already conditional on something in the struct device? */ |
77 | #define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0) | 82 | #define cafe_dev_dbg(dev, args...) do { if (debug) dev_dbg(dev, ##args); } while(0) |
78 | 83 | ||
84 | /* Make it easier to switch to PIO if we need to */ | ||
85 | #define cafe_readl(cafe, addr) readl((cafe)->mmio + CAFE_##addr) | ||
86 | #define cafe_writel(cafe, datum, addr) writel(datum, (cafe)->mmio + CAFE_##addr) | ||
79 | 87 | ||
80 | static int cafe_device_ready(struct mtd_info *mtd) | 88 | static int cafe_device_ready(struct mtd_info *mtd) |
81 | { | 89 | { |
82 | struct cafe_priv *cafe = mtd->priv; | 90 | struct cafe_priv *cafe = mtd->priv; |
83 | int result = !!(readl(cafe->mmio + CAFE_NAND_STATUS) | 0x40000000); | 91 | int result = !!(cafe_readl(cafe, NAND_STATUS) | 0x40000000); |
84 | uint32_t irqs = readl(cafe->mmio + CAFE_NAND_IRQ); | 92 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); |
85 | 93 | ||
86 | writel(irqs, cafe->mmio+CAFE_NAND_IRQ); | 94 | cafe_writel(cafe, irqs, NAND_IRQ); |
87 | 95 | ||
88 | cafe_dev_dbg(&cafe->pdev->dev, "NAND device is%s ready, IRQ %x (%x) (%x,%x)\n", | 96 | cafe_dev_dbg(&cafe->pdev->dev, "NAND device is%s ready, IRQ %x (%x) (%x,%x)\n", |
89 | result?"":" not", irqs, readl(cafe->mmio + CAFE_NAND_IRQ), | 97 | result?"":" not", irqs, cafe_readl(cafe, NAND_IRQ), |
90 | readl(cafe->mmio + 0x3008), readl(cafe->mmio + 0x300c)); | 98 | cafe_readl(cafe, GLOBAL_IRQ), cafe_readl(cafe, GLOBAL_IRQ_MASK)); |
91 | 99 | ||
92 | return result; | 100 | return result; |
93 | } | 101 | } |
@@ -146,14 +154,14 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
146 | 154 | ||
147 | if (command == NAND_CMD_ERASE2 || command == NAND_CMD_PAGEPROG) { | 155 | if (command == NAND_CMD_ERASE2 || command == NAND_CMD_PAGEPROG) { |
148 | /* Second half of a command we already calculated */ | 156 | /* Second half of a command we already calculated */ |
149 | writel(cafe->ctl2 | 0x100 | command, cafe->mmio + CAFE_NAND_CTRL2); | 157 | cafe_writel(cafe, cafe->ctl2 | 0x100 | command, NAND_CTRL2); |
150 | ctl1 = cafe->ctl1; | 158 | ctl1 = cafe->ctl1; |
151 | cafe_dev_dbg(&cafe->pdev->dev, "Continue command, ctl1 %08x, #data %d\n", | 159 | cafe_dev_dbg(&cafe->pdev->dev, "Continue command, ctl1 %08x, #data %d\n", |
152 | cafe->ctl1, cafe->nr_data); | 160 | cafe->ctl1, cafe->nr_data); |
153 | goto do_command; | 161 | goto do_command; |
154 | } | 162 | } |
155 | /* Reset ECC engine */ | 163 | /* Reset ECC engine */ |
156 | writel(0, cafe->mmio + CAFE_NAND_CTRL2); | 164 | cafe_writel(cafe, 0, NAND_CTRL2); |
157 | 165 | ||
158 | /* Emulate NAND_CMD_READOOB on large-page chips */ | 166 | /* Emulate NAND_CMD_READOOB on large-page chips */ |
159 | if (mtd->writesize > 512 && | 167 | if (mtd->writesize > 512 && |
@@ -166,15 +174,15 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
166 | for small-page chips, to position the buffer correctly? */ | 174 | for small-page chips, to position the buffer correctly? */ |
167 | 175 | ||
168 | if (column != -1) { | 176 | if (column != -1) { |
169 | writel(column, cafe->mmio + CAFE_NAND_ADDR1); | 177 | cafe_writel(cafe, column, NAND_ADDR1); |
170 | adrbytes = 2; | 178 | adrbytes = 2; |
171 | if (page_addr != -1) | 179 | if (page_addr != -1) |
172 | goto write_adr2; | 180 | goto write_adr2; |
173 | } else if (page_addr != -1) { | 181 | } else if (page_addr != -1) { |
174 | writel(page_addr & 0xffff, cafe->mmio + CAFE_NAND_ADDR1); | 182 | cafe_writel(cafe, page_addr & 0xffff, NAND_ADDR1); |
175 | page_addr >>= 16; | 183 | page_addr >>= 16; |
176 | write_adr2: | 184 | write_adr2: |
177 | writel(page_addr, cafe->mmio+0x20); | 185 | cafe_writel(cafe, page_addr, NAND_ADDR2); |
178 | adrbytes += 2; | 186 | adrbytes += 2; |
179 | if (mtd->size > mtd->writesize << 16) | 187 | if (mtd->size > mtd->writesize << 16) |
180 | adrbytes++; | 188 | adrbytes++; |
@@ -215,9 +223,9 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
215 | } | 223 | } |
216 | /* RNDOUT and READ0 commands need a following byte */ | 224 | /* RNDOUT and READ0 commands need a following byte */ |
217 | if (command == NAND_CMD_RNDOUT) | 225 | if (command == NAND_CMD_RNDOUT) |
218 | writel(cafe->ctl2 | 0x100 | NAND_CMD_RNDOUTSTART, cafe->mmio + CAFE_NAND_CTRL2); | 226 | cafe_writel(cafe, cafe->ctl2 | 0x100 | NAND_CMD_RNDOUTSTART, NAND_CTRL2); |
219 | else if (command == NAND_CMD_READ0 && mtd->writesize > 512) | 227 | else if (command == NAND_CMD_READ0 && mtd->writesize > 512) |
220 | writel(cafe->ctl2 | 0x100 | NAND_CMD_READSTART, cafe->mmio + CAFE_NAND_CTRL2); | 228 | cafe_writel(cafe, cafe->ctl2 | 0x100 | NAND_CMD_READSTART, NAND_CTRL2); |
221 | 229 | ||
222 | do_command: | 230 | do_command: |
223 | #if 0 | 231 | #if 0 |
@@ -227,11 +235,11 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
227 | cafe->datalen = 2062; | 235 | cafe->datalen = 2062; |
228 | #endif | 236 | #endif |
229 | cafe_dev_dbg(&cafe->pdev->dev, "dlen %x, ctl1 %x, ctl2 %x\n", | 237 | cafe_dev_dbg(&cafe->pdev->dev, "dlen %x, ctl1 %x, ctl2 %x\n", |
230 | cafe->datalen, ctl1, readl(cafe->mmio+CAFE_NAND_CTRL2)); | 238 | cafe->datalen, ctl1, cafe_readl(cafe, NAND_CTRL2)); |
231 | 239 | ||
232 | /* NB: The datasheet lies -- we really should be subtracting 1 here */ | 240 | /* NB: The datasheet lies -- we really should be subtracting 1 here */ |
233 | writel(cafe->datalen, cafe->mmio + CAFE_NAND_DATA_LEN); | 241 | cafe_writel(cafe, cafe->datalen, NAND_DATA_LEN); |
234 | writel(0x90000000, cafe->mmio + CAFE_NAND_IRQ); | 242 | cafe_writel(cafe, 0x90000000, NAND_IRQ); |
235 | if (usedma && (ctl1 & (3<<25))) { | 243 | if (usedma && (ctl1 & (3<<25))) { |
236 | uint32_t dmactl = 0xc0000000 + cafe->datalen; | 244 | uint32_t dmactl = 0xc0000000 + cafe->datalen; |
237 | /* If WR or RD bits set, set up DMA */ | 245 | /* If WR or RD bits set, set up DMA */ |
@@ -242,7 +250,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
242 | the command. */ | 250 | the command. */ |
243 | doneint = 0x10000000; | 251 | doneint = 0x10000000; |
244 | } | 252 | } |
245 | writel(dmactl, cafe->mmio + CAFE_NAND_DMA_CTRL); | 253 | cafe_writel(cafe, dmactl, NAND_DMA_CTRL); |
246 | } | 254 | } |
247 | cafe->datalen = 0; | 255 | cafe->datalen = 0; |
248 | 256 | ||
@@ -253,7 +261,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
253 | printk("Register %x: %08x\n", i, readl(cafe->mmio + i)); | 261 | printk("Register %x: %08x\n", i, readl(cafe->mmio + i)); |
254 | } | 262 | } |
255 | #endif | 263 | #endif |
256 | writel(ctl1, cafe->mmio + CAFE_NAND_CTRL1); | 264 | cafe_writel(cafe, ctl1, NAND_CTRL1); |
257 | /* Apply this short delay always to ensure that we do wait tWB in | 265 | /* Apply this short delay always to ensure that we do wait tWB in |
258 | * any case on any machine. */ | 266 | * any case on any machine. */ |
259 | ndelay(100); | 267 | ndelay(100); |
@@ -263,7 +271,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
263 | uint32_t irqs; | 271 | uint32_t irqs; |
264 | 272 | ||
265 | while (c--) { | 273 | while (c--) { |
266 | irqs = readl(cafe->mmio + CAFE_NAND_IRQ); | 274 | irqs = cafe_readl(cafe, NAND_IRQ); |
267 | if (irqs & doneint) | 275 | if (irqs & doneint) |
268 | break; | 276 | break; |
269 | udelay(1); | 277 | udelay(1); |
@@ -271,9 +279,9 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
271 | cafe_dev_dbg(&cafe->pdev->dev, "Wait for ready, IRQ %x\n", irqs); | 279 | cafe_dev_dbg(&cafe->pdev->dev, "Wait for ready, IRQ %x\n", irqs); |
272 | cpu_relax(); | 280 | cpu_relax(); |
273 | } | 281 | } |
274 | writel(doneint, cafe->mmio + CAFE_NAND_IRQ); | 282 | cafe_writel(cafe, doneint, NAND_IRQ); |
275 | cafe_dev_dbg(&cafe->pdev->dev, "Command %x completed after %d usec, irqs %x (%x)\n", | 283 | cafe_dev_dbg(&cafe->pdev->dev, "Command %x completed after %d usec, irqs %x (%x)\n", |
276 | command, 500000-c, irqs, readl(cafe->mmio + CAFE_NAND_IRQ)); | 284 | command, 500000-c, irqs, cafe_readl(cafe, NAND_IRQ)); |
277 | } | 285 | } |
278 | 286 | ||
279 | 287 | ||
@@ -296,11 +304,11 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command, | |||
296 | case NAND_CMD_STATUS_ERROR1: | 304 | case NAND_CMD_STATUS_ERROR1: |
297 | case NAND_CMD_STATUS_ERROR2: | 305 | case NAND_CMD_STATUS_ERROR2: |
298 | case NAND_CMD_STATUS_ERROR3: | 306 | case NAND_CMD_STATUS_ERROR3: |
299 | writel(cafe->ctl2, cafe->mmio + CAFE_NAND_CTRL2); | 307 | cafe_writel(cafe, cafe->ctl2, NAND_CTRL2); |
300 | return; | 308 | return; |
301 | } | 309 | } |
302 | nand_wait_ready(mtd); | 310 | nand_wait_ready(mtd); |
303 | writel(cafe->ctl2, cafe->mmio + CAFE_NAND_CTRL2); | 311 | cafe_writel(cafe, cafe->ctl2, NAND_CTRL2); |
304 | } | 312 | } |
305 | 313 | ||
306 | static void cafe_select_chip(struct mtd_info *mtd, int chipnr) | 314 | static void cafe_select_chip(struct mtd_info *mtd, int chipnr) |
@@ -313,12 +321,12 @@ static int cafe_nand_interrupt(int irq, void *id, struct pt_regs *regs) | |||
313 | { | 321 | { |
314 | struct mtd_info *mtd = id; | 322 | struct mtd_info *mtd = id; |
315 | struct cafe_priv *cafe = mtd->priv; | 323 | struct cafe_priv *cafe = mtd->priv; |
316 | uint32_t irqs = readl(cafe->mmio + CAFE_NAND_IRQ); | 324 | uint32_t irqs = cafe_readl(cafe, NAND_IRQ); |
317 | writel(irqs & ~0x90000000, cafe->mmio + CAFE_NAND_IRQ); | 325 | cafe_writel(cafe, irqs & ~0x90000000, NAND_IRQ); |
318 | if (!irqs) | 326 | if (!irqs) |
319 | return IRQ_NONE; | 327 | return IRQ_NONE; |
320 | 328 | ||
321 | cafe_dev_dbg(&cafe->pdev->dev, "irq, bits %x (%x)\n", irqs, readl(cafe->mmio + CAFE_NAND_IRQ)); | 329 | cafe_dev_dbg(&cafe->pdev->dev, "irq, bits %x (%x)\n", irqs, cafe_readl(cafe, NAND_IRQ)); |
322 | return IRQ_HANDLED; | 330 | return IRQ_HANDLED; |
323 | } | 331 | } |
324 | 332 | ||
@@ -363,18 +371,18 @@ static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, | |||
363 | struct cafe_priv *cafe = mtd->priv; | 371 | struct cafe_priv *cafe = mtd->priv; |
364 | 372 | ||
365 | cafe_dev_dbg(&cafe->pdev->dev, "ECC result %08x SYN1,2 %08x\n", | 373 | cafe_dev_dbg(&cafe->pdev->dev, "ECC result %08x SYN1,2 %08x\n", |
366 | readl(cafe->mmio + CAFE_NAND_ECC_RESULT), | 374 | cafe_readl(cafe, NAND_ECC_RESULT), |
367 | readl(cafe->mmio + CAFE_NAND_ECC_SYN01)); | 375 | cafe_readl(cafe, NAND_ECC_SYN01)); |
368 | 376 | ||
369 | chip->read_buf(mtd, buf, mtd->writesize); | 377 | chip->read_buf(mtd, buf, mtd->writesize); |
370 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); | 378 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); |
371 | 379 | ||
372 | if (checkecc && readl(cafe->mmio + CAFE_NAND_ECC_RESULT) & (1<<18)) { | 380 | if (checkecc && cafe_readl(cafe, NAND_ECC_RESULT) & (1<<18)) { |
373 | unsigned short syn[8]; | 381 | unsigned short syn[8]; |
374 | int i; | 382 | int i; |
375 | 383 | ||
376 | for (i=0; i<8; i+=2) { | 384 | for (i=0; i<8; i+=2) { |
377 | uint32_t tmp = readl(cafe->mmio + CAFE_NAND_ECC_SYN01 + (i*2)); | 385 | uint32_t tmp = cafe_readl(cafe, NAND_ECC_SYN01 + (i*2)); |
378 | syn[i] = tmp & 0xfff; | 386 | syn[i] = tmp & 0xfff; |
379 | syn[i+1] = (tmp >> 16) & 0xfff; | 387 | syn[i+1] = (tmp >> 16) & 0xfff; |
380 | } | 388 | } |
@@ -577,22 +585,22 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, | |||
577 | } | 585 | } |
578 | 586 | ||
579 | /* Start off by resetting the NAND controller completely */ | 587 | /* Start off by resetting the NAND controller completely */ |
580 | writel(1, cafe->mmio + 0x3034); | 588 | cafe_writel(cafe, 1, NAND_RESET); |
581 | writel(0, cafe->mmio + 0x3034); | 589 | cafe_writel(cafe, 0, NAND_RESET); |
582 | 590 | ||
583 | /* Timings from Marvell's test code (not verified or calculated by us) */ | 591 | cafe_writel(cafe, 0xffffffff, NAND_IRQ_MASK); |
584 | writel(0xffffffff, cafe->mmio + CAFE_NAND_IRQ_MASK); | ||
585 | 592 | ||
593 | /* Timings from Marvell's test code (not verified or calculated by us) */ | ||
586 | if (!slowtiming) { | 594 | if (!slowtiming) { |
587 | writel(0x01010a0a, cafe->mmio + CAFE_NAND_TIMING1); | 595 | cafe_writel(cafe, 0x01010a0a, NAND_TIMING1); |
588 | writel(0x24121212, cafe->mmio + CAFE_NAND_TIMING2); | 596 | cafe_writel(cafe, 0x24121212, NAND_TIMING2); |
589 | writel(0x11000000, cafe->mmio + CAFE_NAND_TIMING3); | 597 | cafe_writel(cafe, 0x11000000, NAND_TIMING3); |
590 | } else { | 598 | } else { |
591 | writel(0xffffffff, cafe->mmio + CAFE_NAND_TIMING1); | 599 | cafe_writel(cafe, 0xffffffff, NAND_TIMING1); |
592 | writel(0xffffffff, cafe->mmio + CAFE_NAND_TIMING2); | 600 | cafe_writel(cafe, 0xffffffff, NAND_TIMING2); |
593 | writel(0xffffffff, cafe->mmio + CAFE_NAND_TIMING3); | 601 | cafe_writel(cafe, 0xffffffff, NAND_TIMING3); |
594 | } | 602 | } |
595 | writel(0xffffffff, cafe->mmio + CAFE_NAND_IRQ_MASK); | 603 | cafe_writel(cafe, 0xffffffff, NAND_IRQ_MASK); |
596 | err = request_irq(pdev->irq, &cafe_nand_interrupt, SA_SHIRQ, "CAFE NAND", mtd); | 604 | err = request_irq(pdev->irq, &cafe_nand_interrupt, SA_SHIRQ, "CAFE NAND", mtd); |
597 | if (err) { | 605 | if (err) { |
598 | dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); | 606 | dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); |
@@ -601,31 +609,31 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, | |||
601 | } | 609 | } |
602 | #if 1 | 610 | #if 1 |
603 | /* Disable master reset, enable NAND clock */ | 611 | /* Disable master reset, enable NAND clock */ |
604 | ctrl = readl(cafe->mmio + 0x3004); | 612 | ctrl = cafe_readl(cafe, GLOBAL_CTRL); |
605 | ctrl &= 0xffffeff0; | 613 | ctrl &= 0xffffeff0; |
606 | ctrl |= 0x00007000; | 614 | ctrl |= 0x00007000; |
607 | writel(ctrl | 0x05, cafe->mmio + 0x3004); | 615 | cafe_writel(cafe, ctrl | 0x05, GLOBAL_CTRL); |
608 | writel(ctrl | 0x0a, cafe->mmio + 0x3004); | 616 | cafe_writel(cafe, ctrl | 0x0a, GLOBAL_CTRL); |
609 | writel(0, cafe->mmio + CAFE_NAND_DMA_CTRL); | 617 | cafe_writel(cafe, 0, NAND_DMA_CTRL); |
610 | 618 | ||
611 | writel(0x7006, cafe->mmio + 0x3004); | 619 | cafe_writel(cafe, 0x7006, GLOBAL_CTRL); |
612 | writel(0x700a, cafe->mmio + 0x3004); | 620 | cafe_writel(cafe, 0x700a, GLOBAL_CTRL); |
613 | 621 | ||
614 | /* Set up DMA address */ | 622 | /* Set up DMA address */ |
615 | writel(cafe->dmaaddr & 0xffffffff, cafe->mmio + CAFE_NAND_DMA_ADDR0); | 623 | cafe_writel(cafe, cafe->dmaaddr & 0xffffffff, NAND_DMA_ADDR0); |
616 | if (sizeof(cafe->dmaaddr) > 4) | 624 | if (sizeof(cafe->dmaaddr) > 4) |
617 | /* Shift in two parts to shut the compiler up */ | 625 | /* Shift in two parts to shut the compiler up */ |
618 | writel((cafe->dmaaddr >> 16) >> 16, cafe->mmio + CAFE_NAND_DMA_ADDR1); | 626 | cafe_writel(cafe, (cafe->dmaaddr >> 16) >> 16, NAND_DMA_ADDR1); |
619 | else | 627 | else |
620 | writel(0, cafe->mmio + CAFE_NAND_DMA_ADDR1); | 628 | cafe_writel(cafe, 0, NAND_DMA_ADDR1); |
621 | 629 | ||
622 | cafe_dev_dbg(&cafe->pdev->dev, "Set DMA address to %x (virt %p)\n", | 630 | cafe_dev_dbg(&cafe->pdev->dev, "Set DMA address to %x (virt %p)\n", |
623 | readl(cafe->mmio + CAFE_NAND_DMA_ADDR0), cafe->dmabuf); | 631 | cafe_readl(cafe, NAND_DMA_ADDR0), cafe->dmabuf); |
624 | 632 | ||
625 | /* Enable NAND IRQ in global IRQ mask register */ | 633 | /* Enable NAND IRQ in global IRQ mask register */ |
626 | writel(0x80000007, cafe->mmio + 0x300c); | 634 | cafe_writel(cafe, 0x80000007, GLOBAL_IRQ_MASK); |
627 | cafe_dev_dbg(&cafe->pdev->dev, "Control %x, IRQ mask %x\n", | 635 | cafe_dev_dbg(&cafe->pdev->dev, "Control %x, IRQ mask %x\n", |
628 | readl(cafe->mmio + 0x3004), readl(cafe->mmio + 0x300c)); | 636 | cafe_readl(cafe, GLOBAL_CTRL), cafe_readl(cafe, GLOBAL_IRQ_MASK)); |
629 | #endif | 637 | #endif |
630 | #if 1 | 638 | #if 1 |
631 | mtd->writesize=2048; | 639 | mtd->writesize=2048; |
@@ -649,7 +657,7 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, | |||
649 | #if 0 | 657 | #if 0 |
650 | writel(0x84600070, cafe->mmio); | 658 | writel(0x84600070, cafe->mmio); |
651 | udelay(10); | 659 | udelay(10); |
652 | cafe_dev_dbg(&cafe->pdev->dev, "Status %x\n", readl(cafe->mmio + 0x30)); | 660 | cafe_dev_dbg(&cafe->pdev->dev, "Status %x\n", cafe_readl(cafe, NAND_NONMEM)); |
653 | #endif | 661 | #endif |
654 | /* Scan to find existance of the device */ | 662 | /* Scan to find existance of the device */ |
655 | if (nand_scan_ident(mtd, 1)) { | 663 | if (nand_scan_ident(mtd, 1)) { |
@@ -697,7 +705,7 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, | |||
697 | 705 | ||
698 | out_irq: | 706 | out_irq: |
699 | /* Disable NAND IRQ in global IRQ mask register */ | 707 | /* Disable NAND IRQ in global IRQ mask register */ |
700 | writel(~1 & readl(cafe->mmio + 0x300c), cafe->mmio + 0x300c); | 708 | cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); |
701 | free_irq(pdev->irq, mtd); | 709 | free_irq(pdev->irq, mtd); |
702 | out_free_dma: | 710 | out_free_dma: |
703 | dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr); | 711 | dma_free_coherent(&cafe->pdev->dev, 2112, cafe->dmabuf, cafe->dmaaddr); |
@@ -716,7 +724,7 @@ static void __devexit cafe_nand_remove(struct pci_dev *pdev) | |||
716 | 724 | ||
717 | del_mtd_device(mtd); | 725 | del_mtd_device(mtd); |
718 | /* Disable NAND IRQ in global IRQ mask register */ | 726 | /* Disable NAND IRQ in global IRQ mask register */ |
719 | writel(~1 & readl(cafe->mmio + 0x300c), cafe->mmio + 0x300c); | 727 | cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); |
720 | free_irq(pdev->irq, mtd); | 728 | free_irq(pdev->irq, mtd); |
721 | nand_release(mtd); | 729 | nand_release(mtd); |
722 | pci_iounmap(pdev, cafe->mmio); | 730 | pci_iounmap(pdev, cafe->mmio); |