From patchwork Tue Jun 12 16:58:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 138374 Delivered-To: patch@linaro.org Received: by 2002:a50:ec0a:0:0:0:0:0 with SMTP id g10-v6csp5787748edr; Tue, 12 Jun 2018 09:58:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKILzNLE6TVxeyFoGa9h5lMCd147a+F+hjCVW0SDJ9SWxReUGvFJQSrl19Z2T7GlusiLuxfR X-Received: by 2002:a17:902:1e2:: with SMTP id b89-v6mr1217225plb.279.1528822719517; Tue, 12 Jun 2018 09:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528822719; cv=none; d=google.com; s=arc-20160816; b=HQGaDBzs7HSLbzJbCfw0HHMQcFwTNql5bc7ktMrtCK+oihF5OHqwNb7m4fd0Ew/uHZ HMJdP/Zkj0iasXAL93/9F5QevMZRvXRApcDkyMqoi4hVuzr2Pg0HNQwdZ/MCd7b5DRAz QltKNOg5+iFBmSLuF1nbQSoDV1JI56hNJ4EKMZs2RvGIC/bW2lBJG2I+hJcr6pcvQYRP OYjLLA/LrUFKC9Ier6i08/aYa4YA8WPOv8TEpSssM2ms2VRInaA1XXVq8JxpDWt+E9HW EH+Y/ZKB/Rn+1ylget1mXO56yMISgfAwPwDVhQcMBzYPNTwHTyJfGzX89SJxxxc7kIbA 5uZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=ZLFCe0GKzEVcYWmmqINPeFmncEB43m35Q4nfojP5WTg=; b=RRL5fIeOGTFzxBFEVllSxpI28aE3BUcTsfo16t03oik+tWe9lTb2ccPqF9CexojX8d Ab0Yljg89YZbTC3VAG6Muzl9Bk0N5dPPPFyzxqlL0wUYepAP0E7tzOk4KRJpTvjRBODI 7wtvS+fubBT6YWcsiEZazuZAenBZw37ExNogABAByNahn8Q6qZbxHA4GYuc1b7FGZxPC kgCPqV4v2ypausV8FDeQ52LfFA1Fcp4i6z5v2uEdFRcWw0NouRpyepYcdyD7m0dWsoU5 ad24eHhvLV9DdIUNs/0/DoilghVpuYs6UlJEQ77nSJpzs/Zqk1uTv08Si4LywA021DGx cNWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RdwqUoTY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 e1-v6si442342pgr.318.2018.06.12.09.58.39; Tue, 12 Jun 2018 09:58:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RdwqUoTY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934780AbeFLQ6h (ORCPT + 13 others); Tue, 12 Jun 2018 12:58:37 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:33021 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934957AbeFLQ6f (ORCPT ); Tue, 12 Jun 2018 12:58:35 -0400 Received: by mail-wm0-f66.google.com with SMTP id z6-v6so20398402wma.0 for ; Tue, 12 Jun 2018 09:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0YMbWSgScx+JqkveweOCr/kvtzWm8FJ6s59KELPucfs=; b=RdwqUoTYBIPN6riuy3UdPIunOHKjH7Evy5jt73NNL65uIBAfhSLZpnn9mmWIOna3e9 kOFUVzNixhUmqggdzmd+K4MyVwsK2wzW9n/WDZh2dFiecd9eFn9oxjBHgFl2oxfhrLAY suxuYk6HkEXOQCMbTzrPbMjUfJQegwFIjT9ko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0YMbWSgScx+JqkveweOCr/kvtzWm8FJ6s59KELPucfs=; b=DzvobLSVHuVLem7Rk2s1MCT+y2Pa220UYVUZYAJHDoh9MhJOlZR06cWE5V/kaZ2xDE 0Y/XvCe/xDPYUoBxjRDFtNTMRC5CvZTLNBjKOzLxmD4nss303fwhqphZWNhScWqhaCdV ef9q2e6Ynw90fOzK1Wf+ralClhCJl3/ZWuNrjdZIudjL+8nxzTMVfy1nxbgWX5f8jqev kDda3MaMmQ7Sl3RAV6dA4qfnPrg5fsDezJE5YynEyqsMHqBzvr6U7MVX2JRKbkwsbtY7 qXBm+gemAtB2LtN9YNA1eNXenxrEdMW+6fxltJEmCpQXlShQw5NSZc80LyBDPZBWkCwQ Oj9A== X-Gm-Message-State: APt69E0rjdTbftkiu6XkURc6YW7ICqRfcgQrsB8+crhiFB92Vniu6fXR Ji/uha5KzNLd+hzrPIVogCTPNg== X-Received: by 2002:a1c:5b0d:: with SMTP id p13-v6mr804476wmb.53.1528822713969; Tue, 12 Jun 2018 09:58:33 -0700 (PDT) Received: from lpoulain-ThinkPad-T470p.home (LFbn-1-2080-109.w90-76.abo.wanadoo.fr. [90.76.145.109]) by smtp.gmail.com with ESMTPSA id a8-v6sm901562wrc.18.2018.06.12.09.58.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Jun 2018 09:58:33 -0700 (PDT) From: Loic Poulain To: bjorn.andersson@linaro.org, ohad@wizery.com Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, Loic Poulain Subject: [PATCH] remoteproc: wcnss: Wait for iris before starting Date: Tue, 12 Jun 2018 18:58:31 +0200 Message-Id: <1528822711-13342-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org wcnss_start fails when called by remoteproc before iris probing. Fix this by adding synchronization/completion on iris assignment. Signed-off-by: Loic Poulain --- drivers/remoteproc/qcom_wcnss.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index b0e07e9..e5fbf91 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -86,6 +86,7 @@ struct qcom_wcnss { struct mutex iris_lock; struct qcom_iris *iris; + struct completion iris_assigned; struct regulator_bulk_data *vregs; size_t num_vregs; @@ -146,6 +147,7 @@ void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, wcnss->iris = iris; wcnss->use_48mhz_xo = use_48mhz_xo; + complete(&wcnss->iris_assigned); mutex_unlock(&wcnss->iris_lock); } @@ -221,6 +223,13 @@ static int wcnss_start(struct rproc *rproc) struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv; int ret; + ret = wait_for_completion_timeout(&wcnss->iris_assigned, + msecs_to_jiffies(5000)); + if (ret == 0) { + dev_err(wcnss->dev, "Timeout waiting for iris device\n"); + return -ENODEV; + } + mutex_lock(&wcnss->iris_lock); if (!wcnss->iris) { dev_err(wcnss->dev, "no iris registered\n"); @@ -496,6 +505,7 @@ static int wcnss_probe(struct platform_device *pdev) init_completion(&wcnss->start_done); init_completion(&wcnss->stop_done); + init_completion(&wcnss->iris_assigned); mutex_init(&wcnss->iris_lock);