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: 10493839 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA96160230 for ; Thu, 28 Jun 2018 13:07:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6EDE29FDF for ; Thu, 28 Jun 2018 13:07:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9EE929FE5; Thu, 28 Jun 2018 13:07:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7733029FDF for ; Thu, 28 Jun 2018 13:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965496AbeF1NHp (ORCPT ); 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-Google-Smtp-Source: AAOMgpcQ0kFgoExckNixS9aufGv5dIIsqidmBJB5A5LzCogtl9xWZ85Lqy5IO5+//15PkJZQeI/FaA== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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)