platform/x86: intel_scu_wdt: Move driver from arch/x86
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 23 Oct 2020 16:03:19 +0000 (19:03 +0300)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 25 Jan 2021 18:05:32 +0000 (20:05 +0200)
The ACPI-enabled Intel MID platforms neither have WDAT table nor proper IDs
to instantiate watchdog device. In order to keep them working move the board
code from arch/x86 to drivers/platform/x86.

Note, the complete SFI support is going to be removed, that's why PDx86
has been chosen as a new home for it. This is the only device which needs
additional code so far.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
arch/x86/platform/intel-mid/device_libs/Makefile
arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c [deleted file]
drivers/platform/x86/Kconfig
drivers/platform/x86/Makefile
drivers/platform/x86/intel_scu_wdt.c [new file with mode: 0644]

index 480fed21cc7d41a8188135b441ae2f8bb69c3d69..918edac9ab9a60e2d9208fdd5ba3e462940586b6 100644 (file)
@@ -30,4 +30,3 @@ obj-$(subst m,y,$(CONFIG_GPIO_PCA953X)) += platform_tca6416.o
 obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
 obj-$(subst m,y,$(CONFIG_INTEL_MID_POWER_BUTTON)) += platform_mrfld_power_btn.o
 obj-$(subst m,y,$(CONFIG_RTC_DRV_CMOS)) += platform_mrfld_rtc.o
-obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_mrfld_wdt.o
diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
deleted file mode 100644 (file)
index 227218a..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Intel Merrifield watchdog platform device library file
- *
- * (C) Copyright 2014 Intel Corporation
- * Author: David Cohen <david.a.cohen@linux.intel.com>
- */
-
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/platform_device.h>
-#include <linux/platform_data/intel-mid_wdt.h>
-
-#include <asm/intel-mid.h>
-#include <asm/intel_scu_ipc.h>
-#include <asm/io_apic.h>
-#include <asm/hw_irq.h>
-
-#define TANGIER_EXT_TIMER0_MSI 12
-
-static struct platform_device wdt_dev = {
-       .name = "intel_mid_wdt",
-       .id = -1,
-};
-
-static int tangier_probe(struct platform_device *pdev)
-{
-       struct irq_alloc_info info;
-       struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
-       int gsi = TANGIER_EXT_TIMER0_MSI;
-       int irq;
-
-       if (!pdata)
-               return -EINVAL;
-
-       /* IOAPIC builds identity mapping between GSI and IRQ on MID */
-       ioapic_set_alloc_attr(&info, cpu_to_node(0), 1, 0);
-       irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
-       if (irq < 0) {
-               dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n", gsi);
-               return irq;
-       }
-
-       pdata->irq = irq;
-       return 0;
-}
-
-static struct intel_mid_wdt_pdata tangier_pdata = {
-       .probe = tangier_probe,
-};
-
-static int wdt_scu_status_change(struct notifier_block *nb,
-                                unsigned long code, void *data)
-{
-       if (code == SCU_DOWN) {
-               platform_device_unregister(&wdt_dev);
-               return 0;
-       }
-
-       return platform_device_register(&wdt_dev);
-}
-
-static struct notifier_block wdt_scu_notifier = {
-       .notifier_call  = wdt_scu_status_change,
-};
-
-static int __init register_mid_wdt(void)
-{
-       if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
-               return -ENODEV;
-
-       wdt_dev.dev.platform_data = &tangier_pdata;
-
-       /*
-        * We need to be sure that the SCU IPC is ready before watchdog device
-        * can be registered:
-        */
-       intel_scu_notifier_add(&wdt_scu_notifier);
-
-       return 0;
-}
-arch_initcall(register_mid_wdt);
index 4a5798a0ce0c461892affddb14ffd0dc4dd2622c..0bb85eabace1e77248d17e94d6f6945c3042a9da 100644 (file)
@@ -1424,6 +1424,14 @@ config INTEL_SCU_PLATFORM
          and SCU (sometimes called PMC as well). The driver currently
          supports Intel Elkhart Lake and compatible platforms.
 
