From patchwork Tue Jun 5 13:49:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10448333 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 212CC60234 for ; Tue, 5 Jun 2018 13:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11B4029494 for ; Tue, 5 Jun 2018 13:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0648E294A6; Tue, 5 Jun 2018 13:50:34 +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 A173329494 for ; Tue, 5 Jun 2018 13:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751844AbeFENub (ORCPT ); Tue, 5 Jun 2018 09:50:31 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46145 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbeFENua (ORCPT ); Tue, 5 Jun 2018 09:50:30 -0400 Received: by mail-lf0-f67.google.com with SMTP id j13-v6so3684179lfb.13 for ; Tue, 05 Jun 2018 06:50:29 -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=CySNetqZe5E0/m66thWs0yXNuIrAKFFK6a4sW9fsogQ=; b=BvpEA5t1j1Gf7Ac3KrKFtdHNGSMl2u1N7UoZ0f4Pn/gkoAXaG6qE6Tw0VsEhBcr67F L/waVuzG/7yGdnj7aI7Ack08Wnt48P6P2gFJK5zroXMXEBsfWe30mQjxHhRcoqkhOgUa FXtCzD/UL0Mp53HwTCK2qXL8im+ar5GGwviiU= 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=CySNetqZe5E0/m66thWs0yXNuIrAKFFK6a4sW9fsogQ=; b=Fm0ELQl36dmf0ie+qmfLE6xvGwXX2b96zt0Ej5PqL+JgLKAHUgKmW3zx99EoWsYbwV l5xsiqadCbTwjWh1LE/oLnVn39+fWfTlw4W7Fy9PoEMZzhatnDgzj0Dwj/XwYlnjfoqY zRl51jTXJTJgdr6xjPdaRr70/2i2d0c1L5GeWosd92o8dXDSlZxob7CiZneysIco5sUZ KuOesS20g7Q5q8QjFulWfGgla1+ClP1OtehCDgWqw40g8iNKNU3nkfNg7GSwDB/cK5tM qb19qPx2ulJ0TjC8MLaxnbZm4Y0gBr8C8M/nGZPTuoDrQO2QrFSFVArDw5v89WnYIKAS +wtg== X-Gm-Message-State: APt69E1rGRP2wQXgUVB6JccyWOkyMO95U/t2u4uimzGn0EcuT39DZ/8A oBG3w+1B+ukfK1e10OYbCC+0LxcR8zo= X-Google-Smtp-Source: ADUXVKJmZlCyWwYuCl+si5SNwh1m/UMfhCJyCuzlp6vYA5woemjU4xUn46fhBSO1E7w4FMu2wefH5g== X-Received: by 2002:a2e:4dcc:: with SMTP id c73-v6mr14368252ljd.135.1528206628571; Tue, 05 Jun 2018 06:50:28 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x72-v6sm5201092lfi.52.2018.06.05.06.50.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:50:27 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 4/9] crypto: atmel-ecc: Provide config zone defines Date: Tue, 5 Jun 2018 15:49:45 +0200 Message-Id: <20180605134950.6605-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180605134950.6605-1-linus.walleij@linaro.org> References: <20180605134950.6605-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 --- drivers/crypto/atmel-ecc.c | 2 +- drivers/crypto/atmel-ecc.h | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index 214b0572bf8b..f1f422385a91 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..6d586a3e443d 100644 --- a/drivers/crypto/atmel-ecc.h +++ b/drivers/crypto/atmel-ecc.h @@ -89,8 +89,29 @@ 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_SLOT_0_1 0x05 +#define CONFIG_ZONE_SLOT_2_3 0x06 +#define CONFIG_ZONE_SLOT_4_5 0x07 +#define CONFIG_ZONE_SLOT_6_7 0x08 +#define CONFIG_ZONE_SLOT_8_9 0x09 +#define CONFIG_ZONE_SLOT_10_11 0x0a +#define CONFIG_ZONE_SLOT_12_13 0x0b +#define CONFIG_ZONE_SLOT_14_15 0x0c +#define CONFIG_ZONE_FLAG_0_1 0x0d +#define CONFIG_ZONE_FLAG_2_3 0x0e +#define CONFIG_ZONE_FLAG_4_5 0x0f +#define CONFIG_ZONE_FLAG_6_7 0x10 +#define CONFIG_ZONE_LKU_0_1 0x11 +#define CONFIG_ZONE_LKU_2_3 0x12 +#define CONFIG_ZONE_LKU_4_5 0x13 +#define CONFIG_ZONE_LKU_6_7 0x14 +#define CONFIG_ZONE_FOOTER 0x15 #define LOCK_VALUE_IDX (RSP_DATA_IDX + 2) #define LOCK_CONFIG_IDX (RSP_DATA_IDX + 3)