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: 10460767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DE8A601A0 for ; Tue, 12 Jun 2018 16:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EC1928A1A for ; Tue, 12 Jun 2018 16:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2355728A2C; Tue, 12 Jun 2018 16:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1704C28A32 for ; Tue, 12 Jun 2018 16:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934002AbeFLQ6h (ORCPT ); Tue, 12 Jun 2018 12:58:37 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33022 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934942AbeFLQ6f (ORCPT ); Tue, 12 Jun 2018 12:58:35 -0400 Received: by mail-wm0-f67.google.com with SMTP id z6-v6so20398403wma.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=itW425oE5EqPtk4Rv6M6WaQP12pFFQguNcPGaJzukUA14G6ZP7HNoBtYuXOanov9Z7 6VtBtWaOjTTHfKRM0W47JYJIc1G+IfwYex6q4m2lfYnEcd4HVPh1OrtZTUI8PzgbMOJd KA6eMpZqjR9M8bO3Cw3D9GbtzAIJnC7+V6CZGm5PcwnL1ti64G014ydNXsQpn9vPVjSi 3gM5AoIJK/biC+yAdy3BR6N7+fA6qI/ZlQUvUSlESLGsMrEH7g1Ep16KEtzTNWWjY5D2 jLJApiJxN+CsSk9EyK9+PO0Dn2C0mFKYwZca8pSeovhovTA5lZqb0gyP/JQH+RwCSMKN tp2g== X-Gm-Message-State: APt69E0ghaS+HOh4xJnEzQbuWuNFzN+PpKtWhMPRSrbyjCMtfgzXP95Y igQbctnxuDgfq+dfXi0woVHGwHu/DOk= X-Google-Smtp-Source: ADUXVKLq+ke53Qvh/ExW7dZY82wPx9+4/xs8n7rwtNkdk3dvUptrgEoXTn5g7Z6S7g8Mrfc80qegIw== 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-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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);