+config INTEL_SCU_WDT
+       bool
+       default INTEL_SCU_PCI
+       depends on INTEL_MID_WATCHDOG
+       help
+         This is a specific platform code to instantiate watchdog device
+         on ACPI-based Intel MID platforms.
+
 config INTEL_SCU_IPC_UTIL
        tristate "Intel SCU IPC utility driver"
        depends on INTEL_SCU
index 728ccc226a29c0521f579a00d66f27bd110e78c2..19306450d791208aec2f4efb8f5bcc372bba669a 100644 (file)
@@ -146,6 +146,7 @@ obj-$(CONFIG_INTEL_PUNIT_IPC)               += intel_punit_ipc.o
 obj-$(CONFIG_INTEL_SCU_IPC)            += intel_scu_ipc.o
 obj-$(CONFIG_INTEL_SCU_PCI)            += intel_scu_pcidrv.o
 obj-$(CONFIG_INTEL_SCU_PLATFORM)       += intel_scu_pltdrv.o
+obj-$(CONFIG_INTEL_SCU_WDT)            += intel_scu_wdt.o
 obj-$(CONFIG_INTEL_SCU_IPC_UTIL)       += intel_scu_ipcutil.o
 obj-$(CONFIG_INTEL_TELEMETRY)          += intel_telemetry_core.o \
                                           intel_telemetry_pltdrv.o \
diff --git a/drivers/platform/x86/intel_scu_wdt.c b/drivers/platform/x86/intel_scu_wdt.c
new file mode 100644 (file)
index 0000000..227218a
--- /dev/null
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Intel Merrifield watchdog platform device library file
+ *
+ * (C) Copyright 2014 Intel Corporation
+ * Author: David Cohen <david.a.cohen@linux.intel.com>
+ */
+
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/intel-mid_wdt.h>
+
+#include <asm/intel-mid.h>
+#include <asm/intel_scu_ipc.h>
+#include <asm/io_apic.h>
+#include <asm/hw_irq.h>
+
+#define TANGIER_EXT_TIMER0_MSI 12
+
+static struct platform_device wdt_dev = {
+       .name = "intel_mid_wdt",
+       .id = -1,
+};
+
+static int tangier_probe(struct platform_device *pdev)
+{
+       struct irq_alloc_info info;
+       struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
+       int gsi = TANGIER_EXT_TIMER0_MSI;
+       int irq;
+
+       if (!pdata)
+               return -EINVAL;
+
+       /* IOAPIC builds identity mapping between GSI and IRQ on MID */
+       ioapic_set_alloc_attr(&info, cpu_to_node(0), 1, 0);
+       irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC, &info);
+       if (irq < 0) {
+               dev_warn(&pdev->dev, "cannot find interrupt %d in ioapic\n", gsi);
+               return irq;
+       }
+
+       pdata->irq = irq;
+       return 0;
+}
+
+static struct intel_mid_wdt_pdata tangier_pdata = {
+       .probe = tangier_probe,
+};
+
+static int wdt_scu_status_change(struct notifier_block *nb,
+                                unsigned long code, void *data)
+{
+       if (code == SCU_DOWN) {
+               platform_device_unregister(&wdt_dev);
+               return 0;
+       }
+
+       return platform_device_register(&wdt_dev);
+}
+
+static struct notifier_block wdt_scu_notifier = {
+       .notifier_call  = wdt_scu_status_change,
+};
+
+static int __init register_mid_wdt(void)
+{
+       if (intel_mid_identify_cpu() != INTEL_MID_CPU_CHIP_TANGIER)
+               return -ENODEV;
+
+       wdt_dev.dev.platform_data = &tangier_pdata;
+
+       /*
+        * We need to be sure that the SCU IPC is ready before watchdog device
+        * can be registered:
+        */
+       intel_scu_notifier_add(&wdt_scu_notifier);
+
+       return 0;
+}
+arch_initcall(register_mid_wdt);