common.c 17.3 KB
Newer Older
1
/* linux/arch/arm/plat-s3c24xx/cpu.c
L
Linus Torvalds 已提交
2 3 4 5 6
 *
 * Copyright (c) 2004-2005 Simtec Electronics
 *	http://www.simtec.co.uk/products/SWLINUX/
 *	Ben Dooks <ben@simtec.co.uk>
 *
7
 * Common code for S3C24XX machines
L
Linus Torvalds 已提交
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/


#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
29
#include <linux/serial_core.h>
30
#include <linux/serial_s3c.h>
31
#include <clocksource/samsung_pwm.h>
32
#include <linux/platform_device.h>
33
#include <linux/delay.h>
34
#include <linux/io.h>
35
#include <linux/platform_data/dma-s3c24xx.h>
L
Linus Torvalds 已提交
36

37
#include <mach/hardware.h>
38
#include <mach/regs-clock.h>
L
Linus Torvalds 已提交
39
#include <asm/irq.h>
40
#include <asm/cacheflush.h>
41
#include <asm/system_info.h>
42
#include <asm/system_misc.h>
L
Linus Torvalds 已提交
43 44 45 46

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

47
#include <mach/regs-gpio.h>
48
#include <mach/dma.h>
L
Linus Torvalds 已提交
49

50 51
#include <plat/cpu.h>
#include <plat/devs.h>
52
#include <plat/clock.h>
53 54
#include <plat/cpu-freq.h>
#include <plat/pll.h>
55
#include <plat/pwm-core.h>
56
#include <plat/watchdog-reset.h>
L
Linus Torvalds 已提交
57

58 59
#include "common.h"

L
Linus Torvalds 已提交
60 61 62
/* table of supported CPUs */

static const char name_s3c2410[]  = "S3C2410";
63
static const char name_s3c2412[]  = "S3C2412";
64
static const char name_s3c2416[]  = "S3C2416/S3C2450";
L
Linus Torvalds 已提交
65
static const char name_s3c2440[]  = "S3C2440";
66
static const char name_s3c2442[]  = "S3C2442";
67
static const char name_s3c2442b[]  = "S3C2442B";
68
static const char name_s3c2443[]  = "S3C2443";
L
Linus Torvalds 已提交
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
static const char name_s3c2410a[] = "S3C2410A";
static const char name_s3c2440a[] = "S3C2440A";

static struct cpu_table cpu_ids[] __initdata = {
	{
		.idcode		= 0x32410000,
		.idmask		= 0xffffffff,
		.map_io		= s3c2410_map_io,
		.init_uarts	= s3c2410_init_uarts,
		.init		= s3c2410_init,
		.name		= name_s3c2410
	},
	{
		.idcode		= 0x32410002,
		.idmask		= 0xffffffff,
		.map_io		= s3c2410_map_io,
		.init_uarts	= s3c2410_init_uarts,
B
Ben Dooks 已提交
86
		.init		= s3c2410a_init,
L
Linus Torvalds 已提交
87 88 89 90 91
		.name		= name_s3c2410a
	},
	{
		.idcode		= 0x32440000,
		.idmask		= 0xffffffff,
92
		.map_io		= s3c2440_map_io,
93
		.init_uarts	= s3c244x_init_uarts,
L
Linus Torvalds 已提交
94 95 96 97 98 99
		.init		= s3c2440_init,
		.name		= name_s3c2440
	},
	{
		.idcode		= 0x32440001,
		.idmask		= 0xffffffff,
100
		.map_io		= s3c2440_map_io,
101
		.init_uarts	= s3c244x_init_uarts,
L
Linus Torvalds 已提交
102 103
		.init		= s3c2440_init,
		.name		= name_s3c2440a
104
	},
105 106 107
	{
		.idcode		= 0x32440aaa,
		.idmask		= 0xffffffff,
108
		.map_io		= s3c2442_map_io,
109 110 111 112
		.init_uarts	= s3c244x_init_uarts,
		.init		= s3c2442_init,
		.name		= name_s3c2442
	},
113 114 115
	{
		.idcode		= 0x32440aab,
		.idmask		= 0xffffffff,
116
		.map_io		= s3c2442_map_io,
117 118 119 120
		.init_uarts	= s3c244x_init_uarts,
		.init		= s3c2442_init,
		.name		= name_s3c2442b
	},
121 122 123 124 125 126 127 128
	{
		.idcode		= 0x32412001,
		.idmask		= 0xffffffff,
		.map_io		= s3c2412_map_io,
		.init_uarts	= s3c2412_init_uarts,
		.init		= s3c2412_init,
		.name		= name_s3c2412,
	},
129 130 131 132 133 134 135 136
	{			/* a newer version of the s3c2412 */
		.idcode		= 0x32412003,
		.idmask		= 0xffffffff,
		.map_io		= s3c2412_map_io,
		.init_uarts	= s3c2412_init_uarts,
		.init		= s3c2412_init,
		.name		= name_s3c2412,
	},
Y
Yauhen Kharuzhy 已提交
137 138 139 140 141 142 143 144
	{			/* a strange version of the s3c2416 */
		.idcode		= 0x32450003,
		.idmask		= 0xffffffff,
		.map_io		= s3c2416_map_io,
		.init_uarts	= s3c2416_init_uarts,
		.init		= s3c2416_init,
		.name		= name_s3c2416,
	},
145 146 147 148 149 150 151 152
	{
		.idcode		= 0x32443001,
		.idmask		= 0xffffffff,
		.map_io		= s3c2443_map_io,
		.init_uarts	= s3c2443_init_uarts,
		.init		= s3c2443_init,
		.name		= name_s3c2443,
	},
L
Linus Torvalds 已提交
153 154 155 156 157 158 159 160 161 162 163
};

