From patchwork Mon Feb 26 18:38:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 10243077 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 A9A72602A0 for ; Mon, 26 Feb 2018 18:45:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E5502A292 for ; Mon, 26 Feb 2018 18:45:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 92EFF2A294; Mon, 26 Feb 2018 18:45:57 +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 000932A292 for ; Mon, 26 Feb 2018 18:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751423AbeBZSpy (ORCPT ); Mon, 26 Feb 2018 13:45:54 -0500 Received: from mleia.com ([178.79.152.223]:60250 "EHLO mail.mleia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbeBZSpw (ORCPT ); Mon, 26 Feb 2018 13:45:52 -0500 Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 781F23F329A; Mon, 26 Feb 2018 18:38:55 +0000 (GMT) From: Vladimir Zapolskiy To: Herbert Xu , Rob Herring Cc: Arnd Bergmann , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-crypto@vger.kernel.org Subject: [PATCH 2/2] hwrng: mxc-rnga - add driver support on boards with device tree Date: Mon, 26 Feb 2018 20:38:49 +0200 Message-Id: <20180226183849.11562-3-vz@mleia.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20180226183849.11562-1-vz@mleia.com> References: <20180226183849.11562-1-vz@mleia.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20180226_183855_511068_52092442 X-CRM114-Status: GOOD ( 17.62 ) 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 platform driver struct are beautified a little. Signed-off-by: Vladimir Zapolskiy --- drivers/char/hw_random/mxc-rnga.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/char/hw_random/mxc-rnga.c b/drivers/char/hw_random/mxc-rnga.c index 4673622..b749e00 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,19 @@ static int __exit mxc_rnga_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id mxc_rnga_of_match[] = { + { .compatible = "fsl,imx31-rnga", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, mxc_rnga_of_match); +#endif + static struct platform_driver mxc_rnga_driver = { .driver = { - .name = "mxc_rnga", - }, + .name = "mxc_rnga", + .of_match_table = of_match_ptr(mxc_rnga_of_match), + }, .remove = __exit_p(mxc_rnga_remove), };