From patchwork Wed May 19 14:36:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 442456 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp1387451jac; Wed, 19 May 2021 07:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTU759uLOXX06UrSCwdYD6qu4/e2WiRRba7OsrGZWTXIy80M4KtKOOU1VHAMVRkEm57bV+ X-Received: by 2002:a92:dd89:: with SMTP id g9mr11594269iln.209.1621435208161; Wed, 19 May 2021 07:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621435208; cv=none; d=google.com; s=arc-20160816; b=zMUF0pCZdQ4MLsrv/Jv8OT3rb8/amRfJ7CJXf2pak81JOsLDP0gy4sbXJomAq8wNYZ EC2hmIV7DP4AL3pk5NXcxqVxDIH7mbeoSug89zEv/gB5lJtx6k0TlKfBlh1gT39u5wtg cHDPMtf2h7BO+CyVurwZJFWmzoTWoXTaPorTeFjgEZFqtFzf1DQ8dLl+SdLn+jDAryAK FHztFusxHdR1Hq9+NhMxgmB+rr9Fqzi+PyQqlXA1XiR5s5e9SezHZplNz/j6eF/GL07t Dcj2dXBRlbzMg8a7vlwEIT4D/jyC55+lDEFdyncbVYg5fOMLC7C+5PIRVV+GtvxMp590 UYZw== 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 g16si14567317jat.43.2021.05.19.07.40.07; Wed, 19 May 2021 07:40:08 -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 + 3 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 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(-) -- 2.31.1 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: