Magnus Damm | c793c1b | 2010-02-05 11:14:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * sh7367 processor support |
| 3 | * |
| 4 | * Copyright (C) 2010 Magnus Damm |
| 5 | * Copyright (C) 2008 Yoshihiro Shimoda |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | */ |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/init.h> |
| 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/irq.h> |
| 24 | #include <linux/platform_device.h> |
| 25 | #include <linux/delay.h> |
| 26 | #include <linux/input.h> |
| 27 | #include <linux/io.h> |
| 28 | #include <linux/serial_sci.h> |
Magnus Damm | c793c1b | 2010-02-05 11:14:49 +0000 | [diff] [blame] | 29 | #include <linux/sh_timer.h> |
| 30 | #include <mach/hardware.h> |
| 31 | #include <asm/mach-types.h> |
| 32 | #include <asm/mach/arch.h> |
| 33 | |
| 34 | static struct plat_sci_port scif0_platform_data = { |
| 35 | .mapbase = 0xe6c40000, |
| 36 | .flags = UPF_BOOT_AUTOCONF, |
| 37 | .type = PORT_SCIF, |
| 38 | .irqs = { 80, 80, 80, 80 }, |
| 39 | }; |
| 40 | |
| 41 | static struct platform_device scif0_device = { |
| 42 | .name = "sh-sci", |
| 43 | .id = 0, |
| 44 | .dev = { |
| 45 | .platform_data = &scif0_platform_data, |
| 46 | }, |
| 47 | }; |
| 48 | |
| 49 | static struct plat_sci_port scif1_platform_data = { |
| 50 | .mapbase = 0xe6c50000, |
| 51 | .flags = UPF_BOOT_AUTOCONF, |
| 52 | .type = PORT_SCIF, |
| 53 | .irqs = { 81, 81, 81, 81 }, |
| 54 | }; |
| 55 | |
| 56 | static struct platform_device scif1_device = { |
| 57 | .name = "sh-sci", |
| 58 | .id = 1, |
| 59 | .dev = { |
| 60 | .platform_data = &scif1_platform_data, |
| 61 | }, |
| 62 | }; |
| 63 | |
| 64 | static struct plat_sci_port scif2_platform_data = { |
| 65 | .mapbase = 0xe6c60000, |
| 66 | .flags = UPF_BOOT_AUTOCONF, |
| 67 | .type = PORT_SCIF, |
| 68 | .irqs = { 82, 82, 82, 82 }, |
| 69 | }; |
| 70 | |
| 71 | static struct platform_device scif2_device = { |
| 72 | .name = "sh-sci", |
| 73 | .id = 2, |
| 74 | .dev = { |
| 75 | .platform_data = &scif2_platform_data, |
| 76 | }, |
| 77 | }; |
| 78 | |
| 79 | static struct plat_sci_port scif3_platform_data = { |
| 80 | .mapbase = 0xe6c70000, |
| 81 | .flags = UPF_BOOT_AUTOCONF, |
| 82 | .type = PORT_SCIF, |
| 83 | .irqs = { 83, 83, 83, 83 }, |
| 84 | }; |
| 85 | |
| 86 | static struct platform_device scif3_device = { |
| 87 | .name = "sh-sci", |
| 88 | .id = 3, |
| 89 | .dev = { |
| 90 | .platform_data = &scif3_platform_data, |
| 91 | }, |
| 92 | }; |
| 93 | |
| 94 | static struct plat_sci_port scif4_platform_data = { |
| 95 | .mapbase = 0xe6c80000, |
| 96 | .flags = UPF_BOOT_AUTOCONF, |
| 97 | .type = PORT_SCIF, |
| 98 | .irqs = { 89, 89, 89, 89 }, |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device scif4_device = { |
| 102 | .name = "sh-sci", |
| 103 | .id = 4, |
| 104 | .dev = { |
| 105 | .platform_data = &scif4_platform_data, |
| 106 | }, |
| 107 | }; |
| 108 | |
| 109 | static struct plat_sci_port scif5_platform_data = { |
| 110 | .mapbase = 0xe6cb0000, |
| 111 | .flags = UPF_BOOT_AUTOCONF, |
| 112 | .type = PORT_SCIF, |
| 113 | .irqs = { 90, 90, 90, 90 }, |
| 114 | }; |
| 115 | |
| 116 | static struct platform_device scif5_device = { |
| 117 | .name = "sh-sci", |
| 118 | .id = 5, |
| 119 | .dev = { |
| 120 | .platform_data = &scif5_platform_data, |
| 121 | }, |
| 122 | }; |
| 123 | |
| 124 | static struct plat_sci_port scif6_platform_data = { |
| 125 | .mapbase = 0xe6c30000, |
| 126 | .flags = UPF_BOOT_AUTOCONF, |
| 127 | .type = PORT_SCIF, |
| 128 | .irqs = { 91, 91, 91, 91 }, |
| 129 | }; |
| 130 | |
| 131 | static struct platform_device scif6_device = { |
| 132 | .name = "sh-sci", |
| 133 | .id = 6, |
| 134 | .dev = { |
| 135 | .platform_data = &scif6_platform_data, |
| 136 | }, |
| 137 | }; |
| 138 | |
| 139 | static struct sh_timer_config cmt10_platform_data = { |
| 140 | .name = "CMT10", |
| 141 | .channel_offset = 0x10, |
| 142 | .timer_bit = 0, |
| 143 | .clk = "r_clk", |
| 144 | .clockevent_rating = 125, |
| 145 | .clocksource_rating = 125, |
| 146 | }; |
| 147 | |
| 148 | static struct resource cmt10_resources[] = { |
| 149 | [0] = { |
| 150 | .name = "CMT10", |
| 151 | .start = 0xe6138010, |
| 152 | .end = 0xe613801b, |
| 153 | .flags = IORESOURCE_MEM, |
| 154 | }, |
| 155 | [1] = { |
| 156 | .start = 72, |
| 157 | .flags = IORESOURCE_IRQ, |
| 158 | }, |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device cmt10_device = { |
| 162 | .name = "sh_cmt", |
| 163 | .id = 10, |
| 164 | .dev = { |
| 165 | .platform_data = &cmt10_platform_data, |
| 166 | }, |
| 167 | .resource = cmt10_resources, |
| 168 | .num_resources = ARRAY_SIZE(cmt10_resources), |
| 169 | }; |
| 170 | |
| 171 | static struct platform_device *sh7367_early_devices[] __initdata = { |
| 172 | &scif0_device, |
| 173 | &scif1_device, |
| 174 | &scif2_device, |
| 175 | &scif3_device, |
| 176 | &scif4_device, |
| 177 | &scif5_device, |
| 178 | &scif6_device, |
| 179 | &cmt10_device, |
| 180 | }; |
| 181 | |
| 182 | void __init sh7367_add_standard_devices(void) |
| 183 | { |
| 184 | platform_add_devices(sh7367_early_devices, |
| 185 | ARRAY_SIZE(sh7367_early_devices)); |
| 186 | } |
| 187 | |
| 188 | #define SYMSTPCR2 0xe6158048 |
| 189 | #define SYMSTPCR2_CMT1 (1 << 29) |
| 190 | |
| 191 | void __init sh7367_add_early_devices(void) |
| 192 | { |
| 193 | /* enable clock to CMT1 */ |
| 194 | __raw_writel(__raw_readl(SYMSTPCR2) & ~SYMSTPCR2_CMT1, SYMSTPCR2); |
| 195 | |
| 196 | early_platform_add_devices(sh7367_early_devices, |
| 197 | ARRAY_SIZE(sh7367_early_devices)); |
| 198 | } |