Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 209fecd1 authored by Kukjin Kim's avatar Kukjin Kim Committed by Ben Dooks
Browse files

ARM: S5P6440: Add new CPU initialization support



This patch adds Samsung's S5P6440 CPU support.

Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
Signed-off-by: default avatarBen Dooks <ben-linux@fluff.org>
parent be97162d
Loading
Loading
Loading
Loading
+114 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/mach-s5p6440/cpu.c
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * 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/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/sysdev.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>

#include <asm/proc-fns.h>

#include <mach/hardware.h>
#include <mach/map.h>
#include <asm/irq.h>

#include <plat/regs-serial.h>
#include <mach/regs-clock.h>

#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/clock.h>
#include <plat/s5p6440.h>

static void s5p6440_idle(void)
{
	unsigned long val;

	if (!need_resched()) {
		val = __raw_readl(S5P_PWR_CFG);
		val &= ~(0x3<<5);
		val |= (0x1<<5);
		__raw_writel(val, S5P_PWR_CFG);

		cpu_do_idle();
	}
	local_irq_enable();
}

/* s5p6440_map_io
 *
 * register the standard cpu IO areas
*/

void __init s5p6440_map_io(void)
{
	/* initialize any device information early */
}

void __init s5p6440_init_clocks(int xtal)
{
	printk(KERN_DEBUG "%s: initializing clocks\n", __func__);

	s3c24xx_register_baseclocks(xtal);
	s5p_register_clocks(xtal);
	s5p6440_register_clocks();
	s5p6440_setup_clocks();
}

void __init s5p6440_init_irq(void)
{
	/* S5P6440 supports only 2 VIC */
	u32 vic[2];

	/*
	 * VIC0 is missing IRQ_VIC0[3, 4, 8, 10, (12-22)]
	 * VIC1 is missing IRQ VIC1[1, 3, 4, 10, 11, 12, 14, 15, 22]
	 */
	vic[0] = 0xff800ae7;
	vic[1] = 0xffbf23e5;

	s5p_init_irq(vic, ARRAY_SIZE(vic));
}

static struct sysdev_class s5p6440_sysclass = {
	.name	= "s5p6440-core",
};

static struct sys_device s5p6440_sysdev = {
	.cls	= &s5p6440_sysclass,
};

static int __init s5p6440_core_init(void)
{
	return sysdev_class_register(&s5p6440_sysclass);
}

core_initcall(s5p6440_core_init);

int __init s5p6440_init(void)
{
	printk(KERN_INFO "S5P6440: Initializing architecture\n");

	/* set idle function */
	pm_idle = s5p6440_idle;

	return sysdev_register(&s5p6440_sysdev);
}
+37 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/mach-s5p6440/include/mach/debug-macro.S
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * 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.
*/

/* pull in the relevant register and map files. */

#include <mach/map.h>
#include <plat/regs-serial.h>

	/* note, for the boot process to work we have to keep the UART
	 * virtual address aligned to an 1MiB boundary for the L1
	 * mapping the head code makes. We keep the UART virtual address
	 * aligned and add in the offset when we load the value here.
	 */

	.macro addruart, rx
		mrc	p15, 0, \rx, c1, c0
		tst	\rx, #1
		ldreq	\rx, = S5P_PA_UART
		ldrne	\rx, = (S5P_VA_UART + S5P_PA_UART & 0xfffff)
#if CONFIG_DEBUG_S3C_UART != 0
		add	\rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
#endif
	.endm

/* include the reset of the code which will do the work, we're only
 * compiling for a single cpu processor type so the default of s3c2440
 * will be fine with us.
 */

#include <plat/debug-macro.S>
+16 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/mach-s5p6440/include/mach/entry-macro.S
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * Low-level IRQ helper macros for the Samsung S5P6440
 *
 * 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 <mach/map.h>
#include <plat/irqs.h>

#include <asm/entry-macro-vic2.S>
+19 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/mach-s5p6440/include/mach/gpio-core.h
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * S5P6440 - GPIO core 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.
*/

#ifndef __ASM_ARCH_GPIO_CORE_H
#define __ASM_ARCH_GPIO_CORE_H __FILE__

/* currently we just include the platform support */
#include <plat/gpio-core.h>

#endif /* __ASM_ARCH_GPIO_CORE_H */
+80 −0
Original line number Original line Diff line number Diff line
/* linux/arch/arm/mach-s5p6440/include/mach/gpio.h
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * S5P6440 - GPIO lib 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.
*/

#ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H __FILE__

#define gpio_get_value	__gpio_get_value
#define gpio_set_value	__gpio_set_value
#define gpio_cansleep	__gpio_cansleep
#define gpio_to_irq	__gpio_to_irq

/* GPIO bank sizes */
#define S5P6440_GPIO_A_NR	(6)
#define S5P6440_GPIO_B_NR	(7)
#define S5P6440_GPIO_C_NR	(8)
#define S5P6440_GPIO_F_NR	(2)
#define S5P6440_GPIO_G_NR	(7)
#define S5P6440_GPIO_H_NR	(10)
#define S5P6440_GPIO_I_NR	(16)
#define S5P6440_GPIO_J_NR	(12)
#define S5P6440_GPIO_N_NR	(16)
#define S5P6440_GPIO_P_NR	(8)
#define S5P6440_GPIO_R_NR	(15)

/* GPIO bank numbers */

/* CONFIG_S3C_GPIO_SPACE allows the user to select extra
 * space for debugging purposes so that any accidental
 * change from one gpio bank to another can be caught.
*/
#define S5P6440_GPIO_NEXT(__gpio) \
	((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)

enum s5p_gpio_number {
	S5P6440_GPIO_A_START = 0,
	S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A),
	S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B),
	S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C),
	S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F),
	S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G),
	S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H),
	S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I),
	S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J),
	S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N),
	S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P),
};

/* S5P6440 GPIO number definitions. */
#define S5P6440_GPA(_nr)	(S5P6440_GPIO_A_START + (_nr))
#define S5P6440_GPB(_nr)	(S5P6440_GPIO_B_START + (_nr))
#define S5P6440_GPC(_nr)	(S5P6440_GPIO_C_START + (_nr))
#define S5P6440_GPF(_nr)	(S5P6440_GPIO_F_START + (_nr))
#define S5P6440_GPG(_nr)	(S5P6440_GPIO_G_START + (_nr))
#define S5P6440_GPH(_nr)	(S5P6440_GPIO_H_START + (_nr))
#define S5P6440_GPI(_nr)	(S5P6440_GPIO_I_START + (_nr))
#define S5P6440_GPJ(_nr)	(S5P6440_GPIO_J_START + (_nr))
#define S5P6440_GPN(_nr)	(S5P6440_GPIO_N_START + (_nr))
#define S5P6440_GPP(_nr)	(S5P6440_GPIO_P_START + (_nr))
#define S5P6440_GPR(_nr)	(S5P6440_GPIO_R_START + (_nr))

/* the end of the S5P6440 specific gpios */
#define S5P6440_GPIO_END	(S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
#define S3C_GPIO_END		S5P6440_GPIO_END

/* define the number of gpios we need to the one after the GPR() range */
#define ARCH_NR_GPIOS		(S5P6440_GPR(S5P6440_GPIO_R_NR) +	\
				 CONFIG_SAMSUNG_GPIO_EXTRA + 1)

#include <asm-generic/gpio.h>

#endif /* __ASM_ARCH_GPIO_H */
Loading