diff mbox series

[4/9,v2] crypto: atmel-ecc: Provide config zone defines

Message ID 20180628130729.17589-4-linus.walleij@linaro.org
State New
Headers show
Series [1/9,v2] crypto: atmel-ecc: Make available for other platforms | expand

Commit Message

Linus Walleij June 28, 2018, 1:07 p.m. UTC
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 <linus.walleij@linaro.org>

---
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 mbox series

Patch

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)