Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1007128imm; Thu, 5 Jul 2018 12:52:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdI0e2eKMAO9XqQqiz2iEoYYEbJhLw2ex+YFI1XZD0wEKgtxKSAwGB078QSbusfeCbhi0gp X-Received: by 2002:a62:121a:: with SMTP id a26-v6mr7822255pfj.104.1530820356164; Thu, 05 Jul 2018 12:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530820356; cv=none; d=google.com; s=arc-20160816; b=su6bkwxLMwxWnTqKJgD/KURnbFrkopWQ4q14GGIBFdcOQXxylB+7OUUeoOAlEAQj5Y pE7SlyZEVQmDdzB3gPCjzAjCNr6eoWec1KkpyQ9c5FB9EMe6xky62ip4s5/laaZ+v5yA X9faulvycJ3pCIHfZFkQFZZdcTsuJAdTeh7pnYXcTBTl4+LIPlqltNmBjajXbzYrZmPl xmqQqujgmAAGN9mpI3VG0dh3kqXySSNLR+3RbKtZ6PTrdGszvbv1WECO5AdXc1LjA9nd o0ojJP6Nu0F5Z2JdG4IkkGu4QBTGHMKiCtmkWHP74BAtpuYxTrh0l22FxdNCrTVFRpN1 jpLg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=d4B5CP0xoXyHP9vlzncui5eT43YW9k3nIkqKGpPdXNs=; b=IoYZ2fX22y/YlbHWDa9Z9363TRTn6EZGR6AnZhMrXAceYv35w5uy7DGyRBKRBrsB3W CflBZKmvFbRLRT3aSNjL5ShGtjQOPQUCXmZNOnpzTIjKc4IUnsivMa94MWigSUjSfLLp /Lo9gd5GIanbz+GNBBdNObw1VuOPJ1RDtlhVDMhrvK3z3zBwD8jG1DbmM3y5ElBNkG0a L/43+FbaKSz0XHG/7gKhiMQ16d02iqnlkwsyEYe+/MFkqmMpQ8YCycvSXoCIT/HLzNtd EjXGOrJpJHWQnCWrJg+KEWXOQdq50S6BwBeF2oUkmnl42JOnwsDX2Y4i2YnU+fYCFJ6T KkKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=IaYurk3i; dkim=pass header.i=@codeaurora.org header.s=default header.b=VsdsXCRF; 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 t128-v6si5940853pgt.598.2018.07.05.12.52.22; Thu, 05 Jul 2018 12:52:36 -0700 (PDT) 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=@codeaurora.org header.s=default header.b=IaYurk3i; dkim=pass header.i=@codeaurora.org header.s=default header.b=VsdsXCRF; 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 S1754086AbeGETvn (ORCPT + 99 others); Thu, 5 Jul 2018 15:51:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:42310 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753828AbeGETvl (ORCPT ); Thu, 5 Jul 2018 15:51:41 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 28C7B60B23; Thu, 5 Jul 2018 19:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530820301; bh=d5WReQaGX6cnN+zduXQlHGg2bXkYDYpk5y3QAgsPQYY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=IaYurk3inw0ZPOzYpezgYEz9lQSF6MxcRPWHkatVSYcPWEnfCZ7kIkG9LDs3hYcc7 DcA2+m2ifrojA+FEH3hDluGCLJ6zihYxO0jg2IjU6D3MLdaBqFXJAQLyUV+3vIO3yb dyKTQgb01zoD4fldHEvIi59bl6TZGE1LCCs4IQQo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.226.60.81] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 5E3EE60646; Thu, 5 Jul 2018 19:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530820300; bh=d5WReQaGX6cnN+zduXQlHGg2bXkYDYpk5y3QAgsPQYY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=VsdsXCRFYwjcDFARMutHImMfmI9I25WEuWpuWmlAH2RiUteqxi659GocLkw58XQrm tscuyG1pkdh+1gJwLCldnNVfUqquf7u9B217lp/uvqQS1UvrXLoaTJEcfmU6IEDvGI BvYaia8vhJ4ls5LWgIkTykHhBpNt8TdPXYgZC+6U= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5E3EE60646 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org Subject: Re: [PATCH v4 6/6] crypto: qcom: Add ACPI support To: Vinod Koul , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bjorn Andersson , Matt Mackall , Herbert Xu , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Stephen Boyd , Timur Tabi References: <20180704114427.29953-1-vkoul@kernel.org> <20180704114427.29953-7-vkoul@kernel.org> From: Jeffrey Hugo Message-ID: <9e57d7d7-cc7b-c602-0e53-620fc3370ceb@codeaurora.org> Date: Thu, 5 Jul 2018 13:51:38 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180704114427.29953-7-vkoul@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/4/2018 5:44 AM, Vinod Koul wrote: > From: Timur Tabi > > Add support for probing on ACPI systems, with ACPI HID QCOM8160. > > On ACPI systems, clocks are always enabled, the PRNG should > already be enabled, and the register region is read-only. > The driver only verifies that the hardware is already > enabled never tries to disable or configure it. > > Signed-off-by: Timur Tabi > [port to crypto API] > Signed-off-by: Vinod Koul Tested-by: Jeffrey Hugo > --- > drivers/crypto/qcom-rng.c | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > > diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c > index f1bd86acaf9d..385352e200db 100644 > --- a/drivers/crypto/qcom-rng.c > +++ b/drivers/crypto/qcom-rng.c > @@ -4,6 +4,7 @@ > // Based on msm-rng.c and downstream driver > > #include > +#include > #include > #include > #include > @@ -168,11 +169,21 @@ static int qcom_rng_probe(struct platform_device *pdev) > if (IS_ERR(rng->base)) > return PTR_ERR(rng->base); > > - rng->clk = devm_clk_get(&pdev->dev, "core"); > - if (IS_ERR(rng->clk)) > - return PTR_ERR(rng->clk); > > - rng->skip_init = (unsigned long)of_device_get_match_data(&pdev->dev); > + /* > + * ACPI systems have v2 hardware. The clocks are always enabled, > + * and we should skip init > + */ > + if (has_acpi_companion(&pdev->dev)) { > + rng->skip_init = 1; > + } else { > + rng->clk = devm_clk_get(&pdev->dev, "core"); > + if (IS_ERR(rng->clk)) > + return PTR_ERR(rng->clk); > + > + rng->skip_init = > + (unsigned long)of_device_get_match_data(&pdev->dev); > + } > > qcom_rng_dev = rng; > ret = crypto_register_rng(&qcom_rng_alg); > @@ -193,6 +204,16 @@ static int qcom_rng_remove(struct platform_device *pdev) > return 0; > } > > +#if IS_ENABLED(CONFIG_ACPI) > +static const struct acpi_device_id qcom_rng_acpi_match[] = { > + { > + .id = "QCOM8160", > + }, > + {} > +}; > +MODULE_DEVICE_TABLE(acpi, qcom_rng_acpi_match); > +#endif > + > static const struct of_device_id qcom_rng_of_match[] = { > { .compatible = "qcom,prng", .data = (void *)0}, > { .compatible = "qcom,prng-ee", .data = (void *)1}, > @@ -206,6 +227,7 @@ static struct platform_driver qcom_rng_driver = { > .driver = { > .name = KBUILD_MODNAME, > .of_match_table = of_match_ptr(qcom_rng_of_match), > + .acpi_match_table = ACPI_PTR(qcom_rng_acpi_match), > } > }; > module_platform_driver(qcom_rng_driver); > -- Jeffrey Hugo Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.