Skip to content

Commit

Permalink
ARM: EXYNOS4: Add functions for gic interrupt handling
Browse files Browse the repository at this point in the history
This patch adds two functions for gic interrupt handling.
1. Add interrupt handling of 4 cores.
2. Dynamically set gic bank offset according to the type of soc.
   Gic bank offset of EXYNOS4412 is 0x4000 while the offset of
   EXYNOS4210 and EXYNOS4212 is 0x8000.

This patch is necessary because EXYNOS4 socs cannot support
GIC register banking as described in commit aab74d3.

Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
  • Loading branch information
Changhwan Youn authored and Kukjin Kim committed Oct 4, 2011
1 parent b88b1cc commit 90a454b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
8 changes: 6 additions & 2 deletions arch/arm/mach-exynos4/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include <mach/regs-irq.h>
#include <mach/regs-pmu.h>

unsigned int gic_bank_offset __read_mostly;

extern int combiner_init(unsigned int combiner_nr, void __iomem *base,
unsigned int irq_start);
extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq);
Expand Down Expand Up @@ -203,16 +205,18 @@ static void exynos4_gic_irq_fix_base(struct irq_data *d)
struct gic_chip_data *gic_data = irq_data_get_irq_chip_data(d);

gic_data->cpu_base = S5P_VA_GIC_CPU +
(EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
(gic_bank_offset * smp_processor_id());

gic_data->dist_base = S5P_VA_GIC_DIST +
(EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
(gic_bank_offset * smp_processor_id());
}

void __init exynos4_init_irq(void)
{
int irq;

gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000;

gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
gic_arch_extn.irq_eoi = exynos4_gic_irq_fix_base;
gic_arch_extn.irq_unmask = exynos4_gic_irq_fix_base;
Expand Down
23 changes: 18 additions & 5 deletions arch/arm/mach-exynos4/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,25 @@
.endm

.macro get_irqnr_preamble, base, tmp
ldr \base, =gic_cpu_base_addr
mov \tmp, #0

mrc p15, 0, \base, c0, c0, 5
and \base, \base, #3
cmp \base, #0
beq 1f

ldr \tmp, =gic_bank_offset
ldr \tmp, [\tmp]
cmp \base, #1
beq 1f

cmp \base, #2
addeq \tmp, \tmp, \tmp
addne \tmp, \tmp, \tmp, LSL #1

1: ldr \base, =gic_cpu_base_addr
ldr \base, [\base]
mrc p15, 0, \tmp, c0, c0, 5
and \tmp, \tmp, #3
cmp \tmp, #1
addeq \base, \base, #EXYNOS4_GIC_BANK_OFFSET
add \base, \base, \tmp
.endm

.macro arch_ret_to_user, tmp1, tmp2
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-exynos4/include/mach/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

#define EXYNOS4_PA_GIC_CPU 0x10480000
#define EXYNOS4_PA_GIC_DIST 0x10490000
#define EXYNOS4_GIC_BANK_OFFSET 0x8000

#define EXYNOS4_PA_COREPERI 0x10500000
#define EXYNOS4_PA_TWD 0x10500600
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/mach-exynos4/platsmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <plat/cpu.h>

extern unsigned int gic_bank_offset;
extern void exynos4_secondary_startup(void);

#define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
Expand Down Expand Up @@ -67,9 +68,9 @@ static DEFINE_SPINLOCK(boot_lock);
static void __cpuinit exynos4_gic_secondary_init(void)
{
void __iomem *dist_base = S5P_VA_GIC_DIST +
(EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
(gic_bank_offset * smp_processor_id());
void __iomem *cpu_base = S5P_VA_GIC_CPU +
(EXYNOS4_GIC_BANK_OFFSET * smp_processor_id());
(gic_bank_offset * smp_processor_id());
int i;

/*
Expand Down

0 comments on commit 90a454b

Please sign in to comment.