From patchwork Thu Jun 28 13:07:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 140441 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2165740ljj; Thu, 28 Jun 2018 06:07:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzeT7gPKQgluSicLF8X/T1SzgpxEFPiExFQF9n1RZzwxWqA8960k/29HEJcUXzXmSo9cV1 X-Received: by 2002:a17:902:ab8e:: with SMTP id f14-v6mr10628859plr.5.1530191267513; Thu, 28 Jun 2018 06:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530191267; cv=none; d=google.com; s=arc-20160816; b=XaEJp3IF85Hr2uAKtzPQ6mTviBMoMpzP/h0gagJQTqNr1E00H8VR4gSJVeyPEorGnI 2O5Cu8/KWx6aJbVbfTYKV1ze3mAwAkilKx6eQZy1PQPrYjy3cOLTSl9G2FVHdkAa2lB/ 5Dq4KeFjSBMvBY5Rw3UWg3Uwb9i9a3qXNxXSdLw1lLPxJZ1iGVLacILhsmuw6UTuNJ79 S8kakuJNjExsOG1B8ZjxbccOhKkvtPSY6avVvNXX2Ko4WysQRdJ7ApKcE05puVbpClgV lgWE1w8uLRprMjU5nLKakJ3caghoTx3JUvYnbV5lWszZS+JAj0htUVJDVQlbhY6XCEMz x5Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=AgxcxdlfOQPaVfkFXmBs8u5Ntq7lvuhH8awgjSkSh0I=; b=gdfZHg7QlTt2VtZLkEWru/gGVB/hHYHUE+d+FkyjdvVg9072Bk0Ra7IgQO4OPt6PpH 2AEv23XhWlvkR3PcJxybsuBN6Eez4Whz9ma0vW1z+NwM0XDVt06DMU8LZ/HntW4LG3PO 9yzJFbnb7y+Jz9+vU7m8U1KcJoFasNod6z3C4hdXThiLZLfC0vt3Bs7xJvdTwYGa1i/H wL/EbaWk8BBlEFcAbKxqg818Zo7xwN4/I4XjNCAtsHoDypp+Cankt9wby1jVUKRUCEyw /xUQfxoEqSSg9OCL7ZtGixMBTo58htwvF78GNRdRoGXnKTZTvq8oc0xTKRe1XzdrpbKw 6EYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M0um8YLI; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si6556676plo.206.2018.06.28.06.07.47; Thu, 28 Jun 2018 06:07:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M0um8YLI; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965496AbeF1NHp (ORCPT + 1 other); Thu, 28 Jun 2018 09:07:45 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:42201 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965245AbeF1NHn (ORCPT ); Thu, 28 Jun 2018 09:07:43 -0400 Received: by mail-lj1-f194.google.com with SMTP id k20-v6so4451233ljk.9 for ; Thu, 28 Jun 2018 06:07:42 -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; bh=AgxcxdlfOQPaVfkFXmBs8u5Ntq7lvuhH8awgjSkSh0I=; b=M0um8YLILfxdSY7413gX7TpEVvdJXNu47oWv4zDqYZAzOKSeYm4gp8dmIVOVchD56n A8jboNSZZu2QNPVQNYFllBnpALqvovw3Jv6+w4EYDYDMmzQtDSyO12QZaQhOHIUkf7Ii LfQDX0ux0gJYLg75a1nnc0VFJUblGzChf31cU= 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; bh=AgxcxdlfOQPaVfkFXmBs8u5Ntq7lvuhH8awgjSkSh0I=; b=gAoksyZIwFyTBrRLEI/8eckcD9X0tT6vzhZ+xfGGNW+1mM7wd6nmGuA3xdet3tjT6W cS6op4c6KrkYcxS97xMO/vFBRji5mOVNOG5YT1T/wlXJIQD/MdVECZlBGHxtWCyUPFmr UvKkgl5O9CT49AqdVYJPmfCAL3AWh0bIjaxiCqee+pmRpH0LELddkU5WKqbj9Q7Tkkpc SPAx2TP6/BvoCtKhU1I+/Vx+BlL/fExEBWtzH7EslKly7YbNtgKnzi1PXrpxecdUrGlq MBBnUACBBHPb9PhIWQk3fRKh644dbQNgKrkcYBnogzIi2hC4hBawOpWwpjzuJiNalytq Uxrg== X-Gm-Message-State: APt69E13D5bN+BXPPR/3g8F6H8aPl225OsHhn0piBKAD9M4KsstFi6xW jT6Tf+fZNb24dWAZTpjKIOWbxYRJeRY= X-Received: by 2002:a2e:3819:: with SMTP id f25-v6mr5191792lja.25.1530191261579; Thu, 28 Jun 2018 06:07:41 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d24-v6sm1314649lfl.53.2018.06.28.06.07.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jun 2018 06:07:40 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 4/9 v2] crypto: atmel-ecc: Provide config zone defines Date: Thu, 28 Jun 2018 15:07:24 +0200 Message-Id: <20180628130729.17589-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180628130729.17589-1-linus.walleij@linaro.org> References: <20180628130729.17589-1-linus.walleij@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The config zone has 0x16 words of 4 bytes each, so provide some basic defines so that we can address these individually. Rename the last word to "footer", this is where we currently look to see if the configuration is locked. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Diet the defines down to the ones used in this patch set. --- drivers/crypto/atmel-ecc.c | 2 +- drivers/crypto/atmel-ecc.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) -- 2.17.0 diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index baef0d07164d..98f9322ca303 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -145,7 +145,7 @@ static void atmel_ecc_init_read_cmd(struct atmel_ecc_cmd *cmd) * (UserExtra, Selector, LockValue, LockConfig). */ cmd->param1 = CONFIG_ZONE; - cmd->param2 = DEVICE_LOCK_ADDR; + cmd->param2 = CONFIG_ZONE_FOOTER; cmd->count = READ_COUNT; atmel_ecc_checksum(cmd); diff --git a/drivers/crypto/atmel-ecc.h b/drivers/crypto/atmel-ecc.h index 25232c8abcc2..d941c4f3d28f 100644 --- a/drivers/crypto/atmel-ecc.h +++ b/drivers/crypto/atmel-ecc.h @@ -89,8 +89,13 @@ static const struct { #define RSP_DATA_IDX 1 /* buffer index of data in response */ #define DATA_SLOT_2 2 /* used for ECDH private key */ -/* Definitions for the device lock state */ -#define DEVICE_LOCK_ADDR 0x15 +/* Definitions for the configuration zone words, these are 4 bytes each */ +#define CONFIG_ZONE_SERIAL_0_3 0x00 +#define CONFIG_ZONE_REVISION 0x01 +#define CONFIG_ZONE_SERIAL_4_7 0x02 +#define CONFIG_ZONE_SERIAL_8_I2CEN 0x03 +#define CONFIG_ZONE_I2C_OTP 0x04 +#define CONFIG_ZONE_FOOTER 0x15 #define LOCK_VALUE_IDX (RSP_DATA_IDX + 2) #define LOCK_CONFIG_IDX (RSP_DATA_IDX + 3)