Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4065402ybb; Mon, 6 Apr 2020 23:27:34 -0700 (PDT) X-Google-Smtp-Source: APiQypLGC9crZGjO6f3aaKCmTUNc+7DlLr2IwKgbvx33CW3BadU/1k4Mmq7npOZlw9lmot9JoQm9 X-Received: by 2002:a05:6830:160c:: with SMTP id g12mr331567otr.335.1586240853911; Mon, 06 Apr 2020 23:27:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586240853; cv=none; d=google.com; s=arc-20160816; b=uHaX279Fxd3bZzKU4pTfmGalvym4AIQxklG2/MveWhnJmJ1TKHlH1grrFC+Ofu6zph UkmxoldtRDUWnXsh+Ef51PC3J+QzL/SA6HtvPVXoml+VGWxkVVLaWlHrK7ZZ3lc1GGVJ 2wGgUVpx4S+89t5dpeLwxDaylOjmdOxsrY9N4ddFDifuzMP/8VLTR3DZELVangD/kKCe iHZF7Nt7URJ6zoxyU1FrUBgKW0EQ34AL+h2LyTVBXM+N7FZMcERme5vISKYo0cr2z4OH a4zIfbskEu8jXWpV7P2yAr1k0TY6YzBkX/X7mLHHirZeelqmlJAY9VZOzIOA02VfJvsj qprQ== 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=ONLftnGsLl++P31s2gjavTkjMaFjGxacNpYiF6aPBEQ=; b=Wqxj6ks+8BynAoyrG4vPANLfWjihmjPMk9oX2tMlLBS+m25H2DWvhLNV2EGM7tQPUy VgYrufZOQm+g2LuCk0s1YB2UxDb1R3LP3LRMg1njtwR0WV4lbTn89BG3VOwb7BdOcS9t mS+IpvcZKD3mqq0TwDQBAvX8bWJ3e83rFusXLjUE5/2uF9M0HIMfl4UGq89pyDiOPX4t O6jISlZhONmYv288xzQnaeefjoFfThmXcb+/ocL/EelN244DirUzMl+0OZZAt3JyAeef 0c7/jRpZI6wzTlUCACyI50kpZrRJGJcpEyD24qxSodt4Y5XIIH5PzrCBWAVVgSuqRfy5 zZWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OprSWA3K; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r187si303860oig.168.2020.04.06.23.27.21; Mon, 06 Apr 2020 23:27:33 -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=pass header.i=@linaro.org header.s=google header.b=OprSWA3K; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbgDGG0s (ORCPT + 99 others); Tue, 7 Apr 2020 02:26:48 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:36772 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbgDGG0s (ORCPT ); Tue, 7 Apr 2020 02:26:48 -0400 Received: by mail-pl1-f195.google.com with SMTP id g2so855635plo.3 for ; Mon, 06 Apr 2020 23:26:47 -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=ONLftnGsLl++P31s2gjavTkjMaFjGxacNpYiF6aPBEQ=; b=OprSWA3K1+DI82/GVLD9pVzmKVKvVfeO4Tz9H3QiOUDtsw81ckghYK6DmWwGFoyB9X Ftt1C2XBTnGx5FJ4C3dZaR72V0ZRplOEfo6sldDkl31sFjawtkBr01zebwSXsX1vs2xq Jf4YZfmwVGrWaOKs+bev2CeGKwbjQl5bUcBSSP+sPhhCYPi5rgtyPyRcroE5/FHTAaAe y4Rfvb8ZIGhtJFvkztdIoQJD3759m2Dq//g5xGG7N3blFCWa/zcUvFaqm78M6g+28EEi CF1rPQ4TtLDmvYPusnpFRFLs4itFj8ojJRYgzJZlEA3SeFgTP8WegMwDQZFYMJKLmMSc ZQfA== 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=ONLftnGsLl++P31s2gjavTkjMaFjGxacNpYiF6aPBEQ=; b=aDuIl922vSZoHiI373goY4tFMPZQbmxUb/byo9azOzfCQYgCgsqLqixxgkHGwc53SO q2ED6JrJMyjrrAKn+Fm6ROnWcVc8tlyAwa/JWGp+FrN7veuC7AOo0J4FJupyHN71j+W7 /3kYol4Y1xhHr6guf2sEFpjZF2fTBn/UByY4hGjkkHxyopBLp16hHD9IDTB3gThGEJvr rKAZGhSkqPJTy+26oJBQxPqa/JZG/yCnS5MopjJ5E3YBYsq0d6BO7G7HmFXGpINqmCNv QXxmbuOrIWEzOGWTo8BbVd/XtZ1oDRgGfapVFGIcnppfxwoy5ZAo+jdKZfemZLALH0nW edAQ== X-Gm-Message-State: AGi0PubWAy+lKckHL734OKqxsrGkXluAGdyH1Bk7SdU+sc/2tHpsjL6Q 7qkqtNvwPyB8DECvNkKQx6bo X-Received: by 2002:a17:902:c595:: with SMTP id p21mr1008197plx.17.1586240806501; Mon, 06 Apr 2020 23:26:46 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:6e86:d03b:80dc:a9ff:fe0a:9bd3]) by smtp.gmail.com with ESMTPSA id mu15sm716327pjb.30.2020.04.06.23.26.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Apr 2020 23:26:45 -0700 (PDT) Date: Tue, 7 Apr 2020 11:56:41 +0530 From: Manivannan Sadhasivam To: Jeffrey Hugo Cc: hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] bus: mhi: core: Handle syserr during power_up Message-ID: <20200407062641.GC2442@Mani-XPS-13-9360> References: <1586207077-22361-1-git-send-email-jhugo@codeaurora.org> <1586207077-22361-2-git-send-email-jhugo@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1586207077-22361-2-git-send-email-jhugo@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 Mon, Apr 06, 2020 at 03:04:35PM -0600, Jeffrey Hugo wrote: > 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, Hmm. Do we really need a max 1ms delay between each read? I'd prefer to have 100ns to reduce the wait time. > + mhi_cntrl->timeout_ms * 1000); > + if (ret) { > + dev_info(dev, "Failed to reset syserr\n"); dev_info(dev, "Failed to reset MHI due to syserr state\n"); ? Thanks, Mani > + 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.