MIPS: Malta: Use PIIX4 poweroff driver to power down
authorPaul Burton <paul.burton@mips.com>
Mon, 19 Sep 2016 21:21:31 +0000 (22:21 +0100)
committerPaul Burton <paul.burton@mips.com>
Sun, 24 Jun 2018 16:27:27 +0000 (09:27 -0700)
Remove the platform code used to power down the system, instead relying
upon the new PIIX4 poweroff driver. This reduces the amount of platform
code required for the Malta board in preparation for allowing it to be
part of a more generic kernel.

Signed-off-by: Paul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/14282/

13 files changed:
arch/mips/Kconfig
arch/mips/configs/malta_defconfig
arch/mips/configs/malta_kvm_defconfig
arch/mips/configs/malta_kvm_guest_defconfig
arch/mips/configs/malta_qemu_32r6_defconfig
arch/mips/configs/maltaaprp_defconfig
arch/mips/configs/maltasmvp_defconfig
arch/mips/configs/maltasmvp_eva_defconfig
arch/mips/configs/maltaup_defconfig
arch/mips/configs/maltaup_xpa_defconfig
arch/mips/mti-malta/Makefile
arch/mips/mti-malta/malta-pm.c [deleted file]
arch/mips/mti-malta/malta-reset.c [deleted file]

index 33375dd234eb9ceb72a3c35505ab00d1b2408d0b..a6ce5087b729084171af996180ec5151a33426df 100644 (file)
@@ -1974,12 +1974,6 @@ config SYS_HAS_CPU_XLR
 config SYS_HAS_CPU_XLP
        bool
 
-config MIPS_MALTA_PM
-       depends on MIPS_MALTA
-       depends on PCI
-       bool
-       default y
-
 #
 # CPU may reorder R->R, R->W, W->R, W->W
 # Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC
index df8a9a15ca83a71ed80a792c7655334601902335..81058295d35f53905fe5ca3ae2c0dbe24c2a28d0 100644 (file)
@@ -317,6 +317,7 @@ CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 14df9ef15d408d7b6d9bd2868736c6b9852f4401..5c10cddc39d363352415555c559c9d23f117349b 100644 (file)
@@ -328,6 +328,7 @@ CONFIG_INPUT_MOUSEDEV=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 25092e344574b8267822311596b8f1306204af19..bb694f5065f14e3afb4ac66ef073da33229311f1 100644 (file)
@@ -330,6 +330,7 @@ CONFIG_INPUT_MOUSEDEV=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 210bf609f7858308548a6f437f69bef772462cc9..5b5306b80576579837a90f923148473cf8245e2a 100644 (file)
@@ -133,6 +133,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index e5934aa98397189740359f5ecfe06d23a9e62890..85543599448f3650cc203b23ced7dbe6e3239a2f 100644 (file)
@@ -133,6 +133,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index cb2ca11c17893e2048b0060d6a6fa25993a4d24d..067bb84ac916647db897b3c6db7ef9cf471bacdc 100644 (file)
@@ -134,6 +134,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index be29fcec69fcc70e325627bfa60f07e90f307c84..dfc78c3172a3be43c72e37352f5c0e9e62998474 100644 (file)
@@ -137,6 +137,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 40462d4c90a0159d563516664011c2bafa51f912..50a2288c69f8207e6b9925de8e309310e12d81e8 100644 (file)
@@ -132,6 +132,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_HW_RANDOM=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 4e50176cb3df53e65c06fc00355b359ed0216a20..99a19cf5f9ba8af6feb873d862d14e2459d1db36 100644 (file)
@@ -326,6 +326,7 @@ CONFIG_MOUSE_PS2_ELANTECH=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_PIIX4_POWEROFF=y
 CONFIG_POWER_RESET_SYSCON=y
 # CONFIG_HWMON is not set
 CONFIG_FB=y
index 63940bdce698848b272e27f3f6c8b389e2d11b94..17c7fd471a27f4049ef03dc49f0176f51a5ddde5 100644 (file)
@@ -13,11 +13,9 @@ obj-y                                += malta-init.o
 obj-y                          += malta-int.o
 obj-y                          += malta-memory.o
 obj-y                          += malta-platform.o
-obj-y                          += malta-reset.o
 obj-y                          += malta-setup.o
 obj-y                          += malta-time.o
 
 obj-$(CONFIG_MIPS_CMP)         += malta-amon.o