/* minimal IO mapping */

static struct map_desc s3c_iodesc[] __initdata = {
	IODESC_ENT(GPIO),
	IODESC_ENT(IRQ),
	IODESC_ENT(MEMCTRL),
	IODESC_ENT(UART)
};

164
/* read cpu identificaiton code */
L
Linus Torvalds 已提交
165

166 167
static unsigned long s3c24xx_read_idcode_v5(void)
{
168 169 170 171 172 173 174 175 176 177
#if defined(CONFIG_CPU_S3C2416)
	/* s3c2416 is v5, with S3C24XX_GSTATUS1 instead of S3C2412_GSTATUS1 */

	u32 gs = __raw_readl(S3C24XX_GSTATUS1);

	/* test for s3c2416 or similar device */
	if ((gs >> 16) == 0x3245)
		return gs;
#endif

178 179 180 181 182 183 184 185 186 187 188 189
#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
	return __raw_readl(S3C2412_GSTATUS1);
#else
	return 1UL;	/* don't look like an 2400 */
#endif
}

static unsigned long s3c24xx_read_idcode_v4(void)
{
	return __raw_readl(S3C2410_GSTATUS1);
}

190 191
static void s3c24xx_default_idle(void)
{
192
	unsigned long tmp = 0;
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
	int i;

	/* idle the system by using the idle mode which will wait for an
	 * interrupt to happen before restarting the system.
	 */

	/* Warning: going into idle state upsets jtag scanning */

	__raw_writel(__raw_readl(S3C2410_CLKCON) | S3C2410_CLKCON_IDLE,
		     S3C2410_CLKCON);

	/* the samsung port seems to do a loop and then unset idle.. */
	for (i = 0; i < 50; i++)
		tmp += __raw_readl(S3C2410_CLKCON); /* ensure loop not optimised out */

	/* this bit is not cleared on re-start... */

	__raw_writel(__raw_readl(S3C2410_CLKCON) & ~S3C2410_CLKCON_IDLE,
		     S3C2410_CLKCON);
}

214 215 216 217 218 219 220
static struct samsung_pwm_variant s3c24xx_pwm_variant = {
	.bits		= 16,
	.div_base	= 1,
	.has_tint_cstat	= false,
	.tclk_mask	= (1 << 4),
};

L
Linus Torvalds 已提交
221 222
void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
{
223 224
	arm_pm_idle = s3c24xx_default_idle;

L
Linus Torvalds 已提交
225
	/* initialise the io descriptors we need for initialisation */
226
	iotable_init(mach_desc, size);
L
Linus Torvalds 已提交
227 228
	iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));

229
	if (cpu_architecture() >= CPU_ARCH_ARMv5) {
230
		samsung_cpu_id = s3c24xx_read_idcode_v5();
231
	} else {
232
		samsung_cpu_id = s3c24xx_read_idcode_v4();
233
	}
234

235
	s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
236 237

	samsung_pwm_set_platdata(&s3c24xx_pwm_variant);
238
}
239

240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
void __init samsung_set_timer_source(unsigned int event, unsigned int source)
{
	s3c24xx_pwm_variant.output_mask = BIT(SAMSUNG_PWM_NUM) - 1;
	s3c24xx_pwm_variant.output_mask &= ~(BIT(event) | BIT(source));
}

