1 // SPDX-License-Identifier: GPL-2.0+
3 // Copyright (c) 2007 TinCanTools
7 // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
10 #include <linux/gpio/machine.h>
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>
17 #include <linux/device.h>
18 #include <linux/platform_device.h>
19 #include <linux/serial_core.h>
20 #include <linux/serial_s3c.h>
23 #include <asm/mach/arch.h>
24 #include <asm/mach/map.h>
25 #include <asm/mach/irq.h>
26 #include <asm/mach/flash.h>
29 #include <asm/mach-types.h>
31 #include <linux/platform_data/i2c-s3c2410.h>
35 #include <linux/mtd/mtd.h>
36 #include <linux/mtd/partitions.h>
37 #include <linux/mtd/map.h>
38 #include <linux/mtd/physmap.h>
42 static struct resource tct_hammer_nor_resource =
43 DEFINE_RES_MEM(0x00000000, SZ_16M);
45 static struct mtd_partition tct_hammer_mtd_partitions[] = {
50 .mask_flags = MTD_WRITEABLE, /* force read-only */
53 .size = MTDPART_SIZ_FULL,
54 .offset = MTDPART_OFS_APPEND,
58 static struct physmap_flash_data tct_hammer_flash_data = {
60 .parts = tct_hammer_mtd_partitions,
61 .nr_parts = ARRAY_SIZE(tct_hammer_mtd_partitions),
64 static struct platform_device tct_hammer_device_nor = {
65 .name = "physmap-flash",
68 .platform_data = &tct_hammer_flash_data,
71 .resource = &tct_hammer_nor_resource,
74 static struct map_desc tct_hammer_iodesc[] __initdata = {
77 #define UCON S3C2410_UCON_DEFAULT
78 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
79 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
81 static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
105 static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
106 .dev_id = "s3c2410-sdi",
109 GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
110 GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
111 GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
112 GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
113 GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
114 GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
119 static struct platform_device *tct_hammer_devices[] __initdata = {
125 &s3c_device_usbgadget,
127 &tct_hammer_device_nor,
130 static void __init tct_hammer_map_io(void)
132 s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
133 s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
134 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
137 static void __init tct_hammer_init_time(void)
139 s3c2410_init_clocks(12000000);
140 s3c24xx_timer_init();
143 static void __init tct_hammer_init(void)
145 s3c_i2c0_set_platdata(NULL);
146 gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
147 platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
150 MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
151 .atag_offset = 0x100,
152 .nr_irqs = NR_IRQS_S3C2410,
153 .map_io = tct_hammer_map_io,
154 .init_irq = s3c2410_init_irq,
155 .init_machine = tct_hammer_init,
156 .init_time = tct_hammer_init_time,