diff options
author | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-03-04 21:59:25 +0300 |
---|---|---|
committer | Jason M. Bills <jason.m.bills@linux.intel.com> | 2021-03-10 23:14:54 +0300 |
commit | b68579627cb675766297353077dff3e4788f5771 (patch) | |
tree | 6016d5a2a7ffe2b7b7a2eb47cbd93cf92a3ff281 | |
parent | 0f09c51c79e5c94308c7ab784ca3b8c81c8ab388 (diff) | |
download | linux-b68579627cb675766297353077dff3e4788f5771.tar.xz |
fixup! peci: Add support for PECI bus driver core
Per recommendation from the CPU team, reduce the first retry
delay to 100us. Use usleep instead of schedule_timeout to avoid
stretching the delay.
Change-Id: I6698b0f05f952aaef737dd09280a17aaec81a2c5
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
-rw-r--r-- | drivers/peci/peci-core.c | 15 | ||||
-rw-r--r-- | include/uapi/linux/peci-ioctl.h | 4 |
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/peci/peci-core.c b/drivers/peci/peci-core.c index 04b56b4e2a53..10375e6087a5 100644 --- a/drivers/peci/peci-core.c +++ b/drivers/peci/peci-core.c @@ -3,6 +3,7 @@ #include <linux/bitfield.h> #include <linux/crc8.h> +#include <linux/delay.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/of_device.h> @@ -192,7 +193,7 @@ static int peci_aw_fcs(struct peci_xfer_msg *msg, int len, u8 *aw_fcs) static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, bool do_retry, bool has_aw_fcs) { - uint interval_ms = PECI_DEV_RETRY_INTERVAL_MIN_MSEC; + uint interval_us = PECI_DEV_RETRY_INTERVAL_MIN_USEC; ulong timeout = jiffies; u8 aw_fcs; int ret; @@ -256,15 +257,11 @@ static int __peci_xfer(struct peci_adapter *adapter, struct peci_xfer_msg *msg, break; } - set_current_state(TASK_INTERRUPTIBLE); - if (schedule_timeout(msecs_to_jiffies(interval_ms))) { - ret = -EINTR; - break; - } + usleep_range(interval_us, interval_us * 2); - interval_ms *= 2; - if (interval_ms > PECI_DEV_RETRY_INTERVAL_MAX_MSEC) - interval_ms = PECI_DEV_RETRY_INTERVAL_MAX_MSEC; + interval_us *= 2; + if (interval_us > PECI_DEV_RETRY_INTERVAL_MAX_USEC) + interval_us = PECI_DEV_RETRY_INTERVAL_MAX_USEC; } if (ret) diff --git a/include/uapi/linux/peci-ioctl.h b/include/uapi/linux/peci-ioctl.h index 1c76c7f5f2ca..e25b3bf694ec 100644 --- a/include/uapi/linux/peci-ioctl.h +++ b/include/uapi/linux/peci-ioctl.h @@ -33,8 +33,8 @@ #define PECI_DEV_CC_RETRY_CHECK_MASK 0xf0 #define PECI_DEV_RETRY_TIMEOUT msecs_to_jiffies(700) -#define PECI_DEV_RETRY_INTERVAL_MIN_MSEC 1 -#define PECI_DEV_RETRY_INTERVAL_MAX_MSEC 128 +#define PECI_DEV_RETRY_INTERVAL_MIN_USEC 100 +#define PECI_DEV_RETRY_INTERVAL_MAX_USEC (128 * 1000) #define PECI_DEV_RETRY_BIT 0x01 /** |