Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Maxtor Shared Storage II Board Setup
0004  *
0005  * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
0006  */
0007 
0008 #include <linux/kernel.h>
0009 #include <linux/init.h>
0010 #include <linux/platform_device.h>
0011 #include <linux/pci.h>
0012 #include <linux/irq.h>
0013 #include <asm/mach-types.h>
0014 #include <asm/mach/arch.h>
0015 #include <asm/mach/pci.h>
0016 #include "orion5x.h"
0017 #include "bridge-regs.h"
0018 #include "common.h"
0019 
0020 /*****************************************************************************
0021  * Maxtor Shared Storage II Info
0022  ****************************************************************************/
0023 
0024 /****************************************************************************
0025  * PCI setup
0026  ****************************************************************************/
0027 static int __init mss2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
0028 {
0029     int irq;
0030 
0031     /*
0032      * Check for devices with hard-wired IRQs.
0033      */
0034     irq = orion5x_pci_map_irq(dev, slot, pin);
0035     if (irq != -1)
0036         return irq;
0037 
0038     return -1;
0039 }
0040 
0041 static struct hw_pci mss2_pci __initdata = {
0042     .nr_controllers = 2,
0043     .setup      = orion5x_pci_sys_setup,
0044     .scan       = orion5x_pci_sys_scan_bus,
0045     .map_irq    = mss2_pci_map_irq,
0046 };
0047 
0048 static int __init mss2_pci_init(void)
0049 {
0050     if (machine_is_mss2())
0051         pci_common_init(&mss2_pci);
0052 
0053     return 0;
0054 }
0055 subsys_initcall(mss2_pci_init);
0056 
0057 /*****************************************************************************
0058  * MSS2 power off method
0059  ****************************************************************************/
0060 /*
0061  * On the Maxtor Shared Storage II, the shutdown process is the following :
0062  * - Userland modifies U-boot env to tell U-boot to go idle at next boot
0063  * - The board reboots
0064  * - U-boot starts and go into an idle mode until the user press "power"
0065  */
0066 static void mss2_power_off(void)
0067 {
0068     u32 reg;
0069 
0070     /*
0071      * Enable and issue soft reset
0072      */
0073     reg = readl(RSTOUTn_MASK);
0074     reg |= 1 << 2;
0075     writel(reg, RSTOUTn_MASK);
0076 
0077     reg = readl(CPU_SOFT_RESET);
0078     reg |= 1;
0079     writel(reg, CPU_SOFT_RESET);
0080 }
0081 
0082 void __init mss2_init(void)
0083 {
0084     /* register mss2 specific power-off method */
0085     pm_power_off = mss2_power_off;
0086 }