Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3708498ybb; Mon, 6 Apr 2020 14:06:32 -0700 (PDT) X-Google-Smtp-Source: APiQypJ5vWE0OxvjviDuVjBIZgq+onQXKRrWvnVqF4v3CjNe5+XsUzR++aF2OweSUYoGosG1ho17 X-Received: by 2002:a05:6830:19a:: with SMTP id q26mr19934580ota.285.1586207192784; Mon, 06 Apr 2020 14:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586207192; cv=none; d=google.com; s=arc-20160816; b=LDDBsBraaNjnIy5E0NKtCPXTPGLpqCCjx0gVSYtHvo6Y5+bUuaF2xjQYo2ExtBXCqP X7MdPl85IpqStLVJsXrQTRbboiiIJj+/hhwn5KtG7FIwL3s39C9F6H47N1nAZXi1glAC aaRFpNaTThShjfZqpkgIDrr1ZXJRDR1gqVUPcqmKfsDa8lhUtGXgS1snvHGUPz4Xy895 TrVQ5WQGPs1FO8NipUDLD/Y8s5ylN4fhhBsIBi6UIBQwMa7CdwH6iDlF8xHxQO2EDymU w5bfI+1fEjHsOx6rX9pkVO2bE3Auatki1EkFhFQdT/E4Pd35+0o1T+XVKjQDvbSavcqz T24g== 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=niurNmGlPk3ZYcwqcsW7bHpahYKJULHkDgwi4ieDHUE=; b=LpKC0hNretEv1RP6ZRYkpYtSqz2Z3GVVTirDP7vgmSltNk1H1LdgwiZu9RXs1YwHn/ DzzOVGUoV92rky4WVV4WNAG5K7BbzApixo70kJYdByxRLe9CirjO+Q3A5b0H+3b/W7ND POplrKw6TjW3Wkrof2QvDooJ5kkhzOyyw0flzNKboK/kjYTJTIxnPYmGEONf0FsUOF6Y Aixc82kKHcXvfyumdTAvE1Ja2Aho7Mww8DETBvZ5vYSCXlJKASfQfI/jLLJGD3xjiSvE FrVQeuVo4vcbbvjgVDGzvBFRi3GlhF2Ncyo0cT1S0RKee35mpqrlpEp3d9dJTsJ22OXg jw0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=HPRusQDn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si7804574oif.149.2020.04.06.14.06.21; Mon, 06 Apr 2020 14:06:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=HPRusQDn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726399AbgDFVFq (ORCPT + 99 others); Mon, 6 Apr 2020 17:05:46 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:18186 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726254AbgDFVFq (ORCPT ); Mon, 6 Apr 2020 17:05:46 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586207145; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=niurNmGlPk3ZYcwqcsW7bHpahYKJULHkDgwi4ieDHUE=; b=HPRusQDnskQflg6P+Mi/HXjv3yju+x1SoO9r+QBu/+LQe/ls7qb8qEITePcE/4RODmO9Rkod eUnR/EAE1oUn1WVozr1YhP5KSX6Bpy0vrcclz42SYJHhbmt6Nc93+cEIIV2I2+4PGBnM29pK z9CqoVHwvLKdN3bMal99BqLg3fY= X-Mailgun-Sending-Ip: 104.130.122.26 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 5e8b99a9.7f08e9580500-smtp-out-n01; Mon, 06 Apr 2020 21:05:45 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 59C76C43637; Mon, 6 Apr 2020 21:05:44 +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 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 81158C43636; Mon, 6 Apr 2020 21:05:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 81158C43636 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: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Jeffrey Hugo Subject: [PATCH 1/3] bus: mhi: core: Handle syserr during power_up Date: Mon, 6 Apr 2020 15:04:35 -0600 Message-Id: <1586207077-22361-2-git-send-email-jhugo@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1586207077-22361-1-git-send-email-jhugo@codeaurora.org> References: <1586207077-22361-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 52690cb..cd6ba23 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 syserr\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.