-obj-$(CONFIG_MIPS_MALTA_PM)    += malta-pm.o
 
 CFLAGS_malta-dtshim.o = -I$(src)/../../../scripts/dtc/libfdt
diff --git a/arch/mips/mti-malta/malta-pm.c b/arch/mips/mti-malta/malta-pm.c
deleted file mode 100644 (file)
index efbd659..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2014 Imagination Technologies
- * Author: Paul Burton <paul.burton@mips.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/io.h>
-#include <linux/pci.h>
-
-#include <asm/mach-malta/malta-pm.h>
-
-static struct pci_bus *pm_pci_bus;
-static resource_size_t pm_io_offset;
-
-int mips_pm_suspend(unsigned state)
-{
-       int spec_devid;
-       u16 sts;
-
-       if (!pm_pci_bus || !pm_io_offset)
-               return -ENODEV;
-
-       /* Ensure the power button status is clear */
-       while (1) {
-               sts = inw(pm_io_offset + PIIX4_FUNC3IO_PMSTS);
-               if (!(sts & PIIX4_FUNC3IO_PMSTS_PWRBTN_STS))
-                       break;
-               outw(sts, pm_io_offset + PIIX4_FUNC3IO_PMSTS);
-       }
-
-       /* Enable entry to suspend */
-       outw(state | PIIX4_FUNC3IO_PMCNTRL_SUS_EN,
-            pm_io_offset + PIIX4_FUNC3IO_PMCNTRL);
-
-       /* If the special cycle occurs too soon this doesn't work... */
-       mdelay(10);
-
-       /*
-        * The PIIX4 will enter the suspend state only after seeing a special
-        * cycle with the correct magic data on the PCI bus. Generate that
-        * cycle now.
-        */
-       spec_devid = PCI_DEVID(0, PCI_DEVFN(0x1f, 0x7));
-       pci_bus_write_config_dword(pm_pci_bus, spec_devid, 0,
-                                  PIIX4_SUSPEND_MAGIC);
-
-       /* Give the system some time to power down */
-       mdelay(1000);
-
-       return 0;
-}
-
-static int __init malta_pm_setup(void)
-{
-       struct pci_dev *dev;
-       int res, io_region = PCI_BRIDGE_RESOURCES;
-
-       /* Find a reference to the PCI bus */
-       pm_pci_bus = pci_find_next_bus(NULL);
-       if (!pm_pci_bus) {
-               pr_warn("malta-pm: failed to find reference to PCI bus\n");
-               return -ENODEV;
-       }
-
-       /* Find the PIIX4 PM device */
-       dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
-                            PCI_DEVICE_ID_INTEL_82371AB_3, PCI_ANY_ID,
-                            PCI_ANY_ID, NULL);
-       if (!dev) {
-               pr_warn("malta-pm: failed to find PIIX4 PM\n");
-               return -ENODEV;
-       }
-
-       /* Request access to the PIIX4 PM IO registers */
-       res = pci_request_region(dev, io_region, "PIIX4 PM IO registers");
-       if (res) {
-               pr_warn("malta-pm: failed to request PM IO registers (%d)\n",
-                       res);
-               pci_dev_put(dev);
-               return -ENODEV;
-       }
-
-       /* Find the offset to the PIIX4 PM IO registers */
-       pm_io_offset = pci_resource_start(dev, io_region);
-
-       pci_dev_put(dev);
-       return 0;
-}
-
-late_initcall(malta_pm_setup);
diff --git a/arch/mips/mti-malta/malta-reset.c b/arch/mips/mti-malta/malta-reset.c
deleted file mode 100644 (file)
index dd6f62a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 1999,2000 MIPS Technologies, Inc.  All rights reserved.
- */
-#include <linux/io.h>
-#include <linux/pm.h>
-#include <linux/reboot.h>
-
-#include <asm/reboot.h>
-#include <asm/mach-malta/malta-pm.h>
-
-static void mips_machine_power_off(void)
-{
-       mips_pm_suspend(PIIX4_FUNC3IO_PMCNTRL_SUS_TYP_SOFF);
-
-       pr_info("Failed to power down, resetting\n");
-       machine_restart(NULL);
-}
-
-static int __init mips_reboot_setup(void)
-{
-       pm_power_off = mips_machine_power_off;
-
-       return 0;
-}
-arch_initcall(mips_reboot_setup);