blob: 7f6fe0db04f35490dae14844443129586c256de2 [file] [log] [blame]
Krzysztof Kozlowski84b21702017-12-25 20:54:32 +01001// SPDX-License-Identifier: GPL-2.0
2// linux/arch/arm/mach-s3c2440/mach-smdk2440.c
3//
4// Copyright (c) 2004-2005 Simtec Electronics
5// Ben Dooks <ben@simtec.co.uk>
6//
7// http://www.fluff.org/ben/smdk2440/
8//
9// Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/interrupt.h>
14#include <linux/list.h>
15#include <linux/timer.h>
16#include <linux/init.h>
Ben Dooksb6d1f542006-12-17 23:22:26 +010017#include <linux/serial_core.h>
Tushar Behera334a1c72014-02-14 10:32:45 +090018#include <linux/serial_s3c.h>
Russell Kingd052d1b2005-10-29 19:07:23 +010019#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010020#include <linux/io.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <asm/irq.h>
27#include <asm/mach-types.h>
28
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020029#include "regs-gpio.h"
30#include "gpio-samsung.h"
31#include "gpio-cfg.h"
Ben Dooks577189762005-10-28 15:31:47 +010032
Arnd Bergmann81994e02019-09-02 22:33:24 +020033#include <linux/platform_data/fb-s3c2410.h>
Arnd Bergmann436d42c2012-08-24 15:22:12 +020034#include <linux/platform_data/i2c-s3c2410.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
Arnd Bergmannc6ff1322019-09-02 18:37:30 +020036#include "devs.h"
37#include "cpu.h"
Ben Dooksd3f4c572006-04-01 18:33:42 +010038
Arnd Bergmann71b91142019-09-02 17:47:55 +020039#include "s3c24xx.h"
40#include "common-smdk-s3c24xx.h"
Kukjin Kimb27b0722012-01-03 14:02:03 +010041
Linus Torvalds1da177e2005-04-16 15:20:36 -070042static struct map_desc smdk2440_iodesc[] __initdata = {
43 /* ISA IO Space map (memory space selected by A24) */
44
Ben Dookscbe69f92005-11-09 14:05:31 +000045 {
46 .virtual = (u32)S3C24XX_VA_ISA_WORD,
47 .pfn = __phys_to_pfn(S3C2410_CS2),
48 .length = 0x10000,
49 .type = MT_DEVICE,
50 }, {
51 .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
52 .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
53 .length = SZ_4M,
54 .type = MT_DEVICE,
55 }, {
56 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
57 .pfn = __phys_to_pfn(S3C2410_CS2),
58 .length = 0x10000,
59 .type = MT_DEVICE,
60 }, {
61 .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
62 .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
63 .length = SZ_4M,
64 .type = MT_DEVICE,
65 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070066};
67
68#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
69#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
70#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
71
Ben Dooks66a9b492006-06-18 23:04:05 +010072static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 [0] = {
74 .hwport = 0,
75 .flags = 0,
76 .ucon = 0x3c5,
77 .ulcon = 0x03,
78 .ufcon = 0x51,
79 },
80 [1] = {
81 .hwport = 1,
82 .flags = 0,
83 .ucon = 0x3c5,
84 .ulcon = 0x03,
85 .ufcon = 0x51,
86 },
87 /* IR port */
88 [2] = {
89 .hwport = 2,
90 .flags = 0,
91 .ucon = 0x3c5,
92 .ulcon = 0x43,
93 .ufcon = 0x51,
94 }
95};
96
Ben Dooks577189762005-10-28 15:31:47 +010097/* LCD driver info */
98
Krzysztof Helt09fe75f2007-10-16 01:28:56 -070099static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
Ben Dooks577189762005-10-28 15:31:47 +0100100
Krzysztof Heltf28ef572007-10-16 01:28:58 -0700101 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
102 S3C2410_LCDCON5_INVVLINE |
103 S3C2410_LCDCON5_INVVFRAME |
104 S3C2410_LCDCON5_PWREN |
105 S3C2410_LCDCON5_HWSWP,
Ben Dooks577189762005-10-28 15:31:47 +0100106
Krzysztof Helt69816692007-10-16 01:29:06 -0700107 .type = S3C2410_LCDCON1_TFT,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700108
109 .width = 240,
110 .height = 320,
111
Krzysztof Helt69816692007-10-16 01:29:06 -0700112 .pixclock = 166667, /* HCLK 60 MHz, divisor 10 */
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700113 .xres = 240,
114 .yres = 320,
115 .bpp = 16,
Krzysztof Helt1f411532007-10-16 01:28:57 -0700116 .left_margin = 20,
117 .right_margin = 8,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700118 .hsync_len = 4,
Krzysztof Helt5f20f692007-10-16 01:28:59 -0700119 .upper_margin = 8,
120 .lower_margin = 7,
Krzysztof Helt93d11f52007-10-16 01:29:00 -0700121 .vsync_len = 4,
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700122};
123
124static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
125 .displays = &smdk2440_lcd_cfg,
126 .num_displays = 1,
127 .default_display = 0,
128
Ben Dooks577189762005-10-28 15:31:47 +0100129#if 0
130 /* currently setup by downloader */
131 .gpccon = 0xaa940659,
132 .gpccon_mask = 0xffffffff,
133 .gpcup = 0x0000ffff,
134 .gpcup_mask = 0xffffffff,
135 .gpdcon = 0xaa84aaa0,
136 .gpdcon_mask = 0xffffffff,
137 .gpdup = 0x0000faff,
138 .gpdup_mask = 0xffffffff,
Arnd Bergmann81994e02019-09-02 22:33:24 +0200139
140 .gpccon_reg = S3C2410_GPCCON,
141 .gpcup_reg = S3C2410_GPCUP,
142 .gpdcon_reg = S3C2410_GPDCON,
143 .gpdup_reg = S3C2410_GPDUP,
Ben Dooks577189762005-10-28 15:31:47 +0100144#endif
145
146 .lpcsel = ((0xCE6) & ~7) | 1<<4,
Ben Dooks577189762005-10-28 15:31:47 +0100147};
148
Linus Torvalds1da177e2005-04-16 15:20:36 -0700149static struct platform_device *smdk2440_devices[] __initdata = {
Ben Dooksb8132482009-11-23 00:13:39 +0000150 &s3c_device_ohci,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 &s3c_device_lcd,
152 &s3c_device_wdt,
Ben Dooks3e1b7762008-10-31 16:14:40 +0000153 &s3c_device_i2c0,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700154 &s3c_device_iis,
155};
156
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100157static void __init smdk2440_map_io(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158{
159 s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +0200161 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162}
163
Heiko Stuebnera28d6182014-05-09 05:49:19 +0900164static void __init smdk2440_init_time(void)
165{
166 s3c2440_init_clocks(16934400);
Krzysztof Kozlowskia1342f62020-08-20 22:42:03 +0200167 s3c24xx_timer_init();
Heiko Stuebnera28d6182014-05-09 05:49:19 +0900168}
169
Ben Dooks5fe10ab2005-09-20 17:24:33 +0100170static void __init smdk2440_machine_init(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171{
Krzysztof Helt09fe75f2007-10-16 01:28:56 -0700172 s3c24xx_fb_set_platdata(&smdk2440_fb_info);
Ben Dooks3e1b7762008-10-31 16:14:40 +0000173 s3c_i2c0_set_platdata(NULL);
Arnd Bergmann673085f2020-08-06 20:20:45 +0200174 /* Configure the I2S pins (GPE0...GPE4) in correct mode */
175 s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
176 S3C_GPIO_PULL_NONE);
Ben Dooks57e51712007-04-20 11:19:16 +0100177 platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
Ben Dooksd3f4c572006-04-01 18:33:42 +0100178 smdk_machine_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700179}
180
181MACHINE_START(S3C2440, "SMDK2440")
Ben Dooksafdd2252010-05-07 09:24:05 +0900182 /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
Nicolas Pitre69d50712011-07-05 22:38:17 -0400183 .atag_offset = 0x100,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184
Heiko Stuebnerce6c1642013-02-12 09:59:20 -0800185 .init_irq = s3c2440_init_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 .map_io = smdk2440_map_io,
187 .init_machine = smdk2440_machine_init,
Heiko Stuebnera28d6182014-05-09 05:49:19 +0900188 .init_time = smdk2440_init_time,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189MACHINE_END