From patchwork Wed May 5 21:37:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 431225 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp868550jao; Wed, 5 May 2021 14:40:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxYkLV+OaQDsGlJe6FPaosYYZ5H4WH3SzPQ632eD7w2G/9QXTSEYX84Us2bQEXes8+z5d4 X-Received: by 2002:a17:90a:d804:: with SMTP id a4mr683438pjv.63.1620250807428; Wed, 05 May 2021 14:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620250807; cv=none; d=google.com; s=arc-20160816; b=qR9/TKNsAPmVyF3iDgKuFYGZtmjjuxwHKWhxr4HbuPuXrQlXl/Khc/XqiDvRxxn/6Z bRjtKsV7kKyywauSmfqYza4F97NH2TiP+WSF9VSv068N+rXiWPthtVdlLN2S7FKPfvFv bjCWUhr4vZL9ryX3omc6o28bp1UpwMkbdtKauXppdbQOIOHF0Pqtmq82otr+d9YUgO+k d1lS3MPU2leDDTDkW1OXZMoS5u2NR+y5RR2YeCdMzYRM4vi3jfD3jG7VLXKBqOARRzQP 96tCKJFbATycmuZKNLOHTKUPOXiQSJSvgo6/AUrTqU2A78+u9eWqI5UTnRpRxCJzmUJS Zh2Q== 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=pEJvk1zZudo0cXLtIrFaUbh6obXgvIjn1HyujLXL5g8=; b=l+GzX+4mhGZ9dXkP8PDvX7z2m0etwnx9jceNANUpOA57enNL5pSYCtsgyvJhsB4NaE 3eeNZ6tDq+uyki4FVuhNWq0jsa6UncEnNZvSJcfCmUTR7PEtEvDeRWPmfoIlj83Ag6Fi dU2T11soKU/sQ5TiwelS1Ph/hBRGAB4SW2qvPwzWcSbBzSoT7cqH/WKWpiCRtS2itj3L Jc1BxSo/zZQI62E5C7T/urS8VIVLIVg7yAp6vJYIDuVY6Su0B8MQXiN4RJKnQ5vf/n30 S4YLpEDKNieHh6XNWsYw0la1r7T6j2uXDRDKjmzIKt3WbdGpcxNAycLwBcacnmUMBr2m ifHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=drxD5dEZ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 m189si592999pfb.79.2021.05.05.14.40.07; Wed, 05 May 2021 14:40:07 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=drxD5dEZ; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S234918AbhEEVlA (ORCPT + 6 others); Wed, 5 May 2021 17:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234692AbhEEVkm (ORCPT ); Wed, 5 May 2021 17:40:42 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF06FC0613ED for ; Wed, 5 May 2021 14:39:36 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id m37so2804291pgb.8 for ; Wed, 05 May 2021 14:39:36 -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=pEJvk1zZudo0cXLtIrFaUbh6obXgvIjn1HyujLXL5g8=; b=drxD5dEZDc2p/dj0Qmi1fQTn6Q3YHavDpdKXgJUF1gIWA3iewBUPcmJbfbJBKSwaGt YH+4AdQaQnY2k/Z8ldO9jkr99qr6IL7vtp28/+8df4h2qFM9ZoatOqRL+MzI1ykgKkIo +f9+n1tgHrJEe0tvSp/+c/BERGe0Oh1G28PEi8xlUvQJ9u2VnaXQiYMbU2apD1o865pg YP934Pl+KNRAS8tiDpIDF0KHwTQJ5S2plGlxuLr6dwmSJoXrYM9a/TQI+Ti65qWIr4nM ompxuzVLD2EPYntRS8CjQV+B+Yx5TV4QT4pI14FKtWXOL94pTnalF3e3TYNBLCZnR2YC TkWA== 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=pEJvk1zZudo0cXLtIrFaUbh6obXgvIjn1HyujLXL5g8=; b=HQ37pcV3cweWcAwZZnxXXDnyG4bojkUgWjkiM/iVnljOT2xN8pHwQksfUacT0Ml6wH gwR4l/PlfXphtrXS3Ptt+clBB/n9vBDQx2h30i7xiTICNs8zZudLxM06oLVYmqHcrmGw h7BIpwZMhTazd4KKxp4sFX07R3FtXi77Wqma2/PFBWAixK3ZPexEIvqm2ccMI6F1SZ7E MqYttZ9TeQJkxJKYMAZWbLyQBctHPnpJoZQ/roVbFmdg511dtWYpC0g64dyiQCwcg02H d/SytXK8UkBQUgjMlnDpXlyz2fjEXjiYFq7IQ1/tFAnKeaIxlu8vwY9e6uZnfskiCE98 F04w== X-Gm-Message-State: AOAM5322ckfJdBbVbO5d0nOOA2Hc8bm2sM2XNPtjEUyDkALmXlsjdrpP EbNycM1o7ajwkxElqTM7V31h9A== X-Received: by 2002:a05:6a00:ad6:b029:28c:c28d:d3c5 with SMTP id c22-20020a056a000ad6b029028cc28dd3c5mr1105527pfl.54.1620250776482; Wed, 05 May 2021 14:39:36 -0700 (PDT) Received: from localhost.localdomain.name ([223.235.141.68]) by smtp.gmail.com with ESMTPSA id z26sm167031pfq.86.2021.05.05.14.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 14:39:36 -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 v2 15/17] crypto: qce: Defer probing if BAM dma is not yet initialized Date: Thu, 6 May 2021 03:07:29 +0530 Message-Id: <20210505213731.538612-16-bhupesh.sharma@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210505213731.538612-1-bhupesh.sharma@linaro.org> References: <20210505213731.538612-1-bhupesh.sharma@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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. 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 | 4 ++++ drivers/dma/qcom/bam_dma.c | 7 +++++++ 2 files changed, 11 insertions(+) -- 2.30.2 diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index 9a7d7ef94687..3e742e9911fa 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "core.h" #include "cipher.h" @@ -201,6 +202,9 @@ static int qce_crypto_probe(struct platform_device *pdev) of_match_device(qce_crypto_of_match, &pdev->dev); int ret; + /* qce driver requires BAM dma driver to be setup first */ + if (!bam_is_probed()) + return -EPROBE_DEFER; qce = devm_kzalloc(dev, sizeof(*qce), GFP_KERNEL); if (!qce) diff --git a/drivers/dma/qcom/bam_dma.c b/drivers/dma/qcom/bam_dma.c index 2bc3b7c7ee5a..c854fcc82dbf 100644 --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -935,6 +935,12 @@ static void bam_channel_init(struct bam_device *bdev, struct bam_chan *bchan, INIT_LIST_HEAD(&bchan->desc_list); } +bool bam_is_probed(void) +{ + return bam_probed; +} +EXPORT_SYMBOL_GPL(bam_is_probed); + static const struct of_device_id bam_of_match[] = { { .compatible = "qcom,bam-v1.3.0", .data = &bam_v1_3_reg_info }, { .compatible = "qcom,bam-v1.4.0", .data = &bam_v1_4_reg_info }, @@ -1084,6 +1090,7 @@ static int bam_dma_probe(struct platform_device *pdev) if (ret) goto err_unregister_dma; + bam_probed = true; if (!bdev->bamclk) { pm_runtime_disable(&pdev->dev); return 0;