Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp171464ybk; Fri, 8 May 2020 22:54:30 -0700 (PDT) X-Google-Smtp-Source: APiQypIrUFk72pE/rDlbtlwtUQfNkwvsKJOgu63frQ/H5Y4Ssk31aFG0MVDO+SQIhJhLy+dWXEVf X-Received: by 2002:a17:906:9249:: with SMTP id c9mr1115864ejx.173.1589003670547; Fri, 08 May 2020 22:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589003670; cv=none; d=google.com; s=arc-20160816; b=AD6s9cK8aQ+qxseTraNvakvI5feD7xOd1iJ+qjtuXaWekjsjogtaS4sWP+gJNyORSa UhppRNVCfJtCWcU9Vw1dg9XCGgGOPn09iRjLJ3VvOcBlF/OU6udQU1VuzPnHPnENLkii k1CCyMo7rGG937cMHFHEJB0bQhPE2YHXnMbM4c4ekpqQqtJrurjkv+fsfMNoF61BlKZk N8GYQPBvfd6kE57WXGWh2r10Ulti2aQY0dn1gCb/mNTWytnd1pMgFzOvCBAjArisAjwB Tzh5Xij2k1V9LS4fYU4nAiZ893VawuuYAxSSDmN9gy+ynwzywDJgW+mELj1NMrBi9KUm Q5/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pvjoP5aUxpQ4gOsr34/F6rHJJZ2e+2QDBWk2vWfDSO4=; b=xlZRheH9jdznDXxXOllI/pEQY4s1HGLllhtp3KB0wVZJKVkw/LZyQ4jYitf3qVl+4E 8+RkKiST4qepFYT2i+zCJNnrtvFf9LsdXSs1NGLbWk+LVblZRQNjCPmnZixSR4Jb+f3a CpgvGc1zKdq0WofRHty9wMwYra/mV1DvC6Zuns9qHKUrcUJ0QMYS/IgGUM2Dsw5squmj kfstH1DxJan7uWQ9eXuss3pqFJgRldCeTM60AeBAFzQsW9N6DA/v7Iu23yDOgi5XccXN cfAIOkqDuGm2l10JRnk+x8CEUiuHgP+Cj1Scu5zuTL2TDFAzfrxA5Ym8LqtyAbAprkzC kdyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="clE/VI4i"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si2177930eja.257.2020.05.08.22.54.01; Fri, 08 May 2020 22:54:30 -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=pass header.i=@linaro.org header.s=google header.b="clE/VI4i"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728868AbgEIFuX (ORCPT + 99 others); Sat, 9 May 2020 01:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725820AbgEIFuX (ORCPT ); Sat, 9 May 2020 01:50:23 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5E3DC05BD09 for ; Fri, 8 May 2020 22:50:22 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id y25so2111859pfn.5 for ; Fri, 08 May 2020 22:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pvjoP5aUxpQ4gOsr34/F6rHJJZ2e+2QDBWk2vWfDSO4=; b=clE/VI4iybQPCUY6guQF99wU0p/FvEMUFM1iyxfUX8WhNZo6t1nkAWScVdPX4mt3W/ 3VYh5zeVh9nopLCiDDTCEVmqYTxdMkRVhu39IaXDPVgXFSzdvXRLdbB3/TD0LYTX29v3 +SoUIFhlqhYcRjQHFdDnkejxhgxPfWu612wsIHXq2OqRziBhIlWyy+ZB0eEvQlSNEafA x1vSl4LYhdfes0Iwos29kWCxRrysF+JQOvr0nhZkMJvtjgQgtNzRu5pQvlYnc29Uy8mO jjDnmx+0SfbMgGGGrc3dG7YAKbrSLgTRUtX3zvoWqWuAxFe9KL+LBkTTIsHCFEoTylcW 0tZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pvjoP5aUxpQ4gOsr34/F6rHJJZ2e+2QDBWk2vWfDSO4=; b=josq8PcGhcPdoPEQenEWRVzxpLDtxctseknwrU/riEVrPzMmvdvkXfV2UP7IgNK2+l XrFYkQE/5kVr5uTpO05EK/rZ9k9/lphHTBCgZTcDen+mpzJ4Shu+cdMHrRDO74pifyBW RUdyP90RFnrpzhPL5MPvRq3RicmzmrDEB4pj04BAN9dNlvKbKrIzywbMVgr+kTTrMWTc X7qQBDnhnb6DdS0EWT10MVtiMkvx3t2wy+7NhcLTsa7iex+1kkcNwbuoYNxWeVngyFfx 3y1WZ+RmhQ/ywfNbvmeChmOC+dVE/UxRyx10Eaqz+fUkcrNVRtHx2DxDKtITamwMEtwd W9Tg== X-Gm-Message-State: AGi0PuaInBDzvECMfCAylWEDwlVWEMYwzGV5gM2sJAjz+7wxES9sRrpl 8ujTak14b0IebEcTGjEpYDb6 X-Received: by 2002:a63:e74f:: with SMTP id j15mr5262764pgk.153.1589003422125; Fri, 08 May 2020 22:50:22 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:6e0c:55d2:2cb4:da01:ad1e:6ad9]) by smtp.gmail.com with ESMTPSA id e16sm2802154pgg.8.2020.05.08.22.50.18 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 May 2020 22:50:21 -0700 (PDT) Date: Sat, 9 May 2020 11:20:14 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org Subject: Re: [PATCH v7 6/8] bus: mhi: core: Return appropriate error codes for AMSS load failure Message-ID: <20200509055014.GF5845@Mani-XPS-13-9360> References: <1588991208-26928-1-git-send-email-bbhatt@codeaurora.org> <1588991208-26928-7-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1588991208-26928-7-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 08, 2020 at 07:26:46PM -0700, Bhaumik Bhatt wrote: > 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 Reviewed-by: Manivannan Sadhasivam Thanks, Mani > --- > 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..cf6dc5a 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