return 0;
}
-#if 0
-static void ipu_irq_handler(unsigned int irq, struct irq_desc *desc)
-{
- struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
- const int int_reg[] = { 1, 2, 3, 4, 11, 12, 13, 14, 15, 0 };
- u32 status;
- int i, line;
-
- for (i = 0;; i++) {
- if (int_reg[i] == 0)
- break;
-
- status = ipu_cm_read(ipu, IPU_INT_STAT(int_reg[i]));
- status &= ipu_cm_read(ipu, IPU_INT_CTRL(int_reg[i]));
-
- while ((line = ffs(status))) {
- line--;
- status &= ~(1UL << line);
- line += ipu->irq_start + (int_reg[i] - 1) * 32;
- generic_handle_irq(line);
- }
-
- }
-}
-
-static void ipu_err_irq_handler(unsigned int irq, struct irq_desc *desc)
-{
- struct ipu_soc *ipu = irq_desc_get_handler_data(desc);
- const int int_reg[] = { 5, 6, 9, 10, 0 };
- u32 status;
- int i, line;
-
- for (i = 0;; i++) {
- if (int_reg[i] == 0)
- break;
-
- status = ipu_cm_read(ipu, IPU_INT_STAT(int_reg[i]));
- status &= ipu_cm_read(ipu, IPU_INT_CTRL(int_reg[i]));
-
- while ((line = ffs(status))) {
- line--;
- status &= ~(1UL << line);
- line += ipu->irq_start + (int_reg[i] - 1) * 32;
- generic_handle_irq(line);
- }
-
- }
-}
-
-static void ipu_ack_irq(struct irq_data *d)
-{
- struct ipu_soc *ipu = irq_data_get_irq_chip_data(d);
- unsigned int irq = d->irq - ipu->irq_start;
- unsigned long flags;
-
- spin_lock_irqsave(&ipu->ipu_lock, flags);
- ipu_cm_write(ipu, 1 << (irq % 32), IPU_INT_STAT(irq / 32 + 1));
- spin_unlock_irqrestore(&ipu->ipu_lock, flags);
-}
-
-static void ipu_unmask_irq(struct irq_data *d)
-{
- struct ipu_soc *ipu = irq_data_get_irq_chip_data(d);
- unsigned int irq = d->irq - ipu->irq_start;
- unsigned long flags;
- u32 reg;
-
- spin_lock_irqsave(&ipu->ipu_lock, flags);
- reg = ipu_cm_read(ipu, IPU_INT_CTRL(irq / 32 + 1));
- reg |= 1 << (irq % 32);
- ipu_cm_write(ipu, reg, IPU_INT_CTRL(irq / 32 + 1));
- spin_unlock_irqrestore(&ipu->ipu_lock, flags);
-}
-
-static void ipu_mask_irq(struct irq_data *d)
-{
- struct ipu_soc *ipu = irq_data_get_irq_chip_data(d);
- unsigned int irq = d->irq - ipu->irq_start;
- unsigned long flags;
- u32 reg;
-
- spin_lock_irqsave(&ipu->ipu_lock, flags);
- reg = ipu_cm_read(ipu, IPU_INT_CTRL(irq / 32 + 1));
- reg &= ~(1 << (irq % 32));
- ipu_cm_write(ipu, reg, IPU_INT_CTRL(irq / 32 + 1));
- spin_unlock_irqrestore(&ipu->ipu_lock, flags);
-}
-
-static struct irq_chip ipu_irq_chip = {
- .name = "IPU",
- .irq_ack = ipu_ack_irq,
- .irq_mask = ipu_mask_irq,
- .irq_unmask = ipu_unmask_irq,
-};
-
-static void __devinit ipu_irq_setup(struct ipu_soc *ipu)
-{
- int i;
-
- for (i = ipu->irq_start; i < ipu->irq_start + MX5_IPU_IRQS; i++) {
- irq_set_chip_and_handler(i, &ipu_irq_chip, handle_level_irq);
- set_irq_flags(i, IRQF_VALID);
- irq_set_chip_data(i, ipu);
- }
-
- irq_set_chained_handler(ipu->irq_sync, ipu_irq_handler);
- irq_set_handler_data(ipu->irq_sync, ipu);
- irq_set_chained_handler(ipu->irq_err, ipu_err_irq_handler);
- irq_set_handler_data(ipu->irq_err, ipu);
-}
-
-int ipu_request_irq(struct ipu_soc *ipu, unsigned int irq,
- irq_handler_t handler, unsigned long flags,
- const char *name, void *dev)
-{
- return request_irq(ipu->irq_start + irq, handler, flags, name, dev);
-}
-EXPORT_SYMBOL_GPL(ipu_request_irq);
-
-void ipu_enable_irq(struct ipu_soc *ipu, unsigned int irq)
-{
- return enable_irq(ipu->irq_start + irq);
-}
-EXPORT_SYMBOL_GPL(ipu_disable_irq);
-
-void ipu_disable_irq(struct ipu_soc *ipu, unsigned int irq)
-{
- return disable_irq(ipu->irq_start + irq);
-}
-EXPORT_SYMBOL_GPL(ipu_disable_irq);
-
-void ipu_free_irq(struct ipu_soc *ipu, unsigned int irq, void *dev_id)
-{
- free_irq(ipu->irq_start + irq, dev_id);
-}
-EXPORT_SYMBOL_GPL(ipu_free_irq);
-
-static irqreturn_t ipu_completion_handler(int irq, void *dev)
-{
- struct completion *completion = dev;
-
- complete(completion);
- return IRQ_HANDLED;
-}
-
-int ipu_wait_for_interrupt(struct ipu_soc *ipu, int interrupt, int timeout_ms)
-{
- DECLARE_COMPLETION_ONSTACK(completion);
- int ret;
-
- ret = ipu_request_irq(ipu, interrupt, ipu_completion_handler,
- 0, NULL, &completion);
- if (ret) {
- dev_err(ipu->dev,
- "ipu request irq %d fail\n", interrupt);
- return ret;
- }
-
- ret = wait_for_completion_timeout(&completion,
- msecs_to_jiffies(timeout_ms));
-
- ipu_free_irq(ipu, interrupt, &completion);
-
- return ret > 0 ? 0 : -ETIMEDOUT;
-}
-EXPORT_SYMBOL_GPL(ipu_wait_for_interrupt);
-#endif
-
struct ipu_soc *ipu_get_soc(int id)
{
if (id >= MXC_IPU_MAX_NUM)