ARM: S5PV210: Add Ext interrupt support.
Subsystems (3)
PATCH v4 1/1 ARM: S5PV210: Add Ext interrupt support.
From: Jongpill Lee <[email protected]>
Add support for external interrupts on v210.
--- arch/arm/mach-s5pv210/Kconfig | 1 + arch/arm/mach-s5pv210/include/mach/irqs.h | 26 +-- arch/arm/mach-s5pv210/include/mach/regs-gpio.h | 46 +++++ arch/arm/plat-s5p/Kconfig | 5 + arch/arm/plat-s5p/Makefile | 1 + arch/arm/plat-s5p/irq-eint.c | 216 ++++++++++++++++++++++++ 6 files changed, 277 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-gpio.h create mode 100644 arch/arm/plat-s5p/irq-eint.c
arch/arm/mach-s5pv210/Kconfig +1 -0
@@ -12,6 +12,7 @@ if ARCH_S5PV210 config CPU_S5PV210 bool select PLAT_S5P + select S5P_EXT_INT help Enable S5PV210 CPU support
arch/arm/mach-s5pv210/include/mach/irqs.h +8 -18
@@ -17,22 +17,9 @@/* VIC0: System, DMA, Timer */ -#define IRQ_EINT0 S5P_IRQ_VIC0(0) -#define IRQ_EINT1 S5P_IRQ_VIC0(1) -#define IRQ_EINT2 S5P_IRQ_VIC0(2) -#define IRQ_EINT3 S5P_IRQ_VIC0(3) -#define IRQ_EINT4 S5P_IRQ_VIC0(4) -#define IRQ_EINT5 S5P_IRQ_VIC0(5) -#define IRQ_EINT6 S5P_IRQ_VIC0(6) -#define IRQ_EINT7 S5P_IRQ_VIC0(7) -#define IRQ_EINT8 S5P_IRQ_VIC0(8) -#define IRQ_EINT9 S5P_IRQ_VIC0(9) -#define IRQ_EINT10 S5P_IRQ_VIC0(10) -#define IRQ_EINT11 S5P_IRQ_VIC0(11) -#define IRQ_EINT12 S5P_IRQ_VIC0(12) -#define IRQ_EINT13 S5P_IRQ_VIC0(13) -#define IRQ_EINT14 S5P_IRQ_VIC0(14) -#define IRQ_EINT15 S5P_IRQ_VIC0(15) +/* Can be used for EINTs 0 to 15 */ +#define IRQ_EINT (x) ((x) + S5P_IRQ_VIC0(0)) +#define IRQ_EINT16_31 S5P_IRQ_VIC0(16)#define IRQ_BATF S5P_IRQ_VIC0(17)#define IRQ_MDMA S5P_IRQ_VIC0(18)
@@ -137,10 +124,13 @@#define S5P_IRQ_EINT_BASE (IRQ_VIC_END + 1)#define S5P_EINT (x) ((x) + S5P_IRQ_EINT_BASE) -#define IRQ_EINT (x) S5P_EINT(x) +/* Can be used for EINTs 16 to 31 */ +#define IRQ_EINT_GRP (x) S5P_EINT(x) + +#define EINT_MODE S3C_GPIO_SFN(0xf)/* Set the default NR_IRQS */ -#define NR_IRQS (IRQ_EINT(31) + 1) +#define NR_IRQS (IRQ_EINT_GRP(31) + 1)#endif /* ASM_ARCH_IRQS_H */
arch/arm/mach-s5pv210/include/mach/regs-gpio.h new file +46 -0
46 lines not on this page · raw message
arch/arm/plat-s5p/Kconfig +5 -0
@@ -23,3 +23,8 @@ config PLAT_S5P select SAMSUNG_IRQ_UART help Base platform code for Samsung's S5P series SoC. + +config S5P_EXT_INT + bool + help + Use the external interrupts (other than GPIO interrupts.)
arch/arm/plat-s5p/Makefile +1 -0
@@ -16,4 +16,5 @@ obj-y += dev-uart.o obj-y += cpu.o obj-y += clock.o obj-y += irq.o +obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o obj-y += setup-i2c0.o
arch/arm/plat-s5p/irq-eint.c new file +216 -0
216 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH v4 1/1 ARM: S5PV210: Add Ext interrupt support.
Hello,
Quoted 134 lines · Kukjin Kim
From: Jongpill Lee <[email protected]>
Add support for external interrupts on v210.
Signed-off-by Jongpill Lee <[email protected]>Signed-off-by Pannaga Bhushan <[email protected]>Signed-off-by Kukjin Kim <[email protected]>--- arch/arm/mach-s5pv210/Kconfig | 1 + arch/arm/mach-s5pv210/include/mach/irqs.h | 26 +-- arch/arm/mach-s5pv210/include/mach/regs-gpio.h | 46 +++++ arch/arm/plat-s5p/Kconfig | 5 + arch/arm/plat-s5p/Makefile | 1 + arch/arm/plat-s5p/irq-eint.c | 216 ++++++++++++++++++++++++ 6 files changed, 277 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-gpio.h create mode 100644 arch/arm/plat-s5p/irq-eint.c...
arch/arm/plat-s5p/irq-eint.c new file +107
-0@@ -0,0 +1,216 @@ +/* linux/arch/arm/plat-s5p/irq-eint.c +* +* Copyright (c) 2010 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* S5P - IRQ EINT support +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/io.h> +#include <linux/sysdev.h> +#include <linux/gpio.h> + +#include <asm/bitops.h> +#include <asm/hardware/vic.h> + +#include <plat/regs-irqtype.h> + +#include <mach/map.h> +#include <plat/cpu.h> +#include <plat/pm.h> + +#include <plat/gpio-cfg.h> +#include <mach/regs-gpio.h> + +static inline void s5p_irq_eint_mask (unsigned int irq) +{ +u32 mask; + + mask =__raw_readl (S5P_EINT_MASK (eint_mask_reg (irq))); + mask |=eint_irq_to_bit (irq); +__raw_writel (mask,S5P_EINT_MASK (eint_mask_reg (irq))); +} + +static void s5p_irq_eint_unmask (unsigned int irq) +{ +u32 mask; + + mask =__raw_readl (S5P_EINT_MASK (eint_mask_reg (irq))); + mask &= ~(eint_irq_to_bit (irq)); +__raw_writel (mask,S5P_EINT_MASK (eint_mask_reg (irq))); +} + +static inline void s5p_irq_eint_ack (unsigned int irq) +{ +__raw_writel (eint_irq_to_bit (irq),S5P_EINT_PEND (eint_pend_reg (irq))); +} + +static void s5p_irq_eint_maskack (unsigned int irq) +{ +/* compiler should in-line these */ +s5p_irq_eint_mask (irq); +s5p_irq_eint_ack (irq); +} + +static int s5p_irq_eint_set_type (unsigned int irq,unsigned int type) +{ +int offs =eint_offset (irq); +int shift; +u32 ctrl, mask; +u32 newvalue =0 ; + +switch (type) { +case IRQ_TYPE_NONE : +printk (KERN_WARNING "No edge setting!\n" ); +break ; + +case IRQ_TYPE_EDGE_RISING : + newvalue =S5P_EXTINT_RISEEDGE ; +break ; + +case IRQ_TYPE_EDGE_FALLING : + newvalue =S5P_EXTINT_RISEEDGE ; +break ; + +case IRQ_TYPE_EDGE_BOTH : + newvalue =S5P_EXTINT_BOTHEDGE ; +break ; + +case IRQ_TYPE_LEVEL_LOW : + newvalue =S5P_EXTINT_LOWLEV ; +break ; + +case IRQ_TYPE_LEVEL_HIGH : + newvalue =S5P_EXTINT_HILEV ; +break ; + +default : +printk (KERN_ERR "No such irq type %d" , type); +return -EINVAL ; + } + + shift = (offs &0x7 ) *4 ; + mask =0x7 << shift; + + ctrl =__raw_readl (S5P_EINT_CON (eint_conf_reg (irq))); + ctrl &= ~mask; + ctrl |= newvalue << shift; +__raw_writel (ctrl,S5P_EINT_CON (eint_conf_reg (irq))); + +if ((0 <= offs) && (offs <8 ))
arch/arm/plat-s5p/irq-eint.c line 117
Quoted 10 lines
arch/arm/plat-s5p/irq-eint.c new file +10
-0+s3c_gpio_cfgpin (S5PV210_GPH0 (offs &0x7 ),EINT_MODE ); + + else if ((8 <= offs) && (offs < 16)) + s3c_gpio_cfgpin(S5PV210_GPH1(offs & 0x7), EINT_MODE); + + else if ((16 <= offs) && (offs < 24)) + s3c_gpio_cfgpin(S5PV210_GPH2(offs & 0x7), EINT_MODE); + + else if ((24 <= offs) && (offs < 32)) + s3c_gpio_cfgpin(S5PV210_GPH3(offs & 0x7), EINT_MODE);
When the code is put into plat-s5p directory then please don't use S5PV210_GPH3 defines. If makes it hardly reusable with other SoCs.
Quoted 1 line
...
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
PATCH v4 1/1 ARM: S5PV210: Add Ext interrupt support.
Quoted 76 lines · Marek Szyprowski
Hello,
Quoted 71 lines · Kukjin Kim
From: Jongpill Lee <[email protected]>
Add support for external interrupts on v210.
Signed-off-by Jongpill Lee <[email protected]>Signed-off-by Pannaga Bhushan <[email protected]>Signed-off-by Kukjin Kim <[email protected]>--- arch/arm/mach-s5pv210/Kconfig | 1 + arch/arm/mach-s5pv210/include/mach/irqs.h | 26 +-- arch/arm/mach-s5pv210/include/mach/regs-gpio.h | 46 +++++ arch/arm/plat-s5p/Kconfig | 5 + arch/arm/plat-s5p/Makefile | 1 + arch/arm/plat-s5p/irq-eint.c | 216 ++++++++++++++++++++++++ 6 files changed, 277 insertions(+), 18 deletions(-) create mode 100644 arch/arm/mach-s5pv210/include/mach/regs-gpio.h create mode 100644 arch/arm/plat-s5p/irq-eint.c...
arch/arm/plat-s5p/irq-eint.c new file +44
-0@@ -0,0 +1,216 @@ +/* linux/arch/arm/plat-s5p/irq-eint.c +* +* Copyright (c) 2010 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* S5P - IRQ EINT support +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#include <linux/kernel.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/io.h> +#include <linux/sysdev.h> +#include <linux/gpio.h> + +#include <asm/bitops.h> +#include <asm/hardware/vic.h> + +#include <plat/regs-irqtype.h> + +#include <mach/map.h> +#include <plat/cpu.h> +#include <plat/pm.h> + +#include <plat/gpio-cfg.h> +#include <mach/regs-gpio.h> + +static inline void s5p_irq_eint_mask (unsigned int irq) +{ +u32 mask; + + mask =__raw_readl (S5P_EINT_MASK (eint_mask_reg (irq))); + mask |=eint_irq_to_bit (irq); +__raw_writel (mask,S5P_EINT_MASK (eint_mask_reg (irq))); +} + +static void s5p_irq_eint_unmask (unsigned int irq) +{ +u32 mask; +
Quoted 8 lines
arch/arm/plat-s5p/irq-eint.c
Quoted 8 lines
arch/arm/plat-s5p/irq-eint.c new file +8
-0+ mask =__raw_readl (S5P_EINT_MASK (eint_mask_reg (irq))); + mask &= ~(eint_irq_to_bit (irq)); +__raw_writel (mask,S5P_EINT_MASK (eint_mask_reg (irq))); +} + +static inline void s5p_irq_eint_ack (unsigned int irq) +{ + __raw_writel(eint_irq_to_bit(irq),
S5P_EINT_PEND(eint_pend_reg(irq)));
Quoted 60 lines
Quoted 60 lines
arch/arm/plat-s5p/irq-eint.c new file +60
-0+} + +static void s5p_irq_eint_maskack (unsigned int irq) +{ +/* compiler should in-line these */ +s5p_irq_eint_mask (irq); +s5p_irq_eint_ack (irq); +} + +static int s5p_irq_eint_set_type (unsigned int irq,unsigned int type) +{ +int offs =eint_offset (irq); +int shift; +u32 ctrl, mask; +u32 newvalue =0 ; + +switch (type) { +case IRQ_TYPE_NONE : +printk (KERN_WARNING "No edge setting!\n" ); +break ; + +case IRQ_TYPE_EDGE_RISING : + newvalue =S5P_EXTINT_RISEEDGE ; +break ; + +case IRQ_TYPE_EDGE_FALLING : + newvalue =S5P_EXTINT_RISEEDGE ; +break ; + +case IRQ_TYPE_EDGE_BOTH : + newvalue =S5P_EXTINT_BOTHEDGE ; +break ; + +case IRQ_TYPE_LEVEL_LOW : + newvalue =S5P_EXTINT_LOWLEV ; +break ; + +case IRQ_TYPE_LEVEL_HIGH : + newvalue =S5P_EXTINT_HILEV ; +break ; + +default : +printk (KERN_ERR "No such irq type %d" , type); +return -EINVAL ; + } + + shift = (offs &0x7 ) *4 ; + mask =0x7 << shift; + + ctrl =__raw_readl (S5P_EINT_CON (eint_conf_reg (irq))); + ctrl &= ~mask; + ctrl |= newvalue << shift; +__raw_writel (ctrl,S5P_EINT_CON (eint_conf_reg (irq))); + +if ((0 <= offs) && (offs <8 )) +s3c_gpio_cfgpin (S5PV210_GPH0 (offs &0x7 ),EINT_MODE ); + +else if ((8 <= offs) && (offs <16 )) +s3c_gpio_cfgpin (S5PV210_GPH1 (offs &0x7 ),EINT_MODE ); +
Quoted 11 lines
arch/arm/plat-s5p/irq-eint.c line 117
Quoted 5 lines
arch/arm/plat-s5p/irq-eint.c new file +5
-0+else if ((16 <= offs) && (offs <24 )) +s3c_gpio_cfgpin (S5PV210_GPH2 (offs &0x7 ),EINT_MODE ); + +else if ((24 <= offs) && (offs <32 )) +s3c_gpio_cfgpin (S5PV210_GPH3 (offs &0x7 ),EINT_MODE );When the code is put into plat-s5p directory then please don't use
S5PV210_GPH3defines. If makes it hardly reusable with other SoCs.Quoted 1 line
...
Eeks, actually went to this from a previously better solution. All the while thinking GPHx is fine for both S5PC100 and S5PV210. Missed the S5PV210 part. Will post the fix soon.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.