2 * I2C Driver for Atmel ATSHA204 over I2C
4 * Copyright (C) 2014 Josh Datko, Cryptotronix, jbd@cryptotronix.com
5 * 2016 Tomas Hlavacek, CZ.NIC, tmshlvck@gmail.com
6 * 2017 Marek BehĂșn, CZ.NIC, kabel@kernel.org
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #ifndef _ATSHA204_I2C_H_
13 #define _ATSHA204_I2C_H_
17 ATSHA204A_ZONE_CONFIG = 0,
18 ATSHA204A_ZONE_OTP = 1,
19 ATSHA204A_ZONE_DATA = 2,
24 ATSHA204A_STATUS_SUCCESS = 0x00,
25 ATSHA204A_STATUS_MISCOMPARE = 0x01,
26 ATSHA204A_STATUS_PARSE_ERROR = 0x03,
27 ATSHA204A_STATUS_EXEC_ERROR = 0x0F,
28 ATSHA204A_STATUS_AFTER_WAKE = 0x11,
29 ATSHA204A_STATUS_CRC_ERROR = 0xFF,
34 ATSHA204A_FUNC_RESET = 0x00,
35 ATSHA204A_FUNC_SLEEP = 0x01,
36 ATSHA204A_FUNC_IDLE = 0x02,
37 ATSHA204A_FUNC_COMMAND = 0x03,
42 ATSHA204A_CMD_READ = 0x02,
43 ATSHA204A_CMD_RANDOM = 0x1B,
51 } __attribute__ ((packed));
61 } __attribute__ ((packed));
63 int atsha204a_wakeup(struct udevice *);
64 int atsha204a_idle(struct udevice *);
65 int atsha204a_sleep(struct udevice *);
66 int atsha204a_read(struct udevice *, enum atsha204a_zone, bool, u16, u8 *);
67 int atsha204a_get_random(struct udevice *, u8 *, size_t);
69 #endif /* _ATSHA204_I2C_H_ */