Пример #1
0
/* This is the interrupt service routine. It handles all interrupts
 * sent to this device. Note that on CE4100, this is a shared
 * interrupt.
 */
static irqreturn_t denali_isr(int irq, void *dev_id)
{
	struct denali_nand_info *denali = dev_id;
	uint32_t irq_status = 0x0;
	irqreturn_t result = IRQ_NONE;

	spin_lock(&denali->irq_lock);

	/* check to see if a valid NAND chip has
	 * been selected.
	 */
	if (is_flash_bank_valid(denali->flash_bank)) {
		/* check to see if controller generated
		 * the interrupt, since this is a shared interrupt */
		irq_status = denali_irq_detected(denali);
		if (irq_status != 0) {
			/* handle interrupt */
			/* first acknowledge it */
			clear_interrupt(denali, irq_status);
			/* store the status in the device context for someone
			   to read */
			denali->irq_status |= irq_status;
			/* notify anyone who cares that it happened */
			complete(&denali->complete);
			/* tell the OS that we've handled this */
			result = IRQ_HANDLED;
		}
	}
	spin_unlock(&denali->irq_lock);
	return result;
}
Пример #2
0
static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask)
{
	uint32_t intr_status = 0;
	uint64_t start;

	if (!is_flash_bank_valid(denali->flash_bank)) {
		dev_dbg(denali->dev, "No valid chip selected (%d)\n",
			denali->flash_bank);
		return 0;
	}

	start = get_time_ns();

	while (!is_timeout(start, 1000 * MSECOND)) {
		intr_status = read_interrupt_status(denali);

		if (intr_status != 0)
			clear_interrupt(denali, intr_status);

		if (intr_status & irq_mask)
			return intr_status;
	}

	/* timeout */
	dev_dbg(denali->dev, "timeout occurred, status = 0x%x, mask = 0x%x\n",
		intr_status, irq_mask);

	return 0;
}
Пример #3
0
static irqreturn_t denali_isr(int irq, void *dev_id)
{
	struct denali_nand_info *denali = dev_id;
	uint32_t irq_status = 0x0;
	irqreturn_t result = IRQ_NONE;

	spin_lock(&denali->irq_lock);

	if (is_flash_bank_valid(denali->flash_bank)) {
		irq_status = denali_irq_detected(denali);
		if (irq_status != 0) {
			
			
			clear_interrupt(denali, irq_status);
			denali->irq_status |= irq_status;
			
			complete(&denali->complete);
			
			result = IRQ_HANDLED;
		}
	}
	spin_unlock(&denali->irq_lock);
	return result;
}