Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3045487ybz; Mon, 27 Apr 2020 09:02:36 -0700 (PDT) X-Google-Smtp-Source: APiQypI8zVZal58LSYCxXGEw/qSn/b/O37qe5jmC7sgpKeyXxkz3twzyByPHu7eDGSGdvoZE33bq X-Received: by 2002:a17:906:4995:: with SMTP id p21mr10719301eju.19.1588003356276; Mon, 27 Apr 2020 09:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588003356; cv=none; d=google.com; s=arc-20160816; b=WWvCQcPWdgJXJYp4ZRd4UV7mbhsloSPa4+ej5/BxBrT/6kwTXVvPKWMwooB1PykApw Cv3gef0z4ziQ3PH9GA0FIyu8kyJPpoQ42YGjormD7vouEIAxmngCFVmi87mBynwDRmzb /HdvxvBxy5Ee87wzpCqzjEzleeo1havt56Z2jrxn8REU8nVTo6o+dFhtFJZayGZkhtwi SV3B3Nz8Fh6TvYvCnA2zAVdZrdVBE/SfLcctSVcQBK2kNEeYyRZn+WWrFnVRfMFZ9iS5 8z3MJFotJAoDdrdNm+XuTgX4pFk8rqFPACX8jZz9jCFQMalHvzgbvLoSQF35utcy4p0s o39A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=/9q73TN0qA+ILuWfO7wpBj99H8TUww0pz6HfMXIUEPg=; b=bwLAtZ1CTLRUcif5qW3k71h44YQ8+2gjTA9kXuhuQcSj8JQKzL9eEYvsFKubAPIcLt PdedExI4UsnOXFvzJEmHMK2G0bqYwzkntOkWnP5BXLUdRoA6RaYg6TU9B37IG4IVxmks iSa6PCMn6H3X63Ivd3Im6cA1ZkFrd0JkAEpGyzXGE3rt6odMndoH/qHan3lk14YP3ZRn HvLjjXV7t2wE1r7wQTQXa8WiQFHoudc9QS1rgVREw4O+2jbfOBKdAg8hKd61vNUNua6/ HxMeNKWyEgmfj+e3FAB9SxYQHvqCWpiAIrBfTMsO/1qa0nnFTwnq4vozLujrvCKfz2ZT b2ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=mbM+Pr75; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oo21si3094ejb.453.2020.04.27.09.01.55; Mon, 27 Apr 2020 09:02:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=mbM+Pr75; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728431AbgD0P7r (ORCPT + 99 others); Mon, 27 Apr 2020 11:59:47 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:42923 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbgD0P7l (ORCPT ); Mon, 27 Apr 2020 11:59:41 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588003180; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=/9q73TN0qA+ILuWfO7wpBj99H8TUww0pz6HfMXIUEPg=; b=mbM+Pr75teVRhf0FX54LqjCWO0GhOE5r5diL/+xV9BFCao5lQyXXpX/FrJXFHwIt7dVT5eeD H9JZAw9mXJ7ttn5HQTBWlWgaBNxC0lKOHb4dkG0BfNSYoF+b6v6aQionkrJ9w5U0kQgbw0Xd I0nf2dDoVy72YjbXEzpSC44zT94= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ea7016a.7fb6b94110a0-smtp-out-n01; Mon, 27 Apr 2020 15:59:38 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 9E7F6C433BA; Mon, 27 Apr 2020 15:59:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from jhugo-perf-lnx.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo) by smtp.codeaurora.org (Postfix) with ESMTPSA id B7438C432C2; Mon, 27 Apr 2020 15:59:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B7438C432C2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org From: Jeffrey Hugo To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH v3 5/6] bus: mhi: core: Handle syserr during power_up Date: Mon, 27 Apr 2020 09:59:12 -0600 Message-Id: <1588003153-13139-6-git-send-email-jhugo@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1588003153-13139-1-git-send-email-jhugo@codeaurora.org> References: <1588003153-13139-1-git-send-email-jhugo@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The MHI device may be in the syserr state when we attempt to init it in power_up(). Since we have no local state, the handling is simple - reset the device and wait for it to transition out of the reset state. Signed-off-by: Jeffrey Hugo --- drivers/bus/mhi/core/pm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index dc83d65..239619b 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -760,6 +761,7 @@ static void mhi_deassert_dev_wake(struct mhi_controller *mhi_cntrl, int mhi_async_power_up(struct mhi_controller *mhi_cntrl) { + enum mhi_state state; enum mhi_ee_type current_ee; enum dev_st_transition next_state; struct device *dev = &mhi_cntrl->mhi_dev->dev; @@ -829,6 +831,24 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) goto error_bhi_offset; } + state = mhi_get_mhi_state(mhi_cntrl); + if (state == MHI_STATE_SYS_ERR) { + mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); + ret = readl_poll_timeout(mhi_cntrl->regs + MHICTRL, val, + !(val & MHICTRL_RESET_MASK), 1000, + mhi_cntrl->timeout_ms * 1000); + if (ret) { + dev_info(dev, "Failed to reset MHI due to syserr state\n"); + goto error_bhi_offset; + } + + /* + * device cleares INTVEC as part of RESET processing, + * re-program it + */ + mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0); + } + /* Transition to next state */ next_state = MHI_IN_PBL(current_ee) ? DEV_ST_TRANSITION_PBL : DEV_ST_TRANSITION_READY; -- Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.