From patchwork Wed May 5 21:37:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupesh Sharma X-Patchwork-Id: 431226 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp868650jao; Wed, 5 May 2021 14:40:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYBSqrLkRyehw80qCul9v7fVn9BkGNfPxdsA7Ojg+AfTP7DaLz6z0dVFZZ4fNay3WFGhvT X-Received: by 2002:a05:6a00:1c5b:b029:28e:650d:7f9a with SMTP id s27-20020a056a001c5bb029028e650d7f9amr995291pfw.70.1620250818585; Wed, 05 May 2021 14:40:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620250818; cv=none; d=google.com; s=arc-20160816; b=Vm4JdVRn0Gz11CMaDclt7H8zETB76vq6y5XersThWQPheMYajtufDEabD77+A87+WI 3xkL7qqoDkQpxWxV0kS9FaNoCEjMH0EVs1v6h/FsoC3Xv8HueHDZZBI3c/JTfCsydc8Q 903XA8TiJpsXsIEFclzFgz1EQFBhJoJEQilunT4b05RtpGQbbQ+AfqLoUcXeViQG1W7n D9PigGGFjy9ZezTl+0IIinBs2SA/6EFuqVPlr3oYBPGrgPFUTSoyPPuBP6Q4fVJEgohe 9wBOgtXYkhaCGdPUUKA0AJhq8tU/HKfu+1HEn6x5tbQGKvvPzJOj7xVrlXT5KUosaX4q Ti+Q== 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=gqMsEIhJm5EqUOgNeJCrpzezZPASaD0w7LK6NRTqosc=; b=BIEX39cV2VUtJ/ltUPRqDdLgZLpQCt/6U8PU+jvR8BXeY4mPvOb/BqRyemqJ4+UxVZ pAm8hTG+gFdpX7/7lluAZMujURZH7Z0Kl74C9HqBwZ/RK4gOypYFLH2vDiuqM6CuV4rt BoKEi5Ig7aZNuBm8OKgGdtWJSiGaJZT6Z9Pluk7aLODGTFdFImRaUmOOMgCTrSLksn3g E6P1LU+UhIEz/BS9mlIKhPDzey73kH5skEo7QQZWeyL6EddfM4ukNDAQmwXEvrJqnzAu GjGxzmjNx1hDG0JA+0Bc27GZrPyzE4ABSUf2/0mTNhz7WeFelC9bqSacfyKd9VSD6ECe MtVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pzbOscr8; 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.18; Wed, 05 May 2021 14:40:18 -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=pzbOscr8; 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 S234667AbhEEVlN (ORCPT + 6 others); Wed, 5 May 2021 17:41:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233775AbhEEVk5 (ORCPT ); Wed, 5 May 2021 17:40:57 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E4B9C06135C for ; Wed, 5 May 2021 14:39:43 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id x7-20020a17090a5307b02901589d39576eso824195pjh.0 for ; Wed, 05 May 2021 14:39:43 -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=gqMsEIhJm5EqUOgNeJCrpzezZPASaD0w7LK6NRTqosc=; b=pzbOscr85X4EFeeMDqwg9QrjOk6I1RQdc7g7pzKkYlY3dH0iLlhi72s1X2XWWMpM2s QvGZNRQjdPZvog/lGq4VdeZwsy30G1ovMEGiKDjmnF3dpiEVc4VY5vkv6HYQJFCfUfTf i2bPSmolUuj9lE2IcWYgkJhuddwgjd4LvHe7l2qploh7CB3JM4FVgmVE1glQAwOS5XQq wXIuEO7FDs7Fxr281q7alYvVu70/98vHSffE3Mt3lSJZom2aMOIdBTKI+W/EJDYnSKVP +3vhZCJfnYs76p4pTF/qWbBBv+Gnqoqrb8c0v7bdxxb6M0wFGRWsHruT524pi7sgCoQC nisA== 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=gqMsEIhJm5EqUOgNeJCrpzezZPASaD0w7LK6NRTqosc=; b=lGvI27wt6r/lEyi/Xfa8iJ8fqqd11P2vX/fNyFJkTblV3adBKlWjh9/UqvU9/ouR02 29CWy3Y41O3TIXL9FF2DZPhOU64gDttOI0aXOKWJFnYNQacO6jttqjglcRqX9AnCpGGW Z4cTogfQcfsCMxT4pF0HBmEZ9dyCY4gp80Iscd844GEKwCsT71Q8PAOuq7Obhr4CIzPi jOuEoMAtH+0Fia5jFqtMw4LUqYzFcHC/FIwCJPvOLORY6laCDGZx+g9QfdQbjga1LscA iZONmR2auXCWUxB5WglRb3qrXWLAH2uR5nkx5+SYVRVhAP2kocEleKQvZ99B0FOk49Jc zk7Q== X-Gm-Message-State: AOAM533mnRBOE9msVxuUR5HbcHnTpn8gCIYl3q6nDo3UokOMJScTbKEb 3p/NJq/EViPiOJ4phfCGI5G0JA== X-Received: by 2002:a17:902:b609:b029:ec:e80d:7ebd with SMTP id b9-20020a170902b609b02900ece80d7ebdmr771721pls.75.1620250782828; Wed, 05 May 2021 14:39:42 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 May 2021 14:39:42 -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 16/17] crypto: qce: Defer probe in case interconnect is not yet initialized Date: Thu, 6 May 2021 03:07:30 +0530 Message-Id: <20210505213731.538612-17-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 On some Qualcomm parts the qce crypto driver needs the interconnect between the crypto block and main memory to be initialized first before the crypto registers can be accessed. So it makes sense to defer the qce crypto driver probing in case the interconnect driver is not yet probed. This fixes the qce probe failure issues when both qce and interconnect drivers 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.30.2 diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c index 3e742e9911fa..9915b184f780 100644 --- a/drivers/crypto/qce/core.c +++ b/drivers/crypto/qce/core.c @@ -222,6 +222,20 @@ static int qce_crypto_probe(struct platform_device *pdev) return ret; qce->mem_path = of_icc_get(qce->dev, "memory"); + + /* Check for NULL return path, which indicates + * interconnect API is disabled or the "interconnects" + * DT property is missing. + */ + if (!qce->mem_path) + /* On some qcom parts, the qce crypto block needs interconnect + * paths to be configured before the registers can be accessed. + * Check here for the same. + */ + if (!strcmp(of_id->compatible, "qcom,ipq6018-qce") || + !strcmp(of_id->compatible, "qcom,sdm845-qce")) + return -EPROBE_DEFER; + if (IS_ERR(qce->mem_path)) return PTR_ERR(qce->mem_path);