Skip to content

Commit

Permalink
Merge branch 'samsung/exynos-multiplatform-drivers' into late/multipl…
Browse files Browse the repository at this point in the history
…atform

This series contains the final pieces for Exynos multiplatform support:
Most of the patches are about the exynos-combiner irqchip, which is
converted to not rely on platform provided constants.

* samsung/exynos-multiplatform-drivers:
  ARM: exynos: restore mach/regs-clock.h for exynos5
  irqchip: exynos: look up irq using irq_find_mapping
  irqchip: exynos: pass irq_base from platform
  irqchip: exynos: localize irq lookup for ATAGS
  irqchip: exynos: allocate combiner_data dynamically
  irqchip: exynos: pass max combiner number to combiner_init
  ARM: exynos: add missing properties for combiner IRQs
  clocksource: exynos_mct: remove platform header dependency
  clk: exynos: prepare for multiplatform

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Apr 19, 2013
2 parents 22cf644 + 20adee8 commit 2254c36
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 137 deletions.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/exynos4210.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
};

combiner:interrupt-controller@10440000 {
samsung,combiner-nr = <16>;
interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
<0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
<0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/boot/dts/exynos4212.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
cpu-offset = <0x8000>;
};

interrupt-controller@10440000 {
samsung,combiner-nr = <18>;
interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
<0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
<0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
<0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
<0 107 0>, <0 108 0>;
};

mct@10050000 {
compatible = "samsung,exynos4412-mct";
reg = <0x10050000 0x800>;
Expand Down
9 changes: 9 additions & 0 deletions arch/arm/boot/dts/exynos4412.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@
cpu-offset = <0x4000>;
};

interrupt-controller@10440000 {
samsung,combiner-nr = <20>;
interrupts = <0 0 0>, <0 1 0>, <0 2 0>, <0 3 0>,
<0 4 0>, <0 5 0>, <0 6 0>, <0 7 0>,
<0 8 0>, <0 9 0>, <0 10 0>, <0 11 0>,
<0 12 0>, <0 13 0>, <0 14 0>, <0 15 0>,
<0 107 0>, <0 108 0>, <0 48 0>, <0 42 0>;
};

mct@10050000 {
compatible = "samsung,exynos4412-mct";
reg = <0x10050000 0x800>;
Expand Down
20 changes: 17 additions & 3 deletions arch/arm/mach-exynos/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,26 @@ void __init exynos_init_time(void)
} else {
/* todo: remove after migrating legacy E4 platforms to dt */
#ifdef CONFIG_ARCH_EXYNOS4
exynos4_clk_init(NULL);
exynos4_clk_init(NULL, !soc_is_exynos4210(), S5P_VA_CMU, readl(S5P_VA_CHIPID + 8) & 1);
exynos4_clk_register_fixed_ext(xxti_f, xusbxti_f);
#endif
mct_init();
mct_init(S5P_VA_SYSTIMER, EXYNOS4_IRQ_MCT_G0, EXYNOS4_IRQ_MCT_L0, EXYNOS4_IRQ_MCT_L1);
}
}

static unsigned int max_combiner_nr(void)
{
if (soc_is_exynos5250())
return EXYNOS5_MAX_COMBINER_NR;
else if (soc_is_exynos4412())
return EXYNOS4412_MAX_COMBINER_NR;
else if (soc_is_exynos4212())
return EXYNOS4212_MAX_COMBINER_NR;
else
return EXYNOS4210_MAX_COMBINER_NR;
}


