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