From patchwork Mon Mar 19 06:19:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengzhou Liu X-Patchwork-Id: 147471 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id C6482B705F for ; Mon, 19 Mar 2012 17:46:46 +1100 (EST) Received: from am1outboundpool.messaging.microsoft.com (am1ehsobe002.messaging.microsoft.com [213.199.154.205]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "Microsoft Secure Server Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 15542B6FC5 for ; Mon, 19 Mar 2012 17:45:37 +1100 (EST) Received: from mail110-am1-R.bigfish.com (10.3.201.227) by AM1EHSOBE002.bigfish.com (10.3.204.22) with Microsoft SMTP Server id 14.1.225.23; Mon, 19 Mar 2012 06:45:23 +0000 Received: from mail110-am1 (localhost [127.0.0.1]) by mail110-am1-R.bigfish.com (Postfix) with ESMTP id CDA552200DC; Mon, 19 Mar 2012 06:45:22 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail110-am1 (localhost.localdomain [127.0.0.1]) by mail110-am1 (MessageSwitch) id 1332139520827239_25609; Mon, 19 Mar 2012 06:45:20 +0000 (UTC) Received: from AM1EHSMHS016.bigfish.com (unknown [10.3.201.241]) by mail110-am1.bigfish.com (Postfix) with ESMTP id BBC1F300045; Mon, 19 Mar 2012 06:45:20 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by AM1EHSMHS016.bigfish.com (10.3.207.154) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 19 Mar 2012 06:45:20 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.1.355.3; Mon, 19 Mar 2012 01:45:22 -0500 Received: from localhost.localdomain (tank.ap.freescale.net [10.193.20.104]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id q2J6jIhH005028; Sun, 18 Mar 2012 23:45:20 -0700 From: Shengzhou Liu To: , Subject: [PATCH] powerpc/crypto: caam - add backward compatible string sec4.0 Date: Mon, 19 Mar 2012 14:19:33 +0800 Message-ID: <1332137973-32660-1-git-send-email-Shengzhou.Liu@freescale.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: Shengzhou Liu X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org In some device trees of previous version, there were string "fsl,sec4.0". To be backward compatible with device trees, we have CAAM driver first check "fsl,sec-v4.0", if it fails, then check for "fsl,sec4.0". Signed-off-by: Shengzhou Liu --- drivers/crypto/caam/caamalg.c | 14 ++++++++++---- drivers/crypto/caam/ctrl.c | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index e73cf2e..d10d00b 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -2152,8 +2152,11 @@ static void __exit caam_algapi_exit(void) int i, err; dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); - if (!dev_node) - return; + if (!dev_node) { + dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); + if (!dev_node) + return; + } pdev = of_find_device_by_node(dev_node); if (!pdev) @@ -2234,8 +2237,11 @@ static int __init caam_algapi_init(void) int i = 0, err = 0; dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); - if (!dev_node) - return -ENODEV; + if (!dev_node) { + dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); + if (!dev_node) + return -ENODEV; + } pdev = of_find_device_by_node(dev_node); if (!pdev) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 8ae3ba2..f078fa0 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -98,6 +98,12 @@ static int caam_probe(struct platform_device *pdev) rspec = 0; for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") rspec++; + if (!rspec) { + /* for backward compatible with device trees */ + for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") + rspec++; + } + ctrlpriv->jrdev = kzalloc(sizeof(struct device *) * rspec, GFP_KERNEL); if (ctrlpriv->jrdev == NULL) { iounmap(&topregs->ctrl); @@ -111,6 +117,13 @@ static int caam_probe(struct platform_device *pdev) ctrlpriv->total_jobrs++; ring++; } + if (!ring) { + for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") { + caam_jr_probe(pdev, np, ring); + ctrlpriv->total_jobrs++; + ring++; + } + } /* Check to see if QI present. If so, enable */ ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) & @@ -226,6 +239,9 @@ static struct of_device_id caam_match[] = { { .compatible = "fsl,sec-v4.0", }, + { + .compatible = "fsl,sec4.0", + }, {}, }; MODULE_DEVICE_TABLE(of, caam_match);