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> |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 17 | #include <linux/clk-provider.h> |
| 18 | #include <linux/clk/mvebu.h> |
Ian Campbell | a7ac56d | 2012-04-29 14:40:42 +0100 | [diff] [blame] | 19 | #include <linux/kexec.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 20 | #include <asm/mach/arch.h> |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 21 | #include <asm/mach/map.h> |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 22 | #include <mach/bridge-regs.h> |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 23 | #include <linux/platform_data/usb-ehci-orion.h> |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 24 | #include <plat/irq.h> |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 25 | #include <plat/common.h> |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 26 | #include "common.h" |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 27 | |
| 28 | static struct of_device_id kirkwood_dt_match_table[] __initdata = { |
| 29 | { .compatible = "simple-bus", }, |
| 30 | { } |
| 31 | }; |
| 32 | |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 33 | /* |
| 34 | * There are still devices that doesn't know about DT yet. Get clock |
| 35 | * gates here and add a clock lookup alias, so that old platform |
| 36 | * devices still work. |
| 37 | */ |
| 38 | |
| 39 | static void __init kirkwood_legacy_clk_init(void) |
| 40 | { |
| 41 | |
| 42 | struct device_node *np = of_find_compatible_node( |
| 43 | NULL, NULL, "marvell,kirkwood-gating-clock"); |
| 44 | |
| 45 | struct of_phandle_args clkspec; |
| 46 | |
| 47 | clkspec.np = np; |
| 48 | clkspec.args_count = 1; |
| 49 | |
| 50 | clkspec.args[0] = CGC_BIT_GE0; |
| 51 | orion_clkdev_add(NULL, "mv643xx_eth_port.0", |
| 52 | of_clk_get_from_provider(&clkspec)); |
| 53 | |
| 54 | clkspec.args[0] = CGC_BIT_PEX0; |
| 55 | orion_clkdev_add("0", "pcie", |
| 56 | of_clk_get_from_provider(&clkspec)); |
| 57 | |
| 58 | clkspec.args[0] = CGC_BIT_USB0; |
| 59 | orion_clkdev_add(NULL, "orion-ehci.0", |
| 60 | of_clk_get_from_provider(&clkspec)); |
| 61 | |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 62 | clkspec.args[0] = CGC_BIT_PEX1; |
| 63 | orion_clkdev_add("1", "pcie", |
| 64 | of_clk_get_from_provider(&clkspec)); |
| 65 | |
| 66 | clkspec.args[0] = CGC_BIT_GE1; |
| 67 | orion_clkdev_add(NULL, "mv643xx_eth_port.1", |
| 68 | of_clk_get_from_provider(&clkspec)); |
| 69 | |
Andrew Lunn | d2268be3 | 2013-01-06 11:10:37 +0100 | [diff] [blame] | 70 | clkspec.args[0] = CGC_BIT_SDIO; |
| 71 | orion_clkdev_add(NULL, "mvsdio", |
| 72 | of_clk_get_from_provider(&clkspec)); |
| 73 | |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | static void __init kirkwood_of_clk_init(void) |
| 77 | { |
| 78 | mvebu_clocks_init(); |
| 79 | kirkwood_legacy_clk_init(); |
| 80 | } |
Michael Walle | 7637212 | 2012-06-06 20:30:57 +0200 | [diff] [blame] | 81 | |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 82 | static void __init kirkwood_dt_init(void) |
| 83 | { |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 84 | pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); |
| 85 | |
| 86 | /* |
| 87 | * Disable propagation of mbus errors to the CPU local bus, |
| 88 | * as this causes mbus errors (which can occur for example |
| 89 | * for PCI aborts) to throw CPU aborts, which we're not set |
| 90 | * up to deal with. |
| 91 | */ |
| 92 | writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); |
| 93 | |
| 94 | kirkwood_setup_cpu_mbus(); |
| 95 | |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 96 | kirkwood_l2_init(); |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 97 | |
Andrew Lunn | 2f129bf | 2011-12-15 08:15:07 +0100 | [diff] [blame] | 98 | /* Setup root of clk tree */ |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 99 | kirkwood_of_clk_init(); |
Jason Cooper | 2b45e05 | 2012-02-29 17:39:08 +0000 | [diff] [blame] | 100 | |
| 101 | #ifdef CONFIG_KEXEC |
| 102 | kexec_reinit = kirkwood_enable_pcie; |
| 103 | #endif |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 104 | |
| 105 | if (of_machine_is_compatible("globalscale,dreamplug")) |
| 106 | dreamplug_init(); |
| 107 | |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 108 | if (of_machine_is_compatible("dlink,dns-kirkwood")) |
| 109 | dnskw_init(); |
| 110 | |
Arnaud Patard (Rtp) | c06cd9b | 2012-04-18 23:16:41 +0200 | [diff] [blame] | 111 | if (of_machine_is_compatible("iom,iconnect")) |
| 112 | iconnect_init(); |
| 113 | |
Simon Baatz | f552036 | 2012-04-30 23:55:17 +0200 | [diff] [blame] | 114 | if (of_machine_is_compatible("raidsonic,ib-nas62x0")) |
| 115 | ib62x0_init(); |
| 116 | |
Andrew Lunn | 9eb61f4 | 2012-05-12 14:57:59 +0200 | [diff] [blame] | 117 | if (of_machine_is_compatible("qnap,ts219")) |
| 118 | qnap_dt_ts219_init(); |
| 119 | |
Sebastian Hesselbarth | dd88db7 | 2012-08-14 22:43:41 +0200 | [diff] [blame] | 120 | if (of_machine_is_compatible("seagate,dockstar")) |
| 121 | dockstar_dt_init(); |
| 122 | |
Josh Coombs | 5136b2a | 2012-07-16 11:52:50 +0200 | [diff] [blame] | 123 | if (of_machine_is_compatible("seagate,goflexnet")) |
| 124 | goflexnet_init(); |
| 125 | |
Michael Walle | 4aff38a | 2012-07-17 07:25:55 +0200 | [diff] [blame] | 126 | if (of_machine_is_compatible("buffalo,lsxl")) |
| 127 | lsxl_init(); |
| 128 | |
Alan M Butler | 4f48b7f | 2012-08-20 15:29:07 +0100 | [diff] [blame] | 129 | if (of_machine_is_compatible("iom,ix2-200")) |
| 130 | iomega_ix2_200_init(); |
| 131 | |
Valentin Longchamp | 0510c8a | 2012-09-04 11:55:02 +0200 | [diff] [blame] | 132 | if (of_machine_is_compatible("keymile,km_kirkwood")) |
| 133 | km_kirkwood_init(); |
| 134 | |
Simon Guinot | ecee1e4 | 2012-10-17 12:09:04 +0200 | [diff] [blame] | 135 | if (of_machine_is_compatible("lacie,inetspace_v2") || |
| 136 | of_machine_is_compatible("lacie,netspace_v2") || |
Simon Guinot | ca7d945 | 2012-10-17 12:09:05 +0200 | [diff] [blame] | 137 | of_machine_is_compatible("lacie,netspace_max_v2") || |
Simon Guinot | 7f9871d | 2012-10-17 12:09:06 +0200 | [diff] [blame] | 138 | of_machine_is_compatible("lacie,netspace_lite_v2") || |
| 139 | of_machine_is_compatible("lacie,netspace_mini_v2")) |
Simon Guinot | ecee1e4 | 2012-10-17 12:09:04 +0200 | [diff] [blame] | 140 | ns2_init(); |
| 141 | |
Stefan Peter | 5492a11 | 2012-11-18 16:46:16 +0100 | [diff] [blame] | 142 | if (of_machine_is_compatible("mpl,cec4")) |
| 143 | mplcec4_init(); |
| 144 | |
Nobuhiro Iwamatsu | f17073a | 2012-11-13 16:43:09 +0900 | [diff] [blame] | 145 | if (of_machine_is_compatible("plathome,openblocks-a6")) |
| 146 | openblocks_a6_init(); |
| 147 | |
Jason Cooper | 767fc1e | 2012-10-22 02:15:35 +0000 | [diff] [blame] | 148 | if (of_machine_is_compatible("usi,topkick")) |
| 149 | usi_topkick_init(); |
| 150 | |
Tero Jaasko | afcad88 | 2012-10-26 18:56:16 +0300 | [diff] [blame] | 151 | if (of_machine_is_compatible("zyxel,nsa310")) |
| 152 | nsa310_init(); |
| 153 | |
Andrew Lunn | 1611f87 | 2012-11-17 15:22:28 +0100 | [diff] [blame] | 154 | of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 155 | } |
| 156 | |
Andrew Lunn | 98adf93 | 2012-10-20 13:23:16 +0200 | [diff] [blame] | 157 | static const char * const kirkwood_dt_board_compat[] = { |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 158 | "globalscale,dreamplug", |
Jamie Lentin | 9007d10 | 2012-04-18 11:06:40 +0100 | [diff] [blame] | 159 | "dlink,dns-320", |
| 160 | "dlink,dns-325", |
Arnaud Patard (Rtp) | c06cd9b | 2012-04-18 23:16:41 +0200 | [diff] [blame] | 161 | "iom,iconnect", |
Simon Baatz | f552036 | 2012-04-30 23:55:17 +0200 | [diff] [blame] | 162 | "raidsonic,ib-nas62x0", |
Andrew Lunn | 9eb61f4 | 2012-05-12 14:57:59 +0200 | [diff] [blame] | 163 | "qnap,ts219", |
Sebastian Hesselbarth | dd88db7 | 2012-08-14 22:43:41 +0200 | [diff] [blame] | 164 | "seagate,dockstar", |
Josh Coombs | 5136b2a | 2012-07-16 11:52:50 +0200 | [diff] [blame] | 165 | "seagate,goflexnet", |
Michael Walle | 4aff38a | 2012-07-17 07:25:55 +0200 | [diff] [blame] | 166 | "buffalo,lsxl", |
Alan M Butler | 4f48b7f | 2012-08-20 15:29:07 +0100 | [diff] [blame] | 167 | "iom,ix2-200", |
Valentin Longchamp | 0510c8a | 2012-09-04 11:55:02 +0200 | [diff] [blame] | 168 | "keymile,km_kirkwood", |
Simon Guinot | ecee1e4 | 2012-10-17 12:09:04 +0200 | [diff] [blame] | 169 | "lacie,inetspace_v2", |
| 170 | "lacie,netspace_max_v2", |
| 171 | "lacie,netspace_v2", |
Simon Guinot | ca7d945 | 2012-10-17 12:09:05 +0200 | [diff] [blame] | 172 | "lacie,netspace_lite_v2", |
Simon Guinot | 7f9871d | 2012-10-17 12:09:06 +0200 | [diff] [blame] | 173 | "lacie,netspace_mini_v2", |
Stefan Peter | 5492a11 | 2012-11-18 16:46:16 +0100 | [diff] [blame] | 174 | "mpl,cec4", |
Nobuhiro Iwamatsu | f17073a | 2012-11-13 16:43:09 +0900 | [diff] [blame] | 175 | "plathome,openblocks-a6", |
Jason Cooper | 767fc1e | 2012-10-22 02:15:35 +0000 | [diff] [blame] | 176 | "usi,topkick", |
Tero Jaasko | afcad88 | 2012-10-26 18:56:16 +0300 | [diff] [blame] | 177 | "zyxel,nsa310", |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 178 | NULL |
| 179 | }; |
| 180 | |
| 181 | DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") |
| 182 | /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ |
| 183 | .map_io = kirkwood_map_io, |
| 184 | .init_early = kirkwood_init_early, |
Andrew Lunn | 278b45b | 2012-06-27 13:40:04 +0200 | [diff] [blame] | 185 | .init_irq = orion_dt_init_irq, |
Jason Cooper | 3d468b6 | 2012-02-27 16:07:13 +0000 | [diff] [blame] | 186 | .timer = &kirkwood_timer, |
| 187 | .init_machine = kirkwood_dt_init, |
| 188 | .restart = kirkwood_restart, |
| 189 | .dt_compat = kirkwood_dt_board_compat, |
| 190 | MACHINE_END |