From 78dc41022e4c1d6428e65a9f2c2f4f7c15143c34 Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Fri, 4 Aug 2017 14:33:37 +0100 Subject: [PATCH] irqchip: madera: Add handler for BOOT_DONE interrupt This gives a place to hang a debug log that can be enabled for debugging boots. Change-Id: I02333ba0c0a9018e93cd3bd97367ea9fafb6afce Signed-off-by: Richard Fitzgerald --- drivers/irqchip/irq-madera.c | 26 +++++++++++++++++++++----- include/linux/irqchip/irq-madera.h | 3 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/irq-madera.c b/drivers/irqchip/irq-madera.c index d80c459cddd7..51353f80310a 100644 --- a/drivers/irqchip/irq-madera.c +++ b/drivers/irqchip/irq-madera.c @@ -34,7 +34,7 @@ struct madera_irq_priv { }; #define MADERA_IRQ(_irq, _reg) \ - [MADERA_IRQ_ ## _irq] = { .reg_offset = (_reg) - MADERA_IRQ1_STATUS_2, \ + [MADERA_IRQ_ ## _irq] = { .reg_offset = (_reg) - MADERA_IRQ1_STATUS_1, \ .mask = MADERA_ ## _irq ## _EINT1 } static const struct regmap_irq madera_irqs[MADERA_NUM_IRQ] = { @@ -93,15 +93,17 @@ static const struct regmap_irq madera_irqs[MADERA_NUM_IRQ] = { MADERA_IRQ(DSP5_BUS_ERR, MADERA_IRQ1_STATUS_33), MADERA_IRQ(DSP6_BUS_ERR, MADERA_IRQ1_STATUS_33), MADERA_IRQ(DSP7_BUS_ERR, MADERA_IRQ1_STATUS_33), + + MADERA_IRQ(BOOT_DONE, MADERA_IRQ1_STATUS_1), }; static const struct regmap_irq_chip madera_irq = { .name = "madera IRQ", - .status_base = MADERA_IRQ1_STATUS_2, - .mask_base = MADERA_IRQ1_MASK_2, - .ack_base = MADERA_IRQ1_STATUS_2, + .status_base = MADERA_IRQ1_STATUS_1, + .mask_base = MADERA_IRQ1_MASK_1, + .ack_base = MADERA_IRQ1_STATUS_1, .runtime_pm = true, - .num_regs = 32, + .num_regs = 33, .irqs = madera_irqs, .num_irqs = ARRAY_SIZE(madera_irqs), }; @@ -198,6 +200,15 @@ static int madera_resume(struct device *dev) } #endif +static irqreturn_t madera_boot_done(int irq, void *data) +{ + struct madera *madera = data; + + dev_warn(madera->dev, "BOOT_DONE\n"); + + return IRQ_HANDLED; +} + static const struct dev_pm_ops madera_irq_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(madera_suspend, madera_resume) SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(madera_suspend_noirq, @@ -266,6 +277,9 @@ static int madera_irq_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); madera->irq_dev = priv->dev; + madera_request_irq(madera, MADERA_IRQ_BOOT_DONE, "BOOT_DONE", + madera_boot_done, madera); + return 0; } @@ -280,6 +294,8 @@ static int madera_irq_remove(struct platform_device *pdev) priv->madera->irq_dev = NULL; + madera_free_irq(priv->madera, MADERA_IRQ_BOOT_DONE, priv->madera); + regmap_del_irq_chip(priv->irq, priv->irq_data); free_irq(priv->irq, priv); diff --git a/include/linux/irqchip/irq-madera.h b/include/linux/irqchip/irq-madera.h index 806684628113..11a71d6370af 100644 --- a/include/linux/irqchip/irq-madera.h +++ b/include/linux/irqchip/irq-madera.h @@ -83,8 +83,9 @@ #define MADERA_IRQ_DSP5_BUS_ERR 69 #define MADERA_IRQ_DSP6_BUS_ERR 70 #define MADERA_IRQ_DSP7_BUS_ERR 71 +#define MADERA_IRQ_BOOT_DONE 72 -#define MADERA_NUM_IRQ 72 +#define MADERA_NUM_IRQ 73 struct madera; -- 2.20.1