cpu.c 3.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/* linux/arch/arm/plat-s5p/cpu.c
 *
 * Copyright (c) 2009 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * S5P CPU 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.
*/

#include <linux/init.h>
#include <linux/module.h>
#include <mach/map.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/regs-clock.h>
#include <plat/cpu.h>
#include <plat/s5p6440.h>
21
#include <plat/s5p6442.h>
22
#include <plat/s5p6450.h>
23
#include <plat/s5pc100.h>
24
#include <plat/s5pv210.h>
25
#include <plat/s5pv310.h>
26 27 28 29

/* table of supported CPUs */

static const char name_s5p6440[] = "S5P6440";
30
static const char name_s5p6442[] = "S5P6442";
31
static const char name_s5p6450[] = "S5P6450";
32
static const char name_s5pc100[] = "S5PC100";
33
static const char name_s5pv210[] = "S5PV210/S5PC110";
34
static const char name_s5pv310[] = "S5PV310";
35 36 37 38 39 40 41 42

static struct cpu_table cpu_ids[] __initdata = {
	{
		.idcode		= 0x56440100,
		.idmask		= 0xffffff00,
		.map_io		= s5p6440_map_io,
		.init_clocks	= s5p6440_init_clocks,
		.init_uarts	= s5p6440_init_uarts,
43
		.init		= s5p64x0_init,
44
		.name		= name_s5p6440,
45 46 47 48 49 50 51 52
	}, {
		.idcode		= 0x36442000,
		.idmask		= 0xffffff00,
		.map_io		= s5p6442_map_io,
		.init_clocks	= s5p6442_init_clocks,
		.init_uarts	= s5p6442_init_uarts,
		.init		= s5p6442_init,
		.name		= name_s5p6442,
53 54 55 56 57 58 59 60
	}, {
		.idcode		= 0x36450000,
		.idmask		= 0xffffff00,
		.map_io		= s5p6450_map_io,
		.init_clocks	= s5p6450_init_clocks,
		.init_uarts	= s5p6450_init_uarts,
		.init		= s5p64x0_init,
		.name		= name_s5p6450,
61 62 63 64 65 66 67 68
	}, {
		.idcode		= 0x43100000,
		.idmask		= 0xfffff000,
		.map_io		= s5pc100_map_io,
		.init_clocks	= s5pc100_init_clocks,
		.init_uarts	= s5pc100_init_uarts,
		.init		= s5pc100_init,
		.name		= name_s5pc100,
69 70 71 72 73 74 75 76
	}, {
		.idcode		= 0x43110000,
		.idmask		= 0xfffff000,
		.map_io		= s5pv210_map_io,
		.init_clocks	= s5pv210_init_clocks,
		.init_uarts	= s5pv210_init_uarts,
		.init		= s5pv210_init,
		.name		= name_s5pv210,
77 78 79 80 81 82 83 84
	}, {
		.idcode		= 0x43200000,
		.idmask		= 0xfffff000,
		.map_io		= s5pv310_map_io,
		.init_clocks	= s5pv310_init_clocks,
		.init_uarts	= s5pv310_init_uarts,
		.init		= s5pv310_init,
		.name		= name_s5pv310,
85 86 87 88 89 90 91
	},
};

/* minimal IO mapping */

static struct map_desc s5p_iodesc[] __initdata = {
	{
92 93 94 95 96 97
		.virtual	= (unsigned long)S5P_VA_CHIPID,
		.pfn		= __phys_to_pfn(S5P_PA_CHIPID),
		.length		= SZ_4K,
		.type		= MT_DEVICE,
	}, {
		.virtual	= (unsigned long)S3C_VA_SYS,
98 99 100 101
		.pfn		= __phys_to_pfn(S5P_PA_SYSCON),
		.length		= SZ_64K,
		.type		= MT_DEVICE,
	}, {
102
		.virtual	= (unsigned long)S3C_VA_TIMER,
103 104 105
		.pfn		= __phys_to_pfn(S5P_PA_TIMER),
		.length		= SZ_16K,
		.type		= MT_DEVICE,
106 107 108 109 110
	}, {
		.virtual	= (unsigned long)S3C_VA_WATCHDOG,
		.pfn		= __phys_to_pfn(S3C_PA_WDT),
		.length		= SZ_4K,
		.type		= MT_DEVICE,
111 112 113 114 115
	}, {
		.virtual	= (unsigned long)S5P_VA_SROMC,
		.pfn		= __phys_to_pfn(S5P_PA_SROMC),
		.length		= SZ_4K,
		.type		= MT_DEVICE,
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
	},
};

/* read cpu identification code */

void __init s5p_init_io(struct map_desc *mach_desc,
			int size, void __iomem *cpuid_addr)
{
	unsigned long idcode;

	/* initialize the io descriptors we need for initialization */
	iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
	if (mach_desc)
		iotable_init(mach_desc, size);

	idcode = __raw_readl(cpuid_addr);
	s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
}