From patchwork Thu Feb 22 14:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rui Miguel Silva X-Patchwork-Id: 129255 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp652312lja; Thu, 22 Feb 2018 06:25:00 -0800 (PST) X-Google-Smtp-Source: AH8x225negfZpOIvId7ycdYEymnGqauHGIYmleBgqAIHEia1ZTuaEt7gKTxoR9OmXDLqSyTARQln X-Received: by 2002:a17:902:aa0b:: with SMTP id be11-v6mr6703476plb.250.1519309500302; Thu, 22 Feb 2018 06:25:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519309500; cv=none; d=google.com; s=arc-20160816; b=W3Ehdc2rlQDKSGagqO8sIgxNXF35LLhuGG49ufDI58odJi2ETnngfhju2YJ3KBfz4w iH3aHX/lvXEFdcHDPiaW/hNcXJYixAz5OFxbacHxO5VcxfKnMcmMWuAZaHHL1z1Jkfp1 q9KGSgSPjKblk44dPOGO+Z/8u21SxWvD7AnEQLyVNJb/t010CMjCdZcRm/uiQWzcCqZ2 se4Lu3411MU7EiA7xn0lzmUM+vj+QvDKpkso+eF0z1PoGkMc/l8x4Au+VfwZjKb8Fc3x XfhK4dL5ZCxp3GgfAYP28DvcECbUiNe3Q10PEDHPjthBuerYQSgW11axy1TUsUhVETEb iuHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=tydO9istC+jFkQCSoj33Mu5OBZbOpP9HP177NTh2zDA=; b=y5ZjjfRVlbFWKRNBMlFXc9CccgqlhStlmbWbBXnzPDzJswBWO69rGivnqRCk6QsHUs 76DRQGVZnEKOJSLVLUwmPXS6U6KC9Clkk4lXfDVBZC9KDqUQbot48mUgi90543xoNcFu JZXJBouag/9D6q6GqACzwtI0n3h2AWDz7TRyIozt4ZkeF1rlgYa/X/2MHGa8aynD9E39 i37LfXmetXUKOumQOvDsKCd9cRg4qV6rtGr6UdERpaEJ8Dmi98Kgb7fxhOg6/zhKQ4VR kpDDsRg6X6Ty3QsaA6xpuc4ttigmsk7hFf2ciY2I8+P8lrkgYxceGe/sYWVC6g21PG+Q AFRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kSa6H4BN; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id f5si98525pgr.235.2018.02.22.06.25.00; Thu, 22 Feb 2018 06:25:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kSa6H4BN; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 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 S932778AbeBVOY6 (ORCPT + 1 other); Thu, 22 Feb 2018 09:24:58 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:41615 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932668AbeBVOXZ (ORCPT ); Thu, 22 Feb 2018 09:23:25 -0500 Received: by mail-wr0-f194.google.com with SMTP id f14so10730211wre.8 for ; Thu, 22 Feb 2018 06:23:24 -0800 (PST) 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=tydO9istC+jFkQCSoj33Mu5OBZbOpP9HP177NTh2zDA=; b=kSa6H4BNUP8HPHjXKoFWJRcn1JFJJQIeEeaM13Er0YL9kdmGMOInOQFvziv6joJA4L fdIqZ5f45cR6sRBCbEfolRlUAA2RSd48HLZSWCqKwrsdC1EiZRSOsUbESs/nMPwSHxMy VMDRRFd03BaYJN6b5TVY547QKgzC2z8yMdaIo= 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=tydO9istC+jFkQCSoj33Mu5OBZbOpP9HP177NTh2zDA=; b=SMdN998PkTM5yURCBEzor4wadyyuFAMQLN/XUdm9jIUegobr2h+N5hQrwV3T6fnoEh 9Qy/6RTebELof8KRMPOodfXRa9lVnwI5HeQRRphi6vxRrz8tr+/YfQdCL1zWaCIxsrxE sstlLEVGDFDwXKZS4r2Quoebg+z3b3LfUSGE/5bSlpL9JPzJd2oegMbltOr58AYXi9f+ C3mGW9Y6Kdxbfn2pQZSiUL4IRoIi7112tMViLVdjp+zQkt1TGiLrznemaqIKgPmvKQmv Pqgo3mJzi7LIhRrFxXVrdj7nzQpMp6iQ5/eecMz1u7XEr78cp+efWiGZmmopZ8vhsTeS oTRg== X-Gm-Message-State: APf1xPAFyM/gKGeFo7O9RNhoNfjF6ejdshZBEzwmGavkJ6SfOPBhLq16 NPRsyeYUfkFMsGHMmZzJJpmvRQ== X-Received: by 10.223.136.164 with SMTP id f33mr6476033wrf.77.1519309404244; Thu, 22 Feb 2018 06:23:24 -0800 (PST) Received: from arch-late.localdomain (a109-49-46-234.cpe.netcabo.pt. [109.49.46.234]) by smtp.gmail.com with ESMTPSA id g96sm239784wrd.73.2018.02.22.06.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 06:23:23 -0800 (PST) From: Rui Miguel Silva To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, Herbert Xu Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Ryan Harkin , Bryan O'Donoghue , Rui Miguel Silva , Fabio Estevam , Peng Fan , "David S. Miller" , Lukas Auer Subject: [PATCH v4 2/4] crypto: caam - do not use mem and emi_slow clock for imx7x Date: Thu, 22 Feb 2018 14:22:48 +0000 Message-Id: <20180222142250.31348-3-rui.silva@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180222142250.31348-1-rui.silva@linaro.org> References: <20180222142250.31348-1-rui.silva@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org I.MX7x only use two clocks for the CAAM module, so make sure we do not try to use the mem and the emi_slow clock when running in that imx7d and imx7s machine type. Cc: "Horia Geantă" Cc: Aymen Sghaier Cc: Fabio Estevam Cc: Peng Fan Cc: "David S. Miller" Cc: Lukas Auer Signed-off-by: Rui Miguel Silva --- drivers/crypto/caam/ctrl.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) -- 2.16.2 diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 361e750f9cba..e4cc636e1104 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -337,7 +337,8 @@ static int caam_remove(struct platform_device *pdev) /* shut clocks off before finalizing shutdown */ clk_disable_unprepare(ctrlpriv->caam_ipg); - clk_disable_unprepare(ctrlpriv->caam_mem); + if (ctrlpriv->caam_mem) + clk_disable_unprepare(ctrlpriv->caam_mem); clk_disable_unprepare(ctrlpriv->caam_aclk); if (ctrlpriv->caam_emi_slow) clk_disable_unprepare(ctrlpriv->caam_emi_slow); @@ -466,14 +467,17 @@ static int caam_probe(struct platform_device *pdev) } ctrlpriv->caam_ipg = clk; - clk = caam_drv_identify_clk(&pdev->dev, "mem"); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - dev_err(&pdev->dev, - "can't identify CAAM mem clk: %d\n", ret); - return ret; + if (!of_machine_is_compatible("fsl,imx7d") && + !of_machine_is_compatible("fsl,imx7s")) { + clk = caam_drv_identify_clk(&pdev->dev, "mem"); + if (IS_ERR(clk)) { + ret = PTR_ERR(clk); + dev_err(&pdev->dev, + "can't identify CAAM mem clk: %d\n", ret); + return ret; + } + ctrlpriv->caam_mem = clk; } - ctrlpriv->caam_mem = clk; clk = caam_drv_identify_clk(&pdev->dev, "aclk"); if (IS_ERR(clk)) { @@ -484,7 +488,9 @@ static int caam_probe(struct platform_device *pdev) } ctrlpriv->caam_aclk = clk; - if (!of_machine_is_compatible("fsl,imx6ul")) { + if (!of_machine_is_compatible("fsl,imx6ul") && + !of_machine_is_compatible("fsl,imx7d") && + !of_machine_is_compatible("fsl,imx7s")) { clk = caam_drv_identify_clk(&pdev->dev, "emi_slow"); if (IS_ERR(clk)) { ret = PTR_ERR(clk); @@ -501,11 +507,13 @@ static int caam_probe(struct platform_device *pdev) return ret; } - ret = clk_prepare_enable(ctrlpriv->caam_mem); - if (ret < 0) { - dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n", - ret); - goto disable_caam_ipg; + if (ctrlpriv->caam_mem) { + ret = clk_prepare_enable(ctrlpriv->caam_mem); + if (ret < 0) { + dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n", + ret); + goto disable_caam_ipg; + } } ret = clk_prepare_enable(ctrlpriv->caam_aclk); @@ -826,7 +834,8 @@ static int caam_probe(struct platform_device *pdev) disable_caam_aclk: clk_disable_unprepare(ctrlpriv->caam_aclk); disable_caam_mem: - clk_disable_unprepare(ctrlpriv->caam_mem); + if (ctrlpriv->caam_mem) + clk_disable_unprepare(ctrlpriv->caam_mem); disable_caam_ipg: clk_disable_unprepare(ctrlpriv->caam_ipg); return ret;