GNU Linux-libre 4.19.263-gnu1
[releases.git] / arch / arm / mach-s3c24xx / mach-tct_hammer.c
1 // SPDX-License-Identifier: GPL-2.0+
2 //
3 // Copyright (c) 2007 TinCanTools
4 //      David Anders <danders@amltd.com>
5 //
6 // @History:
7 // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
8 // Ben Dooks <ben@simtec.co.uk>
9
10 #include <linux/kernel.h>
11 #include <linux/types.h>
12 #include <linux/interrupt.h>
13 #include <linux/list.h>
14 #include <linux/timer.h>
15 #include <linux/init.h>
16 #include <linux/device.h>
17 #include <linux/platform_device.h>
18 #include <linux/serial_core.h>
19 #include <linux/serial_s3c.h>
20 #include <linux/io.h>
21
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
24 #include <asm/mach/irq.h>
25 #include <asm/mach/flash.h>
26
27 #include <mach/hardware.h>
28 #include <asm/irq.h>
29 #include <asm/mach-types.h>
30
31 #include <linux/platform_data/i2c-s3c2410.h>
32 #include <plat/devs.h>
33 #include <plat/cpu.h>
34
35 #include <linux/mtd/mtd.h>
36 #include <linux/mtd/partitions.h>
37 #include <linux/mtd/map.h>
38 #include <linux/mtd/physmap.h>
39 #include <plat/samsung-time.h>
40
41 #include "common.h"
42
43 static struct resource tct_hammer_nor_resource =
44                         DEFINE_RES_MEM(0x00000000, SZ_16M);
45
46 static struct mtd_partition tct_hammer_mtd_partitions[] = {
47         {
48                 .name           = "System",
49                 .size           = 0x240000,
50                 .offset         = 0,
51                 .mask_flags     = MTD_WRITEABLE,  /* force read-only */
52         }, {
53                 .name           = "JFFS2",
54                 .size           = MTDPART_SIZ_FULL,
55                 .offset         = MTDPART_OFS_APPEND,
56         }
57 };
58
59 static struct physmap_flash_data tct_hammer_flash_data = {
60         .width          = 2,
61         .parts          = tct_hammer_mtd_partitions,
62         .nr_parts       = ARRAY_SIZE(tct_hammer_mtd_partitions),
63 };
64
65 static struct platform_device tct_hammer_device_nor = {
66         .name           = "physmap-flash",
67         .id             = 0,
68         .dev = {
69                         .platform_data = &tct_hammer_flash_data,
70                 },
71         .num_resources  = 1,
72         .resource       = &tct_hammer_nor_resource,
73 };
74
75 static struct map_desc tct_hammer_iodesc[] __initdata = {
76 };
77
78 #define UCON S3C2410_UCON_DEFAULT
79 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
80 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
81
82 static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
83         [0] = {
84                 .hwport      = 0,
85                 .flags       = 0,
86                 .ucon        = UCON,
87                 .ulcon       = ULCON,
88                 .ufcon       = UFCON,
89         },
90         [1] = {
91                 .hwport      = 1,
92                 .flags       = 0,
93                 .ucon        = UCON,
94                 .ulcon       = ULCON,
95                 .ufcon       = UFCON,
96         },
97         [2] = {
98                 .hwport      = 2,
99                 .flags       = 0,
100                 .ucon        = UCON,
101                 .ulcon       = ULCON,
102                 .ufcon       = UFCON,
103         }
104 };
105
106
107 static struct platform_device *tct_hammer_devices[] __initdata = {
108         &s3c_device_adc,
109         &s3c_device_wdt,
110         &s3c_device_i2c0,
111         &s3c_device_ohci,
112         &s3c_device_rtc,
113         &s3c_device_usbgadget,
114         &s3c_device_sdi,
115         &tct_hammer_device_nor,
116 };
117
118 static void __init tct_hammer_map_io(void)
119 {
120         s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
121         s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
122         samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
123 }
124
125 static void __init tct_hammer_init_time(void)
126 {
127         s3c2410_init_clocks(12000000);
128         samsung_timer_init();
129 }
130
131 static void __init tct_hammer_init(void)
132 {
133         s3c_i2c0_set_platdata(NULL);
134         platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
135 }
136
137 MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
138         .atag_offset    = 0x100,
139         .map_io         = tct_hammer_map_io,
140         .init_irq       = s3c2410_init_irq,
141         .init_machine   = tct_hammer_init,
142         .init_time      = tct_hammer_init_time,
143 MACHINE_END