Skip to content

Commit 5fae405

Browse files
Pannaga BhushanBen Dooks
authored andcommitted
ARM: S5P: Fix the platform external interrupt issues.
This patch does the following: 1. Corrects the common platform code for external interrupts for using the VIC mask/unmask bits also. 2. Moves the common defines related to external interrupt for plat-s5p to common files. 3. Based on the new common defines, corresponding changes are made in the affected platforms (S5P6440, S5P6442 and S5PC100). Signed-off-by: Pannaga Bhushan <p.bhushan@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
1 parent b1cdc46 commit 5fae405

8 files changed

Lines changed: 40 additions & 28 deletions

File tree

‎arch/arm/mach-s5p6440/include/mach/irqs.h‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,14 @@
7272
#define S5P_IRQ_EINT_BASE (S5P_IRQ_VIC1(31) + 6)
7373

7474
#define S5P_EINT(x) ((x) + S5P_IRQ_EINT_BASE)
75-
#define IRQ_EINT(x) S5P_EINT(x)
75+
76+
#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE)
77+
/*
78+
* S5P6440 has 0-15 external interrupts in group 0. Only these can be used
79+
* to wake up from sleep. If request is beyond this range, by mistake, a large
80+
* return value for an irq number should be indication of something amiss.
81+
*/
82+
#define S5P_EINT_BASE2 (0xf0000000)
7683

7784
/*
7885
* Next the external interrupt groups. These are similar to the IRQ_EINT(x)

‎arch/arm/mach-s5p6442/include/mach/irqs.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@
7777

7878
#define S5P_IRQ_EINT_BASE (IRQ_VIC_END + 1)
7979

80-
#define IRQ_EINT(x) ((x) < 16 ? S5P_IRQ_VIC0(x) : \
81-
(S5P_IRQ_EINT_BASE + (x)-16))
80+
#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
81+
#define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE)
82+
8283
/* Set the default NR_IRQS */
8384

8485
#define NR_IRQS (IRQ_EINT(31) + 1)

‎arch/arm/mach-s5pc100/include/mach/irqs.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@
100100
#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
101101
#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
102102

103-
#define IRQ_EINT(x) ((x) < 16 ? S5P_IRQ_VIC0(x) : \
104-
(S5P_EINT_BASE2 + (x) - 16))
105-
106103
#define S3C_IRQ_GPIO_BASE (IRQ_EINT(31) + 1)
107104
#define S3C_IRQ_GPIO(x) (S3C_IRQ_GPIO_BASE + (x))
108105

‎arch/arm/mach-s5pv210/include/mach/irqs.h‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,12 @@
118118
#define IRQ_MDNIE3 S5P_IRQ_VIC3(8)
119119
#define IRQ_VIC_END S5P_IRQ_VIC3(31)
120120

121-
#define S5P_EINT_16_31_BASE (IRQ_VIC_END + 1)
122-
123-
#define EINT_MODE S3C_GPIO_SFN(0xf)
124-
125-
#define IRQ_EINT(x) ((x) < 16 ? ((x) + S5P_IRQ_VIC0(0)) \
126-
: ((x) + S5P_EINT_16_31_BASE))
121+
#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
122+
#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
127123

128124
/* Set the default NR_IRQS */
129-
130125
#define NR_IRQS (IRQ_EINT(31) + 1)
131126

132-
#define EINT_GPIO_0(x) S5PV210_GPH0(x)
133-
#define EINT_GPIO_1(x) S5PV210_GPH1(x)
134-
#define EINT_GPIO_2(x) S5PV210_GPH2(x)
135-
#define EINT_GPIO_3(x) S5PV210_GPH3(x)
136-
137127
/* Compatibility */
138128
#define IRQ_LCD_FIFO IRQ_LCD0
139129
#define IRQ_LCD_VSYNC IRQ_LCD1

‎arch/arm/mach-s5pv210/include/mach/regs-gpio.h‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,9 @@
2727
#define S5PV210_EINT30PEND (S5P_VA_GPIO + 0xF40)
2828
#define S5P_EINT_PEND(x) (S5PV210_EINT30PEND + ((x) * 0x4))
2929

