aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Wood <brian.j.wood@intel.com>2015-10-15 20:59:49 -0700
committerBeare, Bruce J <bruce.j.beare@intel.com>2015-10-20 18:29:06 +0100
commit96af7a036dde8dcb8a53c29204173123e8167a89 (patch)
tree376450d7be460841918dcd3ff2c430079284ebc6
parent1ce4748a4d78acdc2c4b7cef35181306ed340ef9 (diff)
downloadedison-v3.10-96af7a036dde8dcb8a53c29204173123e8167a89.tar.gz
Correct watchdog interface use for SCU add workaround for IRQ
This commit corrects the issues in the REVERT_ME patches with the upstream intel-mid watchdog driver when being backported to the 3.10.x kernel. Also, we've found that the registration of the IRQ is causing a conflict with the I2C bus. For now we will disable this in the driver as it will not interfer with normal operations of the watchdog (the IRQ handler should never be reached anyway and is only used to print a kernel message). This will be fixed by a subsequent patch. Change-Id: I06757bdf66615ce5cf63396269d8ee889a54eed3 Signed-off-by: Brian Wood <brian.j.wood@intel.com> Reviewed-on: https://android.intel.com/424751
-rw-r--r--drivers/watchdog/intel-mid_wdt.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c
index e12243c2d03..e9ae57ef0b9 100644
--- a/drivers/watchdog/intel-mid_wdt.c
+++ b/drivers/watchdog/intel-mid_wdt.c
@@ -27,7 +27,13 @@
#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 {
@@ -36,15 +42,20 @@ enum {
SCU_WATCHDOG_KEEPALIVE,
};
-static inline int wdt_command(int sub, u32 *in, int inlen)
+static inline int wdt_command(int sub, u8 *in, int inlen)
{
- return intel_scu_ipc_command(IPC_WATCHDOG, sub, in, inlen, NULL, 0);
+ return intel_scu_ipc_command(IPC_WATCHDOG, (u32 *)sub, in, (u32 *)inlen, NULL, 0);
}
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;
@@ -54,9 +65,9 @@ static int wdt_start(struct watchdog_device *wd)
* SCU expects the input size for watchdog IPC to
* be based on 4 bytes
*/
- in_size = DIV_ROUND_UP(sizeof(ipc_wd_start), 4);
+ /* in_size = DIV_ROUND_UP(sizeof(ipc_wd_start), 4); */
- ret = wdt_command(SCU_WATCHDOG_START, (u32 *)&ipc_wd_start, in_size);
+ ret = wdt_command(SCU_WATCHDOG_START, (u8 *)&ipc_wd_start, sizeof(ipc_wd_start));
if (ret) {
struct device *dev = watchdog_get_drvdata(wd);
dev_crit(dev, "error starting watchdog: %d\n", ret);
@@ -140,7 +151,7 @@ static int mid_wdt_probe(struct platform_device *pdev)
watchdog_set_drvdata(wdt_dev, &pdev->dev);
platform_set_drvdata(pdev, wdt_dev);
-
+/*
ret = devm_request_irq(&pdev->dev, pdata->irq, mid_wdt_irq,
IRQF_SHARED | IRQF_NO_SUSPEND, "watchdog",
wdt_dev);
@@ -149,7 +160,7 @@ static int mid_wdt_probe(struct platform_device *pdev)
pdata->irq);
return ret;
}
-
+*/
ret = watchdog_register_device(wdt_dev);
if (ret) {
dev_err(&pdev->dev, "error registering watchdog device\n");