summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2019-08-19 21:16:19 +0300
committerEd Tanous <ed@tanous.net>2019-08-20 18:56:17 +0300
commit35e295e2a161fcf146ea031de53431b2888521fa (patch)
treea0c78943fef5c085f371aaa840d46edecc1f2e95 /meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch
parent9856ac69064742544fafad307d3ee4544385ffa2 (diff)
downloadopenbmc-35e295e2a161fcf146ea031de53431b2888521fa.tar.xz
Sync to internal 8-19-2019
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch
new file mode 100644
index 000000000..e32ec54ac
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-kernel/linux/linux-aspeed/0071-peci-add-a-temporary-workaround.patch
@@ -0,0 +1,101 @@
+From 3394fabbd17ad7263feeb0f4ae593056237f0647 Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+Date: Tue, 30 Jul 2019 13:01:58 -0700
+Subject: [PATCH] peci: add a temporary workaround
+
+To cover a PECI issue, this commit makes PECI driver block all PECI
+commands when PLTRST_N signal is 0.
+
+Also, it adds 'use_wa' module parameter for platforms that don't have
+the PLTRST_N gpio input so that the WA can be disabled through the
+module parameter.
+
+This is a temporary workaround.
+
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+---
+ drivers/peci/busses/peci-aspeed.c | 11 +++++++++++
+ drivers/peci/peci-core.c | 11 +++++++++++
+ include/linux/peci.h | 1 +
+ 3 files changed, 23 insertions(+)
+
+diff --git a/drivers/peci/busses/peci-aspeed.c b/drivers/peci/busses/peci-aspeed.c
+index 8a0dd40730cc..76394ab32854 100644
+--- a/drivers/peci/busses/peci-aspeed.c
++++ b/drivers/peci/busses/peci-aspeed.c
+@@ -10,6 +10,7 @@
+ #include <linux/jiffies.h>
+ #include <linux/module.h>
+ #include <linux/of.h>
++#include <linux/of_gpio.h>
+ #include <linux/peci.h>
+ #include <linux/platform_device.h>
+ #include <linux/reset.h>
+@@ -445,6 +446,16 @@ static int aspeed_peci_probe(struct platform_device *pdev)
+ if (ret)
+ goto err_put_adapter_dev;
+
++ priv->adapter->pltrst_pin = of_get_gpio(pdev->dev.of_node, 0);
++ if (gpio_is_valid(priv->adapter->pltrst_pin)) {
++ ret = devm_gpio_request(&pdev->dev, priv->adapter->pltrst_pin,
++ "peci-aspeed");
++ if (ret < 0) {
++ priv->adapter->pltrst_pin = -1;
++ dev_err(&pdev->dev, "error requesting pltrst gpio\n");
++ }
++ }
++
+ ret = peci_add_adapter(priv->adapter);
+ if (ret)
+ goto err_put_adapter_dev;
+diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c
+index b99ba788a032..2e3b9a0c83e9 100644
+--- a/drivers/peci/peci-core.c
++++ b/drivers/peci/peci-core.c
+@@ -5,6 +5,7 @@
+ #include <linux/crc8.h>
+ #include <linux/delay.h>
+ #include <linux/mm.h>
++#include <linux/gpio.h>
+ #include <linux/module.h>
+ #include <linux/of_device.h>
+ #include <linux/peci.h>
+@@ -190,6 +191,11 @@ static int peci_aw_fcs(struct peci_xfer_msg *msg, int len, u8 *aw_fcs)
+ return 0;
+ }
+
++/* Temporary WA */
++static bool use_wa __read_mostly = true;
++module_param_named(use_wa, use_wa, bool, 0644);
++MODULE_PARM_DESC(use_wa, "flag for enabling of WA");
++
+ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg,
+ bool do_retry, bool has_aw_fcs)
+ {
+@@ -197,6 +203,11 @@ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg,
+ u8 aw_fcs;
+ int ret;
+
++ /* Temporary WA */
++ if (use_wa && gpio_is_valid(adapter->pltrst_pin) &&
++ gpio_get_value(adapter->pltrst_pin) == 0)
++ return -EAGAIN;
++
+ /*
+ * In case if adapter uses DMA, check at here whether tx and rx buffers
+ * are DMA capable or not.
+diff --git a/include/linux/peci.h b/include/linux/peci.h
+index 6fc424dc2a73..e589cb258a2a 100644
+--- a/include/linux/peci.h
++++ b/include/linux/peci.h
+@@ -44,6 +44,7 @@ struct peci_adapter {
+ struct peci_xfer_msg *msg);
+ u32 cmd_mask;
+ bool use_dma;
++ int pltrst_pin;
+ };
+
+ static inline struct peci_adapter *to_peci_adapter(void *d)
+--
+2.7.4
+