From patchwork Fri Jan 26 19:04:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 126010 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp548097ljd; Fri, 26 Jan 2018 11:06:12 -0800 (PST) X-Google-Smtp-Source: AH8x226j193HWHsKO4aJg6vBUgZ6YMgXCJHNq4ZrMC4bXkFCqnI7TqQJLSbM54j6wPHMBexcfX1P X-Received: by 10.98.161.16 with SMTP id b16mr20157421pff.34.1516993572372; Fri, 26 Jan 2018 11:06:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516993572; cv=none; d=google.com; s=arc-20160816; b=QTXtsPK+DtbEXFcdi1on+sjypdkdkU8t+en3yfIXPd57i4gEGerQ3VPrkNfv3oNYeu B/YudFA3Z1EHxotpTQSlx+15h6O2RreA4jkmqq8bgf3VuDong1UxQo1K8+BI7Ngyu5oi L/NUmygIzcick7YpTH982xeDMxuzCBkdYiUudIi7hBsN8Ogm4tpP6Nj+V+p06xPGH/Jy WxwVahDX51V1OYzpyVhzV26H5thxBAatXcBjv+3iTGv+TUsf91nmZgzTkKFLfi79bFXa VDWpCv+yDL9AqSrOlsImWkMTAmQiKGgFXrL0ugzuBi9uzeoEDGIVkW3RDwN+eufGFrl7 yvfA== 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=FkE46eBYH4V9rjjav76nxvHFo1Xp5vkKLwovWrTD7bM=; b=sUb/45JEsSXDb8vwS3iPISh0q4/Xgub8+9ytO1BiTYfyRvonHMJu9W3IzUic47WF3S mNTOhXhHCjzp+N7bOhgI0NS2HKTkySVzG09R1ml5Uibf7RUmDmvyvOL97g9XPgxsS5UE +npIf271MZwz3pvcIrm92SljJpaWdwhNAOpZTtpu6LD7NdRMVbwR+dYk94XyR+9A00Vg JCLGKoNYRw43Qtv/zRaOAkD73WIS+95GViol/wfZj5J1Zf5hjpHq4QP2goBv/QVTYETG dUtghTM7fAGVf6mfIk5VYz4+qFHd0ISakCIPDQzqn7i16qI068agypN9CnTWDc9PG3fn Nrkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=gYjr0s/7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j91-v6si4066892pld.448.2018.01.26.11.06.12; Fri, 26 Jan 2018 11:06:12 -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=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=gYjr0s/7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752631AbeAZTGK (ORCPT + 1 other); Fri, 26 Jan 2018 14:06:10 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:53647 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752622AbeAZTFU (ORCPT ); Fri, 26 Jan 2018 14:05:20 -0500 Received: by mail-wm0-f66.google.com with SMTP id t74so3238172wme.3 for ; Fri, 26 Jan 2018 11:05:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FkE46eBYH4V9rjjav76nxvHFo1Xp5vkKLwovWrTD7bM=; b=gYjr0s/7CgzAwuoh56On9SgnWoTwJFAQgBKiN6aTUlOa4gdJR9MAHeRTVl/uInlCJl 21BoXaVurexnBJr8JsEEKkKM2umgY7LV0A14niQE7N9KI+jsjW0NhxKhriyeOFShBdbQ GgVUsp/W9ti3t5tpu1j2uPScjQMPSGPo+I9HQQZKKcPXT6LVuInJRhx+gKKK36jTv0vh 5MB/HypRGlOoXXlKeH4GZnerx68rILDDH4zrGOdR+d5kptxAZCwr0QDFpaEuiE+z4mU0 mlNJXXk3VJTrJRuVrP6p/GYpJOqBYSNLP+LQhmORfAcObE55+ui9PzJ5AR6Euy0MixJt 5Tyg== 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=FkE46eBYH4V9rjjav76nxvHFo1Xp5vkKLwovWrTD7bM=; b=gJ4pyJf5XebpUImfZF37vyzQUtm+596/OZPbG2ya4f3owtIt8bCv3kO9q1L4T0x6yx gjeKTmeK8wV09Z/zkKUwFbemk0gonq3jad1FeKPUt+4AcLq9W1e0bkiWBQcUdRC/49iT 49jORAO984hkY40kYEHWWp3cbvsgeHs3j9MKkUD42L6iP4I1zvfRjnmePKGXeNc4iNBM 1LxnSJNdazXeSGD5YtoDK3I8Hf+rgEinvG9z3sNwAD1ZO86+pWzH7Dx8m5RU4Tx9tMIh iid5gVz9WNwBbX205rd4G6YKzw8Lzf5IPNRYyzKUVeMIO4zRCNCDvrlIuzwdqaz4q5mC kaLQ== X-Gm-Message-State: AKwxytdtm0BEUd+7IzxSu7sNqrGrDUtOCwTHQDSwsdvm61jvnMAIQeU5 zY5ue4wuekJDnxZojoelubw4LQ== X-Received: by 10.80.189.139 with SMTP id y11mr24363460edh.122.1516993518899; Fri, 26 Jan 2018 11:05:18 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm2719836edl.86.2018.01.26.11.05.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 11:05:18 -0800 (PST) From: Bryan O'Donoghue To: horia.geanta@nxp.com, aymen.sghaier@nxp.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: fabio.estevam@nxp.com, peng.fan@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue Subject: [RESEND PATCH v2 3/5] crypto: caam: do not use mem and emi_slow clock for imx7x Date: Fri, 26 Jan 2018 19:04:59 +0000 Message-Id: <1516993501-29646-4-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516993501-29646-1-git-send-email-pure.logic@nexus-software.ie> References: <1516993501-29646-1-git-send-email-pure.logic@nexus-software.ie> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Rui Miguel Silva 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. [bod: fixed minor trailing whitespace issue] Signed-off-by: Rui Miguel Silva Cc: "Horia Geantă" Cc: Aymen Sghaier Cc: Fabio Estevam Cc: Peng Fan Cc: Herbert Xu Cc: "David S. Miller" Cc: Lukas Auer Signed-off-by: Bryan O'Donoghue --- drivers/crypto/caam/ctrl.c | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 0a1e96b..1f2dd6a 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -333,7 +333,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); @@ -462,14 +463,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)) { @@ -480,7 +484,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); @@ -497,11 +503,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); @@ -823,7 +831,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;