Krzysztof Kozlowski | 84b2170 | 2017-12-25 20:54:32 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | // |
| 3 | // Copyright (c) 2004 Nex Vision |
| 4 | // Guillaume GOURAT <guillaume.gourat@nexvision.fr> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | |
| 6 | #include <linux/kernel.h> |
| 7 | #include <linux/types.h> |
| 8 | #include <linux/interrupt.h> |
| 9 | #include <linux/list.h> |
| 10 | #include <linux/timer.h> |
| 11 | #include <linux/init.h> |
Ben Dooks | b6d1f54 | 2006-12-17 23:22:26 +0100 | [diff] [blame] | 12 | #include <linux/serial_core.h> |
Tushar Behera | 334a1c7 | 2014-02-14 10:32:45 +0900 | [diff] [blame] | 13 | #include <linux/serial_s3c.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 14 | #include <linux/platform_device.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 15 | #include <linux/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | |
Kukjin Kim | 0afdff5 | 2013-01-02 10:32:55 -0800 | [diff] [blame] | 17 | #include <linux/platform_data/i2c-s3c2410.h> |
| 18 | |
| 19 | #include <asm/irq.h> |
| 20 | #include <asm/mach-types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | #include <asm/mach/arch.h> |
| 22 | #include <asm/mach/map.h> |
| 23 | #include <asm/mach/irq.h> |
| 24 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 25 | #include <mach/hardware.h> |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 26 | #include <mach/regs-gpio.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 28 | #include <plat/cpu.h> |
Kukjin Kim | 0afdff5 | 2013-01-02 10:32:55 -0800 | [diff] [blame] | 29 | #include <plat/devs.h> |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame] | 30 | #include <plat/samsung-time.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
Kukjin Kim | b27b072 | 2012-01-03 14:02:03 +0100 | [diff] [blame] | 32 | #include "common.h" |
Kukjin Kim | 0afdff5 | 2013-01-02 10:32:55 -0800 | [diff] [blame] | 33 | #include "otom.h" |
Kukjin Kim | b27b072 | 2012-01-03 14:02:03 +0100 | [diff] [blame] | 34 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | static struct map_desc otom11_iodesc[] __initdata = { |
| 36 | /* Device area */ |
| 37 | { (u32)OTOM_VA_CS8900A_BASE, OTOM_PA_CS8900A_BASE, SZ_16M, MT_DEVICE }, |
| 38 | }; |
| 39 | |
| 40 | #define UCON S3C2410_UCON_DEFAULT |
| 41 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB |
| 42 | #define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE |
| 43 | |
Ben Dooks | 66a9b49 | 2006-06-18 23:04:05 +0100 | [diff] [blame] | 44 | static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | [0] = { |
| 46 | .hwport = 0, |
| 47 | .flags = 0, |
| 48 | .ucon = UCON, |
| 49 | .ulcon = ULCON, |
| 50 | .ufcon = UFCON, |
| 51 | }, |
| 52 | [1] = { |
| 53 | .hwport = 1, |
| 54 | .flags = 0, |
| 55 | .ucon = UCON, |
| 56 | .ulcon = ULCON, |
| 57 | .ufcon = UFCON, |
| 58 | }, |
| 59 | /* port 2 is not actually used */ |
| 60 | [2] = { |
| 61 | .hwport = 2, |
| 62 | .flags = 0, |
| 63 | .ucon = UCON, |
| 64 | .ulcon = ULCON, |
| 65 | .ufcon = UFCON, |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | /* NOR Flash on NexVision OTOM board */ |
| 70 | |
| 71 | static struct resource otom_nor_resource[] = { |
Tushar Behera | e21be38 | 2012-05-12 16:12:24 +0900 | [diff] [blame] | 72 | [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_4M), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | static struct platform_device otom_device_nor = { |
| 76 | .name = "mtd-flash", |
| 77 | .id = -1, |
| 78 | .num_resources = ARRAY_SIZE(otom_nor_resource), |
| 79 | .resource = otom_nor_resource, |
| 80 | }; |
| 81 | |
| 82 | /* Standard OTOM devices */ |
| 83 | |
| 84 | static struct platform_device *otom11_devices[] __initdata = { |
Ben Dooks | b813248 | 2009-11-23 00:13:39 +0000 | [diff] [blame] | 85 | &s3c_device_ohci, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | &s3c_device_lcd, |
| 87 | &s3c_device_wdt, |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 88 | &s3c_device_i2c0, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | &s3c_device_iis, |
| 90 | &s3c_device_rtc, |
| 91 | &otom_device_nor, |
| 92 | }; |
| 93 | |
Ben Dooks | 5fe10ab | 2005-09-20 17:24:33 +0100 | [diff] [blame] | 94 | static void __init otom11_map_io(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | { |
| 96 | s3c24xx_init_io(otom11_iodesc, ARRAY_SIZE(otom11_iodesc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | s3c24xx_init_uarts(otom11_uartcfgs, ARRAY_SIZE(otom11_uartcfgs)); |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame] | 98 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | } |
| 100 | |
Heiko Stuebner | 07ee5e7 | 2014-05-09 05:49:29 +0900 | [diff] [blame] | 101 | static void __init otom11_init_time(void) |
| 102 | { |
| 103 | s3c2410_init_clocks(12000000); |
| 104 | samsung_timer_init(); |
| 105 | } |
| 106 | |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 107 | static void __init otom11_init(void) |
| 108 | { |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 109 | s3c_i2c0_set_platdata(NULL); |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 110 | platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices)); |
| 111 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | |
| 113 | MACHINE_START(OTOM, "Nex Vision - Otom 1.1") |
Russell King | e9dea0c | 2005-07-03 17:38:58 +0100 | [diff] [blame] | 114 | /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ |
Nicolas Pitre | 69d5071 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 115 | .atag_offset = 0x100, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | .map_io = otom11_map_io, |
Ben Dooks | 57e5171 | 2007-04-20 11:19:16 +0100 | [diff] [blame] | 117 | .init_machine = otom11_init, |
Heiko Stuebner | f182aa1 | 2013-03-07 12:38:19 +0900 | [diff] [blame] | 118 | .init_irq = s3c2410_init_irq, |
Heiko Stuebner | 07ee5e7 | 2014-05-09 05:49:29 +0900 | [diff] [blame] | 119 | .init_time = otom11_init_time, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | MACHINE_END |