From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbcKRQxB (ORCPT ); Fri, 18 Nov 2016 11:53:01 -0500 Received: from mga02.intel.com ([134.134.136.20]:38273 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932290AbcKRQw7 (ORCPT ); Fri, 18 Nov 2016 11:52:59 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,510,1473145200"; d="scan'208";a="6171572" From: Andy Shevchenko To: Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, "H. Peter Anvin" Cc: Andy Shevchenko Subject: [PATCH v1 1/1] x86/platform/intel-mid: Register watchdog device after SCU Date: Fri, 18 Nov 2016 18:52:24 +0200 Message-Id: <20161118165224.175514-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.10.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- .../platform/intel-mid/device_libs/platform_wdt.c | 33 ++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c index de73413..0bc9ae3 100644 --- a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c +++ b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c @@ -14,7 +14,9 @@ #include #include #include + #include +#include #include #define TANGIER_EXT_TIMER0_MSI 15 @@ -50,14 +52,35 @@ 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 int __init register_mid_wdt(void) +{ + static struct notifier_block wdt_scu_notifier = { + .notifier_call = wdt_scu_status_change, + }; + + 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); -- 2.10.2