void __init exynos4_init_irq(void)
{
unsigned int gic_bank_offset;
Expand All @@ -434,7 +447,8 @@ void __init exynos4_init_irq(void)
#endif

if (!of_have_populated_dt())
combiner_init(S5P_VA_COMBINER_BASE, NULL);
combiner_init(S5P_VA_COMBINER_BASE, NULL,
max_combiner_nr(), COMBINER_IRQ(0, 0));

/*
* The parameters of s5p_init_irq() are for VIC init.
Expand Down
7 changes: 4 additions & 3 deletions arch/arm/mach-exynos/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <linux/of.h>

extern void mct_init(void);
void mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1);
void exynos_init_time(void);
extern unsigned long xxti_f, xusbxti_f;

Expand All @@ -27,7 +27,7 @@ void exynos5_restart(char mode, const char *cmd);
void exynos_init_late(void);

/* ToDo: remove these after migrating legacy exynos4 platforms to dt */
void exynos4_clk_init(struct device_node *np);
void exynos4_clk_init(struct device_node *np, int is_exynos4210, void __iomem *reg_base, unsigned long xom);
void exynos4_clk_register_fixed_ext(unsigned long, unsigned long);

#ifdef CONFIG_PM_GENERIC_DOMAINS
Expand Down Expand Up @@ -69,7 +69,8 @@ void exynos4212_register_clocks(void);
#endif

struct device_node;
void combiner_init(void __iomem *combiner_base, struct device_node *np);
void combiner_init(void __iomem *combiner_base, struct device_node *np,
unsigned int max_nr, int irq_base);

extern struct smp_operations exynos_smp_ops;

Expand Down
93 changes: 42 additions & 51 deletions drivers/clk/samsung/clk-exynos4.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/of.h>
#include <linux/of_address.h>

#include <plat/cpu.h>
#include "clk.h"
#include "clk-pll.h"

Expand Down Expand Up @@ -910,50 +909,47 @@ struct samsung_gate_clock exynos4x12_gate_clks[] __initdata = {
CLK_IGNORE_UNUSED, 0),
};

#ifdef CONFIG_OF
static struct of_device_id exynos4_clk_ids[] __initdata = {
{ .compatible = "samsung,exynos4210-clock",
.data = (void *)EXYNOS4210, },
{ .compatible = "samsung,exynos4412-clock",
.data = (void *)EXYNOS4X12, },
{ },
};
#endif

/*
* The parent of the fin_pll clock is selected by the XOM[0] bit. This bit
* resides in chipid register space, outside of the clock controller memory
* mapped space. So to determine the parent of fin_pll clock, the chipid
* controller is first remapped and the value of XOM[0] bit is read to
* determine the parent clock.
*/
static void __init exynos4_clk_register_finpll(void)
static unsigned long exynos4_get_xom(void)
{
struct samsung_fixed_rate_clock fclk;
unsigned long xom = 0;
void __iomem *chipid_base;
struct device_node *np;
struct clk *clk;
void __iomem *chipid_base = S5P_VA_CHIPID;
unsigned long xom, finpll_f = 24000000;
char *parent_name;

np = of_find_compatible_node(NULL, NULL, "samsung,exynos4210-chipid");
if (np)
if (np) {
chipid_base = of_iomap(np, 0);

if (chipid_base) {
xom = readl(chipid_base + 8);
parent_name = xom & 1 ? "xusbxti" : "xxti";
clk = clk_get(NULL, parent_name);
if (IS_ERR(clk)) {
pr_err("%s: failed to lookup parent clock %s, assuming "
"fin_pll clock frequency is 24MHz\n", __func__,
parent_name);
} else {
finpll_f = clk_get_rate(clk);
}
if (chipid_base)
xom = readl(chipid_base + 8);

iounmap(chipid_base);
}

return xom;
}

static void __init exynos4_clk_register_finpll(unsigned long xom)
{
struct samsung_fixed_rate_clock fclk;
struct clk *clk;
unsigned long finpll_f = 24000000;
char *parent_name;

parent_name = xom & 1 ? "xusbxti" : "xxti";
clk = clk_get(NULL, parent_name);
if (IS_ERR(clk)) {
pr_err("%s: failed to lookup parent clock %s, assuming "
"fin_pll clock frequency is 24MHz\n", __func__,
parent_name);
} else {
pr_err("%s: failed to map chipid registers, assuming "
"fin_pll clock frequency is 24MHz\n", __func__);
finpll_f = clk_get_rate(clk);
}

fclk.id = fin_pll;
Expand All @@ -963,8 +959,6 @@ static void __init exynos4_clk_register_finpll(void)
fclk.fixed_rate = finpll_f;
samsung_clk_register_fixed_rate(&fclk, 1);

if (np)
iounmap(chipid_base);
}

/*
Expand All @@ -988,28 +982,14 @@ static __initdata struct of_device_id ext_clk_match[] = {
};

/* register exynos4 clocks */
void __init exynos4_clk_init(struct device_node *np)
void __init exynos4_clk_init(struct device_node *np, enum exynos4_soc exynos4_soc, void __iomem *reg_base, unsigned long xom)
{
void __iomem *reg_base;
struct clk *apll, *mpll, *epll, *vpll;
u32 exynos4_soc;

if (np) {
const struct of_device_id *match;
match = of_match_node(exynos4_clk_ids, np);
exynos4_soc = (u32)match->data;

reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
} else {
reg_base = S5P_VA_CMU;
if (soc_is_exynos4210())
exynos4_soc = EXYNOS4210;
else if (soc_is_exynos4212() || soc_is_exynos4412())
exynos4_soc = EXYNOS4X12;
else
panic("%s: unable to determine soc\n", __func__);
}

if (exynos4_soc == EXYNOS4210)
Expand All @@ -1026,7 +1006,7 @@ void __init exynos4_clk_init(struct device_node *np)
ARRAY_SIZE(exynos4_fixed_rate_ext_clks),
ext_clk_match);

exynos4_clk_register_finpll();
exynos4_clk_register_finpll(xom);

if (exynos4_soc == EXYNOS4210) {
apll = samsung_clk_register_pll45xx("fout_apll", "fin_pll",
Expand Down Expand Up @@ -1087,5 +1067,16 @@ void __init exynos4_clk_init(struct device_node *np)
_get_rate("sclk_epll"), _get_rate("sclk_vpll"),
_get_rate("arm_clk"));
}
CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4_clk_init);
CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4_clk_init);


