1 // SPDX-License-Identifier: GPL-2.0+
2 //
3 // Copyright (C) 2004 by FS Forth-Systeme GmbH
4 // All rights reserved.
5 //
6 // @Author: Jonas Dietsche
7 //
8 // @History:
9 // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
10 // Ben Dooks <ben@simtec.co.uk>
11 
12 #include <linux/kernel.h>
13 #include <linux/types.h>
14 #include <linux/interrupt.h>
15 #include <linux/list.h>
16 #include <linux/timer.h>
17 #include <linux/init.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_s3c.h>
20 #include <linux/platform_device.h>
21 #include <linux/io.h>
22 #include "gpio-samsung.h"
23 #include "gpio-cfg.h"
24 
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/irq.h>
28 
29 #include <asm/irq.h>
30 #include <asm/mach-types.h>
31 
32 #include <linux/platform_data/i2c-s3c2410.h>
33 
34 #include "devs.h"
35 #include "cpu.h"
36 
37 #include "s3c24xx.h"
38 #include "common-smdk-s3c24xx.h"
39 
40 static struct map_desc smdk2410_iodesc[] __initdata = {
41   /* nothing here yet */
42 };
43 
44 #define UCON S3C2410_UCON_DEFAULT
45 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
46 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
47 
48 static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
49 	[0] = {
50 		.hwport	     = 0,
51 		.flags	     = 0,
52 		.ucon	     = UCON,
53 		.ulcon	     = ULCON,
54 		.ufcon	     = UFCON,
55 	},
56 	[1] = {
57 		.hwport	     = 1,
58 		.flags	     = 0,
59 		.ucon	     = UCON,
60 		.ulcon	     = ULCON,
61 		.ufcon	     = UFCON,
62 	},
63 	[2] = {
64 		.hwport	     = 2,
65 		.flags	     = 0,
66 		.ucon	     = UCON,
67 		.ulcon	     = ULCON,
68 		.ufcon	     = UFCON,
69 	}
70 };
71 
72 static struct platform_device *smdk2410_devices[] __initdata = {
73 	&s3c_device_ohci,
74 	&s3c_device_lcd,
75 	&s3c_device_wdt,
76 	&s3c_device_i2c0,
77 	&s3c_device_iis,
78 };
79 
smdk2410_map_io(void)80 static void __init smdk2410_map_io(void)
81 {
82 	s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
83 	s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
84 	s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
85 }
86 
smdk2410_init_time(void)87 static void __init smdk2410_init_time(void)
88 {
89 	s3c2410_init_clocks(12000000);
90 	s3c24xx_timer_init();
91 }
92 
smdk2410_init(void)93 static void __init smdk2410_init(void)
94 {
95 	s3c_i2c0_set_platdata(NULL);
96 	platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
97 	/* Configure the I2S pins (GPE0...GPE4) in correct mode */
98 	s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
99 			      S3C_GPIO_PULL_NONE);
100 	smdk_machine_init();
101 }
102 
103 MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
104 				    * to SMDK2410 */
105 	/* Maintainer: Jonas Dietsche */
106 	.atag_offset	= 0x100,
107 	.map_io		= smdk2410_map_io,
108 	.init_irq	= s3c2410_init_irq,
109 	.init_machine	= smdk2410_init,
110 	.init_time	= smdk2410_init_time,
111 MACHINE_END
112