aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-exynos/dev-c2c.c
blob: 1b77a8e1c593c793de7238f4de10ff81c44d3fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* linux/arch/arm/mach-exynos/dev-c2c.c
 *
 * Copyright (c) 2011 Samsung Electronics
 *
 * Base EXYNOS C2C resource and device definitions
 *
 * 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/interrupt.h>
#include <linux/platform_device.h>
#include <linux/ioport.h>
#include <linux/dma-mapping.h>

#include <mach/map.h>
#include <mach/regs-pmu.h>
#include <mach/regs-pmu5.h>
#include <mach/c2c.h>
#include <plat/irqs.h>
#include <plat/cpu.h>

static struct resource exynos_c2c_resource[] = {
	[0] = {
		.start  = EXYNOS_PA_C2C,
		.end    = EXYNOS_PA_C2C + SZ_64K - 1,
		.flags  = IORESOURCE_MEM,
	},
	[1] = {
		.start  = EXYNOS_PA_C2C_CP,
		.end    = EXYNOS_PA_C2C_CP + SZ_64K - 1,
		.flags  = IORESOURCE_MEM,
	},
	[2] = {
		.start  = IRQ_C2C_SSCM0,
		.end    = IRQ_C2C_SSCM0,
		.flags  = IORESOURCE_IRQ,
	},
	[3] = {
		.start  = IRQ_C2C_SSCM1,
		.end    = IRQ_C2C_SSCM1,
		.flags  = IORESOURCE_IRQ,
	},
};

static u64 exynos_c2c_dma_mask = DMA_BIT_MASK(32);

struct platform_device exynos_device_c2c = {
	.name		= "samsung-c2c",
	.id		= -1,
	.num_resources	= ARRAY_SIZE(exynos_c2c_resource),
	.resource	= exynos_c2c_resource,
	.dev		= {
		.dma_mask		= &exynos_c2c_dma_mask,
		.coherent_dma_mask	= DMA_BIT_MASK(32),
	},
};

void __init exynos_c2c_set_platdata(struct exynos_c2c_platdata *pd)
{
	struct exynos_c2c_platdata *npd = pd;

	if (!npd->setup_gpio)
		npd->setup_gpio = exynos_c2c_cfg_gpio;
	if (!npd->set_cprst)
		npd->set_cprst = exynos_c2c_set_cprst;
	if (!npd->clear_cprst)
		npd->clear_cprst = exynos_c2c_clear_cprst;

	if (soc_is_exynos4212() || soc_is_exynos4412()) {
		/* Set C2C_CTRL Register */
		writel(0x1, S5P_C2C_CTRL);
		if (samsung_rev() < EXYNOS4412_REV_1_0)
			npd->c2c_sysreg = S3C_VA_SYS + 0x010C;
	} else if (soc_is_exynos5250()) {
		/* Set C2C_CTRL Register */
		writel(0x1, EXYNOS5_C2C_CTRL);
		if (samsung_rev() < EXYNOS5250_REV_1_0)
			npd->c2c_sysreg = S3C_VA_SYS + 0x0360;
	}

	exynos_device_c2c.dev.platform_data = npd;
}