Received: by 10.223.176.46 with SMTP id f43csp925012wra; Fri, 26 Jan 2018 09:01:35 -0800 (PST) X-Google-Smtp-Source: AH8x2257vCN/RtvR6+wfCWtyLi+cotN1t2g8TLMwzVNjReMFIvsLwkZqmTCq8hQeYudDz3tpbR4b X-Received: by 10.98.218.24 with SMTP id c24mr19750455pfh.145.1516986095435; Fri, 26 Jan 2018 09:01:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516986095; cv=none; d=google.com; s=arc-20160816; b=xhrdP70IxGcr+MtqAiRDB0EDDNzJmIXC93Gx3gSj++CFu5MHxEp4TLDAyfnilZMoV2 6qICU/Be8QDcXayj6oLKlx/Y8ORomcFueCghjIRHolJOD9kHi/q+OUj/DufBZdDRci85 0ko5B3beIgQZg3f7zPKz/maidNQ2Qo0OWU6y4+suNM/duGI5Yk00mMVIu6qGETRxzSDB ZDn7an5RpFpe31N9kgeudniwm5G8ydPP/3K4/pmV1QXping0oWJebfM1WQmYuZl5rcz6 5GPTX3EY/rjplVhX3H9hT4tOn5C7bz3Nh5N2RsOzEGGGLWIrUtaa2X3XhHQW0E3qN8Ib dP4Q== 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=VNpQQqvPMItz39YZCpSz639rQTs1uM4y/sRS9v8B5V9DyU5r3pNvlKk6rP7RnUhQj3 ZfNsihqDl1D8tvRVqLVjRttxdBXwTyBzjSM17SQ6mga2KQdCZX49ODvY3Fp55tw/s//h qvZm8XGZJ7SFGMQrWVg243mrnBbQGPPNnoyvmCKldMTAqvu4lgI1iuZul+3UVwLCv7eA V+IEw1gLvLLbDq+AQ2bLynmXzQM6egkweUYBrTTRNIwr7BbrlM15A+0WGO66ugkcN1I3 ihx8I8E9N1KH/Q5tNVbZ+bJ8LVegIVhbJg0FUE5MoWUEaenNCe4HSSS2jKKGrR6lu8XF d2nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexus-software-ie.20150623.gappssmtp.com header.s=20150623 header.b=ksTe0fjd; 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 l3-v6si3411657pld.558.2018.01.26.09.01.18; Fri, 26 Jan 2018 09:01:35 -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=ksTe0fjd; 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 S1752132AbeAZRAP (ORCPT + 99 others); Fri, 26 Jan 2018 12:00:15 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34885 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbeAZRAL (ORCPT ); Fri, 26 Jan 2018 12:00:11 -0500 Received: by mail-wm0-f65.google.com with SMTP id r78so22557172wme.0 for ; Fri, 26 Jan 2018 09:00:10 -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=ksTe0fjdyt2T+ej69UQWaj6CbADlJ0GYgV9Hw2agDySTudeoKsbUUV7/4DkOORhkeg RDHcgeEVibkyZ8OrNE84UEk2Wbl41ptSA7jkoIOEDEo0LccM7LF5pGh5ZQBUx9iXoaJE cKJdp+iv9ShhPu2mviPk6OPR+Ey63TovVm9jlTcGCZtSS/WannsaauKnvbkHVyChvJKY 4lazb86WSD3EvQG3eK6UAT0Gq43KF1di6HiYaRWqOArrxBFlveWOzIMITwUTT/DqoMe9 /KPgQWYYbbsQFcwuhlO45lz4DS5o8+yaFvvFajO3jr2M4wMjzIN5zHFYCi0h/BNl5ZSN 7jBQ== 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=VRCs5qmF3mUb29B41OtDzf70IgPgFI9hbT4BMiPJUyCeFJFa8/Q/r0jqNgLfEBNFz9 Hcj76OHzT3XgHV5YKChrlDUiDXHOCcnHGaAulCYx+KSepHjT/twW6FlC6fWYJDJN5kBE yMKG4Pb/kAN5BnT7cSwfeip//tzLWqHINI4ETj58dl8tzjYj5oZEYxofS3fHlFofhrMg 7nyIbYgDODH3RYvNXqoloP/W28IgmFAN1EqpdYGtYyKnk0uw/pn3Yt7NPveCGGLt3ePD zubR3iKGqlp6R4Wxl6KEDSR+bEakXipUUjwmFs0G6I7tOOhhVqi/tahxNNc1Tzb38aGO EGYg== X-Gm-Message-State: AKwxyteX8NgTmQSmTNJPVte+JEb1YkmjeyIFFegipbdqYJGXDuP8++i2 qUNQaA6iGTv02w4jeSztaf16YQ== X-Received: by 10.80.244.23 with SMTP id r23mr34188059edm.2.1516986009667; Fri, 26 Jan 2018 09:00:09 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d21sm2733949edb.13.2018.01.26.09.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jan 2018 09:00:09 -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: [PATCH v2 3/5] crypto: caam: do not use mem and emi_slow clock for imx7x Date: Fri, 26 Jan 2018 17:00:02 +0000 Message-Id: <1516986004-25452-4-git-send-email-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516986004-25452-1-git-send-email-pure.logic@nexus-software.ie> References: <1516986004-25452-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