Skip to content

Commit

Permalink
ARM: S5P6442: Add Samsung S5P6442 CPU support
Browse files Browse the repository at this point in the history
This patch adds support for Samsung S5P6442 CPU. This patch also adds
an entry for S5P6442 cpu in plat-s5p cpu table.

Signed-off-by: Adityapratap Sharma <aditya.ps@samsung.com>
Signed-off-by: Atul Dahiya <atul.dahiya@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Kukjin Kim authored and Ben Dooks committed Feb 24, 2010
1 parent a0af8b3 commit 5f7f6a4
Show file tree
Hide file tree
Showing 17 changed files with 617 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arch/arm/mach-s5p6442/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# arch/arm/mach-s5p6442/Kconfig
#
# Copyright (c) 2010 Samsung Electronics Co., Ltd.
# http://www.samsung.com/
#
# Licensed under GPLv2

# Configuration options for the S5P6442

if ARCH_S5P6442

config CPU_S5P6442
bool
select PLAT_S5P
help
Enable S5P6442 CPU support

config MACH_SMDK6442
bool "SMDK6442"
select CPU_S5P6442
help
Machine support for Samsung SMDK6442

endif
18 changes: 18 additions & 0 deletions arch/arm/mach-s5p6442/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# arch/arm/mach-s5p6442/Makefile
#
# Copyright (c) 2010 Samsung Electronics Co., Ltd.
# http://www.samsung.com/
#
# Licensed under GPLv2

obj-y :=
obj-m :=
obj-n :=
obj- :=

# Core support for S5P6442 system

obj-$(CONFIG_CPU_S5P6442) += cpu.o init.o

# machine support

2 changes: 2 additions & 0 deletions arch/arm/mach-s5p6442/Makefile.boot
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zreladdr-y := 0x20008000
params_phys-y := 0x20000100
121 changes: 121 additions & 0 deletions arch/arm/mach-s5p6442/cpu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/* linux/arch/arm/mach-s5p6442/cpu.c
*
* Copyright (c) 2010 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/s5p6442.h>

/* Initial IO mappings */

static struct map_desc s5p6442_iodesc[] __initdata = {
{
.virtual = (unsigned long)S5P_VA_SYSTIMER,
.pfn = __phys_to_pfn(S5P6442_PA_SYSTIMER),
.length = SZ_16K,
.type = MT_DEVICE,
}, {
.virtual = (unsigned long)VA_VIC2,
.pfn = __phys_to_pfn(S5P6442_PA_VIC2),
.length = SZ_16K,
.type = MT_DEVICE,
}
};

static void s5p6442_idle(void)
{
if (!need_resched())
cpu_do_idle();

local_irq_enable();
}

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

void __init s5p6442_map_io(void)
{
iotable_init(s5p6442_iodesc, ARRAY_SIZE(s5p6442_iodesc));
}

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

s3c24xx_register_baseclocks(xtal);
s5p_register_clocks(xtal);
s5p6442_register_clocks();
s5p6442_setup_clocks();
}

void __init s5p6442_init_irq(void)
{
/* S5P6442 supports 3 VIC */
u32 vic[3];

/* VIC0, VIC1, and VIC2: some interrupt reserved */
vic[0] = 0x7fefffff;
vic[1] = 0X7f389c81;
vic[2] = 0X1bbbcfff;

s5p_init_irq(vic, ARRAY_SIZE(vic));
}

static struct sysdev_class s5p6442_sysclass = {
.name = "s5p6442-core",
};

static struct sys_device s5p6442_sysdev = {
.cls = &s5p6442_sysclass,
};

static int __init s5p6442_core_init(void)
{
return sysdev_class_register(&s5p6442_sysclass);
}

core_initcall(s5p6442_core_init);

