dev-sysmmu.c 5.1 KB
Newer Older
K
Kukjin Kim 已提交
1
/* linux/arch/arm/mach-exynos4/dev-sysmmu.c
2 3 4 5
 *
 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
K
Kukjin Kim 已提交
6 7
 * EXYNOS4 - System MMU support
 *
8 9 10 11 12 13 14 15 16 17
 * 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/platform_device.h>
#include <linux/dma-mapping.h>

#include <mach/map.h>
#include <mach/irqs.h>
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
#include <mach/sysmmu.h>
#include <plat/s5p-clock.h>

/* These names must be equal to the clock names in mach-exynos4/clock.c */
const char *sysmmu_ips_name[EXYNOS4_SYSMMU_TOTAL_IPNUM] = {
	"SYSMMU_MDMA"	,
	"SYSMMU_SSS"	,
	"SYSMMU_FIMC0"	,
	"SYSMMU_FIMC1"	,
	"SYSMMU_FIMC2"	,
	"SYSMMU_FIMC3"	,
	"SYSMMU_JPEG"	,
	"SYSMMU_FIMD0"	,
	"SYSMMU_FIMD1"	,
	"SYSMMU_PCIe"	,
	"SYSMMU_G2D"	,
	"SYSMMU_ROTATOR",
	"SYSMMU_MDMA2"	,
	"SYSMMU_TV"	,
	"SYSMMU_MFC_L"	,
	"SYSMMU_MFC_R"	,
};
40

