Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1756101pxj; Wed, 19 May 2021 13:11:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytUiS2pwTAOYaKYFznX1wgfQwXZHfW15AzCQXf7NhlY5MwI9laJHEnLn5iwpWabaGZ6Nym X-Received: by 2002:a17:906:cb1:: with SMTP id k17mr847932ejh.307.1621455062700; Wed, 19 May 2021 13:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455062; cv=none; d=google.com; s=arc-20160816; b=rWoTn8m35pOnKQaHkWFqx3FlWy62kPRGiU5s+Mp1r2AdctXejpxerlLMdxo0eFUqrs 0zQm7xYuMzYqJ4403hAeO2GeDhsJXSPnde4x55L9gX20Lf8ff4Q6NM/LGudIfgA9dey9 uXGZzgG9Qd1zY3d62HEZPP62XLp3HXb0K/XNx+dyVfMQUWiuD+ueWDEvHv0zDvtVBRup VpGsdoqw4wuZALQUSx3aXJAQebdeXU38AxOp79qXR0ytnuFWWyOqhrzrpNQtvpdvHEa7 vJLQE88TVqrq4Y18xkh5h6ttyIdU54UBmDZB9xJf0Dh87mtLMHTY7YPLvSd/ox2L073o xTZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tMCI6bMNXfsVdvjl30Isl8zmWzmOUOT+UPEict+OVps=; b=ZtUEq5CvGATWgojZ257P1asg/q9D/rmHXJV/PDZYFD+2zm/UJMPbClbeoVdxdw35zv Vl8o+CdMptN93KFweTrHhy5nN3mmbaz28NYVfLj8FtDoaOKaMs9B4T/icw9qI/f8k6gQ NTvTtBoPRHsLF/F2cz2bOREOUsBbM+x5hPCTY98lbvfVpsZVTxB3oKvy3r0B/jmzy+hq o12HQALzx6QxfXYAft36NpTKqI8lQhudDC22W1dSclz9kss4O/q4tzt6UuMB4V0w/n5d dYc+WgL5wYICVAqVBaN4CrZcYrLJmtRi5cdOGLIbGbIMVapgiLc7/KOuU0YRUS0JdjXB aYFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rdgnDhvw; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 nb17si830282ejc.226.2021.05.19.13.10.37; Wed, 19 May 2021 13:11:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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=rdgnDhvw; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-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 S1354464AbhESOlY (ORCPT + 99 others); Wed, 19 May 2021 10:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354350AbhESOlE (ORCPT ); Wed, 19 May 2021 10:41:04 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC9AC061343 for ; Wed, 19 May 2021 07:39:12 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id e15so519439plh.1 for ; Wed, 19 May 2021 07:39:12 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=tMCI6bMNXfsVdvjl30Isl8zmWzmOUOT+UPEict+OVps=; b=rdgnDhvw+CW1f1A/uSTAaEcFXGAneUA+szrRk2vs8Ry2VxbHT9B+3MRNMJZUT+GzrV sWBytOOnV8NtSwkPBBeqUE/YeVsxky6razNmKsRIttmsezmV9v7K4FanTFVQnL6h3uSI NNm8kAzSqhI20qB69H90/cmtnQQw2aNNMrMjg/aQmZAQmVJA4SZcSGS7ntSW1RPDNQnf I1fcDiB82cp9p1PQkdxSThuzYWu2L7NMysw18F6IHdXG10akOwXwdc0kwp7uZX9MTLuV 6LOQAPNK/WE45F/hd+f2BvbHMwWiT/QrNE8Sk8QZ+0pvZor64WkBzQH8uyZ+tEcu4YXM 3Fxw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=tMCI6bMNXfsVdvjl30Isl8zmWzmOUOT+UPEict+OVps=; b=i8nyyhFueP9RyemeEwepEw2nsvK3zF9zFpmUFcrXTaggLQaxGC0oMRC9LcaE5r9THG J44jUMD+FkfO6a3RpoR74rJ8bzOKyUMIBM9eChq7ImrF8hyIL/JAmGb7QOFdssT3HWfL pYXXfSqEWqEY+eneGBLGZdjatInLIYMRipP8q5vukZLM/FKujC93wOq91yUqkKOF6j/h Yx40+YciLfhg2HaWVBu1XtP7pmq3EO1tszMDd+JOnIqFazfVdD3/58u6+yb5j3DSUKBT qDXv3tljXTfyt53EZ0qRiDmqZ7/bdg2mogM9wA1UpGIrbRwHVJhRg30jHJivaRS7b4CD g9xA== X-Gm-Message-State: AOAM531dl5xAjliWfH8PD1XulXCCrOorRhme0/t0lnetLmWMyoB8H9dG 0/1mKlREPc1ihVM4qCGHb1oz5g== X-Received: by 2002:a17:90a:4a89:: with SMTP id f9mr11679024pjh.50.1621435151963; Wed, 19 May 2021 07:39:11 -0700 (PDT) Received: from localhost.localdomain.name ([122.177.135.250]) by smtp.gmail.com with ESMTPSA id o24sm9239515pgl.55.2021.05.19.07.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 May 2021 07:39:11 -0700 (PDT) From: Bhupesh Sharma To: linux-arm-msm@vger.kernel.org Cc: bhupesh.sharma@linaro.org, Thara Gopinath , Bjorn Andersson , Rob Herring , Andy Gross , Herbert Xu , "David S . Miller" , Stephen Boyd , Michael Turquette , Vinod Koul , dmaengine@vger.kernel.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bhupesh.linux@gmail.com Subject: [PATCH v3 16/17] crypto: qce: Defer probing if BAM dma channel is not yet initialized Date: Wed, 19 May 2021 20:06:59 +0530 Message-Id: <20210519143700.27392-17-bhupesh.sharma@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519143700.27392-1-bhupesh.sharma@linaro.org> References: <20210519143700.27392-1-bhupesh.sharma@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Since the Qualcomm qce crypto driver needs the BAM dma driver to be setup first (to allow crypto operations), it makes sense to defer the qce crypto driver probing in case the BAM dma driver is not yet probed. Move the code leg requesting dma channels earlier in the probe() flow. This fixes the qce probe failure issues when both qce and BMA dma are compiled as static part of the kernel. Cc: Thara Gopinath Cc: Bjorn Andersson Cc: Rob Herring Cc: Andy Gross Cc: Herbert Xu Cc: David S. Miller Cc: Stephen Boyd Cc: Michael Turquette Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Cc: linux-clk@vger.kernel.org Cc: linux-crypto@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: bhupesh.linux@gmail.com Signed-off-by: Bhupesh Sharma --- drivers/crypto/qce/core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index 8b3e2b4580c2..207221d5b996 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -218,6 +218,14 @@ static int qce_crypto_probe(struct platform_device *pdev) if (ret < 0) goto err_out; + /* qce driver requires BAM dma driver to be setup first. + * In case the dma channel are not set yet, this check + * helps use to return -EPROBE_DEFER earlier. + */ + ret = qce_dma_request(qce->dev, &qce->dma); + if (ret) + return ret; + qce->mem_path = devm_of_icc_get(qce->dev, "memory"); if (IS_ERR(qce->mem_path)) return dev_err_probe(dev, PTR_ERR(qce->mem_path), @@ -269,10 +277,6 @@ static int qce_crypto_probe(struct platform_device *pdev) goto err_clks_iface; } - ret = qce_dma_request(qce->dev, &qce->dma); - if (ret) - goto err_clks; - ret = qce_check_version(qce); if (ret) goto err_clks; @@ -287,12 +291,10 @@ static int qce_crypto_probe(struct platform_device *pdev) ret = qce_register_algs(qce); if (ret) - goto err_dma; + goto err_clks; return 0; -err_dma: - qce_dma_release(&qce->dma); err_clks: clk_disable_unprepare(qce->bus); err_clks_iface: -- 2.31.1