Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / arch / arm / mach-orion5x / board-mss2.c
1 /*
2  * Maxtor Shared Storage II Board Setup
3  *
4  * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version
9  * 2 of the License, or (at your option) any later version.
10  */
11
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/pci.h>
16 #include <linux/irq.h>
17 #include <asm/mach-types.h>
18 #include <asm/mach/arch.h>
19 #include <asm/mach/pci.h>
20 #include <mach/orion5x.h>
21 #include <mach/bridge-regs.h>
22 #include "common.h"
23
24 /*****************************************************************************
25  * Maxtor Shared Storage II Info
26  ****************************************************************************/
27
28 /****************************************************************************
29  * PCI setup
30  ****************************************************************************/
31 static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
32 {
33         int irq;
34
35         /*
36          * Check for devices with hard-wired IRQs.
37          */
38         irq = orion5x_pci_map_irq(dev, slot, pin);
39         if (irq != -1)
40                 return irq;
41
42         return -1;
43 }
44
45 static struct hw_pci mss2_pci __initdata = {
46         .nr_controllers = 2,
47         .setup          = orion5x_pci_sys_setup,
48         .scan           = orion5x_pci_sys_scan_bus,
49         .map_irq        = mss2_pci_map_irq,
50 };
51
52 static int __init mss2_pci_init(void)
53 {
54         if (machine_is_mss2())
55                 pci_common_init(&mss2_pci);
56
57         return 0;
58 }
59 subsys_initcall(mss2_pci_init);
60
61 /*****************************************************************************
62  * MSS2 power off method
63  ****************************************************************************/
64 /*
65  * On the Maxtor Shared Storage II, the shutdown process is the following :
66  * - Userland modifies U-boot env to tell U-boot to go idle at next boot
67  * - The board reboots
68  * - U-boot starts and go into an idle mode until the user press "power"
69  */
70 static void mss2_power_off(void)
71 {
72         u32 reg;
73
74         /*
75          * Enable and issue soft reset
76          */
77         reg = readl(RSTOUTn_MASK);
78         reg |= 1 << 2;
79         writel(reg, RSTOUTn_MASK);
80
81         reg = readl(CPU_SOFT_RESET);
82         reg |= 1;
83         writel(reg, CPU_SOFT_RESET);
84 }
85
86 void __init mss2_init(void)
87 {
88         /* register mss2 specific power-off method */
89         pm_power_off = mss2_power_off;
90 }