Received: by 10.223.176.5 with SMTP id f5csp729828wra; Tue, 30 Jan 2018 18:38:22 -0800 (PST) X-Google-Smtp-Source: AH8x226Nz4z4UnyTbwmd6rmSdwMAmtMYCC301Cd7FgrurnJIervrwf2hbT4EtcI+OtdIXRE4m0X8 X-Received: by 2002:a17:902:208:: with SMTP id 8-v6mr27300791plc.359.1517366302576; Tue, 30 Jan 2018 18:38:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517366302; cv=none; d=google.com; s=arc-20160816; b=t4PqGDx/EBr15zSbqh6Agz4PWwVge3XUunKgAsT+dGT1eQLno+KPhelioe3uhBoOt/ 6HqAUL6qUrsLd/o5TwNveXB4Kh0qnZo5Ix/HRfSPc+dpZKMPDhBCdCnqKoHfKN1GuTPY hIGbTrZuFdfXbualqVboL+1A2I22Q6emG6/B+8vbMLu5FAttUqHMjHH9+Ak7cWsDWGS6 n+Cnd0R4tz39YomgSRl8Vrl7qogQdz7NUavOJgcvBKOFz9SUDvIut4b/MFN7bBim2PeN ztzLxVc9MXr/EYV2eaJMHZyw/nxrLQsoKQGpo/1+OfzUJCoiMdWHOSC6DkbHytx57qD8 Rv+A== 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=PYj6y+KltzYmEqt6M029t1ZXTCVrfwvXfV2QZpCaYqI=; b=u0b93RUCm7QWALSfO57fit/wkRa77KWha8PDwejYqTTJ6SffuTL9ssFlRl5VTnFdBs O7DtqYPwECCn16JvRYBPku67oRzwx3p23X7f2p1jUsnfr5mFQ+d+R0FLTrqOVQ2Vxb1p F5IWMQrJzy4AzrgooFecdUCO0ucPqDBkOJokhNxEexF7VgkAcKaDySEmZUgyTZSFbjTQ sGsfxKYOUC4XE29YjSIV0kZOUYfSoA7BMd/kouwPA+8aSk9D/XYjN5TZCyXdFIJZrMDY 5It+RQ/1cJ1oPQZmM2z6aAbfwU2LoiBicwLFA/WDZ9xyA7T3WDDF30i5+a46XTNIzR7T YFtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=xNG4qLIJ; 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 g1-v6si869799plk.422.2018.01.30.18.38.08; Tue, 30 Jan 2018 18:38:22 -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=xNG4qLIJ; 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 S1752982AbeAaCAt (ORCPT + 99 others); Tue, 30 Jan 2018 21:00:49 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:38121 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912AbeAaCAq (ORCPT ); Tue, 30 Jan 2018 21:00:46 -0500 Received: by mail-wm0-f66.google.com with SMTP id 141so4844498wme.3 for ; Tue, 30 Jan 2018 18:00:46 -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=PYj6y+KltzYmEqt6M029t1ZXTCVrfwvXfV2QZpCaYqI=; b=xNG4qLIJq3U5W/hxMkk20MUjibAMSu9hrpyRN1VgCkt1EdZ5+OrZD+Qtk49d4JlHBZ Ao3d4XVovbwfQcN6LkEN2QkG/R5x1SG2+RDnO1zY22LnjEpZpJ9p9pobTfT+4WQPO9NX fl9ikY/ilQuIHexF0sqmcliBmfzAFGKVzdahIjndt3sweV20GDCYY4IseuIP6Uy1bunc sRmURr73tbzsfF6/d/rO1jdPNDor9qa2Zgv7zKcOfrvCJKaoCn4IDRQEzp7R8Nciy2Ii MY6rtzk6HVqG5UldGujRMc+NbAm2jolNhL0I8O2CFp8xx5u4IIbkE/y6xLeC7CJQobTr 1g+Q== 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=PYj6y+KltzYmEqt6M029t1ZXTCVrfwvXfV2QZpCaYqI=; b=e7OpZFm/UbVtwLFGw4thP//XcdRfKx4WX/fYrFh9Iw1ONSqvTMaSRzIlIzHAnTDo/S yUxM6iMdshZSxSHnz1yLs34tsrK7kLL9dA9j8BzojEGM3NzFK/sMwWk7rrERhuShtLC6 QUaSR1jZ3r0KvgJd7zOOH+Bn7w3CtUMsYB8jIBUlIEF6OIuqJGQVNqotrhkbeswaXpjh 75axkVUUw6R1yIj+yEDALqWY9bPVWjvCEQpi4h/1iRsFVoWmz1UibqbsZoc6GklOQM99 ZOutVu5t5+FBnFkh7WgnlitJINoqZCLsXBzSAo/q7f2DTviKna96sbu+B6a3xcFL2wV6 DRiA== X-Gm-Message-State: AKwxytePtXBVcdlnHHxxYGVAxG8FbkdMht584Yjynh0wq8ict2/ugIgc oEQzBuVWsjbMDug1LPVg4xAYiQ== X-Received: by 10.80.230.12 with SMTP id y12mr54696642edm.203.1517364045546; Tue, 30 Jan 2018 18:00:45 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id w26sm9030867edw.7.2018.01.30.18.00.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Jan 2018 18:00:44 -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, davem@davemloft.net, lukas.auer@aisec.fraunhofer.de, rui.silva@linaro.org, ryan.harkin@linaro.org, Bryan O'Donoghue Subject: [PATCH v3 3/5] crypto: caam: do not use mem and emi_slow clock for imx7x Date: Wed, 31 Jan 2018 02:00:38 +0000 Message-Id: <1517364040-27607-4-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517364040-27607-1-git-send-email-pure.logic@nexus-software.ie> References: <1517364040-27607-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: "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