misc: mnh: Allow longer hotplug timeout for debug

This helps debug early boot issue.

Bug: 63390674
Bug: 63899715

Change-Id: I1bfcb664671016ba71bdd75a6d8ee926a54bc2a1
Signed-off-by: Cheng Gu <gucheng@google.com>
This commit is contained in:
Cheng Gu
2017-08-04 15:44:59 -07:00
parent 11cda4225d
commit 8c473c555f
3 changed files with 22 additions and 7 deletions

View File

@@ -42,7 +42,7 @@
#define APP_DMA_CHAN 1
/* timeout for waiting for bootstrap MSI after hotplug */
#define BOOTSTRAP_TIMEOUT msecs_to_jiffies(2000)
#define BOOTSTRAP_TIMEOUT_MS 2000
/* Signaled when server sents bootstrap MSI */
static DECLARE_COMPLETION(bootstrap_done);
@@ -276,7 +276,7 @@ static int easelcomm_hw_ap_dma_callback(
}
/* AP/client PCIe ready, EP enumerated, can now use MNH host driver. */
static int easelcomm_hw_ap_pcie_ready(void)
static int easelcomm_hw_ap_pcie_ready(unsigned long bootstrap_timeout_jiffies)
{
int ret = 0;
uint64_t temp_rb_base_val;
@@ -314,7 +314,7 @@ static int easelcomm_hw_ap_pcie_ready(void)
} else if (!temp_rb_base_val) {
/* wait for bootstrap completion */
ret = wait_for_completion_timeout(&bootstrap_done,
BOOTSTRAP_TIMEOUT);
bootstrap_timeout_jiffies);
if (!ret) {
pr_err("%s: timeout waiting for bootstrap msi\n",
__func__);
@@ -332,9 +332,11 @@ static int easelcomm_hw_ap_pcie_ready(void)
}
/* Callback on MNH host driver hotplug in/out events. */
static int easelcomm_hw_ap_hotplug_callback(enum mnh_hotplug_event_t event)
static int easelcomm_hw_ap_hotplug_callback(enum mnh_hotplug_event_t event,
void *param)
{
int ret = 0;
unsigned long timeout_ms = (unsigned long)param;
static enum mnh_hotplug_event_t state = MNH_HOTPLUG_OUT;
if (state == event)
@@ -343,7 +345,9 @@ static int easelcomm_hw_ap_hotplug_callback(enum mnh_hotplug_event_t event)
switch (event) {
case MNH_HOTPLUG_IN:
pr_debug("%s: mnh hotplug in\n", __func__);
ret = easelcomm_hw_ap_pcie_ready();
if (!timeout_ms)
timeout_ms = BOOTSTRAP_TIMEOUT_MS;
ret = easelcomm_hw_ap_pcie_ready(msecs_to_jiffies(timeout_ms));
break;
case MNH_HOTPLUG_OUT:
pr_debug("%s: mnh hotplug out\n", __func__);

View File

@@ -213,7 +213,7 @@ struct mnh_sg_list {
typedef int (*irq_cb_t)(uint32_t irq);
typedef int (*irq_dma_cb_t)(uint8_t chan, enum mnh_dma_chan_dir_t dir,
enum mnh_dma_trans_status_t status);
typedef int (*hotplug_cb_t)(enum mnh_hotplug_event_t event);
typedef int (*hotplug_cb_t)(enum mnh_hotplug_event_t event, void *param);
/*******************************************************************************
*

View File

@@ -93,6 +93,9 @@ HW_OUTx(HWIO_PCIE_SS_BASE_ADDR, PCIE_SS, reg, inst, val)
/* Timeout for waiting for MNH set_state to complete */
#define STATE_CHANGE_COMPLETE_TIMEOUT msecs_to_jiffies(5000)
/* Timeout for MNH_HOTPLUG_IN when uart is enabled (in ms) */
#define HOTPLUG_IN_LOOSE_TIMEOUT_MS 15000
/* PCIe */
#define MNH_PCIE_CHAN_0 0
@@ -1188,7 +1191,15 @@ static int mnh_sm_hotplug_callback(enum mnh_hotplug_event_t event)
if (!mnh_hotplug_cb)
return -EFAULT;
return mnh_hotplug_cb(event);
if ((event == MNH_HOTPLUG_IN) && (mnh_boot_args & MNH_UART_ENABLE)) {
dev_info(mnh_sm_dev->dev,
"%s: allow %d secs for MNH_HOTPLUG_IN\n",
__func__, HOTPLUG_IN_LOOSE_TIMEOUT_MS / 1000);
return mnh_hotplug_cb(event,
(void *)HOTPLUG_IN_LOOSE_TIMEOUT_MS);
}
return mnh_hotplug_cb(event, NULL);
}
/**