K
Kukjin Kim 已提交
41
static struct resource exynos4_sysmmu_resource[] = {
42
	[0] = {
K
Kukjin Kim 已提交
43 44
		.start	= EXYNOS4_PA_SYSMMU_MDMA,
		.end	= EXYNOS4_PA_SYSMMU_MDMA + SZ_64K - 1,
45 46 47 48 49 50 51 52
		.flags	= IORESOURCE_MEM,
	},
	[1] = {
		.start	= IRQ_SYSMMU_MDMA0_0,
		.end	= IRQ_SYSMMU_MDMA0_0,
		.flags	= IORESOURCE_IRQ,
	},
	[2] = {
K
Kukjin Kim 已提交
53 54
		.start	= EXYNOS4_PA_SYSMMU_SSS,
		.end	= EXYNOS4_PA_SYSMMU_SSS + SZ_64K - 1,
55 56 57 58 59 60 61 62
		.flags	= IORESOURCE_MEM,
	},
	[3] = {
		.start	= IRQ_SYSMMU_SSS_0,
		.end	= IRQ_SYSMMU_SSS_0,
		.flags	= IORESOURCE_IRQ,
	},
	[4] = {
K
Kukjin Kim 已提交
63 64
		.start	= EXYNOS4_PA_SYSMMU_FIMC0,
		.end	= EXYNOS4_PA_SYSMMU_FIMC0 + SZ_64K - 1,
65 66 67 68 69 70 71 72
		.flags	= IORESOURCE_MEM,
	},
	[5] = {
		.start	= IRQ_SYSMMU_FIMC0_0,
		.end	= IRQ_SYSMMU_FIMC0_0,
		.flags	= IORESOURCE_IRQ,
	},
	[6] = {
K
Kukjin Kim 已提交
73 74
		.start	= EXYNOS4_PA_SYSMMU_FIMC1,
		.end	= EXYNOS4_PA_SYSMMU_FIMC1 + SZ_64K - 1,
75 76 77 78 79 80 81 82
		.flags	= IORESOURCE_MEM,
	},
	[7] = {
		.start	= IRQ_SYSMMU_FIMC1_0,
		.end	= IRQ_SYSMMU_FIMC1_0,
		.flags	= IORESOURCE_IRQ,
	},
	[8] = {
K
Kukjin Kim 已提交
83 84
		.start	= EXYNOS4_PA_SYSMMU_FIMC2,
		.end	= EXYNOS4_PA_SYSMMU_FIMC2 + SZ_64K - 1,
85 86 87 88 89 90 91 92
		.flags	= IORESOURCE_MEM,
	},
	[9] = {
		.start	= IRQ_SYSMMU_FIMC2_0,
		.end	= IRQ_SYSMMU_FIMC2_0,
		.flags	= IORESOURCE_IRQ,
	},
	[10] = {
K
Kukjin Kim 已提交
93 94
		.start	= EXYNOS4_PA_SYSMMU_FIMC3,
		.end	= EXYNOS4_PA_SYSMMU_FIMC3 + SZ_64K - 1,
95 96 97 98 99 100 101 102
		.flags	= IORESOURCE_MEM,
	},
	[11] = {
		.start	= IRQ_SYSMMU_FIMC3_0,
		.end	= IRQ_SYSMMU_FIMC3_0,
		.flags	= IORESOURCE_IRQ,
	},
	[12] = {
K
Kukjin Kim 已提交
103 104
		.start	= EXYNOS4_PA_SYSMMU_JPEG,
		.end	= EXYNOS4_PA_SYSMMU_JPEG + SZ_64K - 1,
105 106 107 108 109 110 111 112
		.flags	= IORESOURCE_MEM,
	},
	[13] = {
		.start	= IRQ_SYSMMU_JPEG_0,
		.end	= IRQ_SYSMMU_JPEG_0,
		.flags	= IORESOURCE_IRQ,
	},
	[14] = {
K
Kukjin Kim 已提交
113 114
		.start	= EXYNOS4_PA_SYSMMU_FIMD0,
		.end	= EXYNOS4_PA_SYSMMU_FIMD0 + SZ_64K - 1,
115 116 117 118 119 120 121 122
		.flags	= IORESOURCE_MEM,
	},
	[15] = {
		.start	= IRQ_SYSMMU_LCD0_M0_0,
		.end	= IRQ_SYSMMU_LCD0_M0_0,
		.flags	= IORESOURCE_IRQ,
	},
	[16] = {
K
Kukjin Kim 已提交
123 124
		.start	= EXYNOS4_PA_SYSMMU_FIMD1,
		.end	= EXYNOS4_PA_SYSMMU_FIMD1 + SZ_64K - 1,
125 126 127 128 129 130 131 132
		.flags	= IORESOURCE_MEM,
	},
	[17] = {
		.start	= IRQ_SYSMMU_LCD1_M1_0,
		.end	= IRQ_SYSMMU_LCD1_M1_0,
		.flags	= IORESOURCE_IRQ,
	},
	[18] = {
K
Kukjin Kim 已提交
133 134
		.start	= EXYNOS4_PA_SYSMMU_PCIe,
		.end	= EXYNOS4_PA_SYSMMU_PCIe + SZ_64K - 1,
135 136 137 138 139 140 141 142
		.flags	= IORESOURCE_MEM,
	},
	[19] = {
		.start	= IRQ_SYSMMU_PCIE_0,
		.end	= IRQ_SYSMMU_PCIE_0,
		.flags	= IORESOURCE_IRQ,
	},
	[20] = {
K
Kukjin Kim 已提交
143 144
		.start	= EXYNOS4_PA_SYSMMU_G2D,
		.end	= EXYNOS4_PA_SYSMMU_G2D + SZ_64K - 1,
145 146 147 148 149 150 151 152
		.flags	= IORESOURCE_MEM,
	},
	[21] = {
		.start	= IRQ_SYSMMU_2D_0,
		.end	= IRQ_SYSMMU_2D_0,
		.flags	= IORESOURCE_IRQ,
	},
	[22] = {
K
Kukjin Kim 已提交
153 154
		.start	= EXYNOS4_PA_SYSMMU_ROTATOR,
		.end	= EXYNOS4_PA_SYSMMU_ROTATOR + SZ_64K - 1,
155 156 157 158 159 160 161 162
		.flags	= IORESOURCE_MEM,
	},
	[23] = {
		.start	= IRQ_SYSMMU_ROTATOR_0,
		.end	= IRQ_SYSMMU_ROTATOR_0,
		.flags	= IORESOURCE_IRQ,
	},
	[24] = {
K
Kukjin Kim 已提交
163 164
		.start	= EXYNOS4_PA_SYSMMU_MDMA2,
		.end	= EXYNOS4_PA_SYSMMU_MDMA2 + SZ_64K - 1,
165 166 167 168 169 170 171 172
		.flags	= IORESOURCE_MEM,
	},
	[25] = {
		.start	= IRQ_SYSMMU_MDMA1_0,
		.end	= IRQ_SYSMMU_MDMA1_0,
		.flags	= IORESOURCE_IRQ,
	},
	[26] = {
K
Kukjin Kim 已提交
173 174
		.start	= EXYNOS4_PA_SYSMMU_TV,
		.end	= EXYNOS4_PA_SYSMMU_TV + SZ_64K - 1,
175 176 177 178 179 180 181 182
		.flags	= IORESOURCE_MEM,
	},
	[27] = {
		.start	= IRQ_SYSMMU_TV_M0_0,
		.end	= IRQ_SYSMMU_TV_M0_0,
		.flags	= IORESOURCE_IRQ,
	},
	[28] = {
K
Kukjin Kim 已提交
183 184
		.start	= EXYNOS4_PA_SYSMMU_MFC_L,
		.end	= EXYNOS4_PA_SYSMMU_MFC_L + SZ_64K - 1,
185 186 187 188 189 190 191 192
		.flags	= IORESOURCE_MEM,
	},
	[29] = {
		.start	= IRQ_SYSMMU_MFC_M0_0,
		.end	= IRQ_SYSMMU_MFC_M0_0,
		.flags	= IORESOURCE_IRQ,
	},
	[30] = {
K
Kukjin Kim 已提交
193 194
		.start	= EXYNOS4_PA_SYSMMU_MFC_R,
		.end	= EXYNOS4_PA_SYSMMU_MFC_R + SZ_64K - 1,
195 196 197 198 199 200 201 202 203
		.flags	= IORESOURCE_MEM,
	},
	[31] = {
		.start	= IRQ_SYSMMU_MFC_M1_0,
		.end	= IRQ_SYSMMU_MFC_M1_0,
		.flags	= IORESOURCE_IRQ,
	},
};

K
Kukjin Kim 已提交
204
struct platform_device exynos4_device_sysmmu = {
205 206
	.name		= "s5p-sysmmu",
	.id		= 32,
K
Kukjin Kim 已提交
207 208
	.num_resources	= ARRAY_SIZE(exynos4_sysmmu_resource),
	.resource	= exynos4_sysmmu_resource,
209
};
K
Kukjin Kim 已提交
210
EXPORT_SYMBOL(exynos4_device_sysmmu);
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232

static struct clk *sysmmu_clk[S5P_SYSMMU_TOTAL_IPNUM];
void sysmmu_clk_init(struct device *dev, sysmmu_ips ips)
{
	sysmmu_clk[ips] = clk_get(dev, sysmmu_ips_name[ips]);
	if (IS_ERR(sysmmu_clk[ips]))
		sysmmu_clk[ips] = NULL;
	else
		clk_put(sysmmu_clk[ips]);
}

void sysmmu_clk_enable(sysmmu_ips ips)
{
	if (sysmmu_clk[ips])
		clk_enable(sysmmu_clk[ips]);
}

void sysmmu_clk_disable(sysmmu_ips ips)
{
	if (sysmmu_clk[ips])
		clk_disable(sysmmu_clk[ips]);
}