/* Reset the flash controller */ static uint16_t denali_nand_reset(struct denali_nand_info *denali) { uint32_t i; dev_dbg(denali->dev, "%s, Line %d, Function: %s\n", __FILE__, __LINE__, __func__); for (i = 0 ; i < denali->max_banks; i++) iowrite32(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); for (i = 0 ; i < denali->max_banks; i++) { iowrite32(1 << i, denali->flash_reg + DEVICE_RESET); while (!(ioread32(denali->flash_reg + INTR_STATUS(i)) & (INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT))) cpu_relax(); if (ioread32(denali->flash_reg + INTR_STATUS(i)) & INTR_STATUS__TIME_OUT) dev_dbg(denali->dev, "NAND Reset operation timed out on bank %d\n", i); } for (i = 0; i < denali->max_banks; i++) iowrite32(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); return PASS; }
/* Reset the flash controller */ static uint16_t denali_nand_reset(struct denali_nand_info *denali) { int i; for (i = 0; i < denali->max_banks; i++) iowrite32(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); for (i = 0; i < denali->max_banks; i++) { iowrite32(1 << i, denali->flash_reg + DEVICE_RESET); while (!(ioread32(denali->flash_reg + INTR_STATUS(i)) & (INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT))) /* cpu_relax(); */ barrier(); if (ioread32(denali->flash_reg + INTR_STATUS(i)) & INTR_STATUS__TIME_OUT) dev_dbg(denali->dev, "NAND Reset operation timed out on bank %d\n", i); } for (i = 0; i < denali->max_banks; i++) iowrite32(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); return PASS; }
static int wait_for_irq(uint32_t irq_mask) { unsigned long timeout = 1000000; uint32_t intr_status; do { intr_status = readl(denali_flash_reg + INTR_STATUS(flash_bank)); if (intr_status & INTR_STATUS__ECC_UNCOR_ERR) { debug("Uncorrected ECC detected\n"); return -EBADMSG; } if (intr_status & irq_mask) break; udelay(1); timeout--; } while (timeout); if (!timeout) { debug("Timeout with interrupt status %08x\n", intr_status); return -EIO; } return 0; }
static uint32_t read_interrupt_status(struct denali_nand_info *denali) { uint32_t intr_status_reg = 0; intr_status_reg = INTR_STATUS(denali->flash_bank); return ioread32(denali->flash_reg + intr_status_reg); }
/* Interrupts are cleared by writing a 1 to the appropriate status bit */ static inline void clear_interrupt(struct denali_nand_info *denali, uint32_t irq_mask) { uint32_t intr_status_reg = 0; intr_status_reg = INTR_STATUS(denali->flash_bank); iowrite32(irq_mask, denali->flash_reg + intr_status_reg); }
/* Reset the flash controller */ static uint32_t denali_nand_reset(struct denali_nand_info *denali) { int i; for (i = 0; i < denali->max_banks; i++) writel(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); for (i = 0; i < denali->max_banks; i++) { writel(1 << i, denali->flash_reg + DEVICE_RESET); while (!(readl(denali->flash_reg + INTR_STATUS(i)) & (INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT))) if (readl(denali->flash_reg + INTR_STATUS(i)) & INTR_STATUS__TIME_OUT) debug("NAND Reset operation timed out on bank" " %d\n", i); } for (i = 0; i < denali->max_banks; i++) writel(INTR_STATUS__RST_COMP | INTR_STATUS__TIME_OUT, denali->flash_reg + INTR_STATUS(i)); return 0; }
static void denali_irq_init(struct denali_nand_info *denali) { uint32_t int_mask = 0; int i; /* Disable global interrupts */ denali_set_intr_modes(denali, false); int_mask = DENALI_IRQ_ALL; /* Clear all status bits */ for (i = 0; i < denali->max_banks; ++i) iowrite32(0xFFFF, denali->flash_reg + INTR_STATUS(i)); denali_irq_enable(denali, int_mask); }
static void denali_irq_init(struct denali_nand_info *denali) { uint32_t int_mask; int i; /* Disable global interrupts */ writel(0, denali->flash_reg + GLOBAL_INT_ENABLE); int_mask = DENALI_IRQ_ALL; /* Clear all status bits */ for (i = 0; i < denali->max_banks; ++i) writel(0xFFFF, denali->flash_reg + INTR_STATUS(i)); denali_irq_enable(denali, int_mask); }