From patchwork Sat Apr 27 00:14:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645496 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EC10C4345F for ; Sat, 27 Apr 2024 00:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9ICsy1OUdwrV8d4HxOdOEBrWlJRtSIsNNgnEykk4shY=; b=TZVJ/A7ns2lACk h7FNBB0QKT165qsDz9j7EUz1KnJbFDVvjUhL3WRn4KCho0rgvHEemjWLyrVmsrZ4m6eTkTMBCgENx YTHAU+AQ/mzyzAtP+6c9P1vMqcRvK4fpQyLlD2vskyhfKHiNpM1p7ajRLCdOAsY5pfzT2PtQSZtxF afneG0LX3MmTMaiUP63Wry+15nRIs48iS8IhHPMuQawlHtnjli030RbBLKK9EJlwx2vKDkmyq9Vv7 1Kx2jGYlonVaOL5we/DEclEfk9ybaNN4wq+CpUxtewFs0R/bgIExWesno+P8eP5RaWj0NCQ3yzpB8 Exgh9NdxzqsuXckcXjQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViL-0000000ESNx-39qN; Sat, 27 Apr 2024 00:14:49 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViJ-0000000ESMK-08Z9 for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:48 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-34b1e35155aso2796991f8f.3 for ; Fri, 26 Apr 2024 17:14:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176884; x=1714781684; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bjCfCCeucpD7gDkmMDMuXuqpCswmNACU1GJc5lMp4Mg=; b=TKst3XzHxpDp8AvUOlRvDH5r4L0cUahWbb9YmMRileSWjxyVc7Uj9B2xyBP1a5hNth JAaNqWI70+sJ4Zt+3aYc/3ZK+np8trmu5IviqNH/DjLWSBbW9gA6Gknq97mMnJx+qNSr DllakPfsiDXH8joY11itB31dhv8Qhn+L7zQ1xmmn0rUhs/4YbQHM1eajGcv/x9me+24o DcIY/x3pPfWFdG6+zBp4NpseRmCO/gtkr5Kn8fvYGj2dy/qQczUQkitgsLSOQcTVHthI ZYjpIo3eZ58k7q0FjBSbICUZtxGTcZDHIgHnQITBbAijHAmSiP+DKCZJAUh44AJoLSNe nsiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176884; x=1714781684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bjCfCCeucpD7gDkmMDMuXuqpCswmNACU1GJc5lMp4Mg=; b=KajgFDwFkhfMFgFNJXPQpyMTFb2sRihmAJOjd5XCOA4RjuDvr1cvynG7O9isUBpdyI HRmysgqy0r9NS7a2GR3QiBuevWt9kR9Kz4fuf0Skucq+JPgRrcvL45CGvkTWzmEwhXVU 9BW3vaunwdTHt4Auyh3SRn4eZRJjRQ14pgJQGUiv3dlU5dhM4ajkg9CcQGsfKxiDwPCu 04TqZq6NKxU9GUqlyb45N05Zx//YX/7TZRwVBeESimb1K8kntX2ysUGZJEbxSHyjXnMx aITLa8bd/kk4n6vW/d3C3klhBZMY+xg5sMIPKfNQXpkXRazlPLUuJvzWsO0ZsjSlTkNU 2llw== X-Forwarded-Encrypted: i=1; AJvYcCUb5owAsb6I30WSDmP75mrWtzob5QiRJjMUquO76CD6TimflB0N8HwU9//CNIR8lcTaqpq3f2nwV1fBGJXoqdFxMmaHp4WJkHuhT42knbxnGRP4uYE= X-Gm-Message-State: AOJu0Yzh/dsKnHns5zqSsBzpSz6u/rGSn1ycaIh5HPowO/ZBgGwDfU2f FY1NtE0AVN0laCsgU54oe56//u3UNyatVeCE1hTo6Mpur7sDfbf6 X-Google-Smtp-Source: AGHT+IHbbjw4s9G62DgHBPWcgS73Ei+GWQ+p5oOBA6ZFjffoNABr4s2scObXnnCnCLYEfmbzk+pRPQ== X-Received: by 2002:adf:9dc7:0:b0:34c:924e:14d3 with SMTP id q7-20020adf9dc7000000b0034c924e14d3mr619514wre.30.1714176884662; Fri, 26 Apr 2024 17:14:44 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:44 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 1/5] crypto: atmel-i2 - add missing arg description Date: Sat, 27 Apr 2024 00:14:35 +0000 Message-Id: <20240427001439.12726-2-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240427001439.12726-1-l.rubusch@gmail.com> References: <20240427001439.12726-1-l.rubusch@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171447_092564_3F2E2E7B X-CRM114-Status: GOOD ( 10.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add missing description for argument hwrng. Signed-off-by: Lothar Rubusch --- drivers/crypto/atmel-i2c.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/atmel-i2c.h b/drivers/crypto/atmel-i2c.h index c0bd429ee..a442b47a4 100644 --- a/drivers/crypto/atmel-i2c.h +++ b/drivers/crypto/atmel-i2c.h @@ -124,6 +124,7 @@ struct atmel_ecc_driver_data { * @wake_token : wake token array of zeros * @wake_token_sz : size in bytes of the wake_token * @tfm_count : number of active crypto transformations on i2c client + * @hwrng : hold the hardware generated rng * * Reads and writes from/to the i2c client are sequential. The first byte * transmitted to the device is treated as the byte size. Any attempt to send From patchwork Sat Apr 27 00:14:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F66CC4345F for ; Sat, 27 Apr 2024 00:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4LyS2/XnTabr2ZNChGirVHOLnBOrFg/B6NiMsWTQpUo=; b=oRkYZliuev1Fdg 2fXlOnA4fF0djLLm/aWCGkhi/1HLOT5y9fzTJC/DziF7xeqr43u7CNkcaC877L2kl3/T5GO8LHcuk EVF/7CTQTf3HXyFF2w/4mlIWQ8DQycVi+hB9QI2xyAuZr3RypRZLWBBKS4kpUVp3zbwXdZ02lCXZU TQOg/88mHwRoro4p7Ixy8IBR9BwFZvMTbY/FaMtX/joUO+oYCGUAYtmBHuXauM9ZmYXptqLVq6Heu 8Bcw87g2jkXFpqR0LPetZVvLI2MSLB6NcaxjRzs5+NOvgPAWmUsxicYjjuYa7xbZ3jg2yHZgSx+2J U9aD+HryGfdMuZunw2VA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0Vie-0000000ESUl-10vG; Sat, 27 Apr 2024 00:15:08 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViJ-0000000ESMP-3mE5 for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:49 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41ba1ba55ebso6521755e9.1 for ; Fri, 26 Apr 2024 17:14:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176886; x=1714781686; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jMiseJ9oP1enUq1gn4sMf++rFxBUicZHq9TM8coF3CA=; b=CULG+q7Z/H5E9XjzE9T7CaSPMkUn/qMHTdCFLlazR6ZxAtIQ/1yBcvGad78PwHVO7F EqC2xYsdGw6VcBAq3ICU2KGBRmNsYRMryNW8sPxo2rf2yoNL5HEWDpvKRJ9Q+wc0+/ew Ng8626/rI/+oAutNXvt/3q9bb7arIU4Uc4W5vTuFfH7I3jm+BLRd84Lbc13dOqg/E6aq 6mGzdCKwp8KHSP412Q8YT5EyF4iSd5LzxouL/XJZomiEBE6kTg0AObR2fkhi5a119aMo cnnpKk1LK1xRpxTHsy/L/RG1+YL0a/scR61eel0hN9hNVGpKQEPP5YtLKi26vVSxgBnS HmqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176886; x=1714781686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jMiseJ9oP1enUq1gn4sMf++rFxBUicZHq9TM8coF3CA=; b=wX5qzjGjV5TUcLqGCjHEdnU3d8qtHmcXpHulxYTUz3C867hcesvCb35PFL3MqEGWQe gL4TqvLydIAiQTa+5qLXyiZZegllIJiHMquC09993no7T5dkYCI2SP3Adk4YWkXFURr0 j7Ipfm7IZ2CfR17oWLljSbCp/LDWvozvykMcbDAyDh0TEDyfFy7L25UUF4MtF6LHml90 7MHca5j9IYhiE+stgwy7xcvhwoTYcirv87ajmO9XOlQy4YnRQI8eUSGfg9aEVxwZPFQl mrsZu+1G2oO1oEXiSIPB6zcojDwSbbIFNY5fJ5gYedkQC8JoQBW0t6OTnVkibvWP3Tt6 0uCA== X-Forwarded-Encrypted: i=1; AJvYcCWJPxVBOT6+c0iuTYxSDQ/IIRD9MjqjHNSo6jHZSGb0fT20/LctQfFffs3VAuTEwio8btSXFwPH7Ntq4Gr8DJ4EhQQHmes6P4tEqNUaxksEVn8GPww= X-Gm-Message-State: AOJu0YzB1OeXmN+BojlLNVYm4Msg0J2PSJgRgnuD+E1wmMbjeLOfhFCi JrteU/3uvvqsgMBoMbY7E+tk3NCxf10aHR6N4S1mlijJl9730+9z X-Google-Smtp-Source: AGHT+IFXqMP90DTmfKs7CdFc3nKMGKNlZz1aY4NaG5XS/PSfcwLaoAlAm6zzYdLyVe3Zsy1ziPIjAw== X-Received: by 2002:a05:600c:1395:b0:41b:cc7d:1207 with SMTP id u21-20020a05600c139500b0041bcc7d1207mr300775wmf.19.1714176885632; Fri, 26 Apr 2024 17:14:45 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:45 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 2/5] crypto: atmel-sha204a - remove unused includes Date: Sat, 27 Apr 2024 00:14:36 +0000 Message-Id: <20240427001439.12726-3-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240427001439.12726-1-l.rubusch@gmail.com> References: <20240427001439.12726-1-l.rubusch@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171447_962686_9F3CDF86 X-CRM114-Status: UNSURE ( 7.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove unnecessarily included headers. Signed-off-by: Lothar Rubusch --- drivers/crypto/atmel-sha204a.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c index c77f482d2..5c3fef6e9 100644 --- a/drivers/crypto/atmel-sha204a.c +++ b/drivers/crypto/atmel-sha204a.c @@ -5,17 +5,8 @@ * Copyright (c) 2019 Linaro, Ltd. */ -#include -#include -#include -#include #include -#include #include -#include -#include -#include -#include #include "atmel-i2c.h" static void atmel_sha204a_rng_done(struct atmel_i2c_work_data *work_data, From patchwork Sat Apr 27 00:14:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E9140C4345F for ; Sat, 27 Apr 2024 00:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mcJT00Mtz2SrYCvmwZdA+1x6aI7KDOxsSIv36ysV2aU=; b=nM6ZrG8G1SnekT UrITeUpzwJDBD5Ur3xrf8NC3Mz/QEc0aRPpcIJzGXT/H3VFuJrH0S3nFUmoIQw5EdLm5zorVBjAxJ ydjrgNhkbgM9rK2remT7hg6hlQC9txS0fUsiVd6TNe0YPzOOyJdc5uOjpTm5Xl7bj4MKZUZ997fXd +wdnzxPHUDIpV77qxiI32lgCy7Qid41raxUlhH3OtP97gDWvjQUidy9ihabiSTiluluzDvEfaZADY cT6ecumiGGBc5iMtuVGiYqPBB0KoH2btO6vOzVt8EKm/4On1mJ6QHjsrjZWvWV0f9gdp1NwQcTFF9 Ep9eSE+2QycJMiiV84IA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0Vie-0000000ESVM-3nGU; Sat, 27 Apr 2024 00:15:08 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViK-0000000ESMr-2QaI for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:49 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-34c8592b8dbso477553f8f.3 for ; Fri, 26 Apr 2024 17:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176887; x=1714781687; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G7Wu7HX45DmWrSGYlsp775A2vFtSzeLLbSxZad1dUpk=; b=e9a7LAvQqz+tlQAuX0OW0zw/Fqf3JUUuuUlb2NcetEU0875yLzcdKoaV8F4ShKc6Rs oGVH/bRxxm2VbD1KS2EJga2Fl6bPi4uEq065SK1oV2qefI0UmGylIU0LMOeL/lpciImk ywWfgrW1XMO9eGsiQ8ES2uul9K/X3383n/Qh0rRuLEabtXJ9GViwV/aQI1v0PV8Lien5 UCHGcekUEXE/WKgfPZYsT6xFmwXBGXw3JqEXbiL27sC4ytNz86PTl/7fW6m+r8mj4JDR CSlfszuLrWFc/tY5PtX5HkpJXZ2aYHuap+tWavNAkk8SZjJnJsGVxTIgFiF5wrpXFEQb qR8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176887; x=1714781687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G7Wu7HX45DmWrSGYlsp775A2vFtSzeLLbSxZad1dUpk=; b=kTJQaMrKSO9krSVHq54ApxE5UMR3fj8l05gFOY3IEapcXiUw/OFesgp94CQTnWURJd ZAgInORWcFnI88kg0zVtOcVrQhy9jsPZhXgm4WEcZTrLDi419sf0R61iS544KRPEOfpb hTeei6XRYjaazQGgJB1j2lBlI3OCh0s1l5WKa4bir28uEhhLgr3tFjBsaagVHP3MoBjp hpJWcO2YT7H2AtJ4O29xThofVzfR72I24+okUfr6YQ9BIiNTqa64kuBq6NEWZzW/Xsdc N0QnpF1LwVRuzpgYsyll/W63s2SaMa5gka+DQbHyf8lLgX7BbD2MHb8OrLJ1RjVy0AMs MJRQ== X-Forwarded-Encrypted: i=1; AJvYcCU13wn8kgKlhrs/paMIzKTITvDoDBMp3oL/JNsKIkHexQ9aI4Zl+Mr9GAPR0qE8g66fdimSHfH19b34JeRDgX4S1ilt/G9xxeV3RhHccD31tfALjqM= X-Gm-Message-State: AOJu0YyivDaJzHZKajsG+poQMsYbJJ75DdnvuCRr1D7n/4/KSJS8Fnbl Cwi9B0iqGhdvQBh3mZjW3jimtNtAXPRQqvPH7tspUdRiV0N+DMZ+ X-Google-Smtp-Source: AGHT+IEmN7Rx+Hbvdq15lK87C/Fn2h+azhHU+pRXnbwUfTaJdKo3RMDApbhevTOVpkgD6LpNRy2LJw== X-Received: by 2002:a05:6000:18af:b0:349:f8a1:cd6a with SMTP id b15-20020a05600018af00b00349f8a1cd6amr3288311wri.16.1714176886534; Fri, 26 Apr 2024 17:14:46 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:46 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 3/5] crypto: atmel-i2c - rename read function Date: Sat, 27 Apr 2024 00:14:37 +0000 Message-Id: <20240427001439.12726-4-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240427001439.12726-1-l.rubusch@gmail.com> References: <20240427001439.12726-1-l.rubusch@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171448_638443_CB683492 X-CRM114-Status: GOOD ( 12.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Make the memory read function name more specific to the read memory zone. The Atmel SHA204 chips provide config, otp and data zone. The implemented read function in fact only reads some fields in zone config. The function renaming allows for a uniform naming scheme when reading from other memory zones. Signed-off-by: Lothar Rubusch --- drivers/crypto/atmel-i2c.c | 6 +++--- drivers/crypto/atmel-i2c.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/atmel-i2c.c b/drivers/crypto/atmel-i2c.c index 83a9093ef..a0d0d4f2a 100644 --- a/drivers/crypto/atmel-i2c.c +++ b/drivers/crypto/atmel-i2c.c @@ -51,7 +51,7 @@ static void atmel_i2c_checksum(struct atmel_i2c_cmd *cmd) *__crc16 = cpu_to_le16(bitrev16(crc16(0, data, len))); } -void atmel_i2c_init_read_cmd(struct atmel_i2c_cmd *cmd) +void atmel_i2c_init_read_config_cmd(struct atmel_i2c_cmd *cmd) { cmd->word_addr = COMMAND; cmd->opcode = OPCODE_READ; @@ -68,7 +68,7 @@ void atmel_i2c_init_read_cmd(struct atmel_i2c_cmd *cmd) cmd->msecs = MAX_EXEC_TIME_READ; cmd->rxsize = READ_RSP_SIZE; } -EXPORT_SYMBOL(atmel_i2c_init_read_cmd); +EXPORT_SYMBOL(atmel_i2c_init_read_config_cmd); void atmel_i2c_init_random_cmd(struct atmel_i2c_cmd *cmd) { @@ -301,7 +301,7 @@ static int device_sanity_check(struct i2c_client *client) if (!cmd) return -ENOMEM; - atmel_i2c_init_read_cmd(cmd); + atmel_i2c_init_read_config_cmd(cmd); ret = atmel_i2c_send_receive(client, cmd); if (ret) diff --git a/drivers/crypto/atmel-i2c.h b/drivers/crypto/atmel-i2c.h index a442b47a4..275297a82 100644 --- a/drivers/crypto/atmel-i2c.h +++ b/drivers/crypto/atmel-i2c.h @@ -178,7 +178,7 @@ void atmel_i2c_flush_queue(void); int atmel_i2c_send_receive(struct i2c_client *client, struct atmel_i2c_cmd *cmd); -void atmel_i2c_init_read_cmd(struct atmel_i2c_cmd *cmd); +void atmel_i2c_init_read_config_cmd(struct atmel_i2c_cmd *cmd); void atmel_i2c_init_random_cmd(struct atmel_i2c_cmd *cmd); void atmel_i2c_init_genkey_cmd(struct atmel_i2c_cmd *cmd, u16 keyid); int atmel_i2c_init_ecdh_cmd(struct atmel_i2c_cmd *cmd, From patchwork Sat Apr 27 00:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645498 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4F60DC04FFE for ; Sat, 27 Apr 2024 00:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5J4nfFsfTY40ioqkF8dmEL3R+051+LvZVqJxeoQ1Ev8=; b=vBUyLhQO2h9ho6 qJTgzkrjoHGZg2PP0V1YTThXig8yBAPDqa9rzWLH4xDwfMc1X987id+iQTt67TuFApBm5JODadstV dS9oQ026YDeKJteFfI8uip7XdEL06d7zmmpGCKmSfzPkPErQDvaFDLpZUru4o0/ECANCQsqBHPnFq zyOLfP8UAEb7Vo5Tb5L0UvweMjzh9SqSIQJ7wG8COi9Z6xrgOzHHPO7sRy6FsBsU+x5sY/Xy/RXJb n7A+X3qynefFtk8yc/wNscFPGn7p6gwJds0QXGbJOM19yz8hqI6zcVY3QQijxYGWA4c1XQ80zcfwJ RsGw7OeWtS+18F+Nt73Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0Vig-0000000ESWG-0K1W; Sat, 27 Apr 2024 00:15:10 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViL-0000000ESNC-243E for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:51 +0000 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-343d7ff2350so2042141f8f.0 for ; Fri, 26 Apr 2024 17:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176887; x=1714781687; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Jw+4H2dgDC16joAqwpa2WM311+mGLcZu7L4IaXQQTU=; b=IbgNcpZe2yKfMs48aIY9i6MwMCnE1mS6kwOGPfUxSFlAyh2eH1ATkijyUiOKuCvfcs xfTDXpjPVRx0NltBPlU2aMvn/A9DrlcszNekSQFFR4equ5tp/sCcXiav3SkNhYneUZNh tC7kkW7W9ctmn/GjxHVj7m6fieXlRojJfa9EgGzgCAnhwuh+KoHi5MohxyLJsgJW6NGc l1iaMbg0aoRJWuchikgVQ8g96jqj/ev1SgcbdjIXSJdCHTl7L/A4rXAlQR3Rbj3IwuGK JA91BuI2IxEqp1j+D0y7wy1ePV/LKM8Qray2kjnL03YIiXhZzzwSU4P61RUyaHWFrvdb AgMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176887; x=1714781687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Jw+4H2dgDC16joAqwpa2WM311+mGLcZu7L4IaXQQTU=; b=TLv53XYndJ7wiihEXSFYDwGYVIt7SKwZqozc/7zeCWmxYCTXaUjvMh5d1QGhOd+mdz mDg97W/FarEtmHFso8P5vQHBcHHWA0B/rNswvsibwbiwKuttQyaiC6JXN9Q+g6MzBMp6 8hFGKrzHW5cTGKxZJFkwFsydoF+tTg0uTjHvZG2hULF0+m77OlIigW5hCx+f6QIsAKK/ 8PdVtUWlBa7zjyDO7EZ0VhuCCev9YEIPCFy8YS8EUotzHu91q2j1aN+5DNNOoabkOfX5 cgByLNiWbXDv9vPSEQLs/Y0OIic5KBsL3zECZtmaSkoIDZUPeLsjdLwojU8tZdgykjVj nrQw== X-Forwarded-Encrypted: i=1; AJvYcCVeWG0ipOyh/pPO9WrtV26qUSs3HMRrlhVccbb9q2FC2+AtJx8bHhlGaqmaZ3i10t/eRjCb+uaHb4djOHCPfssK685U46X2i5wgh6bYH8N7KsX9xD8= X-Gm-Message-State: AOJu0Ywr8veenCRQcvQwEogfGQbD3iN57TyvjzRyHamaJoTAb/t/Uz9m G1bMvbr3Kn6HwO68BCmvXIjXLK53cPJZxDlu55jkID3XMslYZ7j5 X-Google-Smtp-Source: AGHT+IE4GG7POJxQQcSduYqJJ1hpchS7wYZ7oE51tH8muQezmztZSTxqiRyWaLVmbgwuMJ+4DCj1YA== X-Received: by 2002:a5d:59a4:0:b0:34c:5d7:517 with SMTP id p4-20020a5d59a4000000b0034c05d70517mr3633505wrr.18.1714176887634; Fri, 26 Apr 2024 17:14:47 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:47 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 4/5] crypto: atmel-sha204a - add reading from otp zone Date: Sat, 27 Apr 2024 00:14:38 +0000 Message-Id: <20240427001439.12726-5-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240427001439.12726-1-l.rubusch@gmail.com> References: <20240427001439.12726-1-l.rubusch@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171449_565027_6ADB2786 X-CRM114-Status: GOOD ( 17.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide a read function reading the otp zone. The otp zone can be used for storing serial numbers. The otp zone, as also data zone, are only accessible if the chip was locked before. Locking the chip is a post production customization and has to be done manually i.e. not by this driver. Without this step the chip is pretty much not usable, where putting or not putting data into the otp zone is optional. Signed-off-by: Lothar Rubusch --- drivers/crypto/atmel-i2c.c | 24 ++++++++++++++++++++++++ drivers/crypto/atmel-i2c.h | 5 +++++ drivers/crypto/atmel-sha204a.c | 23 +++++++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/drivers/crypto/atmel-i2c.c b/drivers/crypto/atmel-i2c.c index a0d0d4f2a..a895e4289 100644 --- a/drivers/crypto/atmel-i2c.c +++ b/drivers/crypto/atmel-i2c.c @@ -70,6 +70,30 @@ void atmel_i2c_init_read_config_cmd(struct atmel_i2c_cmd *cmd) } EXPORT_SYMBOL(atmel_i2c_init_read_config_cmd); +int atmel_i2c_init_read_otp_cmd(struct atmel_i2c_cmd *cmd, u16 addr) +{ + if (addr < 0 || addr > OTP_ZONE_SIZE) + return -1; + + cmd->word_addr = COMMAND; + cmd->opcode = OPCODE_READ; + /* + * Read the word from OTP zone that may contain e.g. serial + * numbers or similar if persistently pre-initialized and locked + */ + cmd->param1 = OTP_ZONE; + cmd->param2 = cpu_to_le16(addr); + cmd->count = READ_COUNT; + + atmel_i2c_checksum(cmd); + + cmd->msecs = MAX_EXEC_TIME_READ; + cmd->rxsize = READ_RSP_SIZE; + + return 0; +} +EXPORT_SYMBOL(atmel_i2c_init_read_otp_cmd); + void atmel_i2c_init_random_cmd(struct atmel_i2c_cmd *cmd) { cmd->word_addr = COMMAND; diff --git a/drivers/crypto/atmel-i2c.h b/drivers/crypto/atmel-i2c.h index 275297a82..72f04c156 100644 --- a/drivers/crypto/atmel-i2c.h +++ b/drivers/crypto/atmel-i2c.h @@ -64,6 +64,10 @@ struct atmel_i2c_cmd { /* Definitions for eeprom organization */ #define CONFIGURATION_ZONE 0 +#define OTP_ZONE 1 + +/* Definitions for eeprom zone sizes */ +#define OTP_ZONE_SIZE 64 /* Definitions for Indexes common to all commands */ #define RSP_DATA_IDX 1 /* buffer index of data in response */ @@ -179,6 +183,7 @@ void atmel_i2c_flush_queue(void); int atmel_i2c_send_receive(struct i2c_client *client, struct atmel_i2c_cmd *cmd); void atmel_i2c_init_read_config_cmd(struct atmel_i2c_cmd *cmd); +int atmel_i2c_init_read_otp_cmd(struct atmel_i2c_cmd *cmd, u16 addr); void atmel_i2c_init_random_cmd(struct atmel_i2c_cmd *cmd); void atmel_i2c_init_genkey_cmd(struct atmel_i2c_cmd *cmd, u16 keyid); int atmel_i2c_init_ecdh_cmd(struct atmel_i2c_cmd *cmd, diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c index 5c3fef6e9..81b5ea722 100644 --- a/drivers/crypto/atmel-sha204a.c +++ b/drivers/crypto/atmel-sha204a.c @@ -82,6 +82,29 @@ static int atmel_sha204a_rng_read(struct hwrng *rng, void *data, size_t max, return max; } +static int atmel_sha204a_otp_read(struct i2c_client *client, u16 addr, u8 *otp) +{ + struct atmel_i2c_cmd cmd; + int ret = -1; + + if (atmel_i2c_init_read_otp_cmd(&cmd, addr) < 0) { + dev_err(&client->dev, "failed, invalid otp address %04X\n", + addr); + return ret; + } + + ret = atmel_i2c_send_receive(client, &cmd); + + if (cmd.data[0] == 0xff) { + dev_err(&client->dev, "failed, device not ready\n"); + return -ret; + } + + memcpy(otp, cmd.data+1, 4); + + return ret; +} + static int atmel_sha204a_probe(struct i2c_client *client) { struct atmel_i2c_client_priv *i2c_priv; From patchwork Sat Apr 27 00:14:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF127C4345F for ; Sat, 27 Apr 2024 00:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xHyW2LI6/sXOZ2mKgfOc6jHwp7hOm2l2KHo1BerH7lQ=; b=RbRxpo5csHb9oN Sn/jmPYg7BSVsSt2bggzMGK6nZeS5zOF9MxoHx+Vhd+T6WJdYIzD8G1peAe1ZZO/uKuzEcQugRse9 Vyc/kpY9Euxuvlc9SDDzbikIwUD0n6ZpIXfy8mIls9gbM+cjyT2uuLBaDeJnpVpSqGLsxOngb7YPH QfZG6pa4Od6zV8MREDlgWL5zNaiTXyuCbgsjD9evO5PKoZozS+GmK/tgD/yGScVqRzF1oE0Di4bYM 0IfiYOT4hQcdj3TyZ+5F35/ra1eP520Wfuux9kz10Y2Jjc0FYtbm9qp9zG65pDDF3RBCXzEuK1XhL wpziOhK/vSmZpXjKxfOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0Vih-0000000ESXH-0aT9; Sat, 27 Apr 2024 00:15:11 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViL-0000000ESNf-3rHO for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:51 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-34665dd7744so1934460f8f.1 for ; Fri, 26 Apr 2024 17:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176888; x=1714781688; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QSzv/RCJzppzAC4C+b83eofnfT5GR7S5SL9rHV9w/O8=; b=Q33jO0Fa4F01q3O7hOapJ5de1nK71xZf/MpLQ/mSKG827+sIDo/RreNFqr7LPUKEGp /0FgYholZFDiT9efWojJZcQDw0viwnaCQe+0JexIC5/wruw+7Vg5gEFoH48KyDpk33bJ QLN+trHDV+wPD4oOiEBFMeWrnnX/h05umi5Y3pLhr+scIWtGIAce3Rc8drUDVqFGyULH /aADFaj4JKGUySChH1rZeB/pB01dq3VAnwdvcx8hlzhvpvyF+/u90/Vt+JIMk4eM7u2+ GMPKM149H54I3mLt9NZvr8fcf1gmSS1cQ4WMQgpqnUx9wRJQeaKn5NJOYOWPQ59kw7Rf vBVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176888; x=1714781688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QSzv/RCJzppzAC4C+b83eofnfT5GR7S5SL9rHV9w/O8=; b=JMz8FHjvDDOWVAbJAtVT6z195eKfsz8D7DYSpJuouKlttddLwBA9SaDfesK+HkDirn DvXPZ07aL1vGLAtJOe7+lg4IScRVTyXCCcFIUN2EJVr1Qubnz9GAVJoZhm7TetLe3byK Q3RZjGc8xMSCUjHGC4cjtUpWSxTh/7wLPXatcuNa22qegb61d7+yPpr9OwidW5cV7Ph/ V39qJ3yJLsPA9vTe4MrjWmhpJgnVO64D6a5UZUYpovspahW2slnk0U2QikytNh6G+FjS VhM5ro+2SFo746IUJXmhqjdGDvOUtDumRlkmq2XAj9xRZfUrewsGmDKQavxTB+sOW2DX rTQg== X-Forwarded-Encrypted: i=1; AJvYcCWrRxDGigQz+VJyxtIG1IYiRAi/NTlcIhmP8OtS0yGRMBKWP0ugc2oPAvB1sDkAyHqhBvPKWtYEHOUtTp+VWvUnA5YZ6DDBl5XJV9kfR4T2RW7vjkI= X-Gm-Message-State: AOJu0YzGtW7hsMXTBUbxJTrgmulS2DRUUcuzft6biDIDaUZ+DX8oPs8X a8L8jGMxSFzZIftWxrRJ1F02v8B8M/rWblu1bTUrNLs3Xe/Pa4A0 X-Google-Smtp-Source: AGHT+IEKIj9pmQpXucrDUMYp8RecMPEtyhDpIpgqsoHkis1PjldSBsCQNKMv1RrV73/RMo+znB9Xyw== X-Received: by 2002:a05:6000:c85:b0:346:a7:4acb with SMTP id dp5-20020a0560000c8500b0034600a74acbmr2729552wrb.62.1714176888692; Fri, 26 Apr 2024 17:14:48 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:48 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 5/5] crypto: atmel-sha204a - provide the otp content Date: Sat, 27 Apr 2024 00:14:39 +0000 Message-Id: <20240427001439.12726-6-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240427001439.12726-1-l.rubusch@gmail.com> References: <20240427001439.12726-1-l.rubusch@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171450_070416_16A0C6B8 X-CRM114-Status: GOOD ( 15.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Set up sysfs for the Atmel SHA204a. Provide the content of the otp zone as an attribute field on the sysfs entry. Thereby make sure that if the chip is locked, not connected or trouble with the i2c bus, the sysfs device is not set up. This is mostly already handled in atmel-i2c. Signed-off-by: Lothar Rubusch --- drivers/crypto/atmel-sha204a.c | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/crypto/atmel-sha204a.c b/drivers/crypto/atmel-sha204a.c index 81b5ea722..4a2027a60 100644 --- a/drivers/crypto/atmel-sha204a.c +++ b/drivers/crypto/atmel-sha204a.c @@ -105,6 +105,39 @@ static int atmel_sha204a_otp_read(struct i2c_client *client, u16 addr, u8 *otp) return ret; } +static ssize_t otp_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + u16 addr; + u8 otp[OTP_ZONE_SIZE]; + char *str = buf; + struct i2c_client *client = to_i2c_client(dev); + int i; + + for (addr = 0; addr < OTP_ZONE_SIZE/4; addr++) { + if (atmel_sha204a_otp_read(client, addr, otp + addr * 4) < 0) { + dev_err(dev, "failed to read otp zone\n"); + break; + } + } + + for (i = 0; i < addr*2; i++) + str += sprintf(str, "%02X", otp[i]); + str += sprintf(str, "\n"); + return str - buf; +} +static DEVICE_ATTR_RO(otp); + +static struct attribute *atmel_sha204a_attrs[] = { + &dev_attr_otp.attr, + NULL +}; + +static const struct attribute_group atmel_sha204a_groups = { + .name = "atsha204a", + .attrs = atmel_sha204a_attrs, +}; + static int atmel_sha204a_probe(struct i2c_client *client) { struct atmel_i2c_client_priv *i2c_priv; @@ -125,6 +158,16 @@ static int atmel_sha204a_probe(struct i2c_client *client) if (ret) dev_warn(&client->dev, "failed to register RNG (%d)\n", ret); + /* otp read out */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) + return -ENODEV; + + ret = sysfs_create_group(&client->dev.kobj, &atmel_sha204a_groups); + if (ret) { + dev_err(&client->dev, "failed to register sysfs entry\n"); + return ret; + } + return ret; } @@ -137,6 +180,8 @@ static void atmel_sha204a_remove(struct i2c_client *client) return; } + sysfs_remove_group(&client->dev.kobj, &atmel_sha204a_groups); + kfree((void *)i2c_priv->hwrng.priv); }