30-
#define eint_offset(irq) ((irq) < IRQ_EINT16_31 ? ((irq) - IRQ_EINT(0)) \
31-
: ((irq) - S5P_EINT_16_31_BASE))
30+
#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
3231

33-
#define EINT_REG_NR(x) (eint_offset(x) >> 3)
34-
35-
#define eint_irq_to_bit(irq) (1 << (eint_offset(irq) & 0x7))
32+
#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
3633

3734
/* values for S5P_EXTINT0 */
3835
#define S5P_EXTINT_LOWLEV (0x00)
@@ -41,4 +38,11 @@
4138
#define S5P_EXTINT_RISEEDGE (0x03)
4239
#define S5P_EXTINT_BOTHEDGE (0x04)
4340

41+
#define EINT_MODE S3C_GPIO_SFN(0xf)
42+
43+
#define EINT_GPIO_0(x) S5PV210_GPH0(x)
44+
#define EINT_GPIO_1(x) S5PV210_GPH1(x)
45+
#define EINT_GPIO_2(x) S5PV210_GPH2(x)
46+
#define EINT_GPIO_3(x) S5PV210_GPH3(x)
47+
4448
#endif /* __ASM_ARCH_REGS_GPIO_H */

‎arch/arm/plat-s5p/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ config S5P_EXT_INT
2929
bool
3030
help
3131
Use the external interrupts (other than GPIO interrupts.)
32+
Note: Do not choose this for S5P6440.

‎arch/arm/plat-s5p/include/plat/irqs.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,11 @@
8787
#define IRQ_TIMER3 S5P_TIMER_IRQ(3)
8888
#define IRQ_TIMER4 S5P_TIMER_IRQ(4)
8989

90+
#define IRQ_EINT(x) ((x) < 16 ? ((x) + S5P_EINT_BASE1) \
91+
: ((x) - 16 + S5P_EINT_BASE2))
92+
93+
#define EINT_OFFSET(irq) ((irq) < S5P_EINT_BASE2 ? \
94+
((irq) - S5P_EINT_BASE1) : \
95+
((irq) + 16 - S5P_EINT_BASE2))
96+
9097
#endif /* __ASM_PLAT_S5P_IRQS_H */

‎arch/arm/plat-s5p/irq-eint.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static void s5p_irq_eint_maskack(unsigned int irq)
6060

6161
static int s5p_irq_eint_set_type(unsigned int irq, unsigned int type)
6262
{
63-
int offs = eint_offset(irq);
63+
int offs = EINT_OFFSET(irq);
6464
int shift;
6565
u32 ctrl, mask;
6666
u32 newvalue = 0;
@@ -139,17 +139,16 @@ static struct irq_chip s5p_irq_eint = {
139139
*/
140140
static inline void s5p_irq_demux_eint(unsigned int start)
141141
{
142-
u32 status;
142+
u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start)));
143143
u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start)));
144144
unsigned int irq;
145145

146-
status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start)));
147146
status &= ~mask;
148147
status &= 0xff;
149148

150149
while (status) {
151-
irq = fls(status);
152-
generic_handle_irq(irq - 1 + start);
150+
irq = fls(status) - 1;
151+
generic_handle_irq(irq + start);
153152
status &= ~(1 << irq);
154153
}
155154
}
@@ -162,12 +161,18 @@ static void s5p_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
162161

163162
static inline void s5p_irq_vic_eint_mask(unsigned int irq)
164163
{
164+
void __iomem *base = get_irq_chip_data(irq);
165+
165166
s5p_irq_eint_mask(irq);
167+
writel(1 << EINT_OFFSET(irq), base + VIC_INT_ENABLE_CLEAR);
166168
}
167169

168170
static void s5p_irq_vic_eint_unmask(unsigned int irq)
169171
{
172+
void __iomem *base = get_irq_chip_data(irq);
173+
170174
s5p_irq_eint_unmask(irq);
175+
writel(1 << EINT_OFFSET(irq), base + VIC_INT_ENABLE);
171176
}
172177

173178
static inline void s5p_irq_vic_eint_ack(unsigned int irq)

0 commit comments

Comments
 (0)