Received: by 10.223.176.46 with SMTP id f43csp1057515wra; Fri, 26 Jan 2018 11:07:11 -0800 (PST) X-Google-Smtp-Source: AH8x2252lF+DucW6lB+5kaYRtwLimuL2XXYv/BJgIbX3qmd5u+Ijw846olo/azdl1uDl/EfxsEmq X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr15069375plg.268.1516993631288; Fri, 26 Jan 2018 11:07:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516993631; cv=none; d=google.com; s=arc-20160816; b=A9xWbj0hqpxeZkR31ZMuu2+zpmiPcvuY37x1wvcUexvZ+mogDwpJzLyeYFR1asAlA7 H9XT8wM6fqQNCu67Fo9soAIQOBFoDieY4KPK1UKc9j+USSjeHIvFigrymbshwdsxms/P Ntq6WmEWgTmMzfzhyvB0UQ+tbawHryU8SpySUadAWsdQzCQEmhiIWWzsRhh+J1E7r079 RU/gmkadQVj3wHmRJgM1x3vvdpqHpBkUNiLGV3BKX8jkeZKizEASk4u9F4gWq8hyqgwq r51Qz+DNkgl7JJRpD6WjVCgv9CtkJlcnbIaa1z7eX+toERXxGx98RxreyKZ0gTM0+8Ah RpMg== 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=WIxZdsfGmtBxl7DHA5j8YV5YaAs7zQIJRkBJNvTiL9Jg9cX77GZ+LLn7oBPxUFfnnd 572byRnuD35R3Kl7odK0kbBmHXhldPweTsSeRSElZ7Vx6rsYzl0szHUdQvXl7c2Rl0fj JD/VQ+nYZOQZpWMuupd+xmQpXWysSvdFfhsVxykX8dtFxisvP4ym7LKnkuwfvzSNREce 7lKVOgI1goxGeqS2r2pq3E8EUpleY6zEKCjrwror3vKCfXSmB1GW2pMoW/J8Khk0+2P8 vhXa2zjOHghavUTzAQcUlZ5fbCVxFlV1wXaGZTrAunZvGjkkq+EbqZ+nnFFqJ/ru1JKb g3Zg== 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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e4si3322585pgs.271.2018.01.26.11.06.56; Fri, 26 Jan 2018 11:07:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752810AbeAZTGL (ORCPT + 99 others); Fri, 26 Jan 2018 14:06:11 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51546 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752621AbeAZTFU (ORCPT ); Fri, 26 Jan 2018 14:05:20 -0500 Received: by mail-wm0-f68.google.com with SMTP id r71so3239614wmd.1 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=frqYd1pfM/bMfvUzGz20RqvaoJD1O0WWPRAnF7QTb1ex+evpsWrzHkpbBl47kU0Doj JHg/bbpScBQcGlWgrjHWfG8p+oq+X/7bZedxf60RTRyX9FGtC0aMwwlxVexjAhp82+VZ yDVq+1EQsYl31p4rxGSYebzFEUvZNa1x+heXn1ZrmHWYV6M3YdS1n2dmL90zNjsqoPQ3 Bs6Q+ln/wLU5/B4xpdCS9RQVoX8IF+KrGycYYpqY7NEb/KNJh12S9j6F6BGbp3R/iQIQ QiSdh+xiX0cs+cuGFsnVhSeAJn2RtVpkMjmAJC+t0ihHc4+DUDECZW3bo1cUEKX6q1PR M6Qw== X-Gm-Message-State: AKwxytcmgK0W2+1hcNFBkjvnMALXRC95ol7EJw6cq7qVLIXptqruOKSa o14DPtm180rQjDKF6Jx0BYILog== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.7.4