David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s3c2410/mach-tct_hammer.c |
| 2 | * |
| 3 | * Copyright (c) 2007 TinCanTools |
| 4 | * David Anders <danders@amltd.com> |
| 5 | |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of |
| 9 | * the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 19 | * MA 02111-1307 USA |
| 20 | * |
| 21 | * @History: |
| 22 | * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by |
| 23 | * Ben Dooks <ben@simtec.co.uk> |
| 24 | * |
| 25 | ***********************************************************************/ |
| 26 | |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/types.h> |
| 29 | #include <linux/interrupt.h> |
| 30 | #include <linux/list.h> |
| 31 | #include <linux/timer.h> |
| 32 | #include <linux/init.h> |
| 33 | #include <linux/device.h> |
| 34 | #include <linux/platform_device.h> |
| 35 | #include <linux/serial_core.h> |
Russell King | fced80c | 2008-09-06 12:10:45 +0100 | [diff] [blame] | 36 | #include <linux/io.h> |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 37 | |
| 38 | #include <asm/mach/arch.h> |
| 39 | #include <asm/mach/map.h> |
| 40 | #include <asm/mach/irq.h> |
| 41 | #include <asm/mach/flash.h> |
| 42 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 43 | #include <mach/hardware.h> |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 44 | #include <asm/irq.h> |
| 45 | #include <asm/mach-types.h> |
| 46 | |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 47 | #include <plat/regs-serial.h> |
Arnd Bergmann | 436d42c | 2012-08-24 15:22:12 +0200 | [diff] [blame] | 48 | #include <linux/platform_data/i2c-s3c2410.h> |
Ben Dooks | a2b7ba9 | 2008-10-07 22:26:09 +0100 | [diff] [blame] | 49 | #include <plat/devs.h> |
| 50 | #include <plat/cpu.h> |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 51 | |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 52 | #include <linux/mtd/mtd.h> |
| 53 | #include <linux/mtd/partitions.h> |
| 54 | #include <linux/mtd/map.h> |
| 55 | #include <linux/mtd/physmap.h> |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame^] | 56 | #include <plat/samsung-time.h> |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 57 | |
Kukjin Kim | b27b072 | 2012-01-03 14:02:03 +0100 | [diff] [blame] | 58 | #include "common.h" |
| 59 | |
Tushar Behera | f8dadf5 | 2012-05-12 16:12:25 +0900 | [diff] [blame] | 60 | static struct resource tct_hammer_nor_resource = |
| 61 | DEFINE_RES_MEM(0x00000000, SZ_16M); |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 62 | |
| 63 | static struct mtd_partition tct_hammer_mtd_partitions[] = { |
| 64 | { |
| 65 | .name = "System", |
| 66 | .size = 0x240000, |
| 67 | .offset = 0, |
| 68 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 69 | }, { |
| 70 | .name = "JFFS2", |
| 71 | .size = MTDPART_SIZ_FULL, |
| 72 | .offset = MTDPART_OFS_APPEND, |
| 73 | } |
| 74 | }; |
| 75 | |
| 76 | static struct physmap_flash_data tct_hammer_flash_data = { |
| 77 | .width = 2, |
| 78 | .parts = tct_hammer_mtd_partitions, |
| 79 | .nr_parts = ARRAY_SIZE(tct_hammer_mtd_partitions), |
| 80 | }; |
| 81 | |
| 82 | static struct platform_device tct_hammer_device_nor = { |
| 83 | .name = "physmap-flash", |
| 84 | .id = 0, |
| 85 | .dev = { |
| 86 | .platform_data = &tct_hammer_flash_data, |
| 87 | }, |
| 88 | .num_resources = 1, |
| 89 | .resource = &tct_hammer_nor_resource, |
| 90 | }; |
| 91 | |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 92 | static struct map_desc tct_hammer_iodesc[] __initdata = { |
| 93 | }; |
| 94 | |
| 95 | #define UCON S3C2410_UCON_DEFAULT |
| 96 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB |
| 97 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE |
| 98 | |
| 99 | static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = { |
| 100 | [0] = { |
| 101 | .hwport = 0, |
| 102 | .flags = 0, |
| 103 | .ucon = UCON, |
| 104 | .ulcon = ULCON, |
| 105 | .ufcon = UFCON, |
| 106 | }, |
| 107 | [1] = { |
| 108 | .hwport = 1, |
| 109 | .flags = 0, |
| 110 | .ucon = UCON, |
| 111 | .ulcon = ULCON, |
| 112 | .ufcon = UFCON, |
| 113 | }, |
| 114 | [2] = { |
| 115 | .hwport = 2, |
| 116 | .flags = 0, |
| 117 | .ucon = UCON, |
| 118 | .ulcon = ULCON, |
| 119 | .ufcon = UFCON, |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | |
| 124 | static struct platform_device *tct_hammer_devices[] __initdata = { |
| 125 | &s3c_device_adc, |
| 126 | &s3c_device_wdt, |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 127 | &s3c_device_i2c0, |
Ben Dooks | b813248 | 2009-11-23 00:13:39 +0000 | [diff] [blame] | 128 | &s3c_device_ohci, |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 129 | &s3c_device_rtc, |
| 130 | &s3c_device_usbgadget, |
| 131 | &s3c_device_sdi, |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 132 | &tct_hammer_device_nor, |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 133 | }; |
| 134 | |
| 135 | static void __init tct_hammer_map_io(void) |
| 136 | { |
| 137 | s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc)); |
| 138 | s3c24xx_init_clocks(0); |
| 139 | s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs)); |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame^] | 140 | samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4); |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 141 | } |
| 142 | |
| 143 | static void __init tct_hammer_init(void) |
| 144 | { |
Ben Dooks | 3e1b776 | 2008-10-31 16:14:40 +0000 | [diff] [blame] | 145 | s3c_i2c0_set_platdata(NULL); |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 146 | platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices)); |
| 147 | } |
| 148 | |
| 149 | MACHINE_START(TCT_HAMMER, "TCT_HAMMER") |
Nicolas Pitre | 69d5071 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 150 | .atag_offset = 0x100, |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 151 | .map_io = tct_hammer_map_io, |
| 152 | .init_irq = s3c24xx_init_irq, |
| 153 | .init_machine = tct_hammer_init, |
Romain Naour | 7f78b6e | 2013-01-09 18:47:04 -0800 | [diff] [blame^] | 154 | .init_time = samsung_timer_init, |
Kukjin Kim | b27b072 | 2012-01-03 14:02:03 +0100 | [diff] [blame] | 155 | .restart = s3c2410_restart, |
David Anders | 79b34af | 2008-04-10 22:36:59 +0100 | [diff] [blame] | 156 | MACHINE_END |