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)
This commit is contained in:
Matt Wagantall 2012-08-16 18:53:53 -07:00 committed by Stephen Boyd
parent f8414c8d9c
commit e578cf390b
2 changed files with 10 additions and 6 deletions

View file

@ -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 @@ static int pil_mba_init_image(struct pil_desc *pil,
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 @@ static int pil_mba_auth(struct pil_desc *pil)
/* 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) {

View file

@ -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 @@ static int wait_for_mba_ready(struct device *dev)
/* 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 @@ static int wait_for_mba_ready(struct device *dev)
/* 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;