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: 793848 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 540C5611B; Sat, 27 Apr 2024 00:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176887; cv=none; b=rpC9oOCUTDYugpdjAddUJx0ci3TqFor4Ke83N8jIxynyxFhSjwUeB9PlgT8nojZ8mw2EAHcfgpPOAFVH5djKCWWYzuGSEhco/40sB9fZfUrIqxNYCWL9vqMbVdkyc0a/s/8KssVHwdKnXZ3wJj3fZ6I7wYNuTYhR6wo7DtkGwwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176887; c=relaxed/simple; bh=NU1d+mluF9avwg/CVEuJoMhXuuG/d8undlE9kBOzvM0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rClXJBxi2Et5QaliZq+g68u6VDEaznZqX7w5qUgvpvNwMTIIMP1m+YTfM1+oSkaTwwoxwnC6ZejJOJ0wkevsxHhECCghr07vhLg+RWbcRhpDQek/4VXcEGtpwkGlGkNeqQrZEpKSG8XgmWZE4iNi6CIQ91qgizmYHxAR+FtlkaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RrumP7qu; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RrumP7qu" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-34782453ffdso2514221f8f.1; Fri, 26 Apr 2024 17:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176884; x=1714781684; darn=vger.kernel.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=RrumP7quN+heHAg2oLXoX7s90VG1E9ckrSDTSAVgg3qPGahS/V5H2SEtpSBdSjZtHb 0GH4AEAmuhbehFI37zGop6kT8OGjSf09W9P4t3e++x1TdJlky/QrxH1feKGLprG8qz+4 ocqiiNdSPpzbL7wKBncP1Ql7sMpyCzkghuLf9TuAUrV/UCAjvqKpBYk9dKhRGemweumU QM0IqF+L+P8jNafCjMztZTx2jugFC98jPdC8Icx/SlD/+R6FUhD0kpqqc0djKkCXkOCZ 8wtQgDPofu/s6kYilf7ilNvUF6viqA6A05Ul9fVzlnhTeNubIublI3re/ni2kDLheR8/ 44XA== 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=wrD4BcqYf3DN5k7TQCqYxzURJ9FYThXSPHlVdSoNppVRrGlC6N+8BjpXRj0dVfIDfP dykQPkmqPsLdpq5tb9PbLAmEAKocKLpsBddnClT0fuZOaAbxFtvu58aQxL2P6dgmU+2B aor6nUy5v1l9w8+IoxYrjwLyffWTP3AUoB5XuALI2TZNrUbCjC5agdZuLOgBJi8KrHn0 dSaNqgi7t3pTAZtjFoUKOXdWETfKlmi0ru5zqrAsXgbQiEVZ2OfnZlJY8TOMOd8cOhjP bcqQltYkYHotCg3dDeit+359sUGXswM3OCJNfZrjZEaDYGYyQrTuQ+9vXR+EYP6ZnMx3 TYKg== X-Forwarded-Encrypted: i=1; AJvYcCVVZYfMDxbraBE7xZSlAwzfkk2GV3nj5mcPtTTNSTsG7HdzQ7ybPDrShsSERGoBGgCFPMBmvwC0o9Wr6lLMLTWONUT+uM+kZQFgOO0JjHeeFAF9VW1xE5pU/keGfxYMFJlJxRtY+1dFBD83 X-Gm-Message-State: AOJu0YzrLr3pQRgx0O8SWfLYOm4ZhQrXclYAH+Y2CPJKp+ZtmdxqBJLe Z1grdrrWhvXFuQDJsNHFyxCJ9FSSha9ripkmdGklXaBetYsJEyOU 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 Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com 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> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 792747 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8604E6FC3; Sat, 27 Apr 2024 00:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176889; cv=none; b=bx8hxCp3T9F4ct4o8XvWRyqZbY2VulrfuCbTCJK9J51FkggZb9YJ7uFmd5Ejp78iSbeT4ZxcBMY8tlKmHwXqdbMarPHOAwluErziaDmjVpkYe8Mr5veWdg+/aagAEZ/MywGolT+EU2HgGIZBeHMzPG+yADhkTLmF4jakBC2In8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176889; c=relaxed/simple; bh=RB7T/ZPt8GF8humdrVunLWisepJhVBYmwEGCa0VAicc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JwtfrOUs7OON/hNNlNX0M7PhM7qKt/jgUZ3zWa49nh/m/tGV1L42IznGxKuWCCUl/ZvUuIV7+H2D0jucpHeMp6SwV9M0Xz0lNHibLmJgzEUJFvgjRncPss+Pds5CB8jYNp/fFo+Uwgq5Nq1GSc7Z6yknWhiJDJgsD9PHvqNtIzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P5xjg01s; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P5xjg01s" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-41ba1ba55ebso6521745e9.1; 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=vger.kernel.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=P5xjg01sNLKMT15vjQrujuWBol3RhVt1zdM8kpHqJrp5hb23luzNbBsMEbLQrSmdCA 1nwJNL9W1+W+6g0raPV6BMzTL0Ui8b+Gm7jjCSTl/ZKpjnf3pItN++FB7SQfx0SekxlO xrVmm7lc0iCrQYK3sMh+ft7WOizYfQVGdMERIpa2jGt7fzmFvVKcmOwOu1zdieJYdrtd 2A++rN4HXa80KFBgI3Yec2UBERVuT1W2ez690HLAlbqko6L9yYOfSS9bKkbP9zldXtQs LNrEfUKE8lNsV1NgMhVRYMzaO4F0TLknSZU/q/3uYkUnR2PvOujzmMpG0XuYyoN/H8tj +4SQ== 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=RCQb2knpaNbG25L8ThVFqaSDS49QBpFp+GkfGe0LukIzmBNykDltkHB4JqJgpumaYT ZPbGJ08dLpAED01fK7tfYcoctn5rFWVxXiztl3bc0krsCN64gPlZBVqTHy4YeIGA0pq1 t683wwGF2ezAjq8XOcgM05kWHyFJzS3J9RXgyHUmBRQN20NxHnUbMSBBOfYCJXANCKVO x9wo3eKNHTofo2l/sPx7lPz/jynZfY0jnpfkKp5CLHwFQA0HdEbfhc0AwyaWFDRAB5+Y y4NStU6QJhdexXVxpAz/9Aw0sfKs5sHgxxcAzhXJck7/EJgJ35ws8HgCj+mOPzHOuviG Un7w== X-Forwarded-Encrypted: i=1; AJvYcCXkGCsu5NtmJdqFYTu5ikWPvINhKkqezbtJkOE8VllraPUa4AjX4pajfsh8U+GYdN1LDRcn7RqfjjIpexN/UPSAypBSB2m2o7XE3dSNY/CfVl5RJpLdkuYFFHE8JesYMs58hieu0wLGnzTd X-Gm-Message-State: AOJu0YxE4Pr9FeKwsZtp16xv/7LBrxc18L9Xragd69tAzJrmQjq2NWL8 dU7Q5oZLlheVD9uUu6glPt/IbaP1MRGixxLKLAk4Cn8cmR/rCNz4 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 Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com 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> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 793847 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B3F68C11; Sat, 27 Apr 2024 00:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176889; cv=none; b=Y5ezbEOm9OmWm951AculN7MSDRVJJoUUlGP+o8GdVp1QTlKX6otDTVhMq6oVkJ0pNqj43oBy9jZF9W4yb4W1Yq0pDZB3+nVGtONKvYaX8r68uDAI+o0Y+Vk2b0dHbAm7O267w3DKW7Ei4VTO8qTPhIqqEHwp408IN4eiNZkudAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176889; c=relaxed/simple; bh=7dkhjZYA2lOL4VQ95Odht1Oz9K64fNVSbaPiDgL9WZY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lExeN/vprzHNO9Jm+WF+JZI9buXNvAi+vFLk/IrXJCEQjj/SYA5nBogUz9hrRC+kbs0pzlEMIdVjGBE5Oa0nXeLD0waBXsQvQls8Y1fhsAU8pgzuLcV3z0exsdzX1Ak7ndbHfiMPnch+CNJKK+ppTj5G2aZuVT95H0Fj+G3yRFc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ex0XjpGU; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ex0XjpGU" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-343d2b20c4bso1934778f8f.2; 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=vger.kernel.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=Ex0XjpGU4cO/RoUbDbUMsNUwbWu0sygqSmjAOn3jKQo1v8nCOR3Zj8EjRbM2Peq11E dal0HP8ryQ0i05lsA08ZS6o2+ZTW7k+k6lm5w7MzTg+lQAB7LfureuuS3mDV7yeXtC6m hwgmkPKWR5xha4hPJBx4ZTubbtW11PXddAtVgedbRkGgryTMNCx29WvFxFU75VtzwmXp 2lsxaZTMSChT6yNWHoDiU3U/RIyPOhcLx2YS1LyVZRQmLu3qako7WPYus41suRqknAVa uE/iJFuVaa1qNpPNAXflTgasVLe3/tkO63UZyx9bNd/lvxuErB0l1GKzIAeHBdDovWrn m5cg== 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=w9HIBMciDDSHSssgrn1UB1U7+ceATH6uJPo1xV08PdM4GHMscImOHkmLaEBEQXRcdG pd5IfUd9awmgM2bXqZ7W5dousDAobOvLkkl2UquqQp8ZaYuQQ14c9MHKAOPfAq/exy6+ krGN3bSoOxYIt7ig1zYCTojPonsopIfIgU/Z6OjaPalFinkd4VevzHQ7zC0G+NC/x3KX pTYB1+XH7gn2osm9iiQCaXqpuOW+kdbShPtDp2Z3nfej3/AJgthB+7k1CGcCj5KI+BnE fjMvhp4ECfdwXtHgigWGmMIQIswkefOMVkw+h2fh66C1uzFejRNhPBwzE1UWR1ppuamq x4Pg== X-Forwarded-Encrypted: i=1; AJvYcCW91SBtJJSpcDv+wCMrFiQgzgv5bX5hyB+fSeaP1MZ+pTJv/jndj+mGnWsCEtKRwF9ePG88QnhTdj42GG4Eoccm/CbArgyu9GldvOTdMdinkszoAMfZQ5lVQLOH7smtvQgHiD5upcfF6twX X-Gm-Message-State: AOJu0YzixTBBLFJp7g2XApuffkbkVsrguKSJRZf08h8yh7abF8Laf+qD atlXLS7BQij9X90Kxx7OHkyT0QnbiCDK9t8O2CzpL60NkD2lgXC6 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 Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com 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> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 792746 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DFA0E566; Sat, 27 Apr 2024 00:14:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176890; cv=none; b=dErcBMURrTtVgjVS93isT+2scno+UDbpI68faggYmB+SIwbwRyZT63cM8kHqE7SfZsofKwmQNdHAU1/+6VcAx0BI04irk4HZgK1f8r8y4p5Yqk5w3I19pJAf2mZB+S0QJMM5UA/yfeKwYU5yxNcBdCCJvJrfBEd5Qy0GeLeku1w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176890; c=relaxed/simple; bh=5Z3YDU23nPaRHuZlW6BpIbTIdFXBjUqo4Zxal5ZJMJs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Sey10xDj5GhS6h43qSXpFwdPq9gEImOTurZxzEqcxpOmLd1BxDDybsqQSuwkppAJ+KGqJFed2dcF7hJ/RHKEYp8DYBEFbyrwHtd/6Z3LroLLd/oP51IJRs1TcMCyGhTpOT/4svgWdFXgZ3o3J3vqVkKo2NZ1/yIVr8Qxz8l5amo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=f2ObT6pZ; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="f2ObT6pZ" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-34c8592b8dbso477561f8f.3; 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=vger.kernel.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=f2ObT6pZmNy2oynRWdLz9EBrGYwuvrihnUqbwrhXacvz5x/hiAmEpM750nOkV1lePq O+wkePMoDD46fmziEQsEjkRUe+Jt6PdDLsvuc7bwZQbleIPybjrmBaXKTS4ROfWywPW+ O6/AqygLkLeUMo1uy5bZxmjPDKqfFMzMDZCqxnfTRbgKpN4d2yIc6JJa+sl6Yhi9Tag4 p70Bod8gy2r+/m3F7CXvxpQyq7tKJP+shSNyaviDn5fBoJw6kCX+oeev0qNlujd6/6bu vB2E8Va7Y0Fx2kUc59f4ONdrZuBlZnM9Q2wpigvoW4zt5lOirNAMiaDOaYPECPs9G9Ki RTEw== 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=H51FXRZVfRJ0b/SlH6ngM2A2BzR5iK0eSfSbkafL9lreGaH4KL+zeY1x1tOBR5OPPn 6l0MJvRl3kyqO/VBYSkRtMDqFIRhlAoqaQlsb3G7tmyYB0ydREjJq2NV5R3ufUo3uPX3 nmX6m4qY+0AR2UvMMUQ+QZfZ2if16BFyjbVmSmmB5lLC8zCiRhAM0Y6tkuT7zSZH7gkS i2mEsjRb6BMZFd2ykPcZ/ZJ3+WCmgr5OFSVlf870GO9Gq7WXO/p7DtAa5a8iT3rmIgWd 45me1RA8xcwdv8CtC495xk3rkcVyE0fwHz189H7aJc06/g+hpcBE1smM2p5i2rF8mgYX x8Zw== X-Forwarded-Encrypted: i=1; AJvYcCUV0Ex7/Bv481Rj9TOopRNobm5AqRykIP5YimBMJuyKtDpnAUx+RJd5ig7tcVw5i9ZJ0PKiSjHXZAuH3iJSdGi8QPcsOVkjDjdzo7wie9mIisieIx/fsK8PSqsx8kGz6iHhIKXkpSfmrPNP X-Gm-Message-State: AOJu0YxMYD4ZUMANvVQej+VrZuXitEBWiTsMuyw/vy1vjnk5f7W37rPK iDFoOXX4GlQJOtHRGjzrkOJKpGQYYylSm+k91EUKDoYPLOCWIU7c 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 Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com 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> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: 793846 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BB7C2209B; Sat, 27 Apr 2024 00:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176891; cv=none; b=BMlhYqGQvuGwfqBN9e+JGbJwZwHb3SGMR1K9Xu4FuXY15XqV4IamBoYzQenf4plnCkMwVEycXZBEtuybqq7ifBumxiizOGS4h1EZ6dg5gVFK7VcgOx1V9yJJi2MhkpTfT83uERznzuwfoeOZfVyEjVzPWbazTfwR6ntuRJErdk8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714176891; c=relaxed/simple; bh=JdzNbIvVqD/QrFrLzFnmNm9W8IVuhY0tE9Bmz1oYMNs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YK2CrzXDoQyH+jn3sPDyZAGxpvHc8nC8v/9sobCiGqOf0dFbQg5C2Bi1s0j4s8Qj4unM/1lQGpjDsbssn7Vz4KizmSXXg4RWU9ra0Z1Ngsdp/G7KH58VcMQX1/GltHrhtJPtKUFVEGXyBxM1A99z483s995s0rd6Nt/Crk08lFA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RHr9c1uO; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RHr9c1uO" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-34665dd7744so1934461f8f.1; 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=vger.kernel.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=RHr9c1uOr6lv8bC8gUUPTvV/17kTt0++mP5s4Vm3XQLpEGgt5JFsZ4ehMK/0cWl8yz 27auZZmHHH9arCYflrGo5L4YLXuMGlvNqM07G2drW88IU3XvSOhVygOJo1Y/eTAnoSoA ahL+Y14EPiR5Ue2ILf7R4derw7iIHryq1FlmZUE0RgtDGj9yk04/GO2d2TCqIoKxLl6e LUT9UJxSHibzldcFBfyuaSHp9W0hU9bueX1keFgVUTFE/fmYY8cDT8eYHyePQ2xTRqZT dZeW9Jq02ALlTHWUx2Ik+VQPudd0DK5COrfFQCtYh+k4vl6X5S736aBxB3dSLkyQtb1N zesg== 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=Yi8KkCG/ZYEUP/PNqyXmNPiOWk/OpcWjP7vz83iGUAqxWugwTMSJz2hGnkd0OuPjzy jjXmlV+Cvafa42sL6dAnTG1wuj4K4cwaI+JZ6081IVpneaIzag6D4HS0LwB7uhK24smF nS2EATcb3fezQRVU+/ZvMBtXnN1oWIjO4hTDm2tAQeaZvU5k3rMlHZnwuUuigTqmRtDj 9MOQ6lJtLzy+sO1vitZY4EcnBRvzlVHTy00Jazz5HafdF9ryf0RZwn4o5mnl4G56KLxv GlHjZONDUZYmWLxaHZ91i102Pj5ISStRcTAcS5VmwptpkrujyhKi9uYXCYgRV4NFTDIG LUQQ== X-Forwarded-Encrypted: i=1; AJvYcCUPdGkhG/x6V+y/CgRPLKP8hkCqTHp/FfifCiHZBn7Kjq51zZ6HNtlAHRKp5Pd55EQfpWe5LttHhEcLwlCB0BHRBkc7/9lzl2fTwI67ClbMn6yFJhSUBRlYMbEWrKEIvvW99jR312goQZCq X-Gm-Message-State: AOJu0YxL/fYo2mrm+FcBPBSzIVWlxfE+pBWQng6YmH1sIeppOgs9Kjmi wEgl21MBIUX3iKrOJK8CbVGcRR9oEHOVY0l8J/W/tyafhiRtbkFK 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 Cc: nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com 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> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); }