Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net> |
| 3 | * |
| 4 | * arch/arm/mach-kirkwood/board-dt.c |
| 5 | * |
Jason Cooper | 6fa6b87 | 2012-03-15 00:52:31 +0000 | [diff] [blame] | 6 | * Flattened Device Tree board initialization |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 7 | * |
| 8 | * This file is licensed under the terms of the GNU General Public |
| 9 | * License version 2. This program is licensed "as is" without any |
| 10 | * warranty of any kind, whether express or implied. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/init.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 15 | #include <linux/of.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 16 | #include <linux/of_platform.h> |
Ian Campbell | a7ac56d | 2012-04-29 14:40:42 +0100 | [diff] [blame] | 17 | #include <linux/kexec.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 18 | #include <asm/mach/arch.h> |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 19 | #include <asm/mach/map.h> |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 20 | #include <mach/bridge-regs.h> |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 21 | #include <plat/irq.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 22 | #include "common.h" |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 23 | |
| 24 | static struct of_device_id kirkwood_dt_match_table[] __initdata = { |
| 25 | { .compatible = "simple-bus", }, |
| 26 | { } |
| 27 | }; |
| 28 | |
Michael Walle | 7637212 | 2012-06-06 20:30:57 +0200 | [diff] [blame] | 29 | struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = { |
| 30 | OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), |
Andrew Lunn | e91cac0 | 2012-07-20 13:51:55 +0200 | [diff] [blame^] | 31 | OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", |
| 32 | NULL), |
Michael Walle | 7637212 | 2012-06-06 20:30:57 +0200 | [diff] [blame] | 33 | {}, |
| 34 | }; |
| 35 | |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 36 | static void __init kirkwood_dt_init(void) |
| 37 | { |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 38 | pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); |
| 39 | |
| 40 | /* |
| 41 | * Disable propagation of mbus errors to the CPU local bus, |
| 42 | * as this causes mbus errors (which can occur for example |
| 43 | * for PCI aborts) to throw CPU aborts, which we're not set |
| 44 | * up to deal with. |
| 45 | */ |
| 46 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); |
| 47 | |
| 48 | kirkwood_setup_cpu_mbus(); |
| 49 | |
| 50 | #ifdef CONFIG_CACHE_FEROCEON_L2 |
| 51 | kirkwood_l2_init(); |
| 52 | #endif |
| 53 | |
Andrew Lunn | 2f129bf | 2011-12-15 08:15:07 +0100 | [diff] [blame] | 54 | /* Setup root of clk tree */ |
| 55 | kirkwood_clk_init(); |
| 56 | |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 57 | /* internal devices that every board has */ |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 58 | kirkwood_wdt_init(); |
| 59 | kirkwood_xor0_init(); |
| 60 | kirkwood_xor1_init(); |
| 61 | kirkwood_crypto_init(); |
| 62 | |
| 63 | #ifdef CONFIG_KEXEC |
| 64 | kexec_reinit = kirkwood_enable_pcie; |
| 65 | #endif |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 66 | |
| 67 | if (of_machine_is_compatible("globalscale,dreamplug")) |
| 68 | dreamplug_init(); |
| 69 | |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 70 | if (of_machine_is_compatible("dlink,dns-kirkwood")) |
| 71 | dnskw_init(); |
| 72 | |
Arnaud Patard (Rtp) | c06cd9b | 2012-04-18 23:16:41 +0200 | [diff] [blame] | 73 | if (of_machine_is_compatible("iom,iconnect")) |
| 74 | iconnect_init(); |
| 75 | |
Simon Baatz | f552036 | 2012-04-30 23:55:17 +0200 | [diff] [blame] | 76 | if (of_machine_is_compatible("raidsonic,ib-nas62x0")) |
| 77 | ib62x0_init(); |
| 78 | |
Michael Walle | 7637212 | 2012-06-06 20:30:57 +0200 | [diff] [blame] | 79 | of_platform_populate(NULL, kirkwood_dt_match_table, |
| 80 | kirkwood_auxdata_lookup, NULL); |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | static const char *kirkwood_dt_board_compat[] = { |
| 84 | "globalscale,dreamplug", |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 85 | "dlink,dns-320", |
| 86 | "dlink,dns-325", |
Arnaud Patard (Rtp) | c06cd9b | 2012-04-18 23:16:41 +0200 | [diff] [blame] | 87 | "iom,iconnect", |
Simon Baatz | f552036 | 2012-04-30 23:55:17 +0200 | [diff] [blame] | 88 | "raidsonic,ib-nas62x0", |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 89 | NULL |
| 90 | }; |
| 91 | |
| 92 | DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") |
| 93 | /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ |
| 94 | .map_io = kirkwood_map_io, |
| 95 | .init_early = kirkwood_init_early, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 96 | .init_irq = orion_dt_init_irq, |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 97 | .timer = &kirkwood_timer, |
| 98 | .init_machine = kirkwood_dt_init, |
| 99 | .restart = kirkwood_restart, |
| 100 | .dt_compat = kirkwood_dt_board_compat, |
| 101 | MACHINE_END |