msm: pil: Allow MBA & Modem auth timeout to be set in module parameters
For convenient debugging of PBL and MBA code, allow the authentication
timeouts to be overridden with a module parameter. With this, the
timeouts can be extended or disabled entirely (by setting them to 0).
Change-Id: I2329a6ee10503b8b7f7d1d0c2fd52fe1aee42e5a
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
(cherry picked from commit d251d8ec509cf22740c55bf98ac4edced1ad4a4d)
diff --git a/arch/arm/mach-msm/pil-mba.c b/arch/arm/mach-msm/pil-mba.c
index 2176b26..5e67d4f 100644
--- a/arch/arm/mach-msm/pil-mba.c
+++ b/arch/arm/mach-msm/pil-mba.c
@@ -38,10 +38,12 @@
#define STATUS_META_DATA_AUTH_SUCCESS 0x3
#define STATUS_AUTH_COMPLETE 0x4
-#define AUTH_TIMEOUT_US 10000000
#define PROXY_TIMEOUT_MS 10000
#define POLL_INTERVAL_US 50
+static int modem_auth_timeout_ms = 10000;
+module_param(modem_auth_timeout_ms, int, S_IRUGO | S_IWUSR);
+
struct mba_data {
void __iomem *reg_base;
void __iomem *metadata_base;
@@ -89,7 +91,7 @@
writel_relaxed(CMD_META_DATA_READY, drv->reg_base + RMB_MBA_COMMAND);
ret = readl_poll_timeout(drv->reg_base + RMB_MBA_STATUS, status,
status == STATUS_META_DATA_AUTH_SUCCESS || status < 0,
- POLL_INTERVAL_US, AUTH_TIMEOUT_US);
+ POLL_INTERVAL_US, modem_auth_timeout_ms * 1000);
if (ret) {
dev_err(pil->dev, "MBA authentication timed out\n");
} else if (status < 0) {
@@ -133,7 +135,7 @@
/* Wait for all segments to be authenticated or an error to occur */
ret = readl_poll_timeout(drv->reg_base + RMB_MBA_STATUS, status,
status == STATUS_AUTH_COMPLETE || status < 0,
- 50, AUTH_TIMEOUT_US);
+ 50, modem_auth_timeout_ms * 1000);
if (ret) {
dev_err(pil->dev, "MBA authentication timed out\n");
} else if (status < 0) {
diff --git a/arch/arm/mach-msm/pil-q6v5-mss.c b/arch/arm/mach-msm/pil-q6v5-mss.c
index 6a30940..7c372ee 100644
--- a/arch/arm/mach-msm/pil-q6v5-mss.c
+++ b/arch/arm/mach-msm/pil-q6v5-mss.c
@@ -51,10 +51,12 @@
#define RMB_PBL_STATUS 0x04
#define RMB_MBA_STATUS 0x0C
-#define PBL_MBA_WAIT_TIMEOUT_US 100000
#define PROXY_TIMEOUT_MS 10000
#define POLL_INTERVAL_US 50
+static int pbl_mba_boot_timeout_ms = 100;
+module_param(pbl_mba_boot_timeout_ms, int, S_IRUGO | S_IWUSR);
+
static int pil_mss_power_up(struct device *dev)
{
int ret;
@@ -131,7 +133,7 @@
/* Wait for PBL completion. */
ret = readl_poll_timeout(drv->rmb_base + RMB_PBL_STATUS, status,
- status != 0, POLL_INTERVAL_US, PBL_MBA_WAIT_TIMEOUT_US);
+ status != 0, POLL_INTERVAL_US, pbl_mba_boot_timeout_ms * 1000);
if (ret) {
dev_err(dev, "PBL boot timed out\n");
return ret;
@@ -143,7 +145,7 @@
/* Wait for MBA completion. */
ret = readl_poll_timeout(drv->rmb_base + RMB_MBA_STATUS, status,
- status != 0, POLL_INTERVAL_US, PBL_MBA_WAIT_TIMEOUT_US);
+ status != 0, POLL_INTERVAL_US, pbl_mba_boot_timeout_ms * 1000);
if (ret) {
dev_err(dev, "MBA boot timed out\n");
return ret;