void __init samsung_timer_init(void)
{
	unsigned int timer_irqs[SAMSUNG_PWM_NUM] = {
		IRQ_TIMER0, IRQ_TIMER1, IRQ_TIMER2, IRQ_TIMER3, IRQ_TIMER4,
	};

	samsung_pwm_clocksource_init(S3C_VA_TIMER,
					timer_irqs, &s3c24xx_pwm_variant);
}

256 257
/* Serial port registrations */

258 259 260 261 262
#define S3C2410_PA_UART0      (S3C24XX_PA_UART)
#define S3C2410_PA_UART1      (S3C24XX_PA_UART + 0x4000 )
#define S3C2410_PA_UART2      (S3C24XX_PA_UART + 0x8000 )
#define S3C2443_PA_UART3      (S3C24XX_PA_UART + 0xC000 )

263
static struct resource s3c2410_uart0_resource[] = {
264 265 266 267
	[0] = DEFINE_RES_MEM(S3C2410_PA_UART0, SZ_16K),
	[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX0, \
			IRQ_S3CUART_ERR0 - IRQ_S3CUART_RX0 + 1, \
			NULL, IORESOURCE_IRQ)
268 269 270
};

static struct resource s3c2410_uart1_resource[] = {
271 272 273 274
	[0] = DEFINE_RES_MEM(S3C2410_PA_UART1, SZ_16K),
	[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX1, \
			IRQ_S3CUART_ERR1 - IRQ_S3CUART_RX1 + 1, \
			NULL, IORESOURCE_IRQ)
275 276 277
};

static struct resource s3c2410_uart2_resource[] = {
278 279 280 281
	[0] = DEFINE_RES_MEM(S3C2410_PA_UART2, SZ_16K),
	[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX2, \
			IRQ_S3CUART_ERR2 - IRQ_S3CUART_RX2 + 1, \
			NULL, IORESOURCE_IRQ)
282 283 284
};

static struct resource s3c2410_uart3_resource[] = {
285 286 287 288
	[0] = DEFINE_RES_MEM(S3C2443_PA_UART3, SZ_16K),
	[1] = DEFINE_RES_NAMED(IRQ_S3CUART_RX3, \
			IRQ_S3CUART_ERR3 - IRQ_S3CUART_RX3 + 1, \
			NULL, IORESOURCE_IRQ)
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
};

struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
	[0] = {
		.resources	= s3c2410_uart0_resource,
		.nr_resources	= ARRAY_SIZE(s3c2410_uart0_resource),
	},
	[1] = {
		.resources	= s3c2410_uart1_resource,
		.nr_resources	= ARRAY_SIZE(s3c2410_uart1_resource),
	},
	[2] = {
		.resources	= s3c2410_uart2_resource,
		.nr_resources	= ARRAY_SIZE(s3c2410_uart2_resource),
	},
	[3] = {
		.resources	= s3c2410_uart3_resource,
		.nr_resources	= ARRAY_SIZE(s3c2410_uart3_resource),
	},
};
309 310 311

/* initialise all the clocks */

312
#ifdef CONFIG_SAMSUNG_CLOCK
313 314 315 316 317 318 319 320 321 322 323 324
void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
					   unsigned long hclk,
					   unsigned long pclk)
{
	clk_upll.rate = s3c24xx_get_pll(__raw_readl(S3C2410_UPLLCON),
					clk_xtal.rate);

	clk_mpll.rate = fclk;
	clk_h.rate = hclk;
	clk_p.rate = pclk;
	clk_f.rate = fclk;
}
325
#endif
326 327 328 329 330 331 332 333 334 335 336 337

#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
	defined(CONFIG_CPU_S3C2440) || defined(CONFIG_CPU_S3C2442)
