Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 (C), Thomas Petazzoni <thomas.petazzoni@free-electrons.com> |
| 3 | * |
| 4 | * arch/arm/mach-orion5x/board-dt.c |
| 5 | * |
| 6 | * Flattened Device Tree board initialization |
| 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> |
| 15 | #include <linux/of.h> |
| 16 | #include <linux/of_platform.h> |
Thomas Gleixner | f7b861b | 2013-03-21 22:49:38 +0100 | [diff] [blame] | 17 | #include <linux/cpu.h> |
Thomas Petazzoni | 5c69766 | 2014-04-22 23:26:17 +0200 | [diff] [blame] | 18 | #include <linux/mbus.h> |
Thomas Petazzoni | 98d4db2 | 2014-04-22 23:26:24 +0200 | [diff] [blame] | 19 | #include <linux/clk-provider.h> |
Thomas Petazzoni | ab5ab9d | 2014-04-22 23:26:27 +0200 | [diff] [blame] | 20 | #include <linux/clocksource.h> |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 21 | #include <asm/system_misc.h> |
| 22 | #include <asm/mach/arch.h> |
Thomas Petazzoni | 5c69766 | 2014-04-22 23:26:17 +0200 | [diff] [blame] | 23 | #include <asm/mach/map.h> |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 24 | #include <mach/orion5x.h> |
Thomas Petazzoni | 5c69766 | 2014-04-22 23:26:17 +0200 | [diff] [blame] | 25 | #include <mach/bridge-regs.h> |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 26 | #include <plat/irq.h> |
Thomas Petazzoni | 5c69766 | 2014-04-22 23:26:17 +0200 | [diff] [blame] | 27 | #include <plat/time.h> |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 28 | #include "common.h" |
| 29 | |
Andrew Lunn | 4236666 | 2013-10-23 16:12:51 +0200 | [diff] [blame] | 30 | static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 31 | OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), |
| 32 | OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", |
| 33 | NULL), |
| 34 | OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL), |
| 35 | OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL), |
| 36 | OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1090000, "mv_crypto", NULL), |
| 37 | {}, |
| 38 | }; |
| 39 | |
| 40 | static void __init orion5x_dt_init(void) |
| 41 | { |
| 42 | char *dev_name; |
| 43 | u32 dev, rev; |
| 44 | |
| 45 | orion5x_id(&dev, &rev, &dev_name); |
| 46 | printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk); |
| 47 | |
Arnd Bergmann | 06fde1a | 2014-06-04 11:00:18 +0200 | [diff] [blame] | 48 | BUG_ON(mvebu_mbus_dt_init(false)); |
Thomas Petazzoni | 5c69766 | 2014-04-22 23:26:17 +0200 | [diff] [blame] | 49 | |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 50 | /* |
| 51 | * Setup Orion address map |
| 52 | */ |
Thomas Petazzoni | 5d1190e | 2013-03-21 17:59:18 +0100 | [diff] [blame] | 53 | orion5x_setup_wins(); |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 54 | |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 55 | /* |
| 56 | * Don't issue "Wait for Interrupt" instruction if we are |
| 57 | * running on D0 5281 silicon. |
| 58 | */ |
| 59 | if (dev == MV88F5281_DEV_ID && rev == MV88F5281_REV_D0) { |
| 60 | printk(KERN_INFO "Orion: Applying 5281 D0 WFI workaround.\n"); |
Thomas Gleixner | f7b861b | 2013-03-21 22:49:38 +0100 | [diff] [blame] | 61 | cpu_idle_poll_ctrl(true); |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 62 | } |
| 63 | |
Thomas Petazzoni | fbf04d8 | 2014-04-22 23:26:40 +0200 | [diff] [blame] | 64 | if (of_machine_is_compatible("maxtor,shared-storage-2")) |
| 65 | mss2_init(); |
| 66 | |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 67 | of_platform_populate(NULL, of_default_bus_match_table, |
| 68 | orion5x_auxdata_lookup, NULL); |
| 69 | } |
| 70 | |
| 71 | static const char *orion5x_dt_compat[] = { |
| 72 | "marvell,orion5x", |
| 73 | NULL, |
| 74 | }; |
| 75 | |
| 76 | DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)") |
| 77 | /* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */ |
| 78 | .map_io = orion5x_map_io, |
Thomas Petazzoni | 1bffb4a8 | 2012-11-16 16:39:45 +0100 | [diff] [blame] | 79 | .init_machine = orion5x_dt_init, |
| 80 | .restart = orion5x_restart, |
| 81 | .dt_compat = orion5x_dt_compat, |
| 82 | MACHINE_END |