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