static struct resource s3c2410_dma_resource[] = {
	[0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
	[1] = DEFINE_RES_IRQ(IRQ_DMA0),
	[2] = DEFINE_RES_IRQ(IRQ_DMA1),
	[3] = DEFINE_RES_IRQ(IRQ_DMA2),
	[4] = DEFINE_RES_IRQ(IRQ_DMA3),
};
#endif

338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2442)
static struct s3c24xx_dma_channel s3c2410_dma_channels[DMACH_MAX] = {
	[DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
	[DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
	[DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
						S3C24XX_DMA_CHANREQ(2, 2) |
						S3C24XX_DMA_CHANREQ(1, 3),
	},
	[DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
	[DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
	[DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
	[DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
	[DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
	[DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
						 S3C24XX_DMA_CHANREQ(3, 2) |
						 S3C24XX_DMA_CHANREQ(3, 3),
	},
	[DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
						  S3C24XX_DMA_CHANREQ(1, 2),
	},
	[DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 2), },
	[DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
	[DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
	[DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
	[DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
};

static struct s3c24xx_dma_platdata s3c2410_dma_platdata = {
	.num_phy_channels = 4,
	.channels = s3c2410_dma_channels,
	.num_channels = DMACH_MAX,
};

struct platform_device s3c2410_device_dma = {
	.name		= "s3c2410-dma",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s3c2410_dma_resource),
	.resource	= s3c2410_dma_resource,
	.dev	= {
		.platform_data	= &s3c2410_dma_platdata,
	},
};
#endif

382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
#ifdef CONFIG_CPU_S3C2412
static struct s3c24xx_dma_channel s3c2412_dma_channels[DMACH_MAX] = {
	[DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
	[DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
	[DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
	[DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
	[DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
	[DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
	[DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
	[DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
	[DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
	[DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
	[DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
	[DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
	[DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
	[DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
	[DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
	[DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
	[DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, 13 },
	[DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, 14 },
	[DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, 15 },
	[DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, 16 },
};

static struct s3c24xx_dma_platdata s3c2412_dma_platdata = {
	.num_phy_channels = 4,
	.channels = s3c2412_dma_channels,
	.num_channels = DMACH_MAX,
};

struct platform_device s3c2412_device_dma = {
	.name		= "s3c2412-dma",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s3c2410_dma_resource),
	.resource	= s3c2410_dma_resource,
	.dev	= {
		.platform_data	= &s3c2412_dma_platdata,
	},
};
#endif

423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
#if defined(CONFIG_CPU_S3C2440)
static struct s3c24xx_dma_channel s3c2440_dma_channels[DMACH_MAX] = {
	[DMACH_XD0] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 0), },
	[DMACH_XD1] = { S3C24XX_DMA_AHB, true, S3C24XX_DMA_CHANREQ(0, 1), },
	[DMACH_SDI] = { S3C24XX_DMA_APB, false, S3C24XX_DMA_CHANREQ(2, 0) |
						S3C24XX_DMA_CHANREQ(6, 1) |
						S3C24XX_DMA_CHANREQ(2, 2) |
						S3C24XX_DMA_CHANREQ(1, 3),
	},
	[DMACH_SPI0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 1), },
	[DMACH_SPI1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 3), },
	[DMACH_UART0] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 0), },
	[DMACH_UART1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(1, 1), },
	[DMACH_UART2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(0, 3), },
	[DMACH_TIMER] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(3, 0) |
						 S3C24XX_DMA_CHANREQ(3, 2) |
						 S3C24XX_DMA_CHANREQ(3, 3),
	},
	[DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(2, 1) |
						  S3C24XX_DMA_CHANREQ(1, 2),
	},
	[DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 0) |
						   S3C24XX_DMA_CHANREQ(0, 2),
	},
	[DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 0) |
						  S3C24XX_DMA_CHANREQ(5, 2),
	},
	[DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(5, 1) |
						  S3C24XX_DMA_CHANREQ(6, 3),
	},
	[DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(6, 2) |
						  S3C24XX_DMA_CHANREQ(5, 3),
	},
	[DMACH_USB_EP1] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 0), },
	[DMACH_USB_EP2] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 1), },
	[DMACH_USB_EP3] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 2), },
	[DMACH_USB_EP4] = { S3C24XX_DMA_APB, true, S3C24XX_DMA_CHANREQ(4, 3), },
};

static struct s3c24xx_dma_platdata s3c2440_dma_platdata = {
	.num_phy_channels = 4,
	.channels = s3c2440_dma_channels,
	.num_channels = DMACH_MAX,
};

struct platform_device s3c2440_device_dma = {
	.name		= "s3c2410-dma",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s3c2410_dma_resource),
	.resource	= s3c2410_dma_resource,
	.dev	= {
		.platform_data	= &s3c2440_dma_platdata,
	},
};
#endif

479
#if defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
static struct resource s3c2443_dma_resource[] = {
	[0] = DEFINE_RES_MEM(S3C24XX_PA_DMA, S3C24XX_SZ_DMA),
	[1] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA0),
	[2] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA1),
	[3] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA2),
	[4] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA3),
	[5] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA4),
	[6] = DEFINE_RES_IRQ(IRQ_S3C2443_DMA5),
};

static struct s3c24xx_dma_channel s3c2443_dma_channels[DMACH_MAX] = {
	[DMACH_XD0] = { S3C24XX_DMA_AHB, true, 17 },
	[DMACH_XD1] = { S3C24XX_DMA_AHB, true, 18 },
	[DMACH_SDI] = { S3C24XX_DMA_APB, false, 10 },
	[DMACH_SPI0_RX] = { S3C24XX_DMA_APB, true, 1 },
	[DMACH_SPI0_TX] = { S3C24XX_DMA_APB, true, 0 },
	[DMACH_SPI1_RX] = { S3C24XX_DMA_APB, true, 3 },
	[DMACH_SPI1_TX] = { S3C24XX_DMA_APB, true, 2 },
	[DMACH_UART0] = { S3C24XX_DMA_APB, true, 19 },
	[DMACH_UART1] = { S3C24XX_DMA_APB, true, 21 },
	[DMACH_UART2] = { S3C24XX_DMA_APB, true, 23 },
	[DMACH_UART3] = { S3C24XX_DMA_APB, true, 25 },
	[DMACH_UART0_SRC2] = { S3C24XX_DMA_APB, true, 20 },
	[DMACH_UART1_SRC2] = { S3C24XX_DMA_APB, true, 22 },
	[DMACH_UART2_SRC2] = { S3C24XX_DMA_APB, true, 24 },
	[DMACH_UART3_SRC2] = { S3C24XX_DMA_APB, true, 26 },
	[DMACH_TIMER] = { S3C24XX_DMA_APB, true, 9 },
	[DMACH_I2S_IN] = { S3C24XX_DMA_APB, true, 5 },
	[DMACH_I2S_OUT] = { S3C24XX_DMA_APB, true, 4 },
	[DMACH_PCM_IN] = { S3C24XX_DMA_APB, true, 28 },
	[DMACH_PCM_OUT] = { S3C24XX_DMA_APB, true, 27 },
	[DMACH_MIC_IN] = { S3C24XX_DMA_APB, true, 29 },
};

static struct s3c24xx_dma_platdata s3c2443_dma_platdata = {
	.num_phy_channels = 6,
	.channels = s3c2443_dma_channels,
	.num_channels = DMACH_MAX,
};

struct platform_device s3c2443_device_dma = {
	.name		= "s3c2443-dma",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s3c2443_dma_resource),
	.resource	= s3c2443_dma_resource,
	.dev	= {
		.platform_data	= &s3c2443_dma_platdata,
	},
};
#endif
530

531 532 533 534 535 536 537 538
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2410)
void __init s3c2410_init_clocks(int xtal)
{
	s3c2410_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
	samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif

539 540 541 542 543 544 545
#ifdef CONFIG_CPU_S3C2412
void __init s3c2412_init_clocks(int xtal)
{
	s3c2412_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
}
#endif

546 547 548 549 550 551 552
#ifdef CONFIG_CPU_S3C2416
void __init s3c2416_init_clocks(int xtal)
{
	s3c2443_common_clk_init(NULL, xtal, 0, S3C24XX_VA_CLKPWR);
}
#endif

553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568
#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2440)
void __init s3c2440_init_clocks(int xtal)
{
	s3c2410_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
	samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif

#if defined(CONFIG_COMMON_CLK) && defined(CONFIG_CPU_S3C2442)
void __init s3c2442_init_clocks(int xtal)
{
	s3c2410_common_clk_init(NULL, xtal, 2, S3C24XX_VA_CLKPWR);
	samsung_wdt_reset_init(S3C24XX_VA_WATCHDOG);
}
#endif

569 570 571 572 573 574
#ifdef CONFIG_CPU_S3C2443
void __init s3c2443_init_clocks(int xtal)
{
	s3c2443_common_clk_init(NULL, xtal, 1, S3C24XX_VA_CLKPWR);
}
#endif
575 576 577 578 579 580 581 582 583 584 585 586 587 588

#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2440) || \
	defined(CONFIG_CPU_S3C2442)
static struct resource s3c2410_dclk_resource[] = {
	[0] = DEFINE_RES_MEM(0x56000084, 0x4),
};

struct platform_device s3c2410_device_dclk = {
	.name		= "s3c2410-dclk",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(s3c2410_dclk_resource),
	.resource	= s3c2410_dclk_resource,
};
#endif