int __init s5p6442_init(void)
{
printk(KERN_INFO "S5P6442: Initializing architecture\n");

/* set idle function */
pm_idle = s5p6442_idle;

return sysdev_register(&s5p6442_sysdev);
}
36 changes: 36 additions & 0 deletions arch/arm/mach-s5p6442/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/* linux/arch/arm/mach-s5p6442/include/mach/debug-macro.S
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Based on arch/arm/mach-s3c6400/include/mach/debug-macro.S
*
* 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>

.macro addruart, rx
mrc p15, 0, \rx, c1, c0
tst \rx, #1
ldreq \rx, = S3C_PA_UART
ldrne \rx, = S3C_VA_UART
#if CONFIG_DEBUG_S3C_UART != 0
add \rx, \rx, #(0x400 * CONFIG_DEBUG_S3C_UART)
#endif
.endm

#define fifo_full fifo_full_s5pv210
#define fifo_level fifo_level_s5pv210

/* 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>
48 changes: 48 additions & 0 deletions arch/arm/mach-s5p6442/include/mach/entry-macro.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* linux/arch/arm/mach-s5p6442/include/mach/entry-macro.S
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* Low-level IRQ helper macros for the Samsung S5P6442
*
* 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 <asm/hardware/vic.h>
#include <mach/map.h>
#include <plat/irqs.h>

.macro disable_fiq
.endm

.macro get_irqnr_preamble, base, tmp
ldr \base, =VA_VIC0
.endm

.macro arch_ret_to_user, tmp1, tmp2
.endm

.macro get_irqnr_and_base, irqnr, irqstat, base, tmp

@ check the vic0
mov \irqnr, # S5P_IRQ_OFFSET + 31
ldr \irqstat, [ \base, # VIC_IRQ_STATUS ]
teq \irqstat, #0

@ otherwise try vic1
addeq \tmp, \base, #(VA_VIC1 - VA_VIC0)
addeq \irqnr, \irqnr, #32
ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
teqeq \irqstat, #0

@ otherwise try vic2
addeq \tmp, \base, #(VA_VIC2 - VA_VIC0)
addeq \irqnr, \irqnr, #32
ldreq \irqstat, [ \tmp, # VIC_IRQ_STATUS ]
teqeq \irqstat, #0

clzne \irqstat, \irqstat
subne \irqnr, \irqnr, \irqstat
.endm
123 changes: 123 additions & 0 deletions arch/arm/mach-s5p6442/include/mach/gpio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/* linux/arch/arm/mach-s5p6442/include/mach/gpio.h
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* S5P6442 - 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 S5P6442_GPIO_A0_NR (8)
#define S5P6442_GPIO_A1_NR (2)
#define S5P6442_GPIO_B_NR (4)
#define S5P6442_GPIO_C0_NR (5)
#define S5P6442_GPIO_C1_NR (5)
#define S5P6442_GPIO_D0_NR (2)
#define S5P6442_GPIO_D1_NR (6)
#define S5P6442_GPIO_E0_NR (8)
#define S5P6442_GPIO_E1_NR (5)
#define S5P6442_GPIO_F0_NR (8)
#define S5P6442_GPIO_F1_NR (8)
#define S5P6442_GPIO_F2_NR (8)
#define S5P6442_GPIO_F3_NR (6)
#define S5P6442_GPIO_G0_NR (7)
#define S5P6442_GPIO_G1_NR (7)
#define S5P6442_GPIO_G2_NR (7)
#define S5P6442_GPIO_H0_NR (8)
#define S5P6442_GPIO_H1_NR (8)
#define S5P6442_GPIO_H2_NR (8)
#define S5P6442_GPIO_H3_NR (8)
#define S5P6442_GPIO_J0_NR (8)
#define S5P6442_GPIO_J1_NR (6)
#define S5P6442_GPIO_J2_NR (8)
#define S5P6442_GPIO_J3_NR (8)
#define S5P6442_GPIO_J4_NR (5)

/* 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 S5P6442_GPIO_NEXT(__gpio) \
((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)

enum s5p_gpio_number {
S5P6442_GPIO_A0_START = 0,
S5P6442_GPIO_A1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A0),
S5P6442_GPIO_B_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_A1),
S5P6442_GPIO_C0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_B),
S5P6442_GPIO_C1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C0),
S5P6442_GPIO_D0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_C1),
S5P6442_GPIO_D1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D0),
S5P6442_GPIO_E0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_D1),
S5P6442_GPIO_E1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E0),
S5P6442_GPIO_F0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_E1),
S5P6442_GPIO_F1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F0),
S5P6442_GPIO_F2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F1),
S5P6442_GPIO_F3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F2),
S5P6442_GPIO_G0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_F3),
S5P6442_GPIO_G1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G0),
S5P6442_GPIO_G2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G1),
S5P6442_GPIO_H0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_G2),
S5P6442_GPIO_H1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H0),
S5P6442_GPIO_H2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H1),
S5P6442_GPIO_H3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H2),
S5P6442_GPIO_J0_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_H3),
S5P6442_GPIO_J1_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J0),
S5P6442_GPIO_J2_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J1),
S5P6442_GPIO_J3_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J2),
S5P6442_GPIO_J4_START = S5P6442_GPIO_NEXT(S5P6442_GPIO_J3),
};

/* S5P6442 GPIO number definitions. */
#define S5P6442_GPA0(_nr) (S5P6442_GPIO_A0_START + (_nr))
#define S5P6442_GPA1(_nr) (S5P6442_GPIO_A1_START + (_nr))
#define S5P6442_GPB(_nr) (S5P6442_GPIO_B_START + (_nr))
#define S5P6442_GPC0(_nr) (S5P6442_GPIO_C0_START + (_nr))
#define S5P6442_GPC1(_nr) (S5P6442_GPIO_C1_START + (_nr))
#define S5P6442_GPD0(_nr) (S5P6442_GPIO_D0_START + (_nr))
#define S5P6442_GPD1(_nr) (S5P6442_GPIO_D1_START + (_nr))
#define S5P6442_GPE0(_nr) (S5P6442_GPIO_E0_START + (_nr))
#define S5P6442_GPE1(_nr) (S5P6442_GPIO_E1_START + (_nr))
#define S5P6442_GPF0(_nr) (S5P6442_GPIO_F0_START + (_nr))
#define S5P6442_GPF1(_nr) (S5P6442_GPIO_F1_START + (_nr))
#define S5P6442_GPF2(_nr) (S5P6442_GPIO_F2_START + (_nr))
#define S5P6442_GPF3(_nr) (S5P6442_GPIO_F3_START + (_nr))
#define S5P6442_GPG0(_nr) (S5P6442_GPIO_G0_START + (_nr))
#define S5P6442_GPG1(_nr) (S5P6442_GPIO_G1_START + (_nr))
#define S5P6442_GPG2(_nr) (S5P6442_GPIO_G2_START + (_nr))
#define S5P6442_GPH0(_nr) (S5P6442_GPIO_H0_START + (_nr))
#define S5P6442_GPH1(_nr) (S5P6442_GPIO_H1_START + (_nr))
#define S5P6442_GPH2(_nr) (S5P6442_GPIO_H2_START + (_nr))
#define S5P6442_GPH3(_nr) (S5P6442_GPIO_H3_START + (_nr))
#define S5P6442_GPJ0(_nr) (S5P6442_GPIO_J0_START + (_nr))
#define S5P6442_GPJ1(_nr) (S5P6442_GPIO_J1_START + (_nr))
#define S5P6442_GPJ2(_nr) (S5P6442_GPIO_J2_START + (_nr))
#define S5P6442_GPJ3(_nr) (S5P6442_GPIO_J3_START + (_nr))
#define S5P6442_GPJ4(_nr) (S5P6442_GPIO_J4_START + (_nr))

/* the end of the S5P6442 specific gpios */
#define S5P6442_GPIO_END (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + 1)
#define S3C_GPIO_END S5P6442_GPIO_END

/* define the number of gpios we need to the one after the GPJ4() range */
#define ARCH_NR_GPIOS (S5P6442_GPJ4(S5P6442_GPIO_J4_NR) + \
CONFIG_SAMSUNG_GPIO_EXTRA + 1)

#include <asm-generic/gpio.h>

#endif /* __ASM_ARCH_GPIO_H */
18 changes: 18 additions & 0 deletions arch/arm/mach-s5p6442/include/mach/hardware.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* linux/arch/arm/mach-s5p6442/include/mach/hardware.h
*
* Copyright (c) 2010 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*
* S5P6442 - Hardware 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_HARDWARE_H
#define __ASM_ARCH_HARDWARE_H __FILE__

/* currently nothing here, placeholder */

#endif /* __ASM_ARCH_HARDWARE_H */
Loading

0 comments on commit 5f7f6a4

Please sign in to comment.