aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Wood <brian.j.wood@intel.com>2015-10-06 12:18:20 -0700
committerBrian Wood <brian.j.wood@intel.com>2015-10-06 13:08:41 -0700
commit4a333994888f39ee3b380fe22092ef42cc1c06af (patch)
treef9ce997a456fd645f32659bdb1ea055cfa4e8866
parent0b247ec2a0e8a2e5509064a222ba1cf9cac977bd (diff)
downloadedison-v3.10-4a333994888f39ee3b380fe22092ef42cc1c06af.tar.gz
REVERT_ME: Debugging/workaround for SCU watchdog timer setting
The SCU is not correctly accepting the timer setting from watchdog driver, so we configure in a 10 second delta from what is reported to userspace watchdog daemon and SCU default watchdog timer value. Change-Id: Ia8b96b199e217c6842f02765f7568d87706bcc02 Signed-off-by: Brian Wood <brian.j.wood@intel.com>
-rw-r--r--drivers/platform/x86/Makefile4
-rw-r--r--drivers/platform/x86/intel_scu_ipc.c3
-rw-r--r--drivers/watchdog/Makefile3
-rw-r--r--drivers/watchdog/intel-mid_wdt.c56
4 files changed, 61 insertions, 5 deletions
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 7d82ebfcca9..c55f5102a22 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -2,6 +2,10 @@
# Makefile for linux/drivers/platform/x86
# x86 Platform-Specific Drivers
#
+
+# enable pr_debug
+ccflags-y += -DDEBUG
+
obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
obj-$(CONFIG_ASUS_WMI) += asus-wmi.o
obj-$(CONFIG_ASUS_NB_WMI) += asus-nb-wmi.o
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index f19ad213672..3ff5c332a0d 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -344,6 +344,9 @@ int intel_scu_ipc_raw_cmd(int cmd, int sub, u32 *in, int inlen, u32 *out,
{
int i, err;
+ pr_debug("%s: DEBUG: cmd=%d, sub=%d, in=%u, inlen=%d, out=%u, "
+ "outlen=%d, dptr=%u, sptr=%u\n", __func__,
+ cmd, sub, in, inlen, out, outlen, dptr, sptr);
if (ipcdev.pdev == NULL)
return -ENODEV;
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index e5b56bca6cf..6762d88dc83 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -2,6 +2,9 @@
# Makefile for the WatchDog device drivers.
#
+# enable pr_debug
+ccflags-y += -DDEBUG
+
# The WatchDog Timer Driver Core.
watchdog-objs += watchdog_core.o watchdog_dev.o
obj-$(CONFIG_WATCHDOG_CORE) += watchdog.o
diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c
index e12243c2d03..a54f54e7341 100644
--- a/drivers/watchdog/intel-mid_wdt.c
+++ b/drivers/watchdog/intel-mid_wdt.c
@@ -22,12 +22,29 @@
#include <asm/intel_scu_ipc.h>
#include <asm/intel-mid.h>
+/* For debugging watchdog */
+/*
+#include <linux/delay.h>
+#include <linux/workqueue.h>
+
+static void testwq_work_handler(struct work_struct *w);
+static struct workqueue_struct *wq = 0;
+static DECLARE_WORK(testwq_work, testwq_work_handler);
+*/
+/* End of debugging */
+
#define IPC_WATCHDOG 0xf8
#define MID_WDT_PRETIMEOUT 15
#define MID_WDT_TIMEOUT_MIN (1 + MID_WDT_PRETIMEOUT)
#define MID_WDT_TIMEOUT_MAX 170
-#define MID_WDT_DEFAULT_TIMEOUT 90
+/* Change default watchdog timeout from 90 to 80 for issue seen with
+ * SCU setting not being properly set and it using a value of of ~70.
+ * Needs further debugging of SCU driver code to trace if its in driver
+ * or in SCU Firmware. Will adjust in watchdog driver as workaround.
+ #define MID_WDT_DEFAULT_TIMEOUT 90
+*/
+#define MID_WDT_DEFAULT_TIMEOUT 80
/* SCU watchdog messages */
enum {
@@ -38,18 +55,39 @@ enum {
static inline int wdt_command(int sub, u32 *in, int inlen)
{
+ pr_debug("%s: DEBUG: WATCHDOG calling intel_scu_ipc_command() "
+ "with IPC_WATCHDOG\n", __func__);
return intel_scu_ipc_command(IPC_WATCHDOG, sub, in, inlen, NULL, 0);
}
+/* Workqueue handler function for debugging watchdog */
+/*
+static void testwq_work_handler(struct work_struct *w)
+{
+ while(1) {
+ pr_debug("%s: DEBUG: (USING WORKQUEUE TO KICK) WATCHDOG: "
+ "executing SCU_WATCHDOG_KEEPALIVE\n",
+ __func__);
+ wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
+ mdelay(30000);
+ }
+}
+*/
+
static int wdt_start(struct watchdog_device *wd)
{
int ret, in_size;
- int timeout = wd->timeout;
+ /* Increase timeout due to SCU not setting watchdog correctly
+ * and misreporting to userspace watchdog daemon
+ */
+ /* int timeout = wd->timeout; */
+ int timeout = wd->timeout + MID_WDT_PRETIMEOUT;
struct ipc_wd_start {
u32 pretimeout;
u32 timeout;
} ipc_wd_start = { timeout - MID_WDT_PRETIMEOUT, timeout };
+ pr_debug("%s: DEBUG: WATCHDOG\n", __func__);
/*
* SCU expects the input size for watchdog IPC to
* be based on 4 bytes
@@ -68,7 +106,8 @@ static int wdt_start(struct watchdog_device *wd)
static int wdt_ping(struct watchdog_device *wd)
{
int ret;
-
+ pr_debug("%s: DEBUG: WATCHDOG sending SCU_WATCHDOG_KEEPALIVE "
+ "to SCU\n", __func__);
ret = wdt_command(SCU_WATCHDOG_KEEPALIVE, NULL, 0);
if (ret) {
struct device *dev = watchdog_get_drvdata(wd);
@@ -81,7 +120,7 @@ static int wdt_ping(struct watchdog_device *wd)
static int wdt_stop(struct watchdog_device *wd)
{
int ret;
-
+ pr_debug("%s: DEBUG: WATCHDOG\n", __func__);
ret = wdt_command(SCU_WATCHDOG_STOP, NULL, 0);
if (ret) {
struct device *dev = watchdog_get_drvdata(wd);
@@ -117,6 +156,7 @@ static int mid_wdt_probe(struct platform_device *pdev)
struct intel_mid_wdt_pdata *pdata = pdev->dev.platform_data;
int ret;
+ pr_debug("%s: DEBUG: WATCHDOG\n", __func__);
if (!pdata) {
dev_err(&pdev->dev, "missing platform data\n");
return -EINVAL;
@@ -157,12 +197,18 @@ static int mid_wdt_probe(struct platform_device *pdev)
}
dev_info(&pdev->dev, "Intel MID watchdog device probed\n");
-
+ /* Workqueue for debugging watchdog */
+ /* if (!wq)
+ wq = create_singlethread_workqueue("testwq");
+ if (wq)
+ queue_work(wq, &testwq_work);
+ */
return 0;
}
static int mid_wdt_remove(struct platform_device *pdev)
{
+ pr_debug("%s: DEBUG: WATCHDOG\n", __func__);
struct watchdog_device *wd = platform_get_drvdata(pdev);
watchdog_unregister_device(wd);
return 0;