static void __init exynos4210_clk_init(struct device_node *np)
{
exynos4_clk_init(np, EXYNOS4210, NULL, exynos4_get_xom());
}
CLK_OF_DECLARE(exynos4210_clk, "samsung,exynos4210-clock", exynos4210_clk_init);

static void __init exynos4412_clk_init(struct device_node *np)
{
exynos4_clk_init(np, EXYNOS4X12, NULL, exynos4_get_xom());
}
CLK_OF_DECLARE(exynos4412_clk, "samsung,exynos4412-clock", exynos4412_clk_init);
1 change: 0 additions & 1 deletion drivers/clk/samsung/clk-exynos5250.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/of.h>
#include <linux/of_address.h>

#include <plat/cpu.h>
#include "clk.h"
#include "clk-pll.h"

Expand Down
1 change: 0 additions & 1 deletion drivers/clk/samsung/clk-exynos5440.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <linux/of.h>
#include <linux/of_address.h>

#include <plat/cpu.h>
#include "clk.h"
#include "clk-pll.h"

Expand Down
2 changes: 0 additions & 2 deletions drivers/clk/samsung/clk.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#include <linux/of.h>
#include <linux/of_address.h>

#include <mach/map.h>

/**
* struct samsung_clock_alias: information about mux clock
* @id: platform specific id of the clock.
Expand Down
21 changes: 6 additions & 15 deletions drivers/clocksource/exynos_mct.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@

#include <asm/arch_timer.h>
#include <asm/localtimer.h>

#include <plat/cpu.h>

#include <mach/map.h>
#include <mach/irqs.h>
#include <asm/mach/time.h>

#define EXYNOS4_MCTREG(x) (x)
Expand Down Expand Up @@ -511,18 +506,14 @@ static void __init exynos4_timer_resources(struct device_node *np, void __iomem
#endif /* CONFIG_LOCAL_TIMERS */
}

void __init mct_init(void)
void __init mct_init(void __iomem *base, int irq_g0, int irq_l0, int irq_l1)
{
if (soc_is_exynos4210()) {
mct_irqs[MCT_G0_IRQ] = EXYNOS4_IRQ_MCT_G0;
mct_irqs[MCT_L0_IRQ] = EXYNOS4_IRQ_MCT_L0;
mct_irqs[MCT_L1_IRQ] = EXYNOS4_IRQ_MCT_L1;
mct_int_type = MCT_INT_SPI;
} else {
panic("unable to determine mct controller type\n");
}
mct_irqs[MCT_G0_IRQ] = irq_g0;
mct_irqs[MCT_L0_IRQ] = irq_l0;
mct_irqs[MCT_L1_IRQ] = irq_l1;
mct_int_type = MCT_INT_SPI;

exynos4_timer_resources(NULL, S5P_VA_SYSTIMER);
exynos4_timer_resources(NULL, base);
exynos4_clocksource_init();
exynos4_clockevent_init();
}
Expand Down
Loading

0 comments on commit 2254c36

Please sign in to comment.