]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
x86/platform/intel-mid: Register watchdog device after SCU
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 18 Nov 2016 16:52:24 +0000 (18:52 +0200)
committerIngo Molnar <mingo@kernel.org>
Mon, 21 Nov 2016 09:59:14 +0000 (10:59 +0100)
Watchdog device in Intel Tangier relies on SCU to be present. It uses the SCU
IPC channel to send commands and receive responses. If watchdog driver is
initialized quite before SCU and a command has been sent the result is always
an error like the following:

intel_mid_wdt: Error stopping watchdog: 0xffffffed

Register watchdog device whne SCU is ready to avoid described issue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20161118165224.175514-1-andriy.shevchenko@linux.intel.com
[ Small cleanups. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/platform/intel-mid/device_libs/platform_wdt.c

index de734134bc8d2e1733fb831a32cdbfd8fcf80ed5..4f96cd00996200fc4eae7ee7a576d9ebb75273cc 100644 (file)
@@ -14,7 +14,9 @@
 #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>
 
 #define TANGIER_EXT_TIMER0_MSI 15
@@ -50,14 +52,34 @@ static struct intel_mid_wdt_pdata tangier_pdata = {
        .probe = tangier_probe,
 };
 
-static int __init register_mid_wdt(void)
+static int wdt_scu_status_change(struct notifier_block *nb,
+                                unsigned long code, void *data)
 {
-       if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
-               wdt_dev.dev.platform_data = &tangier_pdata;
-               return platform_device_register(&wdt_dev);
+       if (code == SCU_DOWN) {
+               platform_device_unregister(&wdt_dev);
+               return 0;
        }
 
-       return -ENODEV;
+       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;
+}
 rootfs_initcall(register_mid_wdt);