Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3625611ybz; Mon, 27 Apr 2020 20:02:46 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+pCywyVNOOEaqmfEExAdAjc3Dd44gurTNoYQMTdDOzXNjwNOo704qkmVaNQaf8jwglI1P X-Received: by 2002:a17:906:808:: with SMTP id e8mr22184268ejd.372.1588042966313; Mon, 27 Apr 2020 20:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588042966; cv=none; d=google.com; s=arc-20160816; b=yi3NkPDG6P0+lqM268Ck9c58UIPdmcCl2DHY3nPOKg+jTH2mNQwxCiMOa6EO2H7B70 OUAb7mrVXPhIrXcSByHxhIFMJWh7DRLYjW/T5a/CE2Rb2j9v/QPzgKMuoDlLveiBUFuK 9H+FIWU2fZ4wj+lJ24f1PXlVpoL6NlF9ef6kEJrSX9PZ/uriFU2ny3qW0DFJeX5v3CjF UBLH8hx/qvafFWFP7ylSW8W0fb/Cu2c99II7xG7n7za4jKihKeFJ9adC9VJeNBXLxpwv QRFq6f4BFcBZLi6OAXK7inVbRqD35VurxtLVmwZaczDiNSW+dfVThXYLCf3n+McZKcsM 3jgw== 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=PsWaXjUR/K6H4tZBz0YQk+NEUWg8eY6N673gPQl/964=; b=zDWFMaroO5yNBYpjpTzprfSYZC7lv+4QRxMciVknVAzFcTNmmn6MwWJMgdBXIsWNBv 7dEx25yC4TDsIQxNUup2tgavzVQfjzzCAfPLUYB23JYDJ7YpsES7BHdpyPVbYp+UoIfr kIas7SffLAlHFz/ljxUFx1jNst7vhlVr3UNilpCHaK4lztqK4OaMHJai53nO4aqUXZOG xrsCZd6SteYGiKZfNxZVxmvoKhtI3d4f0jBlbCaBshZa9UkRHAaq8TRXozE+vVWnGwVQ Dsyibdpbwn6QBmnJhaNv9yy/oKPtfejefCPGG6GxZoXAjFrwaA3RXujLlmwwuviFr/dm qXAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=TIpMQpaQ; 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 y6si1050870ejw.296.2020.04.27.20.02.23; Mon, 27 Apr 2020 20:02:46 -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=TIpMQpaQ; 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 S1726508AbgD1DAO (ORCPT + 99 others); Mon, 27 Apr 2020 23:00:14 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:13991 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgD1C7n (ORCPT ); Mon, 27 Apr 2020 22:59:43 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588042783; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=PsWaXjUR/K6H4tZBz0YQk+NEUWg8eY6N673gPQl/964=; b=TIpMQpaQ1uiLAyY6hF0g1gODHr/sjrb501oJ6WkEKH5mAHoUv1kM/StJEFFZhUTT/JUBW0c5 i8TVe4RTp9NJETVYf6SpCjJc0Pr9vMnfEp086I+Nk8E4HLhsS3xPNsc7ariXe2cMeRWs6/aL KzZW1Y4gArfq7urrH6xEG2zsC7I= 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 5ea79c1f.7fa7b9424928-smtp-out-n03; Tue, 28 Apr 2020 02:59:43 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 274E1C44788; Tue, 28 Apr 2020 02:59:42 +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 bbhatt-linux.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: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9A842C432C2; Tue, 28 Apr 2020 02:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9A842C432C2 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=bbhatt@codeaurora.org From: Bhaumik Bhatt To: mani@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, hemantk@codeaurora.org, Bhaumik Bhatt Subject: [PATCH v2 6/8] bus: mhi: core: Return appropriate error codes for AMSS load failure Date: Mon, 27 Apr 2020 19:59:24 -0700 Message-Id: <1588042766-17496-7-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1588042766-17496-1-git-send-email-bbhatt@codeaurora.org> References: <1588042766-17496-1-git-send-email-bbhatt@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When loading AMSS firmware using BHIe protocol, return -ETIMEDOUT if no response is received within the timeout or return -EIO in case of a protocol returned failure or an MHI error state. Signed-off-by: Bhaumik Bhatt Signed-off-by: Hemant Kumar --- drivers/bus/mhi/core/boot.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index bc70edc..4e49a0e 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -176,6 +176,7 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, void __iomem *base = mhi_cntrl->bhie; rwlock_t *pm_lock = &mhi_cntrl->pm_lock; u32 tx_status, sequence_id; + int ret; read_lock_bh(pm_lock); if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) { @@ -198,19 +199,19 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, read_unlock_bh(pm_lock); /* Wait for the image download to complete */ - wait_event_timeout(mhi_cntrl->state_event, - MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || - mhi_read_reg_field(mhi_cntrl, base, - BHIE_TXVECSTATUS_OFFS, - BHIE_TXVECSTATUS_STATUS_BMSK, - BHIE_TXVECSTATUS_STATUS_SHFT, - &tx_status) || tx_status, - msecs_to_jiffies(mhi_cntrl->timeout_ms)); - - if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) + ret = wait_event_timeout(mhi_cntrl->state_event, + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || + mhi_read_reg_field(mhi_cntrl, base, + BHIE_TXVECSTATUS_OFFS, + BHIE_TXVECSTATUS_STATUS_BMSK, + BHIE_TXVECSTATUS_STATUS_SHFT, + &tx_status) || tx_status, + msecs_to_jiffies(mhi_cntrl->timeout_ms)); + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state) || + tx_status != BHIE_TXVECSTATUS_STATUS_XFER_COMPL) return -EIO; - return (tx_status == BHIE_TXVECSTATUS_STATUS_XFER_COMPL) ? 0 : -EIO; + return (!ret) ? -ETIMEDOUT : 0; } static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project