From patchwork Tue May 11 13:29:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12250967 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44FA1C433B4 for ; Tue, 11 May 2021 13:29:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19430613CD for ; Tue, 11 May 2021 13:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbhEKNao (ORCPT ); Tue, 11 May 2021 09:30:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEKNan (ORCPT ); Tue, 11 May 2021 09:30:43 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6579BC061574 for ; Tue, 11 May 2021 06:29:37 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id m11so12205570lfg.3 for ; Tue, 11 May 2021 06:29:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yoz2GWLVoP/LmN8U8yqLyJhrZcQ/cFUl8VArRwTIYzs=; b=U0mCBlAvEGT030WD7J5uzq/oKj8uV+C8GhSf/oJ6RwvJzPt588HE0g+nids5SDQzoE S+XavvYkHcCRy4Jnd9toYhETpAbuCiS6PE5KMHYhe4rUfFXURr4p5TKajWmqZ2cEskgV nL/OeJL7LK4IDaQ+11xviByB5+GZnn6iQ4rqAVveL6oViHod1XfxJo68IP62/co4+Mf5 ev49FCL2xQeWRwl17WMHIiGOjk3Ir9WCaQRM8IL03pTR6ANGxNn0ILc42CzK+GyFF3Hf 3BioGL36IQJjJo38Hvt7sd8VcLbVHFZEgdaGZh0+SmciRrR1q3A2cmuP7u+tpygTZ45J u/Vg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yoz2GWLVoP/LmN8U8yqLyJhrZcQ/cFUl8VArRwTIYzs=; b=EBZsJaiiZM419093y2DnphjDQBeuDkDrZRQpnuPfD3Bu3KixkedXEPuIfbkhCO6pDH xl8zOOrTCjDffw/F0fkGQr3bJlZzKDVygMAR8VVKe8zrOnJodsrODaEkBJHW98Y3UI20 lMBm9s50OUg0anEP2Bj2IktxoOLjAqmN4fKeAHuULwbqOyFccUXEUR9BrTMVTaeFID15 3m4TIjJyI6Sz4ahoH4mbLnjysPMtNsk9hyHKMzlBHRl3EMFhx2iW9vXXbGIgKFIwX2+t E2QVClycYSEFvSbmE8MVxTFw2sMGJp93P8aP897TOiNCgPtIqB9sVkzuHI7KFmnS9ieF GbiQ== X-Gm-Message-State: AOAM530uW0EqTHL/veJDYTy3rqJgvpMjeUahmVdVt++i2NJ0vKOnVPvh s0MCUDLdbVMkDxV9uA2QP9SLOg== X-Google-Smtp-Source: ABdhPJykr1In1BcO7q93EKLY6PvMotH1K0CewY1k7kOI81hmCjQR9oudiIRz12jtmsCRVzLR0VhDLw== X-Received: by 2002:a19:7604:: with SMTP id c4mr19610763lff.627.1620739775855; Tue, 11 May 2021 06:29:35 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m4sm3699740ljc.20.2021.05.11.06.29.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 06:29:35 -0700 (PDT) From: Linus Walleij To: Matt Mackall , Herbert Xu , Deepak Saxena Cc: linux-crypto@vger.kernel.org, Arnd Bergmann , Linus Walleij Subject: [PATCH 1/5] hw_random: ixp4xx: enable compile-testing Date: Tue, 11 May 2021 15:29:24 +0200 Message-Id: <20210511132928.814697-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Arnd Bergmann The driver is almost portable already, it just needs to include the new header for the cpu definition. Cc: Deepak Saxena Signed-off-by: Arnd Bergmann Signed-off-by: Linus Walleij Acked-by: Herbert Xu --- The idea is to apply this through the ARM SoC tree along with other IXP4xx refactorings. Please tell me if you prefer another solution. --- drivers/char/hw_random/Kconfig | 2 +- drivers/char/hw_random/ixp4xx-rng.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 1fe006f3f12f..f033a11cc90d 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig @@ -152,7 +152,7 @@ config HW_RANDOM_VIA config HW_RANDOM_IXP4XX tristate "Intel IXP4xx NPU HW Pseudo-Random Number Generator support" - depends on ARCH_IXP4XX + depends on ARCH_IXP4XX || COMPILE_TEST default HW_RANDOM help This driver provides kernel-side support for the Pseudo-Random diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c index beec1627db3c..34781028caec 100644 --- a/drivers/char/hw_random/ixp4xx-rng.c +++ b/drivers/char/hw_random/ixp4xx-rng.c @@ -21,10 +21,9 @@ #include #include #include +#include #include -#include - static int ixp4xx_rng_data_read(struct hwrng *rng, u32 *buffer) { From patchwork Tue May 11 13:29:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12250969 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35A05C433B4 for ; Tue, 11 May 2021 13:29:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 092C361288 for ; Tue, 11 May 2021 13:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231425AbhEKNaq (ORCPT ); Tue, 11 May 2021 09:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEKNaq (ORCPT ); Tue, 11 May 2021 09:30:46 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB106C061574 for ; Tue, 11 May 2021 06:29:39 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id c15so10592543ljr.7 for ; Tue, 11 May 2021 06:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BOC1UntVrV5zpNlzc6ixNauCfquIt1wUm//U5RB1WOI=; b=TM7CX+82noRx77PkMPt/YgmdCrtU3FwSChdWmTv+NUiRJRwPyRoHaTS7u+oRKQbI45 7i/hD1qQ42tyKFhX5sv55KqXRx7cV+GKOOF/GDYcBGeEXLwSE9PbO5uSJoPFYO+1xs/C E62X9YvJw7hXcDhGiCGyirNeFb1aMI9pDCpt0cYK+7CTgJOTLSVPopnE5KUyTPAoQvXm A/XtaRLD9leKaBjN+rWUx5pxYjZ6aVmW/rbU4hU1/5Gl1Q0hgp76bdPIEOt3BtXAXkjF hLgOOFBuV5kn7MT8gSU6mJIV347P2xb61AxreK2xvx52aEh+8r5Mqe1r8eC8coepL088 k1Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BOC1UntVrV5zpNlzc6ixNauCfquIt1wUm//U5RB1WOI=; b=MjNdB7pj0UEeLVqpVO4kYZ1kGG1rxCexC5J02S70o6e6fHA6p8wo4ypPruCgGtsdv+ PST9RH+pnQwQoiJTjcI1ebQ//MbK/M32KzqBBNK2Pg0SQIT3/hV76psP6urS8BXsuJoZ NVyIQVozWnO2xUSC6NTi6dXyEusI/+hJyYgoAu0qHsYDzbwRC7M7LbhiuLDjGXhCPQZV Se8Pmlacz/teFn0omwzfpwo/TzUkUE5UN57itdJ01hvrlypixVQTDGLCH+/fQRa+SsqX XqsYlFvJiY5v4vNTlWMkKhFMKzXrT/AvgzZHwMm2rdmVBvzQTPNkH1QhTIao3iEm1sYl UdPQ== X-Gm-Message-State: AOAM531njHgGVDr0KqZHI3D063l226nR2cP65rtfDhXnHjCY+ib+jf/i PH7MR6+M6H35vjrXfcmB3UoNYw== X-Google-Smtp-Source: ABdhPJyYRyB7uWwYBg2eYcXb1/pnGegSSgmXehxzKSGFoDwBt9+LZ6GaE8UVNHOZDswl6+RuaUAw2w== X-Received: by 2002:a2e:9b84:: with SMTP id z4mr2599640lji.341.1620739778309; Tue, 11 May 2021 06:29:38 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m4sm3699740ljc.20.2021.05.11.06.29.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 06:29:38 -0700 (PDT) From: Linus Walleij To: Matt Mackall , Herbert Xu , Deepak Saxena Cc: linux-crypto@vger.kernel.org, Arnd Bergmann , Linus Walleij Subject: [PATCH 2/5] hw_random: ixp4xx: Use SPDX license tag Date: Tue, 11 May 2021 15:29:25 +0200 Message-Id: <20210511132928.814697-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511132928.814697-1-linus.walleij@linaro.org> References: <20210511132928.814697-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This switches the IXP4xx hardware random driver to use the SPDX type license tag. Cc: Deepak Saxena Signed-off-by: Linus Walleij Acked-by: Herbert Xu --- The idea is to apply this through the ARM SoC tree along with other IXP4xx refactorings. Please tell me if you prefer another solution. --- drivers/char/hw_random/ixp4xx-rng.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c index 34781028caec..defd8176cb68 100644 --- a/drivers/char/hw_random/ixp4xx-rng.c +++ b/drivers/char/hw_random/ixp4xx-rng.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * drivers/char/hw_random/ixp4xx-rng.c * @@ -8,10 +9,6 @@ * Copyright 2005 (c) MontaVista Software, Inc. * * Fixes by Michael Buesch - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #include From patchwork Tue May 11 13:29:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12250971 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED6C7C433ED for ; Tue, 11 May 2021 13:29:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BAB6961288 for ; Tue, 11 May 2021 13:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231443AbhEKNaw (ORCPT ); Tue, 11 May 2021 09:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231465AbhEKNas (ORCPT ); Tue, 11 May 2021 09:30:48 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB46C061574 for ; Tue, 11 May 2021 06:29:41 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id a2so7642182lfc.9 for ; Tue, 11 May 2021 06:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0kH9GejFwRKEAZVnNqAOcSajeuUIKWFZ2mSCj9ztQJ4=; b=uAGW7Wix3B9nYc4qK57H9E8J1wBIayQBT+GL+0GNNbSPwzbK+A7EAyH1BrvQYIV/Y/ XNKH1GgPPM/Vf1yTRR39ymsNaZTcsLejdvqVW9NgZ93zgGGtTE/oPlRAPwAmiEaQtMdv whrhHzW0cVNRxx9uRfodABWVSQXNGdskS6NIQBtbbGQB7R4UAs/s62tzAb/82BUQf5Mj dLxZ/w1woEFAziK4bXbX8hkSgkN94bu6+p5inWrH1hGG+/VvE3y6OCOE2G3aTZNLEc2y Bak25Qi+Ayi+SOMgrisdmtqPNZygmR9Isa7MgrL+VDxSV7cX6aiwKT24XmrSIrYYrb3X csbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0kH9GejFwRKEAZVnNqAOcSajeuUIKWFZ2mSCj9ztQJ4=; b=V3UQs4qO32/QUqaMescWDHvRuINjhvjrxYCTLKbVKEsWqRflbwylKJ1FzBIv3vOiaW fk0vMHMwdZbn/No1xTaqIjDzZ1YkvuewnzLgI7rK+tkIM44FVJxyGHKsUhMouszjkdg/ NULmNrjBPmICL4u9SaFEIzZOOI0fLSXjTp8pzgGxX25KhCM0Y7wUoPHDnLhb9CxgK+h1 m/8GW9JL5tPehBMQW1Zlns4lXeYpuqHV06KxXhaHyPmWAK9WZUZ/5vX+ei71WMsYvs8U ZgzXaWjmUCYnuQK7INX3rbiXv+iqoLfOUq+KkTn9QnPzmgfcLqjEkZo2TMToUrf1xWOv DPUQ== X-Gm-Message-State: AOAM5332vppnC1jdONQyEbnKyDIKfLuS4NHHSkpB68hVFT8WNUzVgQlX bwAeK9Ol7qXhtIjhAOqm0jcb+A== X-Google-Smtp-Source: ABdhPJxi8rsT3KpPgclRphHVqaEsDYLBwDAOQdff1nW5XutEVmljUOL7MLlQP1d0Vgo8ry5ZHd7HhQ== X-Received: by 2002:a05:6512:358c:: with SMTP id m12mr20504720lfr.289.1620739779939; Tue, 11 May 2021 06:29:39 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m4sm3699740ljc.20.2021.05.11.06.29.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 06:29:39 -0700 (PDT) From: Linus Walleij To: Matt Mackall , Herbert Xu , Deepak Saxena Cc: linux-crypto@vger.kernel.org, Arnd Bergmann , Linus Walleij Subject: [PATCH 3/5] hw_random: ixp4xx: Turn into a module Date: Tue, 11 May 2021 15:29:26 +0200 Message-Id: <20210511132928.814697-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511132928.814697-1-linus.walleij@linaro.org> References: <20210511132928.814697-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Instead of just initializing always, which will invariably create problems on multiplatform builds, turn this driver into a module and pass a resource with the memory location. The device only exist on the IXP46x so we only register the device for the IXP46x SoC. Cc: Deepak Saxena Signed-off-by: Linus Walleij Acked-by: Herbert Xu --- The idea is to apply this through the ARM SoC tree along with other IXP4xx refactorings. Please tell me if you prefer another solution. --- arch/arm/mach-ixp4xx/common.c | 24 ++++++++++++++++++- drivers/char/hw_random/ixp4xx-rng.c | 37 +++++++++++++---------------- 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index f86c1bf34eea..a10aa14d09b1 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -237,6 +237,27 @@ static struct resource ixp46x_i2c_resources[] = { } }; +/* A single 32-bit register on IXP46x */ +#define IXP4XX_HWRANDOM_BASE_PHYS 0x70002100 + +static struct resource ixp46x_hwrandom_resource[] = { + { + .start = IXP4XX_HWRANDOM_BASE_PHYS, + .end = IXP4XX_HWRANDOM_BASE_PHYS + 0x3, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device ixp46x_hwrandom_device = { + .name = "ixp4xx-hwrandom", + .id = -1, + .dev = { + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .resource = ixp46x_hwrandom_resource, + .num_resources = ARRAY_SIZE(ixp46x_hwrandom_resource), +}; + /* * I2C controller. The IXP46x uses the same block as the IOP3xx, so * we just use the same device name. @@ -249,7 +270,8 @@ static struct platform_device ixp46x_i2c_controller = { }; static struct platform_device *ixp46x_devices[] __initdata = { - &ixp46x_i2c_controller + &ixp46x_hwrandom_device, + &ixp46x_i2c_controller, }; unsigned long ixp4xx_exp_bus_size; diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c index defd8176cb68..8b59aeefd4a4 100644 --- a/drivers/char/hw_random/ixp4xx-rng.c +++ b/drivers/char/hw_random/ixp4xx-rng.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -36,35 +37,31 @@ static struct hwrng ixp4xx_rng_ops = { .data_read = ixp4xx_rng_data_read, }; -static int __init ixp4xx_rng_init(void) +static int ixp4xx_rng_probe(struct platform_device *pdev) { void __iomem * rng_base; - int err; + struct device *dev = &pdev->dev; + struct resource *res; if (!cpu_is_ixp46x()) /* includes IXP455 */ return -ENOSYS; - rng_base = ioremap(0x70002100, 4); - if (!rng_base) - return -ENOMEM; - ixp4xx_rng_ops.priv = (unsigned long)rng_base; - err = hwrng_register(&ixp4xx_rng_ops); - if (err) - iounmap(rng_base); - - return err; -} + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + rng_base = devm_ioremap_resource(dev, res); + if (IS_ERR(rng_base)) + return PTR_ERR(rng_base); -static void __exit ixp4xx_rng_exit(void) -{ - void __iomem * rng_base = (void __iomem *)ixp4xx_rng_ops.priv; - - hwrng_unregister(&ixp4xx_rng_ops); - iounmap(rng_base); + ixp4xx_rng_ops.priv = (unsigned long)rng_base; + return devm_hwrng_register(dev, &ixp4xx_rng_ops); } -module_init(ixp4xx_rng_init); -module_exit(ixp4xx_rng_exit); +static struct platform_driver ixp4xx_rng_driver = { + .driver = { + .name = "ixp4xx-hwrandom", + }, + .probe = ixp4xx_rng_probe, +}; +module_platform_driver(ixp4xx_rng_driver); MODULE_AUTHOR("Deepak Saxena "); MODULE_DESCRIPTION("H/W Pseudo-Random Number Generator (RNG) driver for IXP45x/46x"); From patchwork Tue May 11 13:29:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12250975 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CA63C433B4 for ; Tue, 11 May 2021 13:29:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6727D613CD for ; Tue, 11 May 2021 13:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231401AbhEKNay (ORCPT ); Tue, 11 May 2021 09:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEKNaw (ORCPT ); Tue, 11 May 2021 09:30:52 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6868C06174A for ; Tue, 11 May 2021 06:29:43 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id c3so28645970lfs.7 for ; Tue, 11 May 2021 06:29:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FFYr3Xo1ppCbhfOBPELbi7/g/WpT3C+kHa8n/mlqcNc=; b=xqyvcHJ3/7tk/3+p2H6mz7mGJYVGdp6Lwz1loHB0CDVOFJlyMuVPJ0XIX7zcqu4T0M ZNcQQT4Wx5RLT59t+TY6MjUlZKGMCB/JaJcLiEJ7LxntOuWHkTo6YkGZ4l9trrZlCIV/ LzdCb1dBjuvyaVkHrzUDSEDMR31jRLi+zdfjO3ae+63VSw6Q1EJTmPU1beqjfkWf/Xhs XEq2zZib3MmsD2WjTVXgWL2Rmzus2nqmPUkmzurLX1PfKiXqipUqKkE71HP/fNrI1KMQ DyKvib95bsgPUnjaig8+UJ2bm+P7MlqqqSlLwTxJAVT+V3EdicAGqzd7r/Xf/usdh7wC Bulg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FFYr3Xo1ppCbhfOBPELbi7/g/WpT3C+kHa8n/mlqcNc=; b=UCZn10lUCwXZ+O46plQfQeuSxpqo2lC3HpcfU7nXiK5bSVB57jzjS8d8RXKc2i5TrD 4WjRfYzeHMhLgZRD8i0+OxgVOhs9kPwdPJlMMlBRPCKBoKD9mvUhYedBB9d7gWBnaGhG 5/JT9qvgyArm47io1LjWHJz3JEp5IBIMfHG3ubc/Z4mpUc83kh8MfjguS3Yuah+vAXo9 Ykd6Y/qy3tFwmEs33y3ktPewONu0M60fSK95UOc0Nv4fzpsf4VcMYc+M6lwQA0VlLiH7 2grbSufjsw9RYtTVGu3K7wCwa+SQWHkzw/B/Ggy3bT7b890HgW7WT9XpeIgUtQZza7Gt bSPQ== X-Gm-Message-State: AOAM530C1lZ65M26V7DkHH5va2BnvnF5Dlmh9LZsU0IcSgiO5KInyhOK MxlyHWH66sOHqytGgpUg6dFWlw== X-Google-Smtp-Source: ABdhPJzFq6lZIyzeqJ0O+rx0RF9ZTO8L/DRul5UAuP4Z7uMSuZCun9S0iVdArkWaQQCmOFreo+ZHzQ== X-Received: by 2002:a05:6512:3056:: with SMTP id b22mr20331716lfb.526.1620739782260; Tue, 11 May 2021 06:29:42 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m4sm3699740ljc.20.2021.05.11.06.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 06:29:42 -0700 (PDT) From: Linus Walleij To: Matt Mackall , Herbert Xu , Deepak Saxena Cc: linux-crypto@vger.kernel.org, Arnd Bergmann , Linus Walleij , devicetree@vger.kernel.org Subject: [PATCH 4/5] hw_random: ixp4xx: Add DT bindings Date: Tue, 11 May 2021 15:29:27 +0200 Message-Id: <20210511132928.814697-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511132928.814697-1-linus.walleij@linaro.org> References: <20210511132928.814697-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This adds device tree bindings for the simple random number generator found in the IXP46x SoCs. Cc: Deepak Saxena Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij Reviewed-by: Rob Herring --- The idea is to apply this through the ARM SoC tree along with other IXP4xx refactorings. Please tell me if you prefer another solution. --- .../bindings/rng/intel,ixp46x-rng.yaml | 36 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml diff --git a/Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml b/Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml new file mode 100644 index 000000000000..61963fa9347e --- /dev/null +++ b/Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rng/intel,ixp46x-rng.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Intel IXP46x RNG bindings + +description: | + The Intel IXP46x has a random number generator at a fixed physical + location in memory. Each read is guaranteed to provide a unique + 32 bit random number. + +maintainers: + - Linus Walleij + +properties: + compatible: + const: intel,ixp46x-rng + + reg: + maxItems: 1 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + rng@70002100 { + compatible = "intel,ixp46x-rng"; + reg = <0x70002100 4>; + }; + diff --git a/MAINTAINERS b/MAINTAINERS index bd7aff0c120f..cc4bb4e75f04 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9248,6 +9248,7 @@ F: include/linux/soc/ixp4xx/qmgr.h INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT M: Deepak Saxena S: Maintained +F: Documentation/devicetree/bindings/display/intel,ixp46x-rng.yaml F: drivers/char/hw_random/ixp4xx-rng.c INTEL KEEM BAY DRM DRIVER From patchwork Tue May 11 13:29:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12250973 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 318FEC433B4 for ; Tue, 11 May 2021 13:29:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F35BB61159 for ; Tue, 11 May 2021 13:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231432AbhEKNaw (ORCPT ); Tue, 11 May 2021 09:30:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbhEKNaw (ORCPT ); Tue, 11 May 2021 09:30:52 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348ADC061760 for ; Tue, 11 May 2021 06:29:45 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id y9so25118699ljn.6 for ; Tue, 11 May 2021 06:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X1K7rwa/77HQwchJ9fJE8GZcfgMpgknk71cF9VgYv1o=; b=xlDW7nnBqI5/8ogVeHOoccWHafRm5Ctg21qga+VPtpuLBc1DC9fDMT06++MoURMO0S x8jpIB4SQELDG+KXL1D1VwmN2WMSc7RpTbjWRf80bRQO55PqcfU1xFxw9AU3J7WgP2XH 1a39u8xDD9erSER3QGkNoSv4zmJh8nWb9tXsUgqz4cGoswbGKW89AhvW9hcxnNEe7j4u 6MvmgLrgbnAFFklDCDDURq0MrYxybnJastgpriYTzT/SQPE2YYIqtt1NkBROGwV30Mof Fe9fV3C9muEOkAhXZ770mBnJbeyhBY4RvDW1ssftvOdV4Y5pDLAKtSlSgIdTOlvxZhuQ 2vpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X1K7rwa/77HQwchJ9fJE8GZcfgMpgknk71cF9VgYv1o=; b=DjIoI7hUvIzX2wWuByVtkb7/BsuhVVzhStY44t4cUl5o240WnWuXOoI6Xoa+msT1KN JmlHKwyrvHe43vpnROBQWHqpISagYSbW56Dd8+LQm2XLnRTif1n3dXW8DMpAb9tfOd8T KXM/Cuvm2Z1JJ//IhzM51aKDxA/mEL/xf1l98JG+KL4hyaCofjj7chKXtD3sphXQ3iot y0YJzeLRkQjpIhhMz9AjqHXC/APVANEmvejfNFbZzLdFPydLayKFcy3RLJK7bszU14hu bWOmS6HQGSMjUQV0EakY8IOUsY+cqd2X2jJfnKldNT+X9drbREssxBlgezRFugFNWHAB o1QQ== X-Gm-Message-State: AOAM532wklYc/9+Cvxg4FdmP0adNiABQVaEjrQxrqqguXgApw7Nvkn9z QUH57MrIacRemQj+q6Gxu0b1Aw== X-Google-Smtp-Source: ABdhPJyDmnwdL16PDw0PUP1YKPwqTMJj0o0sNMewcKSf3Pt55F025LCcWVAbPYWYg7y8/AGiPq9SKw== X-Received: by 2002:a05:651c:485:: with SMTP id s5mr24967388ljc.364.1620739783661; Tue, 11 May 2021 06:29:43 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id m4sm3699740ljc.20.2021.05.11.06.29.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 May 2021 06:29:43 -0700 (PDT) From: Linus Walleij To: Matt Mackall , Herbert Xu , Deepak Saxena Cc: linux-crypto@vger.kernel.org, Arnd Bergmann , Linus Walleij Subject: [PATCH 5/5] hw_random: ixp4xx: Add OF support Date: Tue, 11 May 2021 15:29:28 +0200 Message-Id: <20210511132928.814697-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511132928.814697-1-linus.walleij@linaro.org> References: <20210511132928.814697-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This makes the hardware random number generator found in the IXP46x SoCs probe from the device tree. Cc: Deepak Saxena Signed-off-by: Linus Walleij Acked-by: Herbert Xu --- The idea is to apply this through the ARM SoC tree along with other IXP4xx refactorings. Please tell me if you prefer another solution. --- drivers/char/hw_random/ixp4xx-rng.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/char/hw_random/ixp4xx-rng.c b/drivers/char/hw_random/ixp4xx-rng.c index 8b59aeefd4a4..188854dd16a9 100644 --- a/drivers/char/hw_random/ixp4xx-rng.c +++ b/drivers/char/hw_random/ixp4xx-rng.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -55,9 +56,18 @@ static int ixp4xx_rng_probe(struct platform_device *pdev) return devm_hwrng_register(dev, &ixp4xx_rng_ops); } +static const struct of_device_id ixp4xx_rng_of_match[] = { + { + .compatible = "intel,ixp46x-rng", + }, + {}, +}; +MODULE_DEVICE_TABLE(of, ixp4xx_rng_of_match); + static struct platform_driver ixp4xx_rng_driver = { .driver = { .name = "ixp4xx-hwrandom", + .of_match_table = ixp4xx_rng_of_match, }, .probe = ixp4xx_rng_probe, };