2011-02-14 15:33:10 +08:00
|
|
|
/* linux/arch/arm/mach-exynos4/cpu.c
|
2010-07-26 20:08:52 +08:00
|
|
|
*
|
2011-02-14 15:33:10 +08:00
|
|
|
* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
|
|
|
|
* http://www.samsung.com
|
2010-07-26 20:08:52 +08:00
|
|
|
*
|
|
|
|
* 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/sched.h>
|
|
|
|
#include <linux/sysdev.h>
|
|
|
|
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
|
|
|
#include <asm/proc-fns.h>
|
2010-10-21 14:22:36 +08:00
|
|
|
#include <asm/hardware/cache-l2x0.h>
|
2010-07-26 20:08:52 +08:00
|
|
|
|
|
|
|
#include <plat/cpu.h>
|
|
|
|
#include <plat/clock.h>
|
2011-02-14 15:33:10 +08:00
|
|
|
#include <plat/exynos4.h>
|
2010-10-05 18:07:41 +08:00
|
|
|
#include <plat/sdhci.h>
|
2011-03-12 07:58:01 +08:00
|
|
|
#include <plat/devs.h>
|
|
|
|
#include <plat/fimc-core.h>
|
2010-07-26 20:08:52 +08:00
|
|
|
|
|
|
|
#include <mach/regs-irq.h>
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
/* Initial IO mappings */
|
2011-02-14 15:33:10 +08:00
|
|
|
static struct map_desc exynos4_iodesc[] __initdata = {
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
2011-03-11 09:39:35 +08:00
|
|
|
.virtual = (unsigned long)S5P_VA_SYSTIMER,
|
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_SYSTIMER),
|
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
}, {
|
2010-08-31 15:30:51 +08:00
|
|
|
.virtual = (unsigned long)S5P_VA_SYSRAM,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM),
|
2010-08-31 15:30:51 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_CMU,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
|
2010-08-31 15:30:51 +08:00
|
|
|
.length = SZ_128K,
|
2010-07-26 20:08:52 +08:00
|
|
|
.type = MT_DEVICE,
|
2010-12-03 16:15:40 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_PMU,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_PMU),
|
2010-12-03 16:15:40 +08:00
|
|
|
.length = SZ_64K,
|
|
|
|
.type = MT_DEVICE,
|
2010-07-26 20:08:52 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_COMBINER_BASE,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_COMBINER),
|
2010-07-26 20:08:52 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
2010-08-31 15:30:51 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_COREPERI_BASE,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI),
|
2010-08-31 15:30:51 +08:00
|
|
|
.length = SZ_8K,
|
|
|
|
.type = MT_DEVICE,
|
2010-07-26 20:08:52 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_L2CC,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_L2CC),
|
2010-07-26 20:08:52 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
2010-08-27 16:57:44 +08:00
|
|
|
}, {
|
2010-10-14 14:46:18 +08:00
|
|
|
.virtual = (unsigned long)S5P_VA_GPIO1,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_GPIO1),
|
2010-08-27 16:57:44 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
2010-10-14 14:46:18 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_GPIO2,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_GPIO2),
|
2010-10-14 14:46:18 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_GPIO3,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_GPIO3),
|
2010-10-14 14:46:18 +08:00
|
|
|
.length = SZ_256,
|
|
|
|
.type = MT_DEVICE,
|
2010-12-22 06:21:17 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_DMC0,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_DMC0),
|
2010-12-22 06:21:17 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
2010-08-18 20:45:49 +08:00
|
|
|
}, {
|
2010-08-31 15:30:51 +08:00
|
|
|
.virtual = (unsigned long)S3C_VA_UART,
|
|
|
|
.pfn = __phys_to_pfn(S3C_PA_UART),
|
|
|
|
.length = SZ_512K,
|
2010-08-18 20:45:49 +08:00
|
|
|
.type = MT_DEVICE,
|
2010-10-25 15:30:40 +08:00
|
|
|
}, {
|
|
|
|
.virtual = (unsigned long)S5P_VA_SROMC,
|
2011-02-14 15:33:10 +08:00
|
|
|
.pfn = __phys_to_pfn(EXYNOS4_PA_SROMC),
|
2010-10-25 15:30:40 +08:00
|
|
|
.length = SZ_4K,
|
|
|
|
.type = MT_DEVICE,
|
2010-08-27 16:57:44 +08:00
|
|
|
},
|
2010-07-26 20:08:52 +08:00
|
|
|
};
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
static void exynos4_idle(void)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
|
|
|
if (!need_resched())
|
|
|
|
cpu_do_idle();
|
|
|
|
|
|
|
|
local_irq_enable();
|
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
/*
|
|
|
|
* exynos4_map_io
|
2010-07-26 20:08:52 +08:00
|
|
|
*
|
|
|
|
* register the standard cpu IO areas
|
2011-02-14 15:33:10 +08:00
|
|
|
*/
|
|
|
|
void __init exynos4_map_io(void)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
2011-02-14 15:33:10 +08:00
|
|
|
iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
|
2010-10-05 18:07:41 +08:00
|
|
|
|
|
|
|
/* initialize device information early */
|
2011-02-14 15:33:10 +08:00
|
|
|
exynos4_default_sdhci0();
|
|
|
|
exynos4_default_sdhci1();
|
|
|
|
exynos4_default_sdhci2();
|
|
|
|
exynos4_default_sdhci3();
|
2011-03-12 07:58:01 +08:00
|
|
|
|
|
|
|
s3c_fimc_setname(0, "exynos4-fimc");
|
|
|
|
s3c_fimc_setname(1, "exynos4-fimc");
|
|
|
|
s3c_fimc_setname(2, "exynos4-fimc");
|
|
|
|
s3c_fimc_setname(3, "exynos4-fimc");
|
2010-07-26 20:08:52 +08:00
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
void __init exynos4_init_clocks(int xtal)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
|
|
|
printk(KERN_DEBUG "%s: initializing clocks\n", __func__);
|
|
|
|
|
|
|
|
s3c24xx_register_baseclocks(xtal);
|
|
|
|
s5p_register_clocks(xtal);
|
2011-02-14 15:33:10 +08:00
|
|
|
exynos4_register_clocks();
|
|
|
|
exynos4_setup_clocks();
|
2010-07-26 20:08:52 +08:00
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
void __init exynos4_init_irq(void)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
|
|
|
int irq;
|
|
|
|
|
2010-12-04 23:55:14 +08:00
|
|
|
gic_init(0, IRQ_LOCALTIMER, S5P_VA_GIC_DIST, S5P_VA_GIC_CPU);
|
2010-07-26 20:08:52 +08:00
|
|
|
|
|
|
|
for (irq = 0; irq < MAX_COMBINER_NR; irq++) {
|
2010-11-29 16:04:46 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* From SPI(0) to SPI(39) and SPI(51), SPI(53) are
|
|
|
|
* connected to the interrupt combiner. These irqs
|
|
|
|
* should be initialized to support cascade interrupt.
|
|
|
|
*/
|
|
|
|
if ((irq >= 40) && !(irq == 51) && !(irq == 53))
|
|
|
|
continue;
|
|
|
|
|
2010-07-26 20:08:52 +08:00
|
|
|
combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
|
|
|
|
COMBINER_IRQ(irq, 0));
|
|
|
|
combiner_cascade_irq(irq, IRQ_SPI(irq));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The parameters of s5p_init_irq() are for VIC init.
|
2011-02-14 15:33:10 +08:00
|
|
|
* Theses parameters should be NULL and 0 because EXYNOS4
|
2010-07-26 20:08:52 +08:00
|
|
|
* uses GIC instead of VIC.
|
|
|
|
*/
|
|
|
|
s5p_init_irq(NULL, 0);
|
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
struct sysdev_class exynos4_sysclass = {
|
|
|
|
.name = "exynos4-core",
|
2010-07-26 20:08:52 +08:00
|
|
|
};
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
static struct sys_device exynos4_sysdev = {
|
|
|
|
.cls = &exynos4_sysclass,
|
2010-07-26 20:08:52 +08:00
|
|
|
};
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
static int __init exynos4_core_init(void)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
2011-02-14 15:33:10 +08:00
|
|
|
return sysdev_class_register(&exynos4_sysclass);
|
2010-07-26 20:08:52 +08:00
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
core_initcall(exynos4_core_init);
|
2010-07-26 20:08:52 +08:00
|
|
|
|
2010-10-21 14:22:36 +08:00
|
|
|
#ifdef CONFIG_CACHE_L2X0
|
2011-02-14 15:33:10 +08:00
|
|
|
static int __init exynos4_l2x0_cache_init(void)
|
2010-10-21 14:22:36 +08:00
|
|
|
{
|
|
|
|
/* TAG, Data Latency Control: 2cycle */
|
|
|
|
__raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
|
|
|
|
__raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
|
|
|
|
|
|
|
|
/* L2X0 Prefetch Control */
|
|
|
|
__raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
|
|
|
|
|
|
|
|
/* L2X0 Power Control */
|
|
|
|
__raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
|
|
|
|
S5P_VA_L2CC + L2X0_POWER_CTRL);
|
|
|
|
|
2010-11-26 12:21:53 +08:00
|
|
|
l2x0_init(S5P_VA_L2CC, 0x7C470001, 0xC200ffff);
|
2010-10-21 14:22:36 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
early_initcall(exynos4_l2x0_cache_init);
|
2010-10-21 14:22:36 +08:00
|
|
|
#endif
|
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
int __init exynos4_init(void)
|
2010-07-26 20:08:52 +08:00
|
|
|
{
|
2011-02-14 15:33:10 +08:00
|
|
|
printk(KERN_INFO "EXYNOS4: Initializing architecture\n");
|
2010-07-26 20:08:52 +08:00
|
|
|
|
|
|
|
/* set idle function */
|
2011-02-14 15:33:10 +08:00
|
|
|
pm_idle = exynos4_idle;
|
2010-07-26 20:08:52 +08:00
|
|
|
|
2011-02-14 15:33:10 +08:00
|
|
|
return sysdev_register(&exynos4_sysdev);
|
2010-07-26 20:08:52 +08:00
|
|
|
}
|