Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1384258imm; Tue, 3 Jul 2018 10:09:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJu1ev/JlUjHTFu3SnAmbaTnvVddAPuSGGn2EuXlvZoK2Zcai6T4zV06t9YA6EWeNcJ+iPj X-Received: by 2002:a65:4e09:: with SMTP id r9-v6mr25841070pgt.369.1530637762677; Tue, 03 Jul 2018 10:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530637762; cv=none; d=google.com; s=arc-20160816; b=qG7QebDqP3Pc4A07np6gKJrHmvsCBOMopKTdf0s73sUKIJRGcFxCFfIOXbss1VvCM0 l3ATkasOMY/FmvBxUJKYFfcUzanqxb1PKqCm9ikJPgoNl7sbOdMD/v9vAkHHeN9p+IlK wuy10JwkN76f1hq98syTQ1qFmkS9a5ZOsOR5FIldzNdYmoWO4Io35v2ocjJXpHGZciI1 nLPutrgGW+en3OHN3CF2dzHrwVwAk45Q3ebjhLFYneBEhmMK+AKbaSuNPkY3Ascp9zsH 0h9v3aaGz6VZpJFxNbbapZZ6azQd14xS+dAi5CbMsL4DK1Fq7Fia36pw2g69wvMg2fxE 5I6g== 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=rxhdprVHaptBgSZ1lJvzYtmCeBE4UHRv//vS877iye4=; b=1JzeNQuDzf51h03UKVQtYd68ZTvctFidSveURzSMU+F6QhNDsPAYJzdlD+k1N/pU+D flHQEs20dsfs8IWa6S94IwOpWRVUfv2LjnY3J9rmTeuopm4g3y9nXb8poCpjk/KvnT8q mmuWN9yxefU9aJkp9cAegKgQPMTucZKljm/K+cF5OqYtg1PVxDjInFDuDmxyJkYVgJ7N XybaxkCFLme+msAHK3CjRQLvqAtNSRnliu6d3huUQU1/B7CG6T3NNCaThJLZExzSHp1Z vxszlyy3Kp43po2wZAVOSHKDYxysNAnBdrc1sADzXA1Au3dX4NWcIvHJc/bLnQkPnIkm AV7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fwO8SKyC; dkim=pass header.i=@codeaurora.org header.s=default header.b="LQQ2/p8b"; 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 j12-v6si1310187pgq.312.2018.07.03.10.09.08; Tue, 03 Jul 2018 10:09:22 -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=fwO8SKyC; dkim=pass header.i=@codeaurora.org header.s=default header.b="LQQ2/p8b"; 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 S1753603AbeGCRIc (ORCPT + 99 others); Tue, 3 Jul 2018 13:08:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38702 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934265AbeGCRIQ (ORCPT ); Tue, 3 Jul 2018 13:08:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CF43D60B19; Tue, 3 Jul 2018 17:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530637695; bh=b3vkaI8wRThjfzMgfdxep1qnl8oPVIFCx7UW8y1PD0E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fwO8SKyCQEEaBtd6P8GIGC0xcY8qA98XtinHKb7/yB9bZq3LpDfekozFtNenGDwev yd1zrb2weDtA38v+ZRmEy2KCmTW8hLY8JG5qsaRJW3FOSxyC4EBRn8/cQGRCxdFhHX QZA0J+QgHjdY2ZsOZDigaymVaiDLULQDCTj6HOz0= 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 9AE4560290; Tue, 3 Jul 2018 17:08:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530637694; bh=b3vkaI8wRThjfzMgfdxep1qnl8oPVIFCx7UW8y1PD0E=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=LQQ2/p8b0cX3wRtSSWdD/WJjbfg+d5xi37j/ZVnvckp5vtSzWegPfTi9qt6o8FKSf oicYzxrVKJ5L7cCpq6kVSiiMgurHGq6EGLxNbcaRIJ8+wH7Cdzdgm+c3gH6XaH8k4F 4kiupxKL2WasP+rOeW2tXm5d40ExjsS/t2oAzYss= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9AE4560290 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 v3 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: <20180703060434.19293-1-vkoul@kernel.org> <20180703060434.19293-7-vkoul@kernel.org> From: Jeffrey Hugo Message-ID: <28000d33-5321-76af-7985-94a564a75336@codeaurora.org> Date: Tue, 3 Jul 2018 11:08:10 -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: <20180703060434.19293-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/3/2018 12:04 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 > --- > drivers/crypto/qcom-rng.c | 37 +++++++++++++++++++++++++++++++++---- > 1 file changed, 33 insertions(+), 4 deletions(-) > > diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c > index fdbbcac7bcb8..bc0131d130d6 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 > @@ -154,6 +155,7 @@ static int qcom_rng_probe(struct platform_device *pdev) > { > struct resource *res; > struct qcom_rng *rng; > + u32 val; > int ret; > > rng = devm_kzalloc(&pdev->dev, sizeof(*rng), GFP_KERNEL); > @@ -168,11 +170,27 @@ 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, > + * the PRNG register space is read-only and the PRNG should > + * already be enabled. > + */ > + if (has_acpi_companion(&pdev->dev)) { > + val = readl(rng->base + PRNG_CONFIG); > + if (!(val & PRNG_CONFIG_HW_ENABLE)) { > + dev_err(&pdev->dev, "device is not enabled\n"); > + return -ENODEV; > + } > + 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 +211,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, msm_rng_acpi_match); qcom_rng_acpi_match? Looks like a copy/paste issue. This causes a build failure for me. I'm trying to see if it works otherwise... > +#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 +234,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.