Re: [PATCH 4/9] crypto: atmel-ecc: Provide config zone defines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Linus,

On 06/05/2018 04:49 PM, Linus Walleij wrote:
The config zone has 0x16 words of 4 bytes each, so provide
some basic defines so that we can address these individually.

Are you going to use all these defines? I would add just the defines
that are needed, when they are needed, but I guess it's a matter of
preference.

Thanks,
ta

Rename the last word to "footer", this is where we currently
look to see if the configuration is locked.

Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
  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)



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux