Skip to content

Commit

Permalink
ARM: S5PC100: Use generic S5P GPIO Interrupt interface
Browse files Browse the repository at this point in the history
S5PC100 SoC can use common S5P GPIO interrupt code. This patch
removes specific S5PC100 gpio interrupts code and adds required
defines and code to make use of common S5P code.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
  • Loading branch information
Joonyoung Shim authored and Kukjin Kim committed Oct 20, 2010
1 parent 5fdc97b commit 7e47935
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 305 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-s5pc100/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj- :=

# Core support for S5PC100 system

obj-$(CONFIG_CPU_S5PC100) += cpu.o init.o clock.o gpiolib.o irq-gpio.o
obj-$(CONFIG_CPU_S5PC100) += cpu.o init.o clock.o gpiolib.o
obj-$(CONFIG_CPU_S5PC100) += setup-i2c0.o
obj-$(CONFIG_CPU_S5PC100) += dma.o

Expand Down
45 changes: 11 additions & 34 deletions arch/arm/mach-s5pc100/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@
* L3 8 4Bit None
*/

static int s5pc100_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
{
return S3C_IRQ_GPIO(chip->base + offset);
}

static int s5pc100_gpiolib_to_eint(struct gpio_chip *chip, unsigned int offset)
{
int base;
Expand Down Expand Up @@ -232,6 +227,7 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
.base = S5PC100_GPH0(0),
.ngpio = S5PC100_GPIO_H0_NR,
.label = "GPH0",
.to_irq = s5pc100_gpiolib_to_eint,
},
}, {
.base = S5PC100_GPH1_BASE,
Expand All @@ -240,6 +236,7 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
.base = S5PC100_GPH1(0),
.ngpio = S5PC100_GPIO_H1_NR,
.label = "GPH1",
.to_irq = s5pc100_gpiolib_to_eint,
},
}, {
.base = S5PC100_GPH2_BASE,
Expand All @@ -248,6 +245,7 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
.base = S5PC100_GPH2(0),
.ngpio = S5PC100_GPIO_H2_NR,
.label = "GPH2",
.to_irq = s5pc100_gpiolib_to_eint,
},
}, {
.base = S5PC100_GPH3_BASE,
Expand All @@ -256,6 +254,7 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
.base = S5PC100_GPH3(0),
.ngpio = S5PC100_GPIO_H3_NR,
.label = "GPH3",
.to_irq = s5pc100_gpiolib_to_eint,
},
}, {
.base = S5PC100_GPI_BASE,
Expand Down Expand Up @@ -380,47 +379,25 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
},
};

/* FIXME move from irq-gpio.c */
extern struct irq_chip s5pc100_gpioint;
extern void s5pc100_irq_gpioint_handler(unsigned int irq, struct irq_desc *desc);

static __init void s5pc100_gpiolib_link(struct s3c_gpio_chip *chip)
{
/* Interrupt */
if (chip->config == &gpio_cfg) {
int i, irq;

chip->chip.to_irq = s5pc100_gpiolib_to_irq;

for (i = 0; i < chip->chip.ngpio; i++) {
irq = S3C_IRQ_GPIO_BASE + chip->chip.base + i;
set_irq_chip(irq, &s5pc100_gpioint);
set_irq_data(irq, &chip->chip);
set_irq_handler(irq, handle_level_irq);
set_irq_flags(irq, IRQF_VALID);
}
} else if (chip->config == &gpio_cfg_eint) {
chip->chip.to_irq = s5pc100_gpiolib_to_eint;
}
}

static __init int s5pc100_gpiolib_init(void)
{
struct s3c_gpio_chip *chip;
int nr_chips;
int gpioint_group = 0;

chip = s5pc100_gpio_chips;
nr_chips = ARRAY_SIZE(s5pc100_gpio_chips);

for (; nr_chips > 0; nr_chips--, chip++)
s5pc100_gpiolib_link(chip);
for (; nr_chips > 0; nr_chips--, chip++) {
if (chip->config == &gpio_cfg) {
/* gpio interrupts */
chip->group = gpioint_group++;
}
}

samsung_gpiolib_add_4bit_chips(s5pc100_gpio_chips,
ARRAY_SIZE(s5pc100_gpio_chips));

/* Interrupt */
set_irq_chained_handler(IRQ_GPIOINT, s5pc100_irq_gpioint_handler);

return 0;
}
core_initcall(s5pc100_gpiolib_init);
9 changes: 5 additions & 4 deletions arch/arm/mach-s5pc100/include/mach/irqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@
#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)

#define S3C_IRQ_GPIO_BASE (IRQ_EINT(31) + 1)
#define S3C_IRQ_GPIO(x) (S3C_IRQ_GPIO_BASE + (x))
/* GPIO interrupt */
#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
#define S5P_GPIOINT_GROUP_MAXNR 21

/* Until MP04 Groups -> 40 (exactly 39) Groups * 8 ~= 320 GPIOs */
#define NR_IRQS (S3C_IRQ_GPIO(320) + 1)
/* Set the default NR_IRQS */
#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)

/* Compatibility */
#define IRQ_LCD_FIFO IRQ_LCD0
Expand Down
266 changes: 0 additions & 266 deletions arch/arm/mach-s5pc100/irq-gpio.c

This file was deleted.

0 comments on commit 7e47935

Please sign in to comment.