diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2014-06-19 17:34:41 -0400 |
|---|---|---|
| committer | Jason Cooper <jason@lakedaemon.net> | 2014-06-24 08:37:59 -0400 |
| commit | 4ecc832f4ef25dcb684ca986de3612e881748c0e (patch) | |
| tree | b4f67f2c96c0a6a29f2a9c59d7881c8bb2629aba | |
| parent | e3c871ab232ccc5fd82f76b21b9cae0113f01dc0 (diff) | |
irqchip: spear_shirq: Precalculate status mask
Calculate the status mask at compile time, not at runtime.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20140619212713.496614337@linutronix.de
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
| -rw-r--r-- | drivers/irqchip/spear-shirq.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c index 874950c014be..fc57c35a20b4 100644 --- a/drivers/irqchip/spear-shirq.c +++ b/drivers/irqchip/spear-shirq.c | |||
| @@ -49,6 +49,7 @@ struct shirq_regs { | |||
| 49 | * | 49 | * |
| 50 | * base: Base register address | 50 | * base: Base register address |
| 51 | * regs: Register configuration for shared irq block | 51 | * regs: Register configuration for shared irq block |
| 52 | * mask: Mask to apply to the status register | ||
| 52 | * virq_base: Base virtual interrupt number | 53 | * virq_base: Base virtual interrupt number |
| 53 | * nr_irqs: Number of interrupts handled by this block | 54 | * nr_irqs: Number of interrupts handled by this block |
| 54 | * offset: Bit offset of the first interrupt | 55 | * offset: Bit offset of the first interrupt |
| @@ -57,6 +58,7 @@ struct shirq_regs { | |||
| 57 | struct spear_shirq { | 58 | struct spear_shirq { |
| 58 | void __iomem *base; | 59 | void __iomem *base; |
| 59 | struct shirq_regs regs; | 60 | struct shirq_regs regs; |
| 61 | u32 mask; | ||
| 60 | u32 virq_base; | 62 | u32 virq_base; |
| 61 | u32 nr_irqs; | 63 | u32 nr_irqs; |
| 62 | u32 offset; | 64 | u32 offset; |
| @@ -72,6 +74,7 @@ static DEFINE_SPINLOCK(lock); | |||
| 72 | static struct spear_shirq spear300_shirq_ras1 = { | 74 | static struct spear_shirq spear300_shirq_ras1 = { |
| 73 | .offset = 0, | 75 | .offset = 0, |
| 74 | .nr_irqs = 9, | 76 | .nr_irqs = 9, |
| 77 | .mask = ((0x1 << 9) - 1) << 0, | ||
| 75 | .regs = { | 78 | .regs = { |
| 76 | .enb_reg = SPEAR300_INT_ENB_MASK_REG, | 79 | .enb_reg = SPEAR300_INT_ENB_MASK_REG, |
| 77 | .status_reg = SPEAR300_INT_STS_MASK_REG, | 80 | .status_reg = SPEAR300_INT_STS_MASK_REG, |
| @@ -89,6 +92,7 @@ static struct spear_shirq *spear300_shirq_blocks[] = { | |||
| 89 | static struct spear_shirq spear310_shirq_ras1 = { | 92 | static struct spear_shirq spear310_shirq_ras1 = { |
| 90 | .offset = 0, | 93 | .offset = 0, |
| 91 | .nr_irqs = 8, | 94 | .nr_irqs = 8, |
| 95 | .mask = ((0x1 << 8) - 1) << 0, | ||
| 92 | .regs = { | 96 | .regs = { |
| 93 | .enb_reg = -1, | 97 | .enb_reg = -1, |
| 94 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 98 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
| @@ -99,6 +103,7 @@ static struct spear_shirq spear310_shirq_ras1 = { | |||
| 99 | static struct spear_shirq spear310_shirq_ras2 = { | 103 | static struct spear_shirq spear310_shirq_ras2 = { |
| 100 | .offset = 8, | 104 | .offset = 8, |
| 101 | .nr_irqs = 5, | 105 | .nr_irqs = 5, |
| 106 | .mask = ((0x1 << 5) - 1) << 8, | ||
| 102 | .regs = { | 107 | .regs = { |
| 103 | .enb_reg = -1, | 108 | .enb_reg = -1, |
| 104 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 109 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
| @@ -109,6 +114,7 @@ static struct spear_shirq spear310_shirq_ras2 = { | |||
| 109 | static struct spear_shirq spear310_shirq_ras3 = { | 114 | static struct spear_shirq spear310_shirq_ras3 = { |
| 110 | .offset = 13, | 115 | .offset = 13, |
| 111 | .nr_irqs = 1, | 116 | .nr_irqs = 1, |
| 117 | .mask = ((0x1 << 1) - 1) << 13, | ||
| 112 | .regs = { | 118 | .regs = { |
| 113 | .enb_reg = -1, | 119 | .enb_reg = -1, |
| 114 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 120 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
| @@ -119,6 +125,7 @@ static struct spear_shirq spear310_shirq_ras3 = { | |||
| 119 | static struct spear_shirq spear310_shirq_intrcomm_ras = { | 125 | static struct spear_shirq spear310_shirq_intrcomm_ras = { |
| 120 | .offset = 14, | 126 | .offset = 14, |
| 121 | .nr_irqs = 3, | 127 | .nr_irqs = 3, |
| 128 | .mask = ((0x1 << 3) - 1) << 14, | ||
| 122 | .regs = { | 129 | .regs = { |
| 123 | .enb_reg = -1, | 130 | .enb_reg = -1, |
| 124 | .status_reg = SPEAR310_INT_STS_MASK_REG, | 131 | .status_reg = SPEAR310_INT_STS_MASK_REG, |
| @@ -141,6 +148,7 @@ static struct spear_shirq *spear310_shirq_blocks[] = { | |||
| 141 | static struct spear_shirq spear320_shirq_ras3 = { | 148 | static struct spear_shirq spear320_shirq_ras3 = { |
| 142 | .offset = 0, | 149 | .offset = 0, |
| 143 | .nr_irqs = 7, | 150 | .nr_irqs = 7, |
| 151 | .mask = ((0x1 << 7) - 1) << 0, | ||
| 144 | .disabled = 1, | 152 | .disabled = 1, |
| 145 | .regs = { | 153 | .regs = { |
| 146 | .enb_reg = SPEAR320_INT_ENB_MASK_REG, | 154 | .enb_reg = SPEAR320_INT_ENB_MASK_REG, |
| @@ -154,6 +162,7 @@ static struct spear_shirq spear320_shirq_ras3 = { | |||
| 154 | static struct spear_shirq spear320_shirq_ras1 = { | 162 | static struct spear_shirq spear320_shirq_ras1 = { |
| 155 | .offset = 7, | 163 | .offset = 7, |
| 156 | .nr_irqs = 3, | 164 | .nr_irqs = 3, |
| 165 | .mask = ((0x1 << 3) - 1) << 7, | ||
| 157 | .regs = { | 166 | .regs = { |
| 158 | .enb_reg = -1, | 167 | .enb_reg = -1, |
| 159 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 168 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| @@ -165,6 +174,7 @@ static struct spear_shirq spear320_shirq_ras1 = { | |||
| 165 | static struct spear_shirq spear320_shirq_ras2 = { | 174 | static struct spear_shirq spear320_shirq_ras2 = { |
| 166 | .offset = 10, | 175 | .offset = 10, |
| 167 | .nr_irqs = 1, | 176 | .nr_irqs = 1, |
| 177 | .mask = ((0x1 << 1) - 1) << 10, | ||
| 168 | .regs = { | 178 | .regs = { |
| 169 | .enb_reg = -1, | 179 | .enb_reg = -1, |
| 170 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 180 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| @@ -176,6 +186,7 @@ static struct spear_shirq spear320_shirq_ras2 = { | |||
| 176 | static struct spear_shirq spear320_shirq_intrcomm_ras = { | 186 | static struct spear_shirq spear320_shirq_intrcomm_ras = { |
| 177 | .offset = 11, | 187 | .offset = 11, |
| 178 | .nr_irqs = 11, | 188 | .nr_irqs = 11, |
| 189 | .mask = ((0x1 << 11) - 1) << 11, | ||
| 179 | .regs = { | 190 | .regs = { |
| 180 | .enb_reg = -1, | 191 | .enb_reg = -1, |
| 181 | .status_reg = SPEAR320_INT_STS_MASK_REG, | 192 | .status_reg = SPEAR320_INT_STS_MASK_REG, |
| @@ -239,7 +250,7 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc) | |||
| 239 | 250 | ||
| 240 | chip->irq_ack(idata); | 251 | chip->irq_ack(idata); |
| 241 | 252 | ||
| 242 | mask = ((0x1 << shirq->nr_irqs) - 1) << shirq->offset; | 253 | mask = shirq->mask; |
| 243 | while ((val = readl(shirq->base + shirq->regs.status_reg) & | 254 | while ((val = readl(shirq->base + shirq->regs.status_reg) & |
| 244 | mask)) { | 255 | mask)) { |
| 245 | 256 | ||
