From patchwork Mon Mar 5 22:21:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 10260027 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BE8E6055D for ; Mon, 5 Mar 2018 22:21:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F049D28CD0 for ; Mon, 5 Mar 2018 22:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E45AD28CEE; Mon, 5 Mar 2018 22:21:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5189828CE5 for ; Mon, 5 Mar 2018 22:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753136AbeCEWVH (ORCPT ); Mon, 5 Mar 2018 17:21:07 -0500 Received: from mleia.com ([178.79.152.223]:49284 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753076AbeCEWVH (ORCPT ); Mon, 5 Mar 2018 17:21:07 -0500 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id D61E73F5639; Mon, 5 Mar 2018 22:21:05 +0000 (GMT) From: Vladimir Zapolskiy To: Herbert Xu , Matt Mackall , Rob Herring Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH v2 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Date: Tue, 6 Mar 2018 00:21:00 +0200 Message-Id: <20180305222100.29351-3-vz@mleia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20180305222100.29351-1-vz@mleia.com> References: <20180305222100.29351-1-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20180305_222105_896751_40BDD570 X-CRM114-Status: GOOD ( 19.12 ) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver works well on i.MX31 powered boards with device description taken from board device tree, the only change to add to the driver is the missing OF device id, the affected list of included headers and indentation in platform driver struct are beautified a little. Signed-off-by: Vladimir Zapolskiy Reviewed-by: Fabio Estevam Reviewed-by: Kim Phillips --- Changes from v1 to v2: * a kernel for iMX boards is always built with multiplatform support, thus CONFIG_OF guards were removed, thanks to Kim Phillips for review, * added "fsl,imx21-rnga" compatible to the list. drivers/char/hw_random/mxc-rnga.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index 4673622..f83bee5 100644 --- a/drivers/char/hw_random/mxc-rnga.c +++ b/drivers/char/hw_random/mxc-rnga.c @@ -16,16 +16,13 @@ * This driver is based on other RNG drivers. */ -#include -#include -#include #include -#include -#include -#include -#include #include +#include #include +#include +#include +#include /* RNGA Registers */ #define RNGA_CONTROL 0x00 @@ -197,10 +194,18 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id mxc_rnga_of_match[] = { + { .compatible = "fsl,imx21-rnga", }, + { .compatible = "fsl,imx31-rnga", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, mxc_rnga_of_match); + static struct platform_driver mxc_rnga_driver = { .driver = { - .name = "mxc_rnga", - }, + .name = "mxc_rnga", + .of_match_table = mxc_rnga_of_match, + }, .remove = __exit_p(mxc_rnga_remove), };