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: 137737 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp985989lji; Tue, 5 Jun 2018 06:50:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI0PvHYo2+XbmllVHAG9Kpim8GC7pnMroYebUcWewS8qSpZVHU0CyZDby5ZEsA9ug70lh/3 X-Received: by 2002:a17:902:14b:: with SMTP id 69-v6mr26975407plb.184.1528206634091; Tue, 05 Jun 2018 06:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528206634; cv=none; d=google.com; s=arc-20160816; b=BAY+n9BF6k12T8oL5SK7RHAe1ZKCXAmdyOwYkN5WhkZasOoaJEfd16meDsWQaQJz5a alI4c+eiMfxZAWOBLd68tQlLY+ao2GN+yiQSihpzEYjTltggZsoZSLwNV4TYmW+gX6mM xlhRGks75GJYu9kCOJkK7F0MXQbYmXglxfLlUWbX0iQAVv1L9AgRsnWYljrFrup8Op4F K5giPn4ijf5FjHKy08iadegBQ048Dct3EBiio4raPzsnNkYCKOyTPK6raKJdWdikAHHW gwjweaiCLQYzkCr/L0NtPa1c6NmYsCMKTEcM+SmugU7Wy0WDmiLTxq4yfBevu+zw3bxe T13g== 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=CySNetqZe5E0/m66thWs0yXNuIrAKFFK6a4sW9fsogQ=; b=ozJXsUhqq5n+UFn6wZNcP6NPTBG0E5vzKCPBeZ/1D+hYvOvK6KLHCnuQpwvX4Ysi7o ge6Jz2N09V1i5nKGDK5OwBDZR3vj4YzVzssn+XcSH3kDW6bvi2lcjQNtg/SECfg1Z/eZ rSJEy8WbvYTSQkSAbdf7pfDViHmiOOiQjvmRW8RwDLUH2qjqrjGXbkn8Oxhao09KS8to 46tHTSlq4zdV9OfnC9jvI/4xEgliDlO3bnQbmO3/H+kVtfLRwJRI5eagHGywbnFyqHhk WX/V3Wto7Syibc2v4z8tTkDYsnBCxzpylgNOwc4BWzTKXsznEMPgRw5XNkDRuPFBxVru g89A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BvpEA5t1; 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 j78-v6si24186154pfe.187.2018.06.05.06.50.33; Tue, 05 Jun 2018 06:50:34 -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=BvpEA5t1; 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 S1751844AbeFENub (ORCPT + 1 other); 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-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 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(-) -- 2.17.0 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)