blob: ca83d5a7d10198c8f643d87f1df7fb5a50c83d42 [file] [log] [blame]
Krzysztof Kozlowski84b21702017-12-25 20:54:32 +01001// 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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
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>
Ben Dooksb6d1f542006-12-17 23:22:26 +010018#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090019#include <linux/serial_s3c.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010020#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010021#include <linux/io.h>
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020022#include "gpio-samsung.h"
23#include "gpio-cfg.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25#include <asm/mach/arch.h>
26#include <asm/mach/map.h>
27#include <asm/mach/irq.h>
28
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/irq.h>
30#include <asm/mach-types.h>
31
Arnd Bergmann436d42c2012-08-24 15:22:12 +020032#include <linux/platform_data/i2c-s3c2410.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020034#include "devs.h"
35#include "cpu.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Arnd Bergmann71b91142019-09-02 17:47:55 +020037#include "s3c24xx.h"
38#include "common-smdk-s3c24xx.h"
Kukjin Kimb27b0722012-01-03 14:02:03 +010039
Linus Torvalds1da177e2005-04-16 15:20:36 -070040static 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
Ben Dooks66a9b492006-06-18 23:04:05 +010048static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 [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
72static struct platform_device *smdk2410_devices[] __initdata = {
Ben Dooksb8132482009-11-23 00:13:39 +000073 &s3c_device_ohci,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 &s3c_device_lcd,
75 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +000076 &s3c_device_i2c0,
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 &s3c_device_iis,
78};
79
Ben Dooks5fe10ab2005-09-20 17:24:33 +010080static void __init smdk2410_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070081{
82 s3c24xx_init_io(smdk2410_iodesc, ARRAY_SIZE(smdk2410_iodesc));
Linus Torvalds1da177e2005-04-16 15:20:36 -070083 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +020084 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
Ben Dooks57e51712007-04-20 11:19:16 +010085}
86
Heiko Stuebner07ee5e72014-05-09 05:49:29 +090087static void __init smdk2410_init_time(void)
88{
89 s3c2410_init_clocks(12000000);
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +020090 s3c24xx_timer_init();
Heiko Stuebner07ee5e72014-05-09 05:49:29 +090091}
92
Ben Dooks57e51712007-04-20 11:19:16 +010093static void __init smdk2410_init(void)
94{
Ben Dooks3e1b7762008-10-31 16:14:40 +000095 s3c_i2c0_set_platdata(NULL);
Ben Dooks57e51712007-04-20 11:19:16 +010096 platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
Arnd Bergmann673085f2020-08-06 20:20:45 +020097 /* 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);
Ben Dooks57e51712007-04-20 11:19:16 +0100100 smdk_machine_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101}
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
104 * to SMDK2410 */
Russell Kinge9dea0c2005-07-03 17:38:58 +0100105 /* Maintainer: Jonas Dietsche */
Nicolas Pitre69d50712011-07-05 22:38:17 -0400106 .atag_offset = 0x100,
Russell Kinge9dea0c2005-07-03 17:38:58 +0100107 .map_io = smdk2410_map_io,
Heiko Stuebnerf182aa12013-03-07 12:38:19 +0900108 .init_irq = s3c2410_init_irq,
Ben Dooks57e51712007-04-20 11:19:16 +0100109 .init_machine = smdk2410_init,
Heiko Stuebner07ee5e72014-05-09 05:49:29 +0900110 .init_time = smdk2410_init_time,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111MACHINE_END