Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 1 | /* |
| 2 | * r8a7779 processor support |
| 3 | * |
Sergei Shtylyov | dace48d | 2013-04-04 18:53:50 +0000 | [diff] [blame^] | 4 | * Copyright (C) 2011, 2013 Renesas Solutions Corp. |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 5 | * Copyright (C) 2011 Magnus Damm |
Sergei Shtylyov | dace48d | 2013-04-04 18:53:50 +0000 | [diff] [blame^] | 6 | * Copyright (C) 2013 Cogent Embedded, Inc. |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; version 2 of the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/init.h> |
| 23 | #include <linux/interrupt.h> |
| 24 | #include <linux/irq.h> |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 25 | #include <linux/of_platform.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 26 | #include <linux/platform_device.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/input.h> |
| 29 | #include <linux/io.h> |
| 30 | #include <linux/serial_sci.h> |
| 31 | #include <linux/sh_intc.h> |
| 32 | #include <linux/sh_timer.h> |
Vladimir Barinov | a7b9837 | 2013-02-27 23:39:14 +0300 | [diff] [blame] | 33 | #include <linux/dma-mapping.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 34 | #include <mach/hardware.h> |
Rob Herring | 250a272 | 2012-01-03 16:57:33 -0600 | [diff] [blame] | 35 | #include <mach/irqs.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 36 | #include <mach/r8a7779.h> |
Magnus Damm | a662c08 | 2012-01-10 15:50:01 +0900 | [diff] [blame] | 37 | #include <mach/common.h> |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 38 | #include <asm/mach-types.h> |
| 39 | #include <asm/mach/arch.h> |
Magnus Damm | df27a2d | 2012-03-06 17:37:01 +0900 | [diff] [blame] | 40 | #include <asm/mach/time.h> |
Magnus Damm | 3e353b87 | 2012-02-29 21:37:43 +0900 | [diff] [blame] | 41 | #include <asm/mach/map.h> |
Magnus Damm | 8bac13f | 2012-03-01 12:48:03 +0900 | [diff] [blame] | 42 | #include <asm/hardware/cache-l2x0.h> |
Magnus Damm | 3e353b87 | 2012-02-29 21:37:43 +0900 | [diff] [blame] | 43 | |
| 44 | static struct map_desc r8a7779_io_desc[] __initdata = { |
| 45 | /* 2M entity map for 0xf0000000 (MPCORE) */ |
| 46 | { |
| 47 | .virtual = 0xf0000000, |
| 48 | .pfn = __phys_to_pfn(0xf0000000), |
| 49 | .length = SZ_2M, |
| 50 | .type = MT_DEVICE_NONSHARED |
| 51 | }, |
| 52 | /* 16M entity map for 0xfexxxxxx (DMAC-S/HPBREG/INTC2/LRAM/DBSC) */ |
| 53 | { |
| 54 | .virtual = 0xfe000000, |
| 55 | .pfn = __phys_to_pfn(0xfe000000), |
| 56 | .length = SZ_16M, |
| 57 | .type = MT_DEVICE_NONSHARED |
| 58 | }, |
| 59 | }; |
| 60 | |
| 61 | void __init r8a7779_map_io(void) |
| 62 | { |
| 63 | iotable_init(r8a7779_io_desc, ARRAY_SIZE(r8a7779_io_desc)); |
| 64 | } |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 65 | |
Laurent Pinchart | 8b6edf3 | 2012-12-15 23:51:26 +0100 | [diff] [blame] | 66 | static struct resource r8a7779_pfc_resources[] = { |
| 67 | [0] = { |
| 68 | .start = 0xfffc0000, |
| 69 | .end = 0xfffc023b, |
| 70 | .flags = IORESOURCE_MEM, |
| 71 | }, |
| 72 | [1] = { |
| 73 | .start = 0xffc40000, |
| 74 | .end = 0xffc46fff, |
| 75 | .flags = IORESOURCE_MEM, |
| 76 | } |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device r8a7779_pfc_device = { |
| 80 | .name = "pfc-r8a7779", |
| 81 | .id = -1, |
| 82 | .resource = r8a7779_pfc_resources, |
| 83 | .num_resources = ARRAY_SIZE(r8a7779_pfc_resources), |
| 84 | }; |
| 85 | |
| 86 | void __init r8a7779_pinmux_init(void) |
| 87 | { |
| 88 | platform_device_register(&r8a7779_pfc_device); |
| 89 | } |
| 90 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 91 | static struct plat_sci_port scif0_platform_data = { |
| 92 | .mapbase = 0xffe40000, |
| 93 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 94 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 95 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 96 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 97 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | static struct platform_device scif0_device = { |
| 101 | .name = "sh-sci", |
| 102 | .id = 0, |
| 103 | .dev = { |
| 104 | .platform_data = &scif0_platform_data, |
| 105 | }, |
| 106 | }; |
| 107 | |
| 108 | static struct plat_sci_port scif1_platform_data = { |
| 109 | .mapbase = 0xffe41000, |
| 110 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 111 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 112 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 113 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 114 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | static struct platform_device scif1_device = { |
| 118 | .name = "sh-sci", |
| 119 | .id = 1, |
| 120 | .dev = { |
| 121 | .platform_data = &scif1_platform_data, |
| 122 | }, |
| 123 | }; |
| 124 | |
| 125 | static struct plat_sci_port scif2_platform_data = { |
| 126 | .mapbase = 0xffe42000, |
| 127 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 128 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 129 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 130 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 131 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | static struct platform_device scif2_device = { |
| 135 | .name = "sh-sci", |
| 136 | .id = 2, |
| 137 | .dev = { |
| 138 | .platform_data = &scif2_platform_data, |
| 139 | }, |
| 140 | }; |
| 141 | |
| 142 | static struct plat_sci_port scif3_platform_data = { |
| 143 | .mapbase = 0xffe43000, |
| 144 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 145 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 146 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 147 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 148 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 149 | }; |
| 150 | |
| 151 | static struct platform_device scif3_device = { |
| 152 | .name = "sh-sci", |
| 153 | .id = 3, |
| 154 | .dev = { |
| 155 | .platform_data = &scif3_platform_data, |
| 156 | }, |
| 157 | }; |
| 158 | |
| 159 | static struct plat_sci_port scif4_platform_data = { |
| 160 | .mapbase = 0xffe44000, |
| 161 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 162 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 163 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 164 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 165 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | static struct platform_device scif4_device = { |
| 169 | .name = "sh-sci", |
| 170 | .id = 4, |
| 171 | .dev = { |
| 172 | .platform_data = &scif4_platform_data, |
| 173 | }, |
| 174 | }; |
| 175 | |
| 176 | static struct plat_sci_port scif5_platform_data = { |
| 177 | .mapbase = 0xffe45000, |
| 178 | .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, |
| 179 | .scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1, |
| 180 | .scbrr_algo_id = SCBRR_ALGO_2, |
| 181 | .type = PORT_SCIF, |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 182 | .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | static struct platform_device scif5_device = { |
| 186 | .name = "sh-sci", |
| 187 | .id = 5, |
| 188 | .dev = { |
| 189 | .platform_data = &scif5_platform_data, |
| 190 | }, |
| 191 | }; |
| 192 | |
| 193 | /* TMU */ |
| 194 | static struct sh_timer_config tmu00_platform_data = { |
| 195 | .name = "TMU00", |
| 196 | .channel_offset = 0x4, |
| 197 | .timer_bit = 0, |
| 198 | .clockevent_rating = 200, |
| 199 | }; |
| 200 | |
| 201 | static struct resource tmu00_resources[] = { |
| 202 | [0] = { |
| 203 | .name = "TMU00", |
| 204 | .start = 0xffd80008, |
| 205 | .end = 0xffd80013, |
| 206 | .flags = IORESOURCE_MEM, |
| 207 | }, |
| 208 | [1] = { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 209 | .start = gic_iid(0x40), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 210 | .flags = IORESOURCE_IRQ, |
| 211 | }, |
| 212 | }; |
| 213 | |
| 214 | static struct platform_device tmu00_device = { |
| 215 | .name = "sh_tmu", |
| 216 | .id = 0, |
| 217 | .dev = { |
| 218 | .platform_data = &tmu00_platform_data, |
| 219 | }, |
| 220 | .resource = tmu00_resources, |
| 221 | .num_resources = ARRAY_SIZE(tmu00_resources), |
| 222 | }; |
| 223 | |
| 224 | static struct sh_timer_config tmu01_platform_data = { |
| 225 | .name = "TMU01", |
| 226 | .channel_offset = 0x10, |
| 227 | .timer_bit = 1, |
| 228 | .clocksource_rating = 200, |
| 229 | }; |
| 230 | |
| 231 | static struct resource tmu01_resources[] = { |
| 232 | [0] = { |
| 233 | .name = "TMU01", |
| 234 | .start = 0xffd80014, |
| 235 | .end = 0xffd8001f, |
| 236 | .flags = IORESOURCE_MEM, |
| 237 | }, |
| 238 | [1] = { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 239 | .start = gic_iid(0x41), |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 240 | .flags = IORESOURCE_IRQ, |
| 241 | }, |
| 242 | }; |
| 243 | |
| 244 | static struct platform_device tmu01_device = { |
| 245 | .name = "sh_tmu", |
| 246 | .id = 1, |
| 247 | .dev = { |
| 248 | .platform_data = &tmu01_platform_data, |
| 249 | }, |
| 250 | .resource = tmu01_resources, |
| 251 | .num_resources = ARRAY_SIZE(tmu01_resources), |
| 252 | }; |
| 253 | |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 254 | /* I2C */ |
| 255 | static struct resource rcar_i2c0_res[] = { |
| 256 | { |
| 257 | .start = 0xffc70000, |
| 258 | .end = 0xffc70fff, |
| 259 | .flags = IORESOURCE_MEM, |
| 260 | }, { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 261 | .start = gic_iid(0x6f), |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 262 | .flags = IORESOURCE_IRQ, |
| 263 | }, |
| 264 | }; |
| 265 | |
| 266 | static struct platform_device i2c0_device = { |
| 267 | .name = "i2c-rcar", |
| 268 | .id = 0, |
| 269 | .resource = rcar_i2c0_res, |
| 270 | .num_resources = ARRAY_SIZE(rcar_i2c0_res), |
| 271 | }; |
| 272 | |
| 273 | static struct resource rcar_i2c1_res[] = { |
| 274 | { |
| 275 | .start = 0xffc71000, |
| 276 | .end = 0xffc71fff, |
| 277 | .flags = IORESOURCE_MEM, |
| 278 | }, { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 279 | .start = gic_iid(0x72), |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 280 | .flags = IORESOURCE_IRQ, |
| 281 | }, |
| 282 | }; |
| 283 | |
| 284 | static struct platform_device i2c1_device = { |
| 285 | .name = "i2c-rcar", |
| 286 | .id = 1, |
| 287 | .resource = rcar_i2c1_res, |
| 288 | .num_resources = ARRAY_SIZE(rcar_i2c1_res), |
| 289 | }; |
| 290 | |
| 291 | static struct resource rcar_i2c2_res[] = { |
| 292 | { |
| 293 | .start = 0xffc72000, |
| 294 | .end = 0xffc72fff, |
| 295 | .flags = IORESOURCE_MEM, |
| 296 | }, { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 297 | .start = gic_iid(0x70), |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 298 | .flags = IORESOURCE_IRQ, |
| 299 | }, |
| 300 | }; |
| 301 | |
| 302 | static struct platform_device i2c2_device = { |
| 303 | .name = "i2c-rcar", |
| 304 | .id = 2, |
| 305 | .resource = rcar_i2c2_res, |
| 306 | .num_resources = ARRAY_SIZE(rcar_i2c2_res), |
| 307 | }; |
| 308 | |
| 309 | static struct resource rcar_i2c3_res[] = { |
| 310 | { |
| 311 | .start = 0xffc73000, |
| 312 | .end = 0xffc73fff, |
| 313 | .flags = IORESOURCE_MEM, |
| 314 | }, { |
Kuninori Morimoto | dbe95ad | 2013-03-03 23:11:41 -0800 | [diff] [blame] | 315 | .start = gic_iid(0x71), |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 316 | .flags = IORESOURCE_IRQ, |
| 317 | }, |
| 318 | }; |
| 319 | |
| 320 | static struct platform_device i2c3_device = { |
| 321 | .name = "i2c-rcar", |
| 322 | .id = 3, |
| 323 | .resource = rcar_i2c3_res, |
| 324 | .num_resources = ARRAY_SIZE(rcar_i2c3_res), |
| 325 | }; |
| 326 | |
Vladimir Barinov | a7b9837 | 2013-02-27 23:39:14 +0300 | [diff] [blame] | 327 | static struct resource sata_resources[] = { |
| 328 | [0] = { |
| 329 | .name = "rcar-sata", |
| 330 | .start = 0xfc600000, |
| 331 | .end = 0xfc601fff, |
| 332 | .flags = IORESOURCE_MEM, |
| 333 | }, |
| 334 | [1] = { |
Sergei Shtylyov | d60cd5f | 2013-03-08 02:31:03 +0300 | [diff] [blame] | 335 | .start = gic_iid(0x84), |
Vladimir Barinov | a7b9837 | 2013-02-27 23:39:14 +0300 | [diff] [blame] | 336 | .flags = IORESOURCE_IRQ, |
| 337 | }, |
| 338 | }; |
| 339 | |
| 340 | static struct platform_device sata_device = { |
| 341 | .name = "sata_rcar", |
| 342 | .id = -1, |
| 343 | .resource = sata_resources, |
| 344 | .num_resources = ARRAY_SIZE(sata_resources), |
| 345 | .dev = { |
| 346 | .dma_mask = &sata_device.dev.coherent_dma_mask, |
| 347 | .coherent_dma_mask = DMA_BIT_MASK(32), |
| 348 | }, |
| 349 | }; |
| 350 | |
Sergei Shtylyov | dace48d | 2013-04-04 18:53:50 +0000 | [diff] [blame^] | 351 | /* Ether */ |
| 352 | static struct resource ether_resources[] = { |
| 353 | { |
| 354 | .start = 0xfde00000, |
| 355 | .end = 0xfde003ff, |
| 356 | .flags = IORESOURCE_MEM, |
| 357 | }, { |
| 358 | .start = gic_iid(0xb4), |
| 359 | .flags = IORESOURCE_IRQ, |
| 360 | }, |
| 361 | }; |
| 362 | |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 363 | static struct platform_device *r8a7779_devices_dt[] __initdata = { |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 364 | &scif0_device, |
| 365 | &scif1_device, |
| 366 | &scif2_device, |
| 367 | &scif3_device, |
| 368 | &scif4_device, |
| 369 | &scif5_device, |
| 370 | &tmu00_device, |
| 371 | &tmu01_device, |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 372 | }; |
| 373 | |
Simon Horman | e792120 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 374 | static struct platform_device *r8a7779_late_devices[] __initdata = { |
Kuninori Morimoto | ccc2a27 | 2012-10-10 19:56:51 -0700 | [diff] [blame] | 375 | &i2c0_device, |
| 376 | &i2c1_device, |
| 377 | &i2c2_device, |
| 378 | &i2c3_device, |
Vladimir Barinov | a7b9837 | 2013-02-27 23:39:14 +0300 | [diff] [blame] | 379 | &sata_device, |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 380 | }; |
| 381 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 382 | void __init r8a7779_add_standard_devices(void) |
| 383 | { |
Magnus Damm | 8bac13f | 2012-03-01 12:48:03 +0900 | [diff] [blame] | 384 | #ifdef CONFIG_CACHE_L2X0 |
| 385 | /* Early BRESP enable, Shared attribute override enable, 64K*16way */ |
Kuninori Morimoto | ed7d132 | 2012-10-14 23:35:24 -0700 | [diff] [blame] | 386 | l2x0_init(IOMEM(0xf0100000), 0x40470000, 0x82000fff); |
Magnus Damm | 8bac13f | 2012-03-01 12:48:03 +0900 | [diff] [blame] | 387 | #endif |
Magnus Damm | a662c08 | 2012-01-10 15:50:01 +0900 | [diff] [blame] | 388 | r8a7779_pm_init(); |
| 389 | |
Rafael J. Wysocki | 45e5ca5 | 2012-08-07 01:14:14 +0200 | [diff] [blame] | 390 | r8a7779_init_pm_domains(); |
Magnus Damm | a662c08 | 2012-01-10 15:50:01 +0900 | [diff] [blame] | 391 | |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 392 | platform_add_devices(r8a7779_devices_dt, |
| 393 | ARRAY_SIZE(r8a7779_devices_dt)); |
Simon Horman | e792120 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 394 | platform_add_devices(r8a7779_late_devices, |
| 395 | ARRAY_SIZE(r8a7779_late_devices)); |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 396 | } |
| 397 | |
Sergei Shtylyov | dace48d | 2013-04-04 18:53:50 +0000 | [diff] [blame^] | 398 | void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) |
| 399 | { |
| 400 | platform_device_register_resndata(&platform_bus, "sh_eth", -1, |
| 401 | ether_resources, |
| 402 | ARRAY_SIZE(ether_resources), |
| 403 | pdata, sizeof(*pdata)); |
| 404 | } |
| 405 | |
Magnus Damm | b759bd1 | 2012-05-10 14:57:22 +0900 | [diff] [blame] | 406 | /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ |
| 407 | void __init __weak r8a7779_register_twd(void) { } |
| 408 | |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 409 | void __init r8a7779_earlytimer_init(void) |
Magnus Damm | df27a2d | 2012-03-06 17:37:01 +0900 | [diff] [blame] | 410 | { |
| 411 | r8a7779_clock_init(); |
| 412 | shmobile_earlytimer_init(); |
Magnus Damm | b759bd1 | 2012-05-10 14:57:22 +0900 | [diff] [blame] | 413 | r8a7779_register_twd(); |
Magnus Damm | df27a2d | 2012-03-06 17:37:01 +0900 | [diff] [blame] | 414 | } |
| 415 | |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 416 | void __init r8a7779_add_early_devices(void) |
| 417 | { |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 418 | early_platform_add_devices(r8a7779_devices_dt, |
| 419 | ARRAY_SIZE(r8a7779_devices_dt)); |
Magnus Damm | 3e353b87 | 2012-02-29 21:37:43 +0900 | [diff] [blame] | 420 | |
| 421 | /* Early serial console setup is not included here due to |
| 422 | * memory map collisions. The SCIF serial ports in r8a7779 |
| 423 | * are difficult to entity map 1:1 due to collision with the |
| 424 | * virtual memory range used by the coherent DMA code on ARM. |
| 425 | * |
| 426 | * Anyone wanting to debug early can remove UPF_IOREMAP from |
| 427 | * the sh-sci serial console platform data, adjust mapbase |
| 428 | * to a static M:N virt:phys mapping that needs to be added to |
| 429 | * the mappings passed with iotable_init() above. |
| 430 | * |
| 431 | * Then add a call to shmobile_setup_console() from this function. |
| 432 | * |
| 433 | * As a final step pass earlyprint=sh-sci.2,115200 on the kernel |
| 434 | * command line in case of the marzen board. |
| 435 | */ |
Magnus Damm | f411fad | 2011-12-14 01:36:12 +0900 | [diff] [blame] | 436 | } |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 437 | |
| 438 | #ifdef CONFIG_USE_OF |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 439 | void __init r8a7779_init_delay(void) |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 440 | { |
| 441 | shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */ |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = { |
| 445 | {}, |
| 446 | }; |
| 447 | |
| 448 | void __init r8a7779_add_standard_devices_dt(void) |
| 449 | { |
| 450 | /* clocks are setup late during boot in the case of DT */ |
| 451 | r8a7779_clock_init(); |
| 452 | |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 453 | platform_add_devices(r8a7779_devices_dt, |
| 454 | ARRAY_SIZE(r8a7779_devices_dt)); |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 455 | of_platform_populate(NULL, of_default_bus_match_table, |
| 456 | r8a7779_auxdata_lookup, NULL); |
| 457 | } |
| 458 | |
| 459 | static const char *r8a7779_compat_dt[] __initdata = { |
| 460 | "renesas,r8a7779", |
| 461 | NULL, |
| 462 | }; |
| 463 | |
Kuninori Morimoto | abe0e14 | 2013-03-03 23:11:20 -0800 | [diff] [blame] | 464 | DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 465 | .map_io = r8a7779_map_io, |
Simon Horman | 916ddc3 | 2013-02-19 10:53:05 +0900 | [diff] [blame] | 466 | .init_early = r8a7779_init_delay, |
Simon Horman | 10e8d4f | 2012-11-21 22:00:15 +0900 | [diff] [blame] | 467 | .nr_irqs = NR_IRQS_LEGACY, |
| 468 | .init_irq = r8a7779_init_irq_dt, |
| 469 | .init_machine = r8a7779_add_standard_devices_dt, |
| 470 | .init_time = shmobile_timer_init, |
| 471 | .dt_compat = r8a7779_compat_dt, |
| 472 | MACHINE_END |
| 473 | #endif /* CONFIG_USE_OF */ |