Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp218729ybj; Mon, 4 May 2020 19:46:34 -0700 (PDT) X-Google-Smtp-Source: APiQypIma5BZMPykFLznolYGX7w/hqDVLlShvGYBk7W0pFs2LCcPM0iS0PsN14eg/6If9aAF96Cc X-Received: by 2002:a05:6402:759:: with SMTP id p25mr870189edy.102.1588646793827; Mon, 04 May 2020 19:46:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588646793; cv=none; d=google.com; s=arc-20160816; b=sXNsKYFxb5DfpKG8ROanDG4bn+X/NBFbzFjLy1rkkHsNW5Us/WlO4kVodt+0U6p5nc +dqZ8/FDk8bBtIy1l5omnz6OEUZVnUqcgUxy81KvDz7UQ9G/Kj6SSd+fBcV8bl1L/8ec c57MXfBiQxwhmb7oAaw2P/MUaxm891FmV6iTtwNov7pWkIvYkHlU21sLlaiBoQejggCo r5UVxnbL48KFlKw7Q5Ec/6RqZ70FnmKX+VoWa/+Uopvwe4seP32aee/10DHZhZNgFh7i dlckVpvLOBwjkM9+H0Y2K05v4/dz9ysa6lx+MiucNJehO97oHELH3QgVHo1utePKYQsG 7y8Q== 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=7hzUwGmWRl05YfEuRakRYnz0izFE+MkI9+t81/uGOUo=; b=PcMxDFRLGvwJu+Nh9QNsvsCkCdk43YcbWAPfvSUuRk26lJ+ASkkmTEvFs0++lY0qYy /RCYgnnyl6+jS8VFW7i11jMYKhcsCAEGmpLWiD8xph+2XqAE2HqhjTYAVcQaW1SscUbG WsO/bL+JuErXvicF86xorXYgipJZRVtk5kGyZ0Pb9DSqBH2SRPJWzSn9PKu0KCXsMmBP nzXi6wvCp8CuozxozUm/y3mpEXQhq8TV0N13QsYvQ8Iy8dsKD1jW5tQMMHt1kEUwMtV2 e8GSSI1Eqp74T9N+ksdiq7MWWGc/clWUr7FEJGfawB+eezOTAS7fbCwhgNhLTOo8cj9E Rg6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=Xwb3vbUB; 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 ce9si268468ejc.139.2020.05.04.19.46.10; Mon, 04 May 2020 19:46:33 -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=Xwb3vbUB; 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 S1728402AbgEECon (ORCPT + 99 others); Mon, 4 May 2020 22:44:43 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:14337 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726635AbgEECoi (ORCPT ); Mon, 4 May 2020 22:44:38 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588646678; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=7hzUwGmWRl05YfEuRakRYnz0izFE+MkI9+t81/uGOUo=; b=Xwb3vbUBJ4YWU8Argrn6hZEDxUl+j6Mm28svIc38gMH8AEu8/w4VEFrn+GAbTdyYgGA/ovSl 71tvJS4qx+8ZX12k6uAHDi6z0a2TXd3GjQzujznY7EMdSW0NId9EqjMpirxfjX1W2RMiCW69 UUd86x7dMAqjEInTQA8uL5Hmud4= 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 5eb0d316.7fb1f52632d0-smtp-out-n04; Tue, 05 May 2020 02:44:38 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 2705DC43637; Tue, 5 May 2020 02:44:38 +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=unavailable 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 E1006C4478F; Tue, 5 May 2020 02:44:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E1006C4478F 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, jhugo@codeaurora.org, Bhaumik Bhatt Subject: [PATCH v5 6/8] bus: mhi: core: Return appropriate error codes for AMSS load failure Date: Mon, 4 May 2020 19:44:20 -0700 Message-Id: <1588646662-25785-7-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1588646662-25785-1-git-send-email-bbhatt@codeaurora.org> References: <1588646662-25785-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 Reviewed-by: Jeffrey Hugo --- 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 17c636b..05627fe 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